Patchwork [bitbake-devel,1/2] utils.py: Check for duplication dependency entries

login
register
mail settings
Submitter Mark Hatle
Date Sept. 28, 2012, 5:27 p.m.
Message ID <1348853270-29676-1-git-send-email-mark.hatle@windriver.com>
Download mbox | patch
Permalink /patch/37449/
State New
Headers show

Comments

Mark Hatle - Sept. 28, 2012, 5:27 p.m.
explode_dep_versions is not able to have duplicate entries.  Previously
duplicate entries ended up with the last item being the one returned to
the caller.

Instead we now throw a ValueType exception.  This will ensure the caller
always gets the full set of declared dependencies.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
 lib/bb/utils.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Mark Hatle - Sept. 28, 2012, 8:17 p.m.
BTW I found a case in OE where duplicates were being unintentionally added by 
the package.bbclass.  I'll have a patch for this sometime in the new few hours.

--Mark

On 9/28/12 12:27 PM, Mark Hatle wrote:
> explode_dep_versions is not able to have duplicate entries.  Previously
> duplicate entries ended up with the last item being the one returned to
> the caller.
>
> Instead we now throw a ValueType exception.  This will ensure the caller
> always gets the full set of declared dependencies.
>
> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
> ---
>   lib/bb/utils.py |    2 ++
>   1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/lib/bb/utils.py b/lib/bb/utils.py
> index 82dab6b..fa5d2ab 100644
> --- a/lib/bb/utils.py
> +++ b/lib/bb/utils.py
> @@ -159,6 +159,8 @@ def explode_dep_versions(s):
>               lastver = lastver + " " + (i[:-1] or "")
>               r[lastdep] = lastver
>           elif not inversion:
> +            if i in r:
> +                raise ValueError("Error, item %s appeared in dependency string '%s' multiple times.  explode_dep_versions cannot cope with this." % (i, s))
>               r[i] = None
>               lastdep = i
>               lastver = ""
>

Patch

diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 82dab6b..fa5d2ab 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -159,6 +159,8 @@  def explode_dep_versions(s):
             lastver = lastver + " " + (i[:-1] or "")
             r[lastdep] = lastver
         elif not inversion:
+            if i in r:
+                raise ValueError("Error, item %s appeared in dependency string '%s' multiple times.  explode_dep_versions cannot cope with this." % (i, s))
             r[i] = None
             lastdep = i
             lastver = ""