constellation/bazel/ci/licenseheader.sh.in
Malte Poll 827c4f548d
bazel: deps mirror (#1522)
bazel-deps-mirror is an internal tools used to upload external dependencies
that are referenced in the Bazel WORKSPACE to the Edgeless Systems' mirror.

It also normalizes deps rules.

* hack: add tool to mirror Bazel dependencies
* hack: bazel-deps-mirror tests
* bazel: add deps mirror commands
* ci: upload Bazel dependencies on renovate PRs
* update go mod
* run deps_mirror_upload


Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
2023-03-30 09:41:56 +02:00

43 lines
799 B
Bash

#!/usr/bin/env bash
# Compare licenses of Go dependencies against a whitelist.
###### script header ######
lib=$(realpath @@BASE_LIB@@) || exit 1
stat "${lib}" >> /dev/null || exit 1
# shellcheck source=../sh/lib.bash
if ! source "${lib}"; then
echo "Error: could not find import"
exit 1
fi
cd "${BUILD_WORKSPACE_DIRECTORY}"
###### script body ######
echo "Checking files for missing company license header..."
noHeader=$(
grep \
-rL \
--include='*.go' \
--exclude-dir 3rdparty \
--exclude-dir build \
-e'SPDX-License-Identifier: AGPL-3.0-only' \
-e'DO NOT EDIT'
)
if [[ -z ${noHeader} ]]; then
exit 0
fi
echo "The following files are missing a license header:"
readarray -t <<< "${noHeader}"
for file in "${MAPFILE[@]}"; do
echo " ${file}"
done
exit 1