mirror of https://github.com/armbian/build.git
store dict of artifacts actually installed in image; use it to freeze (`BSPFREEZE=yes`) and check hashes without spurious errors
- eg: `linux-headers` might, or might not, be installed; same with bsp-cli transitional - accidentally fixes [AR-1802]
This commit is contained in:
parent
622ef30f3c
commit
df34679533
|
|
@ -96,6 +96,8 @@ function main_default_build_packages() {
|
|||
declare -g -A image_artifacts_packages_version_reversioned=()
|
||||
declare -g -A image_artifacts_debs=()
|
||||
declare -g -A image_artifacts_debs_reversioned=()
|
||||
declare -A -g image_artifacts_debs_installed=()
|
||||
|
||||
declare one_artifact one_artifact_package
|
||||
for one_artifact in "${artifacts_to_build[@]}"; do
|
||||
declare -A artifact_map_packages=()
|
||||
|
|
@ -113,12 +115,14 @@ function main_default_build_packages() {
|
|||
image_artifacts_debs_reversioned["${one_artifact_package}"]="${artifact_map_debs_reversioned[${one_artifact_package}]}"
|
||||
image_artifacts_packages_version["${artifact_map_packages[${one_artifact_package}]}"]="${artifact_version}"
|
||||
image_artifacts_packages_version_reversioned["${artifact_map_packages[${one_artifact_package}]}"]="${artifact_final_version_reversioned}"
|
||||
image_artifacts_debs_installed["${one_artifact_package}"]="no" # initialize, install_artifact_deb_chroot() will set to "yes" when installed.
|
||||
done
|
||||
done
|
||||
|
||||
debug_dict image_artifacts_packages
|
||||
debug_dict image_artifacts_debs
|
||||
debug_dict image_artifacts_packages_version
|
||||
debug_dict image_artifacts_debs_installed
|
||||
|
||||
overlayfs_wrapper "cleanup"
|
||||
reset_uid_owner "${DEB_STORAGE}"
|
||||
|
|
|
|||
|
|
@ -100,15 +100,24 @@ function list_installed_packages() {
|
|||
# This is a sanity check, to make sure that the packages we installed are the ones we expected to install.
|
||||
# Things that might disrupt this: apt repos containing random versions that are then apt upgraded, forced install, crazy customize, wrong pinning, etc.
|
||||
declare -g -A image_artifacts_packages_version # global scope, set in main_default_build_packages()
|
||||
declare pkg_name pkg_wanted_version
|
||||
for pkg_name in "${!image_artifacts_packages_version[@]}"; do
|
||||
[[ "${pkg_name}" =~ ^linux-headers ]] && continue # linux-headers is a special case, since its always built with kernel, but not always installed (deb-tar)
|
||||
declare -g -A image_artifacts_debs_installed # global scope, set in main_default_build_packages()
|
||||
declare -g -A image_artifacts_packages # global scope, set in main_default_build_packages()
|
||||
|
||||
declare artifact_deb_id pkg_name pkg_wanted_version
|
||||
for artifact_deb_id in "${!image_artifacts_debs_installed[@]}"; do
|
||||
declare deb_is_installed_in_image="${image_artifacts_debs_installed["${artifact_deb_id}"]}"
|
||||
if [[ "${deb_is_installed_in_image}" != "yes" ]]; then
|
||||
continue # skip packages that are not actually installed (eg: kernel-headers, transitional bsp-cli, etc)
|
||||
fi
|
||||
pkg_name="${image_artifacts_packages["${artifact_deb_id}"]}"
|
||||
pkg_wanted_version="${image_artifacts_packages_version[${pkg_name}]}" # this is the hash-version
|
||||
display_alert "Checking installed version of package" "${pkg_name}=${pkg_wanted_version}" "debug"
|
||||
declare actual_version
|
||||
actual_version=$(chroot "${SDCARD}" dpkg-query -W -f='${Status} ${Package} ${Armbian-Original-Hash}\n' "${pkg_name}" | grep "install ok installed" | cut -d " " -f 5)
|
||||
actual_version=$(chroot "${SDCARD}" dpkg-query -W -f='${Status} ${Package} ${Armbian-Original-Hash}\n' "${pkg_name}" | grep " ok installed" | cut -d " " -f 5)
|
||||
if [[ "${actual_version}" != "${pkg_wanted_version}" ]]; then
|
||||
display_alert "Installed hash of package does not match wanted hash. Check for inconsistent repo, customize.sh/hooks, extensions, or upgrades installing wrong version" "${pkg_name} :: actual:'${actual_version}' wanted:'${pkg_wanted_version}'" "warn"
|
||||
declare dpkg_status
|
||||
dpkg_status=$(chroot "${SDCARD}" dpkg-query -W -f='${Status} ${Package} ${Armbian-Original-Hash}\n' "${pkg_name}" || true)
|
||||
display_alert "Installed hash of package does not match wanted hash. Check for inconsistent repo, customize.sh/hooks, extensions, or upgrades installing wrong version" "${pkg_name} :: actual:'${actual_version}' wanted:'${pkg_wanted_version}'; status: '${dpkg_status}'" "warn"
|
||||
else
|
||||
display_alert "Image installed package hash" "✅ ${pkg_name} = ${actual_version}" "info"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -119,4 +119,9 @@ function install_artifact_deb_chroot() {
|
|||
fi
|
||||
display_alert "Installing artifact deb" "${deb_name} :: ${revisioned_deb_rel_path}" "debug"
|
||||
install_deb_chroot "${DEB_STORAGE}/${revisioned_deb_rel_path}"
|
||||
|
||||
# Mark the deb as installed in the global associative array.
|
||||
declare -A -g image_artifacts_debs_installed
|
||||
image_artifacts_debs_installed["${deb_name}"]="yes"
|
||||
debug_dict image_artifacts_debs_installed
|
||||
}
|
||||
|
|
|
|||
|
|
@ -354,12 +354,19 @@ function install_distribution_agnostic() {
|
|||
# freeze armbian packages
|
||||
if [[ "${BSPFREEZE:-"no"}" == yes ]]; then
|
||||
display_alert "Freezing Armbian packages" "$BOARD" "info"
|
||||
chroot_sdcard apt-mark hold "${image_artifacts_packages["armbian-plymouth-theme"]}" "${image_artifacts_packages["armbian-zsh"]}" \
|
||||
"${image_artifacts_packages["armbian-config"]}" "${image_artifacts_packages["armbian-bsp-desktop"]}" \
|
||||
"${image_artifacts_packages["armbian-desktop"]}" "${image_artifacts_packages["armbian-bsp-cli"]}" \
|
||||
"${image_artifacts_packages["armbian-firmware"]}" "${image_artifacts_packages["armbian-firmware-full"]}" \
|
||||
"${image_artifacts_packages["linux-headers"]}" "${image_artifacts_packages["linux-dtb"]}" \
|
||||
"${image_artifacts_packages["linux-image"]}" "${image_artifacts_packages["uboot"]}" || true
|
||||
declare -g -A image_artifacts_debs_installed # global scope, set in main_default_build_packages()
|
||||
declare -g -A image_artifacts_packages # global scope, set in main_default_build_packages()
|
||||
declare -a package_names_to_hold=()
|
||||
declare artifact_deb_id pkg_name pkg_wanted_version
|
||||
for artifact_deb_id in "${!image_artifacts_debs_installed[@]}"; do
|
||||
declare deb_is_installed_in_image="${image_artifacts_debs_installed["${artifact_deb_id}"]}"
|
||||
if [[ "${deb_is_installed_in_image}" != "yes" ]]; then
|
||||
continue
|
||||
fi
|
||||
pkg_name="${image_artifacts_packages["${artifact_deb_id}"]}"
|
||||
package_names_to_hold+=("${pkg_name}")
|
||||
done
|
||||
chroot_sdcard apt-mark hold "${package_names_to_hold[@]}"
|
||||
fi
|
||||
|
||||
# remove deb files
|
||||
|
|
|
|||
Loading…
Reference in New Issue