Skip to content

Commit 1c0ae0f

Browse files
authored
Merge pull request #22261 from github/redsun82-arm64-linux-ripunzip
Add arm64 Linux support to prebuilt ripunzip
2 parents 684a32b + 8aff07c commit 1c0ae0f

2 files changed

Lines changed: 31 additions & 17 deletions

File tree

MODULE.bazel

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,11 @@ ripunzip_archive = use_repo_rule("//misc/ripunzip:ripunzip.bzl", "ripunzip_archi
326326
# go to https://github.com/GoogleChrome/ripunzip/releases to find latest version and corresponding sha256s
327327
ripunzip_archive(
328328
name = "ripunzip",
329-
sha256_linux = "71482d7a7e4ea9176d5596161c49250c34b136b157c45f632b1111323fbfc0de",
330-
sha256_macos_arm = "604194ab13f0aba3972995d995f11002b8fc285c8170401fcd46655065df20c9",
331-
sha256_macos_intel = "65367b94fd579d93d46f2d2595cc4c9a60cfcf497e3c824f9d1a7b80fa8bd38a",
332-
sha256_windows = "ac3874075def2b9e5074a3b5945005ab082cc6e689e1de658da8965bc23e643e",
329+
sha256_linux_arm64 = "a282740ef376ff8dc0de3c589b7457598db15cc045b7daa688f15531612e0bbe",
330+
sha256_linux_x64 = "71482d7a7e4ea9176d5596161c49250c34b136b157c45f632b1111323fbfc0de",
331+
sha256_macos_arm64 = "604194ab13f0aba3972995d995f11002b8fc285c8170401fcd46655065df20c9",
332+
sha256_macos_x64 = "65367b94fd579d93d46f2d2595cc4c9a60cfcf497e3c824f9d1a7b80fa8bd38a",
333+
sha256_windows_x64 = "ac3874075def2b9e5074a3b5945005ab082cc6e689e1de658da8965bc23e643e",
333334
version = "2.0.4",
334335
)
335336

misc/ripunzip/ripunzip.bzl

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,24 @@ 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 == "aarch64":
8+
deb_arch = "arm64"
9+
sha256 = repository_ctx.attr.sha256_linux_arm64
10+
canonical_id = "ripunzip-linux-arm64"
11+
elif arch in ("x86_64", "amd64"):
12+
deb_arch = "amd64"
13+
sha256 = repository_ctx.attr.sha256_linux_x64
14+
canonical_id = "ripunzip-linux-x64"
15+
else:
16+
fail("Unsupported Linux architecture: %s" % arch)
17+
618
# ripunzip only provides a deb package for Linux: we fish the binary out of it
719
# a deb archive contains a data.tar.xz one which contains the files to be installed under usr/bin
820
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",
21+
url = "%s/ripunzip_%s-1_%s.deb" % (url_prefix, version, deb_arch),
22+
sha256 = sha256,
23+
canonical_id = canonical_id,
1224
output = "deb",
1325
)
1426
repository_ctx.extract(
@@ -19,20 +31,20 @@ def _ripunzip_archive_impl(repository_ctx):
1931
elif "windows" in repository_ctx.os.name:
2032
repository_ctx.download_and_extract(
2133
url = "%s/ripunzip_v%s_x86_64-pc-windows-msvc.zip" % (url_prefix, version),
22-
canonical_id = "ripunzip-windows",
23-
sha256 = repository_ctx.attr.sha256_windows,
34+
canonical_id = "ripunzip-windows-x64",
35+
sha256 = repository_ctx.attr.sha256_windows_x64,
2436
output = "bin",
2537
)
2638
elif "mac os" in repository_ctx.os.name:
2739
arch = repository_ctx.os.arch
2840
if arch == "x86_64":
2941
suffix = "x86_64-apple-darwin"
30-
sha256 = repository_ctx.attr.sha256_macos_intel
31-
canonical_id = "ripunzip-macos-intel"
42+
sha256 = repository_ctx.attr.sha256_macos_x64
43+
canonical_id = "ripunzip-macos-x64"
3244
elif arch == "aarch64":
3345
suffix = "aarch64-apple-darwin"
34-
sha256 = repository_ctx.attr.sha256_macos_arm
35-
canonical_id = "ripunzip-macos-arm"
46+
sha256 = repository_ctx.attr.sha256_macos_arm64
47+
canonical_id = "ripunzip-macos-arm64"
3648
else:
3749
fail("Unsupported macOS architecture: %s" % arch)
3850
repository_ctx.download_and_extract(
@@ -51,9 +63,10 @@ ripunzip_archive = repository_rule(
5163
doc = "Downloads a prebuilt ripunzip binary for the host platform from https://github.com/GoogleChrome/ripunzip/releases",
5264
attrs = {
5365
"version": attr.string(mandatory = True),
54-
"sha256_linux": attr.string(mandatory = True),
55-
"sha256_windows": attr.string(mandatory = True),
56-
"sha256_macos_intel": attr.string(mandatory = True),
57-
"sha256_macos_arm": attr.string(mandatory = True),
66+
"sha256_linux_x64": attr.string(mandatory = True),
67+
"sha256_linux_arm64": attr.string(mandatory = True),
68+
"sha256_windows_x64": attr.string(mandatory = True),
69+
"sha256_macos_x64": attr.string(mandatory = True),
70+
"sha256_macos_arm64": attr.string(mandatory = True),
5871
},
5972
)

0 commit comments

Comments
 (0)