-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1539 from GoogleContainerTools/reproducible_busybox
fix: make busybox reproducible
- Loading branch information
Showing
5 changed files
with
71 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
package(default_visibility = ["//base:__subpackages__"]) | ||
|
||
load("//:checksums.bzl", "ARCHITECTURES") | ||
load(":commands.bzl", "BUSYBOX_COMMANDS") | ||
load(":commands.bzl", "busybox_layer") | ||
|
||
package(default_visibility = ["//base:__subpackages__"]) | ||
|
||
# This works for all architectures because it is just files. | ||
# Ppc64le/Arm64/Amd64 needs special case as there is no direct working binary file available. | ||
[genrule( | ||
name = "busybox_" + arch + "_tar", | ||
srcs = ["@busybox_" + arch + "//file"], | ||
outs = ["busybox_" + arch + ".tar"], | ||
cmd = "mkdir busybox; cp $(<) busybox/busybox; cd busybox; \ | ||
if [[ $(<) == *ppc64le* || $(<) == *arm64* || $(<) == *amd64* ]]; then \ | ||
tar -xf busybox ./bin && mv -f ./bin/busybox . && rm -rf ./bin; \ | ||
fi; \ | ||
for cmd in %s; do \ | ||
ln -s busybox $$cmd; \ | ||
done; \ | ||
cd ..; \ | ||
tar -cf $@ busybox" % " ".join(BUSYBOX_COMMANDS), | ||
) for arch in ARCHITECTURES] | ||
SPECIAL_CASE_ARCH = [ | ||
"ppc64le", | ||
"arm64", | ||
"amd64", | ||
] | ||
|
||
[ | ||
busybox_layer( | ||
name = "busybox_" + arch, | ||
busybox = "@busybox_" + arch + "//:file" if arch in SPECIAL_CASE_ARCH else "@busybox_" + arch + "//file", | ||
compress = "gzip", | ||
) | ||
for arch in ARCHITECTURES | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters