mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-05-15 03:33:05 +00:00
generate_vendor: Add go vendored code
Add go vendored code for all packages to the vendor tarball. This should be enough for people who need vendored code, e.g. for hermetic builds. The repo only tracks 4 go vendored code directories but the script considers all go.mod files accross the repo, for the sake of simplicity. The impact on the size of the tarball is less than 20 mb. It is now possible to stop tracking vendored code in git and to get rid of `make vendor`. Signed-off-by: Greg Kurz <groug@kaod.org>
This commit is contained in:
@@ -21,8 +21,9 @@ function usage() {
|
||||
cat <<EOF
|
||||
Usage: ${script_name} tarball-name
|
||||
This script creates a tarball with all the cargo vendored code
|
||||
that a distro would need to do a full build of the project in
|
||||
a disconnected environment, generating a "tarball-name" file.
|
||||
and the go vendored code that a distro would need to do a full
|
||||
build of the project in a disconnected environment, generating
|
||||
a "tarball-name" file.
|
||||
|
||||
EOF
|
||||
|
||||
@@ -35,9 +36,19 @@ create_vendor_tarball() {
|
||||
for i in $(find . -name 'Cargo.lock'); do
|
||||
dir="$(dirname "${i}")"
|
||||
pushd "${dir}"
|
||||
[[ -d .cargo ]] || mkdir .cargo
|
||||
cargo vendor >> .cargo/config.toml
|
||||
vendor_dir_list+=" ${dir}/vendor ${dir}/.cargo/config"
|
||||
case "$(basename "${i}")" in
|
||||
Cargo.lock)
|
||||
[[ -d .cargo ]] || mkdir .cargo
|
||||
cargo vendor >> .cargo/config.toml
|
||||
vendor_dir_list+=" ${dir}/vendor ${dir}/.cargo/config"
|
||||
;;
|
||||
go.mod)
|
||||
go mod tidy
|
||||
go mod vendor
|
||||
go mod verify
|
||||
vendor_dir_list+=" ${dir}/vendor"
|
||||
;;
|
||||
esac
|
||||
echo "${vendor_dir_list}"
|
||||
popd
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user