Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=ea31391631e4d11b713a1976e35656c2f3eefe41
commit ea31391631e4d11b713a1976e35656c2f3eefe41 Author: Michel Hermier <[email protected]> Date: Fri Apr 5 13:10:15 2013 +0200 libpacman: Do not need to pass db arguments when we can simply pass trans object. diff --git a/lib/libpacman/deps.c b/lib/libpacman/deps.c index c73e008..6aa9921 100644 --- a/lib/libpacman/deps.c +++ b/lib/libpacman/deps.c @@ -204,7 +204,7 @@ pmlist_t *_pacman_sortbydeps(pmlist_t *targets, int mode) * dependencies can include versions with depmod operators. * */ -pmlist_t *_pacman_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist_t *packages) +pmlist_t *_pacman_checkdeps(pmtrans_t *trans, unsigned char op, pmlist_t *packages) { pmdepend_t depend; pmlist_t *i, *j, *k; @@ -212,11 +212,13 @@ pmlist_t *_pacman_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmli int found = 0; pmlist_t *baddeps = NULL; pmdepmissing_t *miss = NULL; + pmdb_t *db = trans->handle->db_local; if(db == NULL) { return(NULL); } + if(op == PM_TRANS_TYPE_UPGRADE) { /* PM_TRANS_TYPE_UPGRADE handles the backwards dependencies, ie, the packages * listed in the requiredby field. @@ -564,19 +566,19 @@ pmlist_t *_pacman_removedeps(pmdb_t *db, pmlist_t *targs) * * make sure *list and *trail are already initialized */ -int _pacman_resolvedeps(pmdb_t *local, pmlist_t *dbs_sync, pmpkg_t *syncpkg, pmlist_t *list, - pmlist_t *trail, pmtrans_t *trans, pmlist_t **data) +int _pacman_resolvedeps(pmtrans_t *trans, pmpkg_t *syncpkg, pmlist_t *list, + pmlist_t *trail, pmlist_t **data) { pmlist_t *i, *j; pmlist_t *targ; pmlist_t *deps = NULL; - if(local == NULL || dbs_sync == NULL || syncpkg == NULL) { + if(trans == NULL || syncpkg == NULL) { return(-1); } targ = _pacman_list_add(NULL, syncpkg); - deps = _pacman_checkdeps(trans, local, PM_TRANS_TYPE_ADD, targ); + deps = _pacman_checkdeps(trans, PM_TRANS_TYPE_ADD, targ); FREELISTPTR(targ); if(deps == NULL) { @@ -603,11 +605,11 @@ int _pacman_resolvedeps(pmdb_t *local, pmlist_t *dbs_sync, pmpkg_t *syncpkg, pml /* find the package in one of the repositories */ /* check literals */ - for(j = dbs_sync; !ps && j; j = j->next) { + for(j = trans->handle->dbs_sync; !ps && j; j = j->next) { ps = _pacman_db_get_pkgfromcache(j->data, miss->depend.name); } /* check provides */ - for(j = dbs_sync; !ps && j; j = j->next) { + for(j = trans->handle->dbs_sync; !ps && j; j = j->next) { pmlist_t *provides; provides = _pacman_db_whatprovides(j->data, miss->depend.name); if(provides) { @@ -648,7 +650,7 @@ int _pacman_resolvedeps(pmdb_t *local, pmlist_t *dbs_sync, pmpkg_t *syncpkg, pml } if(usedep) { trail = _pacman_list_add(trail, ps); - if(_pacman_resolvedeps(local, dbs_sync, ps, list, trail, trans, data)) { + if(_pacman_resolvedeps(trans, ps, list, trail, data)) { goto error; } _pacman_log(PM_LOG_DEBUG, _("pulling dependency %s (needed by %s)"), diff --git a/lib/libpacman/deps.h b/lib/libpacman/deps.h index 4d4c636..3ec33be 100644 --- a/lib/libpacman/deps.h +++ b/lib/libpacman/deps.h @@ -50,11 +50,11 @@ pmdepmissing_t *_pacman_depmiss_new(const char *target, unsigned char type, unsi const char *depname, const char *depversion); int _pacman_depmiss_isin(pmdepmissing_t *needle, pmlist_t *haystack); pmlist_t *_pacman_sortbydeps(pmlist_t *targets, int mode); -pmlist_t *_pacman_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist_t *packages); +pmlist_t *_pacman_checkdeps(pmtrans_t *trans, unsigned char op, pmlist_t *packages); int _pacman_splitdep(char *depstr, pmdepend_t *depend); pmlist_t *_pacman_removedeps(pmdb_t *db, pmlist_t *targs); -int _pacman_resolvedeps(pmdb_t *local, pmlist_t *dbs_sync, pmpkg_t *syncpkg, pmlist_t *list, - pmlist_t *trail, pmtrans_t *trans, pmlist_t **data); +int _pacman_resolvedeps(pmtrans_t *trans, pmpkg_t *syncpkg, pmlist_t *list, + pmlist_t *trail, pmlist_t **data); int _pacman_depcmp(pmpkg_t *pkg, pmdepend_t *dep); #endif /* _PACMAN_DEPS_H */ diff --git a/lib/libpacman/sync.c b/lib/libpacman/sync.c index 7778db0..c41ea1f 100644 --- a/lib/libpacman/sync.c +++ b/lib/libpacman/sync.c @@ -242,7 +242,7 @@ int _pacman_sync_prepare(pmtrans_t *trans, pmlist_t **data) _pacman_log(PM_LOG_FLOW1, _("resolving targets dependencies")); for(i = trans->packages; i; i = i->next) { pmpkg_t *spkg = ((pmsyncpkg_t *)i->data)->pkg_new; - if(_pacman_resolvedeps(db_local, dbs_sync, spkg, list, trail, trans, data) == -1) { + if(_pacman_resolvedeps(trans, spkg, list, trail, data) == -1) { /* pm_errno is set by resolvedeps */ ret = -1; goto cleanup; @@ -293,7 +293,7 @@ int _pacman_sync_prepare(pmtrans_t *trans, pmlist_t **data) EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_DONE, NULL, NULL); _pacman_log(PM_LOG_FLOW1, _("looking for unresolvable dependencies")); - deps = _pacman_checkdeps(trans, db_local, PM_TRANS_TYPE_UPGRADE, list); + deps = _pacman_checkdeps(trans, PM_TRANS_TYPE_UPGRADE, list); if(deps) { if(data) { *data = deps; @@ -501,7 +501,7 @@ int _pacman_sync_prepare(pmtrans_t *trans, pmlist_t **data) } if(list) { _pacman_log(PM_LOG_FLOW1, _("checking dependencies of packages designated for removal")); - deps = _pacman_checkdeps(trans, db_local, PM_TRANS_TYPE_REMOVE, list); + deps = _pacman_checkdeps(trans, PM_TRANS_TYPE_REMOVE, list); if(deps) { int errorout = 0; for(i = deps; i; i = i->next) { diff --git a/lib/libpacman/trans.c b/lib/libpacman/trans.c index 843298a..8c0c148 100644 --- a/lib/libpacman/trans.c +++ b/lib/libpacman/trans.c @@ -434,7 +434,7 @@ int _pacman_trans_prepare(pmtrans_t *trans, pmlist_t **data) EVENT(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL); /* look for unsatisfied dependencies */ _pacman_log(PM_LOG_FLOW1, _("looking for unsatisfied dependencies")); - lp = _pacman_checkdeps(trans, db_local, trans->type, trans->_packages); + lp = _pacman_checkdeps(trans, trans->type, trans->_packages); if(lp != NULL) { if(data) { *data = lp; @@ -513,7 +513,7 @@ int _pacman_trans_prepare(pmtrans_t *trans, pmlist_t **data) EVENT(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL); _pacman_log(PM_LOG_FLOW1, _("looking for unsatisfied dependencies")); - lp = _pacman_checkdeps(trans, db_local, trans->type, trans->_packages); + lp = _pacman_checkdeps(trans, trans->type, trans->_packages); if(lp != NULL) { if(trans->flags & PM_TRANS_FLAG_CASCADE) { while(lp) { @@ -530,7 +530,7 @@ int _pacman_trans_prepare(pmtrans_t *trans, pmlist_t **data) } } FREELIST(lp); - lp = _pacman_checkdeps(trans, db_local, trans->type, trans->_packages); + lp = _pacman_checkdeps(trans, trans->type, trans->_packages); } } else { if(data) { _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
