[pacman-dev] [PATCH] Fix warning messages when syncing installed package
Allan McRae
mcrae_allan at hotmail.com
Sat Jun 7 12:05:37 EDT 2008
The patch fixes the warning messages when syncing a package where
the local version is newer that the db version. Also, all messages
are suppressed when using --print-uris and messages about upgrading
or reinstalling are suppressed when using --downloadonly
Signed-off-by: Allan McRae <mcrae_allan at hotmail.com>
---
lib/libalpm/sync.c | 33 +++++++++++++++++++++++++++------
1 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 3dc54d0..f10e1b3 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -333,19 +333,40 @@ 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_vercmp(alpm_pkg_get_version(spkg), alpm_pkg_get_version(local));
+
+ if(cmp == -1) {
+ /* local is newer than spkg */
+ _alpm_db_read(spkg->origin_data.db, spkg, INFRQ_DESC);
+ if(spkg->force) {
+ if(!(trans->flags & (PM_TRANS_FLAG_DOWNLOADONLY | PM_TRANS_FLAG_PRINTURIS))) {
+ _alpm_log(PM_LOG_WARNING, _("%s: forcing upgrade to version %s\n"),
+ alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
+ }
+ } else {
+ /* we are downgrading */
+ if(!(trans->flags & (PM_TRANS_FLAG_DOWNLOADONLY | PM_TRANS_FLAG_PRINTURIS))) {
+ pmdb_t *db = spkg->origin_data.db;
+ _alpm_log(PM_LOG_WARNING, _("%s-%s is newer than in %s -- downgrading\n"),
+ alpm_pkg_get_name(local), alpm_pkg_get_version(local),
+ alpm_db_get_name(db));
+ }
+ }
+ } else if(cmp == 0) {
+ /* spkg has same version as local */
if(trans->flags & PM_TRANS_FLAG_NEEDED) {
- _alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping\n"),
- alpm_pkg_get_name(local), alpm_pkg_get_version(local));
+ if(!(trans->flags & PM_TRANS_FLAG_PRINTURIS)) {
+ _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)) {
+ if(!(trans->flags & (PM_TRANS_FLAG_DOWNLOADONLY | PM_TRANS_FLAG_PRINTURIS))) {
_alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- reinstalling\n"),
alpm_pkg_get_name(local), alpm_pkg_get_version(local));
}
}
- }
+ } /* else cmp == 1 - spkg is newer than local */
}
/* add the package to the transaction */
--
1.5.5.3
More information about the pacman-dev
mailing list