mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Ripunzip: provide installer
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -83,7 +83,7 @@
|
|||||||
/csharp/paket.main_extension.bzl linguist-generated=true
|
/csharp/paket.main_extension.bzl linguist-generated=true
|
||||||
|
|
||||||
# ripunzip tool
|
# ripunzip tool
|
||||||
/misc/bazel/internal/ripunzip/ripunzip-* filter=lfs diff=lfs merge=lfs -text
|
/misc/ripunzip/ripunzip-* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
|
||||||
# swift prebuilt resources
|
# swift prebuilt resources
|
||||||
/swift/third_party/resource-dir/*.zip filter=lfs diff=lfs merge=lfs -text
|
/swift/third_party/resource-dir/*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
|||||||
@@ -118,19 +118,19 @@ lfs_files = use_repo_rule("//misc/bazel:lfs.bzl", "lfs_files")
|
|||||||
|
|
||||||
lfs_files(
|
lfs_files(
|
||||||
name = "ripunzip-linux",
|
name = "ripunzip-linux",
|
||||||
srcs = ["//misc/bazel/internal/ripunzip:ripunzip-linux"],
|
srcs = ["//misc/ripunzip:ripunzip-linux"],
|
||||||
executable = True,
|
executable = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
lfs_files(
|
lfs_files(
|
||||||
name = "ripunzip-windows",
|
name = "ripunzip-windows",
|
||||||
srcs = ["//misc/bazel/internal/ripunzip:ripunzip-windows.exe"],
|
srcs = ["//misc/ripunzip:ripunzip-windows.exe"],
|
||||||
executable = True,
|
executable = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
lfs_files(
|
lfs_files(
|
||||||
name = "ripunzip-macos",
|
name = "ripunzip-macos",
|
||||||
srcs = ["//misc/bazel/internal/ripunzip:ripunzip-macos"],
|
srcs = ["//misc/ripunzip:ripunzip-macos"],
|
||||||
executable = True,
|
executable = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -7,3 +7,10 @@ buildifier(
|
|||||||
],
|
],
|
||||||
lint_mode = "fix",
|
lint_mode = "fix",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
sh_library(
|
||||||
|
name = "sh_runfiles",
|
||||||
|
srcs = ["runfiles.sh"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
deps = ["@bazel_tools//tools/bash/runfiles"],
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
load("@bazel_skylib//rules:native_binary.bzl", "native_binary")
|
|
||||||
|
|
||||||
native_binary(
|
|
||||||
name = "ripunzip",
|
|
||||||
src = select({"@platforms//os:" + os: "@ripunzip-" + os for os in ("linux", "windows", "macos")}),
|
|
||||||
out = "ripunzip.exe",
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
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).
|
|
||||||
A [copy](./LICENSE.txt) of the ripunzip license is included.
|
|
||||||
@@ -364,7 +364,7 @@ def codeql_pack(
|
|||||||
internal("script"),
|
internal("script"),
|
||||||
] + ([
|
] + ([
|
||||||
internal("zip-manifest"),
|
internal("zip-manifest"),
|
||||||
Label("//misc/bazel/internal/ripunzip"),
|
Label("//misc/ripunzip"),
|
||||||
] if zips else []),
|
] if zips else []),
|
||||||
deps = ["@rules_python//python/runfiles"],
|
deps = ["@rules_python//python/runfiles"],
|
||||||
args = [
|
args = [
|
||||||
@@ -373,7 +373,7 @@ def codeql_pack(
|
|||||||
"--destdir",
|
"--destdir",
|
||||||
install_dest,
|
install_dest,
|
||||||
] + ([
|
] + ([
|
||||||
"--ripunzip=$(rlocationpath %s)" % Label("//misc/bazel/internal/ripunzip"),
|
"--ripunzip=$(rlocationpath %s)" % Label("//misc/ripunzip"),
|
||||||
"--zip-manifest=$(rlocationpath %s)" % internal("zip-manifest"),
|
"--zip-manifest=$(rlocationpath %s)" % internal("zip-manifest"),
|
||||||
] if zips else []),
|
] if zips else []),
|
||||||
visibility = visibility,
|
visibility = visibility,
|
||||||
|
|||||||
10
misc/bazel/runfiles.sh
Normal file
10
misc/bazel/runfiles.sh
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# --- begin runfiles.bash initialization v3 ---
|
||||||
|
# Copy-pasted from the Bazel Bash runfiles library v3.
|
||||||
|
set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
|
||||||
|
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
|
||||||
|
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
|
||||||
|
source "$0.runfiles/$f" 2>/dev/null || \
|
||||||
|
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
||||||
|
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
||||||
|
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
|
||||||
|
# --- end runfiles.bash initialization v3 ---
|
||||||
13
misc/ripunzip/BUILD.bazel
Normal file
13
misc/ripunzip/BUILD.bazel
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
alias(
|
||||||
|
name = "ripunzip",
|
||||||
|
actual = select({"@platforms//os:" + os: "@ripunzip-" + os for os in ("linux", "windows", "macos")}),
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
sh_binary(
|
||||||
|
name = "install",
|
||||||
|
srcs = ["install.sh"],
|
||||||
|
args = ["$(rlocationpath :ripunzip)"],
|
||||||
|
data = [":ripunzip"],
|
||||||
|
deps = ["//misc/bazel:sh_runfiles"],
|
||||||
|
)
|
||||||
11
misc/ripunzip/README.md
Normal file
11
misc/ripunzip/README.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
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).
|
||||||
|
A [copy](./LICENSE.txt) of the ripunzip license is included.
|
||||||
|
|
||||||
|
`ripunzip` can easily be made available on the system by running
|
||||||
|
```bash
|
||||||
|
bazel run //misc/ripunzip:install
|
||||||
|
```
|
||||||
|
By default, it will be installed in `~/.local/bin`. The target can be changed with
|
||||||
|
```bash
|
||||||
|
bazel run //misc/ripunzip:install -- /path/to/installation/dir
|
||||||
|
```
|
||||||
24
misc/ripunzip/install.sh
Executable file
24
misc/ripunzip/install.sh
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
. misc/bazel/runfiles.sh
|
||||||
|
|
||||||
|
dest="${2:-$HOME/.local/bin}"
|
||||||
|
|
||||||
|
if [ ! -d "$dest" ]; then
|
||||||
|
echo "$dest: not a directory. Provide a valid installation target." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source="$(rlocation "$1")"
|
||||||
|
|
||||||
|
dest+="/ripunzip"
|
||||||
|
|
||||||
|
if [[ "$source" = *.exe ]]; then
|
||||||
|
dest+=".exe"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp "$source" "$dest"
|
||||||
|
|
||||||
|
echo "installed $("$dest" --version) in $(dirname "$dest")"
|
||||||
2
swift/third_party/resource-dir/BUILD.bazel
vendored
2
swift/third_party/resource-dir/BUILD.bazel
vendored
@@ -21,7 +21,7 @@ alias(
|
|||||||
"@swift_toolchain_" + os,
|
"@swift_toolchain_" + os,
|
||||||
],
|
],
|
||||||
target_compatible_with = ["@platforms//os:" + os],
|
target_compatible_with = ["@platforms//os:" + os],
|
||||||
deps = ["@bazel_tools//tools/bash/runfiles"],
|
deps = ["//misc/bazel:sh_runfiles"],
|
||||||
)
|
)
|
||||||
for os in ("linux", "macos")
|
for os in ("linux", "macos")
|
||||||
]
|
]
|
||||||
|
|||||||
11
swift/third_party/resource-dir/update.sh
vendored
Executable file → Normal file
11
swift/third_party/resource-dir/update.sh
vendored
Executable file → Normal file
@@ -1,12 +1,3 @@
|
|||||||
# --- begin runfiles.bash initialization v3 ---
|
. misc/bazel/runfiles.sh
|
||||||
# Copy-pasted from the Bazel Bash runfiles library v3.
|
|
||||||
set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
|
|
||||||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
|
|
||||||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
|
|
||||||
source "$0.runfiles/$f" 2>/dev/null || \
|
|
||||||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
|
||||||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
|
||||||
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
|
|
||||||
# --- end runfiles.bash initialization v3 ---
|
|
||||||
|
|
||||||
cp "$(rlocation "$1")" "$(rlocation "$2")"
|
cp "$(rlocation "$1")" "$(rlocation "$2")"
|
||||||
|
|||||||
Reference in New Issue
Block a user