[bitbake-devel] [PATCH V2 1/1] utils.py: Add option for explode_dep_versions2 to return unsorted

Christopher Larson kergoth at gmail.com
Tue Feb 20 15:14:31 UTC 2018


On Tue, Feb 20, 2018 at 5:08 AM, Richard Purdie <
richard.purdie at linuxfoundation.org> wrote:

> On Mon, 2018-02-19 at 10:15 -0800, Stephano Cetola wrote:
> > From: Amanda Brindle <amanda.r.brindle at intel.com>
> >
> > Before, explode_dep_versions2 would sort the OrderedDict before
> > returning. This function will still sort the OrderedDict by default,
> > but
> > will now have the option to return the OrderedDict unsorted. This
> > option will
> > allow us to check if the order of the package list has changed.
> >
> > Signed-off-by: Amanda Brindle <amanda.r.brindle at intel.com>
> > Acked-by: Stephano Cetola <stephano.cetola at linux.intel.com>
> > ---
> >  lib/bb/utils.py | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/bb/utils.py b/lib/bb/utils.py
> > index c540b49c..7adb4690 100644
> > --- a/lib/bb/utils.py
> > +++ b/lib/bb/utils.py
> > @@ -187,7 +187,7 @@ def explode_deps(s):
> >              #r[-1] += ' ' + ' '.join(j)
> >      return r
> >
> > -def explode_dep_versions2(s):
> > +def explode_dep_versions2(s, unsorted=False):
> >      """
>
> Would:
>
> def explode_dep_versions2(s, sorted=True):
>
> make things easier to read/understand?
>
> The 'double' logic there currently confuses me a bit.


sorted=True seems clearer to me as well. I’d also recommend thinking about
making this a keyword-only argument, for readability’s sake.

explode_dep_versions2(s, False) reads pretty unclear, since it loses the
info about the meaning of False. Making it keyword only would ensure we’re
forced to called it as sorted=False instead.
-- 
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20180220/4f69725e/attachment-0002.html>


More information about the bitbake-devel mailing list