[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc2-109-g92b3ff24e

git at osgeo.org git at osgeo.org
Sat Sep 17 06:49:57 PDT 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  92b3ff24e095872e9fcd3d2bef2a8a622c7a1c15 (commit)
      from  55aa90628a9f4d233dbe90b55cf0e621f7f98a3d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 92b3ff24e095872e9fcd3d2bef2a8a622c7a1c15
Author: Sandro Santilli <strk at kbt.io>
Date:   Sat Sep 17 15:49:38 2022 +0200

    Allow installing upgrade paths for a single extension
    
    Fixes make install

diff --git a/extensions/upgrade-paths-rules.mk b/extensions/upgrade-paths-rules.mk
index 1a386c81b..3189960fb 100644
--- a/extensions/upgrade-paths-rules.mk
+++ b/extensions/upgrade-paths-rules.mk
@@ -25,6 +25,7 @@ install-upgrade-paths: tag-as-any
 	ln -fs "$(TAG_UPGRADE)" $(EXTDIR)/$(EXTENSION)--$(EXTVERSION)--ANY.sql; \
 	$(abs_topbuilddir)/loader/postgis \
 		install-extension-upgrades \
+		--extension $(EXTENSION) \
 		--pg_sharedir $(PG_SHAREDIR) \
 		$(UPGRADEABLE_VERSIONS)
 
diff --git a/loader/postgis.pl b/loader/postgis.pl
index 013d8c4ca..6c5509699 100644
--- a/loader/postgis.pl
+++ b/loader/postgis.pl
@@ -21,7 +21,7 @@ Commands:
   enable <database>  enable PostGIS in given database
   upgrade <database> upgrade PostGIS in given database
   status <database>  print PostGIS status in given database
-  install-extension-upgrades [--pg_sharedir <dir>] [<from>...]
+  install-extension-upgrades [--pg_sharedir <dir>] [--extension <name>] [<from>...]
 		Ensure files required to upgrade PostGIS from
 		the given version are installed on the system.
 		The <from> arguments may be either version numbers
@@ -31,28 +31,36 @@ Commands:
 
 }
 
+my %SUPPORTED_EXTENSIONS = (
+	'address_standardizer' => 1,
+	'postgis' => 1,
+	'postgis_raster' => 1,
+	'postgis_sfcgal' => 1,
+	'postgis_tiger_geocoder' => 1,
+	'postgis_topology' => 1
+);
+
+
 sub install_upgrade_from
 {
-	my ( $SHAREDIR, $from ) = @_;
+	my ( $SHAREDIR, $EXTENSION, $from ) = @_;
 
 	#print "SHAREDIR: $SHAREDIR\n";
 	#print "FROM: $from\n";
 	die "Please specify a sharedir and a version to install upgrade support for.\n"
 		unless $from;
 
-	my %supported_extension = (
-		'postgis' => 1,
-		'postgis_raster' => 1,
-		'postgis_sfcgal' => 1,
-		'postgis_tiger_geocoder' => 1,
-		'postgis_topology' => 1
-	);
-
 	# sanify ${from}
 	die "'${from}': invalid version, only 3 dot-separated numbers optionally followed by alphanumeric string are allowed\n"
 		unless $from =~ /^[0-9]*\.[0-9]*\.[0-9]*[a-z1-9]*/;
 
 	# Reserver versions
+	my %supported_extension = %SUPPORTED_EXTENSIONS;
+	if ( defined($EXTENSION) ) {
+		%supported_extension = (
+			$EXTENSION => 1
+		)
+	}
 
 	my $EXTDIR = ${SHAREDIR} . '/extension';
 
@@ -87,7 +95,7 @@ sub install_upgrade_from
 
 sub install_upgrade_from_available
 {
-	my ($SHAREDIR) = @_;
+	my ($SHAREDIR, $EXTENSION) = @_;
 	my $EXTDIR = ${SHAREDIR} . '/extension';
 
 	#print "EXTDIR: ${EXTDIR}\n";
@@ -100,7 +108,7 @@ sub install_upgrade_from_available
 		my $ver = $1;
 		next if $ver eq 'unpackaged'; # we don't want to install upgrade from unpackaged
 		print "Found version $ver\n";
-		return $rv if my $rv = install_upgrade_from $SHAREDIR, $ver;
+		return $rv if my $rv = install_upgrade_from $SHAREDIR, $EXTENSION, $ver;
 		#return $rv if $rv; # first failure aborts all
 	}
 	closedir($d);
@@ -113,6 +121,7 @@ sub install_extension_upgrades
 	my $DEFSHAREDIR = `pg_config --sharedir`;
 	chop($DEFSHAREDIR);
 	my $SHAREDIR = ${DEFSHAREDIR};
+	my $EXTENSION;
 
 	my @ver;
 
@@ -125,11 +134,19 @@ sub install_extension_upgrades
 			die "$SHAREDIR is not a directory" unless -d ${SHAREDIR};
 			next;
 		}
+		elsif ( $_[$i] eq '--extension' )
+		{
+			$i++ < @_ - 1 || die '--extension requires an argument';
+			$EXTENSION = $_[$i];
+			die "$EXTENSION is not a supported extension"
+				unless ( exists( $SUPPORTED_EXTENSIONS{$EXTENSION} ) );
+			next;
+		}
 
 		push @ver, $_[$i];
 	}
 
-	print "Installation target: ${SHAREDIR}\n";
+	print "Installation target: ${SHAREDIR} ${EXTENSION}\n";
 
 	if ( 0 == @ver )
 	{
@@ -142,9 +159,9 @@ sub install_extension_upgrades
 	{
 		my $v = $_;
 		if ( -d $v ) {
-			install_upgrade_from_available($SHAREDIR, $v);
+			install_upgrade_from_available($SHAREDIR, ${EXTENSION}, $v);
 		} else {
-			install_upgrade_from($SHAREDIR, $v);
+			install_upgrade_from($SHAREDIR, ${EXTENSION}, $v);
 		}
 	}
 

-----------------------------------------------------------------------

Summary of changes:
 extensions/upgrade-paths-rules.mk |  1 +
 loader/postgis.pl                 | 47 ++++++++++++++++++++++++++-------------
 2 files changed, 33 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list