firmware: avoid potentially duplicate work

addressing an old fixme, should distro and parent-distro be identical (in
a derivative build) we want to avoid wasting effort downloading and
processing the same content files twice.

since parent and non-parent have separate archive-area lists though we
should perhaps not just assume that they are identical or ignore any
differences; thus here in such a situation we ensure that we handle any
archive areas not already done for parent-distro handling in such a case,
while skipping those already done.

i notice that the fixme actually also refers to avoiding actual
overlapping of the cached files, however the cached files are (currently)
always ignored anyway, so this is of no concern. reusing the cached files
is an entirely separate issue.

Gbp-Dch: Short
Closes: #952909
This commit is contained in:
Lyndon Brown 2020-02-11 21:00:14 +00:00 committed by Luca Boccassi
parent 94d126c043
commit a120bc5445
2 changed files with 36 additions and 4 deletions

View File

@ -79,9 +79,25 @@ Firmware_List_From_Contents "${LB_PARENT_MIRROR_CHROOT}" "${LB_PARENT_DISTRIBUTI
if [ "${LB_DERIVATIVE}" = "true" ]
then
# FIXME: account for the fact that PARENT_DISTRIBUTION and DISTRIBUTION might be the same (to not have overlapping cache files for contents).
# Avoid downloading things twice if distributions are identical
DERIVATIVE_ARCHIVE_AREAS=""
if [ "${LB_DISTRIBUTION_CHROOT}" != "${LB_PARENT_DISTRIBUTION_CHROOT}" ]
then
DERIVATIVE_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS}"
else
for _ARCHIVE_AREA in ${LB_ARCHIVE_AREAS}
do
if ! In_list ${_ARCHIVE_AREA} "${LB_PARENT_ARCHIVE_AREAS}"
then
DERIVATIVE_ARCHIVE_AREAS="${DERIVATIVE_ARCHIVE_AREAS} ${_ARCHIVE_AREA}"
fi
done
fi
Firmware_List_From_Contents "${LB_MIRROR_CHROOT}" "${LB_DISTRIBUTION_CHROOT}" "${LB_ARCHIVE_AREAS}"
if [ ! -z "${DERIVATIVE_ARCHIVE_AREAS}" ]
then
Firmware_List_From_Contents "${LB_MIRROR_CHROOT}" "${LB_DISTRIBUTION_CHROOT}" "${DERIVATIVE_ARCHIVE_AREAS}"
fi
fi
# Drop section and keep package names only

View File

@ -367,9 +367,25 @@ then
if [ "${LB_DERIVATIVE}" = "true" ]
then
# FIXME: account for the fact that PARENT_DISTRIBUTION and DISTRIBUTION might be the same (to not have overlapping cache files for contents).
# Avoid downloading things twice if distributions are identical
DERIVATIVE_ARCHIVE_AREAS=""
if [ "${LB_DISTRIBUTION_CHROOT}" != "${LB_PARENT_DISTRIBUTION_CHROOT}" ]
then
DERIVATIVE_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS}"
else
for _ARCHIVE_AREA in ${LB_ARCHIVE_AREAS}
do
if ! In_list ${_ARCHIVE_AREA} "${LB_PARENT_ARCHIVE_AREAS}"
then
DERIVATIVE_ARCHIVE_AREAS="${DERIVATIVE_ARCHIVE_AREAS} ${DERIVATIVE_ARCHIVE_AREAS}"
fi
done
fi
Firmware_List_From_Contents "${LB_MIRROR_CHROOT}" "${LB_DISTRIBUTION_CHROOT}" "${LB_ARCHIVE_AREAS}"
if [ ! -z "${DERIVATIVE_ARCHIVE_AREAS}" ]
then
Firmware_List_From_Contents "${LB_MIRROR_CHROOT}" "${LB_DISTRIBUTION_CHROOT}" "${DERIVATIVE_ARCHIVE_AREAS}"
fi
fi
# Drop section and keep package names only