diff options
author | Lyndon Brown <jnqnfe@gmail.com> | 2020-02-11 21:00:14 +0000 |
---|---|---|
committer | Luca Boccassi <bluca@debian.org> | 2020-03-05 22:13:57 +0000 |
commit | a120bc54458c38636aec3f414af02f449ecaa44f (patch) | |
tree | 2d2b3ca6bdd5e7cf5cba4f03d69616784a33b246 | |
parent | 94d126c0439ee906e69b78397b233d63c96e5f3e (diff) | |
download | vyos-live-build-a120bc54458c38636aec3f414af02f449ecaa44f.tar.gz vyos-live-build-a120bc54458c38636aec3f414af02f449ecaa44f.zip |
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
-rwxr-xr-x | scripts/build/chroot_firmware | 20 | ||||
-rwxr-xr-x | scripts/build/installer_debian-installer | 20 |
2 files changed, 36 insertions, 4 deletions
diff --git a/scripts/build/chroot_firmware b/scripts/build/chroot_firmware index 4a65d552a..7fdd7605d 100755 --- a/scripts/build/chroot_firmware +++ b/scripts/build/chroot_firmware @@ -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 diff --git a/scripts/build/installer_debian-installer b/scripts/build/installer_debian-installer index 67573f2e6..64375e85c 100755 --- a/scripts/build/installer_debian-installer +++ b/scripts/build/installer_debian-installer @@ -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 |