use IO::File;
use File::Path;
-
my %options = (debug => 0,
help => 0,
man => 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',
);
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);
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
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';
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";
);
my ($output,$error) = ('','');
my $h = IPC::Run::start(['rsync',@{$param{options}}],
- \undef,\$output,\$error);
+ \undef,$param{log},$param{log});
while ($h->pump) {
- print {$param{log}} $output,$error;
#print {$param{debug}} $error if defined $param{debug};
}
$h->finish();