mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
hack/vendor: add check for vendored archive/tar
Also allow re-vendoring using `./hack/vendor.sh archive/tar`
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 31b2c3bbd9
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
cc5a381cbc
commit
feaca9816a
3 changed files with 17 additions and 2 deletions
|
@ -280,6 +280,7 @@ RUN --mount=type=cache,sharing=locked,id=moby-dev-aptlib,target=/var/lib/apt \
|
||||||
libnl-3-200 \
|
libnl-3-200 \
|
||||||
libprotobuf-c1 \
|
libprotobuf-c1 \
|
||||||
net-tools \
|
net-tools \
|
||||||
|
patch \
|
||||||
pigz \
|
pigz \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
python3-setuptools \
|
python3-setuptools \
|
||||||
|
|
|
@ -5,12 +5,13 @@ source "${SCRIPTDIR}/.validate"
|
||||||
|
|
||||||
validate_vendor_diff(){
|
validate_vendor_diff(){
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
|
# shellcheck disable=SC2207
|
||||||
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'vendor.conf' 'vendor/' || true) )
|
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'vendor.conf' 'vendor/' || true) )
|
||||||
unset IFS
|
unset IFS
|
||||||
|
|
||||||
if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ ${#files[@]} -gt 0 ]; then
|
if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ ${#files[@]} -gt 0 ]; then
|
||||||
# recreate vendor/
|
# recreate vendor/
|
||||||
vndr -whitelist=^archive/tar
|
./hack/vendor.sh
|
||||||
# check if any files have changed
|
# check if any files have changed
|
||||||
diffs="$(git status --porcelain -- vendor 2>/dev/null)"
|
diffs="$(git status --porcelain -- vendor 2>/dev/null)"
|
||||||
mfiles="$(echo "$diffs" | awk '/^ M / {print $2}')"
|
mfiles="$(echo "$diffs" | awk '/^ M / {print $2}')"
|
||||||
|
|
|
@ -12,4 +12,17 @@ if ! hash vndr; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
vndr -whitelist=^archive/tar "$@"
|
if [ $# -eq 0 ] || [ "$1" = "archive/tar" ]; then
|
||||||
|
echo "update vendored copy of archive/tar"
|
||||||
|
: "${GO_VERSION:=$(awk -F '[ =]' '$1 == "ARG" && $2 == "GO_VERSION" { print $3; exit }' ./Dockerfile)}"
|
||||||
|
rm -rf vendor/archive
|
||||||
|
mkdir -p ./vendor/archive/tar
|
||||||
|
echo "downloading: https://golang.org/dl/go${GO_VERSION}.src.tar.gz"
|
||||||
|
curl -fsSL "https://golang.org/dl/go${GO_VERSION}.src.tar.gz" \
|
||||||
|
| tar --extract --gzip --directory=vendor/archive/tar --strip-components=4 go/src/archive/tar
|
||||||
|
patch --strip=4 --directory=vendor/archive/tar --input="$PWD/patches/0001-archive-tar-do-not-populate-user-group-names.patch"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -eq 0 ] || [ "$1" != "archive/tar" ]; then
|
||||||
|
vndr -whitelist=^archive/tar "$@"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue