Skip to content

Commit

Permalink
feat: handle uncompressed Package indices (#129)
Browse files Browse the repository at this point in the history
* Handle uncompressed Package files

E.g. packages.cloud.google.com/apt’s Packages

* Add a smoketest for uncompressed Packages
  • Loading branch information
JonathanPerry651 authored Dec 9, 2024
1 parent dd83163 commit 073917d
Show file tree
Hide file tree
Showing 3 changed files with 1,144 additions and 359 deletions.
11 changes: 6 additions & 5 deletions apt/private/apt_deb_repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ def _fetch_package_index(rctx, url, dist, comp, arch, integrity):
# --force -> overwrite the output if it exists
# --decompress -> decompress
supported_extensions = {
"xz": ["xz", "--decompress", "--keep", "--force"],
"gz": ["gzip", "--decompress", "--keep", "--force"],
"bz2": ["bzip2", "--decompress", "--keep", "--force"],
"": ["true"],
".xz": ["xz", "--decompress", "--keep", "--force"],
".gz": ["gzip", "--decompress", "--keep", "--force"],
".bz2": ["bzip2", "--decompress", "--keep", "--force"],
}

failed_attempts = []

for (ext, cmd) in supported_extensions.items():
output = "{}/Packages.{}".format(target_triple, ext)
dist_url = "{}/dists/{}/{}/binary-{}/Packages.{}".format(url, dist, comp, arch, ext)
output = "{}/Packages{}".format(target_triple, ext)
dist_url = "{}/dists/{}/{}/binary-{}/Packages{}".format(url, dist, comp, arch, ext)
download = rctx.download(
url = dist_url,
output = output,
Expand Down
Loading

0 comments on commit 073917d

Please sign in to comment.