Patchwork [bitbake-devel,1/1] runqueue.py: check whether multiple versions of the same PN are due to be built

login
register
mail settings
Submitter Robert Yang
Date Sept. 2, 2013, 1:47 p.m.
Message ID <38a257cf48a0e83f75352c5f3eff36c305b48d09.1378129369.git.liezhi.yang@windriver.com>
Download mbox | patch
Permalink /patch/57231/
State New
Headers show

Comments

Robert Yang - Sept. 2, 2013, 1:47 p.m.
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:

[snip]
ERROR: Package already staged (/path/to/tmp/sstate-control/manifest-qemux86-make.populate-sysroot)?!
ERROR: Function failed: sstate_task_postfunc
[snip]

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]

[YOCTO #5094]

I think that we can quite earlier to fix the problem.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 bitbake/lib/bb/runqueue.py |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
Richard Purdie - Sept. 9, 2013, 3:29 p.m.
On Mon, 2013-09-02 at 09:47 -0400, Robert Yang wrote:
> 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:
> 
> [snip]
> ERROR: Package already staged (/path/to/tmp/sstate-control/manifest-qemux86-make.populate-sysroot)?!
> ERROR: Function failed: sstate_task_postfunc
> [snip]
> 
> 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]
> 
> [YOCTO #5094]
> 
> I think that we can quite earlier to fix the problem.
> 
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>

I've merged this although I did move the code and change the error
message wording a little so the output is less confusing to the user.

Cheers,

Richard

Patch

diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 0700a5b..c77cb85 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 = []