From 71d5ae9df9268be2803e2a45277e65c7c84c1fdb Mon Sep 17 00:00:00 2001 From: Scott Little Date: Tue, 9 Feb 2021 13:12:06 -0500 Subject: [PATCH] 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 Change-Id: Ie2fbafae7a0ec90fc11e4af3d67dd15aec27c909 --- build-tools/build-img | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build-tools/build-img b/build-tools/build-img index 02e7f06b..fb71bd1d 100755 --- a/build-tools/build-img +++ b/build-tools/build-img @@ -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