From 4f5a423f921ed7dad66768141b819507d3a3397d Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Wed, 5 Sep 2018 12:58:20 +0200 Subject: [PATCH] import from merge review Resolves: rhbz#1623766 Version: 10.5-1 --- .gitignore | 1 + libecpg-10.5-external-libpq.patch | 40 +++++++++ libecpg-10.5-no-compat-lib.patch | 16 ++++ libecpg-10.5-rpm-pgsql.patch | 72 ++++++++++++++++ libecpg-10.5-var-run-socket.patch | 53 ++++++++++++ libecpg.spec | 137 ++++++++++++++++++++++++++++++ sources | 2 + 7 files changed, 321 insertions(+) create mode 100644 .gitignore create mode 100644 libecpg-10.5-external-libpq.patch create mode 100644 libecpg-10.5-no-compat-lib.patch create mode 100644 libecpg-10.5-rpm-pgsql.patch create mode 100644 libecpg-10.5-var-run-socket.patch create mode 100644 libecpg.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d83a125 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/postgresql-*.tar.bz2* diff --git a/libecpg-10.5-external-libpq.patch b/libecpg-10.5-external-libpq.patch new file mode 100644 index 0000000..bf0001b --- /dev/null +++ b/libecpg-10.5-external-libpq.patch @@ -0,0 +1,40 @@ +We don't build/install interfaces by upstream's implicit rules. + +This patch is used on two places; postgresql.spec and libecpg.spec -- keep those +in sync! + +Related: rhbz#1618698 + +diff --git a/src/Makefile b/src/Makefile +index febbced..9737b55 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -20,7 +20,6 @@ SUBDIRS = \ + backend/utils/mb/conversion_procs \ + backend/snowball \ + include \ +- interfaces \ + backend/replication/libpqwalreceiver \ + backend/replication/pgoutput \ + fe_utils \ +diff --git a/src/Makefile.global.in b/src/Makefile.global.in +index 4ed5174..d0e0dae 100644 +--- a/src/Makefile.global.in ++++ b/src/Makefile.global.in +@@ -457,7 +457,7 @@ endif + + # This macro is for use by libraries linking to libpq. (Because libpgport + # isn't created with the same link flags as libpq, it can't be used.) +-libpq = -L$(libpq_builddir) -lpq ++libpq = -lpq + + # This macro is for use by client executables (not libraries) that use libpq. + # We force clients to pull symbols from the non-shared libraries libpgport +@@ -483,7 +483,6 @@ endif + # Commonly used submake targets + + submake-libpq: +- $(MAKE) -C $(libpq_builddir) all + + submake-libpgport: + $(MAKE) -C $(top_builddir)/src/port all diff --git a/libecpg-10.5-no-compat-lib.patch b/libecpg-10.5-no-compat-lib.patch new file mode 100644 index 0000000..d1d64e0 --- /dev/null +++ b/libecpg-10.5-no-compat-lib.patch @@ -0,0 +1,16 @@ +Nothing ever depended on libecpg_compat.so.3 in Fedora, so don't build +it now, at least till somebody explicitly requests that. + +diff --git a/src/interfaces/ecpg/Makefile b/src/interfaces/ecpg/Makefile +index 41460a1..cc3dd37 100644 +--- a/src/interfaces/ecpg/Makefile ++++ b/src/interfaces/ecpg/Makefile +@@ -2,7 +2,7 @@ subdir = src/interfaces/ecpg + top_builddir = ../../.. + include $(top_builddir)/src/Makefile.global + +-SUBDIRS = include pgtypeslib ecpglib compatlib preproc ++SUBDIRS = include pgtypeslib ecpglib preproc + + # Suppress parallel build of subdirectories to avoid a bug in GNU make 3.82, cf + # http://savannah.gnu.org/bugs/?30653 diff --git a/libecpg-10.5-rpm-pgsql.patch b/libecpg-10.5-rpm-pgsql.patch new file mode 100644 index 0000000..aec64ac --- /dev/null +++ b/libecpg-10.5-rpm-pgsql.patch @@ -0,0 +1,72 @@ +For the RPMs, we want the custom installation directories to end in +/pgsql not /postgresql. This is historical but not worth changing. + +Notice that this patch also makes the appending of /pgsql unconditional. +This is to avoid unexpected behavior if the RPM is built in a working +directory whose path happens to include "postgres" or "pgsql" already. +However, datadir and sysconfdir are already set up in the specfile's +configure call, so we do not have to append anything to them. + + +diff -Naur postgresql-9.0.1.orig/src/Makefile.global.in postgresql-9.0.1/src/Makefile.global.in +--- postgresql-9.0.1.orig/src/Makefile.global.in 2010-10-01 10:25:44.000000000 -0400 ++++ postgresql-9.0.1/src/Makefile.global.in 2010-10-11 11:52:05.224975308 -0400 +@@ -55,8 +55,7 @@ + # Installation directories + # + # These are set by the equivalent --xxxdir configure options. We +-# append "postgresql" to some of them, if the string does not already +-# contain "pgsql" or "postgres", in order to avoid directory clutter. ++# append "pgsql" to some of them, in order to avoid directory clutter. + # + # In a PGXS build, we cannot use the values inserted into Makefile.global + # by configure, since the installation tree may have been relocated. +@@ -74,45 +73,23 @@ + bindir := @bindir@ + + datadir := @datadir@ +-ifeq "$(findstring pgsql, $(datadir))" "" +-ifeq "$(findstring postgres, $(datadir))" "" +-override datadir := $(datadir)/postgresql +-endif +-endif + + sysconfdir := @sysconfdir@ +-ifeq "$(findstring pgsql, $(sysconfdir))" "" +-ifeq "$(findstring postgres, $(sysconfdir))" "" +-override sysconfdir := $(sysconfdir)/postgresql +-endif +-endif + + libdir := @libdir@ + + pkglibdir = $(libdir) +-ifeq "$(findstring pgsql, $(pkglibdir))" "" +-ifeq "$(findstring postgres, $(pkglibdir))" "" +-override pkglibdir := $(pkglibdir)/postgresql +-endif +-endif ++override pkglibdir := $(pkglibdir)/pgsql + + includedir := @includedir@ + + pkgincludedir = $(includedir) +-ifeq "$(findstring pgsql, $(pkgincludedir))" "" +-ifeq "$(findstring postgres, $(pkgincludedir))" "" +-override pkgincludedir := $(pkgincludedir)/postgresql +-endif +-endif ++override pkgincludedir := $(pkgincludedir)/pgsql + + mandir := @mandir@ + + docdir := @docdir@ +-ifeq "$(findstring pgsql, $(docdir))" "" +-ifeq "$(findstring postgres, $(docdir))" "" +-override docdir := $(docdir)/postgresql +-endif +-endif ++override docdir := $(docdir)/pgsql + + htmldir := @htmldir@ + diff --git a/libecpg-10.5-var-run-socket.patch b/libecpg-10.5-var-run-socket.patch new file mode 100644 index 0000000..8e3b193 --- /dev/null +++ b/libecpg-10.5-var-run-socket.patch @@ -0,0 +1,53 @@ +Change the built-in default socket directory to be /var/run/postgresql. +For backwards compatibility with (probably non-libpq-based) clients that +might still expect to find the socket in /tmp, also create a socket in +/tmp. This is to resolve communication problems with clients operating +under systemd's PrivateTmp environment, which won't be using the same +global /tmp directory as the server; see bug #825448. + +Note that we apply the socket directory change at the level of the +hard-wired defaults in the C code, not by just twiddling the setting in +postgresql.conf.sample; this is so that the change will take effect on +server package update, without requiring any existing postgresql.conf +to be updated. (Of course, a user who dislikes this behavior can still +override it via postgresql.conf.) + +diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c +index 9481f2d..75532c7 100644 +--- a/src/backend/utils/misc/guc.c ++++ b/src/backend/utils/misc/guc.c +@@ -3196,7 +3196,7 @@ static struct config_string ConfigureNamesString[] = + }, + &Unix_socket_directories, + #ifdef HAVE_UNIX_SOCKETS +- DEFAULT_PGSOCKET_DIR, ++ DEFAULT_PGSOCKET_DIR ", /tmp", + #else + "", + #endif +diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c +index feeff9e..3e3d784 100644 +--- a/src/bin/initdb/initdb.c ++++ b/src/bin/initdb/initdb.c +@@ -1234,7 +1234,7 @@ setup_config(void) + + #ifdef HAVE_UNIX_SOCKETS + snprintf(repltok, sizeof(repltok), "#unix_socket_directories = '%s'", +- DEFAULT_PGSOCKET_DIR); ++ DEFAULT_PGSOCKET_DIR ", /tmp"); + #else + snprintf(repltok, sizeof(repltok), "#unix_socket_directories = ''"); + #endif +diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h +index e278fa0..9ee15d4 100644 +--- a/src/include/pg_config_manual.h ++++ b/src/include/pg_config_manual.h +@@ -169,7 +169,7 @@ + * here's where to twiddle it. You can also override this at runtime + * with the postmaster's -k switch. + */ +-#define DEFAULT_PGSOCKET_DIR "/tmp" ++#define DEFAULT_PGSOCKET_DIR "/var/run/postgresql" + + /* + * This is the default event source for Windows event log. diff --git a/libecpg.spec b/libecpg.spec new file mode 100644 index 0000000..9088b15 --- /dev/null +++ b/libecpg.spec @@ -0,0 +1,137 @@ +%global majorversion 10 + +Summary: ECPG - Embedded SQL in C +Name: libecpg +Version: %majorversion.5 +Release: 1%{?dist} + +License: PostgreSQL +Url: http://www.postgresql.org/ + +Source0: https://ftp.postgresql.org/pub/source/v%version/postgresql-%version.tar.bz2 +Source1: https://ftp.postgresql.org/pub/source/v%version/postgresql-%version.tar.bz2.sha256 + + +# Comments for these patches are in the patch files. +Patch1: libecpg-10.5-rpm-pgsql.patch +Patch2: libecpg-10.5-var-run-socket.patch +Patch3: libecpg-10.5-external-libpq.patch +Patch4: libecpg-10.5-no-compat-lib.patch + +BuildRequires: gcc +BuildRequires: glibc-devel bison flex gawk +BuildRequires: zlib-devel +BuildRequires: openssl-devel +BuildRequires: krb5-devel +BuildRequires: openldap-devel +BuildRequires: libpq-devel +BuildRequires: gettext +BuildRequires: multilib-rpm-config + +%description +An embedded SQL program consists of code written in an ordinary programming +language, in this case C, mixed with SQL commands in specially marked sections. +To build the program, the source code (*.pgc) is first passed through the +embedded SQL preprocessor, which converts it to an ordinary C program (*.c), and +afterwards it can be processed by a C compiler. + + +%package devel +Summary: Development files for ECPG - Embedded SQL in C +Requires: %name%{?_isa} = %version-%release +Requires: libpgtypes%{?_isa} = %version-%release + +%description devel +ECPG development files. You will need to install this package to build any +package or any clients that use the ECPG to connect to a PostgreSQL server. + + +%package -n libpgtypes +Summary: Map PostgreSQL database types to C equivalents + +%description -n libpgtypes +The pgtypes library maps PostgreSQL database types to C equivalents that can be +used in C programs. It also offers functions to do basic calculations with those +types within C, i.e., without the help of the PostgreSQL server. + + +%prep +( cd "$(dirname "%SOURCE1")" ; sha256sum -c "%SOURCE1" ) +%autosetup -n postgresql-%version -p1 + +# remove .gitignore files to ensure none get into the RPMs (bug #642210) +find . -type f -name .gitignore | xargs rm + + +%build +# We don't build server nor client (e.g. /bin/psql) binaries in this package, so +# we can disable some configure options. +%configure \ + --disable-rpath \ + --with-ldap \ + --with-openssl \ + --with-gssapi \ + --enable-nls \ + --without-readline \ + --datadir=%_datadir/pgsql + +# TODO: can those be built automatically? +make -C "src/backend" ../../src/include/utils/fmgroids.h +make -C "src/backend" ../../src/include/utils/fmgrprotos.h + +%make_build -C "src/interfaces/ecpg" + + +%install +%make_install -C "src/interfaces/ecpg" + +# remove files not to be packaged +find $RPM_BUILD_ROOT -name '*.a' -delete + +%multilib_fix_c_header --file "%{_includedir}/ecpg_config.h" + +# function from postgresql.spec +find_lang_bins () +{ + lstfile=$1 ; shift + cp /dev/null "$lstfile" + for binary; do + %find_lang "$binary"-%majorversion + cat "$binary"-%majorversion.lang >>"$lstfile" + done +} + +find_lang_bins %name.lst ecpglib6 +find_lang_bins %name-devel.lst ecpg + + +%files -f %name.lst +%license COPYRIGHT +%_libdir/libecpg.so.6* + + +%files -n libpgtypes +%license COPYRIGHT +%_libdir/libpgtypes.so.3* + + +%files devel -f %name-devel.lst +%_bindir/ecpg +%_libdir/libecpg.so +%_libdir/libpgtypes.so +%_libdir/pkgconfig/libecpg.pc +%_libdir/pkgconfig/libpgtypes.pc +%_includedir/ecpg*.h +%_includedir/pgsql/informix +%_includedir/pgtypes*.h +%_includedir/sql3types.h +%_includedir/sqlca.h +%_includedir/sqlda*.h + + +%changelog +* Thu Aug 30 2018 Pavel Raiskup - 10.5-1 +- slight simplification before review + +* Thu Aug 16 2018 Pavel Raiskup - 10.5-0.1 +- initial packaging diff --git a/sources b/sources new file mode 100644 index 0000000..a655c26 --- /dev/null +++ b/sources @@ -0,0 +1,2 @@ +SHA512 (postgresql-10.5.tar.bz2) = 1bad30ae88beca66f7e8b99b82e7f02aac1e9230b328e6e5a762a704cdd9dc767d924f5a66c68c93586badfef91b7ff336120a567ce970eaa58bb44c662ad48c +SHA512 (postgresql-10.5.tar.bz2.sha256) = f4b2bf3c6454905caf4bd5a9a53dec33e7ac6c7593e6464bf75bcd12b185bc1c54f925a088122d8819840a17bbda84e8b42c311a639d7457090ace74725971f9