Bug#944964: dh-make-perl: Module accesses internal dpkg database
gregor herrmann
gregoa at debian.org
Mon Nov 18 17:29:36 GMT 2019
On Sun, 17 Nov 2019 21:38:24 +0100, Guillem Jover wrote:
> [M] lib/Debian/DpkgLists.pm
>
> The function _cat_lists() accesses the file list files directly, and
> should be switched to use either «dpkg-query --listfiles» instead, or the
> dpkg-query db-fsys:Files virtual field with --show.
Thanks for the bug report and the hint about db-fsys:Files.
I've now come up with a first patch (pushed to git) which seems to
work and which is not terribly slow.
t/DpkgLists.t still passes and takes ~9 seconds; with the original
_cat_lists() it was more like 2.5 seconds but well.
For convenience, here's the current proposal for _cat_lists():
#v+
sub _cat_lists
{
my ( $class, $callback ) = @_;
my $query_list = 'dpkg-query --show --showformat "\${Package}\n\${db-fsys:Files}"';
open( my $fh, '-|', $query_list )
or warn "failed to run dpkg-query: $!\n";
my ( $pkg, $filename );
while ( defined( my $line = <$fh> ) ) {
chomp $line;
if ( $line =~ /^[a-z0-9]/ ) { # package names start in first column
$pkg = $line;
next;
}
elsif ( $line =~ /^ \// ) { # filenames have a leading space
( $filename = $line ) =~ s/^\s+//;
}
else {
warn "Unrecognized line '$line'\n";
next;
}
&$callback( $pkg, $filename );
}
close($fh);
}
#v-
I wait a bit for comments or improvements before uploading.
Cheers,
gregor
--
.''`. https://info.comodo.priv.at -- Debian Developer https://www.debian.org
: :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D 85FA BB3A 6801 8649 AA06
`. `' Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe
`- NP: Peter Jones: Together Alone
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: Digital Signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-perl-maintainers/attachments/20191118/677326c4/attachment.sig>
More information about the pkg-perl-maintainers
mailing list