summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/package.c29
-rw-r--r--lib/libalpm/package.h1
-rw-r--r--lib/libalpm/sync.c3
3 files changed, 20 insertions, 13 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 304410d8..33cfb6c1 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -123,39 +123,46 @@ void _alpm_pkg_free(void *data)
}
/* Is pkgB an upgrade for pkgA ? */
-int alpm_pkg_compare_versions(pmpkg_t *pkgA, pmpkg_t *pkgB)
+int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg)
{
- if(pkgB->origin == PKG_FROM_CACHE) {
+ int cmp = 0;
+
+ ALPM_LOG_FUNC;
+
+ if(pkg->origin == PKG_FROM_CACHE) {
/* ensure we have the /desc file, which contains the 'force' option */
- _alpm_db_read(pkgB->data, INFRQ_DESC, pkgB);
+ _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
}
- if(pkgB->force) {
+ if(pkg->force) {
/* skip the version compare call if this is a 'force' package */
return(1);
}
/* compare versions and see if we need to upgrade */
- int cmp = alpm_versioncmp(pkgA->version, pkgB->version);
+ cmp = alpm_versioncmp(local_pkg->version, pkg->version);
if(cmp > 0) {
/* local version is newer */
- pmdb_t *db = pkgB->data;
+ pmdb_t *db = pkg->data;
_alpm_log(PM_LOG_WARNING, _("%s: local (%s) is newer than %s (%s)"),
- pkgA->name, pkgA->version, db->treename, pkgB->version);
+ local_pkg->name, local_pkg->version, db->treename, pkg->version);
cmp = 0;
- } else if(alpm_list_find_str(handle->ignorepkg, pkgB->name)) {
+ } else if(alpm_list_find_str(handle->ignorepkg, pkg->name)) {
/* package should be ignored (IgnorePkg) */
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)"),
- pkgA->name, pkgA->version, pkgB->version);
+ local_pkg->name, local_pkg->version, pkg->version);
cmp = 0;
- } else if(_alpm_pkg_istoonew(pkgB)) {
+ } else if(_alpm_pkg_istoonew(pkg)) {
/* package too new (UpgradeDelay) */
_alpm_log(PM_LOG_DEBUG, _("%s-%s: delaying upgrade of package (%s)"),
- pkgA->name, pkgA->version, pkgB->version);
+ local_pkg->name, local_pkg->version, pkg->version);
cmp = 0;
}
+ _alpm_log(PM_LOG_DEBUG, _("compare versions for %s: %s vs %s, result=%d"),
+ local_pkg->name, local_pkg->version, pkg->version, cmp);
+
return(cmp);
}
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index 84274cca..96a3200a 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -94,6 +94,7 @@ pmpkg_t* _alpm_pkg_new(const char *name, const char *version);
pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg);
void _alpm_pkg_free(void *data);
int _alpm_pkg_cmp(const void *p1, const void *p2);
+int alpm_pkg_compare_versions(pmpkg_t *pkgA, pmpkg_t *pkgB);
pmpkg_t *_alpm_pkg_load(char *pkgfile);
pmpkg_t *_alpm_pkg_isin(char *needle, alpm_list_t *haystack);
int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch);
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 3dcde337..6719f476 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -199,7 +199,6 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s
/* match installed packages with the sync dbs and compare versions */
_alpm_log(PM_LOG_DEBUG, _("checking for package upgrades"));
for(i = _alpm_db_get_pkgcache(db_local, INFRQ_NONE); i; i = i->next) {
- int cmp;
int replace=0;
pmpkg_t *local = i->data;
pmpkg_t *spkg = NULL;
@@ -262,7 +261,7 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
pmpkg_t *local;
pmpkg_t *spkg = NULL;
pmsyncpkg_t *sync;
- int cmp, repo_found = 0;
+ int repo_found = 0;
ALPM_LOG_FUNC;