Package: devscripts
Severity: wishlist

The attached diff gives the ability to use the status bits in the bts
to do fun things, like the following:

$ ./scripts/bts.pl status 300000
bug_num: 300000
source: unknown
done: NoèlKöthe <[EMAIL PROTECTED]>
found_versions: 0.51-2
blocks: 
fixed: crypt-ssleay/0.51-3 => 
date: 1111072040
fixed_versions: crypt-ssleay/0.51-3
mergedwith: 
found: 0.51-2 => 
blockedby: 
unarchived: 
keywords: 
summary: 
msgid: <[EMAIL PROTECTED]>
forwarded: 
id: 300000
severity: minor
owner: 
location: archive
log_modified: 1111656819
subject: libcrypt-ssleay-perl: package description typo(s) and the like
originator: Florian Zumbiehl <[EMAIL PROTECTED]>
pending: done
archived: 1
affects: 
package: libcrypt-ssleay-perl
fixed_date: 
tags: 
found_date: 


$ echo -e '300000\n300001\n' |./scripts/bts.pl status file:-
bug_num: 300000
source: unknown
done: NoèlKöthe <[EMAIL PROTECTED]>
found_versions: 0.51-2
blocks: 
fixed: crypt-ssleay/0.51-3 => 
date: 1111072040
fixed_versions: crypt-ssleay/0.51-3
mergedwith: 
found: 0.51-2 => 
blockedby: 
unarchived: 
keywords: 
summary: 
msgid: <[EMAIL PROTECTED]>
forwarded: 
id: 300000
severity: minor
owner: 
location: archive
log_modified: 1111656819
subject: libcrypt-ssleay-perl: package description typo(s) and the like
originator: Florian Zumbiehl <[EMAIL PROTECTED]>
pending: done
archived: 1
affects: 
package: libcrypt-ssleay-perl
fixed_date: 
tags: 
found_date: 

bug_num: 300001
source: unknown
done: Craig Small <[EMAIL PROTECTED]>
found_versions: 0.8.0-1
blocks: 
fixed: jffnms/0.8.1-2 => 
date: 1111072046
fixed_versions: jffnms/0.8.1-2
mergedwith: 
found: 0.8.0-1 => 
blockedby: 
unarchived: 
keywords: 
summary: 
msgid: <[EMAIL PROTECTED]>
forwarded: 
id: 300001
severity: minor
owner: 
location: archive
log_modified: 1112745789
subject: jffnms: package description typo(s) and the like
originator: Florian Zumbiehl <[EMAIL PROTECTED]>
pending: done
archived: 1
affects: 
package: jffnms
fixed_date: 
tags: 
found_date: 



Don Armstrong

-- 
Religion is religion, however you wrap it, and like Quell says, a
preoccupation with the next world clearly signals an inability to cope
credibly with this one.
 -- Richard K. Morgan "Broken Angels" p65

http://www.donarmstrong.com              http://rzlab.ucr.edu
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 1586)
+++ debian/changelog	(working copy)
@@ -1,3 +1,9 @@
+devscripts (2.10.35.1) unstable; urgency=low
+
+  * Hack for bts status command
+
+ -- Don Armstrong <[EMAIL PROTECTED]>  Sun, 10 Aug 2008 14:25:11 -0700
+
 devscripts (2.10.36) UNRELEASED; urgency=low
 
   [ Adam D. Barratt ]
Index: Devscripts/Debbugs.pm
===================================================================
--- Devscripts/Debbugs.pm	(revision 1586)
+++ Devscripts/Debbugs.pm	(working copy)
@@ -153,6 +153,8 @@
                        bugs       => 'bugs',
                        archive    => 'archive',
                        severity   => 'severity',
+		       correspondent => 'correspondent',
+		       affects       => 'affects',
                       );
      my %users;
      my %search_parameters;
Index: scripts/bts.pl
===================================================================
--- scripts/bts.pl	(revision 1586)
+++ scripts/bts.pl	(working copy)
@@ -47,6 +47,8 @@
 use Getopt::Long;
 use Encode;
 
+use Scalar::Util qw(looks_like_number);
+
 # Funny UTF-8 warning messages from HTML::Parse should be ignorable (#292671)
 $SIG{'__WARN__'} = sub { warn $_[0] unless $_[0] =~ /^Parsing of undecoded UTF-8 will give garbage when decoding entities/; };
 
@@ -949,6 +951,59 @@
     print map {qq($_\n)} @{$bugs};
 }
 
+sub bts_status {
+     my @args = @_;
+
+     my @bugs;
+     for my $bug (@args) {
+	  if (looks_like_number($bug)) {
+	       push @bugs,$bug;
+	  }
+	  elsif (m{^file:(.+)}) {
+	       my $file = $1;
+	       my $fh;
+	       if ($file eq '-') {
+		    $fh = \*STDIN;
+	       }
+	       else {
+		    $fh = IO::File->new($file,'r') or
+			 die "Unable to open $file for reading: $!";
+	       }
+	       while (<$fh>) {
+		    chomp;
+		    next if /^\s*\#/;
+		    s/\s//g;
+		    next unless looks_like_number($_);
+		    push @bugs,$_;
+	       }
+	  }
+     }
+     my $bugs = Devscripts::Debbugs::status(@bugs);
+     my $first = 1;
+     for my $bug (keys %{$bugs}) {
+	  print "\n" if not $first;
+	  $first = 0;
+	  my @keys = grep {$_ ne 'bug_num'}
+	       keys %{$bugs->{$bug}};
+	  for my $key ('bug_num',@keys) {
+	       print "$key: ";
+	       if (ref($bugs->{$bug}{$key}) eq 'ARRAY') {
+		    print join(',',@{$bugs->{$bug}{$key}});
+	       }
+	       elsif (ref($bugs->{$bug}{$key}) eq 'HASH') {
+		    print join(',',
+			       map { $_ .' => '. ($bugs->{$bug}{$key}{$_}||'') }
+			       keys %{$bugs->{$bug}{$key}}
+			      );
+	       }
+	       else {
+		    print $bugs->{$bug}{$key}||'';
+	       }
+	       print "\n";
+	  }
+     }
+}
+
 =item clone <bug> [new IDs]
 
 The clone control command allows you to duplicate a bug report. It is useful

Reply via email to