diff mbox series

[1/2] package/postgresql: allow to select postgresql version

Message ID 20201229095255.183687-2-fido_max@inbox.ru
State Changes Requested
Headers show
Series package/timescaledb: Don't build with postgresql 13 | expand

Commit Message

Maxim Kochetkov Dec. 29, 2020, 9:52 a.m. UTC
Some packages (like timescaledb) needs older version of PostgreSQL.
Another use case is supporting older database format. PostgreSQL can't
automatically upgrade database to next major version.

Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
---
 package/postgresql/Config.in       | 24 ++++++++++++++++++++++++
 package/postgresql/postgresql.hash |  3 +++
 package/postgresql/postgresql.mk   |  2 +-
 3 files changed, 28 insertions(+), 1 deletion(-)

Comments

Yann E. MORIN Dec. 29, 2020, 5:49 p.m. UTC | #1
Maxim, All,

On 2020-12-29 12:52 +0300, Maxim Kochetkov via buildroot spake thusly:
> Some packages (like timescaledb) needs older version of PostgreSQL.

As replied to the cover letter: what about bumping tiemscaledb?

> Another use case is supporting older database format. PostgreSQL can't
> automatically upgrade database to next major version.

There are a lot of other packages that may require migrating data when
upgrading; we can't have a version choice for all those.

So, I've marked this patch, and follosing, as Changes Requested in our
patchwork.

Regards,
Yann E. MORIN.

> Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
> ---
>  package/postgresql/Config.in       | 24 ++++++++++++++++++++++++
>  package/postgresql/postgresql.hash |  3 +++
>  package/postgresql/postgresql.mk   |  2 +-
>  3 files changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/package/postgresql/Config.in b/package/postgresql/Config.in
> index 2f677daf5b..aa9b28dcb3 100644
> --- a/package/postgresql/Config.in
> +++ b/package/postgresql/Config.in
> @@ -22,3 +22,27 @@ config BR2_PACKAGE_POSTGRESQL
>  comment "postgresql needs a toolchain w/ dynamic library, wchar"
>  	depends on BR2_USE_MMU
>  	depends on BR2_STATIC_LIBS || !BR2_USE_WCHAR
> +
> +if BR2_PACKAGE_POSTGRESQL
> +
> +choice
> +	prompt "PostgreSQL Version"
> +	default BR2_POSTGRESQL_VERSION_12
> +	help
> +	  Select the version of postgresql you wish to use.
> +
> +config BR2_POSTGRESQL_VERSION_12
> +	bool "postgresql 12"
> +
> +config BR2_POSTGRESQL_VERSION_13
> +	bool "postgresql 13"
> +
> +endchoice
> +
> +config BR2_POSTGRESQL_VERSION
> +	string
> +	default "12.5"    if BR2_POSTGRESQL_VERSION_12
> +	default "13.1"    if BR2_POSTGRESQL_VERSION_13
> +	depends on BR2_PACKAGE_POSTGRESQL
> +
> +endif
> diff --git a/package/postgresql/postgresql.hash b/package/postgresql/postgresql.hash
> index ef676cccc4..ed61e79a09 100644
> --- a/package/postgresql/postgresql.hash
> +++ b/package/postgresql/postgresql.hash
> @@ -1,5 +1,8 @@
>  # From https://ftp.postgresql.org/pub/source/v13.1/postgresql-13.1.tar.bz2.sha256
>  sha256  12345c83b89aa29808568977f5200d6da00f88a035517f925293355432ffe61f  postgresql-13.1.tar.bz2
>  
> +# From https://ftp.postgresql.org/pub/source/v13.1/postgresql-12.5.tar.bz2.sha256
> +sha256  bd0d25341d9578b5473c9506300022de26370879581f5fddd243a886ce79ff95  postgresql-12.5.tar.bz2
> +
>  # License file, Locally calculated
>  sha256  739e5d454d81d31a482469338b7c856f1f5c6b4cdda1551cea6f0f6d18eef62c  COPYRIGHT
> diff --git a/package/postgresql/postgresql.mk b/package/postgresql/postgresql.mk
> index 98361c00c8..09f226bd85 100644
> --- a/package/postgresql/postgresql.mk
> +++ b/package/postgresql/postgresql.mk
> @@ -4,7 +4,7 @@
>  #
>  ################################################################################
>  
> -POSTGRESQL_VERSION = 13.1
> +POSTGRESQL_VERSION = $(call qstrip,$(BR2_POSTGRESQL_VERSION))
>  POSTGRESQL_SOURCE = postgresql-$(POSTGRESQL_VERSION).tar.bz2
>  POSTGRESQL_SITE = https://ftp.postgresql.org/pub/source/v$(POSTGRESQL_VERSION)
>  POSTGRESQL_LICENSE = PostgreSQL
> -- 
> 2.29.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/package/postgresql/Config.in b/package/postgresql/Config.in
index 2f677daf5b..aa9b28dcb3 100644
--- a/package/postgresql/Config.in
+++ b/package/postgresql/Config.in
@@ -22,3 +22,27 @@  config BR2_PACKAGE_POSTGRESQL
 comment "postgresql needs a toolchain w/ dynamic library, wchar"
 	depends on BR2_USE_MMU
 	depends on BR2_STATIC_LIBS || !BR2_USE_WCHAR
