Vendor in latest code.

Add support for vendoring in containers/storage and ran
dep ensure

Need to get default storage for containers to include and default to
overlay2.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh 2017-03-28 15:56:09 -04:00
parent 37f118d73a
commit 549d734da9
35 changed files with 136 additions and 1105 deletions

View file

@ -1,120 +0,0 @@
#!/usr/bin/env bash
PROJECT=github.com/containers/storage
# Downloads dependencies into vendor/ directory
mkdir -p vendor
if ! go list github.com/containers/storage/storage &> /dev/null; then
rm -rf .gopath
mkdir -p .gopath/src/github.com/containers
ln -sf ../../../.. .gopath/src/${PROJECT}
export GOPATH="${PWD}/.gopath:${PWD}/vendor"
fi
export GOPATH="$GOPATH:${PWD}/vendor"
find='find'
if [ "$(go env GOHOSTOS)" = 'windows' ]; then
find='/usr/bin/find'
fi
clone() {
local vcs="$1"
local pkg="$2"
local rev="$3"
local url="$4"
: ${url:=https://$pkg}
local target="vendor/src/$pkg"
echo -n "$pkg @ $rev: "
if [ -d "$target" ]; then
echo -n 'rm old, '
rm -rf "$target"
fi
echo -n 'clone, '
case "$vcs" in
git)
git clone --quiet --no-checkout "$url" "$target"
( cd "$target" && git checkout --quiet "$rev" && git reset --quiet --hard "$rev" )
;;
hg)
hg clone --quiet --updaterev "$rev" "$url" "$target"
;;
esac
echo -n 'rm VCS, '
( cd "$target" && rm -rf .{git,hg} )
echo -n 'rm vendor, '
( cd "$target" && rm -rf vendor Godeps/_workspace )
echo done
}
clean() {
local packages=(
"${PROJECT}/cmd/oci-storage"
)
local storagePlatforms=( ${STORAGE_OSARCH:="linux/amd64 linux/i386 linux/arm freebsd/amd64 freebsd/386 freebsd/arm windows/amd64"} )
local buildTagCombos=(
''
'experimental'
)
echo
echo -n 'collecting import graph, '
local IFS=$'\n'
local imports=( $(
for platform in "${storagePlatforms[@]}"; do
export GOOS="${platform%/*}";
export GOARCH="${platform##*/}";
for buildTags in "${buildTagCombos[@]}"; do
go list -e -tags "$buildTags" -f '{{join .Deps "\n"}}' "${packages[@]}"
go list -e -tags "$buildTags" -f '{{join .TestImports "\n"}}' "${packages[@]}"
done
done | grep -vE "^${PROJECT}/" | sort -u
) )
imports=( $(go list -e -f '{{if not .Standard}}{{.ImportPath}}{{end}}' "${imports[@]}") )
unset IFS
echo -n 'pruning unused packages, '
findArgs=-false
for import in "${imports[@]}"; do
[ "${#findArgs[@]}" -eq 0 ] || findArgs+=( -or )
findArgs+=( -path "vendor/src/$import" )
done
local IFS=$'\n'
local prune=( $($find vendor -depth -type d -not '(' "${findArgs[@]}" ')') )
unset IFS
for dir in "${prune[@]}"; do
$find "$dir" -maxdepth 1 -not -type d -not -name 'LICENSE*' -not -name 'COPYING*' -exec rm -v -f '{}' ';'
rmdir "$dir" 2>/dev/null || true
done
echo -n 'pruning unused files, '
$find vendor -type f -name '*_test.go' -exec rm -v '{}' ';'
$find vendor -type f -name 'Vagrantfile' -exec rm -v '{}' ';'
# These are the files that are left over after fix_rewritten_imports is run.
echo -n 'pruning .orig files, '
$find vendor -type f -name '*.orig' -exec rm -v '{}' ';'
echo done
}
# Fix up hard-coded imports that refer to Godeps paths so they'll work with our vendoring
fix_rewritten_imports () {
local pkg="$1"
local remove="${pkg}/Godeps/_workspace/src/"
local target="vendor/src/$pkg"
echo "$pkg: fixing rewritten imports"
$find "$target" -name \*.go -exec sed -i'.orig' -e "s|\"${remove}|\"|g" {} \;
}

View file

