index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Xavier Chantry <shiningxc@gmail.com> | 2008-05-31 15:06:30 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-08-23 08:47:07 -0500 |
commit | 5b51dbb11e2087e1055be24b486502be806b5e13 (patch) | |
tree | a2938506c96ba529361a55d6f92d8a29724667f2 /lib/libalpm/sync.c | |
parent | e760c4f4784c7e7b59717cd10c56dac04f175b73 (diff) |
-rw-r--r-- | lib/libalpm/sync.c | 30 |
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 7a577a12..4a705b57 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -170,6 +170,7 @@ pmpkg_t SYMEXPORT *alpm_sync_newversion(pmpkg_t *pkg, alpm_list_t *dbs_sync) { alpm_list_t *i; pmpkg_t *spkg = NULL; + int cmp; for(i = dbs_sync; !spkg && i; i = i->next) { spkg = _alpm_db_get_pkgfromcache(i->data, alpm_pkg_get_name(pkg)); @@ -182,14 +183,20 @@ pmpkg_t SYMEXPORT *alpm_sync_newversion(pmpkg_t *pkg, alpm_list_t *dbs_sync) } /* compare versions and see if spkg is an upgrade */ - if(_alpm_pkg_compare_versions(pkg, spkg)) { + cmp = _alpm_pkg_compare_versions(spkg, pkg); + if(cmp > 0) { _alpm_log(PM_LOG_DEBUG, "new version of '%s' found (%s => %s)\n", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg), alpm_pkg_get_version(spkg)); return(spkg); - } else { - return(NULL); } + if (cmp < 0) { + pmdb_t *db = spkg->origin_data.db; + _alpm_log(PM_LOG_WARNING, _("%s: local (%s) is newer than %s (%s)\n"), + alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg), + alpm_db_get_name(db), alpm_pkg_get_version(spkg)); + } + return(NULL); } /** Get a list of upgradable packages on the current system @@ -326,18 +333,23 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy local = _alpm_db_get_pkgfromcache(db_local, alpm_pkg_get_name(spkg)); if(local) { - if(_alpm_pkg_compare_versions(local, spkg) == 0) { - /* spkg is NOT an upgrade */ + int cmp = _alpm_pkg_compare_versions(spkg, local); + if(cmp == 0) { if(trans->flags & PM_TRANS_FLAG_NEEDED) { + /* with the NEEDED flag, packages up to date are not reinstalled */ _alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping\n"), alpm_pkg_get_name(local), alpm_pkg_get_version(local)); return(0); } else { - if(!(trans->flags & PM_TRANS_FLAG_DOWNLOADONLY)) { - _alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- reinstalling\n"), - alpm_pkg_get_name(local), alpm_pkg_get_version(local)); - } + _alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- reinstalling\n"), + alpm_pkg_get_name(local), alpm_pkg_get_version(local)); + } + } else if(cmp < 0) { + /* local version is newer */ + _alpm_log(PM_LOG_WARNING, _("downgrading package %s (%s => %s)\n"), + alpm_pkg_get_name(local), alpm_pkg_get_version(local), + alpm_pkg_get_version(spkg)); } } |