From ec3afd483372bcfa692d649c14bb052919a44880 Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Tue, 18 Aug 2020 15:57:38 +0200 Subject: image_repo_manifest.bbclass: fix build when there is no repo on host * failing "which repo" causes the run.buildinfo_manifest task to fail before it even reaches the test for empty repotool variable: dash -x some-image/1.0-r2/temp/run.buildinfo_manifest.80233 + export systemd_system_unitdir=/usr/lib/systemd/system + export systemd_unitdir=/usr/lib/systemd + export systemd_user_unitdir=/usr/lib/systemd/user + buildinfo_manifest + which repo + repotool= + bb_sh_exit_handler + ret=1 + [ 1 != 0 ] + echo WARNING: exit code 1 from a shell command. WARNING: exit code 1 from a shell command. + exit 1 causing nasty long python exception from do_image task with this fix, it just shows an warning again: dash -x some-image/1.0-r2/temp/run.buildinfo_manifest.80233 + export systemd_user_unitdir=/usr/lib/systemd/user + buildinfo_manifest + which repo + true + repotool= + [ -n ] + bbwarn Android repo tool not found; manifest not copied. + [ -p some-image/1.0-r2/temp/fifo.80233 ] + echo WARNING: Android repo tool not found; manifest not copied. WARNING: Android repo tool not found; manifest not copied. + ret=0 + trap 0 + exit 0 Signed-off-by: Martin Jansa --- classes/image_repo_manifest.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/image_repo_manifest.bbclass b/classes/image_repo_manifest.bbclass index 795f41f..12f56f0 100644 --- a/classes/image_repo_manifest.bbclass +++ b/classes/image_repo_manifest.bbclass @@ -13,7 +13,7 @@ inherit python3native # Write build information to target filesystem buildinfo_manifest () { - repotool=$(which repo) + repotool=`which repo || true` if [ -n "$repotool" ]; then python3 $repotool manifest --revision-as-HEAD -o ${IMAGE_ROOTFS}${sysconfdir}/manifest.xml || bbwarn "Android repo tool failed to run; manifest not copied" else -- cgit v1.2.3-54-g00ecf