Author: mlschroe Date: Wed Mar 5 19:08:16 2008 New Revision: 9023 URL: http://svn.opensuse.org/viewcvs/zypp?rev=9023&view=rev Log: - replace exit() with return, oops - ignore hardlinked file in DU stats - print more statistics in dumpsolv Modified: trunk/sat-solver/tools/common_write.c trunk/sat-solver/tools/dumpsolv.c trunk/sat-solver/tools/repo_rpmdb.c trunk/sat-solver/tools/repo_write.c Modified: trunk/sat-solver/tools/common_write.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/tools/common_write.c?rev=9023&r1=9022&r2=9023&view=diff ============================================================================== --- trunk/sat-solver/tools/common_write.c (original) +++ trunk/sat-solver/tools/common_write.c Wed Mar 5 19:08:16 2008 @@ -248,7 +248,7 @@ sat_free(fileinfos[i].keys); } sat_free(fileinfos); - exit(0); + return 0; } if (attrname) { Modified: trunk/sat-solver/tools/dumpsolv.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/tools/dumpsolv.c?rev=9023&r1=9022&r2=9023&view=diff ============================================================================== --- trunk/sat-solver/tools/dumpsolv.c (original) +++ trunk/sat-solver/tools/dumpsolv.c Wed Mar 5 19:08:16 2008 @@ -26,9 +26,13 @@ for (i = 0, data = repo->repodata; i < repo->nrepodata; i++, data++) { unsigned int j; - printf("%s has %d keys, %d schemata", data->location ? data->location : "**EMBED**", data->nkeys, data->nschemata); + printf("%s has %d keys, %d schemata\n", data->location ? data->location : "**EMBED**", data->nkeys, data->nschemata); for (j = 1; j < data->nkeys; j++) - printf("\n %s (type %s size %d storage %d)", id2str(repo->pool, data->keys[j].name), id2str(repo->pool, data->keys[j].type), data->keys[j].size, data->keys[j].storage); + printf(" %s (type %s size %d storage %d)\n", id2str(repo->pool, data->keys[j].name), id2str(repo->pool, data->keys[j].type), data->keys[j].size, data->keys[j].storage); + if (data->localpool) + printf(" localpool has %d strings, size is %d\n", data->spool.nstrings, data->spool.sstrings); + if (data->dirpool.ndirs) + printf(" localpool has %d directories\n", data->dirpool.ndirs); printf("\n"); } printf("\n"); @@ -248,7 +252,8 @@ repo = repo_create(pool, argc != 1 ? argv[1] : "<stdin>"); if (repo_add_solv(repo, stdin)) printf("could not read repository\n"); - dump_repodata (repo); + printf("pool contains %d strings, %d rels, string size is %d\n", pool->ss.nstrings, pool->nrels, pool->ss.sstrings); + dump_repodata(repo); printf("repo contains %d solvables\n", repo->nsolvables); for (i = repo->start, n = 1; i < repo->end; i++) { Modified: trunk/sat-solver/tools/repo_rpmdb.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/tools/repo_rpmdb.c?rev=9023&r1=9022&r2=9023&view=diff ============================================================================== --- trunk/sat-solver/tools/repo_rpmdb.c (original) +++ trunk/sat-solver/tools/repo_rpmdb.c Wed Mar 5 19:08:16 2008 @@ -54,6 +54,8 @@ #define TAG_CONFLICTNAME 1054 #define TAG_CONFLICTVERSION 1055 #define TAG_OBSOLETENAME 1090 +#define TAG_FILEDEVICES 1095 +#define TAG_FILEINODES 1096 #define TAG_PROVIDEFLAGS 1112 #define TAG_PROVIDEVERSION 1113 #define TAG_OBSOLETEFLAGS 1114 @@ -466,8 +468,11 @@ { Id entry, did; int i, fszc; - unsigned int *fkb, *fn, *fsz, *fm; + unsigned int *fkb, *fn, *fsz, *fm, *fino; + unsigned int inotest[256], inotestok; + if (!fc) + return; fsz = headint32array(rpmhead, TAG_FILESIZES, &fszc); if (!fsz || fc != fszc) { @@ -482,6 +487,80 @@ sat_free(fm); return; } + fino = headint32array(rpmhead, TAG_FILEINODES, &fszc); + if (!fino || fc != fszc) + { + sat_free(fsz); + sat_free(fm); + sat_free(fino); + return; + } + inotestok = 0; + if (fc < sizeof(inotest)) + { + memset(inotest, 0, sizeof(inotest)); + for (i = 0; i < fc; i++) + { + int off, bit; + if (fsz[i] == 0 || !S_ISREG(fm[i])) + continue; + off = (fino[i] >> 5) & (sizeof(inotest)/sizeof(*inotest) - 1); + bit = 1 << (fino[i] & 31); + if ((inotest[off] & bit) != 0) + break; + inotest[off] |= bit; + } + if (i == fc) + inotestok = 1; + } + if (!inotestok) + { + unsigned int *fdev = headint32array(rpmhead, TAG_FILEDEVICES, &fszc); + unsigned int *fx, j; + unsigned int mask, hash, hh; + if (!fdev || fc != fszc) + { + sat_free(fsz); + sat_free(fm); + sat_free(fdev); + sat_free(fino); + return; + } + mask = fc; + while ((mask & (mask - 1)) != 0) + mask = mask & (mask - 1); + mask <<= 2; + if (mask > sizeof(inotest)/sizeof(*inotest)) + fx = sat_calloc(mask, sizeof(unsigned int)); + else + { + fx = inotest; + memset(fx, 0, mask * sizeof(unsigned int)); + } + mask--; + for (i = 0; i < fc; i++) + { + if (fsz[i] == 0 || !S_ISREG(fm[i])) + continue; + hash = (fino[i] + fdev[i] * 31) & mask; + hh = 7; + while ((j = fx[hash]) != 0) + { + if (fino[j - 1] == fino[i] && fdev[j - 1] == fdev[i]) + { + fsz[i] = 0; /* kill entry */ + break; + } + hash = (hash + hh++) & mask; + } + if (!j) + fx[hash] = i + 1; + } + if (fx != inotest) + sat_free(fx); + sat_free(fdev); + } + sat_free(fino); fn = sat_calloc(dic, sizeof(unsigned int)); fkb = sat_calloc(dic, sizeof(unsigned int)); for (i = 0; i < fc; i++) @@ -491,7 +570,6 @@ if (di[i] >= dic) continue; fn[di[i]]++; - /* does not consider hard links. tough luck. */ fkb[di[i]] += fsz[i] / 1024 + 1; } sat_free(fsz); @@ -523,8 +601,10 @@ int bnc, dnc, dic; int i, j; struct filefilter *ff; +#if 0 char *fn = 0; int fna = 0; +#endif if (!repodata) return olddeps; @@ -586,6 +666,7 @@ } if (j == sizeof(filefilters)/sizeof(*filefilters)) continue; +#if 0 j = strlen(bn[i]) + strlen(dn[di[i]]) + 1; if (j > fna) { @@ -594,7 +675,6 @@ } strcpy(fn, dn[di[i]]); strcat(fn, bn[i]); -#if 0 olddeps = repo_addid_dep(repo, olddeps, str2id(pool, fn, 1), SOLVABLE_FILEMARKER); #endif if (repodata) @@ -606,8 +686,10 @@ repodata_add_dirstr(repodata, entry, SOLVABLE_FILELIST, did, bn[i]); } } +#if 0 if (fn) sat_free(fn); +#endif sat_free(bn); sat_free(dn); sat_free(di); Modified: trunk/sat-solver/tools/repo_write.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/tools/repo_write.c?rev=9023&r1=9022&r2=9023&view=diff ============================================================================== --- trunk/sat-solver/tools/repo_write.c (original) +++ trunk/sat-solver/tools/repo_write.c Wed Mar 5 19:08:16 2008 @@ -1600,6 +1600,7 @@ write_id(fp, max); write_id(fp, xd.len); write_blob(fp, xd.buf, xd.len); + sat_free(xd.buf); } /********************************************************************/ -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org