Subject: | DPKG::Parse(3pm) claims that Packages.gz is "understood", but doesn't support compressed files |
Date: | Mon, 29 Oct 2018 17:09:48 +0100 |
To: | bug-DPKG-Parse [...] rt.cpan.org |
From: | Axel Beckert <abe [...] cpan.org> |
Hi,
this has been initially reported in Debian against DPKG::Parse version
0.03 at https://bugs.debian.org/912244
Citing from the DPKG::Parse(3pm) POD/man-page:
Show quoted text
> DESCRIPTION
> DPKG::Parse contains utilities to parse the various files created by
> dpkg and turn them into helpful Perl objects. Current files
> understood by various DPKG::Parse modules:
>
> /var/lib/dpkg/status - DPKG::Parse::Status
> /var/lib/dpkg/available - DPKG::Parse::Available
> Packages.gz - DPKG::Parse::Packages
^^^
But if I parse a gzip compressed packages file as "filename", I just get
"undef" returned by the constructor "new".
Looking at the code, there's no sign of decompression:
Show quoted text> sub parse_package_format {
> my $pkg = shift;
> if (! -f $pkg->filename) {
> die "Cannot find " . $pkg->filename . ", or it's not a file at all!";
> }
> open(STATUS, $pkg->filename);
> my $entry;
> my $line_num = -1;
> my $entry_line = 0;
> STATUSLINE: while (my $line = <STATUS>) {
> ++$line_num;
> if ($line =~ /^\n$/) {
[...]
The easy fix would be to remove that misleading ".gz" from the POD. But
it actually would be nice to be able to transparently read Packages.gz,
Packages.bzip2 and Packages.xz files with that module.
Probably a nice way to fix this would be to accept IO::* objects
instead of insisting on files, e.g. passing an
IO::Uncompress::AnyUncompress object.
Kind regards, Axel
--
PGP: 2FF9CD59612616B5 /~\ Plain Text Ribbon Campaign, http://arc.pasp.de/
Mail: abe@deuxchevaux.org \ / Say No to HTML in E-Mail and Usenet
Mail+Jabber: abe@noone.org X
https://axel.beckert.ch/ / \ I love long mails: https://email.is-not-s.ms/