Improve DNF cache handling in gen-bootloader-iso.sh

The "dnf repoquery" command is using and updating the cache for ad-hoc
repos created when using the repofrompath option. This can result in
gen-bootloader-iso.sh using stale cached information when looking for
specific RPMs in the patch repo when generating bootloader ISOs for
subcloud installs.

In order to avoid such issues, this update asks DNF to mark the cache
as expired after copying the patch repo for generating the new ISOs,
as well as on deletion. This ensures the repoquery uses up-to-date
information.

Additionally, this update removes a duplicated patch repo setup step,
which was not cleaned up during dev testing on the previous commit.

Change-Id: I664edb346692d79cd13b23772686ea88f0aaaf9f
Story: 2007994
Task: 40798
Signed-off-by: Don Penney <don.penney@windriver.com>
This commit is contained in:
Don Penney 2020-08-31 14:37:59 -04:00
parent a69c15f406
commit fb70729a9e

View File

@ -370,6 +370,9 @@ function handle_delete {
rm -rf ${SHARED_DIR}
fi
fi
# Mark the DNF cache expired
dnf clean expire-cache
}
function get_patches_from_host {
@ -487,6 +490,9 @@ function extract_shared_files {
fi
fi
# Mark the DNF cache expired, in case there was previous ad-hoc repo data
dnf clean expire-cache
local squashfs_img_file=${MNTDIR}/LiveOS/squashfs.img
if [ ${PATCHES_FROM_HOST} = "yes" ]; then
extract_pkg_to_workdir 'pxe-network-installer'
@ -540,18 +546,6 @@ function extract_shared_files {
log_error "Failed to copy base repodata from ${INPUT_ISO}"
exit 1
fi
if [ ${PATCHES_FROM_HOST} = "yes" ]; then
get_patches_from_host
else
if [ -d ${MNTDIR}/patches ]; then
rsync -a ${MNTDIR}/patches/ ${SHARED_DIR}/patches/
if [ $? -ne 0 ]; then
log_error "Failed to copy patches repo from ${INPUT_ISO}"
exit 1
fi
fi
fi
}
function extract_node_files {