From: Michael Schroeder Date: Fri, 7 Mar 2008 14:31:43 +0000 (+0000) Subject: - handle the poolusage=3, dirpoolusage=2 case a bit better X-Git-Tag: BASE-SuSE-Code-12_1-Branch~308^2~520 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=01ab87af0ff4d8354957b26792417fce300eeaee;p=thirdparty%2Flibsolv.git - handle the poolusage=3, dirpoolusage=2 case a bit better --- diff --git a/tools/repo_write.c b/tools/repo_write.c index 64bc59b8..ef0ae63e 100644 --- a/tools/repo_write.c +++ b/tools/repo_write.c @@ -845,7 +845,7 @@ repo_write(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void int poolusage, dirpoolusage, idused, dirused; int reloff; - Repodata *data; + Repodata *data, *dirpooldata = 0; Stringpool ownspool, *spool; Dirpool owndirpool, *dirpool; @@ -1051,6 +1051,7 @@ repo_write(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void { dirpoolusage = 2; dirpool = &data->dirpool; + dirpooldata = data; } } } @@ -1071,8 +1072,6 @@ repo_write(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void else stringpool_init_empty(spool); cbdata.ownspool = spool; - if (dirpoolusage) - dirpoolusage = 3; /* hmm, maybe not needed */ } else if (poolusage == 0 || poolusage == 1) { @@ -1082,6 +1081,7 @@ repo_write(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void if (dirpoolusage == 3) { dirpool = &owndirpool; + dirpooldata = 0; dirpool_create(dirpool); cbdata.owndirpool = dirpool; } @@ -1215,8 +1215,6 @@ for (i = 1; i < cbdata.nmykeys; i++) n++; } - reloff = needid[0].map; - /* If we have fileinfos to write, setup schemas and increment needid[] of the right strings. */ for (i = 0; i < nsubfiles; i++) @@ -1320,10 +1318,18 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); continue; if (cbdata.dirused && !cbdata.dirused[i]) continue; + if (cbdata.ownspool && dirpooldata && id > 1) + { + id = putinownpool(&cbdata, dirpooldata->localpool ? &dirpooldata->spool : &pool->ss, id); + needid = cbdata.needid; + } needid[id].need++; } } + reloff = needid[0].map; + + /********************************************************************/ /* @@ -1397,7 +1403,10 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); if (dirmap[i] <= 0) continue; cbdata.dirused[dirmap[i]] = i; - dirmap[i] = needid[dirpool->dirs[dirmap[i]]].need; + id = dirpool->dirs[dirmap[i]]; + if (cbdata.ownspool && dirpooldata && id > 1) + id = putinownpool(&cbdata, dirpooldata->localpool ? &dirpooldata->spool : &pool->ss, id); + dirmap[i] = needid[id].need; } }