Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #8263: Replace binary "which" with build in "command" #8279

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ push-node-authorizer:
bazel-protokube-export:
mkdir -p ${BAZELIMAGES}
bazel build ${BAZEL_CONFIG} --action_env=PROTOKUBE_TAG=${PROTOKUBE_TAG} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //images:protokube.tar.gz //images:protokube.tar.gz.sha1 //images:protokube.tar.gz.sha256
cp -fp bazel-bin/images/bazel-out/k8-fastbuild/bin/images/protokube.tar.gz ${BAZELIMAGES}/protokube.tar.gz
cp -fp bazel-bin/images/protokube.tar.gz ${BAZELIMAGES}/protokube.tar.gz
cp -fp bazel-bin/images/protokube.tar.gz.sha1 ${BAZELIMAGES}/protokube.tar.gz.sha1
cp -fp bazel-bin/images/protokube.tar.gz.sha256 ${BAZELIMAGES}/protokube.tar.gz.sha256

Expand Down
3 changes: 2 additions & 1 deletion tools/gzip.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def _impl(ctx):
in_file = ctx.file.src

out_file = ctx.actions.declare_file("%s.gz" % in_file.path)
basename = ctx.attr.src.label.name
out_file = ctx.actions.declare_file("%s.gz" % basename)

cmd = "gzip -c '%s' > '%s'" % (in_file.path, out_file.path)

Expand Down
4 changes: 2 additions & 2 deletions tools/sha1
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ set -o pipefail
in=$1
out=$2

if ( which sha1sum > /dev/null ); then
if ( command -v sha1sum > /dev/null ); then
(sha1sum $in | cut -d' ' -f1) > $out
elif ( which shasum > /dev/null ); then
elif ( command -v shasum > /dev/null ); then
(shasum -a 1 $in | cut -d' ' -f1) > $out
else
echo "Neither sha1sum nor shasum command is available"
Expand Down
4 changes: 2 additions & 2 deletions tools/sha256
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ set -o pipefail
in=$1
out=$2

if ( which sha256sum > /dev/null ); then
if ( command -v sha256sum > /dev/null ); then
(sha256sum $in | cut -d' ' -f1) > $out
elif ( which shasum > /dev/null ); then
elif ( command -v shasum > /dev/null ); then
(shasum -a 256 $in | cut -d' ' -f1) > $out
else
echo "Neither sha256sum nor shasum command is available"
Expand Down