+
+if BR2_PACKAGE_POSTGRESQL
+
+choice
+	prompt "PostgreSQL Version"
+	default BR2_POSTGRESQL_VERSION_12
+	help
+	  Select the version of postgresql you wish to use.
+
+config BR2_POSTGRESQL_VERSION_12
+	bool "postgresql 12"
+
+config BR2_POSTGRESQL_VERSION_13
+	bool "postgresql 13"
+
+endchoice
+
+config BR2_POSTGRESQL_VERSION
+	string
+	default "12.5"    if BR2_POSTGRESQL_VERSION_12
+	default "13.1"    if BR2_POSTGRESQL_VERSION_13
+	depends on BR2_PACKAGE_POSTGRESQL
+
+endif
diff --git a/package/postgresql/postgresql.hash b/package/postgresql/postgresql.hash
index ef676cccc4..ed61e79a09 100644
--- a/package/postgresql/postgresql.hash
+++ b/package/postgresql/postgresql.hash
@@ -1,5 +1,8 @@ 
 # From https://ftp.postgresql.org/pub/source/v13.1/postgresql-13.1.tar.bz2.sha256
 sha256  12345c83b89aa29808568977f5200d6da00f88a035517f925293355432ffe61f  postgresql-13.1.tar.bz2
 
+# From https://ftp.postgresql.org/pub/source/v13.1/postgresql-12.5.tar.bz2.sha256
+sha256  bd0d25341d9578b5473c9506300022de26370879581f5fddd243a886ce79ff95  postgresql-12.5.tar.bz2
+
 # License file, Locally calculated
 sha256  739e5d454d81d31a482469338b7c856f1f5c6b4cdda1551cea6f0f6d18eef62c  COPYRIGHT
diff --git a/package/postgresql/postgresql.mk b/package/postgresql/postgresql.mk
index 98361c00c8..09f226bd85 100644
--- a/package/postgresql/postgresql.mk
+++ b/package/postgresql/postgresql.mk
@@ -4,7 +4,7 @@ 
 #
 ################################################################################
 
-POSTGRESQL_VERSION = 13.1
+POSTGRESQL_VERSION = $(call qstrip,$(BR2_POSTGRESQL_VERSION))
 POSTGRESQL_SOURCE = postgresql-$(POSTGRESQL_VERSION).tar.bz2
 POSTGRESQL_SITE = https://ftp.postgresql.org/pub/source/v$(POSTGRESQL_VERSION)
 POSTGRESQL_LICENSE = PostgreSQL