#1108032 apt: Option to keep compressed files in the same format as used by the index target

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
Colin Watson
Date:
2025-06-19 11:35:02 UTC
Severity:
normal
#1108032#5
Date:
2025-06-19 11:32:05 UTC
From:
To:
While working on
https://salsa.debian.org/freexian-team/debusine/-/issues/945, I
discovered that there appears to be no way to ask apt to store files in
Dir::State::lists using the same compression format as is used by the
index target it fetched them from.  You can set
Acquire::GzipIndexes=true, but this just causes apt to recompress using
what it thinks is the lowest-cost compressor.  If you know the
compression format used by the index target in question in advance then
you can set KeepCompressedAs on the relevant index target, but from a
cold start you only know that once apt has acquired and parsed the
Release file.

This would have been convenient for a quick-and-dirty mirroring approach
where I just ask apt to fetch all the files in order to be able to reuse
its verification logic (though I think I have another somewhat viable
approach that will achieve many of the same goals; I'm not blocked on
this bug report).  Recompressing/uncompressing the index files means
that they can't reliably be served by a mirror, since their checksums
may not match what's listed in Release.

I talked to Julian about this on Matrix, and he suggested that it
shouldn't be too hard to allow KeepCompressedAs to take a value of
"archive" to preserve the fetched compression format.

Thanks,