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 | |
| parent | 84e7b04add9c8652182e1a9efd9fca85d07220cf (diff) | |
| download | poky-4de220459c23937f53f59b3d416036620e80605c.tar.gz | |
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')
| -rw-r--r-- | meta/packages/ipkg/files/enable_debversion.patch | 111 | ||||
| -rw-r--r-- | meta/packages/ipkg/files/update_version_comparision.patch | 84 | ||||
| -rw-r--r-- | meta/packages/ipkg/ipkg-native_0.99.154.bb | 2 | ||||
| -rw-r--r-- | meta/packages/ipkg/ipkg.inc | 2 | ||||
| -rw-r--r-- | meta/packages/ipkg/ipkg_0.99.154.bb | 2 |
5 files changed, 199 insertions, 2 deletions
diff --git a/meta/packages/ipkg/files/enable_debversion.patch b/meta/packages/ipkg/files/enable_debversion.patch new file mode 100644 index 0000000000..e9c3a7a1d4 --- /dev/null +++ b/meta/packages/ipkg/files/enable_debversion.patch | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | OE makes heavy use of the revision field so it makes sense to | ||
| 2 | enable it. We don't want the familiar stuff though so patch that | ||
| 3 | out. | ||
| 4 | |||
| 5 | RP - 19/02/2008 | ||
| 6 | |||
| 7 | Index: ipkg-0.99.163/pkg.c | ||
| 8 | =================================================================== | ||
| 9 | --- ipkg-0.99.163.orig/pkg.c 2008-02-19 00:35:03.000000000 +0000 | ||
| 10 | +++ ipkg-0.99.163/pkg.c 2008-02-19 00:36:02.000000000 +0000 | ||
| 11 | @@ -1118,15 +1118,11 @@ | ||
| 12 | return r; | ||
| 13 | } | ||
| 14 | |||
| 15 | -#ifdef USE_DEBVERSION | ||
| 16 | r = verrevcmp(pkg->revision, ref_pkg->revision); | ||
| 17 | if (r) { | ||
| 18 | return r; | ||
| 19 | } | ||
| 20 | |||
| 21 | - r = verrevcmp(pkg->familiar_revision, ref_pkg->familiar_revision); | ||
| 22 | -#endif | ||
| 23 | - | ||
| 24 | return r; | ||
| 25 | } | ||
| 26 | |||
| 27 | @@ -1240,10 +1236,7 @@ | ||
| 28 | { | ||
| 29 | char *complete_version; | ||
| 30 | char *epoch_str; | ||
| 31 | -#ifdef USE_DEBVERSION | ||
| 32 | char *revision_str; | ||
| 33 | - char *familiar_revision_str; | ||
| 34 | -#endif | ||
| 35 | |||
| 36 | if (pkg->epoch) { | ||
| 37 | sprintf_alloc(&epoch_str, "%d:", pkg->epoch); | ||
| 38 | @@ -1251,33 +1244,18 @@ | ||
| 39 | epoch_str = strdup(""); | ||
| 40 | } | ||
| 41 | |||
| 42 | -#ifdef USE_DEBVERSION | ||
| 43 | if (pkg->revision && strlen(pkg->revision)) { | ||
| 44 | sprintf_alloc(&revision_str, "-%s", pkg->revision); | ||
| 45 | } else { | ||
| 46 | revision_str = strdup(""); | ||
| 47 | } | ||
| 48 | |||
| 49 | - if (pkg->familiar_revision && strlen(pkg->familiar_revision)) { | ||
| 50 | - sprintf_alloc(&familiar_revision_str, "-fam%s", pkg->familiar_revision); | ||
| 51 | - } else { | ||
| 52 | - familiar_revision_str = strdup(""); | ||
| 53 | - } | ||
| 54 | -#endif | ||
| 55 | |||
| 56 | -#ifdef USE_DEBVERSION | ||
| 57 | - sprintf_alloc(&complete_version, "%s%s%s%s", | ||
| 58 | - epoch_str, pkg->version, revision_str, familiar_revision_str); | ||
| 59 | -#else | ||
| 60 | - sprintf_alloc(&complete_version, "%s%s", | ||
| 61 | - epoch_str, pkg->version); | ||
| 62 | -#endif | ||
| 63 | + sprintf_alloc(&complete_version, "%s%s%s", | ||
| 64 | + epoch_str, pkg->version, revision_str); | ||
| 65 | |||
| 66 | free(epoch_str); | ||
| 67 | -#ifdef USE_DEBVERSION | ||
| 68 | free(revision_str); | ||
| 69 | - free(familiar_revision_str); | ||
| 70 | -#endif | ||
| 71 | |||
| 72 | return complete_version; | ||
| 73 | } | ||
| 74 | Index: ipkg-0.99.163/pkg_parse.c | ||
| 75 | =================================================================== | ||
| 76 | --- ipkg-0.99.163.orig/pkg_parse.c 2008-02-19 00:35:03.000000000 +0000 | ||
| 77 | +++ ipkg-0.99.163/pkg_parse.c 2008-02-19 00:38:42.000000000 +0000 | ||
| 78 | @@ -105,9 +105,7 @@ | ||
| 79 | int parseVersion(pkg_t *pkg, char *raw) | ||
| 80 | { | ||
| 81 | char *colon, *eepochcolon; | ||
| 82 | -#ifdef USE_DEBVERSION | ||
| 83 | char *hyphen; | ||
| 84 | -#endif | ||
| 85 | unsigned long epoch; | ||
| 86 | |||
| 87 | if (!*raw) { | ||
| 88 | @@ -149,23 +147,12 @@ | ||
| 89 | } | ||
| 90 | strcpy(pkg->version, raw); | ||
| 91 | |||
| 92 | -#ifdef USE_DEBVERSION | ||
| 93 | hyphen= strrchr(pkg->version,'-'); | ||
| 94 | |||
| 95 | if (hyphen) { | ||
| 96 | *hyphen++= 0; | ||
| 97 | - if (strncmp("fam", hyphen, 3) == 0) { | ||
| 98 | - pkg->familiar_revision=hyphen+3; | ||
| 99 | - hyphen= strrchr(pkg->version,'-'); | ||
| 100 | - if (hyphen) { | ||
| 101 | - *hyphen++= 0; | ||
| 102 | - pkg->revision = hyphen; | ||
| 103 | - } | ||
| 104 | - } else { | ||
| 105 | pkg->revision = hyphen; | ||
| 106 | - } | ||
| 107 | } | ||
| 108 | -#endif | ||
| 109 | |||
| 110 | /* | ||
| 111 | fprintf(stderr,"Parsed version: %lu, %s, %s, %s\n", | ||
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 @@ | |||
| 1 | Update the version comparision to a more recent one from dpkg. This | ||
| 2 | means it now recognises 0.0-foo > 0.0+foo as it should. | ||
| 3 | |||
| 4 | RP - 19/02/2008 | ||
| 5 | |||
| 6 | Index: 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) | ||
diff --git a/meta/packages/ipkg/ipkg-native_0.99.154.bb b/meta/packages/ipkg/ipkg-native_0.99.154.bb index 9e5185fe24..8435b4de1d 100644 --- a/meta/packages/ipkg/ipkg-native_0.99.154.bb +++ b/meta/packages/ipkg/ipkg-native_0.99.154.bb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | require ipkg.inc | 1 | require ipkg.inc |
| 2 | require ipkg-native.inc | 2 | require ipkg-native.inc |
| 3 | 3 | ||
| 4 | PR = "r2" | 4 | PR = "r3" |
diff --git a/meta/packages/ipkg/ipkg.inc b/meta/packages/ipkg/ipkg.inc index c3195c8c57..3f580a2309 100644 --- a/meta/packages/ipkg/ipkg.inc +++ b/meta/packages/ipkg/ipkg.inc | |||
| @@ -11,6 +11,8 @@ AUTO_LIBNAME_PKGS = "libipkg" | |||
| 11 | 11 | ||
| 12 | SRC_URI = "${HANDHELDS_CVS};module=familiar/dist/ipkg;tag=${@'V' + bb.data.getVar('PV',d,1).replace('.', '-')} \ | 12 | SRC_URI = "${HANDHELDS_CVS};module=familiar/dist/ipkg;tag=${@'V' + bb.data.getVar('PV',d,1).replace('.', '-')} \ |
| 13 | file://fix_tar_extension.patch;patch=1 \ | 13 | file://fix_tar_extension.patch;patch=1 \ |
| 14 | file://update_version_comparision.patch;patch=1 \ | ||
| 15 | file://enable_debversion.patch;patch=1 \ | ||
| 14 | file://terse.patch;patch=1 \ | 16 | file://terse.patch;patch=1 \ |
| 15 | file://ipkg_bugfix.patch;patch=1 \ | 17 | file://ipkg_bugfix.patch;patch=1 \ |
| 16 | file://noupdalt.patch;patch=1" | 18 | file://noupdalt.patch;patch=1" |
diff --git a/meta/packages/ipkg/ipkg_0.99.154.bb b/meta/packages/ipkg/ipkg_0.99.154.bb index 27992c3efa..dca29096d1 100644 --- a/meta/packages/ipkg/ipkg_0.99.154.bb +++ b/meta/packages/ipkg/ipkg_0.99.154.bb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | require ipkg.inc | 1 | require ipkg.inc |
| 2 | PR = "r9" | 2 | PR = "r10" |
| 3 | 3 | ||
| 4 | RDEPENDS_${PN} += "${VIRTUAL-RUNTIME_update-alternatives}" | 4 | RDEPENDS_${PN} += "${VIRTUAL-RUNTIME_update-alternatives}" |
