remove old snapcraft files (#8167)

This commit is contained in:
Brad Warren 2020-07-22 17:29:32 -07:00 committed by GitHub
parent 9ee4831f78
commit a1cd909247
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 0 additions and 215 deletions

View file

@ -1,44 +0,0 @@
#!/bin/bash
# Cross-compile the Certbot snap from local sources for the specified architecture.
# This script is designed for CI tests purpose.
# Usage: build.sh [amd64,arm64,armhf]
set -ex
SNAP_ARCH=$1
if [[ -z "${SNAP_ARCH}" ]]; then
echo "You need to specify the target architecture"
exit 1
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
CERTBOT_DIR="$(dirname "$(dirname "${DIR}")")"
# shellcheck source=common.sh
source "${DIR}/common.sh"
RegisterQemuHandlers
ResolveArch "${SNAP_ARCH}"
pushd "${DIR}/packages"
"${CERTBOT_DIR}/tools/simple_http_server.py" 8080 >/dev/null 2>&1 &
HTTP_SERVER_PID="$!"
popd
function cleanup() {
kill "${HTTP_SERVER_PID}"
}
trap cleanup EXIT
# NB: We use ARCH-stable-save tag instead of ARCH-stable, because recent versions of snapcraft images
# behave badly on QEMU for arm64 architecture. This should be fixed either by a new version of the
# image that does not have this problem anymore, or the migration to snapcraft remote builds.
docker run \
--rm \
--net=host \
-v "${CERTBOT_DIR}:/certbot" \
-w "/certbot" \
-e "PIP_EXTRA_INDEX_URL=http://localhost:8080" \
"adferrand/snapcraft:${DOCKER_ARCH}-stable-save" \
bash -c "snapcraft clean && snapcraft"

View file

@ -1,76 +0,0 @@
#!/bin/bash
# Cross-compile the specified Certbot DNS plugins snaps from local sources for the specified architecture.
# This script is designed for CI tests purpose.
# Usage: build.sh [amd64,arm64,armhf] [DNS_PLUGIN1,DNS_PLUGIN2 or ALL]
set -ex
SNAP_ARCH=$1
DNS_PLUGINS=$2
if [[ -z "${SNAP_ARCH}" ]]; then
echo "You need to specify the target architecture"
exit 1
fi
if [[ -z "${DNS_PLUGINS}" ]]; then
echo "You need to specify the DNS plugins"
exit 1
fi
if [[ "${DNS_PLUGINS}" = "ALL" ]]; then
DNS_PLUGINS=$(find . -maxdepth 1 -type d -name "certbot-dns-*" -exec basename {} \; | paste -sd "," -)
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
CERTBOT_DIR="$(dirname "$(dirname "${DIR}")")"
# shellcheck source=common.sh
source "${DIR}/common.sh"
RegisterQemuHandlers
ResolveArch "${SNAP_ARCH}"
pushd "${DIR}/packages"
"${CERTBOT_DIR}/tools/simple_http_server.py" 8080 >/dev/null 2>&1 &
HTTP_SERVER_PID="$!"
popd
function cleanup() {
kill "${HTTP_SERVER_PID}"
}
trap cleanup EXIT
SCRIPT=$(mktemp /tmp/script.XXXXXX.sh)
chmod +x "${SCRIPT}"
SNAP_CONSTRAINTS=$(mktemp /tmp/snap-constraints.XXXXXX.txt)
python3 tools/strip_hashes.py letsencrypt-auto-source/pieces/dependency-requirements.txt | grep -v python-augeas > "${SNAP_CONSTRAINTS}"
cat << "EOF" >> "${SCRIPT}"
#!/bin/bash
set -ex
IFS=","
for DNS_PLUGIN in ${DNS_PLUGINS}; do
pushd "${DNS_PLUGIN}"
cp /snap-constraints.txt .
snapcraft clean
snapcraft
popd
done
EOF
# NB: We use ARCH-stable-save tag instead of ARCH-stable, because recent versions of snapcraft images
# behave badly on QEMU for arm64 architecture. This should be fixed either by a new version of the
# image that does not have this problem anymore, or the migration to snapcraft remote builds.
docker run \
--rm \
--net=host \
-v "${CERTBOT_DIR}:/certbot" \
-v "${SCRIPT}:/script.sh" \
-v "${SNAP_CONSTRAINTS}:/snap-constraints.txt" \
-w "/certbot" \
-e "DNS_PLUGINS=${DNS_PLUGINS}" \
-e "PIP_EXTRA_INDEX_URL=http://localhost:8080" \
"adferrand/snapcraft:${DOCKER_ARCH}-stable-save" \
/script.sh

View file

@ -1,53 +0,0 @@
#!/bin/bash
# Common bash functions useful for cross-compiling Certbot snaps.
# Resolve the Snap architecture to Docker architecture (DOCKER_ARCH variable)
# and QEMU architecture (QEMU_ARCH variable).
# Usage: ResolveArch [amd64|arm64|armhf]
ResolveArch() {
local SNAP_ARCH=$1
case "${SNAP_ARCH}" in
"amd64")
DOCKER_ARCH="amd64"
QEMU_ARCH="x86_64"
;;
"arm64")
DOCKER_ARCH="arm64v8"
QEMU_ARCH="aarch64"
;;
"armhf")
DOCKER_ARCH="arm32v7"
QEMU_ARCH="arm"
;;
"*")
echo "Not supported build architecture '$1'." >&2
exit 1
esac
}
# Downloads QEMU static binary file for architecture
# Usage: DownloadQemuStatic [x86_64|aarch64|arm] DEST_DIR
DownloadQemuStatic() {
local QEMU_ARCH=$1
local DEST_DIR=$2
local QEMU_DOWNLOAD_URL
local QEMU_LATEST_TAG
if [ ! -f "${DIR}/qemu-${QEMU_ARCH}-static" ]; then
QEMU_DOWNLOAD_URL="https://github.com/multiarch/qemu-user-static/releases/download"
QEMU_LATEST_TAG=$(curl -s https://api.github.com/repos/multiarch/qemu-user-static/tags \
| grep 'name.*v[0-9]' \
| head -n 1 \
| cut -d '"' -f 4)
echo "${QEMU_DOWNLOAD_URL}/${QEMU_LATEST_TAG}/x86_64_qemu-${QEMU_ARCH}-static.tar.gz"
curl -SL "${QEMU_DOWNLOAD_URL}/${QEMU_LATEST_TAG}/x86_64_qemu-${QEMU_ARCH}-static.tar.gz" \
| tar xzv -C "${DEST_DIR}"
fi
}
# Executes the QEMU register script
# Usage: RegisterQemuHandlers
RegisterQemuHandlers() {
docker run --rm --privileged multiarch/qemu-user-static:register --reset
}

