From 3ba177a1b8e553716f45606aa65b0a74e55d94c1 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 7 Apr 2022 17:33:21 +0100 Subject: 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. Signed-off-by: Richard Purdie --- meta/classes/package_deb.bbclass | 7 ++++++- meta/classes/package_ipk.bbclass | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass index 2e75e222bc..a9b8ba0118 100644 --- a/meta/classes/package_deb.bbclass +++ b/meta/classes/package_deb.bbclass @@ -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) diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass index f67cb0e5c9..9fe3c52fae 100644 --- a/meta/classes/package_ipk.bbclass +++ b/meta/classes/package_ipk.bbclass @@ -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) -- cgit 1.2.3-korg