Patchwork [19/22] package_deb: Dependencies with a ( or ) in them are invalid in debs

login
register
mail settings
Submitter Mark Hatle
Date Dec. 4, 2012, 5:14 p.m.
Message ID <0902d41db63ca4eed506d919a41752e1a28072cf.1354641032.git.mark.hatle@windriver.com>
Download mbox | patch
Permalink /patch/40325/
State Accepted
Commit 12acb6bb00ba665571fcfbdb0ef4668ca0a98d5b
Headers show

Comments

Mark Hatle - Dec. 4, 2012, 5:14 p.m.
Replace ( or ) with __.  This allows RPM style dependencies to be satisfied
in deb style packages.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
 meta/classes/package_deb.bbclass |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

Patch

diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index d273cb0..eed9b8a 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -335,12 +335,22 @@  python do_package_deb () {
         mapping_rename_hook(localdata)
 
         def debian_cmp_remap(var):
+            # dpkg does not allow for '(' or ')' in a dependency name
+            # replace these instances with '__' and '__'
+            #
             # In debian '>' and '<' do not mean what it appears they mean
             #   '<' = less or equal
             #   '>' = greater or equal
             # adjust these to the '<<' and '>>' equivalents
             #
             for dep in var:
+                if '(' in dep:
+                    newdep = dep.replace('(', '__')
+                    newdep = newdep.replace(')', '__')
+                    if newdep != dep:
+                        var[newdep] = var[dep]
+                        del var[dep]
+            for dep in var:
                 for i, v in enumerate(var[dep]):
                     if (v or "").startswith("< "):
                         var[dep][i] = var[dep][i].replace("< ", "<< ")