Bug 9227

Summary: Dependency chain analysis isn't optimal
Product: [Build System, Metadata & Runtime] BitBake Reporter: Ross Burton <ross.burton>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: Low CC: poky.bs.watcher, poky.watcher
Version: 2.0   
Target Milestone: Future   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Ross Burton 2016-03-08 11:13:30 UTC
I managed to crash the dependency chain finding code with a "simple" metadata change.

In glibc:
BBCLASSEXTEND=native
DEPENDS_class-target=""

In base.bbclass, around INHIBIT_DEFAULT_DEPS add glibc-native if native.

Bitbaking something will then crash the dependency cycle code:

ERROR: An uncaught exception occured in runqueue, please see the failure below:
ERROR: Running idle function
Traceback (most recent call last):
 File "/home/ross/Yocto/poky/bitbake/lib/bb/runqueue.py", line 345, in find_chains(taskid=2, prev_chain=[0, 1, 7, 8, 4, 2]):
                    if scan:
   >                    find_chains(revdep, copy.deepcopy(prev_chain))
                    for dep in explored_deps[revdep]:
 File "/home/ross/Yocto/poky/bitbake/lib/bb/runqueue.py", line 345, in find_chains(taskid=5, prev_chain=[0, 1, 7, 8, 4, 2, 5]):
                    if scan:
   >                    find_chains(revdep, copy.deepcopy(prev_chain))
                    for dep in explored_deps[revdep]:
 File "/home/ross/Yocto/poky/bitbake/lib/bb/runqueue.py", line 345, in find_chains(taskid=67, prev_chain=[0, 1, 7, 8, 4, 2, 5, 67]):
                    if scan:
   >                    find_chains(revdep, copy.deepcopy(prev_chain))
                    for dep in explored_deps[revdep]:
 File "/home/ross/Yocto/poky/bitbake/lib/bb/runqueue.py", line 345, in find_chains(taskid=68, prev_chain=[0, 1, 7, 8, 4, 2, 5, 67, 68]):
                    if scan:
   >                    find_chains(revdep, copy.deepcopy(prev_chain))
                    for dep in explored_deps[revdep]:
 File "/home/ross/Yocto/poky/bitbake/lib/bb/runqueue.py", line 346, in find_chains(taskid=64, prev_chain=[0, 1, 7, 8, 4, 2, 5, 67, 68, 64]):
                        find_chains(revdep, copy.deepcopy(prev_chain))
   >                for dep in explored_deps[revdep]:
                        if dep not in total_deps:
KeyError: 65
Comment 1 Ross Burton 2016-03-08 11:14:50 UTC
I'm reliably informed that page 1015 of Advanced Engineering Mathematics by Kryzig covers shortest path problems.
Comment 2 Richard Purdie 2019-02-17 10:32:11 UTC
I applied:

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 9eda11ad048..209a7b734a4 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -70,6 +70,7 @@ BASE_DEFAULT_DEPS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compile
 BASEDEPENDS = ""
 BASEDEPENDS_class-target = "${@base_dep_prepend(d)}"
 BASEDEPENDS_class-nativesdk = "${@base_dep_prepend(d)}"
+BASEDEPENDS_class-native = "glibc-native"
 
 DEPENDS_prepend="${BASEDEPENDS} "
 
diff --git a/meta/recipes-core/glibc/glibc_2.29.bb b/meta/recipes-core/glibc/glibc_2.29.bb
index 72db00cdb77..572f7146c93 100644
--- a/meta/recipes-core/glibc/glibc_2.29.bb
+++ b/meta/recipes-core/glibc/glibc_2.29.bb
@@ -131,4 +131,6 @@ do_compile () {
 
 require glibc-package.inc
 
-BBCLASSEXTEND = "nativesdk"
+BBCLASSEXTEND = "nativesdk native"
+DEPENDS_class-native = ""
+INHIBIT_DEFAULT_DEPS_class-native = "1"

and just got dependency loops which exited after 10 loops were found (recent fix). Closing as this appears to work now.