2 # vim: ts=8 sw=8 nowrap
4 # Compare two buglist status-files
8 use lib dirname(__FILE__);
14 my $Version = "BugDiff 1.0\nCopyright (C) Wichert Akkerman <wakkerma\@debian.org>\n";
27 $0 [-V] [-h] [-H] <status1> <status2>
30 -h show some (hopefully) helpfull information
31 -H produce HTML output
32 -n list newly opened bugs
42 print "<h2>Closed/downgraded release-critical bugs</h2>\n";
44 for my $p (sort keys %removed) {
45 print " <li><em>" . &scanlib::wwwname($p) . ":</em>\n";
46 for $b (sort @{$removed{$p}}) {
47 print &scanlib::wwwnumber($b) . " ";
54 print "Closed/downgraded release-critical bugs:\n" if (scalar keys %removed>0);
55 for my $p (sort keys %removed) {
57 print join(", ", sort @{$removed{$p}});
67 print "<h2>Opened/upgraded release-critical bugs</h2>\n";
69 for my $p (sort keys %new) {
70 print " <li><em>" . &scanlib::wwwname($p) . ":</em>\n";
71 for $b (sort @{$new{$p}}) {
72 print &scanlib::wwwnumber($b) . " ";
79 print "Opened/upgraded release-critical bugs:\n" if (%new);
80 for my $p (sort keys %new) {
82 print join(", ", sort @{$new{$p}});
89 my ($opened, $closed) = @_;
92 print "<STRONG>" . ($closed ? $closed : "NO") . "</STRONG> release-critical bugs were closed and ";
93 print "<STRONG>" . ($opened ? $opened : "NONE") . "</STRONG> were opened.<P>\n";
95 print "" . ($closed ? $closed : "NO") . " release-critical bugs were closed ";
96 print "and " . ($opened ? $opened : "NONE") . " were opened.\n\n";
100 our ($opt_V, $opt_h, $opt_H, $opt_n, $opt_c, $opt_s);
102 ShowUsage if ($opt_h or ($#ARGV != 1));
103 ShowVersion if ($opt_V);
106 scanlib::readstatus($ARGV[0]);
107 my %oldbugs=%scanlib::packagelist;
108 %scanlib::packagelist=();
110 scanlib::readstatus($ARGV[1]);
113 for my $p (keys %oldbugs) {
114 for $b (@{$oldbugs{$p}}) {
115 if (!defined($scanlib::packagelist{$p}) || scalar grep { $_ == $b } @{$scanlib::packagelist{$p}} == 0) {
116 push @{$removed{$p}}, $b;
123 for my $p (keys %scanlib::packagelist) {
124 for $b (@{$scanlib::packagelist{$p}}) {
125 if (!defined($oldbugs{$p}) || scalar grep { $_ == $b } @{$oldbugs{$p}} == 0) {
126 push @{$new{$p}}, $b;
132 statistics($opened, $closed) if ($opt_s);
133 closedbugs if ($opt_c);
134 openedbugs if ($opt_n);