mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Ripunzip: fix windows os check, add comments
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
def _impl(repository_ctx):
|
def _ripunzip_archive_impl(repository_ctx):
|
||||||
version = repository_ctx.attr.version
|
version = repository_ctx.attr.version
|
||||||
url_prefix = "https://github.com/GoogleChrome/ripunzip/releases/download/v%s" % version
|
url_prefix = "https://github.com/GoogleChrome/ripunzip/releases/download/v%s" % version
|
||||||
build_file = Label("//misc/ripunzip:BUILD.ripunzip.bazel")
|
build_file = Label("//misc/ripunzip:BUILD.ripunzip.bazel")
|
||||||
if repository_ctx.os.name == "linux":
|
if "linux" in repository_ctx.os.name:
|
||||||
|
# ripunzip only provides a deb package for Linux: we fish the binary out of it
|
||||||
|
# a deb archive contains a data.tar.xz one which contains the files to be installed under usr/bin
|
||||||
repository_ctx.download_and_extract(
|
repository_ctx.download_and_extract(
|
||||||
url = "%s/ripunzip_%s-1_amd64.deb" % (url_prefix, version),
|
url = "%s/ripunzip_%s-1_amd64.deb" % (url_prefix, version),
|
||||||
sha256 = repository_ctx.attr.sha256_linux,
|
sha256 = repository_ctx.attr.sha256_linux,
|
||||||
@@ -11,16 +13,17 @@ def _impl(repository_ctx):
|
|||||||
)
|
)
|
||||||
repository_ctx.extract(
|
repository_ctx.extract(
|
||||||
"deb/data.tar.xz",
|
"deb/data.tar.xz",
|
||||||
strip_prefix = "usr",
|
strip_prefix = "usr/bin",
|
||||||
|
output = "bin",
|
||||||
)
|
)
|
||||||
elif repository_ctx.os.name == "windows":
|
elif "windows" in repository_ctx.os.name:
|
||||||
repository_ctx.download_and_extract(
|
repository_ctx.download_and_extract(
|
||||||
url = "%s/ripunzip_v%s_x86_64-pc-windows-msvc.zip" % (url_prefix, version),
|
url = "%s/ripunzip_v%s_x86_64-pc-windows-msvc.zip" % (url_prefix, version),
|
||||||
canonical_id = "ripunzip-windows",
|
canonical_id = "ripunzip-windows",
|
||||||
sha256 = repository_ctx.attr.sha256_windows,
|
sha256 = repository_ctx.attr.sha256_windows,
|
||||||
output = "bin",
|
output = "bin",
|
||||||
)
|
)
|
||||||
elif repository_ctx.os.name == "mac os x":
|
elif "mac os" in repository_ctx.os.name:
|
||||||
arch = repository_ctx.os.arch
|
arch = repository_ctx.os.arch
|
||||||
if arch == "x86_64":
|
if arch == "x86_64":
|
||||||
suffix = "x86_64-apple-darwin"
|
suffix = "x86_64-apple-darwin"
|
||||||
@@ -44,7 +47,8 @@ def _impl(repository_ctx):
|
|||||||
repository_ctx.symlink(build_file, "BUILD.bazel")
|
repository_ctx.symlink(build_file, "BUILD.bazel")
|
||||||
|
|
||||||
ripunzip_archive = repository_rule(
|
ripunzip_archive = repository_rule(
|
||||||
implementation = _impl,
|
implementation = _ripunzip_archive_impl,
|
||||||
|
doc = "Downloads a prebuilt ripunzip binary for the host platform from https://github.com/GoogleChrome/ripunzip/releases",
|
||||||
attrs = {
|
attrs = {
|
||||||
"version": attr.string(mandatory = True),
|
"version": attr.string(mandatory = True),
|
||||||
"sha256_linux": attr.string(mandatory = True),
|
"sha256_linux": attr.string(mandatory = True),
|
||||||
|
|||||||
Reference in New Issue
Block a user