diff options
author | Lyndon Brown <jnqnfe@gmail.com> | 2020-02-13 04:43:46 +0000 |
---|---|---|
committer | Lyndon Brown <jnqnfe@gmail.com> | 2020-03-05 21:34:38 +0000 |
commit | b54bdd7fb18d32178094e8c4e1493b6121044c11 (patch) | |
tree | 48edea9fb010dffcef7617a3483ed1cc884bcc59 | |
parent | 2e3f195c3888c8fc6bfab64f5efaad5e54302328 (diff) | |
download | vyos-live-build-b54bdd7fb18d32178094e8c4e1493b6121044c11.tar.gz vyos-live-build-b54bdd7fb18d32178094e8c4e1493b6121044c11.zip |
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
-rwxr-xr-x | scripts/build/installer_debian-installer | 52 |
1 files changed, 34 insertions, 18 deletions
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 |