]> git.donarmstrong.com Git - debbugs.git/commitdiff
fix issues with localconfig in local-debbugs
authorDon Armstrong <don@donarmstrong.com>
Mon, 29 Aug 2016 15:30:32 +0000 (08:30 -0700)
committerDon Armstrong <don@donarmstrong.com>
Mon, 29 Aug 2016 15:30:32 +0000 (08:30 -0700)
Debbugs/Common.pm
Debbugs/Packages.pm
bin/local-debbugs

index 2bc3e0dfe3280143f0243b6ae8df189376ead1a7..86c782300e00b5c3edf3dd709825917d446d311f 100644 (file)
@@ -364,7 +364,7 @@ sub package_maintainer {
        for my $fn (@config{('source_maintainer_file',
                             'source_maintainer_file_override',
                             'pseudo_maint_file')}) {
-           next unless defined $fn;
+           next unless defined $fn and length $fn;
            if (not -e $fn) {
                warn "Missing source maintainer file '$fn'";
                next;
@@ -471,7 +471,8 @@ sub getpseudodesc {
     return $_pseudodesc if defined $_pseudodesc;
     $_pseudodesc = {};
     __add_to_hash($config{pseudo_desc_file},$_pseudodesc) if
-       defined $config{pseudo_desc_file};
+       defined $config{pseudo_desc_file} and
+       length $config{pseudo_desc_file};
     return $_pseudodesc;
 }
 
index f2ba789b14d1c0ccd149dddcf7172a49b351969a..c9f3f8f6482f1e183dfbc8f595a0809a1585d3ee 100644 (file)
@@ -72,7 +72,8 @@ our $_pkgcomponent;
 our $_srcpkg;
 sub getpkgsrc {
     return $_pkgsrc if $_pkgsrc;
-    return {} unless defined $Debbugs::Packages::gPackageSource;
+    return {} unless defined $config{package_source} and
+       length $config{package_source};
     my %pkgsrc;
     my %pkgcomponent;
     my %srcpkg;
index 25c47c9300671f9e9a7a8e332627d898252c0840..8f4e5ca192e2a442859259da7a0ef80bdb8d3696 100755 (executable)
@@ -123,7 +123,6 @@ use IPC::Run;
 use IO::File;
 use File::Path;
 
-
 my %options = (debug           => 0,
               help            => 0,
               man             => 0,
@@ -131,7 +130,7 @@ my %options = (debug           => 0,
               quiet           => 0,
               detach          => 1,
               cgi_bin         => '/var/lib/debbugs/www/cgi',
-              css             => '/var/lib/debbugs/www/bugs.css',
+              css             => '/var/lib/debbugs/www/css/bugs.css',
               bug_site        => 'bugs.debian.org',
               bug_mirror      => 'bugs-mirror.debian.org',
               );
@@ -160,11 +159,9 @@ my @USAGE_ERRORS;
 if (1 != grep {exists $options{$_}} qw(daemon show search mirror stop)) {
      push @USAGE_ERRORS,"You must pass one (and only one) of --daemon --show --search or --mirror";
 }
-$options{verbose} = $options{verbose} - $options{quiet};
 
 pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
 
-
 # munge in local configuration
 
 local_config(\%options);
@@ -182,7 +179,21 @@ if ($options{daemon}) {
         not defined $pid) {
          print STDERR "Unable to determine if daemon is running: $!\n";
          exit 1;
-     }
+      }
+     my $conf = IO::File->new($options{mirror_location}.'/debbugs_config_local','w') or
+        die "Unable to open $options{mirror_location}/debbugs_config_local for writing: $!";
+     print {$conf} <<"EOF";
+\$gConfigDir = "$options{mirror_location}";
+\$gSpoolDir = "$options{mirror_location}";
+\$gWebHost = 'localhost:$options{port}';
+\$gPackageSource = '';
+\$gPseudoDescFile = '';
+\$gPseudoMaintFile = '';
+\$gProject = 'Local Debbugs';
+1;
+EOF
+     close $conf;
+     $ENV{DEBBUGS_CONFIG_FILE} = $options{mirror_location}.'/debbugs_config_local';
      # ok, now lets daemonize
 
      # XXX make sure that all paths have been turned into absolute
@@ -206,7 +217,8 @@ if ($options{daemon}) {
          package local_debbugs::server;
          use IO::File;
          use HTTP::Server::Simple;
-         use base qw(HTTP::Server::Simple::CGI);
+         use base qw(HTTP::Server::Simple::CGI HTTP::Server::Simple::CGI::Environment);
+         use Cwd qw(getcwd);
 
          sub net_server {
               return 'Net::Server::Fork';
@@ -260,7 +272,10 @@ if ($options{daemon}) {
                    redirect($cgi,$base_uri."/cgi-bin/pkgreport.cgi?pkg=$1");
               }
               elsif ($path =~ m{^/?cgi(?:-bin)?/((?:(?:bug|pkg)report|version)\.cgi)}) {
-                   # dispatch to pkgreport.cgi
+                  # dispatch to pkgreport.cgi
+                  $ENV{DEBBUGS_CONFIG_FILE} = $options{mirror_location}.'/debbugs_config_local';
+                  $ENV{PERL5LIB} = "/home/don/projects/debbugs/debbugs";
+
                    print "HTTP/1.1 200 OK\n";
                    exec("$options{cgi_bin}/$1") or
                         die "Unable to execute $options{cgi_bin}/$1";