]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
package_ipk/deb: Fix specific version handling
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 7 Apr 2022 16:33:21 +0000 (17:33 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 9 Apr 2022 21:51:12 +0000 (22:51 +0100)
We recently added a "xxx (= 1.2.3)" style dependency to a recipe and have
been having trouble with the opkg and debian backends with it.

The issues is that for debian, "=" really does mean equals and includes the
PR field. One bitbake recipe does not know the PR of another, nor shoud it.
In other words 1.2.3 != 1.2.3-r0. Debian defaults to a PR of "0", not our
"r0".

The only way I can think of to make this work is to change "=" dependencies
without revision information (no "-r" in the version) into things like:
"xxx (>= 1.2.3), xxx (<< 1.2.3.0)". This appears to work even if it is a
pretty horrible workaround.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/package_deb.bbclass
meta/classes/package_ipk.bbclass

index 2e75e222bcb28b3f22ad87c75870bb08b6728f2a..a9b8ba011847b038cb9867f3f0a12cd9c20b71b5 100644 (file)
@@ -182,7 +182,8 @@ def deb_write_pkg(pkg, d):
             #   '<' = less or equal
             #   '>' = greater or equal
             # adjust these to the '<<' and '>>' equivalents
-            #
+            # Also, "=" specifiers only work if they have the PR in, so 1.2.3 != 1.2.3-r0
+            # so to avoid issues, map this to ">= 1.2.3 << 1.2.3.0"
             for dep in list(var.keys()):
                 if '(' in dep or '/' in dep:
                     newdep = re.sub(r'[(:)/]', '__', dep)
@@ -197,6 +198,10 @@ def deb_write_pkg(pkg, d):
                         var[dep][i] = var[dep][i].replace("< ", "<< ")
                     elif (v or "").startswith("> "):
                         var[dep][i] = var[dep][i].replace("> ", ">> ")
+                    elif (v or "").startswith("= ") and "-r" not in v:
+                        ver = var[dep][i].replace("= ", "")
+                        var[dep][i] = var[dep][i].replace("= ", ">= ")
+                        var[dep].append("<< " + ver + ".0")
 
         rdepends = bb.utils.explode_dep_versions2(localdata.getVar("RDEPENDS") or "")
         debian_cmp_remap(rdepends)
index f67cb0e5c908bb865d2961555a20a63db08b1ee7..9fe3c52fae3539f6b9f78633689d787ad030ef34 100644 (file)
@@ -168,13 +168,18 @@ def ipk_write_pkg(pkg, d):
             #   '<' = less or equal
             #   '>' = greater or equal
             # adjust these to the '<<' and '>>' equivalents
-            #
+            # Also, "=" specifiers only work if they have the PR in, so 1.2.3 != 1.2.3-r0
+            # so to avoid issues, map this to ">= 1.2.3 << 1.2.3.0"
             for dep in var:
                 for i, v in enumerate(var[dep]):
                     if (v or "").startswith("< "):
                         var[dep][i] = var[dep][i].replace("< ", "<< ")
                     elif (v or "").startswith("> "):
                         var[dep][i] = var[dep][i].replace("> ", ">> ")
+                    elif (v or "").startswith("= ") and "-r" not in v:
+                        ver = var[dep][i].replace("= ", "")
+                        var[dep][i] = var[dep][i].replace("= ", ">= ")
+                        var[dep].append("<< " + ver + ".0")
 
         rdepends = bb.utils.explode_dep_versions2(localdata.getVar("RDEPENDS") or "")
         debian_cmp_remap(rdepends)