package_ipk/deb: Fix specific version handling

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.

(From OE-Core rev: 3ba177a1b8e553716f45606aa65b0a74e55d94c1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2022-04-07 17:33:21 +01:00
parent 3d4e5a0b7f
commit 21f0318abc
2 changed files with 12 additions and 2 deletions

View 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)

View 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)