@@ -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