Skip to content

Commit ac6cc38

Browse files
authored
Merge pull request github#16681 from github/redsun82/ripunzip
Ripunzip: provide installer
2 parents 2d42ea0 + 61847bc commit ac6cc38

File tree

16 files changed

+73
-27
lines changed

16 files changed

+73
-27
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
/csharp/paket.main_extension.bzl linguist-generated=true
8484

8585
# ripunzip tool
86-
/misc/bazel/internal/ripunzip/ripunzip-* filter=lfs diff=lfs merge=lfs -text
86+
/misc/ripunzip/ripunzip-* filter=lfs diff=lfs merge=lfs -text
8787

8888
# swift prebuilt resources
8989
/swift/third_party/resource-dir/*.zip filter=lfs diff=lfs merge=lfs -text

MODULE.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,19 @@ lfs_files = use_repo_rule("//misc/bazel:lfs.bzl", "lfs_files")
118118

119119
lfs_files(
120120
name = "ripunzip-linux",
121-
srcs = ["//misc/bazel/internal/ripunzip:ripunzip-linux"],
121+
srcs = ["//misc/ripunzip:ripunzip-linux"],
122122
executable = True,
123123
)
124124

125125
lfs_files(
126126
name = "ripunzip-windows",
127-
srcs = ["//misc/bazel/internal/ripunzip:ripunzip-windows.exe"],
127+
srcs = ["//misc/ripunzip:ripunzip-windows.exe"],
128128
executable = True,
129129
)
130130

131131
lfs_files(
132132
name = "ripunzip-macos",
133-
srcs = ["//misc/bazel/internal/ripunzip:ripunzip-macos"],
133+
srcs = ["//misc/ripunzip:ripunzip-macos"],
134134
executable = True,
135135
)
136136

misc/bazel/BUILD.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@ buildifier(
77
],
88
lint_mode = "fix",
99
)
10+
11+
sh_library(
12+
name = "sh_runfiles",
13+
srcs = ["runfiles.sh"],
14+
visibility = ["//visibility:public"],
15+
deps = ["@bazel_tools//tools/bash/runfiles"],
16+
)

misc/bazel/internal/ripunzip/BUILD.bazel

Lines changed: 0 additions & 8 deletions
This file was deleted.

misc/bazel/internal/ripunzip/README.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

misc/bazel/pkg.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def codeql_pack(
364364
internal("script"),
365365
] + ([
366366
internal("zip-manifest"),
367-
Label("//misc/bazel/internal/ripunzip"),
367+
Label("//misc/ripunzip"),
368368
] if zips else []),
369369
deps = ["@rules_python//python/runfiles"],
370370
args = [
@@ -373,7 +373,7 @@ def codeql_pack(
373373
"--destdir",
374374
install_dest,
375375
] + ([
376-
"--ripunzip=$(rlocationpath %s)" % Label("//misc/bazel/internal/ripunzip"),
376+
"--ripunzip=$(rlocationpath %s)" % Label("//misc/ripunzip"),
377377
"--zip-manifest=$(rlocationpath %s)" % internal("zip-manifest"),
378378
] if zips else []),
379379
visibility = visibility,

misc/bazel/runfiles.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# --- begin runfiles.bash initialization v3 ---
2+
# Copy-pasted from the Bazel Bash runfiles library v3.
3+
set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
4+
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
5+
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
6+
source "$0.runfiles/$f" 2>/dev/null || \
7+
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
8+
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
9+
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
10+
# --- end runfiles.bash initialization v3 ---

misc/ripunzip/BUILD.bazel

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
alias(
2+
name = "ripunzip",
3+
actual = select({"@platforms//os:" + os: "@ripunzip-" + os for os in ("linux", "windows", "macos")}),
4+
visibility = ["//visibility:public"],
5+
)
6+
7+
sh_binary(
8+
name = "install",
9+
srcs = ["install.sh"],
10+
args = ["$(rlocationpath :ripunzip)"],
11+
data = [":ripunzip"],
12+
deps = ["//misc/bazel:sh_runfiles"],
13+
)
File renamed without changes.

misc/ripunzip/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
These LFS files are distributions of [ripunzip](https://github.com/google/ripunzip), compiled with this [workflow](https://github.com/github/codeql/actions/workflows/build-ripunzip.yml).
2+
A [copy](./LICENSE.txt) of the ripunzip license is included.
3+
4+
`ripunzip` can easily be made available on the system by running
5+
```bash
6+
bazel run //misc/ripunzip:install
7+
```
8+
By default, it will be installed in `~/.local/bin`. The target can be changed with
9+
```bash
10+
bazel run //misc/ripunzip:install -- /path/to/installation/dir
11+
```

0 commit comments

Comments
 (0)