Skip to content

Commit

Permalink
pkg.bzl: Fix install targets.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
criemen committed May 30, 2024
1 parent 61593ae commit e2cb563
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions misc/bazel/internal/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 4 additions & 4 deletions misc/bazel/pkg.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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,
Expand Down

0 comments on commit e2cb563

Please sign in to comment.