[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc2-594-gb669712b3

git at osgeo.org git at osgeo.org
Fri Feb 10 03:24:15 PST 2023


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  b669712b3ea8df41e179316bd4ce76210a001e32 (commit)
      from  7505ad7a6de9fd961ea0a3ead1e4861a327ce4c2 (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 b669712b3ea8df41e179316bd4ce76210a001e32
Author: Sandro Santilli <strk at kbt.io>
Date:   Fri Feb 10 12:23:59 2023 +0100

    Only check for loaders if needed

diff --git a/regress/run_test.pl b/regress/run_test.pl
index d769fefee..b0c1ff6f1 100755
--- a/regress/run_test.pl
+++ b/regress/run_test.pl
@@ -88,7 +88,7 @@ our $VERBOSE = 0;
 our $OPT_SCHEMA = 'public';
 
 GetOptions (
-	'verbose' => \$VERBOSE,
+	'verbose+' => \$VERBOSE,
 	'clean' => \$OPT_CLEAN,
 	'nodrop' => \$OPT_NODROP,
 	'upgrade' => \$OPT_UPGRADE,
@@ -117,17 +117,20 @@ if ( @ARGV < 1 )
 sub findOrDie
 {
     my $exec = shift;
-	printf "Checking for %s ... ", $exec;
-    #my $path = which $exec;
+    my $verbose = shift;
+    printf "Checking for %s ... ", $exec if $verbose;
     foreach my $d ( split /:/, $ENV{PATH} )
     {
         my $path = $d . '/' . $exec;
         if ( -x $path ) {
-		    print "found ($path)\n";
-            return $path;
+            if ( $verbose ) {
+                print "found";
+                print " ($path)" if $verbose gt 1;
+                print "\n";
+            }
+            return $path
         }
     }
-    print "failed\n";
     print STDERR "Unable to find $exec executable.\n";
     print STDERR "PATH is " . $ENV{"PATH"} . "\n";
     die "HINT: use POSTGIS_TOP_BUILD_DIR env or --build-dir switch the specify top build dir.\n";
@@ -137,9 +140,26 @@ sub findOrDie
 # TODO: make this conditional ?
 $ENV{PATH} = $TOP_BUILDDIR . '/loader:' . $TOP_BUILDDIR .  '/raster/loader:' . $ENV{PATH};
 
-our $SHP2PGSQL = findOrDie 'shp2pgsql';
-our $PGSQL2SHP = findOrDie 'pgsql2shp';
-our $RASTER2PGSQL = findOrDie 'raster2pgsql' if ( $OPT_WITH_RASTER );
+our $SHP2PGSQL;
+sub shp2pgsql
+{
+    $SHP2PGSQL = findOrDie 'shp2pgsql', @_ unless defined($SHP2PGSQL);
+    return $SHP2PGSQL;
+}
+
+our $PGSQL2SHP;
+sub pgsql2shp
+{
+    $PGSQL2SHP = findOrDie 'pgsql2shp', @_ unless defined($PGSQL2SHP);
+    return $PGSQL2SHP;
+}
+
+our $RASTER2PGSQL;
+sub raster2pgsql
+{
+    $RASTER2PGSQL = findOrDie 'raster2pgsql', @_ unless defined($RASTER2PGSQL);
+    return $RASTER2PGSQL;
+}
 
 if ( $OPT_UPGRADE_PATH )
 {
@@ -194,6 +214,25 @@ my $OBJ_COUNT_POST = 0;
 # Set up the temporary directory
 ##################################################################
 
+# Pre-flight to check if we need
+# to find shp2pgsql/pgsql2shp/raster2pgsql
+foreach $TEST (@ARGV)
+{
+    if ( -r "${TEST}.dbf" )
+    {
+        shp2pgsql($VERBOSE);
+        pgsql2shp($VERBOSE);
+    }
+    elsif ( -r "${TEST}.tif" )
+    {
+        raster2pgsql($VERBOSE);
+    }
+}
+
+##################################################################
+# Set up the temporary directory
+##################################################################
+
 my $TMPDIR;
 if ( $ENV{'PGIS_REG_TMPDIR'} )
 {
@@ -214,7 +253,7 @@ mkpath $TMPDIR; # make sure tmp dir exists
 my $REGRESS_LOG = "${TMPDIR}/regress_log";
 
 # Report
-print "TMPDIR is $TMPDIR\n";
+print "TMPDIR is $TMPDIR\n" if $VERBOSE gt 1;
 
 ##################################################################
 # Prepare the database
@@ -353,7 +392,6 @@ if ( $OPT_DUMPRESTORE )
     die unless dump_restore();
 }
 
-
 ##################################################################
 # Report PostGIS environment
 ##################################################################
@@ -887,7 +925,7 @@ sub run_loader_and_check_output
 	{
 		show_progress();
 		# Produce the output SQL file.
-		$cmd = "$SHP2PGSQL $loader_options -g the_geom ${TEST}.shp $tblname > $outfile 2> $errfile";
+		$cmd = shp2pgsql() . " $loader_options -g the_geom ${TEST}.shp $tblname > $outfile 2> $errfile";
 		$rv = system($cmd);
 
 		if ( $rv )
@@ -953,7 +991,7 @@ sub run_dumper_and_check_output
 	if ( $run_always || -r $expected_shp_file )
 	{
 		show_progress();
-		$cmd = "${PGSQL2SHP} -f ${TMPDIR}/dumper $DB $tblname > $errfile 2>&1";
+		$cmd = pgsql2shp() . " -f ${TMPDIR}/dumper $DB $tblname > $errfile 2>&1";
 		$rv = system($cmd);
 
 		if ( $rv )
@@ -1020,7 +1058,7 @@ sub run_raster_loader_and_check_output
 		show_progress();
 
 		# Produce the output SQL file.
-		$cmd = "$RASTER2PGSQL $loader_options $raster_file $tblname > $outfile 2> $errfile";
+		$cmd = raster2pgsql() . " $loader_options $raster_file $tblname > $outfile 2> $errfile";
 		$rv = system($cmd);
 
 		if ( $rv )
@@ -1190,7 +1228,7 @@ sub run_dumper_test
   chomp(@dumplines);
   my $dumpstring = shift @dumplines;
   @dumplines = map { local $_ = $_; s/{regdir}/$REGDIR/; $_ } @dumplines;
-  my @cmd = ("${PGSQL2SHP}", "-f", ${shpfile});
+  my @cmd = ( pgsql2shp(), "-f", ${shpfile});
   push @cmd, @dumplines;
   push @cmd, ${DB};
   push @cmd, $dumpstring;

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

Summary of changes:
 regress/run_test.pl | 68 +++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 53 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list