Bug 5094

Summary: Check whether multiple versions of the same PN are due to be built
Product: [Build System, Metadata & Runtime] BitBake Reporter: Robert Yang <liezhi.yang>
Component: bitbakeAssignee: Robert Yang <liezhi.yang>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: jessica.zhang, poky.bs.watcher, poky.watcher, razvanx.ionescu, richard.purdie, sgw
Version: 1.5   
Target Milestone: 1.5 M5   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Robert Yang 2013-09-02 07:36:35 UTC
There would be an race issue if we:

$ bitbake make-3.81 make-3.82

This because they are being built at the same time which would cause unexpected problems, for example such an error:

ERROR: Package already staged (/buildarea/lyang1/build3/tmp/sstate-control/manifest-qemux86-make.populate-sysroot)?!
ERROR: Function failed: sstate_task_postfunc
ERROR: Logfile of failure stored in: /buildarea/lyang1/build3/tmp/work/i586-poky-linux/make/3.82-r3/temp/log.do_populate_sysroot.6565

Or there would be python's strack trace such as:

[snip]
 *** 0004:    mfile = open(manifest)
     0005:    entries = mfile.readlines()
     0006:    mfile.close()
     0007:
     0008:    for entry in entries:
Exception: IOError: [Errno 2] No such file or directory: xxx
[snip]

I think that we can quite earlier, the following patch would fix the problem:

diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 197308f..6a80619 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -702,7 +702,17 @@ class RunQueueData:
                 else:
                     msg += "\n This usually means one provides something the other doesn't and should."
                     logger.error(msg)
-
+                # Check whether multiple versions of the same PN are due to be
+                # built, for example:
+                # <pn>-1.0
+                # <pn>-2.0
+                seen_pn = []
+                for fn in prov_list[prov]:
+                    pn = self.dataCache.pkg_fn[fn]
+                    if pn not in seen_pn:
+                        seen_pn.append(pn)
+                    else:
+                        bb.fatal("Multiple versions of %s are due to be built." % pn)
 
         # Create a whitelist usable by the stamp checks
         stampfnwhitelist = []
Comment 2 Razvan Ionescu 2013-10-02 10:59:13 UTC
Verified with poky: 87771db34c660c82333bb47a17b31f18bbffe776

bitbake make-3.81 make-3.82


returns the following error message as expected:

ERROR: Multiple versions of make are due to be built (/home/razvan/yocto_work/pokytests/meta/recipes-devtools/make/make_3.81.bb /home/razvan/yocto_work/pokytests/meta/recipes-devtools/make/make_3.82.bb). Only one version of a given PN should be built in any given build. You likely need to set PREFERRED_VERSION_make to select the correct version or don't depend on multiple versions.

Summary: There was 1 ERROR message shown, returning a non-zero exit code.