All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/1] utils.py: Add option for explode_dep_versions2
@ 2018-02-19 18:15 Stephano Cetola
  2018-02-19 18:15 ` [PATCH V2 1/1] utils.py: Add option for explode_dep_versions2 to return unsorted Stephano Cetola
  0 siblings, 1 reply; 4+ messages in thread
From: Stephano Cetola @ 2018-02-19 18:15 UTC (permalink / raw)
  To: bitbake-devel

Changes since V1:
applied to bitbake tree rather than poky-contrib
updated subject to reference utils.py rather than bitbake

This patch is required for a fix to buildhistory.

See [YOCTO #12334] for details.

Amanda Brindle (1):
  utils.py: Add option for explode_dep_versions2 to return unsorted

 lib/bb/utils.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
2.16.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH V2 1/1] utils.py: Add option for explode_dep_versions2 to return unsorted
  2018-02-19 18:15 [PATCH V2 0/1] utils.py: Add option for explode_dep_versions2 Stephano Cetola
@ 2018-02-19 18:15 ` Stephano Cetola
  2018-02-20 12:08   ` Richard Purdie
  0 siblings, 1 reply; 4+ messages in thread
From: Stephano Cetola @ 2018-02-19 18:15 UTC (permalink / raw)
  To: bitbake-devel

From: Amanda Brindle <amanda.r.brindle@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@intel.com>
Acked-by: Stephano Cetola <stephano.cetola@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):
     """
     Take an RDEPENDS style string of format:
     "DEPEND1 (optional version) DEPEND2 (optional version) ..."
@@ -250,7 +250,8 @@ def explode_dep_versions2(s):
         if not (i in r and r[i]):
             r[lastdep] = []
 
-    r = collections.OrderedDict(sorted(r.items(), key=lambda x: x[0]))
+    if not unsorted:
+        r = collections.OrderedDict(sorted(r.items(), key=lambda x: x[0]))
     return r
 
 def explode_dep_versions(s):
-- 
2.16.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V2 1/1] utils.py: Add option for explode_dep_versions2 to return unsorted
  2018-02-19 18:15 ` [PATCH V2 1/1] utils.py: Add option for explode_dep_versions2 to return unsorted Stephano Cetola
@ 2018-02-20 12:08   ` Richard Purdie
  2018-02-20 15:14     ` Christopher Larson
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2018-02-20 12:08 UTC (permalink / raw)
  To: Stephano Cetola, bitbake-devel

On Mon, 2018-02-19 at 10:15 -0800, Stephano Cetola wrote:
> From: Amanda Brindle <amanda.r.brindle@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@intel.com>
> Acked-by: Stephano Cetola <stephano.cetola@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.

Cheers,

Richard




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V2 1/1] utils.py: Add option for explode_dep_versions2 to return unsorted
  2018-02-20 12:08   ` Richard Purdie
@ 2018-02-20 15:14     ` Christopher Larson
  0 siblings, 0 replies; 4+ messages in thread
From: Christopher Larson @ 2018-02-20 15:14 UTC (permalink / raw)
  To: Richard Purdie; +Cc: bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 1774 bytes --]

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

> On Mon, 2018-02-19 at 10:15 -0800, Stephano Cetola wrote:
> > From: Amanda Brindle <amanda.r.brindle@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@intel.com>
> > Acked-by: Stephano Cetola <stephano.cetola@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

[-- Attachment #2: Type: text/html, Size: 2656 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-20 15:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-19 18:15 [PATCH V2 0/1] utils.py: Add option for explode_dep_versions2 Stephano Cetola
2018-02-19 18:15 ` [PATCH V2 1/1] utils.py: Add option for explode_dep_versions2 to return unsorted Stephano Cetola
2018-02-20 12:08   ` Richard Purdie
2018-02-20 15:14     ` Christopher Larson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.