summaryrefslogtreecommitdiffstats
path: root/meta/packages/ipkg/files/update_version_comparision.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/ipkg/files/update_version_comparision.patch')
-rw-r--r--meta/packages/ipkg/files/update_version_comparision.patch84
1 files changed, 84 insertions, 0 deletions
diff --git a/meta/packages/ipkg/files/update_version_comparision.patch b/meta/packages/ipkg/files/update_version_comparision.patch
new file mode 100644
index 0000000000..b0d0df525b
--- /dev/null
+++ b/meta/packages/ipkg/files/update_version_comparision.patch
@@ -0,0 +1,84 @@
1Update the version comparision to a more recent one from dpkg. This
2means it now recognises 0.0-foo > 0.0+foo as it should.
3
4RP - 19/02/2008
5
6Index: ipkg-0.99.163/pkg.c
7===================================================================
8--- ipkg-0.99.163.orig/pkg.c 2008-02-18 11:24:45.000000000 +0000
9+++ ipkg-0.99.163/pkg.c 2008-02-19 00:24:50.000000000 +0000
10@@ -1128,43 +1130,37 @@
11 return r;
12 }
13
14-int verrevcmp(const char *val, const char *ref)
15-{
16- int vc, rc;
17- long vl, rl;
18- const char *vp, *rp;
19- const char *vsep, *rsep;
20-
21- if (!val) val= "";
22- if (!ref) ref= "";
23- for (;;) {
24- vp= val; while (*vp && !isdigit(*vp)) vp++;
25- rp= ref; while (*rp && !isdigit(*rp)) rp++;
26- for (;;) {
27- vc= (val == vp) ? 0 : *val++;
28- rc= (ref == rp) ? 0 : *ref++;
29- if (!rc && !vc) break;
30- if (vc && !isalpha(vc)) vc += 256; /* assumes ASCII character set */
31- if (rc && !isalpha(rc)) rc += 256;
32- if (vc != rc) return vc - rc;
33- }
34- val= vp;
35- ref= rp;
36- vl=0; if (isdigit(*vp)) vl= strtol(val,(char**)&val,10);
37- rl=0; if (isdigit(*rp)) rl= strtol(ref,(char**)&ref,10);
38- if (vl != rl) return vl - rl;
39-
40- vc = *val;
41- rc = *ref;
42- vsep = strchr(".-", vc);
43- rsep = strchr(".-", rc);
44- if (vsep && !rsep) return -1;
45- if (!vsep && rsep) return +1;
46-
47- if (!*val && !*ref) return 0;
48- if (!*val) return -1;
49- if (!*ref) return +1;
50- }
51+/* assume ascii; warning: evaluates x multiple times! */
52+#define order(x) ((x) == '~' ? -1 \
53+ : isdigit((x)) ? 0 \
54+ : !(x) ? 0 \
55+ : isalpha((x)) ? (x) \
56+ : (x) + 256)
57+
58+static int verrevcmp(const char *val, const char *ref) {
59+ if (!val) val= "";
60+ if (!ref) ref= "";
61+
62+ while (*val || *ref) {
63+ int first_diff= 0;
64+
65+ while ( (*val && !isdigit(*val)) || (*ref && !isdigit(*ref)) ) {
66+ int vc= order(*val), rc= order(*ref);
67+ if (vc != rc) return vc - rc;
68+ val++; ref++;
69+ }
70+
71+ while ( *val == '0' ) val++;
72+ while ( *ref == '0' ) ref++;
73+ while (isdigit(*val) && isdigit(*ref)) {
74+ if (!first_diff) first_diff= *val - *ref;
75+ val++; ref++;
76+ }
77+ if (isdigit(*val)) return 1;
78+ if (isdigit(*ref)) return -1;
79+ if (first_diff) return first_diff;
80+ }
81+ return 0;
82 }
83
84 int pkg_version_satisfied(pkg_t *it, pkg_t *ref, const char *op)