build-img fails if not run under $MY_WORKSPACE

Build-img may need to generate a patch that is to be applied to the
image being produced.  The patch build tool drops the patch into
the current directory.  No explicit working directory was set.
A subsequent step tries to apply the patch, but assumes it is in
$MY_WORKSPACE.

We want all build artifacts to be placed under $MY_WORKSPACE, so
set $MY_WORKSPACE as the current directory before creating the patch.

Closes-Bug: 1915182
Signed-off-by: Scott Little <scott.little@windriver.com>
Change-Id: Ie2fbafae7a0ec90fc11e4af3d67dd15aec27c909
This commit is contained in:
Scott Little 2021-02-09 13:12:06 -05:00
parent 395308f881
commit 71d5ae9df9

View File

@ -561,6 +561,9 @@ echo "${cmd[@]}"
# patch the iso if additional rpms are specified
if [ ${#RPM_ADDON_LIST[@]} -gt 0 ] ; then
# Patch build will drop the generated patch file into the current directory.
# We want that to be $MY_WORKSPACE.
pushd $MY_WORKSPACE
patch_file="PATCH.img-addon"
patched_iso="$TEMPFILES_DIR/bootimage_${AUTO_MODE}${GRAPHICAL_SUFFIX}_patched.iso"
cmd=("$PATCH_BUILD" --id "${patch_file}" --summary "additional packages for qcow2 image" --desc "Adds customizations to qcow2 image")
@ -575,6 +578,7 @@ if [ ${#RPM_ADDON_LIST[@]} -gt 0 ] ; then
echo "${cmd[@]}"
"${cmd[@]}" || exit 1
mv ${patched_iso} ${auto_iso}
popd
fi
# create a blank image file