Francois Gouget : winetest: Automatically update @INC for winetest.conf.

Alexandre Julliard julliard at winehq.org
Wed Feb 8 15:23:06 CST 2017


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Feb  8 08:09:39 2017 +0100

winetest: Automatically update @INC for winetest.conf.

This lets the build-index, dissect and gather scripts automatically find
the configuration file.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 winetest/build-index | 10 ++++++++++
 winetest/dissect     | 10 ++++++++++
 winetest/gather      | 10 ++++++++++
 3 files changed, 30 insertions(+)

diff --git a/winetest/build-index b/winetest/build-index
index 5f00f5d..349144f 100755
--- a/winetest/build-index
+++ b/winetest/build-index
@@ -25,6 +25,16 @@ use open ':utf8';
 use CGI qw(:standard);
 use POSIX qw(strftime);
 
+sub BEGIN
+{
+    if ($0 !~ m=^/=)
+    {
+        # Turn $0 into an absolute path so it can safely be used in @INC
+        require Cwd;
+        $0 = Cwd::cwd() . "/$0";
+    }
+    unshift @INC, $1 if ($0 =~ m=^(/.*)/[^/]+$=);
+}
 use vars qw/$gitdir $gitweb $queuedir/;
 require "winetest.conf";
 
diff --git a/winetest/dissect b/winetest/dissect
index f5b6744..d9404fe 100755
--- a/winetest/dissect
+++ b/winetest/dissect
@@ -38,6 +38,16 @@ use open ':utf8';
 use CGI qw(:standard);
 charset("utf-8");
 
+sub BEGIN
+{
+    if ($0 !~ m=^/=)
+    {
+        # Turn $0 into an absolute path so it can safely be used in @INC
+        require Cwd;
+        $0 = Cwd::cwd() . "/$0";
+    }
+    unshift @INC, $1 if ($0 =~ m=^(/.*)/[^/]+$=);
+}
 use vars qw/$gitdir $gitweb $queuedir $datadir $maxmult $maxuserskips $maxfailedtests $maxfilesize $acceptprediluvianwin/;
 require "winetest.conf";
 
diff --git a/winetest/gather b/winetest/gather
index 74c6734..10ed2da 100755
--- a/winetest/gather
+++ b/winetest/gather
@@ -35,6 +35,16 @@ use warnings;
 use CGI qw(:standard);
 charset("utf-8");
 
+sub BEGIN
+{
+    if ($0 !~ m=^/=)
+    {
+        # Turn $0 into an absolute path so it can safely be used in @INC
+        require Cwd;
+        $0 = Cwd::cwd() . "/$0";
+    }
+    unshift @INC, $1 if ($0 =~ m=^(/.*)/[^/]+$=);
+}
 use vars qw/$datadir $gitweb/;
 require "winetest.conf";
 




More information about the wine-cvs mailing list