diff options
author | Guillem Jover <guillem@debian.org> | 2012-05-08 06:04:53 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2012-05-10 04:43:33 +0200 |
commit | 4f315d811d9a8ed271395b84caeab80b2c05f0fb (patch) | |
tree | 87bd731f44987a1ce2cc9a39afd750ca8062810c | |
parent | a049e019af38a74732a6ee115a3628d864913e9c (diff) | |
download | dpkg-4f315d811d9a8ed271395b84caeab80b2c05f0fb.tar.gz |
libdpkg: Rename versioncompare() to dpkg_version_compare()
-rw-r--r-- | dselect/pkgdepcon.cc | 11 | ||||
-rw-r--r-- | dselect/pkglist.cc | 2 | ||||
-rw-r--r-- | dselect/pkgtop.cc | 3 | ||||
-rw-r--r-- | lib/dpkg/dpkg-db.h | 4 | ||||
-rw-r--r-- | lib/dpkg/libdpkg.map | 2 | ||||
-rw-r--r-- | lib/dpkg/parse.c | 2 | ||||
-rw-r--r-- | lib/dpkg/test/t-version.c | 44 | ||||
-rw-r--r-- | lib/dpkg/vercmp.c | 6 | ||||
-rw-r--r-- | src/archives.c | 2 | ||||
-rw-r--r-- | src/configure.c | 4 | ||||
-rw-r--r-- | src/enquiry.c | 2 | ||||
-rw-r--r-- | src/processarc.c | 11 |
12 files changed, 49 insertions, 44 deletions
diff --git a/dselect/pkgdepcon.cc b/dselect/pkgdepcon.cc index 028ed6d57..0e97e4c0c 100644 --- a/dselect/pkgdepcon.cc +++ b/dselect/pkgdepcon.cc @@ -40,7 +40,8 @@ packagelist::useavailable(pkginfo *pkg) (!(pkg->status == pkginfo::stat_installed || pkg->status == pkginfo::stat_triggersawaited || pkg->status == pkginfo::stat_triggerspending) || - versioncompare(&pkg->available.version,&pkg->installed.version) > 0)) + dpkg_version_compare(&pkg->available.version, + &pkg->installed.version) > 0)) return true; else return false; @@ -392,8 +393,8 @@ packagelist::deppossatisfied(deppossi *possi, perpackagestate **fixbyupgrade) return true; if (want == pkginfo::want_hold && fixbyupgrade && !*fixbyupgrade && versionsatisfied(&possi->ed->pkg.available, possi) && - versioncompare(&possi->ed->pkg.available.version, - &possi->ed->pkg.installed.version) > 1) + dpkg_version_compare(&possi->ed->pkg.available.version, + &possi->ed->pkg.installed.version) > 1) *fixbyupgrade = possi->ed->pkg.clientdata; return false; } @@ -430,8 +431,8 @@ packagelist::deppossatisfied(deppossi *possi, perpackagestate **fixbyupgrade) (!(provider->up->up->status == pkginfo::stat_installed || provider->up->up->status == pkginfo::stat_triggerspending || provider->up->up->status == pkginfo::stat_triggersawaited) || - versioncompare(&provider->up->up->available.version, - &provider->up->up->installed.version) > 1)) + dpkg_version_compare(&provider->up->up->available.version, + &provider->up->up->installed.version) > 1)) *fixbyupgrade = provider->up->up->clientdata; } return false; diff --git a/dselect/pkglist.cc b/dselect/pkglist.cc index d03675cda..a5e7f904c 100644 --- a/dselect/pkglist.cc +++ b/dselect/pkglist.cc @@ -207,7 +207,7 @@ void packagelist::ensurestatsortinfo() { vera= &table[index]->pkg->available.version; if (!dpkg_version_is_informative(vera)) { table[index]->ssavail= ssa_installed_gone; - } else if (versioncompare(vera,veri) > 0) { + } else if (dpkg_version_compare(vera, veri) > 0) { table[index]->ssavail= ssa_installed_newer; } else { table[index]->ssavail= ssa_installed_sameold; diff --git a/dselect/pkgtop.cc b/dselect/pkgtop.cc index 14f17e2a7..1c86a7ab4 100644 --- a/dselect/pkgtop.cc +++ b/dselect/pkgtop.cc @@ -207,7 +207,8 @@ void packagelist::redraw1itemsel(int index, int selected) { versiondescribe(&pkg->installed.version, vdew_nonambig)); if (versionavailable_width) { if (dpkg_version_is_informative(&pkg->available.version) && - versioncompare(&pkg->available.version,&pkg->installed.version) > 0) + dpkg_version_compare(&pkg->available.version, + &pkg->installed.version) > 0) wattrset(listpad, part_attr[selected ? selstatesel : selstate]); mvwprintw(listpad, screenline, versionavailable_column, "%-*.*s", versionavailable_width, versionavailable_width, diff --git a/lib/dpkg/dpkg-db.h b/lib/dpkg/dpkg-db.h index d0f3dfd5c..908b5ae76 100644 --- a/lib/dpkg/dpkg-db.h +++ b/lib/dpkg/dpkg-db.h @@ -377,8 +377,8 @@ void varbufdependency(struct varbuf *vb, struct dependency *dep); bool versionsatisfied3(const struct dpkg_version *a, const struct dpkg_version *b, enum dpkg_relation rel); -int versioncompare(const struct dpkg_version *a, - const struct dpkg_version *b); +int dpkg_version_compare(const struct dpkg_version *a, + const struct dpkg_version *b); /*** from depcon.c ***/ diff --git a/lib/dpkg/libdpkg.map b/lib/dpkg/libdpkg.map index 39200e10f..7c6729f97 100644 --- a/lib/dpkg/libdpkg.map +++ b/lib/dpkg/libdpkg.map @@ -184,7 +184,7 @@ LIBDPKG_PRIVATE { # Version struct handling dpkg_version_blank; dpkg_version_is_informative; - versioncompare; + dpkg_version_compare; versiondescribe; versionsatisfied3; parseversion; diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c index 65a4bc724..cf87c423e 100644 --- a/lib/dpkg/parse.c +++ b/lib/dpkg/parse.c @@ -740,7 +740,7 @@ int parsedb(const char *filename, enum parsedbflags flags, db_pkgbin = &db_pkg->installed; if (((flags & pdb_ignoreolder) || ps.type == pdb_file_available) && - versioncompare(&new_pkgbin->version, &db_pkgbin->version) < 0) + dpkg_version_compare(&new_pkgbin->version, &db_pkgbin->version) < 0) continue; pkg_parse_copy(&ps, db_pkg, db_pkgbin, new_pkg, new_pkgbin); diff --git a/lib/dpkg/test/t-version.c b/lib/dpkg/test/t-version.c index e1e728361..bb7156e13 100644 --- a/lib/dpkg/test/t-version.c +++ b/lib/dpkg/test/t-version.c @@ -37,28 +37,28 @@ test_version_compare(void) dpkg_version_blank(&a); dpkg_version_blank(&b); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); a.epoch = 1; b.epoch = 2; - test_fail(versioncompare(&a, &b) == 0); + test_fail(dpkg_version_compare(&a, &b) == 0); /* Test for version equality. */ a = b = version(0, "0", "0"); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); a = version(0, "0", "00"); b = version(0, "00", "0"); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); a = b = version(1, "2", "3"); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); /* Test for epoch difference. */ a = version(0, "0", "0"); b = version(1, "0", "0"); - test_pass(versioncompare(&a, &b) < 0); - test_pass(versioncompare(&b, &a) > 0); + test_pass(dpkg_version_compare(&a, &b) < 0); + test_pass(dpkg_version_compare(&b, &a) > 0); /* FIXME: Complete. */ } @@ -87,67 +87,67 @@ test_version_parse(void) b = version(0, "0", ""); test_pass(parseversion(&a, "0", NULL) == 0); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); test_pass(parseversion(&a, "0:0", NULL) == 0); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); test_pass(parseversion(&a, "0:0-", NULL) == 0); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); b = version(0, "0", "0"); test_pass(parseversion(&a, "0:0-0", NULL) == 0); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); b = version(0, "0.0", "0.0"); test_pass(parseversion(&a, "0:0.0-0.0", NULL) == 0); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); /* Test epoched versions. */ b = version(1, "0", ""); test_pass(parseversion(&a, "1:0", NULL) == 0); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); b = version(5, "1", ""); test_pass(parseversion(&a, "5:1", NULL) == 0); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); /* Test multiple dashes. */ b = version(0, "0-0", "0"); test_pass(parseversion(&a, "0:0-0-0", NULL) == 0); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); b = version(0, "0-0-0", "0"); test_pass(parseversion(&a, "0:0-0-0-0", NULL) == 0); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); /* Test multiple colons. */ b = version(0, "0:0", "0"); test_pass(parseversion(&a, "0:0:0-0", NULL) == 0); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); b = version(0, "0:0:0", "0"); test_pass(parseversion(&a, "0:0:0:0-0", NULL) == 0); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); /* Test multiple dashes and colons. */ b = version(0, "0:0-0", "0"); test_pass(parseversion(&a, "0:0:0-0-0", NULL) == 0); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); b = version(0, "0-0:0", "0"); test_pass(parseversion(&a, "0:0-0:0-0", NULL) == 0); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); /* Test valid characters in upstream version. */ b = version(0, "09azAZ.-+~:", "0"); test_pass(parseversion(&a, "0:09azAZ.-+~:-0", NULL) == 0); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); /* Test valid characters in revision. */ b = version(0, "0", "azAZ09.+~"); test_pass(parseversion(&a, "0:0-azAZ09.+~", NULL) == 0); - test_pass(versioncompare(&a, &b) == 0); + test_pass(dpkg_version_compare(&a, &b) == 0); /* Test empty version. */ test_pass(parseversion(&a, "", &err) != 0); diff --git a/lib/dpkg/vercmp.c b/lib/dpkg/vercmp.c index 9bc7ddc94..c2c9dbba4 100644 --- a/lib/dpkg/vercmp.c +++ b/lib/dpkg/vercmp.c @@ -88,8 +88,8 @@ verrevcmp(const char *a, const char *b) } int -versioncompare(const struct dpkg_version *a, - const struct dpkg_version *b) +dpkg_version_compare(const struct dpkg_version *a, + const struct dpkg_version *b) { int r; @@ -115,7 +115,7 @@ versionsatisfied3(const struct dpkg_version *a, if (rel == dpkg_relation_none) return true; - r = versioncompare(a, b); + r = dpkg_version_compare(a, b); switch (rel) { case dpkg_relation_eq: diff --git a/src/archives.c b/src/archives.c index 1d809c3fa..33fe59c8f 100644 --- a/src/archives.c +++ b/src/archives.c @@ -1631,7 +1631,7 @@ wanttoinstall(struct pkginfo *pkg) if (pkg->status < stat_unpacked) return true; - r = versioncompare(&pkg->available.version, &pkg->installed.version); + r = dpkg_version_compare(&pkg->available.version, &pkg->installed.version); if (r > 0) { return true; } else if (r == 0) { diff --git a/src/configure.c b/src/configure.c index 48ad7582e..11ec20691 100644 --- a/src/configure.c +++ b/src/configure.c @@ -288,8 +288,8 @@ deferred_configure(struct pkginfo *pkg) pkg_name(otherpkg, pnaw_always), statusinfos[otherpkg->status].name); - if (versioncompare(&pkg->installed.version, - &otherpkg->installed.version)) + if (dpkg_version_compare(&pkg->installed.version, + &otherpkg->installed.version)) ohshit(_("package %s %s cannot be configured because " "%s is at a different version (%s)"), pkg_name(pkg, pnaw_always), diff --git a/src/enquiry.c b/src/enquiry.c index fe9e30106..2cc5c9f36 100644 --- a/src/enquiry.c +++ b/src/enquiry.c @@ -651,7 +651,7 @@ cmpversions(const char *const *argv) } else if (!dpkg_version_is_informative(&b)) { return rip->if_none_b; } - r= versioncompare(&a,&b); + r = dpkg_version_compare(&a, &b); debug(dbg_general,"cmpversions a=`%s' b=`%s' r=%d", versiondescribe(&a,vdew_always), versiondescribe(&b,vdew_always), diff --git a/src/processarc.c b/src/processarc.c index c3d99a6a5..ec324eba6 100644 --- a/src/processarc.c +++ b/src/processarc.c @@ -392,7 +392,8 @@ pkgset_getting_in_sync(struct pkginfo *pkg) continue; if (otherpkg->status <= stat_configfiles) continue; - if (versioncompare(&pkg->available.version, &otherpkg->installed.version)) { + if (dpkg_version_compare(&pkg->available.version, + &otherpkg->installed.version)) { return false; } } @@ -532,7 +533,8 @@ void process_archive(const char *filename) { if (otherpkg->status <= stat_halfconfigured) continue; - if (versioncompare(&pkg->available.version, &otherpkg->installed.version)) + if (dpkg_version_compare(&pkg->available.version, + &otherpkg->installed.version)) enqueue_deconfigure(otherpkg, NULL); } @@ -716,8 +718,9 @@ void process_archive(const char *filename) { pkg_set_status(pkg, stat_halfconfigured); modstatdb_note(pkg); push_cleanup(cu_prermupgrade, ~ehflag_normaltidy, NULL, 0, 1, (void *)pkg); - if (versioncompare(&pkg->available.version, - &pkg->installed.version) >= 0) /* Upgrade or reinstall */ + if (dpkg_version_compare(&pkg->available.version, + &pkg->installed.version) >= 0) + /* Upgrade or reinstall. */ maintainer_script_alternative(pkg, PRERMFILE, "pre-removal", cidir, cidirrest, "upgrade", "failed-upgrade"); else /* Downgrade => no fallback */ |