Package: devscripts
Version: 2.10.47
Severity: wishlist
File: /usr/bin/rc-alert
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA224

Hi,

I'd like to see debtags functionality added to rc-alert (maybe also to
wnpp-alert -- I'll have a look at it later). Reason is simple:
contributors want to help but probably don't know every programming
language. With debtags you can filter for packages implemented in a
specific language.

I've attached a patch to add this feature. It's very simple by now and
only allows one debtag to look for. I consider extending that feature if
you're willing to add it at all. :)

rc-alert --debtags implemented-in::python

I like it. :)

Hauke
(jhr on irc.debian.org)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iFYEARELAAYFAknfqYgACgkQGOp6XeD8cQ12VQDfUD6wv9gWALP8FA+irWDpH9TL
YosDBj/sIaOBeQDfT24ARmyTaYkaWXRp6jl10XPc8LV/yVTKyl9Qmg==
=bKpB
-----END PGP SIGNATURE-----
Index: scripts/rc-alert.pl
===================================================================
--- scripts/rc-alert.pl	(revision 1849)
+++ scripts/rc-alert.pl	(working copy)
@@ -35,6 +35,7 @@
 my $cachefile = $cachedir . basename($url);
 my $forcecache = 0;
 my $usecache = 0;
+my $debtags_db = '/var/lib/debtags/package-tags';
 
 my %flagmap = ( '(P)' => "pending",
 		'.(\+)' => "patch",
@@ -63,6 +64,8 @@
 my $distincoperation = "or";
 my $distexcoperation = "or";
 
+my $debtags = '';
+
 my $progname = basename($0);
 
 my $usage = <<"EOF";
@@ -83,6 +86,9 @@
   --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 debtag)
+  --debtags          tags (comma seperated, e.g. implemented-in::perl,role::plugin)
 EOF
 
 my $version = <<"EOF";
@@ -90,6 +96,7 @@
 This code is copyright 2003 by Anthony DeRobertis
 Modifications copyright 2003 by Julian Gilbey <j...@debian.org>
 Modifications copyright 2008 by Adam D. Barratt <ad...@adam-barratt.org.uk>
+Modifications copyright 2009 by Jan Hauke Rahm <in...@jhr-online.de>
 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 +118,7 @@
 	   "exclude-dists=s" => \$excludedists,
 	   "include-dist-op|o=s" => \$distincoperation,
 	   "exclude-dist-op=s" => \$distexcoperation,
+       "debtags=s" => \$debtags,
 	   );
 
 if ($opt_help) { print $usage; exit 0; }
@@ -164,6 +172,18 @@
     $package_list = InstalledPackages(0);
 }
 
+## Get debtags info
+my %dt_pkg;
+if ($debtags) {
+    open DEBTAGS, $debtags_db or die "$progname: could not read debtags database: $!\n";
+    while (defined(my $line = <DEBTAGS>)) {
+        if ($line =~ /^(.+?)(?::?\s*|:\s+(.+?)\s*)$/) {
+            $dt_pkg{$1} = $2;
+        }
+    }
+    close DEBTAGS;
+}
+
 ## Read the list of bugs
 
 my $found_bugs_start;
@@ -210,6 +230,10 @@
 	
 	return unless $flagsapply and $distsapply;
 
+    if ($debtags) {
+        return unless ($dt_pkg{$args{pkg}} and $dt_pkg{$args{pkg}} =~ /$debtags/);
+    }
+
 	# yep, relevant
 	print "Package: $args{pkg}\n",
 	    $comment,  # non-empty comments always contain the trailing \n
Index: scripts/rc-alert.1
===================================================================
--- scripts/rc-alert.1	(revision 1849)
+++ scripts/rc-alert.1	(working copy)
@@ -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] [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,15 @@
 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
+Then it is possible to only list bugs which have a specific debtag set. Note
+that you need to have debtags installed and also that it's not mandatory for
+maintainers to set proper debtags by now. Thus the produced list is probably
+incomplete.
+.TP
+.BR \-\-debtags
+One debtag that you want to look for, e.g. implemented-in::perl which would
+only list bugs in packages which are (now guess!) implemented in perl.
 .SH EXAMPLES
 .TP
 .BR \-\-include\-dists " OS"
@@ -83,4 +92,5 @@
 .SH AUTHOR
 \fBrc-alert\fR was written by Anthony DeRobertis and modified by
 Julian Gilbey <j...@debian.org> and Adam D. Barratt <a...@adam-barratt.org.uk>
-for the devscripts package.
+for the devscripts package. Debtags functionality was added by Jan Hauke Rahm
+<i...@jhr-online.de>.

Reply via email to