Bug 15611

Summary: buildhistory package generation fails for empty package
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Andreas Cord-Landwehr <cordlandwehr>
Component: oe-core otherAssignee: Steve Sakoman <steve>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: Medium+ CC: tim.orling
Version: 5.0.4   
Target Milestone: 5.0.5   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Andreas Cord-Landwehr 2024-10-05 09:45:48 UTC
Please note that this is a problem I see on scarthgap branch *after* yocto-5.0.3 tag, but I am not sure where to report this otherwise, since the problem solution is not fully obvious to me: When using "buildhistory" in my global INHERIT statement, the packages history generation for libdevmapper fails because libdevmapper does not provide any package.

The trivial workaround is to use:

diff --cc meta/classes/buildhistory.bbclass
index 0b1bd518fe,0b1bd518fe..ca0cab3689
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@@ -621,7 -621,7 +621,7 @@@ 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 2>/dev/null || true)
        for pkgdir in $pkgdirlist; do
                pkgname=$(basename $pkgdir)
                outfolder="${BUILDHISTORY_DIR_PACKAGE}/$pkgname"

which is probably not a good idea to mask all errors ;)

My layer hashes and bitbake output are:

yoctouser@355b0133b0d8:/opt/yocto/kde/scarthgap/build-raspberrypi5$ bitbake libdevmapper
Loading cache: 100% |###############################################################################################################################################################################| Time: 0:00:03
Loaded 5340 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "2.8.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "aarch64-poky-linux"
MACHINE              = "raspberrypi5"
DISTRO               = "kde-linux"
DISTRO_VERSION       = "5.0.4"
TUNE_FEATURES        = "aarch64 crypto cortexa76"
TARGET_FPU           = ""
meta-kde-demo        = "work/scarthgap:ec99897e969dffb5398fd13583c4eeae72616652"
meta-kf6             = "work/kdoctools-fix-temp-dir-access:a2576a03d6759394bb583ab5f114c20e8fed0053"
meta-kde             = "master:8db4e65e5cb6e1b2cf011626f9ab94231cd0e249"
meta-qt6             = "6.8.0:dc13e1bfda4a4757a08c2d6673bc4bac012c4a80"
meta-java            = "HEAD:a2c62218c1dbc4cb49461afa8c1a88f89cf9457f"
meta-networking      
meta-python          
meta-oe              
meta-multimedia      = "HEAD:735ae0310870ffce07ce0c55c4f87c20ac161ff9"
meta-yocto-bsp       
meta-poky            
meta                 = "HEAD:c799f73a47fa35d6059456291328f7ff10fdb273"
meta-raspberrypi     = "HEAD:1879cb831f4ea3e532cb5ce9fa0f32be917e8fa3"
u-boot               = "scarthgap/u-boot:66ceeebd047d7fdfc8668b300319a76da8ae257d"