View file

@ -1,42 +0,0 @@
#!/bin/bash
# Cross-compile cryptography and cffi native wheels for arm64 and armhf architectures,
# on the versions required by the current pinning of Certbot dependencies.
# Wheels are stored in snap/local/packages folder to speed up cross-compilation of Certbot snap.
set -ex
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
TARGET_ARCHS="arm64 armhf"
rm -rf "${DIR}/packages/"*
# shellcheck source=common.sh
source "${DIR}/common.sh"
RegisterQemuHandlers
tools/strip_hashes.py letsencrypt-auto-source/pieces/dependency-requirements.txt \
| grep -v python-augeas > "${DIR}/snap-constraints.txt"
for SNAP_ARCH in ${TARGET_ARCHS}; do
ResolveArch "${SNAP_ARCH}"
DownloadQemuStatic "${QEMU_ARCH}" "${DIR}"
docker run \
--rm \
-v "${DIR}/qemu-${QEMU_ARCH}-static:/usr/bin/qemu-${QEMU_ARCH}-static" \
-v "${DIR}:/workspace" \
-w "/workspace" \
"${DOCKER_ARCH}/ubuntu:20.04" \
sh -c "\
apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3 python3-venv python3-dev libffi-dev libssl-dev gcc \
&& mkdir -p /build \
&& python3 -m venv /build/venv \
&& /build/venv/bin/pip install wheel \
&& /build/venv/bin/pip wheel cryptography cffi -c snap-constraints.txt -w /build \
&& mkdir -p /workspace/packages/cffi /workspace/packages/cryptography \
&& mv /build/cryptography-* /workspace/packages/cryptography \
&& mv /build/cffi-* /workspace/packages/cffi \
&& chmod 777 /workspace/packages /workspace/packages/cffi /workspace/packages/cryptography \
&& chmod 666 /workspace/packages/cffi/* /workspace/packages/cryptography/*
"
done