@ -17,6 +17,7 @@ set -e
set -o pipefail
export PATH=/usr/local/go/bin:${PATH}
export PKG='github.com/containers/storage'
export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export MAKEDIR="$SCRIPTDIR/make"
@ -71,22 +72,16 @@ else
exit 1
fi
if [ "$AUTO_GOPATH" ]; then
rm -rf .gopath
mkdir -p .gopath/src/"$(dirname "${PKG}")"
ln -sf ../../../.. .gopath/src/"${PKG}"
export GOPATH="${PWD}/.gopath:${PWD}/vendor"
export GOPATH="${GOPATH:-/go}"
if [ "$(go env GOOS)" = 'solaris' ]; then
# sys/unix is installed outside the standard library on solaris
# TODO need to allow for version change, need to get version from go
export GOPATH="${GOPATH}:/usr/lib/gocode/1.6.2"
fi
if [ "$(go env GOOS)" = 'solaris' ]; then
# sys/unix is installed outside the standard library on solaris
# TODO need to allow for version change, need to get version from go
export GOPATH="${GOPATH}:/usr/lib/gocode/1.6.2"
fi
if [ ! "$GOPATH" ]; then
echo >&2 'error: missing GOPATH; please see https://golang.org/doc/code.html#GOPATH'
echo >&2 ' alternatively, set AUTO_GOPATH=1'
exit 1
fi
@ -186,7 +181,7 @@ test_env() {
GOPATH="$GOPATH" \
GOTRACEBACK=all \
HOME="$ABS_DEST/fake-HOME" \
PATH="$PATH" \
PATH="${GOPATH}/bin:/usr/local/go/bin:$PATH" \
TEMP="$TEMP" \
"$@"
}

View file

@ -7,6 +7,7 @@ BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION"
source "${MAKEDIR}/.go-autogen"
export GCCGO=${SCRIPTDIR}/../vagrant/gccgo-wrapper.sh
# gccgo require explicit flag -pthread to allow goroutines to work.
go build -compiler=gccgo \
-o "$DEST/$BINARY_FULLNAME" \

View file

@ -8,7 +8,7 @@ unset IFS
errors=()
for f in "${files[@]}"; do
failedLint=$(golint "$f")
failedLint=$(golint "$f")
if [ "$failedLint" ]; then
errors+=( "$failedLint" )
fi

View file

@ -1,27 +0,0 @@
#!/bin/bash
source "${MAKEDIR}/.validate"
IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'hack/vendor.sh' 'hack/.vendor-helpers.sh' 'vendor/' || true) )
unset IFS
if [ ${#files[@]} -gt 0 ]; then
# We run vendor.sh to and see if we have a diff afterwards
./hack/vendor.sh >/dev/null
# Let see if the working directory is clean
diffs="$(git status --porcelain -- vendor 2>/dev/null)"
if [ "$diffs" ]; then
{
echo 'The result of ./hack/vendor.sh differs'
echo
echo "$diffs"
echo
echo 'Please vendor your package with ./hack/vendor.sh.'
echo
} >&2
false
else
echo 'Congratulations! All vendoring changes are done the right way.'
fi
fi

View file

@ -1,61 +0,0 @@
#!/usr/bin/env bash
set -e
# this script is used to update vendored dependencies
#
# Usage:
# vendor.sh revendor all dependencies
# vendor.sh github.com/docker/engine-api revendor only the engine-api dependency.
# vendor.sh github.com/docker/engine-api v0.3.3 vendor only engine-api at the specified tag/commit.
# vendor.sh git github.com/docker/engine-api v0.3.3 is the same but specifies the VCS for cases where the VCS is something else than git
# vendor.sh git golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://github.com/golang/sys.git vendor only golang.org/x/sys downloading from the specified URL
cd "$(dirname "$BASH_SOURCE")/.."
source 'hack/.vendor-helpers.sh'
case $# in
0)
rm -rf vendor/
;;
# If user passed arguments to the script
1)
eval "$(grep -E "^clone [^ ]+ $1" "$0")"
clean
exit 0
;;
2)
rm -rf "vendor/src/$1"
clone git "$1" "$2"
clean
exit 0
;;
[34])
rm -rf "vendor/src/$2"
clone "$@"
clean
exit 0
;;
*)
>&2 echo "error: unexpected parameters"
exit 1
;;
esac
# the following lines are in sorted order, FYI
clone git github.com/Microsoft/hcsshim v0.3.6
clone git github.com/Microsoft/go-winio v0.3.4
clone git github.com/Sirupsen/logrus v0.10.0 # logrus is a common dependency among multiple deps
# forked golang.org/x/net package includes a patch for lazy loading trace templates
clone git golang.org/x/net 2beffdc2e92c8a3027590f898fe88f69af48a3f8 https://github.com/tonistiigi/net.git
clone git golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://github.com/golang/sys.git
clone git github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3
clone git github.com/docker/go-connections fa2850ff103453a9ad190da0df0af134f0314b3d
clone git github.com/docker/engine-api 1d247454d4307fb1ddf10d09fd2996394b085904
# get graph and distribution packages
clone git github.com/vbatts/tar-split v0.9.13
# get go-zfs packages
clone git github.com/mistifyio/go-zfs 22c9b32c84eb0d0c6f4043b6e90fc94073de92fa
clone git github.com/pborman/uuid v1.0
clone git github.com/opencontainers/runc cc29e3dded8e27ba8f65738f40d251c885030a28 # libcontainer
clean