Printing a useful error message while failing should help users understand why
we fail with this error. As the current error message doesn't directly link to
needing to inherit nopackages.

Previous error message:
| DEBUG: Executing shell function buildhistory_list_pkg_files
| find: ".../meta-toolchain/1.0/packages-split/*": No such file or directory
| WARNING: exit code 1 from a shell command.
| DEBUG: Python function buildhistory_emit_pkghistory finished

New error message:
| ERROR: meta-toolchain-1.0-r0 do_package: meta-toolchain: 
../meta-toolchain/1.0/packages-split is empty.
| ERROR: meta-toolchain-1.0-r0 do_package: Possible reasons:
| ERROR: meta-toolchain-1.0-r0 do_package: 1. Recipe doesn't install any files. 
Inherit nopackages to fix.
| ERROR: meta-toolchain-1.0-r0 do_package: 2. do_packagedata task wasn't 
executed.
| ERROR: meta-toolchain-1.0-r0 do_package: Execution of 
'../meta-toolchain/1.0/temp/run.buildhistory_list_pkg_files.1003324' failed 
with exit code 1

Signed-off-by: Atharva Nandanwar <[email protected]>
---
 meta/classes/buildhistory.bbclass | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meta/classes/buildhistory.bbclass 
b/meta/classes/buildhistory.bbclass
index ce3abaa69d..0e9d5464af 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -621,7 +621,13 @@ buildhistory_list_pkg_files() {
        fi
 
        # Create individual files-in-package for each recipe's package
-       pkgdirlist=$(find ${PKGDEST}/* -maxdepth 0 -type d)
+       pkgdirlist=$(find ${PKGDEST}/* -maxdepth 0 -type d || true)
+       if [ -z "${pkgdirlist}" ]; then
+               bberror "${PN}: ${PKGDEST} is empty."
+               bberror "Possible reasons:"
+               bberror "1. Recipe doesn't install any files. Inherit 
nopackages to fix."
+               bbfatal "2. do_packagedata task wasn't executed."
+       fi
        for pkgdir in $pkgdirlist; do
                pkgname=$(basename $pkgdir)
                outfolder="${BUILDHISTORY_DIR_PACKAGE}/$pkgname"
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#205202): 
https://lists.openembedded.org/g/openembedded-core/message/205202
Mute This Topic: https://lists.openembedded.org/mt/108781648/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to