[bitbake-devel] [PATCH 2/2] taskdata.py: set PREFERRED_VERSION when it is in the item

Robert Yang liezhi.yang at windriver.com
Mon Sep 2 13:41:20 UTC 2013


There is an error if we:

$ bitbake make (the make-3.82 will be built)
// Edit make.inc
$ bitbake make-3.81
[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]

Set the PREFERRED_VERSION if we find the version info in the item would fix the
problem, I think that we need iterate in all the packages since it seems that
we can't know wether the item is just a PN or PN-PV unless we compare them,
what can I think is check len(all_p) == 1, but this doesn't work when the same
recipe is multiple layers.

[YOCTO #5067]

Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
 bitbake/lib/bb/taskdata.py |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py
index 58fe199..38a3191 100644
--- a/bitbake/lib/bb/taskdata.py
+++ b/bitbake/lib/bb/taskdata.py
@@ -430,6 +430,21 @@ class TaskData:
 
         all_p = dataCache.providers[item]
 
+        # Check whether item has the one of following formats and set the
+        # PREFERRED_VERSION if it does:
+        # - <pn>-<pv>
+        # - <pn>-<pv>-<pr> (when no PE)
+        # - <pn>-<pe>_<pv>-<pr> (when PE)
+        for fn in all_p:
+            pn = dataCache.pkg_fn[fn]
+            pe = dataCache.pkg_pepvpr[fn][0]
+            pv = dataCache.pkg_pepvpr[fn][1]
+            pr = dataCache.pkg_pepvpr[fn][2]
+            if not pe and (item == "%s-%s" % (pn, pv) or item == "%s-%s-%s" % (pn, pv, pr)):
+                cfgData.setVar("PREFERRED_VERSION_" + pn, pv)
+            elif pe and item == "%s-%s_%s-%s" % (pn, pe, pv, pr):
+                cfgData.setVar("PREFERRED_VERSION_" + pn, pv)
+
         eligible, foundUnique = bb.providers.filterProviders(all_p, item, cfgData, dataCache)
         eligible = [p for p in eligible if not self.getfn_id(p) in self.failed_fnids]
 
-- 
1.7.10.4




More information about the bitbake-devel mailing list