From b54bdd7fb18d32178094e8c4e1493b6121044c11 Mon Sep 17 00:00:00 2001 From: Lyndon Brown Date: Thu, 13 Feb 2020 04:43:46 +0000 Subject: installer: filter derived udebs from parent list the existing logic just bundled the entire parent and derived udeb lists together, ignoring the fact that there might thus be two instances of some packages, and relying upon getting derived ones first and checking file existence to avoid handling the overridden parent instances. here we now actually filter the list of parent udebs to exclude packages that are to be obtained from the derivative. this enables avoiding the file existence checking Partial fix for #952914 Gbp-Dch: Short --- scripts/build/installer_debian-installer | 52 +++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 18 deletions(-) (limited to 'scripts') diff --git a/scripts/build/installer_debian-installer b/scripts/build/installer_debian-installer index e3e79ec81..91a2b0603 100755 --- a/scripts/build/installer_debian-installer +++ b/scripts/build/installer_debian-installer @@ -528,13 +528,35 @@ then gunzip -c Packages.derivative.gz > Packages.derivative fi - # Put derived first to prefer them + UDEBS="$(awk '/Filename: / { print $2 }' Packages)" + if [ "${LB_DERIVATIVE}" = "true" ] then - UDEBS="$(awk '/Filename: / { print $2 }' Packages.derivative)" - fi + _UDEBS_DERIVED="$(awk '/Filename: / { print $2 }' Packages.derivative)" + + # Filter parent packages to exclude those replaced by derivative + # We need to compare package names from lists of paths and filenames that include versions + _UDEBS_FILTERED="" + _UDEBS_DERIVED_NAMES="" + for _UDEB in ${_UDEBS_DERIVED} + do + _UDEBS_DERIVED_NAMES="${_UDEBS_DERIVED_NAMES} $(basename ${_UDEB} | awk -F_ '{ print $1 }')" + done + for _UDEB in ${UDEBS} + do + if ! In_list "$(basename ${_UDEB} | awk -F_ '{ print $1 }')" "${_UDEBS_DERIVED_NAMES}" + then + _UDEBS_FILTERED="${_UDEBS_FILTERED} ${_UDEB}" + fi + done + _UDEBS_DERIVED_NAMES="" - UDEBS="${UDEBS} $(awk '/Filename: / { print $2 }' Packages)" + # Combine into one list + UDEBS="${_UDEBS_FILTERED} ${_UDEBS_DERIVED}" + + _UDEBS_DERIVED="" + _UDEBS_FILTERED="" + fi # Downloading udeb packages Echo_message "Downloading udebs..." @@ -547,16 +569,12 @@ then for UDEB in ${UDEBS} do _UDEB_FILENAME="$(basename ${UDEB})" - # Skip if already got (any version), i.e. should parent and derive both list it - if ! ls "$(${_UDEB_FILENAME} | awk -F_ '{ print $1 }')"_* > /dev/null 2>&1 + # Copy from cache if available, otherwise download + if [ -f ../cache/packages.installer_debian-installer.udeb/"${_UDEB_FILENAME}" ] then - # Copy from cache if available, otherwise download - if [ -f ../cache/packages.installer_debian-installer.udeb/"${_UDEB_FILENAME}" ] - then - cp ../cache/packages.installer_debian-installer.udeb/"${_UDEB_FILENAME}" ./ - else - wget ${WGET_OPTIONS} "${LB_MIRROR_CHROOT}"/${UDEB} || wget ${WGET_OPTIONS} "${LB_PARENT_MIRROR_CHROOT}"/${UDEB} - fi + cp ../cache/packages.installer_debian-installer.udeb/"${_UDEB_FILENAME}" ./ + else + wget ${WGET_OPTIONS} "${LB_MIRROR_CHROOT}/${UDEB}" || wget ${WGET_OPTIONS} "${LB_PARENT_MIRROR_CHROOT}/${UDEB}" fi done @@ -630,11 +648,9 @@ then # Sort udebs into alphabetised pool structure for UDEB in ${UDEBS} do - if [ -f "$(basename ${UDEB})" ] - then - Install_file "$(basename ${UDEB})" "pool-udeb" - rm "$(basename ${UDEB})" - fi + _UDEB_FILENAME="$(basename ${UDEB})" + Install_file "${_UDEB_FILENAME}" "pool-udeb" + rm "${_UDEB_FILENAME}" done # Creating udeb indices -- cgit v1.2.3