mini-mirror: Preserve codename and label

Ubuntu 18.04 performs strict checking of the Codename and Label when
performing an apt-get update. The snapshots published by aptly do not
set these parameters in a way that apt-get likes.

This change explicitly sets the codename and label based on the values
from the upstream repo being mirrored.

Note: this relies on a currently unmerged pull request/
https://github.com/aptly-dev/aptly/pull/892

Change-Id: I011862dcf9efbb8b1f9757c65f3d58da49a496d7
This commit is contained in:
Phil Sphicas 2019-12-26 12:38:31 -08:00
parent 6c3f46abd8
commit 066efa5767
4 changed files with 16 additions and 6 deletions

View File

@ -26,8 +26,8 @@ COPY "${APTLY_CONFIG_PATH}" /etc/aptly.conf
COPY tools/install_aptly.sh /opt/install_aptly.sh
ARG APTLY_INSTALL_FROM=source
ARG APTLY_REPO=https://github.com/aptly-dev/aptly.git
ARG APTLY_REFSPEC=master
ARG APTLY_REPO=https://github.com/smstone/aptly.git
ARG APTLY_REFSPEC=allow-custom-codename
RUN /opt/install_aptly.sh

View File

@ -26,8 +26,8 @@ COPY "${APTLY_CONFIG_PATH}" /etc/aptly.conf
COPY tools/install_aptly.sh /opt/install_aptly.sh
ARG APTLY_INSTALL_FROM=source
ARG APTLY_REPO=https://github.com/aptly-dev/aptly.git
ARG APTLY_REFSPEC=master
ARG APTLY_REPO=https://github.com/smstone/aptly.git
ARG APTLY_REFSPEC=allow-custom-codename
RUN /opt/install_aptly.sh

View File

@ -37,8 +37,10 @@ RELEASE_SIGN_KEY_PASSPHRASE=${RELEASE_SIGN_KEY_PASSPHRASE:-""}
# APTLY_INSTALL_FROM is either 'apt' or 'source'
APTLY_INSTALL_FROM=${APTLY_INSTALL_FROM:-"source"}
APTLY_REPO=${APTLY_REPO:-"https://github.com/aptly-dev/aptly.git"}
APTLY_REFSPEC=${APTLY_REFSPEC:-"v1.4.0"}
# Explicitly setting the codename relies on an unmerged pull request
# https://github.com/aptly-dev/aptly/pull/892
APTLY_REPO=${APTLY_REPO:-"https://github.com/smstone/aptly.git"}
APTLY_REFSPEC=${APTLY_REFSPEC:-"allow-custom-codename"}
docker build -f "${IMAGE}"/Dockerfile."${DISTRO}" --network=host \
-t "${REGISTRY_URI}""${IMAGE}":"${VERSION}"-"${DISTRO}""${EXTRA_TAG_INFO}" \

View File

@ -59,6 +59,10 @@ for source_prefix in /opt/sources/*; do
aptly mirror update -config="${conf}" -max-tries=3 "${source}"
aptly snapshot create -config="${conf}" "${source}" from mirror "${source}"
# preserve the codename and label of the source repository
codename=$(aptly mirror show ${source} | sed -n 's/^Codename: //p')
label=$(aptly mirror show ${source} | sed -n 's/^Label: //p')
# Publish snapshot and sign if a key passphrase is provided.
com_list=$(echo "${components[@]}" | tr ' ' ',')
if [ ! -z "$1" ]; then
@ -67,11 +71,15 @@ for source_prefix in /opt/sources/*; do
-component="${com_list}" \
-distribution="${dist}" \
-passphrase="${1}" \
-codename="${codename}" \
-label="${label}" \
"${source}" "${source_prefix:13}"
else
aptly publish snapshot \
-component="${com_list}" \
-distribution="${dist}" \
-codename="${codename}" \
-label="${label}" \
"${source}" "${source_prefix:13}"
fi
done