mirror of https://github.com/kubernetes/kops.git
Remove more sha1-generation code
This commit is contained in:
parent
abe4c12794
commit
e313f384ba
|
@ -1,4 +1,3 @@
|
|||
exports_files([
|
||||
"sha1",
|
||||
"sha256",
|
||||
])
|
||||
|
|
|
@ -2,14 +2,6 @@ def _impl(ctx):
|
|||
in_file = ctx.file.src
|
||||
|
||||
basename = ctx.attr.src.label.name
|
||||
out_sha1 = ctx.actions.declare_file("%s.sha1" % basename)
|
||||
ctx.actions.run(
|
||||
executable = ctx.executable._cmd_sha1,
|
||||
outputs = [out_sha1],
|
||||
inputs = [in_file],
|
||||
arguments = [in_file.path, out_sha1.path],
|
||||
)
|
||||
|
||||
out_sha256 = ctx.actions.declare_file("%s.sha256" % basename)
|
||||
ctx.actions.run(
|
||||
executable = ctx.executable._cmd_sha256,
|
||||
|
@ -19,12 +11,11 @@ def _impl(ctx):
|
|||
)
|
||||
|
||||
return DefaultInfo(
|
||||
files = depset([out_sha1, out_sha256]),
|
||||
files = depset([out_sha256]),
|
||||
)
|
||||
|
||||
def _get_outputs(src):
|
||||
return {
|
||||
"sha1": src.name + ".sha1",
|
||||
"sha256": src.name + ".sha256",
|
||||
}
|
||||
|
||||
|
@ -32,12 +23,6 @@ hashes = rule(
|
|||
implementation = _impl,
|
||||
attrs = {
|
||||
"src": attr.label(mandatory = True, allow_single_file = True),
|
||||
"_cmd_sha1": attr.label(
|
||||
default = Label("//tools:sha1"),
|
||||
allow_single_file = True,
|
||||
executable = True,
|
||||
cfg = "host",
|
||||
),
|
||||
"_cmd_sha256": attr.label(
|
||||
default = Label("//tools:sha256"),
|
||||
allow_single_file = True,
|
||||
|
|
17
tools/sha1
17
tools/sha1
|
@ -1,17 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
in=$1
|
||||
out=$2
|
||||
|
||||
if ( command -v sha1sum > /dev/null ); then
|
||||
(sha1sum $in | cut -d' ' -f1) > $out
|
||||
elif ( command -v shasum > /dev/null ); then
|
||||
(shasum -a 1 $in | cut -d' ' -f1) > $out
|
||||
else
|
||||
echo "Neither sha1sum nor shasum command is available"
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue