Web lists-archives.com

Re: Please add lzip support in the repository




Stuart Prescott writes ("Re: Please add lzip support in the repository"):
> > What is `apt-helper cat-file' and how does it help ?
> 
> On stretch:
> 
> $ apt-file search apt-helper
> apt: /usr/lib/apt/apt-helper

Ah.  I looked on PATH.  I expect "Front door" programs to be on PATH
nowadays.

> $ /usr/lib/apt/apt-helper download-file 
> http://deb.debian.org/debian/dists/sid/main/binary-amd64/Packages.xz 
> Packages.xz
> Get:1 http://deb.debian.org/debian/dists/sid/main/binary-amd64/Packages.xz 
> [7,547 kB]
> Fetched 7,547 kB in 5s (1,446 kB/s)
> 
> $ /usr/lib/apt/apt-helper cat-file Packages.xz | less

So this is not really a replacement for the impugned compression
regexps because
 * it's not available in stable (some of us care about backportability
    and supporting stable users)
 * it involves invoking a command and parsing the output to get
    trivial information which should be available as a simple
    variable in a scripting language
 * it provides only a more-cooked interface than is probably wanted

A better answer would be the perl function
   Dpkg::Compression::compression_guess_from_filename
which is fairly easy to use and has been available for a long time.
Useable something like this:
  https://browse.dgit.debian.org/dgit.git/tree/dgit#n2163

Or if you just want to strip the compression extension then
  \.([^\.]+)
and call compression_guess_from_filename on $1 and see if it's undef.

See for example
  https://manpages.debian.org/wheezy/libdpkg-perl/Dpkg::Compression.3.en.html

Ideally other languages should have something similar.

Ian.