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
This commit is contained in:
Lyndon Brown 2020-02-13 04:43:46 +00:00
parent 2e3f195c38
commit b54bdd7fb1
1 changed files with 34 additions and 18 deletions

View File

@ -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)"
UDEBS="${UDEBS} $(awk '/Filename: / { print $2 }' Packages)"
# 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=""
# 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