Patchwork [1/1] sstate.bbclass: check before open the manifest

login
register
mail settings
Submitter Robert Yang
Date Aug. 31, 2013, 10:51 a.m.
Message ID <5221CAA0.60601@windriver.com>
Download mbox | patch
Permalink /patch/57159/
State New
Headers show

Comments

Robert Yang - Aug. 31, 2013, 10:51 a.m.
Hi RP,

Thanks, I've made a draft patch for fixing why make-3.82 is being built,
the problem is that when we run "bitbake make-3.81":
- For 'make' itself, it will build make_3.81.bb
- But for make-dev/dbg, it will build make_3.82.bb since there is no
PREFERRED_VERSION and it will use the highest version.

This draft patch sets the PREFERRED_VERSION for the pkg and will fix the
problem, I will send it to bitbake-devel later.

cfgData, dataCache)
          eligible = [p for p in eligible if not self.getfn_id(p) in 
self.failed_fnids]

// Robert

On 08/30/2013 11:29 PM, Richard Purdie wrote:
> On Fri, 2013-08-30 at 09:24 +0800, Robert Yang wrote:
>>
>> On 08/30/2013 01:00 AM, Richard Purdie wrote:
>>> On Thu, 2013-08-29 at 09:13 -0400, Robert Yang wrote:
>>>> The python stack trace would be printed if we:
>>>>
>>>> $ bitbake make (the make-3.82 will be built)
>>>> // Edit make.inc
>>>> $ bitbake make-3.81
>>>
>>> This is at best hiding the real problem. Why is bitbake building
>>> make-3.82 when you asked for make-3.81?
>>>
>>> I tried this here and also see the warning:
>>>
>>> ERROR: Multiple .bb files are due to be built which each provide make
>>> (/media/build1/poky/meta/recipes-devtools/make/make_3.81.bb /media/build1/poky/meta/recipes-devtools/make/make_3.82.bb).
>>>    This usually means one provides something the other doesn't and should.
>>>
>>> so bitbake is basically telling you there is a problem already. So there
>>> are two issues:
>>>
>>
>> What I thought was that let the user know the normal error, but we can do
>> more to fix it as you pointed out.
>>
>>> a) Why is make 3.82 being built?
>>
>> Ah, yes, that's problem, I will do more investigation.
>>
>>> b) If multiple identical PNs are being built we probably should hard
>>> error out since its not supported in the slightest. The sstate race you
>>> mention is the least of the problems :(.
>>>
>>
>> OK, I will try to fix such a case:
>>
>> bitbake make-3.81 make-3.82
>
> I think this should just give an error.
>
> Cheers,
>
> Richard
>
>
>
Otavio Salvador - Aug. 31, 2013, 10:07 p.m.
On Sat, Aug 31, 2013 at 7:51 AM, Robert Yang <liezhi.yang@windriver.com> wrote:
>
> Hi RP,
>
> Thanks, I've made a draft patch for fixing why make-3.82 is being built,
> the problem is that when we run "bitbake make-3.81":
> - For 'make' itself, it will build make_3.81.bb
> - But for make-dev/dbg, it will build make_3.82.bb since there is no
> PREFERRED_VERSION and it will use the highest version.
>
> This draft patch sets the PREFERRED_VERSION for the pkg and will fix the
> problem, I will send it to bitbake-devel later.

Nice discovery :-) This does seem to address a core issue.

> diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py
> index 58fe199..fc8ee6d 100644
> --- a/bitbake/lib/bb/taskdata.py
> +++ b/bitbake/lib/bb/taskdata.py
> @@ -429,6 +429,22 @@ class TaskData:
>              return
>
>          all_p = dataCache.providers[item]
> +        logger.warn("pppreferred: %s" % dataCache.preferred)
> +
> +        # 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)

I understand the problem here but maybe this should be checked in
bitbake and avoid iterate in all packages?
Robert Yang - Sept. 2, 2013, 1:59 a.m.
On 09/01/2013 06:07 AM, Otavio Salvador wrote:
> On Sat, Aug 31, 2013 at 7:51 AM, Robert Yang <liezhi.yang@windriver.com> wrote:
>>
>> Hi RP,
>>
>> Thanks, I've made a draft patch for fixing why make-3.82 is being built,
>> the problem is that when we run "bitbake make-3.81":
>> - For 'make' itself, it will build make_3.81.bb
>> - But for make-dev/dbg, it will build make_3.82.bb since there is no
>> PREFERRED_VERSION and it will use the highest version.
>>
>> This draft patch sets the PREFERRED_VERSION for the pkg and will fix the
>> problem, I will send it to bitbake-devel later.
>
> Nice discovery :-) This does seem to address a core issue.
>
>> diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py
>> index 58fe199..fc8ee6d 100644
>> --- a/bitbake/lib/bb/taskdata.py
>> +++ b/bitbake/lib/bb/taskdata.py
>> @@ -429,6 +429,22 @@ class TaskData:
>>               return
>>
>>           all_p = dataCache.providers[item]
>> +        logger.warn("pppreferred: %s" % dataCache.preferred)
>> +
>> +        # 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)
>
> I understand the problem here but maybe this should be checked in
> bitbake and avoid iterate in all packages?
>

Yes, you are right, it should be sent to bitbake-devel mailing list,
and I'm trying to avoid iterating in all packages.

// Robert

Patch

diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py
index 58fe199..fc8ee6d 100644
--- a/bitbake/lib/bb/taskdata.py
+++ b/bitbake/lib/bb/taskdata.py
@@ -429,6 +429,22 @@  class TaskData:
              return

          all_p = dataCache.providers[item]
+        logger.warn("pppreferred: %s" % dataCache.preferred)
+
+        # 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,