* [PATCH 0/1] Modified the vercmp() to meet Debian rules
@ 2012-04-12 9:27 Lianhao Lu
2012-04-12 9:28 ` [PATCH 1/1] bb.utils: Modifed " Lianhao Lu
0 siblings, 1 reply; 2+ messages in thread
From: Lianhao Lu @ 2012-04-12 9:27 UTC (permalink / raw)
To: bitbake-devel
As we investigated, the vercmp() in bitbake didn't meet the Debian rules,
and is not compatible to what opkg expected. Detailed information could be
find at http://lists.linuxtogo.org/pipermail/bitbake-devel/2012-April/002641.html.
This patch fixed the vercmp() to meet the Debian rules.
The following changes since commit 4219e2ea033232d95117211947b751bdb5efafd4:
Saul Wold (1):
hig/builder: use the new which_terminal() function
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib llu/vercmp_bitbake
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=llu/vercmp_bitbake
Lianhao Lu (1):
bb.utils: Modifed vercmp() to meet Debian rules.
lib/bb/utils.py | 40 ++++++++++++++++------------------------
1 files changed, 16 insertions(+), 24 deletions(-)
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 1/1] bb.utils: Modifed vercmp() to meet Debian rules.
2012-04-12 9:27 [PATCH 0/1] Modified the vercmp() to meet Debian rules Lianhao Lu
@ 2012-04-12 9:28 ` Lianhao Lu
0 siblings, 0 replies; 2+ messages in thread
From: Lianhao Lu @ 2012-04-12 9:28 UTC (permalink / raw)
To: bitbake-devel
The version compare function vercmp() was not exatcly conforming to
Debian rules, e.g. it reported 'r1' > 'r1.1' but the Debian rules says
'r1' < 'r1.1'; it didn't support the "~" either.
Modified the vercmp() to meet Debian rules, so that it's compatible to
the rules used in opkg.
This part of the buf fixing of [YOCTO #2233].
Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
---
lib/bb/utils.py | 40 ++++++++++++++++------------------------
1 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 21d3a81..1d98bca 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -31,9 +31,6 @@ from contextlib import contextmanager
logger = logging.getLogger("BitBake.Util")
-# Version comparison
-separators = ".-"
-
# Context used in better_exec, eval
_context = {
"os": os,
@@ -48,15 +45,18 @@ def explode_version(s):
while (s != ''):
if s[0] in string.digits:
m = numeric_regexp.match(s)
- r.append(int(m.group(1)))
+ r.append((0, int(m.group(1))))
s = m.group(2)
continue
if s[0] in string.letters:
m = alpha_regexp.match(s)
- r.append(m.group(1))
+ r.append((1, m.group(1)))
s = m.group(2)
continue
- r.append(s[0])
+ if s[0] == '~':
+ r.append((-1, s[0]))
+ else:
+ r.append((2, s[0]))
s = s[1:]
return r
@@ -77,33 +77,25 @@ def split_version(s):
def vercmp_part(a, b):
va = explode_version(a)
vb = explode_version(b)
- sa = False
- sb = False
while True:
if va == []:
- ca = None
+ (oa, ca) = (0, None)
else:
- ca = va.pop(0)
+ (oa, ca) = va.pop(0)
if vb == []:
- cb = None
+ (ob, cb) = (0, None)
else:
- cb = vb.pop(0)
- if ca == None and cb == None:
+ (ob, cb) = vb.pop(0)
+ if (oa, ca) == (0, None) and (ob, cb) == (0, None):
return 0
-
- if isinstance(ca, basestring):
- sa = ca in separators
- if isinstance(cb, basestring):
- sb = cb in separators
- if sa and not sb:
+ if oa < ob:
return -1
- if not sa and sb:
+ elif oa > ob:
return 1
-
- if ca > cb:
- return 1
- if ca < cb:
+ elif ca < cb:
return -1
+ elif ca > cb:
+ return 1
def vercmp(ta, tb):
(ea, va, ra) = ta
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-12 9:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-12 9:27 [PATCH 0/1] Modified the vercmp() to meet Debian rules Lianhao Lu
2012-04-12 9:28 ` [PATCH 1/1] bb.utils: Modifed " Lianhao Lu
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.