summaryrefslogtreecommitdiff
path: root/packages/ipkg-utils
diff options
context:
space:
mode:
authorPaul Sokolovsky <pmiscml@gmail.com>2007-04-04 12:36:04 +0000
committerPaul Sokolovsky <pmiscml@gmail.com>2007-04-04 12:36:04 +0000
commit77e64186f9856c0239fe7580a826ad7f3705f9c9 (patch)
tree37e41f5fec187d7bd50a3e34f3b115a320d7bfbf /packages/ipkg-utils
parent3a88290f931baa6feda702c9d5ab7948f8dc1ba1 (diff)
ipkg-utils-native 1.6+cvs20050404: Fix version comparision algorithm, now
it treats version as structured notion, and compares it component by component (epoch (was before), then upstream version, then package revision). * Closes #2061.
Diffstat (limited to 'packages/ipkg-utils')
-rw-r--r--packages/ipkg-utils/ipkg-utils-native/ipkg-py-sane-vercompare.patch51
-rw-r--r--packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb5
2 files changed, 54 insertions, 2 deletions
diff --git a/packages/ipkg-utils/ipkg-utils-native/ipkg-py-sane-vercompare.patch b/packages/ipkg-utils/ipkg-utils-native/ipkg-py-sane-vercompare.patch
new file mode 100644
index 0000000000..00ee391405
--- /dev/null
+++ b/packages/ipkg-utils/ipkg-utils-native/ipkg-py-sane-vercompare.patch
@@ -0,0 +1,51 @@
+Only in ipkg-utils: ipkg-py-sane-vercompare.patch
+diff -ur ipkg-utils.org/ipkg.py ipkg-utils/ipkg.py
+--- ipkg-utils.org/ipkg.py 2005-01-08 18:08:52.000000000 +0000
++++ ipkg-utils/ipkg.py 2007-04-04 11:52:46.000000000 +0000
+@@ -48,9 +48,9 @@
+ self.epoch = epoch
+ self.version = version
+
+- def _versioncompare(self, ref):
+- selfversion = self.version
+- refversion = ref.version
++ def _versioncompare(self, selfversion, refversion):
++ if not selfversion: selfversion = ""
++ if not refversion: refversion = ""
+ while 1:
+ ## first look for non-numeric version component
+ selfm = re.match('([^0-9]*)(.*)', selfversion)
+@@ -89,7 +89,18 @@
+ elif (self.epoch < ref.epoch):
+ return -1
+ else:
+- return self._versioncompare(ref)
++ self_ver_comps = re.match(r"(.+?)(-r.+)?$", self.version)
++ ref_ver_comps = re.match(r"(.+?)(-r.+)?$", ref.version)
++ #print (self_ver_comps.group(1), self_ver_comps.group(2))
++ #print (ref_ver_comps.group(1), ref_ver_comps.group(2))
++ r = self._versioncompare(self_ver_comps.group(1), ref_ver_comps.group(1))
++ if r == 0:
++ r = self._versioncompare(self_ver_comps.group(2), ref_ver_comps.group(2))
++ #print "compare: %s vs %s = %d" % (self, ref, r)
++ return r
++
++ def __str__(self):
++ return str(self.epoch) + ":" + self.version
+
+ def parse_version(versionstr):
+ epoch = 0
+@@ -445,6 +456,13 @@
+ return self.packages[key]
+
+ if __name__ == "__main__":
++
++ assert Version(0, "1.2.2-r1").compare(Version(0, "1.2.3-r0")) == -1
++ assert Version(0, "1.2.2-r0").compare(Version(0, "1.2.2+cvs20070308-r0")) == -1
++ assert Version(0, "1.2.2+cvs20070308").compare(Version(0, "1.2.2-r0")) == 1
++ assert Version(0, "1.2.2-r0").compare(Version(0, "1.2.2-r0")) == 0
++ assert Version(0, "1.2.2-r5").compare(Version(0, "1.2.2-r0")) == 1
++
+ package = Package()
+
+ package.set_package("FooBar")
diff --git a/packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb b/packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb
index 8079b46267..03a381387e 100644
--- a/packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb
+++ b/packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb
@@ -1,8 +1,9 @@
require ipkg-utils_${PV}.bb
-SRC_URI += "file://ipkg-utils-fix.patch;patch=1"
+SRC_URI += "file://ipkg-utils-fix.patch;patch=1 \
+ file://ipkg-py-sane-vercompare.patch;patch=1"
RDEPENDS = ""
-PR = "r8"
+PR = "r9"
inherit native