According to the Debian Repository format wiki page:
Clients must support xz compression, and must support gzip and bzip2 if they want to use the files that are listed as usual use cases of these formats.
[...]
Servers should offer only xz compressed files [...]
Debian Buster (10) backports archive only has a Packages.xz file, and no longer a Packages.gz file. See e.g. https://snapshot.debian.org/archive/debian/20200217T085500Z/dists/buster-backports/main/binary-amd64/
dpkg_src() from package_manager/dpkg.bzl only supports a packages_gz_url parameter, and providing an XZ file there results in an error.
|
_dpkg_src = repository_rule( |
|
_dpkg_src_impl, |
|
attrs = { |
|
"url": attr.string(), |
|
"arch": attr.string(), |
|
"distro": attr.string(), |
|
"snapshot": attr.string(), |
|
"packages_gz_url": attr.string(), |
|
"package_prefix": attr.string(), |
|
"sha256": attr.string(), |
|
"_dpkg_parser": attr.label( |
|
executable = True, |
|
default = Label("@dpkg_parser//file:downloaded"), |
|
cfg = "host", |
|
), |
|
}, |
|
) |
I think I understand the logic in these rules to create a PR. It seems that everything is designed around the presence of the .gz files only. Here's my proposed solution:
Introduce packages_url in favour of packages_gz_url (which then should be deprecated), auto-detecting the compression format based on the file extension in the URL, supporting gzip, lzma and uncompressed. Elegant and compatible, I'd say.
A bit less trivial is the other use case of the rule where packages_url is not given but mirror_url, snapshot, distro and arch are. Currently we assume there's a .gz file at the compiled location. If I would change that to .xz, it will break current use for several reasons (old or Google repos which only have .gz files, and sha256 will be different). Perhaps introduce a new parameter for that with the default to .gz to maintain compatibility?
According to the Debian Repository format wiki page:
Debian Buster (10) backports archive only has a Packages.xz file, and no longer a Packages.gz file. See e.g. https://snapshot.debian.org/archive/debian/20200217T085500Z/dists/buster-backports/main/binary-amd64/
dpkg_src()frompackage_manager/dpkg.bzlonly supports apackages_gz_urlparameter, and providing an XZ file there results in an error.distroless/package_manager/dpkg.bzl
Lines 58 to 74 in 76c76a1
I think I understand the logic in these rules to create a PR. It seems that everything is designed around the presence of the
.gzfiles only. Here's my proposed solution:Introduce
packages_urlin favour ofpackages_gz_url(which then should be deprecated), auto-detecting the compression format based on the file extension in the URL, supporting gzip, lzma and uncompressed. Elegant and compatible, I'd say.A bit less trivial is the other use case of the rule where
packages_urlis not given butmirror_url,snapshot,distroandarchare. Currently we assume there's a.gzfile at the compiled location. If I would change that to .xz, it will break current use for several reasons (old or Google repos which only have .gz files, and sha256 will be different). Perhaps introduce a new parameter for that with the default to .gz to maintain compatibility?