summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/include.sh69
1 files changed, 42 insertions, 27 deletions
diff --git a/lib/include.sh b/lib/include.sh
index 0b3e91b..41ae3bb 100644
--- a/lib/include.sh
+++ b/lib/include.sh
@@ -65,27 +65,55 @@ include_changes()
source="${_include_source}"
srcver="${_include_version}"
+ # List of (binver, arch, plat) tuples to be checked later.
+ script='s/[0-9][0-9]* [^ ][^ ]* [^_]*_\([^_]*\)'
+ script="${script}"'_\([^_]*\)_\([^_]*\)\.opk/\1 \2 \3/p'
+ bvaps="$(printf '%s\n' "${_include_files}" | \
+ sed -n "${script}" | LC_COLLATE='C' sort | uniq)"
+
info "$(get_msg 'include_including')" "${source}" "${srcver}" \
"${chan}" "${dist}"
- # Make sure the (binver, arch, plat) tuples ("bvaps" for short) are new.
- # Remove old binary packages of the same arch and plat from the suite.
- # Set the new binary version of packages of the arch and plat in the
- # suite.
- # Set the reference count for the (source, binver, arch, plat) tuple to
- # 1.
- script='s/[0-9][0-9]* [^ ][^ ]* [^_]*_\([^_]*\)_\([^_]*\)_\([^_]*\)'
- script="${script}"'\.opk/\1 \2 \3/p'
- bvaps="$(printf '%s\n' "${_include_files}" | sed -n "${script}" | \
- LC_COLLATE='C' sort | uniq)"
- while read -r binver arch plat; do
- old_ver="$(db_get_binver "${chan}" "${dist}" \
- "${arch}" "${plat}" "${source}")"
- if [ "x${old_ver}" != 'x' ]; then
+ # Pre-inclusion database sanity checks and updates: check for an
+ # existing version of the package in the suite.
+ old_ver="$(db_get_srcver "${chan}" "${dist}" "${source}")"
+ if [ "x${old_ver}" = 'x' ]; then
+ # New package.
+ db_set_srcver "${chan}" "${dist}" "${source}" "${srcver}"
+ elif [ "x${old_ver}" != "x${_include_version}" ]; then
+ # New source version. Remove the old source package from the
+ # suite.
+ remove_source_from_suite "${chan}" "${dist}" "${source}"
+ db_set_srcver "${chan}" "${dist}" "${source}" "${srcver}"
+ else
+ # Same source version. Hopefully different binary version,
+ # architecture, and/or platform. Make sure such "bvap" tuples
+ # are new.
+ while read -r binver arch plat; do
+ old_ver="$(db_get_binver "${chan}" "${dist}" \
+ "${arch}" "${plat}" "${source}")"
if [ "x${old_ver}" = "x${binver}" ]; then
error 2 "$(get_msg 'include_bvap_exists')" \
"${binver}" "${arch}" "${plat}"
fi
+ done <<-EOF
+ ${bvaps}
+ EOF
+ fi
+
+ # For each (binver, arch, plat) tuple in the package changes:
+ # * Remove old binary packages of the same arch and plat from the
+ # suite.
+ # * Set the new binary version of packages of the arch and plat in the
+ # suite.
+ # * Set the reference count for the tuple to 1.
+ # This is done separately from the next loop because it must be done
+ # exactly once for each bvap tuple. The next loop can hit any given
+ # bvap tuple multiple times.
+ while read -r binver arch plat; do
+ old_ver="$(db_get_binver "${chan}" "${dist}" \
+ "${arch}" "${plat}" "${source}")"
+ if [ "x${old_ver}" != 'x' ]; then
remove_packages_from_suite_archplat "${chan}" \
"${dist}" "${arch}" "${plat}" "${source}"
fi
@@ -97,19 +125,6 @@ include_changes()
${bvaps}
EOF
- # Remove the source package from the suite if the version is new.
- # Update the source package version in the suite.
- old_ver="$(db_get_srcver "${chan}" "${dist}" "${source}")"
- if [ "x${old_ver}" = 'x' ]; then
- db_set_srcver "${chan}" "${dist}" "${source}" "${srcver}"
- else
- if [ "x${old_ver}" != "x${_include_version}" ]; then
- remove_source_from_suite "${chan}" "${dist}" "${source}"
- db_set_srcver "${chan}" "${dist}" \
- "${source}" "${srcver}"
- fi
- fi
-
# Include each binary package.
files=''
while read -r size sect file; do