[postgis-tickets] r17752 - [run_test] Allow requesting function upgrade also w/out :auto

Sandro Santilli strk at kbt.io
Thu Aug 22 02:20:42 PDT 2019


Author: strk
Date: 2019-08-22 02:20:42 -0700 (Thu, 22 Aug 2019)
New Revision: 17752

Modified:
   trunk/regress/run_test.pl
Log:
[run_test] Allow requesting function upgrade also w/out :auto

Append an exlamation mark to any target version in upgrade-path
to request upgrade via function...

Modified: trunk/regress/run_test.pl
===================================================================
--- trunk/regress/run_test.pl	2019-08-22 06:47:50 UTC (rev 17751)
+++ trunk/regress/run_test.pl	2019-08-22 09:20:42 UTC (rev 17752)
@@ -547,8 +547,9 @@
                   <from> can be specified as "unpackaged<version>"
                          to specify a script version to start from.
                   <to> can be specified as ":auto" to request
-                       upgrades to default version, and ":auto!"
-                       to request upgrade via postgis_extensions_upgrade()
+                       upgrades to default version, and be appended
+                       a question mark (ie: ":auto!" or "3.0.0!") to
+                       request upgrade via postgis_extensions_upgrade()
                        if available.
   --dumprestore   dump and restore spatially-enabled db before running tests
   --nodrop        do not drop the regression database on exit
@@ -1514,23 +1515,25 @@
     my $sql;
     my $upgrade_via_function = 0;
 
-    if ( $OPT_UPGRADE_TO =~ /^:auto/ )
+    if ( $OPT_UPGRADE_TO =~ /!$/ )
     {
-      if ( $OPT_UPGRADE_TO =~ /^:auto!/ )
+      $OPT_UPGRADE_TO =~ s/!$//;
+      my $from = $OPT_UPGRADE_FROM;
+      $from =~ s/^unpackaged//;
+      if ( ! $from || ! semver_lessthan($from, "3.0.0") )
       {
-        my $from = $OPT_UPGRADE_FROM;
-        $from =~ s/^unpackaged//;
-        if ( ! $from || ! semver_lessthan($from, "3.0.0") )
-        {
-          $upgrade_via_function = 1;
-        }
-        else
-        {
-          print "WARNING: postgis_extensions_upgrade()".
-                " not available or functional in version $from.".
-                " We'll use manual upgrade.\n";
-        }
+        $upgrade_via_function = 1;
       }
+      else
+      {
+        print "WARNING: postgis_extensions_upgrade()".
+              " not available or functional in version $from.".
+              " We'll use manual upgrade.\n";
+      }
+    }
+
+    if ( $OPT_UPGRADE_TO =~ /^:auto/ )
+    {
       $OPT_UPGRADE_TO = $defextver;
     }
 



More information about the postgis-tickets mailing list