Skip to contentSkip to conversation

postgresql: new package

PATCH New Peter Seiderer 4 participants 6 messages Mar 31, 2014 – Apr 4, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 postgresql: new package

Based on suggested new package by Marco Trapanese ([1]).

[1] http://lists.busybox.net/pipermail/buildroot/2014-February/090661.html

---
Changes v2 -> v3:
- change data dir from /srv/pqsql/data to /var/lib/pgsql (as suggested by Thomas Petazzoni)
- fix POSTGRESQL_SITE url (removed cut and paste error) (as suggested by Thomas Petazzoni)
- remove superfluous POSTGRESQL_CONF_OPT prefix option (as suggested by Thomas Petazzoni)
- fix POSTGRESQL_USERS (remove superfluous own group) (as suggested by Yann E. MORIN)
- fix data dir install command (remove superfluous -v option) (as suggested by Yann E. MORIN)
- make readline an zlib optional (add hint in the help text instead)
(as suggested by Thomas Petazzoni)

Changes v1 -> v2:
- add postgresql user
- add postgresql data directory
- add sysv initialize and startup script

---
 package/Config.in                |  1 +
 package/postgresql/Config.in     | 20 +++++++++++++++
 package/postgresql/S50postgresql | 44 ++++++++++++++++++++++++++++++++
 package/postgresql/postgresql.mk | 54 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 119 insertions(+)
 create mode 100644 package/postgresql/Config.in
 create mode 100644 package/postgresql/S50postgresql
 create mode 100644 package/postgresql/postgresql.mk
package/Config.in +1 -0
index e816603..5805342 100644
@@ -544,6 +544,7 @@ source "package/berkeleydb/Config.in"
 source "package/cppdb/Config.in"
 source "package/gdbm/Config.in"
 source "package/mysql/Config.in"
+source "package/postgresql/Config.in"
 source "package/redis/Config.in"
 source "package/sqlcipher/Config.in"
 source "package/sqlite/Config.in"
package/postgresql/Config.in new file +20 -0
new file mode 100644
index 0000000..bc0305b
@@ -0,0 +1,20 @@
+config BR2_PACKAGE_POSTGRESQL
+	bool "PostgreSQL"
+	depends on BR2_INET_IPV6
+	select BR2_PACKAGE_READLINE
+	select BR2_PACKAGE_ZLIB
+	help
+	  PostgreSQL is a powerful, open source object-relational
+	  database system.
+
+	  Enable the readline package to gain readline support in
+	  pgsql (the command line interpreter), which offers
+	  command history and edit functions.
+
+	  Enable the zlib package to gain builtin compression for
+	  archives with pg_dump and pg_restore.
+
+	  http://www.postgresql.org
+
+comment "PostgreSQL needs a toolchain w/ IPv6"
+	depends on !BR2_INET_IPV6
package/postgresql/S50postgresql new file +44 -0

44 lines not on this page · raw message

package/postgresql/postgresql.mk new file +54 -0

54 lines not on this page · raw message

Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/1 postgresql: new package

Dear Peter Seiderer,

package/postgresql/Config.in line 2

Quoted 8 lines · Peter Seiderer
package/postgresql/Config.in new file +2 -0
new file mode 100644
index 0000000..bc0305b
@@ -0,0 +1,20 @@
+config BR2_PACKAGE_POSTGRESQL
+	bool "PostgreSQL"

lower case, please.

package/postgresql/Config.in line 3

Quoted 1 line
package/postgresql/Config.in new file +1 -0
+	depends on BR2_INET_IPV6

Since it currently doesn't build with uClibc, can you make this package depends on !BR2_TOOLCHAIN_USES_UCLIBC ?

package/postgresql/Config.in line 4

Quoted 1 line
package/postgresql/Config.in new file +1 -0
+if [ ! -f /srv/pgsql/data/PG_VERSION ]; then

I thought we changed to /var/lib/pgsql ?

Maybe you should create a variable that contains /var/lib/pgsql to avoid this duplication.

package/postgresql/Config.in line 8

Quoted 4 lines
package/postgresql/Config.in new file +4 -0
+ifeq ($(BR2_PACKAGE_ZLIB),y)
+	POSTGRESQL_DEPENDENCIES += zlib
+else
+	POSTGRESQL_CONF_OPT += --wihtout-zlib

Typo.

package/postgresql/Config.in line 11

Quoted 3 lines
package/postgresql/Config.in new file +3 -0
+ifeq ($(BR2_PACKAGE_OPENSSL),y)
+	POSTGRESQL_DEPENDENCIES += openssl
+	POSTGRESQL_CONF_OPT += --with-openssl

else

	POSTGRESQL_CONF_OPT += --without-openssl

