summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-07-28 11:31:15 (EDT)
committer P. J. McDermott <pjm@nac.net>2013-07-28 11:31:15 (EDT)
commite0e490bb61a8c1ddf8d6c9e70c268ef5aa5230ec (patch)
tree0c4871e398aa65e4305112439e9d7a4f0d70e58c
parent3ed9af9a2677e758b5bfb60a98f3553b4c67af2b (diff)
include: Check and update bvaps first.
-rw-r--r--lib/include.sh54
-rw-r--r--locale/en_US/pro_archman.sh1
2 files changed, 38 insertions, 17 deletions
diff --git a/lib/include.sh b/lib/include.sh
index ac1000a..f90fcd5 100644
--- a/lib/include.sh
+++ b/lib/include.sh
@@ -37,15 +37,16 @@ include_changes()
local dist=
local source=
local srcver=
- local old_ver=
+ local script=
local bvaps=
+ local binver=
+ local arch=
+ local plat=
+ local old_ver=
local size=
local sect=
local file=
local pkg=
- local binver=
- local plat=
- local arch=
local pool_file=
parse_control "${changes}" _include_changes_field \
@@ -58,6 +59,37 @@ include_changes()
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]* [^_]*_\([^_]*\)_\([^_]*\)_\([^_]*\)\.opk'
+ script="${script}"'/\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}" \
+ "${plat}" "${arch}" "${source}")"
+ if [ "x${old_ver}" != 'x' ]; then
+ if [ "x${old_ver}" = "x${binver}" ]; then
+ error 2 "$(get_msg 'include_bvap_exists')" \
+ "${binver}" "${arch}" "${plat}"
+ fi
+ remove_packages_from_suite_archplat "${chan}" \
+ "${dist}" "${plat}" "${arch}" "${source}"
+ fi
+ db_set_binver "${chan}" "${dist}" "${plat}" "${arch}" \
+ "${source}" "${binver}"
+ db_inc_references "${plat}" "${arch}" "${source}" "${binver}" \
+ >/dev/null
+ done <<-EOF
+ ${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}"
@@ -69,7 +101,7 @@ include_changes()
fi
fi
- bvaps=''
+ # Include each binary package.
while read -r size file; do
if [ "x${file##[ ]}" = 'x' ]; then
continue
@@ -80,7 +112,6 @@ include_changes()
EOF
db_add_package "${plat}" "${arch}" "${source}" "${binver}" \
"${sect}" "${pkg}"
- bvaps="${bvaps}${binver} ${plat} ${arch}${LF}"
pool_file="pool/$(hash_name "${source}")/${source}"
pool_file="${pool_file}/${pkg}_${binver}_${arch}_${plat}.opk"
cp -p "$(dirname "${changes}")/${file}" \
@@ -91,17 +122,6 @@ include_changes()
${_include_files}
EOF
- while read -r binver plat arch; do
- remove_packages_from_suite_archplat "${chan}" "${dist}" \
- "${plat}" "${arch}" "${source}"
- db_set_binver "${chan}" "${dist}" "${plat}" "${arch}" \
- "${source}" "${binver}"
- db_inc_references "${plat}" "${arch}" "${source}" "${binver}" \
- >/dev/null
- done <<-EOF
- $(printf '%s' "${bvaps}" | LC_COLLATE='C' sort | uniq)
- EOF
-
return 0
}
diff --git a/locale/en_US/pro_archman.sh b/locale/en_US/pro_archman.sh
index d8b0ed5..a926ce1 100644
--- a/locale/en_US/pro_archman.sh
+++ b/locale/en_US/pro_archman.sh
@@ -33,6 +33,7 @@ msg_pro_archman_cmd_include_usage='<changes> ...'
# lib/include.sh
msg_pro_archman_include_including='Including %s (%s) into %s/%s...'
+msg_pro_archman_include_bvap_exists='Packages already exist for binary version %s, architecture %s, and platform %s'
# lib/cmd/process-incoming.sh
msg_pro_archman_cmd_process_incoming_summary='include packages in incoming'