summaryrefslogtreecommitdiff
path: root/lib/libalpm/sync.c
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-02-06 17:39:32 +0000
committerAaron Griffin <aaron@archlinux.org>2007-02-06 17:39:32 +0000
commit67ea493ec24caa7279b35a28d96e5d6f2c271f59 (patch)
treef4da3d53a46e5e4901e13d421e0e505befb64b45 /lib/libalpm/sync.c
parent26e7d16d0edd023efa10db56b745c3501f2d5db9 (diff)
downloadpacman-67ea493ec24caa7279b35a28d96e5d6f2c271f59.tar.xz
Attempt to unify the -S and -Su version comparissons for when a package is newer
See FS#5388
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r--lib/libalpm/sync.c34
1 files changed, 3 insertions, 31 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 9cf973fa..3dcde337 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -229,24 +229,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s
}
/* 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);
if(!find_pkginsync(spkg->name, trans->packages)) {
@@ -260,8 +243,6 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s
goto error;
}
trans->packages = alpm_list_add(trans->packages, sync);
- } else {
- /* spkg->name is already in the packages list -- just ignore it */
}
}
}
@@ -344,17 +325,8 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
local = _alpm_db_get_pkgfromcache(db_local, spkg->name);
if(local) {
- cmp = alpm_versioncmp(local->version, spkg->version);
- if(cmp > 0 && !spkg->force) {
- /* local version is newer -- get confirmation before adding */
- int resp = 0;
- QUESTION(trans, PM_TRANS_CONV_LOCAL_NEWER, local, NULL, NULL, &resp);
- if(!resp) {
- _alpm_log(PM_LOG_WARNING, _("%s-%s: local version is newer -- skipping"), local->name, local->version);
- return(0);
- }
- } else if(cmp == 0) {
- /* versions are identical -- get confirmation before adding */
+ if(alpm_pkg_compare_versions(local, spkg) == 0) {
+ /* spkg is NOT an upgrade, get confirmation before adding */
int resp = 0;
QUESTION(trans, PM_TRANS_CONV_LOCAL_UPTODATE, local, NULL, NULL, &resp);
if(!resp) {