modularity: drop '*-libs' and '*-devel' subpackages

The PostgreSQL shared libraries are moved to 'libpq' and 'libecpg'
packages, which allows us to have single library version per
Fedora release, even though we will provide multiple versions of
PostgreSQL servers.

Related: rhbz#1618698
Version: 10.5-4
This commit is contained in:
Pavel Raiskup 2018-09-05 07:54:34 +02:00
parent b46d68a9cb
commit ffc865e4a8
3 changed files with 133 additions and 70 deletions

View File

@ -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

View File

@ -0,0 +1,59 @@
We should ideally provide '/bin/pg_config' in postgresql-server-devel, and
provide no pg_config binary in libpq package. But most of the Fedora packages
that use pg_config actually only build against PG libraries (and
postgresql-server-devel isn't needed). So.., to avoid the initial rush around
rhbz#1618698 change, rather provide pg_server_config binary, which int urn means
that we'll have to fix only a minimal set of packages which really build
PostgreSQL server modules.
diff --git a/src/bin/pg_config/Makefile b/src/bin/pg_config/Makefile
index c410087..e546b7b 100644
--- a/src/bin/pg_config/Makefile
+++ b/src/bin/pg_config/Makefile
@@ -11,28 +11,30 @@
PGFILEDESC = "pg_config - report configuration information"
PGAPPICON=win32
+PG_CONFIG = pg_server_config$(X)
+
subdir = src/bin/pg_config
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
OBJS= pg_config.o $(WIN32RES)
-all: pg_config
+all: $(PG_CONFIG)
-pg_config: $(OBJS) | submake-libpgport
- $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
+$(PG_CONFIG): $(OBJS) | submake-libpgport
+ $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
install: all installdirs
- $(INSTALL_SCRIPT) pg_config$(X) '$(DESTDIR)$(bindir)/pg_config$(X)'
+ $(INSTALL_SCRIPT) $(PG_CONFIG) '$(DESTDIR)$(bindir)/$(PG_CONFIG)'
installdirs:
$(MKDIR_P) '$(DESTDIR)$(bindir)'
uninstall:
- rm -f '$(DESTDIR)$(bindir)/pg_config$(X)'
+ rm -f '$(DESTDIR)$(bindir)/$(PG_CONFIG)'
clean distclean maintainer-clean:
- rm -f pg_config$(X) $(OBJS)
+ rm -f $(PG_CONFIG) $(OBJS)
rm -rf tmp_check
check:
diff --git a/src/bin/pg_config/nls.mk b/src/bin/pg_config/nls.mk
index 1d41f90ee0..0f34f371cc 100644
--- a/src/bin/pg_config/nls.mk
+++ b/src/bin/pg_config/nls.mk
@@ -1,4 +1,4 @@
# src/bin/pg_config/nls.mk
-CATALOG_NAME = pg_config
+CATALOG_NAME = pg_server_config
AVAIL_LANGUAGES = cs de es fr he it ja ko nb pl pt_BR ro ru sv ta tr zh_CN zh_TW
GETTEXT_FILES = pg_config.c ../../common/config_info.c ../../common/exec.c

View File

@ -59,7 +59,7 @@ Summary: PostgreSQL client programs
Name: postgresql
%global majorversion 10
Version: 10.5
Release: 3%{?dist}
Release: 4%{?dist}
# The PostgreSQL license is very similar to other MIT licenses, but the OSI
# recognizes it as an independent license, so we do as well.
@ -105,6 +105,8 @@ Patch1: rpm-pgsql.patch
Patch2: postgresql-logging.patch
Patch5: postgresql-var-run-socket.patch
Patch6: postgresql-man.patch
Patch8: postgresql-external-libpq.patch
Patch9: postgresql-server-pg_config.patch
BuildRequires: gcc
BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk
@ -115,6 +117,7 @@ BuildRequires: perl-generators
BuildRequires: readline-devel zlib-devel
BuildRequires: systemd systemd-devel util-linux
BuildRequires: multilib-rpm-config
BuildRequires: libpq-devel
# postgresql-setup build requires
BuildRequires: m4 elinks docbook-utils help2man
@ -167,9 +170,6 @@ BuildRequires: systemtap-sdt-devel
BuildRequires: libselinux-devel
%endif
# main package requires -libs subpackage
Requires: %{name}-libs%{?_isa} = %precise_version
# https://bugzilla.redhat.com/1464368
%global __provides_exclude_from %{_libdir}/pgsql
@ -183,32 +183,17 @@ over a network connection. The PostgreSQL server can be found in the
postgresql-server sub-package.
%package libs
Summary: The shared libraries required for any PostgreSQL clients
Group: Applications/Databases
# for /sbin/ldconfig
Requires(post): glibc
Requires(postun): glibc
%description libs
The postgresql-libs package provides the essential shared libraries for any
PostgreSQL client program or interface. You will need to install this package
to use any other PostgreSQL package or any clients that need to connect to a
PostgreSQL server.
%package server
Summary: The programs needed to create and run a PostgreSQL server
Group: Applications/Databases
Requires: %{name}%{?_isa} = %precise_version
Requires: %{name}-libs%{?_isa} = %precise_version
Requires(pre): /usr/sbin/useradd
# We require this to be present for %%{_prefix}/lib/tmpfiles.d
Requires: systemd
# Make sure it's there when scriptlets run, too
%{?systemd_requires}
# Packages which provide postgresql plugins should build-require
# postgresql-devel and require
# postgresql-server-devel and require
# postgresql-server(:MODULE_COMPAT_%%{postgresql_major}).
# This will automatically guard against incompatible server & plugin
# installation (#1008939, #1007840)
@ -239,28 +224,19 @@ and source files for the PostgreSQL tutorial.
Summary: Extension modules distributed with PostgreSQL
Group: Applications/Databases
Requires: %{name}%{?_isa} = %precise_version
Requires: %{name}-libs%{?_isa} = %precise_version
%description contrib
The postgresql-contrib package contains various extension modules that are
included in the PostgreSQL distribution.
%package devel
%package server-devel
Summary: PostgreSQL development header files and libraries
Group: Development/Libraries
Requires: %{name}-libs%{?_isa} = %precise_version
Provides: libpq-devel = %precise_version
Provides: libecpg-devel = %precise_version
Provides: postgresql-server-devel = %precise_version
%description devel
The postgresql-devel package contains the header files and libraries
needed to compile C or C++ applications which will directly interact
with a PostgreSQL database management server. It also contains the ecpg
Embedded C Postgres preprocessor. You need to install this package if you want
to develop applications which will interact with a PostgreSQL server.
%description server-devel
The postgresql-server-devel package contains the header files and configuration
needed to compile PostgreSQL server extension.
%package test-rpm-macros
Summary: Convenience RPM macros for build-time testing against PostgreSQL server
@ -273,7 +249,7 @@ that want to run build-time testsuite against running PostgreSQL server.
%package static
Summary: Statically linked PostgreSQL libraries
Requires: %{name}-devel%{?_isa} = %precise_version
Requires: %{name}-server-devel%{?_isa} = %precise_version
%description static
Statically linked PostgreSQL libraries that do not have dynamically linked
@ -285,8 +261,7 @@ counterparts.
Summary: Support for upgrading from the previous major release of PostgreSQL
Group: Applications/Databases
Requires: %{name}-server%{?_isa} = %precise_version
Requires: %{name}-libs%{?_isa} = %precise_version
Provides: bundled(postgresql-libs) = %prevversion
Provides: bundled(postgresql-server) = %prevversion
%description upgrade
The postgresql-upgrade package contains the pg_upgrade utility and supporting
@ -368,7 +343,7 @@ Install this if you want to write database functions in Tcl.
Summary: The test suite distributed with PostgreSQL
Group: Applications/Databases
Requires: %{name}-server%{?_isa} = %precise_version
Requires: %{name}-devel%{?_isa} = %precise_version
Requires: %{name}-server-devel%{?_isa} = %precise_version
%description test
The postgresql-test package contains files needed for various tests for the
@ -390,6 +365,8 @@ benchmarks.
%patch2 -p1
%patch5 -p1
%patch6 -p1
%patch8 -p1
%patch9 -p1
# We used to run autoconf here, but there's no longer any real need to,
# since Postgres ships with a reasonably modern configure script.
@ -668,6 +645,13 @@ EOF
make DESTDIR=$RPM_BUILD_ROOT install-world
# We ship pg_config through libpq-devel
mv $RPM_BUILD_ROOT/%_mandir/man1/pg_{,server_}config.1
rm $RPM_BUILD_ROOT/%_includedir/pg_config*.h
rm $RPM_BUILD_ROOT/%_includedir/libpq/libpq-fs.h
rm $RPM_BUILD_ROOT/%_includedir/postgres_ext.h
rm -r $RPM_BUILD_ROOT/%_includedir/pgsql/internal/
%if %plpython3
mv src/Makefile.global src/Makefile.global.save
cp src/Makefile.global.python3 src/Makefile.global
@ -682,11 +666,8 @@ make DESTDIR=$RPM_BUILD_ROOT install-world
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/pgsql/contrib
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/pgsql/extension
# multilib header hack; some headers are installed in two places!
# multilib header hack
for header in \
%{_includedir}/pg_config.h \
%{_includedir}/pg_config_ext.h \
%{_includedir}/ecpg_config.h \
%{_includedir}/pgsql/server/pg_config.h \
%{_includedir}/pgsql/server/pg_config_ext.h
do
@ -717,6 +698,8 @@ install -d -m 700 $RPM_BUILD_ROOT%{?_localstatedir}/lib/pgsql/backups
# postgres' .bash_profile
install -m 644 %{SOURCE11} $RPM_BUILD_ROOT%{?_localstatedir}/lib/pgsql/.bash_profile
rm $RPM_BUILD_ROOT/%{_datadir}/man/man1/ecpg.1
%if %upgrade
pushd postgresql-%{prevversion}
make DESTDIR=$RPM_BUILD_ROOT install
@ -794,7 +777,7 @@ mv $RPM_BUILD_ROOT%{_docdir}/pgsql/html doc
rm -rf $RPM_BUILD_ROOT%{_docdir}/pgsql
# remove files not to be packaged
rm $RPM_BUILD_ROOT%{_libdir}/lib{ecpg,pq,ecpg_compat,pgfeutils,pgtypes}.a
rm $RPM_BUILD_ROOT%{_libdir}/libpgfeutils.a
%if !%plperl
rm -f $RPM_BUILD_ROOT%{_bindir}/pgsql/hstore_plperl.so
@ -814,8 +797,7 @@ find_lang_bins ()
cat "$binary"-%{majorversion}.lang >>"$lstfile"
done
}
find_lang_bins devel.lst ecpg pg_config
find_lang_bins libs.lst ecpglib6 libpq5
find_lang_bins devel.lst pg_server_config
find_lang_bins server.lst \
initdb pg_basebackup pg_controldata pg_ctl pg_resetwal pg_rewind plpgsql postgres
find_lang_bins contrib.lst \
@ -837,11 +819,6 @@ find_lang_bins pltcl.lst pltcl
%endif
%endif
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%pre server
/usr/sbin/groupadd -g 26 -o -r postgres >/dev/null 2>&1 || :
/usr/sbin/useradd -M -N -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \
@ -1040,16 +1017,6 @@ make -C postgresql-setup-%{setup_version} check
%{_libdir}/pgsql/pgxml.so
%endif
%files libs -f libs.lst
%doc COPYRIGHT
%dir %{_libdir}/pgsql
%{_libdir}/libecpg.so.*
%{_libdir}/libecpg_compat.so.*
%{_libdir}/libpgtypes.so.*
%{_libdir}/libpq.so.*
%files server -f server.lst
%{_bindir}/initdb
%{_bindir}/pg_basebackup
@ -1116,18 +1083,12 @@ make -C postgresql-setup-%{setup_version} check
%endif
%files devel -f devel.lst
%{_bindir}/ecpg
%{_bindir}/pg_config
%{_includedir}/*
%{_libdir}/libecpg.so
%{_libdir}/libecpg_compat.so
%{_libdir}/libpgtypes.so
%{_libdir}/libpq.so
%files server-devel -f devel.lst
%{_bindir}/pg_server_config
%dir %{_includedir}/pgsql
%{_includedir}/pgsql/server
%{_libdir}/pgsql/pgxs/
%{_libdir}/pkgconfig/*.pc
%{_mandir}/man1/ecpg.*
%{_mandir}/man1/pg_config.*
%{_mandir}/man1/pg_server_config.*
%{_mandir}/man3/SPI_*
%{macrosdir}/macros.%name
@ -1197,6 +1158,9 @@ make -C postgresql-setup-%{setup_version} check
%changelog
* Wed Sep 05 2018 Pavel Raiskup <praiskup@redhat.com> - 10.5-4
- build without postgresql-libs; libraries moved to libpq and libecpg
* Mon Aug 27 2018 Pavel Raiskup <praiskup@redhat.com> - 10.5-3
- devel subpackage provides postgresql-server-devel and libecpg-devel
(first step for rhbz#1618698)