summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2008-02-19 00:33:18 +0000
committerRichard Purdie <rpurdie@rpsys.net>2008-02-19 00:33:18 +0000
commitb5a19ef64dc7a61915bf05510a975dd9d1dce2ee (patch)
treec03470683d2e2cc05c04e729e4eaff55a9601458
parent3736c8dda619105cbe8908c9a86f4263d610a59e (diff)
ipkg: Partially fix broken version comparisions
-rw-r--r--packages/ipkg/files/update_version_comparision.patch82
-rw-r--r--packages/ipkg/ipkg-native_0.99.163.bb3
-rw-r--r--packages/ipkg/ipkg.inc1
-rw-r--r--packages/ipkg/ipkg_0.99.163.bb2
4 files changed, 86 insertions, 2 deletions
diff --git a/packages/ipkg/files/update_version_comparision.patch b/packages/ipkg/files/update_version_comparision.patch
new file mode 100644
index 0000000000..9f617ef9f0
--- /dev/null
+++ b/packages/ipkg/files/update_version_comparision.patch
@@ -0,0 +1,82 @@
+Update the version comparision to a more recent one from dpkg. This
+means it now recognises 0.0-foo > 0.0+foo as it should.
+
+Index: ipkg-0.99.163/pkg.c
+===================================================================
+--- ipkg-0.99.163.orig/pkg.c 2008-02-18 11:24:45.000000000 +0000
++++ ipkg-0.99.163/pkg.c 2008-02-19 00:24:50.000000000 +0000
+@@ -1128,43 +1130,37 @@
+ return r;
+ }
+
+-int verrevcmp(const char *val, const char *ref)
+-{
+- int vc, rc;
+- long vl, rl;
+- const char *vp, *rp;
+- const char *vsep, *rsep;
+-
+- if (!val) val= "";
+- if (!ref) ref= "";
+- for (;;) {
+- vp= val; while (*vp && !isdigit(*vp)) vp++;
+- rp= ref; while (*rp && !isdigit(*rp)) rp++;
+- for (;;) {
+- vc= (val == vp) ? 0 : *val++;
+- rc= (ref == rp) ? 0 : *ref++;
+- if (!rc && !vc) break;
+- if (vc && !isalpha(vc)) vc += 256; /* assumes ASCII character set */
+- if (rc && !isalpha(rc)) rc += 256;
+- if (vc != rc) return vc - rc;
+- }
+- val= vp;
+- ref= rp;
+- vl=0; if (isdigit(*vp)) vl= strtol(val,(char**)&val,10);
+- rl=0; if (isdigit(*rp)) rl= strtol(ref,(char**)&ref,10);
+- if (vl != rl) return vl - rl;
+-
+- vc = *val;
+- rc = *ref;
+- vsep = strchr(".-", vc);
+- rsep = strchr(".-", rc);
+- if (vsep && !rsep) return -1;
+- if (!vsep && rsep) return +1;
+-
+- if (!*val && !*ref) return 0;
+- if (!*val) return -1;
+- if (!*ref) return +1;
+- }
++/* assume ascii; warning: evaluates x multiple times! */
++#define order(x) ((x) == '~' ? -1 \
++ : isdigit((x)) ? 0 \
++ : !(x) ? 0 \
++ : isalpha((x)) ? (x) \
++ : (x) + 256)
++
++static int verrevcmp(const char *val, const char *ref) {
++ if (!val) val= "";
++ if (!ref) ref= "";
++
++ while (*val || *ref) {
++ int first_diff= 0;
++
++ while ( (*val && !isdigit(*val)) || (*ref && !isdigit(*ref)) ) {
++ int vc= order(*val), rc= order(*ref);
++ if (vc != rc) return vc - rc;
++ val++; ref++;
++ }
++
++ while ( *val == '0' ) val++;
++ while ( *ref == '0' ) ref++;
++ while (isdigit(*val) && isdigit(*ref)) {
++ if (!first_diff) first_diff= *val - *ref;
++ val++; ref++;
++ }
++ if (isdigit(*val)) return 1;
++ if (isdigit(*ref)) return -1;
++ if (first_diff) return first_diff;
++ }
++ return 0;
+ }
+
+ int pkg_version_satisfied(pkg_t *it, pkg_t *ref, const char *op)
diff --git a/packages/ipkg/ipkg-native_0.99.163.bb b/packages/ipkg/ipkg-native_0.99.163.bb
index 7a95b28159..163eba62e2 100644
--- a/packages/ipkg/ipkg-native_0.99.163.bb
+++ b/packages/ipkg/ipkg-native_0.99.163.bb
@@ -2,11 +2,12 @@ S = "${WORKDIR}/ipkg-${PV}"
#require ipkg_${PV}.bb
require ipkg-native.inc
-PR = "r4"
+PR = "r5"
inherit autotools pkgconfig native
SRC_URI = "http://www.handhelds.org/pub/packages/ipkg/ipkg-${PV}.tar.gz \
+ file://update_version_comparision.patch;patch=1 \
file://is-processing.patch;patch=1 \
file://1-pkg-parse--Optimize-inefficient-parsing.patch;patch=1 \
file://2-pkg-vec--Optimize-gross-inefficiency.patch;patch=1 \
diff --git a/packages/ipkg/ipkg.inc b/packages/ipkg/ipkg.inc
index 9154572f08..980a4265bd 100644
--- a/packages/ipkg/ipkg.inc
+++ b/packages/ipkg/ipkg.inc
@@ -10,6 +10,7 @@ FILES_libipkg = "${libdir}/*.so.*"
AUTO_LIBNAME_PKGS = "libipkg"
SRC_URI = "${HANDHELDS_CVS};module=familiar/dist/ipkg;tag=${@'V' + bb.data.getVar('PV',d,1).replace('.', '-')} \
+ file://update_version_comparision.patch;patch=1 \
file://ipkg-configure \
file://terse.patch;patch=1"
diff --git a/packages/ipkg/ipkg_0.99.163.bb b/packages/ipkg/ipkg_0.99.163.bb
index fccfe8d53f..f2d7652b89 100644
--- a/packages/ipkg/ipkg_0.99.163.bb
+++ b/packages/ipkg/ipkg_0.99.163.bb
@@ -1,5 +1,5 @@
include ipkg.inc
-PR = "r6"
+PR = "r7"
S = "${WORKDIR}/ipkg-${PV}"