[Git][debian-gis-team/postgis][experimental] 2 commits: Use alternatives to manage extension/*.control
Christoph Berg
gitlab at salsa.debian.org
Mon Aug 26 12:07:42 BST 2019
Christoph Berg pushed to branch experimental at Debian GIS Project / postgis
Commits:
31f46544 by Christoph Berg at 2019-08-16T12:36:48Z
Use alternatives to manage extension/*.control
Instead of conflicting with older postgresql-*-postgis-*-scripts packages, use
the alternatives system for managing the extension/*.control files. This
finally allows us to depend on the -scripts package from the main extension
package.
- - - - -
f249e949 by Christoph Berg at 2019-08-16T12:36:52Z
Remove unversioned and unused sql files from address standardizer.
- - - - -
6 changed files:
- debian/changelog
- debian/control
- debian/control.in
- + debian/postgresql-generic-postgis-scripts.postinst.in
- + debian/postgresql-generic-postgis-scripts.prerm.in
- debian/rules
Changes:
=====================================
debian/changelog
=====================================
@@ -2,6 +2,11 @@ postgis (3.0.0~alpha4+dfsg-2) UNRELEASED; urgency=medium
* debian/tests: Test postgis_raster extension as well.
* debian/tests/regress: Makefile.in needs some variables from ./configure.
+ * Instead of conflicting with older postgresql-*-postgis-*-scripts packages,
+ use the alternatives system for managing the extension/*.control files.
+ This finally allows us to depend on the -scripts package from the main
+ extension package.
+ * Remove unversioned and unused sql files from address standardizer.
-- Christoph Berg <myon at debian.org> Mon, 12 Aug 2019 10:55:44 +0200
=====================================
debian/control
=====================================
@@ -97,9 +97,9 @@ Description: Geographic objects support for PostgreSQL -- documentation
Package: postgresql-11-postgis-3
Architecture: any
Depends: postgresql-11,
+ postgresql-11-postgis-3-scripts,
${shlibs:Depends},
${misc:Depends}
-Recommends: postgresql-11-postgis-3-scripts
Suggests: postgis
Breaks: postgis (<< 1.2.1)
Provides: postgresql-11-postgis,
@@ -121,11 +121,6 @@ Multi-Arch: foreign
Depends: ${perl:Depends},
${misc:Depends}
Recommends: postgresql-11-postgis-3
-Breaks: postgresql-11-postgis-scripts (<< 2.2.2+dfsg-3~)
-Conflicts: postgresql-11-postgis-2.2-scripts,
- postgresql-11-postgis-2.3-scripts,
- postgresql-11-postgis-2.4-scripts,
- postgresql-11-postgis-2.5-scripts
Provides: postgresql-11-postgis-scripts,
postgresql-postgis-scripts
Replaces: postgresql-11-postgis-scripts (<< 2.2.2+dfsg-3~)
=====================================
debian/control.in
=====================================
@@ -97,9 +97,9 @@ Description: Geographic objects support for PostgreSQL -- documentation
Package: postgresql-PGVERSION-postgis-3
Architecture: any
Depends: postgresql-PGVERSION,
+ postgresql-PGVERSION-postgis-3-scripts,
${shlibs:Depends},
${misc:Depends}
-Recommends: postgresql-PGVERSION-postgis-3-scripts
Suggests: postgis
Breaks: postgis (<< 1.2.1)
Provides: postgresql-PGVERSION-postgis,
@@ -121,11 +121,6 @@ Multi-Arch: foreign
Depends: ${perl:Depends},
${misc:Depends}
Recommends: postgresql-PGVERSION-postgis-3
-Breaks: postgresql-PGVERSION-postgis-scripts (<< 2.2.2+dfsg-3~)
-Conflicts: postgresql-PGVERSION-postgis-2.2-scripts,
- postgresql-PGVERSION-postgis-2.3-scripts,
- postgresql-PGVERSION-postgis-2.4-scripts,
- postgresql-PGVERSION-postgis-2.5-scripts
Provides: postgresql-PGVERSION-postgis-scripts,
postgresql-postgis-scripts
Replaces: postgresql-PGVERSION-postgis-scripts (<< 2.2.2+dfsg-3~)
=====================================
debian/postgresql-generic-postgis-scripts.postinst.in
=====================================
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+set -eu
+
+MAJOR_VERSION="3"
+PGVERSION="@PGVERSION@"
+DIR="/usr/share/postgresql/$PGVERSION/extension"
+
+case $1 in
+ configure)
+ # first move files from versions without the alternatives system away
+ for ext in postgis postgis_raster postgis_sfcgal postgis_tiger_geocoder postgis_topology address_standardizer address_standardizer_data_us; do
+ dpkg-divert --package postgresql-$PGVERSION-postgis-$MAJOR_VERSION-scripts --rename \
+ --divert $DIR/$ext-old.control --add $DIR/$ext.control
+ done
+
+ # install our alternatives (priority is "30" for compatibility with 2.5, "25")
+ update-alternatives \
+ --install $DIR/postgis.control postgresql-$PGVERSION-postgis.control $DIR/postgis-$MAJOR_VERSION.control ${MAJOR_VERSION}0 \
+ --slave $DIR/postgis_raster.control postgresql-$PGVERSION-postgis_raster.control $DIR/postgis_raster-$MAJOR_VERSION.control \
+ --slave $DIR/postgis_sfcgal.control postgresql-$PGVERSION-postgis_sfcgal.control $DIR/postgis_sfcgal-$MAJOR_VERSION.control \
+ --slave $DIR/postgis_tiger_geocoder.control postgresql-$PGVERSION-postgis_tiger_geocoder.control $DIR/postgis_tiger_geocoder-$MAJOR_VERSION.control \
+ --slave $DIR/postgis_topology.control postgresql-$PGVERSION-postgis_topology.control $DIR/postgis_topology-$MAJOR_VERSION.control \
+ --slave $DIR/address_standardizer.control postgresql-$PGVERSION-address_standardizer.control $DIR/address_standardizer-$MAJOR_VERSION.control \
+ --slave $DIR/address_standardizer_data_us.control postgresql-$PGVERSION-address_standardizer_data_us.control $DIR/address_standardizer_data_us-$MAJOR_VERSION.control
+
+ # add alternatives for old versions (priority is "1")
+ test -f $DIR/postgis-old.control && update-alternatives \
+ --install $DIR/postgis.control postgresql-$PGVERSION-postgis.control $DIR/postgis-old.control 1 \
+ --slave $DIR/postgis_raster.control postgresql-$PGVERSION-postgis_raster.control $DIR/postgis_raster-old.control \
+ --slave $DIR/postgis_sfcgal.control postgresql-$PGVERSION-postgis_sfcgal.control $DIR/postgis_sfcgal-old.control \
+ --slave $DIR/postgis_tiger_geocoder.control postgresql-$PGVERSION-postgis_tiger_geocoder.control $DIR/postgis_tiger_geocoder-old.control \
+ --slave $DIR/postgis_topology.control postgresql-$PGVERSION-postgis_topology.control $DIR/postgis_topology-old.control \
+ --slave $DIR/address_standardizer.control postgresql-$PGVERSION-address_standardizer.control $DIR/address_standardizer-old.control \
+ --slave $DIR/address_standardizer_data_us.control postgresql-$PGVERSION-address_standardizer_data_us.control $DIR/address_standardizer_data_us-old.control
+
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
=====================================
debian/postgresql-generic-postgis-scripts.prerm.in
=====================================
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+set -eu
+
+MAJOR_VERSION="3"
+PGVERSION="@PGVERSION@"
+DIR="/usr/share/postgresql/$PGVERSION/extension"
+
+case $1 in
+ remove)
+ # remove our alternatives
+ update-alternatives --remove postgresql-$PGVERSION-postgis.control $DIR/postgis-$MAJOR_VERSION.control
+
+ # remove alternatives for older versions
+ # (this is not totally correct, but we don't have a better place to put it,
+ # and it's only wrong when an old version and at least two "new" versions
+ # are installed, and one of the new versions is removed)
+ update-alternatives --remove postgresql-$PGVERSION-postgis.control $DIR/postgis-old.control
+
+ # move any diverted files back
+ for ext in postgis postgis_raster postgis_sfcgal postgis_tiger_geocoder postgis_topology address_standardizer address_standardizer_data_us; do
+ dpkg-divert --package postgresql-$PGVERSION-postgis-$MAJOR_VERSION-scripts --rename \
+ --remove $DIR/$ext.control
+ done
+
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
=====================================
debian/rules
=====================================
@@ -93,7 +93,7 @@ override_dh_autoreconf:
override_dh_auto_clean: debian/control
# Clean all separate build directories.
- (set -e; \
+ (set -ex; \
for PGVER in $(OTHER_POSTGRES_VERSIONS); do \
rm -rf $(CURDIR)/debian/build-$$PGVER; \
done)
@@ -109,6 +109,8 @@ override_dh_auto_clean: debian/control
# Cleanup auto-generated packaging control files
rm -f $(CURDIR)/debian/postgresql-*-postgis-*.install
rm -f $(CURDIR)/debian/postgresql-*-postgis-*-scripts.install
+ rm -f $(CURDIR)/debian/postgresql-*-postgis-*-scripts.postinst
+ rm -f $(CURDIR)/debian/postgresql-*-postgis-*-scripts.prerm
rm -f loader/cunit/cu_tester
rm -rf liblwgeom/cunit/.libs
@@ -116,7 +118,7 @@ override_dh_auto_configure:
# Copy sources required to build extensions for all but the most
# recent Postgres version. Unfortunately, Postgis doesn't support
# vpath builds.
- (set -e; \
+ (set -ex; \
for PGVER in $(OTHER_POSTGRES_VERSIONS); do \
mkdir $(CURDIR)/debian/build-$$PGVER; \
for FILE in `ls $(CURDIR) | grep -v debian`; do \
@@ -141,6 +143,16 @@ override_dh_auto_configure:
done)
override_dh_auto_build:
+# Create debhelper files for each Postgres major version
+ (set -ex; \
+ for PGVER in $(OTHER_POSTGRES_VERSIONS) $(NEWEST_POSTGRES_VERSION); do \
+ for SUFFIX in .install -scripts.install -scripts.postinst -scripts.prerm; do \
+ cat $(CURDIR)/debian/postgresql-generic-postgis$$SUFFIX.in \
+ | sed -e "s/@PGVERSION@/$$PGVER/g" \
+ > $(CURDIR)/debian/postgresql-$$PGVER-postgis-$(MAJOR_VERSION)$$SUFFIX; \
+ done \
+ done)
+
# Build against the newest Postgres version
@echo " ### building $(NEWEST_POSTGRES_VERSION) ###"
$(MAKE) $(NJOBS)
@@ -166,8 +178,6 @@ override_dh_auto_build:
# clever enough to run this before 'install'.
$(MAKE) $(NJOBS) -C extensions
- touch $@
-
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
# Run unit tests (against the newest Postgres version, first)
@@ -198,23 +208,25 @@ override_dh_auto_install:
install DESTDIR=$(CURDIR)/debian/tmp; \
done)
+# Remove unversioned and unused files from address standardizer
+ rm -fv debian/tmp/usr/share/postgresql/*/extension/address_standardizer.sql
+ rm -fv debian/tmp/usr/share/postgresql/*/extension/address_standardizer_data_us.sql
+
+# Move extension control files to version-specific names
+# (otherwise, the -script packages from different major versions would conflict)
+ (set -ex; \
+ for PGVER in $(OTHER_POSTGRES_VERSIONS) $(NEWEST_POSTGRES_VERSION); do \
+ for control in $(CURDIR)/debian/tmp/usr/share/postgresql/$$PGVER/extension/*.control; do \
+ mv $$control $${control%.control}-$(MAJOR_VERSION).control; \
+ done \
+ done)
+
# Compile and install docs
$(MAKE) -C doc docs-install man-install \
DESTDIR=$(CURDIR)/debian/tmp \
PGSQL_DOCDIR=/usr/share/doc \
PGSQL_MANDIR=/usr/share/man
-# Auto-create required .install file for each Postgres major version
- (set -e; \
- for PGVER in $(OTHER_POSTGRES_VERSIONS) $(NEWEST_POSTGRES_VERSION); do \
- cat $(CURDIR)/debian/postgresql-generic-postgis.install.in \
- | sed -e "s/@PGVERSION@/$$PGVER/" \
- > $(CURDIR)/debian/postgresql-$$PGVER-postgis-$(MAJOR_VERSION).install; \
- cat $(CURDIR)/debian/postgresql-generic-postgis-scripts.install.in \
- | sed -e "s/@PGVERSION@/$$PGVER/" \
- > $(CURDIR)/debian/postgresql-$$PGVER-postgis-$(MAJOR_VERSION)-scripts.install; \
- done)
-
# Move binaries from the NEWEST_POSTGRES_VERSION build to the
# 'postgis' binary package.
mkdir -p $(CURDIR)/debian/postgis/usr/bin
View it on GitLab: https://salsa.debian.org/debian-gis-team/postgis/compare/f3803992ec645292741001fcb2aa83b1a39cac28...f249e949265258ea886a41ff804d8287538d6caa
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/postgis/compare/f3803992ec645292741001fcb2aa83b1a39cac28...f249e949265258ea886a41ff804d8287538d6caa
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20190826/34cd8218/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list