From: Martin Jansa <martin.jansa@gmail.com>
To: bitbake-devel@lists.openembedded.org
Subject: Re: [1.40][PATCH] bitbake: fix version comparison when one of the versions ends in .
Date: Sat, 15 Jun 2019 09:24:09 +0200 [thread overview]
Message-ID: <20190615072409.GA1486@jama> (raw)
In-Reply-To: <20190615071743.9494-1-Martin.Jansa@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4715 bytes --]
On Sat, Jun 15, 2019 at 07:17:43AM +0000, Martin Jansa wrote:
> From: Alexander Kanavin <alex.kanavin@gmail.com>
>
> Previously, this would happen:
>
> ======================================================================
> ERROR: test_vercmpstring (bb.tests.utils.VerCmpString)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/home/alexander/development/poky/bitbake/lib/bb/tests/utils.py", line 45, in test_vercmpstring
> result = bb.utils.vercmp_string('1.', '1.1')
> File "/home/alexander/development/poky/bitbake/lib/bb/utils.py", line 143, in vercmp_string
> return vercmp(ta, tb)
> File "/home/alexander/development/poky/bitbake/lib/bb/utils.py", line 135, in vercmp
> r = vercmp_part(va, vb)
> File "/home/alexander/development/poky/bitbake/lib/bb/utils.py", line 124, in vercmp_part
> elif ca < cb:
> TypeError: '<' not supported between instances of 'NoneType' and 'int'
I was seeing the same error on versions not ending with '.', in my case:
bb.utils.vercmp((0,1.0.2r,r0.0webos22), (0,1.0.2r0webos19,r0.0webos21)
Which lead to do_packagedata failure through buildhistory_emit_pkghistory shown bellow.
Alex's fix works for the above versions as well, should I extend
the bb.utils.vercmp selftest with even weirder versions like we're using
or leave it as is?
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:buildhistory_emit_pkghistory(d)
0003:
File: 'oe-core/meta/classes/buildhistory.bbclass', lineno: 263, function: buildhistory_emit_pkghistory
0259: last_pkge = lastversion.pkge
0260: last_pkgv = lastversion.pkgv
0261: last_pkgr = lastversion.pkgr
0262: bb.warn("bb.utils.vercmp((%s,%s,%s), (%s,%s,%s)" % (pkge, pkgv, pkgr, last_pkge, last_pkgv, last_pkgr))
*** 0263: r = bb.utils.vercmp((pkge, pkgv, pkgr), (last_pkge, last_pkgv, last_pkgr))
0264: if r < 0:
0265: msg = "Package version for package %s went backwards which would break package feeds from (%s:%s-%s to %s:%s-%s)" % (pkg, last_pkge, last_pkgv, last_pkgr, pkge, pkgv, pkgr)
0266: package_qa_handle_error("version-going-backwards", msg, d)
0267:
File: 'bitbake/lib/bb/utils.py', lineno: 134, function: vercmp
0130: (eb, vb, rb) = tb
0131:
0132: r = int(ea or 0) - int(eb or 0)
0133: if (r == 0):
*** 0134: r = vercmp_part(va, vb)
0135: if (r == 0):
0136: r = vercmp_part(ra, rb)
0137: return r
0138:
File: 'bitbake/lib/bb/utils.py', lineno: 123, function: vercmp_part
0119: if oa < ob:
0120: return -1
0121: elif oa > ob:
0122: return 1
*** 0123: elif ca < cb:
0124: return -1
0125: elif ca > cb:
0126: return 1
0127:
Exception: TypeError: '<' not supported between instances of 'NoneType' and 'int'
>
> ----------------------------------------------------------------------
>
> Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> lib/bb/tests/utils.py | 4 ++++
> lib/bb/utils.py | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/lib/bb/tests/utils.py b/lib/bb/tests/utils.py
> index 2f4ccf3c..f1cd83a4 100644
> --- a/lib/bb/tests/utils.py
> +++ b/lib/bb/tests/utils.py
> @@ -42,6 +42,10 @@ class VerCmpString(unittest.TestCase):
> self.assertTrue(result < 0)
> result = bb.utils.vercmp_string('1.1', '1.0+1.1-beta1')
> self.assertTrue(result > 0)
> + result = bb.utils.vercmp_string('1.', '1.1')
> + self.assertTrue(result < 0)
> + result = bb.utils.vercmp_string('1.1', '1.')
> + self.assertTrue(result > 0)
>
> def test_explode_dep_versions(self):
> correctresult = {"foo" : ["= 1.10"]}
> diff --git a/lib/bb/utils.py b/lib/bb/utils.py
> index 73b6cb42..215c18cf 100644
> --- a/lib/bb/utils.py
> +++ b/lib/bb/utils.py
> @@ -120,6 +120,10 @@ def vercmp_part(a, b):
> return -1
> elif oa > ob:
> return 1
> + elif ca is None:
> + return -1
> + elif cb is None:
> + return 1
> elif ca < cb:
> return -1
> elif ca > cb:
> --
> 2.17.1
>
--
Martin 'JaMa' Jansa jabber: Martin.Jansa@gmail.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 201 bytes --]
next prev parent reply other threads:[~2019-06-15 7:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-15 7:17 [1.40][PATCH] bitbake: fix version comparison when one of the versions ends in Martin Jansa
2019-06-15 7:24 ` Martin Jansa [this message]
2019-06-15 10:05 ` richard.purdie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190615072409.GA1486@jama \
--to=martin.jansa@gmail.com \
--cc=bitbake-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.