Bug 6420 - Detect and error when required packages are not produced
Summary: Detect and error when required packages are not produced
Status: NEW
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.8
Hardware: All Multiple
: Medium enhancement
Target Milestone: 6.99
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard:
: 5531 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-06-10 16:49 UTC by Paul Eggleton
Modified: 2026-03-26 14:27 UTC (History)
8 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Eggleton 2014-06-10 16:49:34 UTC
During packaging, check if there are any dependencies (RDEPENDS) on packages that have ended up empty and not produced; and if so produce an error as soon as possible, instead of allowing the build to proceed up to do_rootfs and then the package manager reporting the package as missing.

At the moment we probably don't have access within the metadata to the information that we need for this - we really want to know which recipe BitBake thought was going to satisfy the dependency and report that, since that's likely where the problem lies.
Comment 1 Hongxu Jia 2014-12-05 09:31:28 UTC
(In reply to comment #0)
> During packaging, check if there are any dependencies (RDEPENDS) on packages
> that have ended up empty and not produced; and if so produce an error as
> soon as possible, instead of allowing the build to proceed up to do_rootfs
> and then the package manager reporting the package as missing.
> 
> At the moment we probably don't have access within the metadata to the
> information that we need for this - we really want to know which recipe
> BitBake thought was going to satisfy the dependency and report that, since
> that's likely where the problem lies.

Hi Richard,

In order to check the non-existance package was needed
by whom at package producing time, we need to get all
recipes's RDEPENDS, and calculate dependency chain, but
how to access metadata to get these?

The cachedata have everything what we need, but it is
used for bitbake and not exposed to recipe, do you have
any suggestions to make some API by metadata?

Further more, do we have a mechanism about communication
between recipes by metadata, suce as invoking
d.setVar('recipe1_info', **) in recipe1 and invoking
d.getVar('recipe1_info') in recipe2.

Thanks,
Hongxu
Comment 2 Hongxu Jia 2014-12-09 03:27:29 UTC
I think we could make use of bb.persist_data.persist to do this:
...
Used to store data in a central location such that other threads/tasks can 
access them at some future date.  Acts as a convenience wrapper around sqlite,
currently, providing a key/value store accessed by 'domain'
...

//Hongxu
Comment 3 Hongxu Jia 2014-12-12 01:30:45 UTC
Test Steps:

1. Edit xz and gzip recipe, to simulate a package missing situation (the manually added
rdepends is not real but):
..............
diff --git a/meta/recipes-extended/gzip/gzip.inc b/meta/recipes-extended/gzip/gzip.inc
index 671b1eb..7e643e5 100644
--- a/meta/recipes-extended/gzip/gzip.inc
+++ b/meta/recipes-extended/gzip/gzip.inc
@@ -32,3 +32,8 @@ ALTERNATIVE_LINK_NAME[gzip] = "${base_bindir}/gzip"
 ALTERNATIVE_LINK_NAME[zcat] = "${base_bindir}/zcat"
 
 export CONFIG_SHELL="/bin/sh"
+
+PACKAGES =+ "${PN}-missing1 ${PN}-missing2"
+FILES_${PN}-missing1 = ""
+FILES_${PN}-missing2 = ""
+RPROVIDES_${PN}-missing1 = "${PN}-missing"
diff --git a/meta/recipes-extended/xz/xz_5.1.3alpha.bb b/meta/recipes-extended/xz/xz_5.1.3alpha.bb
index 168e383..c5d8b57 100644
--- a/meta/recipes-extended/xz/xz_5.1.3alpha.bb
+++ b/meta/recipes-extended/xz/xz_5.1.3alpha.bb
@@ -37,6 +37,9 @@ FILES_liblzma-dev = "${includedir}/lzma* ${libdir}/liblzma*${SOLIBSDEV} ${libdir
 FILES_liblzma-staticdev = "${libdir}/liblzma.a"
 FILES_liblzma-dbg = "${libdir}/.debug/liblzma*"
 
+
+RDEPENDS_${PN}_class-target += "gzip-missing gzip-missing2"
+
 BBCLASSEXTEND = "native nativesdk"
 
 export CONFIG_SHELL="/bin/sh"
..............

2. Vim local.conf
...
IMAGE_INSTALL_append = " xz"
WARN_QA_append = " package-missing"
...

3. bitbake core-image-minimal
..............
|WARNING: QA Issue: package gzip-missing1 not generated, but listed in PACKAGES
|Compute rdepends chains, '-->' means 'runtime depends'
|("gzip-missing1" rprovides "gzip-missing")
|"xz" -> "gzip-missing"
| [package-missing]
|WARNING: QA Issue: package gzip-missing2 not generated, but listed in PACKAGES
|Compute rdepends chains, '-->' means 'runtime depends'
|"xz" -> "gzip-missing2"
| [package-missing]
|ERROR: Unable to install packages. Command '/home/jiahongxu/yocto/build-2014120
2-mips/tmp/sysroots/x86_64-linux/usr/bin/smart --quiet --data-dir=/home/jiahongx
u/yocto/build-20141202-mips/tmp/work/qemumips-poky-linux/core-image-minimal/1.0
-r0/rootfs/var/lib/smart install -y xz@mips32r2 run-postinsts@all packagegroup-
core-boot@qemumips' returned 1:
error: Can't install xz-5.1.3alpha-r0@mips32r2: no package provides gzip-missing


|ERROR: Function failed: do_rootfs
|ERROR: Logfile of failure stored in: /home/jiahongxu/yocto/build-20141202-mips/
tmp/work/qemumips-poky-linux/core-image-minimal/1.0-r0/temp/log.do_rootfs.24338
|ERROR: Task 7 (/home/jiahongxu/yocto/poky/meta/recipes-core/images/core-image-
minimal.bb, do_rootfs) failed with exit code '1'
..............

//Hongxu
Comment 4 Hongxu Jia 2015-06-02 02:11:29 UTC
This is rejected by RP:

...
This tells me what the change does. What it doesn't say is why we need
this?

Its a fairly invasive set of changes but I don't see the usecase...

Cheers,

Richard

...
Comment 5 Hongxu Jia 2015-06-02 02:11:32 UTC
*** Bug 5531 has been marked as a duplicate of this bug. ***
Comment 6 Paul Eggleton 2015-06-16 10:54:04 UTC
FWIW, Richard wasn't necessarily rejecting the entire idea of having this check, he was just concerned about how it was described and implemented. I think the heart of the problem is that the solution to this bug has become tied to the the one for bug 5531, however, the issue that 5531 describes is not quite the same - I'm not even sure that 5531 is practical to solve with the current state of our metadata.

I'm reopening this and I'd like us to try implement it such that it will warn 
if a package that is depended upon is not produced at packaging time, assuming that is practical to do.
Comment 7 Stephen K Jolley 2015-11-19 16:03:06 UTC
This was REOPENED
Comment 8 Randy MacLeod 2023-10-24 14:24:26 UTC
Bulk move from 4.99 or 0.00 to 5.99