Skip to content

Commit b4974ff

Browse files
redsun82Copilot
andcommitted
Add arm64 Linux support to prebuilt ripunzip
The `ripunzip_archive` repository rule downloaded a prebuilt ripunzip for the host platform, but the Linux branch was hardcoded to the amd64 deb, so on an arm64 Linux host it would fetch an x86 binary. Switch on `repository_ctx.os.arch` (mirroring the macOS branch) to select the arm64 deb, which ripunzip publishes for the pinned version. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c6404a7a-35d7-4294-b3b6-9231ca15ef25
1 parent 7bb0034 commit b4974ff

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ ripunzip_archive = use_repo_rule("//misc/ripunzip:ripunzip.bzl", "ripunzip_archi
327327
ripunzip_archive(
328328
name = "ripunzip",
329329
sha256_linux = "71482d7a7e4ea9176d5596161c49250c34b136b157c45f632b1111323fbfc0de",
330+
sha256_linux_arm = "a282740ef376ff8dc0de3c589b7457598db15cc045b7daa688f15531612e0bbe",
330331
sha256_macos_arm = "604194ab13f0aba3972995d995f11002b8fc285c8170401fcd46655065df20c9",
331332
sha256_macos_intel = "65367b94fd579d93d46f2d2595cc4c9a60cfcf497e3c824f9d1a7b80fa8bd38a",
332333
sha256_windows = "ac3874075def2b9e5074a3b5945005ab082cc6e689e1de658da8965bc23e643e",

misc/ripunzip/ripunzip.bzl

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,22 @@ def _ripunzip_archive_impl(repository_ctx):
33
url_prefix = "https://github.com/GoogleChrome/ripunzip/releases/download/v%s" % version
44
build_file = Label("//misc/ripunzip:BUILD.ripunzip.bazel")
55
if "linux" in repository_ctx.os.name:
6+
arch = repository_ctx.os.arch
7+
if arch in ("aarch64", "arm64"):
8+
deb_arch = "arm64"
9+
sha256 = repository_ctx.attr.sha256_linux_arm
10+
canonical_id = "ripunzip-linux-arm"
11+
else:
12+
deb_arch = "amd64"
13+
sha256 = repository_ctx.attr.sha256_linux
14+
canonical_id = "ripunzip-linux"
15+
616
# ripunzip only provides a deb package for Linux: we fish the binary out of it
717
# a deb archive contains a data.tar.xz one which contains the files to be installed under usr/bin
818
repository_ctx.download_and_extract(
9-
url = "%s/ripunzip_%s-1_amd64.deb" % (url_prefix, version),
10-
sha256 = repository_ctx.attr.sha256_linux,
11-
canonical_id = "ripunzip-linux",
19+
url = "%s/ripunzip_%s-1_%s.deb" % (url_prefix, version, deb_arch),
20+
sha256 = sha256,
21+
canonical_id = canonical_id,
1222
output = "deb",
1323
)
1424
repository_ctx.extract(
@@ -52,6 +62,7 @@ ripunzip_archive = repository_rule(
5262
attrs = {
5363
"version": attr.string(mandatory = True),
5464
"sha256_linux": attr.string(mandatory = True),
65+
"sha256_linux_arm": attr.string(mandatory = True),
5566
"sha256_windows": attr.string(mandatory = True),
5667
"sha256_macos_intel": attr.string(mandatory = True),
5768
"sha256_macos_arm": attr.string(mandatory = True),

0 commit comments

Comments
 (0)