Switch to golang/dep.
This commit is contained in:
parent
709d50836b
commit
2618aef008
246 changed files with 42564 additions and 17452 deletions
111
script/glide.sh
111
script/glide.sh
|
@ -1,111 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
set -o nounset
|
||||
|
||||
####
|
||||
### Helper script for glide[-vc] to handle specifics for the Traefik repo.
|
||||
##
|
||||
|
||||
GLIDE_ARGS=()
|
||||
GLIDE_VC_ARGS=(
|
||||
'--use-lock-file' # `glide list` seems to miss test dependencies, e.g., github.com/mattn/go-shellwords
|
||||
'--only-code'
|
||||
'--no-tests'
|
||||
)
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
readonly SCRIPT_DIR
|
||||
readonly GLIDE_DIR="${SCRIPT_DIR}/.."
|
||||
|
||||
usage() {
|
||||
echo "usage: $(basename "$0") install | update | get <package> | trim
|
||||
install: Install all dependencies and trim the vendor folder afterwards (alternative command: i).
|
||||
update: Update all dependencies and trim the vendor folder afterwards (alternative command: up).
|
||||
get: Add a dependency and trim the vendor folder afterwards.
|
||||
trim: Trim the vendor folder only, do not install or update dependencies.
|
||||
|
||||
The current working directory must contain a glide.yaml file." >&2
|
||||
}
|
||||
|
||||
GLIDE_ARGS+=('--strip-vendor')
|
||||
|
||||
if ! type glide > /dev/null 2>&1; then
|
||||
echo "glide not found in PATH." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! type glide-vc > /dev/null 2>&1; then
|
||||
echo "glide-vc not found in PATH." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -e "${GLIDE_DIR}/glide.yaml" ]]; then
|
||||
echo "no glide.yaml file found in the current working directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo "missing command" >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
readonly glide_command="$1"
|
||||
shift
|
||||
|
||||
skip_glide_command=
|
||||
case "${glide_command}" in
|
||||
'install' | 'i')
|
||||
if [[ $# -ne 0 ]]; then
|
||||
echo "surplus parameters given" >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
'update' | 'up')
|
||||
if [[ $# -ne 0 ]]; then
|
||||
echo "surplus parameters given" >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
'get')
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo 'insufficient/surplus arguments given for "get" command' >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
GLIDE_ARGS+=("$1")
|
||||
shift
|
||||
;;
|
||||
|
||||
'trim')
|
||||
if [[ $# -ne 0 ]]; then
|
||||
echo "surplus parameters given" >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
skip_glide_command=yes
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "unknown command: ${glide_command}" >&2
|
||||
usage
|
||||
exit 1
|
||||
esac
|
||||
readonly skip_glide_command
|
||||
|
||||
if [[ -z "${skip_glide_command}" ]]; then
|
||||
# Use parameter substitution to account for an empty glide arguments array
|
||||
# that would otherwise lead to an "unbound variable" error due to the nounset
|
||||
# option.
|
||||
GLIDE_ARGS=("${GLIDE_ARGS+"${GLIDE_ARGS[@]}"}")
|
||||
echo "running: glide ${glide_command} ${GLIDE_ARGS[*]}"
|
||||
glide ${glide_command} ${GLIDE_ARGS[*]}
|
||||
fi
|
||||
|
||||
echo "trimming vendor folder using: glide-vc ${GLIDE_VC_ARGS[*]}"
|
||||
glide-vc ${GLIDE_VC_ARGS[*]}
|
34
script/prune-dep.sh
Executable file
34
script/prune-dep.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
set -o nounset
|
||||
|
||||
echo "Prune dependencies"
|
||||
|
||||
dep prune
|
||||
|
||||
find vendor -name '*_test.go' -exec rm {} \;
|
||||
|
||||
find vendor -type f \( ! -iname 'licen[cs]e*' \
|
||||
-a ! -iname '*notice*' \
|
||||
-a ! -iname '*patent*' \
|
||||
-a ! -iname '*copying*' \
|
||||
-a ! -iname '*unlicense*' \
|
||||
-a ! -iname '*copyright*' \
|
||||
-a ! -iname '*copyleft*' \
|
||||
-a ! -iname '*legal*' \
|
||||
-a ! -iname 'disclaimer*' \
|
||||
-a ! -iname 'third-party*' \
|
||||
-a ! -iname 'thirdparty*' \
|
||||
-a ! -iname '*.go' \
|
||||
-a ! -iname '*.c' \
|
||||
-a ! -iname '*.S' \
|
||||
-a ! -iname '*.cc' \
|
||||
-a ! -iname '*.cpp' \
|
||||
-a ! -iname '*.cxx' \
|
||||
-a ! -iname '*.h' \
|
||||
-a ! -iname '*.hh' \
|
||||
-a ! -iname '*.hpp' \
|
||||
-a ! -iname '*.hxx' \
|
||||
-a ! -iname '*.s' \) -exec rm -f {} +
|
|
@ -1,13 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.validate"
|
||||
|
||||
if grep -q "$(glide-hash)" glide.lock; then
|
||||
echo 'Congratulations! glide.lock is unchanged.'
|
||||
else
|
||||
{
|
||||
echo "Error: glide.lock has been manually changed. Don't do this. Use script/glide.sh up instead."
|
||||
echo
|
||||
} >&2
|
||||
false
|
||||
fi
|
|
@ -3,27 +3,28 @@ set -o errexit
|
|||
set -o pipefail
|
||||
set -o nounset
|
||||
|
||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; export SCRIPTDIR
|
||||
source "${SCRIPTDIR}/.validate"
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; export SCRIPT_DIR
|
||||
source "${SCRIPT_DIR}/.validate"
|
||||
|
||||
vendor_dir="./vendor/"
|
||||
IFS=$'\n' files=( $(validate_diff --diff-filter=ACMR --name-only -- ${vendor_dir} || true) )
|
||||
|
||||
if [[ ${#files[@]} -gt 0 ]]; then
|
||||
# We run glide install to and see if we have a diff afterwards
|
||||
# We run dep install to and see if we have a diff afterwards
|
||||
echo "checking ${vendor_dir} for unintentional changes..."
|
||||
(
|
||||
"${SCRIPTDIR}/glide.sh" install
|
||||
)
|
||||
|
||||
dep ensure -v
|
||||
(${SCRIPT_DIR}/prune-dep.sh)
|
||||
|
||||
# Let see if the working directory is clean
|
||||
diffs="$(git status --porcelain -- ${vendor_dir} 2>/dev/null)"
|
||||
if [[ "$diffs" ]]; then
|
||||
{
|
||||
echo "The result of 'glide install' for vendor directory '${vendor_dir}' differs"
|
||||
echo "The result of 'dep ensure' for vendor directory '${vendor_dir}' differs"
|
||||
echo
|
||||
echo "$diffs"
|
||||
echo
|
||||
echo 'Please vendor your package(s) with script/glide.sh.'
|
||||
echo 'Please vendor your package(s) with dep.'
|
||||
echo
|
||||
} >&2
|
||||
exit 2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue