summaryrefslogtreecommitdiff
path: root/scripts/build/chroot_firmware
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-02-10 18:49:34 +0000
committerLuca Boccassi <bluca@debian.org>2020-03-05 22:13:57 +0000
commitc53a94932583ad8030594dd021e4a035ffcc872f (patch)
tree017e55459719bc35f389cd3687a3ea7ac908dc6e /scripts/build/chroot_firmware
parenta951fe7ba648c9197a312933aeed35baeb0f6f7b (diff)
downloadvyos-live-build-c53a94932583ad8030594dd021e4a035ffcc872f.tar.gz
vyos-live-build-c53a94932583ad8030594dd021e4a035ffcc872f.zip
firmware: fix possible duplication in firmware package lists (inefficiency)
where multiple archive areas are used, the code here on each loop is: 1) fetching the archive area contents file (compressed) 2) **appending** the output to that of the previous loop 3) searching the file for firmware references, adding to the list since it appends rather than replaces, entries found in each loop get re-added on each subsequent loop, resulting in duplication in the resulting list below I evaluate the possible solutions to explain why I chose the one I chose, however the reader should not waste too much time worrying about whether one of the other solution would have actually been better because things are changed significantly in further commits shortly! possible solutions: a) switching to output (>) rather than append (>>), but this might fail against an existing file b) removing the file on each loop, but this will complicate any future caching improvements that might be made here (currently the files are always deleted and thus downloaded fresh) c) allow the appending, evaluating the complete file after the loop solution C warrants consideration of disk space consumption; currently the compressed 'main' archive (for sid on amd64) expands to 592.3 MB (feb-2020), 'contrib' is 3.1 MB, and 'non-free' is 18.5 MB. solution C was chosen here; the difference of accumulated file size vs. max-single was minor enough to not be of particular concern (~613 vs. ~592 MB). Gbp-Dch: Short Closes: #952906
Diffstat (limited to 'scripts/build/chroot_firmware')
-rwxr-xr-xscripts/build/chroot_firmware8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/build/chroot_firmware b/scripts/build/chroot_firmware
index 4cfe37e48..1070ccbae 100755
--- a/scripts/build/chroot_firmware
+++ b/scripts/build/chroot_firmware
@@ -68,10 +68,10 @@ do
CONTENTS_URL="${LB_PARENT_MIRROR_CHROOT}/dists/${LB_PARENT_DISTRIBUTION_CHROOT}/${_PARENT_ARCHIVE_AREA}/Contents-${LB_ARCHITECTURES}.gz"
wget ${WGET_OPTIONS} "${CONTENTS_URL}" -O - | gunzip -c >> "${CONTENTS_FILE}"
-
- FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' "${CONTENTS_FILE}" | sort -u)"
done
+FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' "${CONTENTS_FILE}" | sort -u)"
+
if echo ${LB_PARENT_ARCHIVE_AREAS} | grep -qs "non-free"
then
# Manually add firmware-linux/non-free meta package
@@ -102,9 +102,9 @@ then
CONTENTS_URL="${LB_MIRROR_CHROOT}/dists/${LB_DISTRIBUTION_CHROOT}/${_ARCHIVE_AREA}/Contents-${LB_ARCHITECTURES}.gz"
wget ${WGET_OPTIONS} "${CONTENTS_URL}" -O - | gunzip -c >> "${CONTENTS_FILE}"
-
- FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' "${CONTENTS_FILE}" | sort -u)"
done
+
+ FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' "${CONTENTS_FILE}" | sort -u)"
fi
# Drop section and keep package names only