use warnings;
use strict;
+# Sanitize environent for taint
+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);
use Debbugs::Config qw(:globals :text :config);
use Debbugs::Text qw(:templates);
+use Debbugs::DB;
+
+my $s;
+my @schema_arg = ();
+if (defined $config{database}) {
+ $s = Debbugs::DB->connect($config{database}) or
+ die "Unable to connect to DB";
+ @schema_arg = ('schema',$s);
+}
+
use CGI::Simple;
my $q = new CGI::Simple;
qw(bug-rev pend-rev sev-rev),
qw(maxdays mindays version),
qw(data which dist newest),
+ qw(noaffects),
],
default => $default_params,
);
}
for my $incexc (qw(include exclude)) {
next unless exists $param{$incexc};
- $param{$incexc} = [grep /\S\:\S/, make_list($param{$incexc})];
+ # normalize tag to tags
+ $param{$incexc} = [map {s/^tag:/tags:/; $_} grep /\S\:\S/, make_list($param{$incexc})];
}
for my $key (keys %package_search_keys) {
next unless exists $param{key};
exit 0;
}
+# normalize innclude/exclude keys; currently this is in two locations,
+# which is suboptimal. Closes: #567407
+for my $incexc (qw(include exclude)) {
+ next unless exists $param{$incexc};
+ # normalize tag to tags
+ $param{$incexc} = [map {s/^tag:/tags:/; $_} make_list($param{$incexc})];
+}
+
+
+
# map from yes|no to 1|0
for my $key (qw(repeatmerged bug-rev pend-rev sev-rev)) {
if (exists $param{$key}){
"ord" => [2,3,4,1,0,5],
} ],
"oldview" => [ qw(status severity) ],
- "normal" => [ qw(status severity classification) ],
+ "normal" => [ qw(status severity classification) ],
+ raw => [{nam => 'Raw',def => 'Raw'}],
);
if (exists $param{which} and exists $param{data}) {
delete $param{maintenc}
}
-
-if (not grep {exists $param{$_}} keys %package_search_keys and exists $param{users}) {
- $param{usertag} = [make_list($param{users})];
-}
-
if (exists $param{pkg}) {
$param{package} = $param{pkg};
delete $param{pkg};
}
+if (not grep {exists $param{$_}} keys %package_search_keys and exists $param{users}) {
+ $param{usertag} = [make_list($param{users})];
+}
+
my %bugusertags;
my %ut;
my %seen_users;
}
if (defined $param{usertag}) {
- my $do_not_add_usertags = grep {exists $param{$_}} keys %package_search_keys;
for my $usertag (make_list($param{usertag})) {
my %select_ut = ();
my ($u, $t) = split /:/, $usertag, 2;
$t = join(",", keys(%select_ut));
}
add_user($u,\%ut,\%bugusertags,\%seen_users,\%cats,\%hidden);
- push @{$param{tag}}, split /,/, $t unless $do_not_add_usertags;
+ push @{$param{tag}}, split /,/, $t;
}
}
-quitcgi("You have to choose something to select by") unless grep {exists $param{$_}} keys %package_search_keys;
+quitcgi("You have to choose something to select by", '400 Bad Request')
+ unless grep {exists $param{$_}} keys %package_search_keys;
my $Archived = $param{archive} ? " Archived" : "";
grep {$_ ne 'newest'}
keys %package_search_keys, 'archive'),
usertags => \%ut,
+ @schema_arg,
);
+# shove in bugs which affect this package if there is a package or a
+# source given (by default), but no affects options given
+if (not exists $param{affects} and not exists $param{noaffects} and
+ (exists $param{src} or
+ exists $param{package})) {
+ push @bugs, get_bugs((map {my $key = $_;
+ exists $param{$key}?($key =~ /^(?:package|src)$/?'affects':$key,
+ ($key eq 'src'?[map {"src:$_"}make_list($param{$key})]:$param{$_})):()}
+ grep {$_ ne 'newest'}
+ keys %package_search_keys, 'archive'),
+ usertags => \%ut,
+ @schema_arg,
+ );
+}
+
+# filter out included or excluded bugs
+
+
if (defined $param{version}) {
$title .= " at version $param{version}";
}
exclude => $exclude,
this => $this,
options => \%param,
+ @schema_arg,
(exists $param{dist})?(dist => $param{dist}):(),
);
+print "Cache-Control: public, max-age=300\n";
print "Content-Type: text/html; charset=utf-8\n\n";
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
delete $param{dist};
}
-# output infomration about the packages
+# output information about the packages
for my $package (make_list($param{package}||[])) {
print generate_package_info(binary => 1,
package => $package,
options => \%param,
bugs => \@bugs,
+ @schema_arg,
);
}
for my $package (make_list($param{src}||[])) {
package => $package,
options => \%param,
bugs => \@bugs,
+ @schema_arg,
);
}
print $result;
-print pkg_javascript() . "\n";
+print fill_in_template(template=>'cgi/pkgreport_javascript');
print qq(<h2 class="outstanding"><!--<a class="options" href="javascript:toggle(1)">-->Options<!--</a>--></h2>\n);
+$param{orderings} =
+ [uniq((grep {!$hidden{$_}} keys %cats),
+ $param{ordering})];
print option_form(template => 'cgi/pkgreport_options',
param => \%param,
form_options => $form_options,