Sstate summary: Wanted 13 Local 0 Mirrors 0 Missed 13 Current 274 (0% match, 95% complete)########################################################################################                  | ETA:  0:00:00
Initialising tasks: 100% |##########################################################################################################################################################################| Time: 0:00:01
NOTE: Executing Tasks
ERROR: libdevmapper-2.03.22-r0 do_package: ExecutionError('/opt/yocto/kde/scarthgap/build-raspberrypi5/tmp/work/cortexa76-poky-linux/libdevmapper/2.03.22/temp/run.buildhistory_list_pkg_files.3020896', 1, None, None)
ERROR: Logfile of failure stored in: /opt/yocto/kde/scarthgap/build-raspberrypi5/tmp/work/cortexa76-poky-linux/libdevmapper/2.03.22/temp/log.do_package.3020896
Log data follows:
| DEBUG: Executing python function extend_recipe_sysroot
| NOTE: Direct dependencies are ['/opt/yocto/kde/scarthgap/sources/poky/meta/recipes-core/glibc/glibc_2.39.bb:do_populate_sysroot', '/opt/yocto/kde/scarthgap/sources/poky/meta/recipes-core/systemd/systemd-systemctl-native.bb:do_populate_sysroot', '/opt/yocto/kde/scarthgap/sources/poky/meta/recipes-devtools/gcc/gcc-cross_13.3.bb:do_populate_sysroot', '/opt/yocto/kde/scarthgap/sources/poky/meta/recipes-devtools/gcc/gcc-runtime_13.3.bb:do_populate_sysroot', '/opt/yocto/kde/scarthgap/sources/poky/meta/recipes-devtools/libtool/libtool-cross_2.4.7.bb:do_populate_sysroot', '/opt/yocto/kde/scarthgap/sources/poky/meta/recipes-devtools/libtool/libtool-native_2.4.7.bb:do_populate_sysroot', '/opt/yocto/kde/scarthgap/sources/poky/meta/recipes-devtools/quilt/quilt-native_0.67.bb:do_populate_sysroot', '/opt/yocto/kde/scarthgap/sources/poky/meta/recipes-extended/libaio/libaio_0.3.113.bb:do_populate_sysroot', 'virtual:native:/opt/yocto/kde/scarthgap/sources/poky/meta/recipes-devtools/autoconf-archive/autoconf-archive_2023.02.20.bb:do_populate_sysroot', 'virtual:native:/opt/yocto/kde/scarthgap/sources/poky/meta/recipes-devtools/autoconf/autoconf_2.72e.bb:do_populate_sysroot', 'virtual:native:/opt/yocto/kde/scarthgap/sources/poky/meta/recipes-devtools/automake/automake_1.16.5.bb:do_populate_sysroot', 'virtual:native:/opt/yocto/kde/scarthgap/sources/poky/meta/recipes-devtools/patch/patch_2.7.6.bb:do_populate_sysroot', 'virtual:native:/opt/yocto/kde/scarthgap/sources/poky/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb:do_populate_sysroot', 'virtual:native:/opt/yocto/kde/scarthgap/sources/poky/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot']
| NOTE: Installed into sysroot: []
| NOTE: Skipping as already exists in sysroot: ['gettext-minimal-native', 'glibc', 'systemd-systemctl-native', 'binutils-cross-aarch64', 'gcc-cross-aarch64', 'gcc-runtime', 'libgcc', 'libtool-cross', 'libtool-native', 'm4-native', 'quilt-native', 'libaio', 'texinfo-dummy-native', 'linux-libc-headers', 'zlib-native', 'autoconf-archive-native', 'autoconf-native', 'automake-native', 'flex-native', 'gnu-config-native', 'patch-native', 'pkgconfig-native', 'pseudo-native', 'xz-native', 'zstd-native', 'attr-native', 'gmp-native', 'libmpc-native', 'mpfr-native', 'sqlite3-native']
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing python function sstate_task_prefunc
| DEBUG: Python function sstate_task_prefunc finished
| DEBUG: Executing python function do_package
| DEBUG: No packages to build, skipping do_package
| DEBUG: Python function do_package finished
| DEBUG: Executing python function sstate_task_postfunc
| NOTE: Using umask 0o002 (not 22) for sstate packaging
| DEBUG: Executing python function target_add_sysroot_deps
| DEBUG: Python function target_add_sysroot_deps finished
| DEBUG: Executing python function sstate_hardcode_path
| NOTE: Removing hardcoded paths from sstate package: 'find /opt/yocto/kde/scarthgap/build-raspberrypi5/tmp/work/cortexa76-poky-linux/libdevmapper/2.03.22/sstate-build-package/ \( -name "*.la" -o -name "*-config" -o -name "*_config" -o -name "postinst-*" \) -type f | xargs grep -l -e '/opt/yocto/kde/scarthgap/build-raspberrypi5/tmp/work/cortexa76-poky-linux/libdevmapper/2.03.22/recipe-sysroot' -e '/opt/yocto/kde/scarthgap/build-raspberrypi5/tmp/work/cortexa76-poky-linux/libdevmapper/2.03.22/recipe-sysroot-native' -e '/opt/yocto/kde/scarthgap/build-raspberrypi5/tmp/hosttools' | tee /opt/yocto/kde/scarthgap/build-raspberrypi5/tmp/work/cortexa76-poky-linux/libdevmapper/2.03.22/sstate-build-package/fixmepath | xargs --no-run-if-empty sed -i -e 's:/opt/yocto/kde/scarthgap/build-raspberrypi5/tmp/work/cortexa76-poky-linux/libdevmapper/2.03.22/recipe-sysroot-native:FIXMESTAGINGDIRHOST:g' -e 's:/opt/yocto/kde/scarthgap/build-raspberrypi5/tmp/work/cortexa76-poky-linux/libdevmapper/2.03.22/recipe-sysroot:FIXMESTAGINGDIRTARGET:g' -e 's:/opt/yocto/kde/scarthgap/build-raspberrypi5/tmp/hosttools:FIXME_HOSTTOOLS_DIR:g''
| DEBUG: Python function sstate_hardcode_path finished
| DEBUG: Executing python function sstate_report_unihash
| DEBUG: Reported task 1cb9183c1f63473a608bf8e33d6a7f61d6c06509de13d554c5748f3ab89eb1c1 as unihash 1cb9183c1f63473a608bf8e33d6a7f61d6c06509de13d554c5748f3ab89eb1c1 to unix:///opt/yocto/kde/scarthgap/build-raspberrypi5/hashserve.sock
| DEBUG: Python function sstate_report_unihash finished
| DEBUG: Executing python function sstate_create_and_sign_package
| DEBUG: Executing shell function sstate_archive_package
| DEBUG: Shell function sstate_archive_package finished
| DEBUG: Python function sstate_create_and_sign_package finished
| DEBUG: Executing python function sstate_hardcode_path_unpack
| DEBUG: Python function sstate_hardcode_path_unpack finished
| DEBUG: Executing python function buildhistory_emit_outputsigs
| DEBUG: Python function buildhistory_emit_outputsigs finished
| DEBUG: Executing python function uninative_changeinterp
| DEBUG: Python function uninative_changeinterp finished
| DEBUG: Python function sstate_task_postfunc finished
| DEBUG: Executing shell function buildhistory_list_pkg_files
| find: ‘/opt/yocto/kde/scarthgap/build-raspberrypi5/tmp/work/cortexa76-poky-linux/libdevmapper/2.03.22/packages-split/*’: No such file or directory
| WARNING: exit code 1 from a shell command.
ERROR: Task (/opt/yocto/kde/scarthgap/sources/meta-openembedded/meta-oe/recipes-support/lvm2/libdevmapper_2.03.22.bb:do_package) failed with exit code '1'
NOTE: Tasks Summary: Attempted 863 tasks of which 846 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 5 seconds

Summary: 1 task failed:
  /opt/yocto/kde/scarthgap/sources/meta-openembedded/meta-oe/recipes-support/lvm2/libdevmapper_2.03.22.bb:do_package
Comment 1 Andreas Cord-Landwehr 2024-10-05 09:57:32 UTC
I can confirm that this does not happen with 5.0.3
Comment 2 Steve Sakoman 2024-10-10 15:00:38 UTC
libdevmapper is actually a meta-openembedded recipe, not oe-core.

That said, there is a patch on the oe list to fix this issue:

https://lists.openembedded.org/g/openembedded-devel/message/112734
Comment 3 Andreas Cord-Landwehr 2024-10-23 19:41:01 UTC
Thanks a lot for the clarification! I wasn't aware of the nopackages class and thus being a problem in meta-openembedded.