Francois Gouget : winetest: Let the scripts autodetect the work directory.

Alexandre Julliard julliard at winehq.org
Wed Jun 7 12:12:31 CDT 2017


Module: tools
Branch: master
Commit: c9170c8554a3837712b40f529c56165bbbc9f347
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=c9170c8554a3837712b40f529c56165bbbc9f347

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Jun  7 11:07:29 2017 +0200

winetest: Let the scripts autodetect the work directory.

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>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 d13d1cf..b10788c 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 2d25ae3..f41824f 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 dcd9795..dc413cd 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 99e50fb..1e4a5fe 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 94f3541..28227a3 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 ba15514..0d35d11 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";
 




More information about the wine-cvs mailing list