installer: download udebs directly from correct mirror

instead of trying all from derived mirror then falling back to parent upon
failure, which as pointed out by a message printed out can result in a
load of spurious 404 errors; actually get each udeb from the mirror it is
supposed to be retrieved from.

Partial fix for #952914, this is the last commit for it so closes it

Gbp-Dch: Short
Closes: #952914
This commit is contained in:
Lyndon Brown 2020-02-13 04:55:14 +00:00
parent b54bdd7fb1
commit 0869a890ae
1 changed files with 22 additions and 15 deletions

View File

@ -529,16 +529,17 @@ then
fi
UDEBS="$(awk '/Filename: / { print $2 }' Packages)"
UDEBS_DERIVED=""
if [ "${LB_DERIVATIVE}" = "true" ]
then
_UDEBS_DERIVED="$(awk '/Filename: / { print $2 }' Packages.derivative)"
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}
for _UDEB in ${UDEBS_DERIVED}
do
_UDEBS_DERIVED_NAMES="${_UDEBS_DERIVED_NAMES} $(basename ${_UDEB} | awk -F_ '{ print $1 }')"
done
@ -549,23 +550,14 @@ then
_UDEBS_FILTERED="${_UDEBS_FILTERED} ${_UDEB}"
fi
done
_UDEBS_DERIVED_NAMES=""
# Combine into one list
UDEBS="${_UDEBS_FILTERED} ${_UDEBS_DERIVED}"
_UDEBS_DERIVED=""
UDEBS="${_UDEBS_FILTERED}"
_UDEBS_FILTERED=""
_UDEBS_DERIVED_NAMES=""
fi
# Downloading udeb packages
Echo_message "Downloading udebs..."
if [ "${LB_DERIVATIVE}" = "true" ]
then
Echo_message "Building in derivative mode in debian+ layout.. a lot of 404 errors are ok here."
fi
for UDEB in ${UDEBS}
do
_UDEB_FILENAME="$(basename ${UDEB})"
@ -574,10 +566,25 @@ then
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}"
wget ${WGET_OPTIONS} "${LB_PARENT_MIRROR_CHROOT}/${UDEB}"
fi
done
if [ "${LB_DERIVATIVE}" = "true" ]
then
for UDEB in ${UDEBS_DERIVED}
do
_UDEB_FILENAME="$(basename ${UDEB})"
# 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}"
fi
done
fi
# Caching udebs
rm -rf ../cache/packages.installer_debian-installer.udeb
mkdir -p ../cache/packages.installer_debian-installer.udeb
@ -646,7 +653,7 @@ then
done < exclude
# Sort udebs into alphabetised pool structure
for UDEB in ${UDEBS}
for UDEB in "${UDEBS} ${UDEBS_DERIVED}"
do
_UDEB_FILENAME="$(basename ${UDEB})"
Install_file "${_UDEB_FILENAME}" "pool-udeb"