From ffd3a6304ddb7b69f7bd5df09b292c193bea4459 Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Sat, 2 Apr 2005 20:37:50 +0000 Subject: - updated transaction events - the cache is rebuilt after each package installation (to be reworked) --- lib/libalpm/add.c | 20 ++++++++++++-------- lib/libalpm/remove.c | 10 +++++----- 2 files changed, 17 insertions(+), 13 deletions(-) (limited to 'lib/libalpm') diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 286c8f2a..1cb73e73 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -135,7 +135,7 @@ int add_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data) if(!(trans->flags & PM_TRANS_FLAG_NODEPS)) { PMList *j; - TRANS_CB(trans, PM_TRANS_EVT_DEPS_START, NULL, NULL); + TRANS_CB(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL); _alpm_log(PM_LOG_FLOW1, "looking for conflicts or unsatisfied dependencies"); lp = checkdeps(db, trans->type, trans->packages); @@ -192,13 +192,13 @@ int add_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data) FREELISTPTR(trans->packages); trans->packages = lp; - TRANS_CB(trans, PM_TRANS_EVT_DEPS_DONE, NULL, NULL); + TRANS_CB(trans, PM_TRANS_EVT_CHECKDEPS_DONE, NULL, NULL); } /* Check for file conflicts */ if(!(trans->flags & PM_TRANS_FLAG_FORCE)) { - TRANS_CB(trans, PM_TRANS_EVT_CONFLICTS_START, NULL, NULL); + TRANS_CB(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL); _alpm_log(PM_LOG_FLOW1, "looking for file conflicts"); lp = db_find_conflicts(db, trans->packages, handle->root); @@ -207,7 +207,7 @@ int add_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data) RET_ERR(PM_ERR_FILE_CONFLICTS, -1); } - TRANS_CB(trans, PM_TRANS_EVT_CONFLICTS_DONE, NULL, NULL); + TRANS_CB(trans, PM_TRANS_EVT_FILECONFLICTS_DONE, NULL, NULL); } return(0); @@ -328,7 +328,7 @@ int add_commit(pmdb_t *db, pmtrans_t *trans) } } - _alpm_log(PM_LOG_FLOW1, "adding database entry %s-%s", info->name, info->version); + _alpm_log(PM_LOG_FLOW1, "updating database"); /* Figure out whether this package was installed explicitly by the user * or installed as a dependency for another package */ @@ -615,15 +615,19 @@ int add_commit(pmdb_t *db, pmtrans_t *trans) } FREEPKG(oldpkg); + + /* cache needs to be rebuilt */ + /* ORE + cache should be updated and never freed/reloaded from scratch each time a + package is added!!! */ + db_free_pkgcache(db); + } /* run ldconfig if it exists */ _alpm_log(PM_LOG_FLOW1, "running \"ldconfig -r %s\"", handle->root); _alpm_ldconfig(handle->root); - /* cache needs to be rebuilt */ - db_free_pkgcache(db); - return(0); } diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 70bfeecf..f5a09578 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -72,7 +72,7 @@ int remove_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data) ASSERT(data != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); if(!(trans->flags & (PM_TRANS_FLAG_NODEPS)) && (trans->type != PM_TRANS_TYPE_UPGRADE)) { - TRANS_CB(trans, PM_TRANS_EVT_DEPS_START, NULL, NULL); + TRANS_CB(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL); _alpm_log(PM_LOG_FLOW1, "looking for conflicts or unsatisfied dependencies"); if((lp = checkdeps(db, trans->type, trans->packages)) != NULL) { @@ -107,7 +107,7 @@ int remove_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data) FREELISTPTR(trans->packages); trans->packages = lp; - TRANS_CB(trans, PM_TRANS_EVT_DEPS_DONE, NULL, NULL); + TRANS_CB(trans, PM_TRANS_EVT_CHECKDEPS_DONE, NULL, NULL); } return(0); @@ -256,15 +256,15 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans) TRANS_CB(trans, PM_TRANS_EVT_REMOVE_DONE, info, NULL); alpm_logaction("removed %s (%s)", info->name, info->version); } + + /* cache needs to be rebuilt */ + db_free_pkgcache(db); } /* run ldconfig if it exists */ if(trans->type != PM_TRANS_TYPE_UPGRADE) { _alpm_log(PM_LOG_FLOW1, "running \"ldconfig -r %s\"", handle->root); _alpm_ldconfig(handle->root); - - /* cache needs to be rebuilt */ - db_free_pkgcache(db); } return(0); -- cgit v1.2.3-70-g09d2