build: Remove unused scripts
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
This commit is contained in:
parent
69211171f8
commit
2d65cf4f24
5
Makefile
5
Makefile
|
@ -172,13 +172,10 @@ install-envtest: setup-envtest ## Download envtest binaries locally.
|
|||
help: ## Display this help menu
|
||||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
||||
|
||||
update-attributions:
|
||||
./hack/update-attributions.sh
|
||||
|
||||
e2e:
|
||||
./hack/ci/e2e.sh
|
||||
|
||||
verify: update-attributions fmt vet manifests api-docs tidy
|
||||
verify: fmt vet manifests api-docs tidy
|
||||
@if [ ! "$$(git status --porcelain --untracked-files=no)" = "" ]; then \
|
||||
echo "working directory is dirty:"; \
|
||||
git --no-pager diff; \
|
||||
|
|
|
@ -1,158 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
IMG="${IMG:-}"
|
||||
TAG="${TAG:-}"
|
||||
IMG_TAG="${IMG}:${TAG}"
|
||||
DOWNLOAD_URL="https://github.com/fluxcd/golang-with-libgit2/releases/download/${TAG}"
|
||||
SKIP_COSIGN_VERIFICATION="${SKIP_COSIGN_VERIFICATION:-false}"
|
||||
|
||||
TMP_DIR=$(mktemp -d)
|
||||
|
||||
function cleanup(){
|
||||
rm -rf "${TMP_DIR}"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
fatal() {
|
||||
echo '[ERROR] ' "$@" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
download() {
|
||||
[[ $# -eq 2 ]] || fatal 'download needs exactly 2 arguments'
|
||||
|
||||
curl -o "$1" -sfL "$2"
|
||||
|
||||
[[ $? -eq 0 ]] || fatal 'Download failed'
|
||||
}
|
||||
|
||||
download_files() {
|
||||
[[ $# -eq 1 ]] || fatal 'download_files needs exactly 1 arguments'
|
||||
|
||||
FILE_NAMES="checksums.txt checksums.txt.sig checksums.txt.pem $1"
|
||||
|
||||
for FILE_NAME in ${FILE_NAMES}; do
|
||||
download "${TMP_DIR}/${FILE_NAME}" "${DOWNLOAD_URL}/${FILE_NAME}"
|
||||
done
|
||||
}
|
||||
|
||||
cosign_verify(){
|
||||
[[ $# -eq 3 ]] || fatal 'cosign_verify needs exactly 3 arguments'
|
||||
|
||||
COSIGN_EXPERIMENTAL=1 cosign verify-blob --cert "$1" --signature "$2" "$3"
|
||||
|
||||
[[ $? -eq 0 ]] || fatal 'signature verification failed'
|
||||
}
|
||||
|
||||
assure_provenance() {
|
||||
[[ $# -eq 1 ]] || fatal 'assure_provenance needs exactly 1 arguments'
|
||||
|
||||
if "${SKIP_COSIGN_VERIFICATION}"; then
|
||||
echo 'Skipping cosign verification...'
|
||||
else
|
||||
cosign_verify "${TMP_DIR}/checksums.txt.pem" \
|
||||
"${TMP_DIR}/checksums.txt.sig" \
|
||||
"${TMP_DIR}/checksums.txt"
|
||||
fi
|
||||
|
||||
pushd "${TMP_DIR}" || exit
|
||||
if command -v sha256sum; then
|
||||
grep "$1" "checksums.txt" | sha256sum --check
|
||||
else
|
||||
grep "$1" "checksums.txt" | shasum -a 256 --check
|
||||
fi
|
||||
popd || exit
|
||||
|
||||
[[ $? -eq 0 ]] || fatal 'integrity verification failed'
|
||||
}
|
||||
|
||||
extract_libraries(){
|
||||
[[ $# -eq 2 ]] || fatal 'extract_libraries needs exactly 2 arguments'
|
||||
|
||||
tar -xf "${TMP_DIR}/$1"
|
||||
|
||||
rm "${TMP_DIR}/$1"
|
||||
mv "${2}" "${TAG}"
|
||||
mv "${TAG}/" "./build/libgit2"
|
||||
}
|
||||
|
||||
fix_pkgconfigs(){
|
||||
NEW_DIR="$(/bin/pwd)/build/libgit2/${TAG}"
|
||||
|
||||
# Update the prefix paths included in the .pc files.
|
||||
if [[ $OSTYPE == 'darwin'* ]]; then
|
||||
# https://github.com/fluxcd/golang-with-libgit2/blob/v0.1.4/.github/workflows/release.yaml#L158
|
||||
INSTALLED_DIR="/Users/runner/work/golang-with-libgit2/golang-with-libgit2/build/darwin-libgit2-only"
|
||||
|
||||
# This will make it easier to update to the location in which they will be used.
|
||||
# sed has a sight different behaviour in MacOS
|
||||
# NB: Some macOS users may override their sed with gsed. If gsed is the PATH, use that instead.
|
||||
if command -v gsed &> /dev/null; then
|
||||
find "${NEW_DIR}" -type f -name "*.pc" | xargs -I {} gsed -i "s;${INSTALLED_DIR};${NEW_DIR};g" {}
|
||||
else
|
||||
find "${NEW_DIR}" -type f -name "*.pc" | xargs -I {} sed -i "" "s;${INSTALLED_DIR};${NEW_DIR};g" {}
|
||||
fi
|
||||
else
|
||||
# https://github.com/fluxcd/golang-with-libgit2/blob/v0.1.4/.github/workflows/release.yaml#L52
|
||||
INSTALLED_DIR="/home/runner/work/golang-with-libgit2/golang-with-libgit2/build/build_libgit2_only"
|
||||
|
||||
find "${NEW_DIR}" -type f -name "*.pc" | xargs -I {} sed -i "s;${INSTALLED_DIR};${NEW_DIR};g" {}
|
||||
fi
|
||||
}
|
||||
|
||||
extract_from_image(){
|
||||
PLATFORM=$1
|
||||
DIR=$2
|
||||
|
||||
id=$(docker create --platform="${PLATFORM}" "${IMG_TAG}" sh)
|
||||
docker cp "${id}":/usr/local - > output.tar.gz
|
||||
docker rm -v "${id}"
|
||||
|
||||
tar -xf output.tar.gz "local/${DIR}"
|
||||
rm output.tar.gz
|
||||
|
||||
NEW_DIR="$(/bin/pwd)/build/libgit2/${TAG}"
|
||||
INSTALLED_DIR="/usr/local/${DIR}"
|
||||
|
||||
mv "local/${DIR}" "${TAG}"
|
||||
rm -rf "local"
|
||||
mv "${TAG}/" "./build/libgit2"
|
||||
|
||||
# Update the prefix paths included in the .pc files.
|
||||
# This will make it easier to update to the location in which they will be used.
|
||||
find "${NEW_DIR}" -type f -name "*.pc" | xargs -I {} sed -i "s;${INSTALLED_DIR};${NEW_DIR};g" {}
|
||||
}
|
||||
|
||||
install_libraries(){
|
||||
if [ -d "./build/libgit2/${TAG}" ]; then
|
||||
echo "Skipping: libgit2 ${TAG} already installed"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir -p "./build/libgit2"
|
||||
|
||||
# Linux ARM support is still based on the container image libraries.
|
||||
if [[ $OSTYPE == 'linux'* ]]; then
|
||||
if [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "aarch64" ]; then
|
||||
extract_from_image "linux/arm64" "aarch64-alpine-linux-musl"
|
||||
fix_pkgconfigs "aarch64-alpine-linux-musl"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
FILE_NAME="linux-$(uname -m)-libgit2-only.tar.gz"
|
||||
DIR="linux-libgit2-only"
|
||||
if [[ $OSTYPE == 'darwin'* ]]; then
|
||||
FILE_NAME="darwin-libgit2-only.tar.gz"
|
||||
DIR="darwin-libgit2-only"
|
||||
fi
|
||||
|
||||
download_files "${FILE_NAME}"
|
||||
assure_provenance "${FILE_NAME}"
|
||||
extract_libraries "${FILE_NAME}" "${DIR}"
|
||||
fix_pkgconfigs
|
||||
}
|
||||
|
||||
install_libraries
|
|
@ -1,25 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eoux pipefail
|
||||
|
||||
SPLIT="***"
|
||||
|
||||
cat <<EOF > ATTRIBUTIONS.md
|
||||
# Attributions
|
||||
|
||||
This application uses Open Source components. You can find the source
|
||||
code of their open source projects along with license information below.
|
||||
We acknowledge and are grateful to these developers for their contributions
|
||||
to open source.
|
||||
|
||||
## libgit2
|
||||
|
||||
Libgit2 was obtained in source-code form from its github repository:
|
||||
https://github.com/libgit2/libgit2/
|
||||
|
||||
No changes were made to its original source code.
|
||||
|
||||
Copyright notice (https://raw.githubusercontent.com/libgit2/libgit2/main/COPYING):
|
||||
|
||||
$(curl --max-time 5 -L https://raw.githubusercontent.com/libgit2/libgit2/main/COPYING)
|
||||
EOF
|
Loading…
Reference in New Issue