[Tools] winetest: Automatically update @INC for winetest.conf.
Francois Gouget
fgouget at codeweavers.com
Wed Feb 8 01:09:39 CST 2017
This lets the build-index, dissect and gather scripts automatically find
the configuration file.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
Without this patch one needs to use 'perl -I$HOME/tools/winetest ...'
to run these scripts.
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 5f00f5d3..349144ff 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 f5b67447..d9404fe2 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 74c67343..10ed2da0 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";
--
2.11.0
More information about the wine-patches
mailing list