Merge "mini-mirror: Allow per-source Aptly config files"

This commit is contained in:
Zuul 2019-03-06 03:11:40 +00:00 committed by Gerrit Code Review
commit 2a6e230936
2 changed files with 22 additions and 8 deletions

View File

@ -89,6 +89,12 @@ environment variable:
export APTLY_CONFIG_PATH=aptly.conf
.. NOTE::
Mini-mirror can be configured on a per-repo basis by adding an Aptly config
file to the root directory of a source. This overrides the Aptly config
file taken from ``APTLY_CONFIG_PATH``.
Proxy
~~~~~

View File

@ -28,6 +28,13 @@ for source_prefix in /opt/sources/*; do
dist=${info[2]}
components=${info[*]:3}
# Use source specific aptly config when provided
if [ -f "${source}"/aptly.conf ]; then
conf="${source}"/aptly.conf
else
conf=/etc/aptly.conf
fi
# Create package query from well-defined package list.
#
# package1
@ -48,20 +55,21 @@ for source_prefix in /opt/sources/*; do
name="${source}-${component}"
mirrors+=("$name")
aptly mirror create -filter="${packages}" -filter-with-deps \
"${name}" "${repo}" "${dist}" "${component}"
aptly mirror update "${name}"
aptly snapshot create "${name}" from mirror "${name}"
aptly -config="${conf}" mirror create -filter="${packages}" \
-filter-with-deps "${name}" "${repo}" "${dist}" "${component}"
aptly -config="${conf}" mirror update "${name}"
aptly -config="${conf}" snapshot create "${name}" from mirror "${name}"
done
# Publish snapshot and sign if a key passphrase is provided
com_list=$(echo "${components[@]}" | tr ' ' ',')
if [ ! -z "$1" ]; then
aptly publish snapshot -component="${com_list}" -distribution="${dist}" \
-batch=true -passphrase="${1}" "${mirrors[@]}" "${source_prefix:13}"
else
aptly publish snapshot -component="${com_list}" -distribution="${dist}" \
aptly -config="${conf}" publish snapshot -component="${com_list}" \
-distribution="${dist}" -batch=true -passphrase="${1}" \
"${mirrors[@]}" "${source_prefix:13}"
else
aptly -config="${conf}" publish snapshot -component="${com_list}" \
-distribution="${dist}" "${mirrors[@]}" "${source_prefix:13}"
fi
done
done