Patchwork package_deb.bbclass: don't handle advanced dependency marker as version number

login
register
mail settings
Submitter Marko Lindqvist
Date May 10, 2012, 1:41 a.m.
Message ID <1336614104-1825-1-git-send-email-cazfi74@gmail.com>
Download mbox | patch
Permalink /patch/27429/
State New
Headers show

Comments

Marko Lindqvist - May 10, 2012, 1:41 a.m.
Strip advanced dependency markers away from Provides before writing
them to control file. Left in place they would mean package version
number in control file format.

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 meta/classes/package_deb.bbclass |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
Saul Wold - May 10, 2012, 4 a.m.
On 05/09/2012 06:41 PM, Marko Lindqvist wrote:
> Strip advanced dependency markers away from Provides before writing
> them to control file. Left in place they would mean package version
> number in control file format.
>
> Signed-off-by: Marko Lindqvist<cazfi74@gmail.com>
> ---
>   meta/classes/package_deb.bbclass |   19 ++++++++++++++++++-
>   1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
> index dc0f963..c51bf3c 100644
> --- a/meta/classes/package_deb.bbclass
> +++ b/meta/classes/package_deb.bbclass
> @@ -206,6 +206,23 @@ python do_package_deb () {
>       import re, copy
>       import textwrap
>
> +    def deb_explode_dep_ver(varname):
> +        # Remove markers from string so they won't get handled as version numbers
> +        depstr = localdata.getVar(varname, True) or ""
> +        start = depstr.find("(")
> +        while start != -1:
> +            # We are not searching ")" from full string in case it's malformed in a way
> +            # that first ")" is before first "("
> +            endstr = depstr[start:len(depstr)]
> +            end = endstr.find(")")
> +            if (end == len(endstr) - 1) or (end == -1):
> +                tmpstr = depstr[0:start]
> +            else:
> +                tmpstr = depstr[0:start] + depstr[start+end+1:len(depstr)]
> +            depstr = tmpstr
> +            start = depstr.find("(")
> +        return bb.utils.explode_dep_versions(depstr)
> +
>       workdir = d.getVar('WORKDIR', True)
>       if not workdir:
>           bb.error("WORKDIR not defined, unable to package")
> @@ -341,7 +358,7 @@ python do_package_deb () {
>                   if '*' in dep:
>                           del rrecommends[dep]
>           rsuggests = bb.utils.explode_dep_versions(localdata.getVar("RSUGGESTS", True) or "")
> -        rprovides = bb.utils.explode_dep_versions(localdata.getVar("RPROVIDES", True) or "")
> +        rprovides = deb_explode_dep_ver("RPROVIDES")
>           rreplaces = bb.utils.explode_dep_versions(localdata.getVar("RREPLACES", True) or "")
>           rconflicts = bb.utils.explode_dep_versions(localdata.getVar("RCONFLICTS", True) or "")
>           if rdepends:

Marko, Just to let you know that worked much better!

Thanks

Sau!

Patch

diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index dc0f963..c51bf3c 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -206,6 +206,23 @@  python do_package_deb () {
     import re, copy
     import textwrap
 
+    def deb_explode_dep_ver(varname):
+        # Remove markers from string so they won't get handled as version numbers
+        depstr = localdata.getVar(varname, True) or ""
+        start = depstr.find("(")
+        while start != -1:
+            # We are not searching ")" from full string in case it's malformed in a way
+            # that first ")" is before first "("
+            endstr = depstr[start:len(depstr)]
+            end = endstr.find(")")
+            if (end == len(endstr) - 1) or (end == -1):
+                tmpstr = depstr[0:start]
+            else:
+                tmpstr = depstr[0:start] + depstr[start+end+1:len(depstr)]
+            depstr = tmpstr
+            start = depstr.find("(")
+        return bb.utils.explode_dep_versions(depstr)
+
     workdir = d.getVar('WORKDIR', True)
     if not workdir:
         bb.error("WORKDIR not defined, unable to package")
@@ -341,7 +358,7 @@  python do_package_deb () {
                 if '*' in dep:
                         del rrecommends[dep]
         rsuggests = bb.utils.explode_dep_versions(localdata.getVar("RSUGGESTS", True) or "")
-        rprovides = bb.utils.explode_dep_versions(localdata.getVar("RPROVIDES", True) or "")
+        rprovides = deb_explode_dep_ver("RPROVIDES")
         rreplaces = bb.utils.explode_dep_versions(localdata.getVar("RREPLACES", True) or "")
         rconflicts = bb.utils.explode_dep_versions(localdata.getVar("RCONFLICTS", True) or "")
         if rdepends: