From 39b6d552c67a88cc17636f974a4061755955622e Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Tue, 17 Jan 2006 18:38:31 +0000 Subject: - code cleanup - log improvements --- lib/libalpm/add.c | 15 ++++++++------- lib/libalpm/conflict.c | 12 ++++++------ lib/libalpm/remove.c | 1 + 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'lib/libalpm') diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 0e0bd899..e8dfb491 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -336,9 +336,7 @@ int add_commit(pmtrans_t *trans, pmdb_t *db) RET_ERR(PM_ERR_TRANS_ABORT, -1); } /* copy the skiplist over */ - for(lp = trans->skiplist; lp; lp = lp->next) { - tr->skiplist = pm_list_add(tr->skiplist, strdup(lp->data)); - } + tr->skiplist = _alpm_list_strdup(trans->skiplist); if(remove_commit(tr, db) == -1) { FREETRANS(tr); RET_ERR(PM_ERR_TRANS_ABORT, -1); @@ -444,11 +442,12 @@ int add_commit(pmtrans_t *trans, pmdb_t *db) * (it will be the new orginal) */ for(lp = info->backup; lp; lp = lp->next) { - char *fn; char *file = lp->data; - - if(!file) continue; + if(!file) { + continue; + } if(!strcmp(file, pathname)) { + char *fn; /* 32 for the hash, 1 for the terminating NULL, and 1 for the tab delimiter */ MALLOC(fn, strlen(file)+34); sprintf(fn, "%s\t%s", file, md5_pkg); @@ -616,7 +615,8 @@ int add_commit(pmtrans_t *trans, pmdb_t *db) _alpm_log(PM_LOG_FLOW1, "updating database"); _alpm_log(PM_LOG_FLOW2, "adding database entry %s", info->name); if(db_write(db, info, INFRQ_ALL)) { - _alpm_log(PM_LOG_ERROR, "could not update database entry %s/%s-%s", db->treename, info->name, info->version); + _alpm_log(PM_LOG_ERROR, "could not update database entry %s-%s", + info->name, info->version); alpm_logaction(NULL, "error updating database for %s-%s!", info->name, info->version); RET_ERR(PM_ERR_DB_WRITE, -1); } @@ -645,6 +645,7 @@ int add_commit(pmtrans_t *trans, pmdb_t *db) FREELISTPTR(provides); } if(depinfo == NULL) { + _alpm_log(PM_LOG_ERROR, "could not find dependency %s", depend.name); /* wtf */ continue; } diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index 4e7cb12a..a9e7a963 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -76,7 +76,7 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages) STRNCPY(miss->target, tp->name, PKG_NAME_LEN); STRNCPY(miss->depend.name, dp->name, PKG_NAME_LEN); if(!pm_list_is_in(miss, baddeps)) { - _alpm_log(PM_LOG_FLOW2, "checkdeps: targs vs db: adding %s as a conflict for %s", + _alpm_log(PM_LOG_DEBUG, "checkdeps: targs vs db: adding %s as a conflict for %s", dp->name, tp->name); baddeps = pm_list_add(baddeps, miss); } else { @@ -95,7 +95,7 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages) STRNCPY(miss->target, tp->name, PKG_NAME_LEN); STRNCPY(miss->depend.name, dp->name, PKG_NAME_LEN); if(!pm_list_is_in(miss, baddeps)) { - _alpm_log(PM_LOG_FLOW2, "checkdeps: targs vs db: adding %s as a conflict for %s", + _alpm_log(PM_LOG_DEBUG, "checkdeps: targs vs db: adding %s as a conflict for %s", dp->name, tp->name); baddeps = pm_list_add(baddeps, miss); } else { @@ -121,7 +121,7 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages) STRNCPY(miss->target, tp->name, PKG_NAME_LEN); STRNCPY(miss->depend.name, otp->name, PKG_NAME_LEN); if(!pm_list_is_in(miss, baddeps)) { - _alpm_log(PM_LOG_FLOW2, "checkdeps: targs vs targs: adding %s as a conflict for %s", + _alpm_log(PM_LOG_DEBUG, "checkdeps: targs vs targs: adding %s as a conflict for %s", otp->name, tp->name); baddeps = pm_list_add(baddeps, miss); } else { @@ -139,7 +139,7 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages) STRNCPY(miss->target, tp->name, PKG_NAME_LEN); STRNCPY(miss->depend.name, otp->name, PKG_NAME_LEN); if(!pm_list_is_in(miss, baddeps)) { - _alpm_log(PM_LOG_FLOW2, "checkdeps: targs vs targs: adding %s as a conflict for %s", + _alpm_log(PM_LOG_DEBUG, "checkdeps: targs vs targs: adding %s as a conflict for %s", otp->name, tp->name); baddeps = pm_list_add(baddeps, miss); } else { @@ -166,7 +166,7 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages) STRNCPY(miss->target, tp->name, PKG_NAME_LEN); STRNCPY(miss->depend.name, info->name, PKG_NAME_LEN); if(!pm_list_is_in(miss, baddeps)) { - _alpm_log(PM_LOG_FLOW2, "checkdeps: db vs targs: adding %s as a conflict for %s", + _alpm_log(PM_LOG_DEBUG, "checkdeps: db vs targs: adding %s as a conflict for %s", info->name, tp->name); baddeps = pm_list_add(baddeps, miss); } else { @@ -186,7 +186,7 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages) STRNCPY(miss->target, tp->name, PKG_NAME_LEN); STRNCPY(miss->depend.name, info->name, PKG_NAME_LEN); if(!pm_list_is_in(miss, baddeps)) { - _alpm_log(PM_LOG_FLOW2, "checkdeps: db vs targs: adding %s as a conflict for %s", + _alpm_log(PM_LOG_DEBUG, "checkdeps: db vs targs: adding %s as a conflict for %s", info->name, tp->name); baddeps = pm_list_add(baddeps, miss); } else { diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index b519cdc4..966df1b6 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -277,6 +277,7 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db) FREELISTPTR(provides); } if(depinfo == NULL) { + _alpm_log(PM_LOG_ERROR, "could not find dependency %s", depend.name); /* wtf */ continue; } -- cgit v1.2.3-70-g09d2