[postgresql] devel: guard against incompabtible plugin installation

Pavel Raiskup praiskup at fedoraproject.org
Fri Jul 18 07:11:45 UTC 2014


commit 4f1d2a08337f371e7d81436b18c33611289ad5e4
Author: Pavel Raiskup <praiskup at redhat.com>
Date:   Thu Jul 3 16:24:41 2014 +0200

    devel: guard against incompabtible plugin installation
    
    Each package having some *.so plugin for postgresql-server should
    be rebuilt against each major version bump of PostgreSQL.  Using
    this statements in F21+
    
      BuildRequires: postgresql-devel
      Require: postgresql-server(:MODULE_COMPAT_%{postgresql_major})
    
    then automatically blocks installation of postgresql-server and
    incompatible plugin at the same time and thus indirectly forces
    plugin maintainers to rebuild their packages against newer server.
    
    File macros.postgresql now starts providing correct
    %{postgresql_major} macro.
    
    Resolves: #1008939
    Version: 9.3.4-8

 postgresql.spec |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/postgresql.spec b/postgresql.spec
index f8449da..28d55af 100644
--- a/postgresql.spec
+++ b/postgresql.spec
@@ -60,6 +60,9 @@
 # _pkgdocdir is defined in fc20+, remove once f19 is dead
 %{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
 
+# https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_of_Additional_RPM_Macros
+%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)
+
 Summary: PostgreSQL client programs
 Name: postgresql
 %global majorversion 9.3
@@ -208,6 +211,12 @@ Requires(postun): systemd-units
 # should fire just after this package is installed.
 Requires(post): systemd-sysv
 Requires(post): chkconfig
+# Packages which provide postgresql plugins should build-require
+# postgresql-devel and require
+# postgresql-server(:MODULE_COMPAT_%%{postgresql_major}).
+# This will automatically guard against incompatible server & plugin
+# installation (#1008939, #1007840)
+Provides: %{name}-server(:MODULE_COMPAT_%{majorversion})
 
 %description server
 PostgreSQL is an advanced Object-Relational database management system (DBMS).
@@ -623,6 +632,10 @@ 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
 
+echo "%%%{name}_major %{majorversion}" > macros.%{name}
+install -D -m 644 macros.%{name} \
+    $RPM_BUILD_ROOT%{macrosdir}/%{name}.macros
+
 # multilib header hack; note pg_config.h is installed in two places!
 # we only apply this to known Red Hat multilib arches, per bug #177564
 case `uname -i` in
@@ -1090,6 +1103,7 @@ fi
 %{_libdir}/pkgconfig/*.pc
 %{_mandir}/man1/ecpg.*
 %{_mandir}/man3/SPI_*
+%{macrosdir}/*
 
 %if %upgrade
 %files upgrade
@@ -1136,9 +1150,11 @@ fi
 %endif
 
 %changelog
-* Wed Jun 25 2014 Pavel Raiskup <praiskup at redhat.com> - 9.3.4-8
+* Fri Jul 18 2014 Pavel Raiskup <praiskup at redhat.com> - 9.3.4-8
 - provide postgresql-doc for postgresql-docs package (#1086420)
 - move html documentation to *-docs subpackage (#1086420)
+- provide postgresql-server(:MODULE_COMPAT_%%{postgresql_major}) to guard
+  against incompatible plugin installation (#1008939)
 
 * Thu Jun 19 2014 Pavel Raiskup <praiskup at redhat.com> - 9.3.4-7
 - OOM handling compatible with 9.5+, by Tom Lane (#1110969)


More information about the scm-commits mailing list