[Git][debian-gis-team/postgis][master] 2 commits: Use alternatives to manage extension/*.control
Christoph Berg
gitlab at salsa.debian.org
Mon Oct 14 10:17:23 BST 2019
Christoph Berg pushed to branch master at Debian GIS Project / postgis
Commits:
4bcb850b by Christoph Berg at 2019-10-14T09:14:16Z
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.
Other than in the postgis 3 branch, we do not install diversions for
older non-alternatives-enabled packages, as these would conflict with
the diversions from the 3 branch.
- - - - -
bcf12bdd by Christoph Berg at 2019-10-14T09:14:22Z
debian/tests: Run regression tests.
- - - - -
9 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
- debian/tests/control
- + debian/tests/regress
- debian/tests/test-extension-creation
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,13 @@
+postgis-2.5 (2.5.3+dfsg-2) UNRELEASED; urgency=medium
+
+ * 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.
+ * debian/tests: Run regression tests.
+
+ -- Christoph Berg <myon at debian.org> Fri, 11 Oct 2019 17:19:19 +0200
+
postgis (2.5.3+dfsg-1) unstable; urgency=medium
* New upstream release.
=====================================
debian/control
=====================================
@@ -133,9 +133,9 @@ Description: PostGIS "Lightweight Geometry" library - Development files
Package: postgresql-11-postgis-2.5
Architecture: any
Depends: postgresql-11,
+ postgresql-11-postgis-2.5-scripts,
${shlibs:Depends},
${misc:Depends}
-Recommends: postgresql-11-postgis-2.5-scripts
Suggests: postgis
Breaks: postgis (<< 1.2.1)
Provides: postgresql-11-postgis,
=====================================
debian/control.in
=====================================
@@ -133,9 +133,9 @@ Description: PostGIS "Lightweight Geometry" library - Development files
Package: postgresql-PGVERSION-postgis-2.5
Architecture: any
Depends: postgresql-PGVERSION,
+ postgresql-PGVERSION-postgis-2.5-scripts,
${shlibs:Depends},
${misc:Depends}
-Recommends: postgresql-PGVERSION-postgis-2.5-scripts
Suggests: postgis
Breaks: postgis (<< 1.2.1)
Provides: postgresql-PGVERSION-postgis,
=====================================
debian/postgresql-generic-postgis-scripts.postinst.in
=====================================
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -eu
+
+MAJOR_VERSION="2.5"
+PGVERSION="@PGVERSION@"
+DIR="/usr/share/postgresql/$PGVERSION/extension"
+
+case $1 in
+ configure)
+ # 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 25 \
+ --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
+
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
=====================================
debian/postgresql-generic-postgis-scripts.prerm.in
=====================================
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -eu
+
+MAJOR_VERSION="2.5"
+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
+
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
=====================================
debian/rules
=====================================
@@ -101,7 +101,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)
@@ -117,6 +117,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
@@ -127,7 +129,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 \
@@ -152,6 +154,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).$(MINOR_VERSION)$$SUFFIX; \
+ done \
+ done)
+
# Build against the newest Postgres version
@echo " ### building $(NEWEST_POSTGRES_VERSION) ###"
$(MAKE) $(NJOBS)
@@ -177,8 +189,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)
@@ -215,24 +225,22 @@ override_dh_auto_install:
install DESTDIR=$(CURDIR)/debian/tmp; \
done)
+# 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).$(MINOR_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).$(MINOR_VERSION).install; \
- cat $(CURDIR)/debian/postgresql-generic-postgis-scripts.install.in \
- | sed -e "s/@PGVERSION@/$$PGVER/" \
- > $(CURDIR)/debian/postgresql-$$PGVER-postgis-$(MAJOR_VERSION).$(MINOR_VERSION)-scripts.install; \
- done)
-
-# Copy binaries from the NEWEST_POSTGRES_VERSION build to the
+# Move binaries from the NEWEST_POSTGRES_VERSION build to the
# 'postgis' binary package.
mkdir -p $(CURDIR)/debian/postgis/usr/bin
cp -r $(CURDIR)/debian/tmp/usr/lib/postgresql/$(NEWEST_POSTGRES_VERSION)/bin/* \
=====================================
debian/tests/control
=====================================
@@ -1,3 +1,3 @@
Depends: @, postgresql-server-dev-all, postgresql-all
-Tests: test-extension-creation
-Restrictions: needs-root, allow-stderr
+Tests: test-extension-creation regress
+Restrictions: allow-stderr
=====================================
debian/tests/regress
=====================================
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -eux
+
+# link shape loader/dumper to where the testsuite expects them
+PRGS="loader/shp2pgsql loader/pgsql2shp raster/loader/raster2pgsql"
+for prg in $PRGS; do
+ test -x $prg || ln -s /usr/bin/$(basename $prg) $prg
+done
+
+# delete test directory before possibly switching user
+rm -rf /tmp/pgis_reg
+
+# make Makefile.in believe that we have completed staged-install
+for file in regress/staged-install-raster regress/staged-install-topology regress/staged-install; do
+ test -f $file || touch $file
+done
+
+# re-start ourselves as nobody since PG can't run as root
+if [ "$(id -un)" = "root" ]; then
+ exec su nobody -s /bin/sh "$0" "$@"
+fi
+
+# Makefile.in needs some variables from ./configure, set the most important ones here
+POSTGIS_GEOS_VERSION="$(dpkg-query -f '${Version}' --show 'libgeos-*.*' | cut -c 1,3)"
+
+# clean up on exit
+trap "rm -rf /tmp/pgis_reg $PRGS regress/staged-install* || :" EXIT
+
+# run the regression tests
+for v in $(pg_buildext supported-versions); do
+ pg_virtualenv -v $v \
+ make -C regress -f Makefile.in check PERL=perl RUNTESTFLAGS="--extension --verbose" POSTGIS_GEOS_VERSION=$POSTGIS_GEOS_VERSION HAVE_SFCGAL=yes
+done
=====================================
debian/tests/test-extension-creation
=====================================
@@ -4,7 +4,7 @@ set -eu
for v in $(pg_buildext supported-versions); do
pg_virtualenv -v $v sh -e <<-'EOF'
- # test extension
+ # test extension (fuzzystrmatch is part of postgresql-contrib and is needed by postgis_tiger_geocoder)
for ext in postgis postgis_sfcgal fuzzystrmatch postgis_tiger_geocoder postgis_topology address_standardizer address_standardizer_data_us; do
psql -eXc "CREATE EXTENSION $ext"
done
View it on GitLab: https://salsa.debian.org/debian-gis-team/postgis/compare/9117335a0523fc43c42158d2f407b4482d82986f...bcf12bddaddd4134a7228f3336ac83df571bbc3e
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/postgis/compare/9117335a0523fc43c42158d2f407b4482d82986f...bcf12bddaddd4134a7228f3336ac83df571bbc3e
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/20191014/df8162ac/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list