summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/add.c4
-rw-r--r--lib/libalpm/alpm.c22
-rw-r--r--lib/libalpm/alpm.h3
-rw-r--r--lib/libalpm/package.c2
-rw-r--r--lib/libalpm/versioncmp.c6
-rw-r--r--lib/libalpm/versioncmp.h2
6 files changed, 10 insertions, 29 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 38e193a8..f3cc07a5 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -158,7 +158,7 @@ int SYMHIDDEN _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
if(trans->flags & PM_TRANS_FLAG_FRESHEN) {
/* only upgrade/install this package if it is already installed and at a lesser version */
dummy = _alpm_db_get_pkgfromcache(db, pkgname);
- if(dummy == NULL || alpm_versioncmp(dummy->version, pkgver) >= 0) {
+ if(dummy == NULL || _alpm_versioncmp(dummy->version, pkgver) >= 0) {
pm_errno = PM_ERR_PKG_CANT_FRESH;
goto error;
}
@@ -170,7 +170,7 @@ int SYMHIDDEN _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
for(i = trans->packages; i; i = i->next) {
pmpkg_t *pkg = i->data;
if(strcmp(pkg->name, pkgname) == 0) {
- if(alpm_versioncmp(pkg->version, pkgver) < 0) {
+ if(_alpm_versioncmp(pkg->version, pkgver) < 0) {
pmpkg_t *newpkg;
_alpm_log(PM_LOG_WARNING, _("replacing older version %s-%s by %s in target list"),
pkg->name, pkg->version, pkgver);
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 0d7246d0..a366562d 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -561,7 +561,7 @@ int SYMEXPORT alpm_pkg_vercmp(const char *ver1, const char *ver2)
{
ALPM_LOG_FUNC;
- return(alpm_versioncmp(ver1, ver2));
+ return(_alpm_versioncmp(ver1, ver2));
}
/* internal */
@@ -1175,25 +1175,7 @@ alpm_list_t *alpm_get_upgrades()
continue;
}
- /* compare versions and see if we need to upgrade */
- cmp = alpm_versioncmp(local->version, spkg->version);
- if(cmp > 0 && !spkg->force) {
- /* local version is newer */
- pmdb_t *db = spkg->data;
- _alpm_log(PM_LOG_WARNING, _("%s: local (%s) is newer than %s (%s)"),
- local->name, local->version, db->treename, spkg->version);
- } else if(cmp == 0) {
- /* versions are identical */
- } else if(alpm_list_find_str(handle->ignorepkg, spkg->name)) {
- /* package should be ignored (IgnorePkg) */
- _alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)"),
- local->name, local->version, spkg->version);
- } else if(_alpm_pkg_istoonew(spkg)) {
- /* package too new (UpgradeDelay) */
- _alpm_log(PM_LOG_DEBUG, _("%s-%s: delaying upgrade of package (%s)"),
- local->name, local->version, spkg->version);
- /* check if spkg->name is already in the packages list. */
- } else {
+ if(alpm_pkg_compare_versions(local, spkg)) {
_alpm_log(PM_LOG_DEBUG, _("%s-%s elected for upgrade (%s => %s)"),
local->name, local->version, local->version, spkg->version);
alpm_list_t *s;
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 7557d47e..262593cf 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -482,9 +482,6 @@ extern enum _pmerrno_t pm_errno;
char *alpm_strerror(int err);
-/* Version Compare */
-int alpm_versioncmp(const char *a, const char *b);
-
alpm_list_t *alpm_get_upgrades();
#ifdef __cplusplus
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index bd977902..2a9144a7 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -135,7 +135,7 @@ int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg)
}
/* compare versions and see if we need to upgrade */
- cmp = alpm_versioncmp(local_pkg->version, pkg->version);
+ cmp = _alpm_versioncmp(local_pkg->version, pkg->version);
if(cmp != 0 && pkg->force) {
cmp = 1;
diff --git a/lib/libalpm/versioncmp.c b/lib/libalpm/versioncmp.c
index 0cc9e78c..489e109d 100644
--- a/lib/libalpm/versioncmp.c
+++ b/lib/libalpm/versioncmp.c
@@ -148,7 +148,7 @@ static int strverscmp (s1, s2)
#endif
/* this function was taken from rpm 4.0.4 and rewritten */
-int SYMEXPORT alpm_versioncmp(const char *a, const char *b)
+int _alpm_versioncmp(const char *a, const char *b)
{
char str1[64], str2[64];
char *ptr1, *ptr2;
@@ -238,7 +238,7 @@ int SYMEXPORT alpm_versioncmp(const char *a, const char *b)
if((!*one) && (!*two)) {
/* compare release numbers */
- if(rel1 && rel2) return(alpm_versioncmp(rel1, rel2));
+ if(rel1 && rel2) return(_alpm_versioncmp(rel1, rel2));
return(0);
}
@@ -256,7 +256,7 @@ int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
if(dep->mod == PM_DEP_MOD_ANY) {
equal = 1;
} else {
- int cmp = alpm_versioncmp(pkg->version, dep->version);
+ int cmp = _alpm_versioncmp(pkg->version, dep->version);
switch(dep->mod) {
case PM_DEP_MOD_EQ: equal = (cmp == 0); break;
case PM_DEP_MOD_GE: equal = (cmp >= 0); break;
diff --git a/lib/libalpm/versioncmp.h b/lib/libalpm/versioncmp.h
index 34f7a189..5ce3c286 100644
--- a/lib/libalpm/versioncmp.h
+++ b/lib/libalpm/versioncmp.h
@@ -27,6 +27,8 @@
#include "package.h"
int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep);
+int _alpm_versioncmp(const char *a, const char *b)
+
#endif