diff options
author | Lyndon Brown <jnqnfe@gmail.com> | 2020-02-11 17:44:31 +0000 |
---|---|---|
committer | Luca Boccassi <bluca@debian.org> | 2020-03-05 22:13:57 +0000 |
commit | aa745de0bbdfec3a2e23f4d76b081664d5d24673 (patch) | |
tree | 74349789de9bf07af8c773e750311f14414910dc /scripts/build | |
parent | 4933beffce1f4467bf93ef5fc6711e4d2dff901f (diff) | |
download | vyos-live-build-aa745de0bbdfec3a2e23f4d76b081664d5d24673.tar.gz vyos-live-build-aa745de0bbdfec3a2e23f4d76b081664d5d24673.zip |
firmware: de-dup firmware list parsing
Edit: There were four copies of the same logic to keep in sync;
Originally this patch deduplicated each file, but leaving a copy of
the new function in each, thus reducing the duplication but not
eliminating it. A later patch moved it into a shared function file
following further enhancements to the code in question. This has
since been revised to have the function moved to a shared file here,
which simplifies and gives a cleaner diff.
Gbp-Dch: Short
Closes: #952908
Diffstat (limited to 'scripts/build')
-rwxr-xr-x | scripts/build/chroot_firmware | 29 | ||||
-rwxr-xr-x | scripts/build/installer_debian-installer | 31 |
2 files changed, 5 insertions, 55 deletions
diff --git a/scripts/build/chroot_firmware b/scripts/build/chroot_firmware index e644a5584..5686de624 100755 --- a/scripts/build/chroot_firmware +++ b/scripts/build/chroot_firmware @@ -52,25 +52,13 @@ Check_package host /usr/bin/wget wget #esac # Include firmware packages -# Assumption: firmware packages install files into /lib/firmware # Get all firmware packages names mkdir -p cache/contents.chroot FIRMWARE_PACKAGES="" -CONTENTS_FILE="cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES}" - -rm -f "${CONTENTS_FILE}" - -for _PARENT_ARCHIVE_AREA in ${LB_PARENT_ARCHIVE_AREAS} -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}" -done - -FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' "${CONTENTS_FILE}" | sort -u)" +Firmware_List_From_Contents "${LB_PARENT_MIRROR_CHROOT}" "${LB_PARENT_DISTRIBUTION_CHROOT}" "${LB_PARENT_ARCHIVE_AREAS}" if echo ${LB_PARENT_ARCHIVE_AREAS} | grep -qs "non-free" then @@ -93,22 +81,9 @@ 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). - CONTENTS_FILE="cache/contents.chroot/contents.${LB_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES}" - - rm -f "${CONTENTS_FILE}" - - for _ARCHIVE_AREA in ${LB_ARCHIVE_AREAS} - do - 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}" - done - - FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' "${CONTENTS_FILE}" | sort -u)" + Firmware_List_From_Contents "${LB_MIRROR_CHROOT}" "${LB_DISTRIBUTION_CHROOT}" "${LB_ARCHIVE_AREAS}" fi -rm -f "${CONTENTS_FILE}" - # Drop section and keep package names only for _PACKAGE in ${FIRMWARE_PACKAGES} do diff --git a/scripts/build/installer_debian-installer b/scripts/build/installer_debian-installer index dcfd1792b..96e4e7b5c 100755 --- a/scripts/build/installer_debian-installer +++ b/scripts/build/installer_debian-installer @@ -337,28 +337,16 @@ then DI_PACKAGES="${DI_PACKAGES} console-setup keyboard-configuration kbd" ;; esac + # Include firmware packages if [ "${LB_FIRMWARE_BINARY}" = "true" ] then - # Assumption: firmware packages install files into /lib/firmware - # Get all firmware packages names mkdir -p cache/contents.binary FIRMWARE_PACKAGES="" - CONTENTS_FILE="cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES}" - - rm -f "${CONTENTS_FILE}" - - for _PARENT_ARCHIVE_AREA in ${LB_PARENT_ARCHIVE_AREAS} - 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}" - done - - FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' "${CONTENTS_FILE}" | sort -u)" + Firmware_List_From_Contents "${LB_PARENT_MIRROR_CHROOT}" "${LB_PARENT_DISTRIBUTION_CHROOT}" "${LB_PARENT_ARCHIVE_AREAS}" if echo ${LB_PARENT_ARCHIVE_AREAS} | grep -qs "non-free" then @@ -381,22 +369,9 @@ then then # FIXME: account for the fact that PARENT_DISTRIBUTION and DISTRIBUTION might be the same (to not have overlapping cache files for contents). - CONTENTS_FILE="cache/contents.chroot/contents.${LB_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES}" - - rm -f "${CONTENTS_FILE}" - - for _ARCHIVE_AREA in ${LB_ARCHIVE_AREAS} - do - 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}" - done - - FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' "${CONTENTS_FILE}" | sort -u)" + Firmware_List_From_Contents "${LB_MIRROR_CHROOT}" "${LB_DISTRIBUTION_CHROOT}" "${LB_ARCHIVE_AREAS}" fi - rm -f "${CONTENTS_FILE}" - # Drop section and keep package names only for _PACKAGE in ${FIRMWARE_PACKAGES} do |