Control: tags -1 patch Control: user bugs.debian....@packages.debian.org Control: usertag -1 bugscan
On Sat, Nov 12, 2016 at 05:13:15PM +0000, Mattia Rizzolo wrote: > On Sat, Nov 12, 2016 at 06:06:35PM +0200, Adrian Bunk wrote: > > This is likely caused by > > https://lists.debian.org/debian-devel-announce/2016/11/msg00005.html > > Not only this, unknown-package@ receive email of packages with known > maintainer. > > You can have a look at archive-unknown-package on quantz to see them, > for example I just receive notification that 835685 is closed, but that > bug really is on a package with a maintainer. > (removing myself from the alias until this is fixed). Attached is a patch for bugscan which I believe should fix the issue. It has been semi-tested (I extracted the methods to a separate file, stubbed out the config and ran readpackages), but it's not exactly easy to test properly... Regards, James
>From 8984ec2d25b0d0c73423350cc29139cd71237926 Mon Sep 17 00:00:00 2001 From: James Clarke <jrt...@jrtc27.com> Date: Sat, 12 Nov 2016 22:29:25 +0000 Subject: [PATCH] Handle .xz, .bz2 and uncompressed Sources and Packages files --- scanlib.pm | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/scanlib.pm b/scanlib.pm index 7cd2e63..ee995ec 100644 --- a/scanlib.pm +++ b/scanlib.pm @@ -30,7 +30,27 @@ package scanlib; our (%maintainer,%section,%packagelist,%debbugssection,%bugs); -# Read the list of maintainer +sub findcompressedfile { + my ($file) = @_; + my @types = ( + { cat => "xzcat", ext => ".xz" }, + { cat => "bzcat", ext => ".bz2" }, + { cat => "zcat", ext => ".gz" }, + { cat => "cat", ext => "" }, + ); + for my $type (@types) { + my $cat = $type->{cat}; + my $ext = $type->{ext}; + my $fileext = $file . $ext; + if (-f $fileext and system("which $cat >/dev/null 2>&1") == 0) { + return ($fileext, $cat); + } + } + die "Unable to find compressed file for $file"; +} + + +# Read the list of maintainer sub readmaintainers() { my $pkg; # Name of package my $mnt; # Maintainer name & email @@ -55,8 +75,9 @@ sub readsources { my ($root,$archive) = @_; for my $sect (@bugcfg::sections) { - open(P, "zcat $root/$sect/source/Sources.gz|") - or die open "open: $sect sourcelist: $!\n"; + my ($file, $cat) = findcompressedfile("$root/$sect/source/Sources"); + open(P, "$cat $file|") + or die "open: $sect sourcelist ($cat $file): $!\n"; while (<P>) { chomp; next unless m/^Package:\s/; @@ -71,23 +92,25 @@ sub readpackages { my ($root,$archive) = @_; for my $arch ( @bugcfg::architectures ) { for my $sect ( @bugcfg::sections) { - open(P, "zcat $root/$sect/binary-$arch/Packages.gz|") - or die "open: $root/$sect/binary-$arch/Packages.gz: $!\n"; + my ($file, $cat) = findcompressedfile("$root/$sect/binary-$arch/Packages"); + open(P, "$cat $file|") + or die "open: $cat $file: $!\n"; while (<P>) { chomp; next unless m/^Package:\s/; # We're only interested in the packagenames s/^Package:\s*//; # Strip the fieldname $section{$_} = "$archive/$sect"; - print "$root/$sect/binary-$arch/Packages.gz\n" if ($_ eq 'xtla'); + print "$file\n" if ($_ eq 'xtla'); } close(P); } } # handle the source packages for my $sect (@bugcfg::sections) { + my ($file, $cat) = findcompressedfile("$root/$sect/source/Sources"); my $fh; - open($fh,'-|','zcat',"$root/$sect/source/Sources.gz") or - die "Unable to open zcat $root/$sect/source/Sources.gz for reading: $!"; + open($fh,'-|',"$cat","$file") or + die "Unable to open $cat $file for reading: $!"; while (<$fh>) { chomp; next unless m/^Package:\s/; # We're only interested in the packagenames -- 2.10.2