qw(%gSeverityDisplay @gTags @gSeverityList @gStrongSeverities),
qw(%gSearchEstraier),
qw(%gDistributionAliases),
+ qw(%gObsoleteSeverities),
qw(@gPostProcessall @gRemovalDefaultDistributionTags @gRemovalDistributionTags @gRemovalArchitectures),
qw(@gRemovalStrongSeverityDefaultDistributionTags),
qw(@gDefaultArchitectures),
set_default(\%config,'severity_list',[keys %{$config{severity_display}}]);
+=item obsolete_severities
+
+A hashref of obsolete severities with the replacing severity
+
+Default: {}
+
+=cut
+
+set_default(\%config,'obsolete_severities',{});
+
=item tags
An arrayref of the tags used
use POSIX qw(strftime);
+use Carp;
+
# These are a set of options which are common to all of these functions
-my %common_options = (debug => {type => SCALARREF,
+my %common_options = (debug => {type => SCALARREF|HANDLE,
optional => 1,
},
transcript => {type => SCALARREF|HANDLE,
)
)
if not exists $param{append_log} or $param{append_log};
- my @files_to_remove = map {s#db-h/$dir/##; $_} glob("db-h/$dir/$bug.*");
+ my @files_to_remove = map {s#$config{spool_dir}/db-h/$dir/##; $_} glob("$config{spool_dir}/db-h/$dir/$bug.*");
if ($config{save_old_bugs}) {
- mkpath("archive/$dir");
+ mkpath("$config{spool_dir}/archive/$dir");
foreach my $file (@files_to_remove) {
- link( "db-h/$dir/$file", "archive/$dir/$file" ) || copy( "db-h/$dir/$file", "archive/$dir/$file" );
+ link( "$config{spool_dir}/db-h/$dir/$file", "$config{spool_dir}/archive/$dir/$file" ) or
+ copy( "$config{spool_dir}/db-h/$dir/$file", "$config{spool_dir}/archive/$dir/$file" );
}
print {$transcript} "archived $bug to archive/$dir (from $param{bug})\n";
}
- unlink(map {"db-h/$dir/$_"} @files_to_remove);
+ unlink(map {"$config{spool_dir}/db-h/$dir/$_"} @files_to_remove);
print {$transcript} "deleted $bug (from $param{bug})\n";
}
bughook_archive(@bugs);
for my $bug (@bugs) {
print {$debug} "$param{bug} removing $bug\n";
my $dir = get_hashname($bug);
- my @files_to_copy = map {s#archive/$dir/##; $_} glob("archive/$dir/$bug.*");
+ my @files_to_copy = map {s#$config{spool_dir}/archive/$dir/##; $_} glob("$config{spool_dir}/archive/$dir/$bug.*");
mkpath("archive/$dir");
foreach my $file (@files_to_copy) {
# die'ing here sucks
- link( "archive/$dir/$file", "db-h/$dir/$file" ) or
- copy( "archive/$dir/$file", "db-h/$dir/$file" ) or
- die "Unable to copy archive/$dir/$file to db-h/$dir/$file";
+ link( "$config{spool_dir}/archive/$dir/$file", "$config{spool_dir}/db-h/$dir/$file" ) or
+ copy( "$config{spool_dir}/archive/$dir/$file", "$config{spool_dir}/db-h/$dir/$file" ) or
+ die "Unable to copy $config{spool_dir}/archive/$dir/$file to $config{spool_dir}/db-h/$dir/$file";
}
- push @files_to_remove, map {"archive/$dir/$_"} @files_to_copy;
+ push @files_to_remove, map {"$config{spool_dir}/archive/$dir/$_"} @files_to_copy;
print {$transcript} "Unarchived $config{bug} $bug\n";
}
unlink(@files_to_remove) or die "Unable to unlink bugs";
spec => {%common_options},
allow_extra => 1,
);
- my $fake_scalar = '';
- my $debug = globify_scalar(exists $param{debug}?$param{debug}:\$fake_scalar);
- my $transcript = globify_scalar(exists $param{transcript}?$param{transcript}:\$fake_scalar);
+ my $debug = globify_scalar(exists $param{debug}?$param{debug}:undef);
+ my $transcript = globify_scalar(exists $param{transcript}?$param{transcript}:undef);
return ($debug,$transcript);
-
}
sub __return_append_to_log_options{
- my %param = @_
+ my %param = @_;
+ my $action = $param{action} if exists $param{action};
if (not exists $param{requester}) {
$param{requester} = $config{control_internal_requester};
}
$param{request_addr} = $config{control_internal_request_addr};
}
if (not exists $param{message}) {
- $action = $param{action} if exists $param{action};
my $date = rfc822_date();
$param{message} = fill_in_template(template => 'mail/fake_control_message',
variables => {request_addr => $param{request_addr},
},
);
}
+ if (not defined $action) {
+ carp "Undefined action!";
+ $action = "unknown action";
+ }
return (action => $action,
- %param);
+ (map {exists $append_action_options{$_}?($_,$param{$_}):()}
+ keys %param),
+ );
}
($param{logfh}) = @_;
}
else {
- %param = validate_with(params => @_,
+ %param = validate_with(params => \@_,
spec => {bug_num => {type => SCALAR,
optional => 1,
},
$log =~ s/\.summary$/.log/;
($location) = $status =~ m/(db-h|db|archive)/;
}
- my $status_fh = new IO::File $status, 'r' or
+ my $status_fh = IO::File->new($status, 'r') or
warn "Unable to open $status for reading: $!" and return undef;
my %data;
sub lockreadbug {
my ($lref, $location) = @_;
- &filelock("lock/$lref");
+ &filelock("$config{spool_dir}/lock/$lref");
my $data = read_bug(bug => $lref, location => $location);
&unfilelock unless defined $data;
return $data;
return (1,$data);
}
unfilelock();
- filelock('lock/merge');
+ filelock("$config{spool_dir}/lock/merge");
$data = lockreadbug(@_);
if (not defined $data) {
unfilelock();
sub bughook_archive {
my @refs = @_;
- &filelock("debbugs.trace.lock");
+ &filelock("$config{spool_dir}/debbugs.trace.lock");
&appendfile("debbugs.trace","archive ".join(',',@refs)."\n");
my %bugs = update_realtime("$config{spool_dir}/index.db.realtime",
map{($_,'REMOVE')} @refs);
sub bughook {
my ( $type, %bugs_temp ) = @_;
- &filelock("debbugs.trace.lock");
+ &filelock("$config{spool_dir}/debbugs.trace.lock");
my %bugs;
for my $bug (keys %bugs_temp) {
bless $self, $class;
$self->{filename} = _file_from_email($self->{email});
- if (not -r $p) {
- return bless $user, "Debbugs::User";
+ if (not -r $self->{filename}) {
+ return $self;
}
- my $uf = IO::File->new($p,'r')
- or die "Unable to open file $p for reading: $!";
+ my $uf = IO::File->new($self->{filename},'r')
+ or die "Unable to open file $self->{filename} for reading: $!";
if ($need_lock) {
flock($uf, LOCK_EX);
- $user->{"locked"} = $uf;
+ $self->{"locked"} = $uf;
}
while(1) {
sub write {
my $self = shift;
- my $uf;
+
my $ut = $self->{"tags"};
my $p = $self->{"filename"};
carp "read_usertags is deprecated";
my $user = get_user($email);
- for my $t (keys %{$user->{"tags"}}) {
- $ut->{$t} = [] unless defined $ut->{$t};
- push @{$ut->{$t}}, @{$user->{"tags"}->{$t}};
+ for my $tag (keys %{$user->{"tags"}}) {
+ $usertags->{$tag} = [] unless defined $usertags->{$tag};
+ push @{$usertags->{$tag}}, @{$user->{"tags"}->{$tag}};
}
return $usertags;
}
carp "write_usertags is deprecated";
my $user = Debbugs::User->new($email,1); # locked
- $user->{"tags"} = { %{$ut} };
+ $user->{"tags"} = { %{$usertags} };
$user->write();
}
use Debbugs::Status qw(:status);
use Debbugs::CGI qw(:all);
-use vars qw($gPackagePages $gWebDomain %gSeverityDisplay @gSeverityList);
-
-if (defined $ENV{REQUEST_METHOD} and $ENV{REQUEST_METHOD} eq 'HEAD') {
- print "Content-Type: text/html; charset=utf-8\n\n";
- exit 0;
-}
-
-nice(5);
+use Debbugs::Text qw(:templates);
use CGI::Simple;
my $q = new CGI::Simple;
+if ($q->request_method() eq 'HEAD') {
+ print $q->header(-type => "text/html",
+ -charset => 'utf-8',
+ );
+ exit 0;
+}
+
our %param = cgi_parameters(query => $q,
single => [qw(ordering archive repeatmerged),
qw(bug-rev pend-rev sev-rev),
default => {ordering => 'normal',
archive => 0,
repeatmerged => 1,
+ include => [],
+ exclude => [],
},
);
}
-my $archive = ($param{'archive'} || "no") eq "yes";
my $include = $param{'&include'} || $param{'include'} || "";
my $exclude = $param{'&exclude'} || $param{'exclude'} || "";
);
my @select_key = (qw(submitter maint pkg package src usertag),
- qw(status tag maintenc owner severity newest)
+ qw(status tag maintenc owner severity newest),
+ qw(correspondent),
);
if (exists $param{which} and exists $param{data}) {
}
}
-my $Archived = $archive ? " Archived" : "";
+my $Archived = $param{archive} ? " Archived" : "";
our $this = munge_url('pkgreport.cgi?',
%param,
@bugs = get_bugs(function =>
sub {my %d=@_;
foreach my $try (splitpackages($d{"pkg"})) {
- return 1 if !getparsedaddrs($maintainers{$try});
+ return 1 if not exists $maintainers{$try};
}
return 0;
}
Subject => "Munging a bug with $command",
],
body => <<EOF) or fail 'message to control@bugs.something failed';
+debug 10
$control_command->{command} 1$control_command->{value}
thanks
EOF
'Title of bug is submitting a bug');
# Other tests for bugs in the page should be added here eventually
+
use warnings;
use strict;
-# Here, we're going to shoot messages through a set of things that can
-# happen.
-
-# First, we're going to send mesages to receive.
-# To do so, we'll first send a message to submit,
-# then send messages to the newly created bugnumber.
-
use IO::File;
use File::Temp qw(tempdir);
use Cwd qw(getcwd);
BAIL_OUT($@);
}
-# Output some debugging information if there's an error
+# Output some debugging information if we're debugging
END{
if ($ENV{DEBUG}) {
foreach my $key (keys %config) {
EOF
-# test bugreport.cgi
+# test the soap server
my $port = 11343;
END{
if (defined $child_pid) {
+ my $temp_exit = $?;
kill(15,$child_pid);
waitpid(-1,0);
+ $? = $temp_exit;
}
}
my $output='';
local $SIG{PIPE} = 'IGNORE';
local $SIG{CHLD} = sub {};
- my $pid = open3($wfd,$rfd,$rfd,'scripts/receive.in')
- or die "Unable to start receive.in: $!";
+ my $pid = open3($wfd,$rfd,$rfd,'scripts/receive')
+ or die "Unable to start receive: $!";
print {$wfd} create_mime_message($param{headers},
- $param{body}) or die "Unable to to print to receive.in";
- close($wfd) or die "Unable to close receive.in";
+ $param{body}) or die "Unable to to print to receive";
+ close($wfd) or die "Unable to close receive";
my $err = $? >> 8;
my $childpid = waitpid($pid,0);
if ($childpid != -1) {
$err = $? >> 8;
- print STDERR "receive.in pid: $pid doesn't match childpid: $childpid\n" if $childpid != $pid;
+ print STDERR "receive pid: $pid doesn't match childpid: $childpid\n" if $childpid != $pid;
}
if ($err != 0 ) {
my $rfh = IO::Handle->new_from_fd($rfd,'r') or die "Unable to create filehandle: $!";
print STDERR "Reading from STDOUT/STDERR would have blocked.";
}
print STDERR $output,qq(\n);
- die "receive.in failed with exit status $err";
+ die "receive failed with exit status $err";
}
# now we should run processall to see if the message gets processed
if ($param{run_processall}) {
- system('scripts/processall.in') == 0 or die "processall.in failed";
+ system('scripts/processall') == 0 or die "processall failed";
}
}
END {
if (defined $child_pid) {
# stop the child
+ my $temp_exit = $?;
kill(15,$child_pid);
waitpid(-1,0);
+ $? = $temp_exit;
}
}