mirror of
https://github.com/flatcar/scripts.git
synced 2026-01-18 23:12:18 +01:00
pkg-auto: Handle updates also in coreos-overlay and across repos
This commit is contained in:
parent
81c9f4cbd2
commit
892bde03a3
@ -1875,18 +1875,16 @@ function consistency_checks() {
|
||||
# 1 - name of a map variable, will contain a mapping of package name
|
||||
# to repository name
|
||||
function read_package_sources() {
|
||||
local which=${1}; shift
|
||||
local -n package_sources_map_ref=${1}; shift
|
||||
|
||||
# shellcheck source=for-shellcheck/globals
|
||||
source "${WORKDIR}/globals"
|
||||
|
||||
local -a files=()
|
||||
local which arch
|
||||
for which in "${WHICH[@]}"; do
|
||||
files+=( "${WORKDIR}/pkg-reports/${which}/sdk-package-repos" )
|
||||
for arch in "${ARCHES[@]}"; do
|
||||
files+=( "${WORKDIR}/pkg-reports/${which}/${arch}-board-package-repos" )
|
||||
done
|
||||
local -a files=( "${WORKDIR}/pkg-reports/${which}/sdk-package-repos" )
|
||||
local arch
|
||||
for arch in "${ARCHES[@]}"; do
|
||||
files+=( "${WORKDIR}/pkg-reports/${which}/${arch}-board-package-repos" )
|
||||
done
|
||||
|
||||
local file pkg repo saved_repo
|
||||
@ -1934,14 +1932,17 @@ function read_package_sources() {
|
||||
# BOM_NEW_PKG_SLOT_VERMINMAX_MAP_MVM_IDX - same as above, but for
|
||||
# packages after the update
|
||||
#
|
||||
# BOM_PKG_SOURCES_MAP_IDX - mapping of package name to the repository
|
||||
# name
|
||||
# BOM_OLD_PKG_SOURCES_MAP_IDX - mapping of old package name to the
|
||||
# repository name
|
||||
#
|
||||
# BOM_NEW_PKG_SOURCES_MAP_IDX - mapping of new package name to the
|
||||
# repository name
|
||||
#
|
||||
# BOM_DIFF_LIB_FILTERS_IDX - filtering information used to skip
|
||||
# irrelevant parts when processing
|
||||
# md5-cache entries for automated change
|
||||
# reporting
|
||||
declare -gri BOM_PKG_TO_TAGS_MVM_IDX=0 BOM_PKG_SLOTS_SET_MVM_IDX=1 BOM_OLD_PKG_SLOT_VERMINMAX_MAP_MVM_IDX=2 BOM_NEW_PKG_SLOT_VERMINMAX_MAP_MVM_IDX=3 BOM_PKG_SOURCES_MAP_IDX=4 BOM_DIFF_LIB_FILTERS_IDX=5
|
||||
declare -gri BOM_PKG_TO_TAGS_MVM_IDX=0 BOM_PKG_SLOTS_SET_MVM_IDX=1 BOM_OLD_PKG_SLOT_VERMINMAX_MAP_MVM_IDX=2 BOM_NEW_PKG_SLOT_VERMINMAX_MAP_MVM_IDX=3 BOM_OLD_PKG_SOURCES_MAP_IDX=4 BOM_NEW_PKG_SOURCES_MAP_IDX=5 BOM_DIFF_LIB_FILTERS_IDX=6
|
||||
|
||||
# Declare bunch of maps variables.
|
||||
#
|
||||
@ -1949,7 +1950,7 @@ declare -gri BOM_PKG_TO_TAGS_MVM_IDX=0 BOM_PKG_SLOTS_SET_MVM_IDX=1 BOM_OLD_PKG_S
|
||||
#
|
||||
# @ - names of variables to be used for bunch of maps
|
||||
function bunch_of_maps_declare() {
|
||||
struct_declare -ga "${@}" "( '' '' '' '' '' '' )"
|
||||
struct_declare -ga "${@}" "( '' '' '' '' '' '' '' )"
|
||||
}
|
||||
|
||||
# Unset bunch of maps variables.
|
||||
@ -2104,7 +2105,8 @@ function handle_one_package_change() {
|
||||
local pkg_slots_set_mvm_var_name=${bunch_of_maps_ref[BOM_PKG_SLOTS_SET_MVM_IDX]}
|
||||
local old_pkg_slot_verminmax_map_mvm_var_name=${bunch_of_maps_ref[BOM_OLD_PKG_SLOT_VERMINMAX_MAP_MVM_IDX]}
|
||||
local new_pkg_slot_verminmax_map_mvm_var_name=${bunch_of_maps_ref[BOM_NEW_PKG_SLOT_VERMINMAX_MAP_MVM_IDX]}
|
||||
local -n pkg_sources_map_ref=${bunch_of_maps_ref[BOM_PKG_SOURCES_MAP_IDX]}
|
||||
local -n pkg_old_sources_map_ref=${bunch_of_maps_ref[BOM_OLD_PKG_SOURCES_MAP_IDX]}
|
||||
local -n pkg_new_sources_map_ref=${bunch_of_maps_ref[BOM_NEW_PKG_SOURCES_MAP_IDX]}
|
||||
local diff_lib_filters_var_name=${bunch_of_maps_ref[BOM_DIFF_LIB_FILTERS_IDX]}
|
||||
|
||||
# The function goes over a pair of old and new package names. For
|
||||
@ -2130,8 +2132,8 @@ function handle_one_package_change() {
|
||||
fi
|
||||
pkg_debug_enable "${old_name}" "${new_name}"
|
||||
pkg_debug 'handling updates'
|
||||
local old_repo=${pkg_sources_map_ref["${old_name}"]:-}
|
||||
local new_repo=${pkg_sources_map_ref["${new_name}"]:-}
|
||||
local old_repo=${pkg_old_sources_map_ref["${old_name}"]:-}
|
||||
local new_repo=${pkg_new_sources_map_ref["${new_name}"]:-}
|
||||
if [[ -z ${old_repo} ]]; then
|
||||
pkg_warn_d "${warnings_dir}" \
|
||||
'- package not in old state' \
|
||||
@ -2148,22 +2150,46 @@ function handle_one_package_change() {
|
||||
pkg_debug_disable
|
||||
return 0
|
||||
fi
|
||||
if [[ ${old_repo} != "${new_repo}" ]]; then
|
||||
# This is pretty much an arbitrary limitation and I don't
|
||||
# remember any more why we have it.
|
||||
pkg_warn_d "${warnings_dir}" \
|
||||
'- package has moved between repos? unsupported for now' \
|
||||
" - old package and repo: ${old_name} ${old_repo}" \
|
||||
" - new package and repo: ${new_name} ${new_repo}"
|
||||
pkg_debug_disable
|
||||
return 0
|
||||
fi
|
||||
if [[ ${new_repo} != 'portage-stable' ]]; then
|
||||
# coreos-overlay packages will need a separate handling
|
||||
pkg_debug 'not a portage-stable package'
|
||||
pkg_debug_disable
|
||||
return 0
|
||||
fi
|
||||
|
||||
local old_repo_path new_repo_path old_cache_path new_cache_path
|
||||
case ${old_repo} in
|
||||
'portage-stable')
|
||||
old_repo_path=${OLD_PORTAGE_STABLE}
|
||||
old_cache_path="${WORKDIR}/pkg-reports/old/portage-stable-cache"
|
||||
;;
|
||||
'coreos-overlay')
|
||||
old_repo_path=${OLD_COREOS_OVERLAY}
|
||||
old_cache_path="${WORKDIR}/pkg-reports/old/coreos-overlay-cache"
|
||||
;;
|
||||
*)
|
||||
pkg_warn_d "${warnings_dir}" \
|
||||
'- package coming from unknown repo' \
|
||||
' - which: old' \
|
||||
" - package: ${old_name}" \
|
||||
" - repo: ${old_repo}"
|
||||
pkg_debug_disable
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case ${new_repo} in
|
||||
'portage-stable')
|
||||
new_repo_path=${NEW_PORTAGE_STABLE}
|
||||
new_cache_path="${WORKDIR}/pkg-reports/new/portage-stable-cache"
|
||||
;;
|
||||
'coreos-overlay')
|
||||
new_repo_path=${NEW_COREOS_OVERLAY}
|
||||
new_cache_path="${WORKDIR}/pkg-reports/new/coreos-overlay-cache"
|
||||
;;
|
||||
*)
|
||||
pkg_warn_d "${warnings_dir}" \
|
||||
'- package coming from unknown repo' \
|
||||
' - which: new' \
|
||||
" - package: ${new_name}" \
|
||||
" - repo: ${new_repo}"
|
||||
pkg_debug_disable
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
local hopc_old_slots_set_var_name hopc_new_slots_set_var_name
|
||||
mvm_get "${pkg_slots_set_mvm_var_name}" "${old_name}" hopc_old_slots_set_var_name
|
||||
@ -2231,8 +2257,8 @@ function handle_one_package_change() {
|
||||
hopc_package_output_paths[POP_PKG_OUT_DIR_IDX]=${update_dir_non_slot}
|
||||
# POP_PKG_SLOT_OUT_DIR_IDX will be set in loops below
|
||||
|
||||
generate_non_ebuild_diffs "${update_dir_non_slot}" "${OLD_PORTAGE_STABLE}" "${NEW_PORTAGE_STABLE}" "${old_name}" "${new_name}"
|
||||
generate_full_diffs "${update_dir_non_slot}" "${OLD_PORTAGE_STABLE}" "${NEW_PORTAGE_STABLE}" "${old_name}" "${new_name}"
|
||||
generate_non_ebuild_diffs "${update_dir_non_slot}" "${old_repo_path}" "${new_repo_path}" "${old_name}" "${new_name}"
|
||||
generate_full_diffs "${update_dir_non_slot}" "${old_repo_path}" "${new_repo_path}" "${old_name}" "${new_name}"
|
||||
generate_package_mention_reports "${update_dir_non_slot}" "${NEW_STATE}" "${old_name}" "${new_name}"
|
||||
|
||||
local hopc_changed=''
|
||||
@ -2266,12 +2292,12 @@ function handle_one_package_change() {
|
||||
gentoo_ver_cmp_out "${new_version}" "${old_version}" hopc_cmp_result
|
||||
case ${hopc_cmp_result} in
|
||||
"${GV_GT}")
|
||||
handle_pkg_update hopc_package_output_paths "${pkg_to_tags_mvm_var_name}" "${diff_lib_filters_var_name}" "${old_name}" "${new_name}" "${old_version}" "${new_version}"
|
||||
handle_pkg_update hopc_package_output_paths "${pkg_to_tags_mvm_var_name}" "${diff_lib_filters_var_name}" "${old_repo_path}" "${new_repo_path}" "${old_cache_path}" "${new_cache_path}" "${old_name}" "${new_name}" "${old_version}" "${new_version}"
|
||||
hopc_changed=x
|
||||
;;
|
||||
"${GV_EQ}")
|
||||
hopc_slot_changed=
|
||||
handle_pkg_as_is hopc_package_output_paths "${pkg_to_tags_mvm_var_name}" "${diff_lib_filters_var_name}" "${old_name}" "${new_name}" "${old_version}" hopc_slot_changed
|
||||
handle_pkg_as_is hopc_package_output_paths "${pkg_to_tags_mvm_var_name}" "${diff_lib_filters_var_name}" "${old_repo_path}" "${new_repo_path}" "${old_cache_path}" "${new_cache_path}" "${old_name}" "${new_name}" "${old_version}" hopc_slot_changed
|
||||
if [[ -z ${hopc_slot_changed} ]]; then
|
||||
rm -rf "${update_dir}"
|
||||
else
|
||||
@ -2279,7 +2305,7 @@ function handle_one_package_change() {
|
||||
fi
|
||||
;;
|
||||
"${GV_LT}")
|
||||
handle_pkg_downgrade hopc_package_output_paths "${pkg_to_tags_mvm_var_name}" "${diff_lib_filters_var_name}" "${old_name}" "${new_name}" "${s}" "${s}" "${old_version}" "${new_version}"
|
||||
handle_pkg_downgrade hopc_package_output_paths "${pkg_to_tags_mvm_var_name}" "${diff_lib_filters_var_name}" "${old_repo_path}" "${new_repo_path}" "${old_cache_path}" "${new_cache_path}" "${old_name}" "${new_name}" "${s}" "${s}" "${old_version}" "${new_version}"
|
||||
hopc_changed=x
|
||||
;;
|
||||
esac
|
||||
@ -2313,12 +2339,12 @@ function handle_one_package_change() {
|
||||
gentoo_ver_cmp_out "${new_version}" "${old_version}" hopc_cmp_result
|
||||
case ${hopc_cmp_result} in
|
||||
"${GV_GT}")
|
||||
handle_pkg_update hopc_package_output_paths "${pkg_to_tags_mvm_var_name}" "${diff_lib_filters_var_name}" "${old_name}" "${new_name}" "${old_version}" "${new_version}"
|
||||
handle_pkg_update hopc_package_output_paths "${pkg_to_tags_mvm_var_name}" "${diff_lib_filters_var_name}" "${old_repo_path}" "${new_repo_path}" "${old_cache_path}" "${new_cache_path}" "${old_name}" "${new_name}" "${old_version}" "${new_version}"
|
||||
hopc_changed=x
|
||||
;;
|
||||
"${GV_EQ}")
|
||||
hopc_slot_changed=
|
||||
handle_pkg_as_is hopc_package_output_paths "${pkg_to_tags_mvm_var_name}" "${diff_lib_filters_var_name}" "${old_name}" "${new_name}" "${old_version}" hopc_slot_changed
|
||||
handle_pkg_as_is hopc_package_output_paths "${pkg_to_tags_mvm_var_name}" "${diff_lib_filters_var_name}" "${old_repo_path}" "${new_repo_path}" "${old_cache_path}" "${new_cache_path}" "${old_name}" "${new_name}" "${old_version}" hopc_slot_changed
|
||||
if [[ -z ${hopc_slot_changed} ]]; then
|
||||
rm -rf "${update_dir}"
|
||||
else
|
||||
@ -2326,7 +2352,7 @@ function handle_one_package_change() {
|
||||
fi
|
||||
;;
|
||||
"${GV_LT}")
|
||||
handle_pkg_downgrade hopc_package_output_paths "${pkg_to_tags_mvm_var_name}" "${diff_lib_filters_var_name}" "${old_name}" "${new_name}" "${hopc_old_s}" "${hopc_new_s}" "${old_version}" "${new_version}"
|
||||
handle_pkg_downgrade hopc_package_output_paths "${pkg_to_tags_mvm_var_name}" "${diff_lib_filters_var_name}" "${old_repo_path}" "${new_repo_path}" "${old_cache_path}" "${new_cache_path}" "${old_name}" "${new_name}" "${hopc_old_s}" "${hopc_new_s}" "${old_version}" "${new_version}"
|
||||
hopc_changed=x
|
||||
;;
|
||||
esac
|
||||
@ -2517,11 +2543,9 @@ function handle_package_changes() {
|
||||
|
||||
info "preparing for handling package changes"
|
||||
|
||||
# TODO: when we handle moving packages between repos, then there
|
||||
# should be two maps, for old and new state
|
||||
local -A hpc_package_sources_map
|
||||
hpc_package_sources_map=()
|
||||
read_package_sources hpc_package_sources_map
|
||||
local -A hpc_old_package_sources_map=() hpc_new_package_sources_map=()
|
||||
read_package_sources old hpc_old_package_sources_map
|
||||
read_package_sources new hpc_new_package_sources_map
|
||||
|
||||
local -a old_pkgs new_pkgs
|
||||
old_pkgs=()
|
||||
@ -2610,7 +2634,8 @@ function handle_package_changes() {
|
||||
hpc_bunch_of_maps[BOM_PKG_SLOTS_SET_MVM_IDX]=hpc_pkg_slots_set_mvm
|
||||
hpc_bunch_of_maps[BOM_OLD_PKG_SLOT_VERMINMAX_MAP_MVM_IDX]=hpc_old_pkg_slot_verminmax_map_mvm
|
||||
hpc_bunch_of_maps[BOM_NEW_PKG_SLOT_VERMINMAX_MAP_MVM_IDX]=hpc_new_pkg_slot_verminmax_map_mvm
|
||||
hpc_bunch_of_maps[BOM_PKG_SOURCES_MAP_IDX]=hpc_package_sources_map
|
||||
hpc_bunch_of_maps[BOM_OLD_PKG_SOURCES_MAP_IDX]=hpc_old_package_sources_map
|
||||
hpc_bunch_of_maps[BOM_NEW_PKG_SOURCES_MAP_IDX]=hpc_new_package_sources_map
|
||||
hpc_bunch_of_maps[BOM_DIFF_LIB_FILTERS_IDX]="${hpc_diff_lib_filters_name}"
|
||||
|
||||
# We will be spawning as many jobs below as there are available
|
||||
@ -2812,14 +2837,15 @@ function handle_pkg_update() {
|
||||
local -n package_output_paths_ref=${1}; shift
|
||||
local pkg_to_tags_mvm_var_name=${1}; shift
|
||||
local diff_lib_filters_var_name=${1}; shift
|
||||
local old_repo_path=${1}; shift
|
||||
local new_repo_path=${1}; shift
|
||||
local old_cache_path=${1}; shift
|
||||
local new_cache_path=${1}; shift
|
||||
local old_pkg=${1}; shift
|
||||
local new_pkg=${1}; shift
|
||||
local old=${1}; shift
|
||||
local new=${1}; shift
|
||||
|
||||
# shellcheck source=for-shellcheck/globals
|
||||
source "${WORKDIR}/globals"
|
||||
|
||||
local old_no_r=${old%-r+([0-9])}
|
||||
local new_no_r=${new%-r+([0-9])}
|
||||
|
||||
@ -2829,12 +2855,12 @@ function handle_pkg_update() {
|
||||
lines+=( "0:renamed from ${old_pkg}" )
|
||||
fi
|
||||
local out_dir=${package_output_paths_ref[POP_PKG_SLOT_OUT_DIR_IDX]}
|
||||
generate_ebuild_diff "${out_dir}" "${OLD_PORTAGE_STABLE}" "${NEW_PORTAGE_STABLE}" "${old_pkg}" "${new_pkg}" "${old}" "${new}"
|
||||
generate_ebuild_diff "${out_dir}" "${old_repo_path}" "${new_repo_path}" "${old_pkg}" "${new_pkg}" "${old}" "${new}"
|
||||
|
||||
local diff_report_name
|
||||
gen_varname diff_report_name
|
||||
diff_report_declare "${diff_report_name}"
|
||||
generate_cache_diff_report "${diff_report_name}" "${diff_lib_filters_var_name}" "${WORKDIR}/pkg-reports/old/portage-stable-cache" "${WORKDIR}/pkg-reports/new/portage-stable-cache" "${old_pkg}" "${new_pkg}" "${old}" "${new}"
|
||||
generate_cache_diff_report "${diff_report_name}" "${diff_lib_filters_var_name}" "${old_cache_path}" "${new_cache_path}" "${old_pkg}" "${new_pkg}" "${old}" "${new}"
|
||||
|
||||
local -n diff_report_ref=${diff_report_name}
|
||||
local -n diff_lines_ref=${diff_report_ref[${DR_LINES_IDX}]}
|
||||
@ -2887,14 +2913,15 @@ function handle_pkg_as_is() {
|
||||
local -n package_output_paths_ref=${1}; shift
|
||||
local pkg_to_tags_mvm_var_name=${1}; shift
|
||||
local diff_lib_filters_var_name=${1}; shift
|
||||
local old_repo_path=${1}; shift
|
||||
local new_repo_path=${1}; shift
|
||||
local old_cache_path=${1}; shift
|
||||
local new_cache_path=${1}; shift
|
||||
local old_pkg=${1}; shift
|
||||
local new_pkg=${1}; shift
|
||||
local v=${1}; shift
|
||||
local -n changed_ref=${1}; shift
|
||||
|
||||
# shellcheck source=for-shellcheck/globals
|
||||
source "${WORKDIR}/globals"
|
||||
|
||||
local pkg_name=${new_pkg#/}
|
||||
local -a lines=( "0:still at ${v}" )
|
||||
|
||||
@ -2905,14 +2932,14 @@ function handle_pkg_as_is() {
|
||||
fi
|
||||
|
||||
local out_dir=${package_output_paths_ref[POP_PKG_SLOT_OUT_DIR_IDX]}
|
||||
generate_ebuild_diff "${out_dir}" "${OLD_PORTAGE_STABLE}" "${NEW_PORTAGE_STABLE}" "${old_pkg}" "${new_pkg}" "${v}" "${v}"
|
||||
generate_ebuild_diff "${out_dir}" "${old_repo_path}" "${new_repo_path}" "${old_pkg}" "${new_pkg}" "${v}" "${v}"
|
||||
|
||||
local modified=''
|
||||
|
||||
local diff_report_name
|
||||
gen_varname diff_report_name
|
||||
diff_report_declare "${diff_report_name}"
|
||||
generate_cache_diff_report "${diff_report_name}" "${diff_lib_filters_var_name}" "${WORKDIR}/pkg-reports/old/portage-stable-cache" "${WORKDIR}/pkg-reports/new/portage-stable-cache" "${old_pkg}" "${new_pkg}" "${v}" "${v}"
|
||||
generate_cache_diff_report "${diff_report_name}" "${diff_lib_filters_var_name}" "${old_cache_path}" "${new_cache_path}" "${old_pkg}" "${new_pkg}" "${v}" "${v}"
|
||||
|
||||
local -n diff_report_ref=${diff_report_name}
|
||||
local -n diff_lines_ref=${diff_report_ref[${DR_LINES_IDX}]}
|
||||
@ -2966,14 +2993,15 @@ function handle_pkg_downgrade() {
|
||||
local -n package_output_paths_ref=${1}; shift
|
||||
local pkg_to_tags_mvm_var_name=${1}; shift
|
||||
local diff_lib_filters_var_name=${1}; shift
|
||||
local old_repo_path=${1}; shift
|
||||
local new_repo_path=${1}; shift
|
||||
local old_cache_path=${1}; shift
|
||||
local new_cache_path=${1}; shift
|
||||
local old_pkg=${1}; shift
|
||||
local new_pkg=${1}; shift
|
||||
local old=${1}; shift
|
||||
local new=${1}; shift
|
||||
|
||||
# shellcheck source=for-shellcheck/globals
|
||||
source "${WORKDIR}/globals"
|
||||
|
||||
local old_no_r=${old%-r+([0-9])}
|
||||
local new_no_r=${new%-r+([0-9])}
|
||||
|
||||
@ -2984,12 +3012,12 @@ function handle_pkg_downgrade() {
|
||||
fi
|
||||
|
||||
local out_dir=${package_output_paths_ref[POP_PKG_SLOT_OUT_DIR_IDX]}
|
||||
generate_ebuild_diff "${out_dir}" "${OLD_PORTAGE_STABLE}" "${NEW_PORTAGE_STABLE}" "${old_pkg}" "${new_pkg}" "${old}" "${new}"
|
||||
generate_ebuild_diff "${out_dir}" "${old_repo_path}" "${new_repo_path}" "${old_pkg}" "${new_pkg}" "${old}" "${new}"
|
||||
|
||||
local diff_report_name
|
||||
gen_varname diff_report_name
|
||||
diff_report_declare "${diff_report_name}"
|
||||
generate_cache_diff_report "${diff_report_name}" "${diff_lib_filters_var_name}" "${WORKDIR}/pkg-reports/old/portage-stable-cache" "${WORKDIR}/pkg-reports/new/portage-stable-cache" "${old_pkg}" "${new_pkg}" "${old}" "${new}"
|
||||
generate_cache_diff_report "${diff_report_name}" "${diff_lib_filters_var_name}" "${old_cache_path}" "${new_cache_path}" "${old_pkg}" "${new_pkg}" "${old}" "${new}"
|
||||
|
||||
local -n diff_report_ref=${diff_report_name}
|
||||
local -n diff_lines_ref=${diff_report_ref[${DR_LINES_IDX}]}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user