firmware: enable caching for archive content file with firmware lists
the existing logic for obtaining a list of firmware packages always downloaded a fresh copy of the archive content file, deleting the file already in the cache. here we move to actually making use of the cache. this helps when building multiple times, at least for the same distro. the package list obtained is rarely going to change after all. it could of course differ between distros, but the cache is per-distro, as it has always been. we of course here switch to caching each of the archive-area files individually rather than having one file that gets overwritten (or appended to in the case of when we kept the decompressed file). Gbp-Dch: Short Closes: #952911
This commit is contained in:
parent
7867641fd0
commit
4d0c3a1169
|
@ -20,19 +20,32 @@ Firmware_List_From_Contents () {
|
|||
|
||||
for _ARCHIVE_AREA in ${ARCHIVE_AREAS}
|
||||
do
|
||||
local CONTENTS_FILE="cache/contents.chroot/contents.${DISTRO_CHROOT}.${LB_ARCHITECTURES}.gz"
|
||||
local CONTENTS_URL="${MIRROR_CHROOT}/dists/${DISTRO_CHROOT}/${_ARCHIVE_AREA}/Contents-${LB_ARCHITECTURES}.gz"
|
||||
local CONTENTS_FILEDIR="cache/contents.chroot/${DISTRO_CHROOT}/${_ARCHIVE_AREA}"
|
||||
local CONTENTS_FILE="${CONTENTS_FILEDIR}/contents-${LB_ARCHITECTURES}.gz"
|
||||
|
||||
# Ensure fresh
|
||||
rm -f "${CONTENTS_FILE}"
|
||||
mkdir -p "${CONTENTS_FILEDIR}"
|
||||
|
||||
wget ${WGET_OPTIONS} "${CONTENTS_URL}" -O "${CONTENTS_FILE}"
|
||||
# Purge from cache if not wanting to use from cache, ensuring fresh copy
|
||||
if [ "${LB_CACHE}" != "true" ]
|
||||
then
|
||||
rm -f "${CONTENTS_FILE}"
|
||||
fi
|
||||
|
||||
# If not cached, download
|
||||
if [ ! -e "${CONTENTS_FILE}" ]
|
||||
then
|
||||
wget ${WGET_OPTIONS} "${CONTENTS_URL}" -O "${CONTENTS_FILE}"
|
||||
fi
|
||||
|
||||
local PACKAGES
|
||||
PACKAGES="$(gunzip -c "${CONTENTS_FILE}" | awk '/^lib\/firmware/ { print $2 }' | sort -u )"
|
||||
FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} ${PACKAGES}"
|
||||
|
||||
# Don't waste disk space preserving since always getting fresh
|
||||
rm -f "${CONTENTS_FILE}"
|
||||
# Don't waste disk space, if not making use of caching
|
||||
if [ "${LB_CACHE}" != "true" ]
|
||||
then
|
||||
rm -f "${CONTENTS_FILE}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
|
|
@ -54,7 +54,6 @@ Check_package host /usr/bin/wget wget
|
|||
# Include firmware packages
|
||||
|
||||
# Get all firmware packages names
|
||||
mkdir -p cache/contents.chroot
|
||||
|
||||
FIRMWARE_PACKAGES=""
|
||||
|
||||
|
|
Loading…
Reference in New Issue