use IO::File;
use Debbugs::Status qw(splitpackages get_bug_status);
use Debbugs::Packages qw(getsrcpkgs getpkgsrc);
-use Debbugs::Common qw(getparsedaddrs getmaintainers getmaintainers_reverse make_list);
+use Debbugs::Common qw(getparsedaddrs package_maintainer getmaintainers make_list);
use Fcntl qw(O_RDONLY);
use MLDBM qw(DB_File Storable);
use List::Util qw(first);
}
my @bugs;
BUG: while (<$flatfile>) {
- next unless m/^(\S+)\s+(\d+)\s+(\d+)\s+(\S+)\s+\[\s*([^]]*)\s*\]\s+(\w+)\s+(.*)$/;
+ next unless m/^(\S+)\s+(\d+)\s+(\d+)\s+(\S+)\s+\[\s*(.*)\s*\]\s+(\w+)\s+(.*)$/;
my ($pkg,$bug,$time,$status,$submitter,$severity,$tags) = ($1,$2,$3,$4,$5,$6,$7);
next if $grep_bugs and not exists $bugs{$bug};
if (exists $param{package}) {
}
if (exists $param{maint}) {
my $key_inc = 0;
- my $maint_rev = getmaintainers_reverse();
my %_temp_p = ();
- for my $package (map { exists $maint_rev->{$_}?@{$maint_rev->{$_}}:()}
- make_list($param{maint})) {
+ for my $package (package_maintainer(maintainer=>$param{maint})) {
$packages{$package}++ unless exists $_temp_p{$package};
$_temp_p{$package} = 1;
$key_inc = 1;
}
my @links = ();
for my $type (qw(src package)) {
- push @links, map {(munge_url('pkgreport.cgi?',
+ push @links, map {my $t_type = $type;
+ if ($_ =~ s/^src://) {
+ $t_type = 'src';
+ }
+ (munge_url('pkgreport.cgi?',
%options,
- $type => $_,
+ $t_type => $_,
),
- ($type eq 'src'?'src:':'').$_);
+ ($t_type eq 'src'?'src:':'').$_);
} make_list($param{$type}) if exists $param{$type};
}
for my $type (qw(maint owner submitter correspondent)) {
$temp =~ s{(\d+)}
{bug_links(bug=>$1)}ge;
$temp;]gxie;
-
+ if (defined $config{cve_tracker} and
+ length $config{cve_tracker}
+ ) {
+ # Add links to CVE vulnerabilities (closes #568464)
+ $body =~ s{(CVE-\d{4}-\d{4,})}
+ {<a href="http://$config{cve_tracker}$1">$1</a>}gx;
+ }
if (not exists $param{att}) {
print {$param{output}} qq(<pre class="message">$body</pre>\n);
}
@EXPORT = ();
%EXPORT_TAGS = (html => [qw(short_bug_status_html pkg_htmlizebugs),
- qw(pkg_javascript),
- qw(pkg_htmlselectyesno pkg_htmlselectsuite),
- qw(buglinklist pkg_htmlselectarch)
],
- misc => [qw(generate_package_info make_order_list),
- qw(myurl),
- qw(get_bug_order_index determine_ordering),
+ misc => [qw(generate_package_info),
+ qw(determine_ordering),
],
);
@EXPORT_OK = (qw());
spec => {binary => {type => BOOLEAN,
default => 1,
},
- package => {type => SCALAR|ARRAYREF,
+ package => {type => SCALAR,#|ARRAYREF,
},
options => {type => HASHREF,
},
if (defined $config{subscription_domain} and
length $config{subscription_domain}) {
my $ptslink = $param{binary} ? $srcforpkg : $package;
+ # the pts only wants the source, and doesn't care about src: (#566089)
+ $ptslink =~ s/^src://;
push @references, q(to the <a href="http://).html_escape("$config{subscription_domain}/$ptslink").q(">Package Tracking System</a>);
}
# Only output this if the source listing is non-trivial.
if (@blocks && $status{"pending"} ne 'fixed' && ! length($status{done})) {
for my $b (@blocks) {
my %s = %{get_bug_status($b)};
- next if $s{"pending"} eq 'fixed' || length $s{done};
+ next if (defined $s{pending} and $s{pending} eq 'fixed') or (defined $s{done} and length $s{done});
push @{$status{blocks_array}}, {bug_num => $b, subject => $s{subject}, status => \%s};
}
}
return $result;
}
-sub pkg_javascript {
- return fill_in_template(template=>'cgi/pkgreport_javascript',
- );
-}
-
-sub pkg_htmlselectyesno {
- my ($name, $n, $y, $default) = @_;
- return sprintf('<select name="%s"><option value=no%s>%s</option><option value=yes%s>%s</option></select>', $name, ($default ? "" : " selected"), $n, ($default ? " selected" : ""), $y);
-}
-
-sub pkg_htmlselectsuite {
- my $id = sprintf "b_%d_%d_%d", $_[0], $_[1], $_[2];
- my @suites = ("stable", "testing", "unstable", "experimental");
- my %suiteaka = ("stable", "etch", "testing", "lenny", "unstable", "sid");
- my $defaultsuite = "unstable";
-
- my $result = sprintf '<select name=dist id="%s">', $id;
- for my $s (@suites) {
- $result .= sprintf '<option value="%s"%s>%s%s</option>',
- $s, ($defaultsuite eq $s ? " selected" : ""),
- $s, (defined $suiteaka{$s} ? " (" . $suiteaka{$s} . ")" : "");
- }
- $result .= '</select>';
- return $result;
-}
-
-sub pkg_htmlselectarch {
- my $id = sprintf "b_%d_%d_%d", $_[0], $_[1], $_[2];
- my @arches = qw(alpha amd64 arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc);
-
- my $result = sprintf '<select name=arch id="%s">', $id;
- $result .= '<option value="any">any architecture</option>';
- for my $a (@arches) {
- $result .= sprintf '<option value="%s">%s</option>', $a, $a;
- }
- $result .= '</select>';
- return $result;
-}
-
-sub myurl {
- my %param = @_;
- return html_escape(pkg_url(map {exists $param{$_}?($_,$param{$_}):()}
- qw(archive repeatmerged mindays maxdays),
- qw(version dist arch package src tag maint submitter)
- )
- );
-}
-
-sub make_order_list {
- my $vfull = shift;
- my @x = ();
-
- if ($vfull =~ m/^([^:]+):(.*)$/) {
- my $v = $1;
- for my $vv (split /,/, $2) {
- push @x, "$v=$vv";
- }
- }
- else {
- for my $v (split /,/, $vfull) {
- next unless $v =~ m/.=./;
- push @x, $v;
- }
- }
- push @x, ""; # catch all
- return @x;
-}
-
sub get_bug_order_index {
my $order = shift;
my $status = shift;
return $pos + 1;
}
-sub buglinklist {
- my ($prefix, $infix, @els) = @_;
- return '' if not @els;
- return $prefix . bug_linklist($infix,'submitter',@els);
-}
-
-
# sets: my @names; my @prior; my @title; my @order;
sub determine_ordering {
binary => {type => SCALAR|ARRAYREF,
default => [],
},
+ maintainer => {type => SCALAR|ARRAYREF,
+ default => [],
+ },
rehash => {type => BOOLEAN,
default => 0,
},
},
},
);
+ my @binary = make_list($param{binary});
+ my @source = make_list($param{source});
+ my @maintainers = make_list($param{maintainer});
+ if ((@binary or @source) and @maintainers) {
+ croak "It is nonsensical to pass both maintainers and source or binary";
+ }
if ($param{rehash}) {
$_source_maintainer = undef;
$_source_maintainer_rev = undef;
$_source_maintainer_rev = {};
for my $fn (@config{('source_maintainer_file',
'source_maintainer_file_override',
- 'pseduo_maint_file')}) {
+ 'pseudo_maint_file')}) {
next unless defined $fn;
if (not -e $fn) {
warn "Missing source maintainer file '$fn'";
$_maintainer_rev = {};
for my $fn (@config{('maintainer_file',
'maintainer_file_override',
- 'pseduo_maint_file')}) {
+ 'pseudo_maint_file')}) {
next unless defined $fn;
if (not -e $fn) {
warn "Missing maintainer file '$fn'";
}
}
my @return;
- my @extra_source;
- my $b = $param{reverse}?$_maintainer_rev:$_maintainer;
- for my $binary (make_list($param{binary})) {
+ for my $binary (@binary) {
if (not $param{reverse} and $binary =~ /^src:/) {
- push @extra_source,$binary;
+ push @source,$binary;
next;
}
- push @return,grep {defined $_} make_list($b->{$binary});
+ push @return,grep {defined $_} make_list($_maintainer->{$binary});
}
- my $s = $param{reverse}?$_source_maintainer_rev:$_source_maintainer;
- for my $source (make_list($param{source},@extra_source)) {
+ for my $source (@source) {
$source =~ s/^src://;
- push @return,grep {defined $_} make_list($s->{$source});
+ push @return,grep {defined $_} make_list($_source_maintainer->{$source});
+ }
+ for my $maintainer (grep {defined $_} @maintainers) {
+ push @return,grep {defined $_}
+ make_list($_maintainer_rev->{$maintainer});
+ push @return,map {$_ !~ /^src:/?'src:'.$_:$_}
+ grep {defined $_}
+ make_list($_source_maintainer_rev->{$maintainer});
}
return @return;
}
qw($gVersionPackagesDir $gVersionIndex $gBinarySourceMap $gSourceBinaryMap),
qw($gVersionTimeIndex),
qw($gSimpleVersioning),
+ qw($gCVETracker),
qw($gSendmail $gLibPath $gSpamScan @gExcludeFromControl),
qw(%gSeverityDisplay @gTags @gSeverityList @gStrongSeverities),
qw(%gTagsSingleLetter),
=cut
-
set_default(\%config,'subscription_domain',undef);
+
+=item cve_tracker $gCVETracker
+
+URI to CVE security tracker; in bugreport.cgi, CVE-2001-0002 becomes
+linked to http://$config{cve_tracker}CVE-2001-002
+
+Default: security-tracker.debian.org/tracker/
+
+=cut
+
+set_default(\%config,'cve_tracker','security-tracker.debian.org/tracker/');
+
+
=back
=cut
$hash_name =~ s/^([\$\%\@])g//;
my $glob_type = $1;
my $glob_name = 'g'.$hash_name;
- $hash_name =~ s/(HTML|CGI)/ucfirst(lc($1))/ge;
+ $hash_name =~ s/(HTML|CGI|CVE)/ucfirst(lc($1))/ge;
$hash_name =~ s/^([A-Z]+)/lc($1)/e;
$hash_name =~ s/([A-Z]+)/'_'.lc($1)/ge;
return $hash_name unless wantarray;
}
if (not $match) {
$going_to_fail = 1;
- print {$transcript} "$field: '".join(', ',make_list($data->{$field})).
+ print {$transcript} qq($field: ).join(', ',map{qq("$_")} make_list($data->{$field})).
"' does not match at least one of ".
- join(', ',map {ref($_)?'(regex)':$_} make_list($param{limit}{$field}))."\n";
+ join(', ',map {ref($_)?'(regex)':qq("$_")} make_list($param{limit}{$field}))."\n";
}
}
}
my $entity = shift;
my $type = $entity->effective_type;
if ($type eq 'text/plain' or
- ($type =~ m#text/# and $type ne 'text/html') or
+ ($type =~ m#text/?# and $type ne 'text/html') or
$type eq 'application/pgp') {
return $entity->bodyhandle;
} elsif ($type eq 'multipart/alternative') {
# Strip off RFC2440-style PGP clearsigning.
if (@bodylines and $bodylines[0] =~ /^-----BEGIN PGP SIGNED/) {
- shift @bodylines while @bodylines and length $bodylines[0];
+ shift @bodylines while @bodylines and
+ length $bodylines[0] and
+ # we currently don't strip \r; handle this for the
+ # time being, though eventually it should be stripped
+ # too, I think. [See #565981]
+ $bodylines[0] ne "\r";
shift @bodylines while @bodylines and $bodylines[0] !~ /\S/;
for my $findsig (0 .. $#bodylines) {
if ($bodylines[$findsig] =~ /^-----BEGIN PGP SIGNATURE/) {
}
my %versions;
for my $package (make_list($param{package})) {
+ my $source_only = 0;
+ if ($package =~ s/^src://) {
+ $source_only = 1;
+ }
my $version = $versions->{$package};
next unless defined $version;
for my $dist (make_list($param{dist})) {
make_list($param{arch}):
(grep {not $param{no_source_arch} or
$_ ne 'source'
- } keys %{$version->{$dist}})) {
+ } $source_only?'source':keys %{$version->{$dist}})) {
next unless defined $version->{$dist}{$arch};
for my $ver (ref $version->{$dist}{$arch} ?
keys %{$version->{$dist}{$arch}} :
addfoundversions($status,$package,$version,$isbinary);
-
+All use of this should be phased out in favor of Debbugs::Control::fixed/found
=cut
return unless defined $version;
undef $package if $package =~ m[(?:\s|/)];
my $source = $package;
+ if ($package =~ s/^src://) {
+ $isbinary = 0;
+ $source = $package;
+ }
if (defined $package and $isbinary) {
my @srcinfo = binary_to_source(binary => $package,
}
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}){
# 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{source} or
+ (exists $param{src} or
exists $param{package})) {
- push @bugs, get_bugs((map {exists $param{$_}?($_ =~ /^(?:package|source)$/?'affects':$_,
- ($_ eq 'source'?'src:'.$param{$_}:$param{$_})):()}
+ 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,
);
}
+# filter out included or excluded bugs
+
+
if (defined $param{version}) {
$title .= " at version $param{version}";
}
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);
#497144)
* Fix problem with non-existant /etc/debbugs/config
* Ditch \r and \n in status fields (closes: #545895)
+ * Properly handle source packages when searching by maintainer; use
+ package_maintainer instead of the hashes (closes: #556863)
+ * Handle \r properly in Debbugs::MIME for PGP signatures
+ (closes: #565981). Thanks to Mike Hommey
+ * Allow type to be text as well as text/(something not html)
+ (closes: #566068). Thanks to Mike Hommey.
+ * Fix links to PTS pages for src packages (closes: #566089). Thanks to
+ Sandro Tosi.
+ * Fix affects for source packages (closes: #563470). Thanks to Charles
+ Plessy.
+ * Allow tag instead of tags; silently normalize it (closes: #567407).
+ Thanks to Martin Krafft.
+ * Properly handle Forwarded: at submit@ time (closes: #568020). Thanks
+ to Martin Krafft.
+ * Fix source package src: urls
+ * Use package_maintainer to search for packages maintained by a
+ maintainer (closes: #556863). Thanks to Yves-Alexis Perez.
+ * Linkify CVE reports (closes: #568464). Thanks to Martin Zobel-Helas.
-- Don Armstrong <don@debian.org> Wed, 26 Aug 2009 21:32:53 -0700
$data->{owner}= $pheader{owner};
}
if (defined($pheader{forwarded})) {
- $data->{'forwarded-to'} = $pheader{forwarded};
+ $data->{forwarded} = $pheader{forwarded};
}
&filelock("nextnumber.lock");
open(N,"nextnumber") || die "nextnumber: read: $!";
foo main foo
END
"$config_dir/pseudo-packages.description" => '',
+ "$config_dir/pseudo-packages.maint" => '',
);
while (my ($file,$contents) = each %files_to_create) {
system('mkdir','-p',dirname($file));