mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-13 16:06:59 +02:00
pkg-auto: Add md5-metadata cache diff reports to package reports
This commit is contained in:
parent
016f35d8f5
commit
13e84333b8
@ -53,6 +53,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/util.sh"
|
|||||||
source "${PKG_AUTO_IMPL_DIR}/cleanups.sh"
|
source "${PKG_AUTO_IMPL_DIR}/cleanups.sh"
|
||||||
source "${PKG_AUTO_IMPL_DIR}/debug.sh"
|
source "${PKG_AUTO_IMPL_DIR}/debug.sh"
|
||||||
source "${PKG_AUTO_IMPL_DIR}/gentoo_ver.sh"
|
source "${PKG_AUTO_IMPL_DIR}/gentoo_ver.sh"
|
||||||
|
source "${PKG_AUTO_IMPL_DIR}/md5_cache_diff_lib.sh"
|
||||||
|
|
||||||
# Sets up the workdir using the passed config. The config can be
|
# Sets up the workdir using the passed config. The config can be
|
||||||
# created basing on the config_template file or using the
|
# created basing on the config_template file or using the
|
||||||
@ -2185,9 +2186,9 @@ function handle_pkg_update() {
|
|||||||
local pkg_name
|
local pkg_name
|
||||||
pkg_name=${new_pkg#*/}
|
pkg_name=${new_pkg#*/}
|
||||||
local -a lines
|
local -a lines
|
||||||
lines=( "from ${old} to ${new}")
|
lines=( "0:from ${old} to ${new}")
|
||||||
if [[ ${old_pkg} != "${new_pkg}" ]]; then
|
if [[ ${old_pkg} != "${new_pkg}" ]]; then
|
||||||
lines+=( "renamed from ${old_pkg}" )
|
lines+=( "0:renamed from ${old_pkg}" )
|
||||||
fi
|
fi
|
||||||
# shellcheck disable=SC2153 # OLD_PORTAGE_STABLE is not a misspelling, it comes from globals file
|
# shellcheck disable=SC2153 # OLD_PORTAGE_STABLE is not a misspelling, it comes from globals file
|
||||||
generate_ebuild_diff "${OLD_PORTAGE_STABLE}" "${NEW_PORTAGE_STABLE}" "${old_pkg}" "${new_pkg}" "${old_s}" "${new_s}" "${old}" "${new}"
|
generate_ebuild_diff "${OLD_PORTAGE_STABLE}" "${NEW_PORTAGE_STABLE}" "${old_pkg}" "${new_pkg}" "${old_s}" "${new_s}" "${old}" "${new}"
|
||||||
@ -2196,15 +2197,28 @@ function handle_pkg_update() {
|
|||||||
local hpu_update_dir hpu_update_dir_non_slot
|
local hpu_update_dir hpu_update_dir_non_slot
|
||||||
update_dir_non_slot "${new_pkg}" hpu_update_dir_non_slot
|
update_dir_non_slot "${new_pkg}" hpu_update_dir_non_slot
|
||||||
update_dir "${new_pkg}" "${old_s}" "${new_s}" hpu_update_dir
|
update_dir "${new_pkg}" "${old_s}" "${new_s}" hpu_update_dir
|
||||||
|
|
||||||
|
local diff_report_name
|
||||||
|
gen_varname diff_report_name
|
||||||
|
diff_report_declare "${diff_report_name}"
|
||||||
|
generate_cache_diff_report "${diff_report_name}" "${WORKDIR}/pkg-reports/old/portage-stable-cache" "${WORKDIR}/pkg-reports/new/portage-stable-cache" "${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}]}
|
||||||
|
lines+=( "${diff_lines_ref[@]}" )
|
||||||
|
unset -n diff_lines_ref
|
||||||
|
unset -n diff_report_ref
|
||||||
|
diff_report_unset "${diff_report_name}"
|
||||||
|
|
||||||
if [[ -s "${hpu_update_dir}/ebuild.diff" ]]; then
|
if [[ -s "${hpu_update_dir}/ebuild.diff" ]]; then
|
||||||
lines+=( 'TODO: review ebuild.diff' )
|
lines+=( '0:TODO: review ebuild.diff' )
|
||||||
fi
|
fi
|
||||||
if [[ -s "${hpu_update_dir_non_slot}/other.diff" ]]; then
|
if [[ -s "${hpu_update_dir_non_slot}/other.diff" ]]; then
|
||||||
lines+=( 'TODO: review other.diff' )
|
lines+=( '0:TODO: review other.diff' )
|
||||||
fi
|
fi
|
||||||
lines+=( 'TODO: review occurences' )
|
lines+=( '0:TODO: review occurences' )
|
||||||
if [[ ${old_pkg} != "${new_pkg}" ]]; then
|
if [[ ${old_pkg} != "${new_pkg}" ]]; then
|
||||||
lines+=( 'TODO: review occurences-for-old-name' )
|
lines+=( '0:TODO: review occurences-for-old-name' )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local -a hpu_tags
|
local -a hpu_tags
|
||||||
@ -2213,7 +2227,7 @@ function handle_pkg_update() {
|
|||||||
if ver_test "${new_no_r}" -gt "${old_no_r}"; then
|
if ver_test "${new_no_r}" -gt "${old_no_r}"; then
|
||||||
# version bump
|
# version bump
|
||||||
generate_changelog_entry_stub "${pkg_name}" "${new_no_r}" "${hpu_tags[@]}"
|
generate_changelog_entry_stub "${pkg_name}" "${new_no_r}" "${hpu_tags[@]}"
|
||||||
lines+=( 'release notes: TODO' )
|
lines+=( '0:release notes: TODO' )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
generate_summary_stub "${new_pkg}" "${hpu_tags[@]}" -- "${lines[@]}"
|
generate_summary_stub "${new_pkg}" "${hpu_tags[@]}" -- "${lines[@]}"
|
||||||
@ -2253,12 +2267,12 @@ function handle_pkg_as_is() {
|
|||||||
local pkg_name
|
local pkg_name
|
||||||
pkg_name=${new_pkg#/}
|
pkg_name=${new_pkg#/}
|
||||||
local -a lines
|
local -a lines
|
||||||
lines=( "still at ${v}" )
|
lines=( "0:still at ${v}" )
|
||||||
|
|
||||||
local renamed
|
local renamed
|
||||||
renamed=
|
renamed=
|
||||||
if [[ ${old_pkg} != "${new_pkg}" ]]; then
|
if [[ ${old_pkg} != "${new_pkg}" ]]; then
|
||||||
lines+=( "renamed from ${old_pkg}" )
|
lines+=( "0:renamed from ${old_pkg}" )
|
||||||
renamed=x
|
renamed=x
|
||||||
fi
|
fi
|
||||||
generate_ebuild_diff "${OLD_PORTAGE_STABLE}" "${NEW_PORTAGE_STABLE}" "${old_pkg}" "${new_pkg}" "${old_s}" "${new_s}" "${v}" "${v}"
|
generate_ebuild_diff "${OLD_PORTAGE_STABLE}" "${NEW_PORTAGE_STABLE}" "${old_pkg}" "${new_pkg}" "${old_s}" "${new_s}" "${v}" "${v}"
|
||||||
@ -2267,12 +2281,28 @@ function handle_pkg_as_is() {
|
|||||||
update_dir "${new_pkg}" "${old_s}" "${new_s}" hpai_update_dir
|
update_dir "${new_pkg}" "${old_s}" "${new_s}" hpai_update_dir
|
||||||
local modified
|
local modified
|
||||||
modified=
|
modified=
|
||||||
|
|
||||||
|
local diff_report_name
|
||||||
|
gen_varname diff_report_name
|
||||||
|
diff_report_declare "${diff_report_name}"
|
||||||
|
generate_cache_diff_report "${diff_report_name}" "${WORKDIR}/pkg-reports/old/portage-stable-cache" "${WORKDIR}/pkg-reports/new/portage-stable-cache" "${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}]}
|
||||||
|
if [[ ${#diff_lines_ref[@]} -gt 0 ]]; then
|
||||||
|
lines+=( "${diff_lines_ref[@]}" )
|
||||||
|
modified=x
|
||||||
|
fi
|
||||||
|
unset -n diff_lines_ref
|
||||||
|
unset -n diff_report_ref
|
||||||
|
diff_report_unset "${diff_report_name}"
|
||||||
|
|
||||||
if [[ -s "${hpai_update_dir}/ebuild.diff" ]]; then
|
if [[ -s "${hpai_update_dir}/ebuild.diff" ]]; then
|
||||||
lines+=( 'TODO: review ebuild.diff' )
|
lines+=( '0:TODO: review ebuild.diff' )
|
||||||
modified=x
|
modified=x
|
||||||
fi
|
fi
|
||||||
if [[ -s "${hpai_update_dir_non_slot}/other.diff" ]]; then
|
if [[ -s "${hpai_update_dir_non_slot}/other.diff" ]]; then
|
||||||
lines+=( 'TODO: review other.diff' )
|
lines+=( '0:TODO: review other.diff' )
|
||||||
modified=x
|
modified=x
|
||||||
fi
|
fi
|
||||||
if [[ -z ${renamed} ]] && [[ -z ${modified} ]]; then
|
if [[ -z ${renamed} ]] && [[ -z ${modified} ]]; then
|
||||||
@ -2281,9 +2311,9 @@ function handle_pkg_as_is() {
|
|||||||
fi
|
fi
|
||||||
# shellcheck disable=SC2034 # ref to an external variable
|
# shellcheck disable=SC2034 # ref to an external variable
|
||||||
changed_ref=x
|
changed_ref=x
|
||||||
lines+=( 'TODO: review occurences' )
|
lines+=( '0:TODO: review occurences' )
|
||||||
if [[ ${old_pkg} != "${new_pkg}" ]]; then
|
if [[ ${old_pkg} != "${new_pkg}" ]]; then
|
||||||
lines+=( 'TODO: review occurences-for-old-name' )
|
lines+=( '0:TODO: review occurences-for-old-name' )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local -a hpai_tags
|
local -a hpai_tags
|
||||||
@ -2324,24 +2354,37 @@ function handle_pkg_downgrade() {
|
|||||||
local pkg_name
|
local pkg_name
|
||||||
pkg_name=${new_pkg#*/}
|
pkg_name=${new_pkg#*/}
|
||||||
local -a lines
|
local -a lines
|
||||||
lines=( "downgraded from ${old} to ${new}" )
|
lines=( "0:downgraded from ${old} to ${new}" )
|
||||||
if [[ ${old_pkg} != "${new_pkg}" ]]; then
|
if [[ ${old_pkg} != "${new_pkg}" ]]; then
|
||||||
lines+=( "renamed from ${old_pkg}" )
|
lines+=( "0:renamed from ${old_pkg}" )
|
||||||
fi
|
fi
|
||||||
generate_ebuild_diff "${OLD_PORTAGE_STABLE}" "${NEW_PORTAGE_STABLE}" "${old_pkg}" "${new_pkg}" "${old_s}" "${new_s}" "${old}" "${new}"
|
generate_ebuild_diff "${OLD_PORTAGE_STABLE}" "${NEW_PORTAGE_STABLE}" "${old_pkg}" "${new_pkg}" "${old_s}" "${new_s}" "${old}" "${new}"
|
||||||
|
|
||||||
local hpd_update_dir hpd_update_dir_non_slot
|
local hpd_update_dir hpd_update_dir_non_slot
|
||||||
update_dir_non_slot "${new_pkg}" hpd_update_dir_non_slot
|
update_dir_non_slot "${new_pkg}" hpd_update_dir_non_slot
|
||||||
update_dir "${new_pkg}" "${old_s}" "${new_s}" hpd_update_dir
|
update_dir "${new_pkg}" "${old_s}" "${new_s}" hpd_update_dir
|
||||||
|
|
||||||
|
local diff_report_name
|
||||||
|
gen_varname diff_report_name
|
||||||
|
diff_report_declare "${diff_report_name}"
|
||||||
|
generate_cache_diff_report "${diff_report_name}" "${WORKDIR}/pkg-reports/old/portage-stable-cache" "${WORKDIR}/pkg-reports/new/portage-stable-cache" "${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}]}
|
||||||
|
lines+=( "${diff_lines_ref[@]}" )
|
||||||
|
unset -n diff_lines_ref
|
||||||
|
unset -n diff_report_ref
|
||||||
|
diff_report_unset "${diff_report_name}"
|
||||||
|
|
||||||
if [[ -s "${hpd_update_dir}/ebuild.diff" ]]; then
|
if [[ -s "${hpd_update_dir}/ebuild.diff" ]]; then
|
||||||
lines+=( 'TODO: review ebuild.diff' )
|
lines+=( '0:TODO: review ebuild.diff' )
|
||||||
fi
|
fi
|
||||||
if [[ -s "${hpd_update_dir_non_slot}/other.diff" ]]; then
|
if [[ -s "${hpd_update_dir_non_slot}/other.diff" ]]; then
|
||||||
lines+=( 'TODO: review other.diff' )
|
lines+=( '0:TODO: review other.diff' )
|
||||||
fi
|
fi
|
||||||
lines+=( 'TODO: review occurences' )
|
lines+=( '0:TODO: review occurences' )
|
||||||
if [[ ${old_pkg} != "${new_pkg}" ]]; then
|
if [[ ${old_pkg} != "${new_pkg}" ]]; then
|
||||||
lines+=( 'TODO: review occurences-for-old-name' )
|
lines+=( '0:TODO: review occurences-for-old-name' )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local -a hpd_tags
|
local -a hpd_tags
|
||||||
@ -2350,7 +2393,7 @@ function handle_pkg_downgrade() {
|
|||||||
if ver_test "${new_no_r}" -lt "${old_no_r}"; then
|
if ver_test "${new_no_r}" -lt "${old_no_r}"; then
|
||||||
# version bump
|
# version bump
|
||||||
generate_changelog_entry_stub "${pkg_name}" "${new_no_r}" "${hpd_tags[@]}"
|
generate_changelog_entry_stub "${pkg_name}" "${new_no_r}" "${hpd_tags[@]}"
|
||||||
lines+=( "release notes: TODO" )
|
lines+=( "0:release notes: TODO" )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
generate_summary_stub "${new_pkg}" "${hpd_tags[@]}" -- "${lines[@]}"
|
generate_summary_stub "${new_pkg}" "${hpd_tags[@]}" -- "${lines[@]}"
|
||||||
@ -2456,10 +2499,16 @@ function generate_summary_stub() {
|
|||||||
printf ' [%s]' "${tags[@]}"
|
printf ' [%s]' "${tags[@]}"
|
||||||
fi
|
fi
|
||||||
printf '\n'
|
printf '\n'
|
||||||
if [[ ${#} -gt 0 ]]; then
|
local indent_line indent line
|
||||||
printf ' - %s\n' "${@}"
|
for indent_line; do
|
||||||
printf '\n'
|
indent=${indent_line%%:*}
|
||||||
fi
|
line=${indent_line#*:}
|
||||||
|
if [[ ${indent} -gt 0 ]]; then
|
||||||
|
printf -- ' %.0s' $(seq 1 "${indent}")
|
||||||
|
fi
|
||||||
|
printf ' - %s\n' "${line}"
|
||||||
|
done
|
||||||
|
printf '\n'
|
||||||
} >>"${REPORTS_DIR}/updates/summary_stubs"
|
} >>"${REPORTS_DIR}/updates/summary_stubs"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2565,6 +2614,32 @@ function generate_ebuild_diff() {
|
|||||||
xdiff --unified=3 "${old_path}" "${new_path}" >"${ged_update_dir}/ebuild.diff"
|
xdiff --unified=3 "${old_path}" "${new_path}" >"${ged_update_dir}/ebuild.diff"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generate_cache_diff_report() {
|
||||||
|
local diff_report_var_name=${1}; shift
|
||||||
|
local old_cache_dir=${1}; shift
|
||||||
|
local new_cache_dir=${1}; shift
|
||||||
|
local old_pkg=${1}; shift
|
||||||
|
local new_pkg=${1}; shift
|
||||||
|
local old=${1}; shift
|
||||||
|
local new=${1}; shift
|
||||||
|
|
||||||
|
source "${WORKDIR}/globals"
|
||||||
|
|
||||||
|
local old_entry=${old_cache_dir}/${old_pkg}-${old}
|
||||||
|
local new_entry=${new_cache_dir}/${new_pkg}-${new}
|
||||||
|
|
||||||
|
local old_cache_name new_cache_name
|
||||||
|
gen_varname old_cache_name
|
||||||
|
gen_varname new_cache_name
|
||||||
|
cache_file_declare "${old_cache_name}" "${new_cache_name}"
|
||||||
|
parse_cache_file "${old_cache_name}" "${old_entry}" "${ARCHES[@]}"
|
||||||
|
parse_cache_file "${new_cache_name}" "${new_entry}" "${ARCHES[@]}"
|
||||||
|
|
||||||
|
diff_cache_data "${old_cache_name}" "${new_cache_name}" "${diff_report_var_name}"
|
||||||
|
|
||||||
|
cache_file_unset "${old_cache_name}" "${new_cache_name}"
|
||||||
|
}
|
||||||
|
|
||||||
# Generate a report with information where the old and new packages
|
# Generate a report with information where the old and new packages
|
||||||
# are mentioned in entire scripts repository. May result in two
|
# are mentioned in entire scripts repository. May result in two
|
||||||
# separate reports if the package got renamed.
|
# separate reports if the package got renamed.
|
||||||
@ -2936,11 +3011,11 @@ function handle_eclass() {
|
|||||||
if [[ -e "${OLD_PORTAGE_STABLE}/${eclass}" ]] && [[ -e "${NEW_PORTAGE_STABLE}/${eclass}" ]]; then
|
if [[ -e "${OLD_PORTAGE_STABLE}/${eclass}" ]] && [[ -e "${NEW_PORTAGE_STABLE}/${eclass}" ]]; then
|
||||||
mkdir -p "${REPORTS_DIR}/updates/${eclass}"
|
mkdir -p "${REPORTS_DIR}/updates/${eclass}"
|
||||||
xdiff --unified=3 "${OLD_PORTAGE_STABLE}/${eclass}" "${NEW_PORTAGE_STABLE}/${eclass}" >"${REPORTS_DIR}/updates/${eclass}/eclass.diff"
|
xdiff --unified=3 "${OLD_PORTAGE_STABLE}/${eclass}" "${NEW_PORTAGE_STABLE}/${eclass}" >"${REPORTS_DIR}/updates/${eclass}/eclass.diff"
|
||||||
lines+=( 'TODO: review the diff' )
|
lines+=( '0:TODO: review the diff' )
|
||||||
elif [[ -e "${OLD_PORTAGE_STABLE}/${eclass}" ]]; then
|
elif [[ -e "${OLD_PORTAGE_STABLE}/${eclass}" ]]; then
|
||||||
lines+=( 'unused, dropped' )
|
lines+=( '0:unused, dropped' )
|
||||||
else
|
else
|
||||||
lines+=( 'added from Gentoo' )
|
lines+=( '0:added from Gentoo' )
|
||||||
fi
|
fi
|
||||||
generate_summary_stub "${eclass}" -- "${lines[@]}"
|
generate_summary_stub "${eclass}" -- "${lines[@]}"
|
||||||
}
|
}
|
||||||
@ -3014,7 +3089,7 @@ function handle_profiles() {
|
|||||||
done <"${out_dir}/full.diff"
|
done <"${out_dir}/full.diff"
|
||||||
lines_to_file_truncate "${out_dir}/relevant.diff" "${relevant_lines[@]}"
|
lines_to_file_truncate "${out_dir}/relevant.diff" "${relevant_lines[@]}"
|
||||||
lines_to_file_truncate "${out_dir}/possibly-irrelevant-files" "${possibly_irrelevant_files[@]}"
|
lines_to_file_truncate "${out_dir}/possibly-irrelevant-files" "${possibly_irrelevant_files[@]}"
|
||||||
generate_summary_stub profiles -- 'TODO: review the diffs'
|
generate_summary_stub profiles -- '0:TODO: review the diffs'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Handles changes in license directory. Generates brief reports and
|
# Handles changes in license directory. Generates brief reports and
|
||||||
@ -3083,15 +3158,15 @@ function handle_licenses() {
|
|||||||
local joined
|
local joined
|
||||||
if [[ ${#dropped[@]} -gt 0 ]]; then
|
if [[ ${#dropped[@]} -gt 0 ]]; then
|
||||||
join_by joined ', ' "${dropped[@]}"
|
join_by joined ', ' "${dropped[@]}"
|
||||||
lines+=( "dropped ${joined}" )
|
lines+=( "0:dropped ${joined}" )
|
||||||
fi
|
fi
|
||||||
if [[ ${#added[@]} -gt 0 ]]; then
|
if [[ ${#added[@]} -gt 0 ]]; then
|
||||||
join_by joined ', ' "${added[@]}"
|
join_by joined ', ' "${added[@]}"
|
||||||
lines+=( "added ${joined}" )
|
lines+=( "0:added ${joined}" )
|
||||||
fi
|
fi
|
||||||
if [[ ${#changed[@]} -gt 0 ]]; then
|
if [[ ${#changed[@]} -gt 0 ]]; then
|
||||||
join_by joined ', ' "${changed[@]}"
|
join_by joined ', ' "${changed[@]}"
|
||||||
lines+=( "updated ${joined}" )
|
lines+=( "0:updated ${joined}" )
|
||||||
fi
|
fi
|
||||||
generate_summary_stub licenses -- "${lines[@]}"
|
generate_summary_stub licenses -- "${lines[@]}"
|
||||||
}
|
}
|
||||||
@ -3106,7 +3181,7 @@ function handle_scripts() {
|
|||||||
mkdir -p "${out_dir}"
|
mkdir -p "${out_dir}"
|
||||||
|
|
||||||
xdiff --unified=3 --recursive "${OLD_PORTAGE_STABLE}/scripts" "${NEW_PORTAGE_STABLE}/scripts" >"${out_dir}/scripts.diff"
|
xdiff --unified=3 --recursive "${OLD_PORTAGE_STABLE}/scripts" "${NEW_PORTAGE_STABLE}/scripts" >"${out_dir}/scripts.diff"
|
||||||
generate_summary_stub scripts -- 'TODO: review the diffs'
|
generate_summary_stub scripts -- '0:TODO: review the diffs'
|
||||||
}
|
}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user