[Tools 2/2] winetest: Let the scripts autodetect the work directory.

Francois Gouget fgouget at codeweavers.com
Wed Jun 7 04:07:29 CDT 2017


The scripts now automatically recognize the work directory if it is the
current directory as is the case when invoked from the cron script.
This makes winetest.conf's $workdir setting unnecessary.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---

The cron script already receives the work directory as a parameter and 
sets up the current directory accordingly so this should not require 
outside changes.

 winetest/INSTALL.txt   |  1 -
 winetest/build-errors  | 10 ++++++++--
 winetest/build-index   | 13 ++++++++++---
 winetest/dissect       | 13 ++++++++++---
 winetest/gather        | 14 ++++++++++----
 winetest/winetest.conf |  2 --
 6 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/winetest/INSTALL.txt b/winetest/INSTALL.txt
index d13d1cf8..b10788ce 100644
--- a/winetest/INSTALL.txt
+++ b/winetest/INSTALL.txt
@@ -32,7 +32,6 @@ Read-only source code account:
   should be available as $HOME/tools/winetest/INSTALL.txt).
     git clone git://source.winehq.org/git/tools.git
 - Edit $HOME/tools/winetest/winetest.conf to set:
-    $workdir = "/home/winehq/sites/winetest";
     $gitdir = "/home/wine/wine.git";
 
 Web site account:
diff --git a/winetest/build-errors b/winetest/build-errors
index 2d25ae3f..f41824f9 100755
--- a/winetest/build-errors
+++ b/winetest/build-errors
@@ -33,8 +33,7 @@ sub BEGIN
     }
     unshift @INC, $1 if ($0 =~ m=^(/.*)/[^/]+$=);
 }
-use vars qw/$workdir/;
-require "winetest.conf";
+
 
 my $name0=$0;
 $name0 =~ s+^.*/++;
@@ -63,6 +62,13 @@ sub long_date($)
 # Generate a table of the errors encountered during processing
 #
 
+require Cwd;
+my $workdir = Cwd::cwd();
+if (!-f "$workdir/report.css")
+{
+    error("'$workdir' is not a valid work directory\n");
+    exit 2;
+}
 chdir($workdir) or die "could not chdir to the work directory: $!";
 
 my @errors;
diff --git a/winetest/build-index b/winetest/build-index
index dcd9795a..dc413cd7 100755
--- a/winetest/build-index
+++ b/winetest/build-index
@@ -34,7 +34,7 @@ sub BEGIN
     }
     unshift @INC, $1 if ($0 =~ m=^(/.*)/[^/]+$=);
 }
-use vars qw/$workdir $gitdir $gitweb/;
+use vars qw/$gitdir $gitweb/;
 require "winetest.conf";
 
 my $name0=$0;
@@ -62,11 +62,11 @@ sub get_build_info($)
     {
         ($date, $subject) = ($1, $2);
         # Make sure the directory's mtime matches the commit time
-        utime $date, $date, "$workdir/data/$build";
+        utime $date, $date, "data/$build";
     }
     else
     {
-        $date = (stat "$workdir/data/$build")[9];
+        $date = (stat "data/$build")[9];
         $subject = "";
     }
     return ($date, $subject);
@@ -113,6 +113,13 @@ my @groups = (\%w95, \%w98, \%me, \%nt3, \%nt4, \%w2k, \%xp, \%w2k3, \%vista, \%
 # Grab the build list and archive the old results
 #
 
+require Cwd;
+my $workdir = Cwd::cwd();
+if (!-f "$workdir/report.css")
+{
+    error("'$workdir' is not a valid work directory\n");
+    exit 2;
+}
 chdir($workdir) or die "could not chdir to the work directory: $!";
 
 my @builds;
diff --git a/winetest/dissect b/winetest/dissect
index 99e50fb3..1e4a5fe2 100755
--- a/winetest/dissect
+++ b/winetest/dissect
@@ -48,7 +48,7 @@ sub BEGIN
     }
     unshift @INC, $1 if ($0 =~ m=^(/.*)/[^/]+$=);
 }
-use vars qw/$workdir $gitdir $gitweb $maxmult $maxuserskips $maxfailedtests $maxfilesize $acceptprediluvianwin/;
+use vars qw/$gitdir $gitweb $maxmult $maxuserskips $maxfailedtests $maxfilesize $acceptprediluvianwin/;
 require "winetest.conf";
 
 my $name0=$0;
@@ -81,11 +81,11 @@ sub get_build_info($)
     {
         ($date, $subject) = ($1, $2);
         # Make sure the directory's mtime matches the commit time
-        utime $date, $date, "$workdir/data/$build";
+        utime $date, $date, "data/$build";
     }
     else
     {
-        $date = (stat "$workdir/data/$build")[9];
+        $date = (stat "data/$build")[9];
         $subject = "";
     }
     return ($date, $subject);
@@ -105,6 +105,13 @@ sub short_date($)
 # Command line processing
 #
 
+require Cwd;
+my $workdir = Cwd::cwd();
+if (!-f "$workdir/report.css")
+{
+    error("'$workdir' is not a valid work directory\n");
+    exit 2;
+}
 chdir($workdir) or die "could not chdir to the work directory: $!";
 
 my ($update, $report);
diff --git a/winetest/gather b/winetest/gather
index 94f35410..28227a34 100755
--- a/winetest/gather
+++ b/winetest/gather
@@ -45,7 +45,7 @@ sub BEGIN
     }
     unshift @INC, $1 if ($0 =~ m=^(/.*)/[^/]+$=);
 }
-use vars qw/$workdir $gitdir $gitweb/;
+use vars qw/$gitdir $gitweb/;
 require "winetest.conf";
 
 my $name0=$0;
@@ -76,11 +76,11 @@ sub get_build_info($)
     {
         ($date, $subject) = ($1, $2);
         # Make sure the directory's mtime matches the commit time
-        utime $date, $date, "$workdir/data/$build";
+        utime $date, $date, "data/$build";
     }
     else
     {
-        $date = (stat "$workdir/data/$build")[9];
+        $date = (stat "data/$build")[9];
         $subject = "";
     }
     return ($date, $subject);
@@ -175,7 +175,13 @@ my %idmap = (95=>\%w95, 98=>\%w98, me=>\%me, nt3=>\%nt3, nt4=>\%nt4, 2000=>\%w2k
 # Pick a build to work on
 #
 
-
+require Cwd;
+my $workdir = Cwd::cwd();
+if (!-f "$workdir/report.css")
+{
+    error("'$workdir' is not a valid work directory\n");
+    exit 2;
+}
 chdir($workdir) or die "could not chdir to the work directory: $!";
 
 my ($outdated,undef) = glob "data/*/outdated";
diff --git a/winetest/winetest.conf b/winetest/winetest.conf
index ba155141..0d35d116 100644
--- a/winetest/winetest.conf
+++ b/winetest/winetest.conf
@@ -1,7 +1,5 @@
 # Hey Emacs! This is a -*-cperl-*- file!
 
-$workdir = "/home/winehq/opt/winetest";
-
 $gitdir = "/home/winehq/opt/source/git/wine.git";
 $gitweb = "//source.winehq.org/git/wine.git";
 
-- 
2.11.0



More information about the wine-patches mailing list