All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] utils.py: Check for duplication dependency entries
@ 2012-09-28 17:27 Mark Hatle
  2012-09-28 17:27 ` [PATCH 2/2] utils.py: explode_dep_version - add ability to deal with whitespace Mark Hatle
  2012-09-28 20:17 ` [PATCH 1/2] utils.py: Check for duplication dependency entries Mark Hatle
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Hatle @ 2012-09-28 17:27 UTC (permalink / raw)
  To: bitbake-devel

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 = ""
-- 
1.7.3.4




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

* [PATCH 2/2] utils.py: explode_dep_version - add ability to deal with whitespace
  2012-09-28 17:27 [PATCH 1/2] utils.py: Check for duplication dependency entries Mark Hatle
@ 2012-09-28 17:27 ` Mark Hatle
  2012-09-28 20:17 ` [PATCH 1/2] utils.py: Check for duplication dependency entries Mark Hatle
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Hatle @ 2012-09-28 17:27 UTC (permalink / raw)
  To: bitbake-devel

Add the ability to deal with arbitrary whitespace.  Support the comparison
operators of: <, >, =, <=, >=, =<, =>, <<, >>, ==, and !=.

This list was generated based on behavior of deb, opkg and rpm.

Note, In OE the last six are not expected to be supported, but someone
may try to use them.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
 lib/bb/utils.py |   56 +++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index fa5d2ab..3a18a39 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -148,24 +148,52 @@ def explode_dep_versions(s):
     l = s.replace(",", "").split()
     lastdep = None
     lastver = ""
+    incmp = False
     inversion = False
     for i in l:
         if i[0] == '(':
+            incmp = True
+            i = i[1:].strip()
+            if not i:
+                continue
+
+        if incmp:
+            incmp = False
             inversion = True
-            lastver = i[1:] or ""
-            #j = []
-        elif inversion and i.endswith(')'):
-            inversion = False
-            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 = ""
-        elif inversion:
-            lastver = lastver + " " + i
+            # This list is based on behavior and supported comparisons from deb, opkg and rpm.
+            #
+            # Even though =<, <<, ==, !=, =>, and >> may not be supported, 
+            # we list each possibly valid item. 
+            # The build system is responsible for validation of what it supports.
+            if i.startswith(('<=', '=<', '<<', '==', '!=', '>=', '=>', '>>')):
+                lastver = i[0:2]
+                i = i[2:]
+            elif i.startswith(('<', '>', '=')):
+                lastver = i[0:1]
+                i = i[1:]
+            else:
+                # This is an unsupported case!
+                lastver = (i or "")
+                i = ""
+            i.strip()
+            if not i:
+                continue
+
+        if inversion:
+            if i.endswith(')'):
+                i = i[:-1] or ""
+                inversion = False
+            if i:
+                lastver = lastver + " " + (i or "")
+                r[lastdep] = lastver
+            continue
+
+        #if 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 = ""
 
     return r
 
-- 
1.7.3.4




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

* Re: [PATCH 1/2] utils.py: Check for duplication dependency entries
  2012-09-28 17:27 [PATCH 1/2] utils.py: Check for duplication dependency entries Mark Hatle
  2012-09-28 17:27 ` [PATCH 2/2] utils.py: explode_dep_version - add ability to deal with whitespace Mark Hatle
@ 2012-09-28 20:17 ` Mark Hatle
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Hatle @ 2012-09-28 20:17 UTC (permalink / raw)
  To: bitbake-devel

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 = ""
>




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

end of thread, other threads:[~2012-09-28 20:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-28 17:27 [PATCH 1/2] utils.py: Check for duplication dependency entries Mark Hatle
2012-09-28 17:27 ` [PATCH 2/2] utils.py: explode_dep_version - add ability to deal with whitespace Mark Hatle
2012-09-28 20:17 ` [PATCH 1/2] utils.py: Check for duplication dependency entries Mark Hatle

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.