[OE-core] v2 [PATCH 2/2] sanity.bbclass: Implement initial toolchain sanity checks

Peter Seebach peter.seebach at windriver.com
Mon Apr 30 16:59:48 UTC 2012


On Sat, 28 Apr 2012 16:42:31 -0700
Khem Raj <raj.khem at gmail.com> wrote:

> > +    valid_tunes = data.getVarFlags('TUNEVALID') or ""
> > +    conflicts = data.getVarFlags('TUNECONFLICTS') or ""
> > +    split_conflicts = {}
> > +    for feature in features:
> > +        if feature in conflicts:
> > +            if feature not in split_conflicts:
> > +                split_conflicts[feature] =
> > conflicts[feature].split()
> > +            for other in features:
> > +                if other in split_conflicts[feature]:
> > +                    tune_errors.append("Feature '%s' conflicts
> > with '%s'." %
> > +                        ( feature, other ))
> > +        if feature in valid_tunes:
> > +            bb.note("  %s: %s" % (feature, valid_tunes[feature]))
> > +        else:
> > +            tune_errors.append("Feature '%s' is not defined." %
> > feature)  

Using sets seems a little like overkill, because I really do want to
check specifically which features are in conflict.  That said:

> > +    valid_tunes = data.getVarFlags('TUNEVALID') or ""
> > +    conflicts = data.getVarFlags('TUNECONFLICTS') or ""
> > +    split_conflicts = {}
> > +    for feature in features:
> > +        if feature in conflicts:
> > +            for conflict in conflicts[feature].split():
> > +                if conflict in features:
> > +                    tune_errors.append("Feature '%s' conflicts
> > with '%s'." %
> > +                        ( feature, conflict ))
> > +        if feature in valid_tunes:
> > +            bb.note("  %s: %s" % (feature, valid_tunes[feature]))
> > +        else:
> > +            tune_errors.append("Feature '%s' is not defined." %
> > feature)

I can drop the "optimization" of caching the split results, since I
believe most features only have one conflict anyway, and Python may
well be optimizing it for me.

Basically, the first part is "for each feature, if it has any 
conflicts,check them against all the other features."

My original thought had been to write this the way I did the whitelist,
something like:

if True in [x in features for x in conflicts[feature].split()]

but this wouldn't let me diagnose which feature conflicted.  So when I
started on this, I was thinking that I had to know which feature I'd
found in the conflicts list, but of course, the entries in the
conflicts list *are* the features.  So I could simplify it as above.

-s
-- 
Listen, get this.  Nobody with a good compiler needs to be justified.




More information about the Openembedded-core mailing list