Add support for creating extension from unpackaged (#3296)
authorSandro Santilli <strk@keybit.net>
Mon, 28 Sep 2015 07:40:13 +0000 (07:40 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 28 Sep 2015 07:40:13 +0000 (07:40 +0000)
Use: ./run_test.pl --extension --upgrade-path unpackaged--2.2.0

git-svn-id: http://svn.osgeo.org/postgis/trunk@14119 b70326c6-7e19-0410-871a-916f4a2858ee

regress/run_test.pl

index 3cf09327bcb6e9ae111fa4761c4365536c3c6170..ae5cd42d20f6d364d42aadc4986b0d6a3c4b81d7 100755 (executable)
@@ -97,6 +97,11 @@ if ( $OPT_UPGRADE_PATH )
   print "Upgrade path: ${OPT_UPGRADE_FROM} --> ${OPT_UPGRADE_TO}\n";
 }
 
+if ( $OPT_EXTENSIONS )
+{
+       $OPT_WITH_RASTER = 1; # implied
+}
+
 
 
 ##################################################################
@@ -1241,6 +1246,10 @@ sub prepare_spatial_extensions
        my $psql_opts = "--no-psqlrc --variable ON_ERROR_STOP=true";
        my $sql = "CREATE EXTENSION postgis";
        if ( $OPT_UPGRADE_FROM ) {
+               if ( $OPT_UPGRADE_FROM eq "unpackaged" ) {
+                       prepare_spatial();
+                       return;
+               }
                $sql .= " VERSION '" . $OPT_UPGRADE_FROM . "'";
        }
 
@@ -1376,6 +1385,10 @@ sub upgrade_spatial_extensions
     my $nextver = $OPT_UPGRADE_TO ? "${OPT_UPGRADE_TO}" : "${libver}next";
     my $sql = "ALTER EXTENSION postgis UPDATE TO '${nextver}'";
 
+    if ( $OPT_UPGRADE_FROM eq "unpackaged" ) {
+      $sql = "CREATE EXTENSION postgis VERSION '${nextver}' FROM unpackaged";
+    }
+
     print "Upgrading PostGIS in '${DB}' using: ${sql}\n" ;
 
     my $cmd = "psql $psql_opts -c \"" . $sql . "\" $DB >> $REGRESS_LOG 2>&1";