From 2026d08aeaeeab9d58b538d906bbde10297523e9 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Wed, 22 Oct 2025 23:11:33 +1100 Subject: [PATCH] chore(apt): introduce `stable` and `preview` distributions (#10679) In order to distribute pre-releases, it is useful to have a `preview` distribution in addition to the `stable` one. --------- Signed-off-by: Thomas Eizinger --- scripts/sync-apt.sh | 53 +++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/scripts/sync-apt.sh b/scripts/sync-apt.sh index 9af71e781..1007af99b 100755 --- a/scripts/sync-apt.sh +++ b/scripts/sync-apt.sh @@ -2,10 +2,8 @@ # set -euo pipefail -DISTRIBUTION="stable" COMPONENT="main" WORK_DIR="$(mktemp -d)" -POOL_DIR="${WORK_DIR}/pool" DISTS_DIR="${WORK_DIR}/dists" if [ -z "${AZURERM_ARTIFACTS_CONNECTION_STRING:-}" ]; then @@ -19,44 +17,42 @@ cleanup() { trap cleanup EXIT -echo "Downloading packages..." +for DISTRIBUTION in "stable" "preview"; do + POOL_DIR="${WORK_DIR}/pool-${DISTRIBUTION}" -az storage blob download-batch \ - --destination "${WORK_DIR}" \ - --source apt \ - --pattern "pool/*.deb" \ - --connection-string "${AZURERM_ARTIFACTS_CONNECTION_STRING}" \ - 2>&1 | grep -v "WARNING" || true + echo "Downloading packages for distribution $DISTRIBUTION..." -echo "Detecting architectures..." -ARCHITECTURES=$(for deb in "${POOL_DIR}"/*.deb; do dpkg-deb -f "$deb" Architecture 2>/dev/null; done | sort -u | tr '\n' ' ') + az storage blob download-batch \ + --destination "${WORK_DIR}" \ + --source apt \ + --pattern "pool-${DISTRIBUTION}/*.deb" \ + --connection-string "${AZURERM_ARTIFACTS_CONNECTION_STRING}" \ + 2>&1 | grep -v "WARNING" || true -if [ -z "$ARCHITECTURES" ]; then - echo "Error: Could not detect architectures" - exit 1 -fi + echo "Detecting architectures..." + ARCHITECTURES=$(for deb in "${POOL_DIR}"/*.deb; do dpkg-deb -f "$deb" Architecture 2>/dev/null; done | sort -u | tr '\n' ' ') || true -echo "Found: ${ARCHITECTURES}" + echo "Found: ${ARCHITECTURES}" -echo "Generating metadata..." -mkdir -p "${DISTS_DIR}/${DISTRIBUTION}/${COMPONENT}" + echo "Generating metadata..." + mkdir -p "${DISTS_DIR}/${DISTRIBUTION}/${COMPONENT}" -for ARCH in $ARCHITECTURES; do - BINARY_DIR="${DISTS_DIR}/${DISTRIBUTION}/${COMPONENT}/binary-${ARCH}" - mkdir -p "${BINARY_DIR}" + for ARCH in $ARCHITECTURES; do + BINARY_DIR="${DISTS_DIR}/${DISTRIBUTION}/${COMPONENT}/binary-${ARCH}" + mkdir -p "${BINARY_DIR}" - apt-ftparchive packages --arch "${ARCH}" "${POOL_DIR}/" >"${BINARY_DIR}/Packages" - gzip -k -f "${BINARY_DIR}/Packages" + apt-ftparchive packages --arch "${ARCH}" "${POOL_DIR}/" >"${BINARY_DIR}/Packages" + gzip -k -f "${BINARY_DIR}/Packages" - cat >"${BINARY_DIR}/Release" <"${BINARY_DIR}/Release" <Release <Release <>Release + apt-ftparchive release . >>Release +done echo "Uploading metadata..." az storage blob upload-batch \