Patchwork [05/12] package_deb/ipk: Remap < and > to << and >>

login
register
mail settings
Submitter Mark Hatle
Date Sept. 30, 2012, 12:19 a.m.
Message ID <f4656df3bfd9c6be360c20c3a2e10ac0a249a023.1348963477.git.mark.hatle@windriver.com>
Download mbox | patch
Permalink /patch/37483/
State Accepted
Commit bbcc78d8ff03725ce5b3b65ce24025c3da45f2ab
Headers show

Comments

Mark Hatle - Sept. 30, 2012, 12:19 a.m.
In deb and ipk, < means <=, while > means >=... there is a different
operator << and >> that means < and >, so we map them when constructing
the packages.

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

Patch

diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index 3b42d3b..a25e5d7 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -334,18 +334,36 @@  python do_package_deb () {
 
         mapping_rename_hook(localdata)
 
+        def debian_cmp_remap(var):
+            # 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 (var[dep] or "").startswith("< "):
+                    var[dep] = var[dep].replace("< ", "<< ")
+                elif (var[dep] or "").startswith("> "):
+                    var[dep] = var[dep].replace("> ", ">> ")
+
         rdepends = bb.utils.explode_dep_versions(localdata.getVar("RDEPENDS", True) or "")
+        debian_cmp_remap(rdepends)
         for dep in rdepends:
                 if '*' in dep:
                         del rdepends[dep]
         rrecommends = bb.utils.explode_dep_versions(localdata.getVar("RRECOMMENDS", True) or "")
+        debian_cmp_remap(rrecommends)
         for dep in rrecommends:
                 if '*' in dep:
                         del rrecommends[dep]
         rsuggests = bb.utils.explode_dep_versions(localdata.getVar("RSUGGESTS", True) or "")
+        debian_cmp_remap(rsuggests)
         rprovides = bb.utils.explode_dep_versions(localdata.getVar("RPROVIDES", True) or "")
+        debian_cmp_remap(rprovides)
         rreplaces = bb.utils.explode_dep_versions(localdata.getVar("RREPLACES", True) or "")
+        debian_cmp_remap(rreplaces)
         rconflicts = bb.utils.explode_dep_versions(localdata.getVar("RCONFLICTS", True) or "")
+        debian_cmp_remap(rconflicts)
         if rdepends:
             ctrlfile.write("Depends: %s\n" % unicode(bb.utils.join_deps(rdepends)))
         if rsuggests:
diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass
index 59cb856..281ce59 100644
--- a/meta/classes/package_ipk.bbclass
+++ b/meta/classes/package_ipk.bbclass
@@ -372,12 +372,30 @@  python do_package_ipk () {
 
         mapping_rename_hook(localdata)
 
+        def debian_cmp_remap(var):
+            # 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 (var[dep] or "").startswith("< "):
+                    var[dep] = var[dep].replace("< ", "<< ")
+                elif (var[dep] or "").startswith("> "):
+                    var[dep] = var[dep].replace("> ", ">> ")
+
         rdepends = bb.utils.explode_dep_versions(localdata.getVar("RDEPENDS", True) or "")
+        debian_cmp_remap(rdepends)
         rrecommends = bb.utils.explode_dep_versions(localdata.getVar("RRECOMMENDS", True) or "")
+        debian_cmp_remap(rrecommends)
         rsuggests = bb.utils.explode_dep_versions(localdata.getVar("RSUGGESTS", True) or "")
+        debian_cmp_remap(rsuggests)
         rprovides = bb.utils.explode_dep_versions(localdata.getVar("RPROVIDES", True) or "")
+        debian_cmp_remap(rprovides)
         rreplaces = bb.utils.explode_dep_versions(localdata.getVar("RREPLACES", True) or "")
+        debian_cmp_remap(rreplaces)
         rconflicts = bb.utils.explode_dep_versions(localdata.getVar("RCONFLICTS", True) or "")
+        debian_cmp_remap(rconflicts)
 
         if rdepends:
             ctrlfile.write("Depends: %s\n" % bb.utils.join_deps(rdepends))