From e2cb5631d9a6d4583a1d0dbc9ae3b4e6a98e678e Mon Sep 17 00:00:00 2001 From: Cornelius Riemenschneider Date: Thu, 30 May 2024 21:06:46 +0200 Subject: [PATCH 1/2] `pkg.bzl`: Fix install targets. First, the labels used in this file need to be wrapped in `Label`, so that we can use the installer target from the internal repo. Second, when unpacking zips, the path passed to `ripunzip` included a trailing `\n`, which caused `ripunzip` to fail. --- misc/bazel/internal/install.py | 1 + misc/bazel/pkg.bzl | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/misc/bazel/internal/install.py b/misc/bazel/internal/install.py index f1c1a410e0c6..c64bbd53bb28 100644 --- a/misc/bazel/internal/install.py +++ b/misc/bazel/internal/install.py @@ -50,6 +50,7 @@ for line in manifest: prefix, _, zip = line.partition(":") assert zip, f"missing prefix for {prefix}, you should use prefix:zip format" + zip = zip.strip() dest = destdir / prefix dest.mkdir(parents=True, exist_ok=True) subprocess.run([ripunzip, "unzip-file", zip, "-d", dest], check=True) diff --git a/misc/bazel/pkg.bzl b/misc/bazel/pkg.bzl index fdfdb6be746b..56dea86acec1 100644 --- a/misc/bazel/pkg.bzl +++ b/misc/bazel/pkg.bzl @@ -367,14 +367,14 @@ def codeql_pack( ) py_binary( name = internal("installer"), - srcs = ["//misc/bazel/internal:install.py"], - main = "//misc/bazel/internal:install.py", + srcs = [Label("//misc/bazel/internal:install.py")], + main = Label("//misc/bazel/internal:install.py"), data = [ internal("build-file"), internal("script"), ] + ([ internal("zip-manifest"), - "//misc/bazel/internal/ripunzip", + Label("//misc/bazel/internal/ripunzip"), ] if zips else []), deps = ["@rules_python//python/runfiles"], args = [ @@ -383,7 +383,7 @@ def codeql_pack( "--destdir", install_dest, ] + ([ - "--ripunzip=$(rlocationpath //misc/bazel/internal/ripunzip)", + "--ripunzip=$(rlocationpath " + str(Label("//misc/bazel/internal/ripunzip")) + ")", "--zip-manifest=$(rlocationpath %s)" % internal("zip-manifest"), ] if zips else []), visibility = visibility, From a42bdd9bb06b1ec5d257643b3fc0e461265d00f9 Mon Sep 17 00:00:00 2001 From: Cornelius Riemenschneider Date: Mon, 3 Jun 2024 10:53:08 +0200 Subject: [PATCH 2/2] Update misc/bazel/pkg.bzl Co-authored-by: Paolo Tranquilli --- misc/bazel/pkg.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/bazel/pkg.bzl b/misc/bazel/pkg.bzl index 56dea86acec1..80fa3a78d519 100644 --- a/misc/bazel/pkg.bzl +++ b/misc/bazel/pkg.bzl @@ -383,7 +383,7 @@ def codeql_pack( "--destdir", install_dest, ] + ([ - "--ripunzip=$(rlocationpath " + str(Label("//misc/bazel/internal/ripunzip")) + ")", + "--ripunzip=$(rlocationpath %s)" % Label("//misc/bazel/internal/ripunzip"), "--zip-manifest=$(rlocationpath %s)" % internal("zip-manifest"), ] if zips else []), visibility = visibility,