diff options
author | Richard Purdie <richard@openedhand.com> | 2008-02-19 10:31:48 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2008-02-19 10:31:48 +0000 |
commit | 4de220459c23937f53f59b3d416036620e80605c (patch) | |
tree | f5a6520c9301c94c795f91273cb8fe22e1a9d5a7 /meta/packages/ipkg/files/update_version_comparision.patch | |
parent | 84e7b04add9c8652182e1a9efd9fca85d07220cf (diff) | |
download | openembedded-core-4de220459c23937f53f59b3d416036620e80605c.tar.gz openembedded-core-4de220459c23937f53f59b3d416036620e80605c.tar.bz2 openembedded-core-4de220459c23937f53f59b3d416036620e80605c.tar.xz openembedded-core-4de220459c23937f53f59b3d416036620e80605c.zip |
ipkg: Fix version comparisions
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3827 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/ipkg/files/update_version_comparision.patch')
-rw-r--r-- | meta/packages/ipkg/files/update_version_comparision.patch | 84 |
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 000000000..b0d0df525 --- /dev/null +++ b/meta/packages/ipkg/files/update_version_comparision.patch @@ -0,0 +1,84 @@ +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. + +RP - 19/02/2008 + +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) |