diff options
Diffstat (limited to 'lib/include.sh')
-rw-r--r-- | lib/include.sh | 54 |
1 files changed, 37 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 } |