FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 06-07-2008, 04:05 PM
Allan McRae
 
Default Fix warning messages when syncing installed package

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@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
"),
+ 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
"),
+ 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
"),
- 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
"),
+ 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
"),
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


_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 

Thread Tools




All times are GMT. The time now is 09:33 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org