From: Michael Schroeder Date: Mon, 15 Apr 2013 12:19:02 +0000 (+0200) Subject: add pool parameter to rpm_state_create so that we can use pool_error for error reporting X-Git-Tag: BASE-SuSE-Code-12_3-Branch~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1da63a9e704f9143c09c0c02c29669c85bee6de2;p=thirdparty%2Flibsolv.git add pool parameter to rpm_state_create so that we can use pool_error for error reporting --- diff --git a/examples/solv.c b/examples/solv.c index 5d8e31e2..4e966cf2 100644 --- a/examples/solv.c +++ b/examples/solv.c @@ -145,7 +145,7 @@ yum_substitute(Pool *pool, char *line) Queue q; queue_init(&q); - rpmstate = rpm_state_create(pool_get_rootdir(pool)); + rpmstate = rpm_state_create(pool, pool_get_rootdir(pool)); rpm_installedrpmdbids(rpmstate, "Providename", "redhat-release", &q); if (q.count) { @@ -3171,7 +3171,7 @@ rerunsolver: printf("Searching for file conflicts\n"); queue_init(&conflicts); - fcstate.rpmstate = rpm_state_create(rootdir); + fcstate.rpmstate = rpm_state_create(pool, rootdir); fcstate.newpkgscnt = newpkgs; fcstate.checkq = &checkq; fcstate.newpkgsfps = newpkgsfps; diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c index 20b3715d..fc555376 100644 --- a/ext/repo_rpmdb.c +++ b/ext/repo_rpmdb.c @@ -2268,6 +2268,7 @@ rpm_query(void *rpmhandle, Id what) struct rpm_by_state { + Pool *pool; RpmHead *rpmhead; int rpmheadsize; @@ -2429,10 +2430,11 @@ freestate(struct rpm_by_state *state) } void * -rpm_state_create(const char *rootdir) +rpm_state_create(Pool *pool, const char *rootdir) { struct rpm_by_state *state; state = solv_calloc(1, sizeof(*state)); + state->pool = pool; if (rootdir) state->rootdir = solv_strdup(rootdir); return state; @@ -3195,6 +3197,7 @@ repo_add_rpmdb_pubkeys(Repo *repo, int flags) rootdir = pool_get_rootdir(pool); memset(&state, 0, sizeof(state)); + state.pool = pool; if (!(state.dbenv = opendbenv(rootdir))) return 0; entries = getinstalledrpmdbids(&state, "Name", "gpg-pubkey", &nentries, 0); diff --git a/ext/repo_rpmdb.h b/ext/repo_rpmdb.h index e513417d..117da426 100644 --- a/ext/repo_rpmdb.h +++ b/ext/repo_rpmdb.h @@ -32,7 +32,7 @@ extern Id repo_add_pubkey(Repo *repo, const char *key, int flags); #define RPM_ITERATE_FILELIST_NOGHOSTS (1 << 3) /* create and free internal state, rootdir is the rootdir of the rpm database */ -extern void *rpm_state_create(const char *rootdir); +extern void *rpm_state_create(Pool *pool, const char *rootdir); extern void *rpm_state_free(void *rpmstate); /* return all matching rpmdbids */ diff --git a/tools/findfileconflicts.c b/tools/findfileconflicts.c index cb90f548..a59c097c 100644 --- a/tools/findfileconflicts.c +++ b/tools/findfileconflicts.c @@ -54,7 +54,7 @@ int main(int argc, char **argv) queue_init(&conflicts); FOR_REPO_SOLVABLES(installed, p, s) queue_push(&todo, p); - state = rpm_state_create(pool_get_rootdir(pool)); + state = rpm_state_create(pool, pool_get_rootdir(pool)); pool_findfileconflicts(pool, &todo, 0, &conflicts, FINDFILECONFLICTS_USE_SOLVABLEFILELIST | FINDFILECONFLICTS_CHECK_DIRALIASING | FINDFILECONFLICTS_USE_ROOTDIR, &iterate_handle, state); rpm_state_free(state); queue_free(&todo);