]> git.donarmstrong.com Git - debbugs.git/commitdiff
use the git repo base dir as INC if we're running out of git
authorDon Armstrong <don@donarmstrong.com>
Wed, 28 Mar 2018 22:44:51 +0000 (15:44 -0700)
committerDon Armstrong <don@donarmstrong.com>
Wed, 28 Mar 2018 22:46:39 +0000 (15:46 -0700)
cgi/bugreport.cgi
cgi/libravatar.cgi
cgi/pkgindex.cgi
cgi/pkgreport.cgi
cgi/search.cgi
cgi/soap.cgi
cgi/version.cgi

index 226258a1b26063fc48ed17d9ef5470289a3412c2..a457dfd0d208bc0e3d36f9ae657ef1a0f2b77bf1 100755 (executable)
@@ -15,6 +15,29 @@ use MIME::Decoder;
 use IO::Scalar;
 use IO::File;
 
+# if we're running out of git, we want to use the git base directory as the
+# first INC directory. If you're not running out of git, don't do that.
+use File::Basename qw(dirname);
+use Cwd qw(abs_path);
+our $debbugs_dir;
+BEGIN {
+    $debbugs_dir =
+       abs_path(dirname(abs_path(__FILE__)) . '/../');
+    # clear the taint; we'll assume that the absolute path to __FILE__ is the
+    # right path if there's a .git directory there
+    ($debbugs_dir) = $debbugs_dir =~ /([[:print:]]+)/;
+    if (defined $debbugs_dir and
+       -d $debbugs_dir . '/.git/') {
+    } else {
+       undef $debbugs_dir;
+    }
+    # if the first directory in @INC is not an absolute directory, assume that
+    # someone has overridden us via -I.
+    if ($INC[0] !~ /^\//) {
+    }
+}
+use if defined $debbugs_dir, lib => $debbugs_dir;
+
 use Debbugs::Config qw(:globals :text :config);
 
 # for read_log_records
index 81f9c73855a141dd46ed58158355d8f20c7e5926..406f696e229643b6151c079a76852718da7af36d 100755 (executable)
@@ -3,6 +3,29 @@
 use warnings;
 use strict;
 
+# if we're running out of git, we want to use the git base directory as the
+# first INC directory. If you're not running out of git, don't do that.
+use File::Basename qw(dirname);
+use Cwd qw(abs_path);
+our $debbugs_dir;
+BEGIN {
+    $debbugs_dir =
+       abs_path(dirname(abs_path(__FILE__)) . '/../');
+    # clear the taint; we'll assume that the absolute path to __FILE__ is the
+    # right path if there's a .git directory there
+    ($debbugs_dir) = $debbugs_dir =~ /([[:print:]]+)/;
+    if (defined $debbugs_dir and
+       -d $debbugs_dir . '/.git/') {
+    } else {
+       undef $debbugs_dir;
+    }
+    # if the first directory in @INC is not an absolute directory, assume that
+    # someone has overridden us via -I.
+    if ($INC[0] !~ /^\//) {
+    }
+}
+use if defined $debbugs_dir, lib => $debbugs_dir;
+
 use Debbugs::Config qw(:config);
 use Debbugs::CGI qw(cgi_parameters);
 use Debbugs::Common;
index a43428a6cd7f6362433a1c3ace25a6b2b04b3b07..007e2cf347d3d7896905d72d5ca33f4fa872b38a 100755 (executable)
@@ -4,6 +4,29 @@ use warnings;
 use strict;
 use POSIX qw(strftime nice);
 
+# if we're running out of git, we want to use the git base directory as the
+# first INC directory. If you're not running out of git, don't do that.
+use File::Basename qw(dirname);
+use Cwd qw(abs_path);
+our $debbugs_dir;
+BEGIN {
+    $debbugs_dir =
+       abs_path(dirname(abs_path(__FILE__)) . '/../');
+    # clear the taint; we'll assume that the absolute path to __FILE__ is the
+    # right path if there's a .git directory there
+    ($debbugs_dir) = $debbugs_dir =~ /([[:print:]]+)/;
+    if (defined $debbugs_dir and
+       -d $debbugs_dir . '/.git/') {
+    } else {
+       undef $debbugs_dir;
+    }
+    # if the first directory in @INC is not an absolute directory, assume that
+    # someone has overridden us via -I.
+    if ($INC[0] !~ /^\//) {
+    }
+}
+use if defined $debbugs_dir, lib => $debbugs_dir;
+
 use Debbugs::Config qw(:globals :text :config);
 use CGI::Simple;
 use Debbugs::CGI qw(:util :url :html);
index d27caa13dc39c58dd5dc0a7216d1086fd39c32a1..2efed0e6dc43497761d64bff8692a3972c84b872 100755 (executable)
@@ -18,6 +18,29 @@ BEGIN{
     delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
 }
 
+# if we're running out of git, we want to use the git base directory as the
+# first INC directory. If you're not running out of git, don't do that.
+use File::Basename qw(dirname);
+use Cwd qw(abs_path);
+our $debbugs_dir;
+BEGIN {
+    $debbugs_dir =
+       abs_path(dirname(abs_path(__FILE__)) . '/../');
+    # clear the taint; we'll assume that the absolute path to __FILE__ is the
+    # right path if there's a .git directory there
+    ($debbugs_dir) = $debbugs_dir =~ /([[:print:]]+)/;
+    if (defined $debbugs_dir and
+       -d $debbugs_dir . '/.git/') {
+    } else {
+       undef $debbugs_dir;
+    }
+    # if the first directory in @INC is not an absolute directory, assume that
+    # someone has overridden us via -I.
+    if ($INC[0] !~ /^\//) {
+    }
+}
+use if defined $debbugs_dir, lib => $debbugs_dir;
+
 binmode(STDOUT,':encoding(UTF-8)');
 use POSIX qw(strftime nice);
 use List::AllUtils qw(uniq);
index d728542ef3fdd60485c3bd3efc559cdc489c18ab..be152cb274bb2ae605ab45e013f8ffe1b263d151 100755 (executable)
@@ -11,6 +11,29 @@ BEGIN{
      }
 }
 
+# if we're running out of git, we want to use the git base directory as the
+# first INC directory. If you're not running out of git, don't do that.
+use File::Basename qw(dirname);
+use Cwd qw(abs_path);
+our $debbugs_dir;
+BEGIN {
+    $debbugs_dir =
+       abs_path(dirname(abs_path(__FILE__)) . '/../');
+    # clear the taint; we'll assume that the absolute path to __FILE__ is the
+    # right path if there's a .git directory there
+    ($debbugs_dir) = $debbugs_dir =~ /([[:print:]]+)/;
+    if (defined $debbugs_dir and
+       -d $debbugs_dir . '/.git/') {
+    } else {
+       undef $debbugs_dir;
+    }
+    # if the first directory in @INC is not an absolute directory, assume that
+    # someone has overridden us via -I.
+    if ($INC[0] !~ /^\//) {
+    }
+}
+use if defined $debbugs_dir, lib => $debbugs_dir;
+
 
 use CGI::Simple;
 
index 261042b0a88c5731ab3c35d9d93df704d550bca0..8c1ec3c5c3466d45d6168f22ec299311fc2326da 100755 (executable)
@@ -3,6 +3,29 @@
 use warnings;
 use strict;
 
+# if we're running out of git, we want to use the git base directory as the
+# first INC directory. If you're not running out of git, don't do that.
+use File::Basename qw(dirname);
+use Cwd qw(abs_path);
+our $debbugs_dir;
+BEGIN {
+    $debbugs_dir =
+       abs_path(dirname(abs_path(__FILE__)) . '/../');
+    # clear the taint; we'll assume that the absolute path to __FILE__ is the
+    # right path if there's a .git directory there
+    ($debbugs_dir) = $debbugs_dir =~ /([[:print:]]+)/;
+    if (defined $debbugs_dir and
+       -d $debbugs_dir . '/.git/') {
+    } else {
+       undef $debbugs_dir;
+    }
+    # if the first directory in @INC is not an absolute directory, assume that
+    # someone has overridden us via -I.
+    if ($INC[0] !~ /^\//) {
+    }
+}
+use if defined $debbugs_dir, lib => $debbugs_dir;
+
 #use SOAP::Transport::HTTP;
 
 use Debbugs::SOAP::Server;
index ab8f3c17a287604aa8e565165c961bd5987c0889..b7d99b96396ee68f0d51625bbe42bf37d7d35b77 100755 (executable)
@@ -11,6 +11,28 @@ BEGIN{
      }
 }
 
+# if we're running out of git, we want to use the git base directory as the
+# first INC directory. If you're not running out of git, don't do that.
+use File::Basename qw(dirname);
+use Cwd qw(abs_path);
+our $debbugs_dir;
+BEGIN {
+    $debbugs_dir =
+       abs_path(dirname(abs_path(__FILE__)) . '/../');
+    # clear the taint; we'll assume that the absolute path to __FILE__ is the
+    # right path if there's a .git directory there
+    ($debbugs_dir) = $debbugs_dir =~ /([[:print:]]+)/;
+    if (defined $debbugs_dir and
+       -d $debbugs_dir . '/.git/') {
+    } else {
+       undef $debbugs_dir;
+    }
+    # if the first directory in @INC is not an absolute directory, assume that
+    # someone has overridden us via -I.
+    if ($INC[0] !~ /^\//) {
+    }
+}
+use if defined $debbugs_dir, lib => $debbugs_dir;
 
 use CGI::Simple;