Author: adsb
Date: 2009-04-18 16:04:47 +0000 (Sat, 18 Apr 2009)
New Revision: 1861
Modified:
trunk/debian/changelog
trunk/scripts/rc-alert.1
trunk/scripts/rc-alert.pl
Log:
rc-alert: Allow the generated list of bugs to be restricted to those
affecting packages with particular debtags facets. Thanks, Jan Hauke
Rahm. (Closes: #523523)
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2009-04-16 21:45:46 UTC (rev 1860)
+++ trunk/debian/changelog 2009-04-18 16:04:47 UTC (rev 1861)
@@ -6,6 +6,9 @@
(Closes: #523982)
* licensecheck: Add detection of the AGPL. Thanks, Didier Raboud.
(Closes: #520903)
+ * rc-alert: Allow the generated list of bugs to be restricted to those
+ affecting packages with particular debtags facets. Thanks, Jan Hauke
+ Rahm. (Closes: #523523)
* rmadison: Allow a default URL to be specified in the configuration file.
Thanks, Roland Mas. (Closes: #524198)
Modified: trunk/scripts/rc-alert.1
===================================================================
--- trunk/scripts/rc-alert.1 2009-04-16 21:45:46 UTC (rev 1860)
+++ trunk/scripts/rc-alert.1 2009-04-18 16:04:47 UTC (rev 1861)
@@ -2,7 +2,7 @@
.SH NAME
rc-alert \- check for installed packages with release-critical bugs
.SH SYNOPSIS
-\fBrc-alert [inclusion options] [package ...]\fR
+\fBrc-alert [inclusion options] [\-\-debtags [tag[,tag ...]] [package ...]\fR
.br
\fBrc-alert \-\-help|\-\-version\fR
.SH DESCRIPTION
@@ -24,7 +24,7 @@
.TP
.BR \-\-version ", " \-v
Show version and copyright information.
-.TP
+.P
It is also possible to filter the list of bugs reported based on the
tags and distributions associated with the package. The filtering options
are:
@@ -62,6 +62,20 @@
If set to \fIand\fP, a bug must apply to all of the specified distributions
in order to be excluded. By default the bug will be excluded if it applies
to any of the listed distributions.
+.P
+It is also possible to only list bugs which have specific debtags set. Note
+that you need to have debtags installed and also that it's not mandatory for
+maintainers to set proper debtags. The produced list will thus probably be
+incomplete.
+.TP
+.BR \-\-debtags
+Match packages based on the listed tags. Each package is matched only if it has
+all the listed tags; in the case of multiple tags within the same facet, a
+package is matched if it has any of the listed tags within the facet.
+.TP
+.BR \-\-debtags\-database
+Use a non-standard debtags database. The default is
+/var/lib/debtags/packages-tags.
.SH EXAMPLES
.TP
.BR \-\-include\-dists " OS"
@@ -76,11 +90,18 @@
.BR \-\-exclude\-dists " SOT" " \-\-include\-tags" " R"
The bug must apply to only unstable or experimental (or both) and be tagged
unreproducible
+.TP
+.BR \-\-debtags " implemented-in::perl,role::plugin,implemented-in::python"
+The bug must apply to packages matching the specified debtags, i.e. the match
+will only include packages that have the ‘role::plugin’ tag and that have
+either of the tags ‘implemented-in::perl’ or ‘implemented-in::python’.
.SH BUGS
It is not possible to say "does not apply only to unstable"
.SH SEE ALSO
+.BR debtags(1)
.BR popbugs(1)
.SH AUTHOR
\fBrc-alert\fR was written by Anthony DeRobertis and modified by
Julian Gilbey <[email protected]> and Adam D. Barratt <[email protected]>
-for the devscripts package.
+for the devscripts package. Debtags functionality was added by Jan Hauke Rahm
+<[email protected]>.
Modified: trunk/scripts/rc-alert.pl
===================================================================
--- trunk/scripts/rc-alert.pl 2009-04-16 21:45:46 UTC (rev 1860)
+++ trunk/scripts/rc-alert.pl 2009-04-18 16:04:47 UTC (rev 1861)
@@ -4,6 +4,7 @@
# Copyright (C) 2003 Anthony DeRobertis
# Modifications Copyright 2003 Julian Gilbey <[email protected]>
# Modifications Copyright 2008 Adam D. Barratt <[email protected]>
+# Modifications copyright 2009 by Jan Hauke Rahm <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,6 +30,7 @@
sub print_if_relevant(%);
sub human_flags($);
sub unhtmlsanit($);
+sub dt_parse_request($);
my $cachedir = $ENV{'HOME'}."/.devscripts_cache/";
my $url = "http://bugs.debian.org/release-critical/other/all.html";
@@ -63,6 +65,9 @@
my $distincoperation = "or";
my $distexcoperation = "or";
+my $debtags = '';
+my $debtags_db = '/var/lib/debtags/package-tags';
+
my $progname = basename($0);
my $usage = <<"EOF";
@@ -83,6 +88,11 @@
--include-dist-op Must all distributions be matched for inclusion?
--exclude-dists Set of distributions to exclude
--exclude-dist-op Must all distributions be matched for exclusion?
+
+ Debtags options: (only list packages with matching debtags)
+ --debtags Comma separated list of tags
+ (e.g. implemented-in::perl,role::plugin)
+ --debtags-database Database file (default: /var/lib/debtags/package-tags)
EOF
my $version = <<"EOF";
@@ -90,6 +100,7 @@
This code is copyright 2003 by Anthony DeRobertis
Modifications copyright 2003 by Julian Gilbey <[email protected]>
Modifications copyright 2008 by Adam D. Barratt <[email protected]>
+Modifications copyright 2009 by Jan Hauke Rahm <[email protected]>
This program comes with ABSOLUTELY NO WARRANTY.
You are free to redistribute this code under the terms of the
GNU General Public License, version 2, or (at your option) any later version.
@@ -111,6 +122,8 @@
"exclude-dists=s" => \$excludedists,
"include-dist-op|o=s" => \$distincoperation,
"exclude-dist-op=s" => \$distexcoperation,
+ "debtags=s" => \$debtags,
+ "debtags-database=s" => \$debtags_db,
);
if ($opt_help) { print $usage; exit 0; }
@@ -164,6 +177,22 @@
$package_list = InstalledPackages(0);
}
+## Get debtags info
+my %dt_pkg;
+my @dt_requests;
+if ($debtags) {
+ ## read debtags database to %dt_pkg
+ open DEBTAGS, $debtags_db or die "$progname: could not read debtags
database: $!\n";
+ while (<DEBTAGS>) {
+ next unless /^(.+?)(?::?\s*|:\s+(.+?)\s*)$/;
+ $dt_pkg{$1} = $2;
+ }
+ close DEBTAGS;
+
+ ## and parse the request string
+ @dt_requests = dt_parse_request($debtags);
+}
+
## Read the list of bugs
my $found_bugs_start;
@@ -210,6 +239,12 @@
return unless $flagsapply and $distsapply;
+ foreach (@dt_requests) {
+ ## the array should be empty if nothing requested
+ return unless ($dt_pkg{$args{pkg}} and
+ $dt_pkg{$args{pkg}} =~ /(\A|,\s*)$_(,|\z)/);
+ }
+
# yep, relevant
print "Package: $args{pkg}\n",
$comment, # non-empty comments always contain the trailing \n
@@ -217,6 +252,8 @@
"Title: " . unhtmlsanit($args{name}) , "\n",
"Flags: " . $flags , "\n",
(defined $args{dists} ? "Dists: " . $dists . "\n" : ""),
+ (defined $dt_pkg{$args{pkg}} ?
+ "Debtags: " . $dt_pkg{$args{pkg}} . "\n" : ""),
"\n";
}
}
@@ -302,3 +339,24 @@
$in =~ s/&(lt|gt|amp|quot);/$saniarray{$1}/g;
return $in;
}
+
+sub dt_parse_request($) {
+ my %dt_lookup;
+ foreach (split /,/, $_[0]) {
+ my ($d_key, $d_val) = split '::', $_;
+ die "$progname: A debtag must be of the form 'key::value'. See
debtags(1) for details!"
+ unless ($d_key and $d_val);
+ if ($dt_lookup{$d_key}) {
+ $dt_lookup{$d_key} = "$dt_lookup{$d_key}|$d_val";
+ } else {
+ $dt_lookup{$d_key} = quotemeta($d_val);
+ }
+ }
+
+ my @out;
+ while (my ($dk, $dv) = each %dt_lookup) {
+ $dv = "($dv)" if ($dv =~ /\|/);
+ push @out, $dk . "::" . $dv;
+ }
+ return @out;
+}
--
To unsubscribe, send mail to [email protected].