utils.py: Add option for explode_dep_versions2
v2 cover utils.py: Add option for explode_dep_versions2
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(-)
Signature · 1 line
2.16.0
PATCH v2 1/1 utils.py: Add option for explode_dep_versions2 to return unsorted
From: Amanda Brindle <[email protected]>
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.
--- lib/bb/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/bb/utils.py +3 -2
@@ -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):
Signature · 1 line
2.16.0
Re: [PATCH V2 1/1] utils.py: Add option for explode_dep_versions2 to return unsorted
Quoted 25 lines · Stephano Cetola
From: Amanda Brindle <[email protected]>
Before,
explode_dep_versions2would 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 <[email protected]>Acked-by Stephano Cetola <[email protected]>---
lib/bb/utils.py | 5 +++--1 file changed, 3 insertions(+), 2 deletions(-)lib/bb/utils.py +0
-0@@ -187,7 +187,7 @@ def explode_deps(s): #r[-1] += ' ' + ' '.join(j)return r
lib/bb/utils.py +1
-1-def explode_dep_versions2(s): +def explode_dep_versions2(s, unsorted=False):
Quoted 1 line
"""
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
Re: [PATCH V2 1/1] utils.py: Add option for explode_dep_versions2 to return unsorted
Quoted 30 lines · Richard Purdie
Quoted 20 lines · Stephano Cetola
From: Amanda Brindle <[email protected]>
Before,
explode_dep_versions2would 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 <[email protected]>Acked-by Stephano Cetola <[email protected]>--- lib/bb/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)lib/bb/utils.py +0
-0lib/bb/utils.py def explode_deps(s): · line 191
Quoted 6 lines
lib/bb/utils.py +1
-1@@ -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:
Quoted 5 lines
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.
Signature · 4 lines
Christopher Larson kergoth at gmail dot com Founder - BitBake, OpenEmbedded, OpenZaurus Senior Software Engineer, Mentor Graphics