24ac316ff5
This commit introduces the download post-process script support/download/go-post-process, and hooks it into the Go package infrastructure. The -modcacherw flag is added to ensure that the Go cache is read/write, and can be deleted properly upon "make clean". The <pkg>_LICENSE variable of golang packages is expanded with ", vendored dependencies licenses probably not listed" as currently for all packages, the licenses of the vendored dependencies are not taken into account. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
37 lines
754 B
Bash
Executable File
37 lines
754 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
set -o pipefail
|
|
|
|
. "${0%/*}/helpers"
|
|
|
|
# Parse our options
|
|
while getopts "n:o:" OPT; do
|
|
case "${OPT}" in
|
|
o) output="${OPTARG}";;
|
|
n) base_name="${OPTARG}";;
|
|
:) error "option '%s' expects a mandatory argument\n" "${OPTARG}";;
|
|
\?) error "unknown option '%s'\n" "${OPTARG}";;
|
|
esac
|
|
done
|
|
|
|
# Already vendored tarball, nothing to do
|
|
if tar tf "${output}" | grep -q "^[^/]*/vendor" ; then
|
|
exit 0
|
|
fi
|
|
|
|
post_process_unpack "${base_name}" "${output}"
|
|
|
|
# Do the Go vendoring
|
|
pushd "${base_name}" > /dev/null
|
|
|
|
if [ ! -f go.mod ]; then
|
|
echo "ERROR: no vendor/ folder and no go.mod, aborting"
|
|
exit 1
|
|
fi
|
|
|
|
go mod vendor -v -modcacherw
|
|
popd > /dev/null
|
|
|
|
post_process_repack $(pwd) "${base_name}" "${output}"
|