From: Don Armstrong Date: Wed, 28 Mar 2018 22:44:51 +0000 (-0700) Subject: use the git repo base dir as INC if we're running out of git X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a62b19a9ba39ce1b719a47627853042fce3b3941;hp=f9166033f2170e5e1b3ffec3af0eac812aa97c92;p=debbugs.git use the git repo base dir as INC if we're running out of git --- diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index 226258a..a457dfd 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -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 diff --git a/cgi/libravatar.cgi b/cgi/libravatar.cgi index 81f9c73..406f696 100755 --- a/cgi/libravatar.cgi +++ b/cgi/libravatar.cgi @@ -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; diff --git a/cgi/pkgindex.cgi b/cgi/pkgindex.cgi index a43428a..007e2cf 100755 --- a/cgi/pkgindex.cgi +++ b/cgi/pkgindex.cgi @@ -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); diff --git a/cgi/pkgreport.cgi b/cgi/pkgreport.cgi index d27caa1..2efed0e 100755 --- a/cgi/pkgreport.cgi +++ b/cgi/pkgreport.cgi @@ -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); diff --git a/cgi/search.cgi b/cgi/search.cgi index d728542..be152cb 100755 --- a/cgi/search.cgi +++ b/cgi/search.cgi @@ -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; diff --git a/cgi/soap.cgi b/cgi/soap.cgi index 261042b..8c1ec3c 100755 --- a/cgi/soap.cgi +++ b/cgi/soap.cgi @@ -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; diff --git a/cgi/version.cgi b/cgi/version.cgi index ab8f3c1..b7d99b9 100755 --- a/cgi/version.cgi +++ b/cgi/version.cgi @@ -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;