Christoph Berg pushed to branch experimental at Debian GIS Project / postgis


Commits:
2b7b99f8 by Christoph Berg at 2019-10-15T09:56:55Z
Remove the dpkg-diversions of .control files for older PostGIS versions, using 
diversions on top of alternatives seems too fragile. The 2.5 branch has been 
updated to use alternatives, so we should have covered most cases in practise.

- - - - -


5 changed files:

- debian/changelog
- debian/postgresql-generic-postgis-scripts.postinst.in
- + debian/postgresql-generic-postgis-scripts.preinst.in
- debian/postgresql-generic-postgis-scripts.prerm.in
- debian/rules


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+postgis (3.0.0~rc2+dfsg-1~exp2) UNRELEASED; urgency=medium
+
+  * Remove the dpkg-diversions of .control files for older PostGIS versions,
+    using diversions on top of alternatives seems too fragile.
+    The 2.5 branch has been updated to use alternatives, so we should have
+    covered most cases in practise.
+
+ -- Christoph Berg <[email protected]>  Tue, 15 Oct 2019 11:27:32 +0200
+
 postgis (3.0.0~rc2+dfsg-1~exp1) experimental; urgency=medium
 
   [ Christoph Berg ]


=====================================
debian/postgresql-generic-postgis-scripts.postinst.in
=====================================
@@ -8,12 +8,6 @@ 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 \
@@ -24,16 +18,6 @@ case $1 in
       --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
 


=====================================
debian/postgresql-generic-postgis-scripts.preinst.in
=====================================
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+set -eu
+
+MAJOR_VERSION="3"
+PGVERSION="@PGVERSION@"
+DIR="/usr/share/postgresql/$PGVERSION/extension"
+
+# Some early 3.0 versions had a mechanism to divert the control files of older
+# PostGIS versions away. This has been removed because it was too fragile.
+
+if [ "${2:-}" ] &&
+  dpkg --compare-versions "$2" ge "3.0.0~alpha4+dfsg-2~exp1~" &&
+  dpkg --compare-versions "$2" lt "3.0.0~rc2+dfsg-1~exp2~"; then
+
+  # remove alternatives for older versions
+  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 
--no-rename \
+      --remove $DIR/$ext.control
+    rm -vf $DIR/$ext-old.control
+  done
+fi
+
+#DEBHELPER#
+
+exit 0


=====================================
debian/postgresql-generic-postgis-scripts.prerm.in
=====================================
@@ -11,18 +11,6 @@ case $1 in
     # 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
 


=====================================
debian/rules
=====================================
@@ -110,6 +110,7 @@ override_dh_auto_clean: debian/control
        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.preinst
        rm -f $(CURDIR)/debian/postgresql-*-postgis-*-scripts.prerm
        rm -f loader/cunit/cu_tester
        rm -rf liblwgeom/cunit/.libs
@@ -146,7 +147,7 @@ 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 \
+               for SUFFIX in .install -scripts.install -scripts.postinst 
-scripts.preinst -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; \



View it on GitLab: 
https://salsa.debian.org/debian-gis-team/postgis/commit/2b7b99f85f5b1f2a4dda89536575eae0b030b9e2

-- 
View it on GitLab: 
https://salsa.debian.org/debian-gis-team/postgis/commit/2b7b99f85f5b1f2a4dda89536575eae0b030b9e2
You're receiving this email because of your account on salsa.debian.org.


_______________________________________________
Pkg-grass-devel mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-grass-devel

Reply via email to