Other than that, looks good.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 postgresql: new package

Quoted 4 lines · Thomas Petazzoni

Dear Peter Seiderer,

On Mon, 31 Mar 2014 08:59:29 +0200, Peter Seiderer wrote:

[snip[

Quoted 6 lines
Quoted 1 line

+if [ ! -f /srv/pgsql/data/PG_VERSION ]; then

I thought we changed to /var/lib/pgsql ?

Maybe you should create a variable that contains /var/lib/pgsql to avoid this duplication.

I'm opposed to such variables, I don't see how they give an advantage:

- they make the code less readable (you have to look up what POSTGRESQL_DATABASE_PATH expands to);

- they make the code longer (extra line for the assignment, and POSTGRESQL_DATABASE_PATH is not significantly shorter than /var/lib/pgsql);

- changing the path is quite trivial as long as it stays in the same file (I admit that I assume that you vi-users know how to escape a /).

Regards,
Arnout

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

PATCH 1/1 postgresql: new package

In reply to Thomas Petazzoni

Hello Thomas,

Quoted 10 lines

Gesendet: Donnerstag, 03. April 2014 um 22:39 Uhr
Von: "Thomas Petazzoni" <[email protected]>
An: "Peter Seiderer" <[email protected]>
Cc: buildroot at busybox.net, "Yann E. MORIN" <[email protected]>
Betreff: Re: [Buildroot] [PATCH] postgresql: new package

Dear Peter Seiderer,

On Mon, 31 Mar 2014 08:59:29 +0200, Peter Seiderer wrote:

Quoted 10 lines

package/postgresql/Config.in line 2

Quoted 8 lines
package/postgresql/Config.in new file +2 -0
new file mode 100644
index 0000000..bc0305b
@@ -0,0 +1,20 @@
+config BR2_PACKAGE_POSTGRESQL
+	bool "PostgreSQL"

lower case, please.

o.k.

Quoted 6 lines

package/postgresql/Config.in line 3

Quoted 2 lines
package/postgresql/Config.in new file +1 -0
+	depends on BR2_INET_IPV6

Since it currently doesn't build with uClibc, can you make this package depends on !BR2_TOOLCHAIN_USES_UCLIBC ?

o.k. postgresql compiles with uClibc without locale/i18n, will add appropriate dependency...

Quoted 5 lines

package/postgresql/Config.in line 4

Quoted 2 lines
package/postgresql/Config.in new file +1 -0
+if [ ! -f /srv/pgsql/data/PG_VERSION ]; then

I thought we changed to /var/lib/pgsql ?

sorry, missed that one, will fix...

Quoted 10 lines

Maybe you should create a variable that contains /var/lib/pgsql to avoid this duplication.

package/postgresql/Config.in line 8

Quoted 4 lines
package/postgresql/Config.in new file +4 -0
+ifeq ($(BR2_PACKAGE_ZLIB),y)
+	POSTGRESQL_DEPENDENCIES += zlib
+else
+	POSTGRESQL_CONF_OPT += --wihtout-zlib

Typo.

o.k, fixed...

Quoted 7 lines

package/postgresql/Config.in line 11

Quoted 4 lines
package/postgresql/Config.in new file +3 -0
+ifeq ($(BR2_PACKAGE_OPENSSL),y)
+	POSTGRESQL_DEPENDENCIES += openssl
+	POSTGRESQL_CONF_OPT += --with-openssl

else

	POSTGRESQL_CONF_OPT += --without-openssl

no need for the else branch, because no autodetection of openssl package (without openssl is the default already), but I can add a comment to make this clear?

Peter

Quoted 9 lines

Other than that, looks good.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 1/1 postgresql: new package

In reply to Peter Seiderer

Hi Peter,

Quoted 34 lines

Based on suggested new package by Marco Trapanese ([1]).

[1] http://lists.busybox.net/pipermail/buildroot/2014-February/090661.html

---
Changes v2 -> v3:
- change data dir from /srv/pqsql/data to /var/lib/pgsql (as suggested by Thomas Petazzoni)
- fix POSTGRESQL_SITE url (removed cut and paste error) (as suggested by Thomas Petazzoni)
- remove superfluous POSTGRESQL_CONF_OPT prefix option (as suggested by Thomas Petazzoni)
- fix POSTGRESQL_USERS (remove superfluous own group) (as suggested by Yann E. MORIN)
- fix data dir install command (remove superfluous -v option) (as suggested by Yann E. MORIN)
- make readline an zlib optional (add hint in the help text instead)
(as suggested by Thomas Petazzoni)

Changes v1 -> v2:
- add postgresql user
- add postgresql data directory
- add sysv initialize and startup script

---
  package/Config.in                |  1 +
  package/postgresql/Config.in     | 20 +++++++++++++++
  package/postgresql/S50postgresql | 44 ++++++++++++++++++++++++++++++++
  package/postgresql/postgresql.mk | 54 ++++++++++++++++++++++++++++++++++++++++
  4 files changed, 119 insertions(+)

create mode 100644 package/postgresql/Config.in create mode 100644 package/postgresql/S50postgresql create mode 100644 package/postgresql/postgresql.mk

[...]

Quoted 7 lines
package/postgresql/postgresql.mk new file +1 -0
new file mode 100644
index 0000000..fee4aed
@@ -0,0 +1,54 @@
+################################################################################

package/postgresql/postgresql.mk line 11

Quoted 10 lines
package/postgresql/postgresql.mk new file +10 -0
+#
+# postgresql
+#
+################################################################################
+
+POSTGRESQL_VERSION = 9.3.3
+POSTGRESQL_SOURCE = postgresql-$(POSTGRESQL_VERSION).tar.bz2
+POSTGRESQL_SITE = http://ftp.postgresql.org/pub/source/v$(POSTGRESQL_VERSION)
+POSTGRESQL_LICENSE = PostgreSQL
+POSTGRESQ_LICENSE_FILES = COPYRIGHT

typo
POSTGRESQL_LICENSE_FILES = COPYRIGHT

Regards,
Jerzy

Quoted 43 lines
package/postgresql/postgresql.mk new file +43 -0
+
+ifneq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
+	POSTGRESQL_CONF_OPT += --disable-thread-safety
+endif
+
+ifeq ($(BR2_PACKAGE_READLINE),y)
+	POSTGRESQL_DEPENDENCIES += readline
+else
+	POSTGRESQL_CONF_OPT += --wihtout-readline
+endif
+
+ifeq ($(BR2_PACKAGE_ZLIB),y)
+	POSTGRESQL_DEPENDENCIES += zlib
+else
+	POSTGRESQL_CONF_OPT += --wihtout-zlib
+endif
+
+ifeq ($(BR2_PACKAGE_TZDATA),y)
+	POSTGRESQL_DEPENDENCIES += tzdata
+	POSTGRESQL_CONF_OPT += --with-system-tzdata=/usr/share/zoneinfo
+endif
+
+ifeq ($(BR2_PACKAGE_OPENSSL),y)
+	POSTGRESQL_DEPENDENCIES += openssl
+	POSTGRESQL_CONF_OPT += --with-openssl
+endif
+
+define POSTGRESQL_USERS
+	postgres -1 postgres -1 * /var/lib/pgsql /bin/sh - PostgreSQL Server
+endef
+
+define POSTGRESQL_INSTALL_TARGET_FIXUP
+	$(INSTALL) -dm 0700 $(TARGET_DIR)/var/lib/pgsql
+endef
+
+POSTGRESQL_POST_INSTALL_TARGET_HOOKS += POSTGRESQL_INSTALL_TARGET_FIXUP
+
+define POSTGRESQL_INSTALL_INIT_SYSV
+	$(INSTALL) -m 0755 -D package/postgresql/S50postgresql \
+		$(TARGET_DIR)/etc/init.d/S50postgresql
+endef
+
+$(eval $(autotools-package))
#5 lore raw

PATCH 1/1 postgresql: new package

Hello Jerzy,

Quoted 5 lines

Gesendet: Donnerstag, 03. April 2014 um 23:55 Uhr
Von: "Jerzy Grzegorek" <[email protected]>
An: "Peter Seiderer" <[email protected]>, buildroot at busybox.net
Betreff: Re: [Buildroot] [PATCH] postgresql: new package

[...]

Quoted 23 lines
Quoted 8 lines
package/postgresql/postgresql.mk new file +1 -0
new file mode 100644
index 0000000..fee4aed
@@ -0,0 +1,54 @@
+################################################################################

package/postgresql/postgresql.mk line 11

Quoted 10 lines
package/postgresql/postgresql.mk new file +10 -0
+#
+# postgresql
+#
+################################################################################
+
+POSTGRESQL_VERSION = 9.3.3
+POSTGRESQL_SOURCE = postgresql-$(POSTGRESQL_VERSION).tar.bz2
+POSTGRESQL_SITE = http://ftp.postgresql.org/pub/source/v$(POSTGRESQL_VERSION)
+POSTGRESQL_LICENSE = PostgreSQL
+POSTGRESQ_LICENSE_FILES = COPYRIGHT

typo
POSTGRESQL_LICENSE_FILES = COPYRIGHT

Quoted 3 lines

Regards,
Jerzy

Thank you for the review, will fix this on for the next version... Regards,
Peter