Hello community,
here is the log from the commit of package libsatsolver
checked in at Mon Mar 17 16:14:23 CET 2008.
--------
--- libsatsolver/libsatsolver.changes 2008-03-14 08:38:47.000000000 +0100
+++ /mounts/work_src_done/STABLE/libsatsolver/libsatsolver.changes 2008-03-17 16:11:27.000000000 +0100
@@ -1,0 +2,6 @@
+Mon Mar 17 16:10:22 CET 2008 - matz@suse.de
+
+- Initialize all allocated array members for blocky arrays (when it
+ matters, e.g. when extending also in blocks - bnc#371137)
+
+-------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libsatsolver.spec ++++++
--- /var/tmp/diff_new_pack.jM4095/_old 2008-03-17 16:14:01.000000000 +0100
+++ /var/tmp/diff_new_pack.jM4095/_new 2008-03-17 16:14:01.000000000 +0100
@@ -12,7 +12,7 @@
Name: libsatsolver
Version: 0.0.22
-Release: 2
+Release: 3
License: BSD 3-Clause
Url: http://svn.opensuse.org/svn/zypp/trunk/sat-solver
Source: satsolver-%{version}.tar.bz2
@@ -156,6 +156,9 @@
%{perl_vendorlib}/satsolverx.pm
%changelog
+* Mon Mar 17 2008 matz@suse.de
+- Initialize all allocated array members for blocky arrays (when it
+ matters, e.g. when extending also in blocks - bnc#371137)
* Fri Mar 14 2008 coolo@suse.de
- fix build on other distris
- fix requires of tools
++++++ satsolver-0.0.22.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/satsolver-0.0.22/package/libsatsolver.changes new/satsolver-0.0.22/package/libsatsolver.changes
--- old/satsolver-0.0.22/package/libsatsolver.changes 2008-03-14 08:38:46.000000000 +0100
+++ new/satsolver-0.0.22/package/libsatsolver.changes 2008-03-17 16:11:26.000000000 +0100
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Mon Mar 17 16:10:22 CET 2008 - matz@suse.de
+
+- Initialize all allocated array members for blocky arrays (when it
+ matters, e.g. when extending also in blocks - bnc#371137)
+
+-------------------------------------------------------------------
Fri Mar 14 08:37:47 CET 2008 - coolo@suse.de
- fix build on other distris
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/satsolver-0.0.22/src/dirpool.c new/satsolver-0.0.22/src/dirpool.c
--- old/satsolver-0.0.22/src/dirpool.c 2008-03-14 08:38:46.000000000 +0100
+++ new/satsolver-0.0.22/src/dirpool.c 2008-03-17 16:11:26.000000000 +0100
@@ -32,8 +32,7 @@
if (!dp->ndirs)
return;
dp->dirs = sat_extend_resize(dp->dirs, dp->ndirs, sizeof(Id), DIR_BLOCK);
- dirtraverse = sat_extend_resize(0, dp->ndirs, sizeof(Id), DIR_BLOCK);
- memset(dirtraverse, 0, dp->ndirs * sizeof(Id));
+ dirtraverse = sat_calloc_block(dp->ndirs, sizeof(Id), DIR_BLOCK);
for (parent = 0, i = 0; i < dp->ndirs; i++)
{
if (dp->dirs[i] > 0)
@@ -100,4 +99,3 @@
dp->dirtraverse[dp->ndirs] = 0;
return dp->ndirs++;
}
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/satsolver-0.0.22/src/pool.c new/satsolver-0.0.22/src/pool.c
--- old/satsolver-0.0.22/src/pool.c 2008-03-14 08:38:46.000000000 +0100
+++ new/satsolver-0.0.22/src/pool.c 2008-03-17 16:11:26.000000000 +0100
@@ -124,7 +124,7 @@
stringpool_init (&pool->ss, initpool_data);
- /* alloc space for ReDep 0 */
+ /* alloc space for RelDep 0 */
pool->rels = sat_extend_resize(0, 1, sizeof(Reldep), REL_BLOCK);
pool->nrels = 1;
memset(pool->rels, 0, sizeof(Reldep));
@@ -339,10 +339,8 @@
pool_freeidhashes(pool); /* XXX: should not be here! */
pool_freewhatprovides(pool);
num = pool->ss.nstrings;
- pool->whatprovides = whatprovides = sat_extend_resize(0, num, sizeof(Offset), WHATPROVIDES_BLOCK);
- memset(whatprovides, 0, num * sizeof(Offset));
- pool->whatprovides_rel = sat_extend_resize(0, pool->nrels, sizeof(Offset), WHATPROVIDES_BLOCK);
- memset(pool->whatprovides_rel, 0, pool->nrels * sizeof(Offset));
+ pool->whatprovides = whatprovides = sat_calloc_block(num, sizeof(Offset), WHATPROVIDES_BLOCK);
+ pool->whatprovides_rel = sat_calloc_block(pool->nrels, sizeof(Offset), WHATPROVIDES_BLOCK);
/* count providers for each name */
for (i = 1; i < pool->nsolvables; i++)
@@ -931,5 +929,235 @@
return pool->tmpspacebuf[n];
}
+/*******************************************************************/
+
+struct mptree {
+ Id sibling;
+ Id child;
+ const char *comp;
+ int compl;
+ Id mountpoint;
+};
+
+struct ducbdata {
+ DUChanges *mps;
+ struct mptree *mptree;
+ int addsub;
+
+ Id *dirmap;
+ int nmap;
+ Repodata *olddata;
+};
+
+
+static int
+solver_fill_DU_cb(void *cbdata, Solvable *s, Repodata *data, Repokey *key, KeyValue *value)
+{
+ struct ducbdata *cbd = cbdata;
+ Id mp;
+
+ if (data != cbd->olddata)
+ {
+ Id dn, mp, comp, *dirmap, *dirs;
+ int i, compl;
+ const char *compstr;
+ struct mptree *mptree;
+
+ /* create map from dir to mptree */
+ cbd->dirmap = sat_free(cbd->dirmap);
+ cbd->nmap = 0;
+ dirmap = sat_calloc(data->dirpool.ndirs, sizeof(Id));
+ mptree = cbd->mptree;
+ mp = 0;
+ for (dn = 2, dirs = data->dirpool.dirs + dn; dn < data->dirpool.ndirs; dn++)
+ {
+ comp = *dirs++;
+ if (comp <= 0)
+ {
+ mp = dirmap[-comp];
+ continue;
+ }
+ if (mp < 0)
+ {
+ /* unconnected */
+ dirmap[dn] = mp;
+ continue;
+ }
+ if (!mptree[mp].child)
+ {
+ dirmap[dn] = -mp;
+ continue;
+ }
+ if (data->localpool)
+ compstr = stringpool_id2str(&data->spool, comp);
+ else
+ compstr = id2str(data->repo->pool, comp);
+ compl = strlen(compstr);
+ for (i = mptree[mp].child; i; i = mptree[i].sibling)
+ if (mptree[i].compl == compl && !strncmp(mptree[i].comp, compstr, compl))
+ break;
+ dirmap[dn] = i ? i : -mp;
+ }
+ /* change dirmap to point to mountpoint instead of mptree */
+ for (dn = 0; dn < data->dirpool.ndirs; dn++)
+ {
+ mp = dirmap[dn];
+ dirmap[dn] = mptree[mp > 0 ? mp : -mp].mountpoint;
+ }
+ cbd->dirmap = dirmap;
+ cbd->nmap = data->dirpool.ndirs;
+ cbd->olddata = data;
+ }
+ if (value->id < 0 || value->id >= cbd->nmap)
+ return 0;
+ mp = cbd->dirmap[value->id];
+ if (mp < 0)
+ return 0;
+ if (cbd->addsub > 0)
+ {
+ cbd->mps[mp].kbytes += value->num;
+ cbd->mps[mp].files += value->num2;
+ }
+ else
+ {
+ cbd->mps[mp].kbytes -= value->num;
+ cbd->mps[mp].files -= value->num2;
+ }
+ return 0;
+}
+
+static void
+propagate_mountpoints(struct mptree *mptree, int pos, Id mountpoint)
+{
+ int i;
+ if (mptree[pos].mountpoint == -1)
+ mptree[pos].mountpoint = mountpoint;
+ else
+ mountpoint = mptree[pos].mountpoint;
+ for (i = mptree[pos].child; i; i = mptree[i].sibling)
+ propagate_mountpoints(mptree, i, mountpoint);
+}
+
+#define MPTREE_BLOCK 15
+
+void
+pool_calc_duchanges(Pool *pool, Queue *pkgs, DUChanges *mps, int nmps)
+{
+ char *p;
+ const char *path, *compstr;
+ struct mptree *mptree;
+ int i, nmptree;
+ int pos, compl;
+ int mp;
+ struct ducbdata cbd;
+
+ cbd.mps = mps;
+ cbd.addsub = 0;
+ cbd.dirmap = 0;
+ cbd.nmap = 0;
+ cbd.olddata = 0;
+
+ mptree = sat_extend_resize(0, 1, sizeof(struct mptree), MPTREE_BLOCK);
+
+ /* our root node */
+ mptree[0].sibling = 0;
+ mptree[0].child = 0;
+ mptree[0].comp = 0;
+ mptree[0].compl = 0;
+ mptree[0].mountpoint = -1;
+ nmptree = 1;
+
+ /* create component tree */
+ for (mp = 0; mp < nmps; mp++)
+ {
+ mps[mp].kbytes = 0;
+ mps[mp].files = 0;
+ pos = 0;
+ path = mps[mp].path;
+ while(*path == '/')
+ path++;
+ while (*path)
+ {
+ if ((p = strchr(path, '/')) == 0)
+ {
+ compstr = path;
+ compl = strlen(compstr);
+ path += compl;
+ }
+ else
+ {
+ compstr = path;
+ compl = p - path;
+ path = p + 1;
+ while(*path == '/')
+ path++;
+ }
+ for (i = mptree[pos].child; i; i = mptree[i].sibling)
+ if (mptree[i].compl == compl && !strncmp(mptree[i].comp, compstr, compl))
+ break;
+ if (!i)
+ {
+ /* create new node */
+ mptree = sat_extend(mptree, nmptree, 1, sizeof(struct mptree), MPTREE_BLOCK);
+ i = nmptree++;
+ mptree[i].sibling = mptree[pos].child;
+ mptree[i].child = 0;
+ mptree[i].comp = compstr;
+ mptree[i].compl = compl;
+ mptree[i].mountpoint = -1;
+ mptree[pos].child = i;
+ }
+ pos = i;
+ }
+ mptree[pos].mountpoint = mp;
+ }
+
+ propagate_mountpoints(mptree, 0, mptree[0].mountpoint);
+
+#if 0
+ for (i = 0; i < nmptree; i++)
+ {
+ printf("#%d sibling: %d\n", i, mptree[i].sibling);
+ printf("#%d child: %d\n", i, mptree[i].child);
+ printf("#%d comp: %s\n", i, mptree[i].comp);
+ printf("#%d compl: %d\n", i, mptree[i].compl);
+ printf("#%d mountpont: %d\n", i, mptree[i].mountpoint);
+ }
+#endif
+
+ cbd.mptree = mptree;
+ cbd.addsub = 1;
+ for (i = 0; i < pkgs->count; i++)
+ {
+ Id sp = pkgs->elements[i];
+ if (sp > 0)
+ repo_search(pool->solvables[sp].repo, sp, SOLVABLE_DISKUSAGE, 0, 0, solver_fill_DU_cb, &cbd);
+ }
+ cbd.addsub = -1;
+ for (i = 0; i < pkgs->count; i++)
+ {
+ Id sp = pkgs->elements[i];
+ if (sp < 0)
+ repo_search(pool->solvables[-sp].repo, -sp, SOLVABLE_DISKUSAGE, 0, 0, solver_fill_DU_cb, &cbd);
+ }
+ sat_free(mptree);
+}
+
+int
+pool_calc_installsizechange(Pool *pool, Queue *pkgs)
+{
+ int i, change;
+
+ change = 0;
+ for (i = 0; i < pkgs->count; i++)
+ {
+ Id sp = pkgs->elements[i];
+ if (sp > 0)
+ change += repo_lookup_num(pool->solvables + sp, SOLVABLE_INSTALLSIZE);
+ else if (sp < 0)
+ change -= repo_lookup_num(pool->solvables - sp, SOLVABLE_INSTALLSIZE);
+ }
+ return change;
+}
// EOF
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/satsolver-0.0.22/src/pool.h new/satsolver-0.0.22/src/pool.h
--- old/satsolver-0.0.22/src/pool.h 2008-03-14 08:38:46.000000000 +0100
+++ new/satsolver-0.0.22/src/pool.h 2008-03-17 16:11:26.000000000 +0100
@@ -315,6 +315,15 @@
*/
void pool_search(Pool *pool, Id p, Id key, const char *match, int flags, int (*callback)(void *cbdata, Solvable *s, struct _Repodata *data, struct _Repokey *key, struct _KeyValue *kv), void *cbdata);
+typedef struct _duchanges {
+ const char *path;
+ int kbytes;
+ int files;
+} DUChanges;
+
+void pool_calc_duchanges(Pool *pool, Queue *pkgs, DUChanges *mps, int nmps);
+int pool_calc_installsizechange(Pool *pool, Queue *pkgs);
+
/* loop over all providers of d */
#define FOR_PROVIDES(v, vp, d) \
for (vp = pool_whatprovides(pool, d) ; (v = *vp++) != 0; )
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/satsolver-0.0.22/src/poolid.c new/satsolver-0.0.22/src/poolid.c
--- old/satsolver-0.0.22/src/poolid.c 2008-03-14 08:38:46.000000000 +0100
+++ new/satsolver-0.0.22/src/poolid.c 2008-03-17 16:11:26.000000000 +0100
@@ -233,7 +233,7 @@
dep2strcpy(pool, p, id);
return p;
}
-
+
void
pool_shrink_strings(Pool *pool)
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/satsolver-0.0.22/src/repodata.c new/satsolver-0.0.22/src/repodata.c
--- old/satsolver-0.0.22/src/repodata.c 2008-03-14 08:38:46.000000000 +0100
+++ new/satsolver-0.0.22/src/repodata.c 2008-03-17 16:11:26.000000000 +0100
@@ -872,8 +872,7 @@
return;
if (!data->incoreoffset)
{
- data->incoreoffset = sat_extend_resize(data->incoreoffset, num, sizeof(Id), REPODATA_BLOCK);
- memset(data->incoreoffset, 0, num * sizeof(Id));
+ data->incoreoffset = sat_calloc_block(num, sizeof(Id), REPODATA_BLOCK);
data->start = start;
data->end = start + num;
return;
@@ -896,8 +895,8 @@
int i;
if (!data->attrs)
{
- data->attrs = sat_extend_resize(0, data->end - data->start, sizeof(Id *), REPODATA_BLOCK);
- memset(data->attrs, 0, (data->end - data->start) * sizeof(Id *));
+ data->attrs = sat_calloc_block(data->end - data->start, sizeof(Id *),
+ REPODATA_BLOCK);
}
i = 0;
if (data->attrs[entry])
@@ -1487,6 +1486,52 @@
return parent;
}
+const char *
+repodata_dir2str(Repodata *data, Id did, const char *suf)
+{
+ Pool *pool = data->repo->pool;
+ int l = 0;
+ Id parent, comp;
+ const char *comps;
+ char *p;
+
+ if (!did)
+ return suf ? suf : "";
+ parent = did;
+ while (parent)
+ {
+ comp = dirpool_compid(&data->dirpool, parent);
+ comps = stringpool_id2str(data->localpool ? &data->spool : &pool->ss, comp);
+ l += strlen(comps);
+ parent = dirpool_parent(&data->dirpool, parent);
+ if (parent)
+ l++;
+ }
+ if (suf)
+ l += strlen(suf) + 1;
+ p = pool_alloctmpspace(pool, l + 1) + l;
+ *p = 0;
+ if (suf)
+ {
+ p -= strlen(suf);
+ strcpy(p, suf);
+ *--p = '/';
+ }
+ parent = did;
+ while (parent)
+ {
+ comp = dirpool_compid(&data->dirpool, parent);
+ comps = stringpool_id2str(data->localpool ? &data->spool : &pool->ss, comp);
+ l = strlen(comps);
+ p -= l;
+ strncpy(p, comps, l);
+ parent = dirpool_parent(&data->dirpool, parent);
+ if (parent)
+ *--p = '/';
+ }
+ return p;
+}
+
unsigned int
repodata_compress_page(unsigned char *page, unsigned int len, unsigned char *cpage, unsigned int max)
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/satsolver-0.0.22/src/repodata.h new/satsolver-0.0.22/src/repodata.h
--- old/satsolver-0.0.22/src/repodata.h 2008-03-14 08:38:46.000000000 +0100
+++ new/satsolver-0.0.22/src/repodata.h 2008-03-17 16:11:26.000000000 +0100
@@ -140,6 +140,7 @@
void repodata_disable_paging(Repodata *data);
Id repodata_str2dir(Repodata *data, const char *dir, int create);
+const char *repodata_dir2str(Repodata *data, Id did, const char *suf);
unsigned int repodata_compress_page(unsigned char *, unsigned int, unsigned char *, unsigned int);
void repodata_read_or_setup_pages(Repodata *data, unsigned int pagesz, unsigned int blobsz);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/satsolver-0.0.22/src/solver.c new/satsolver-0.0.22/src/solver.c
--- old/satsolver-0.0.22/src/solver.c 2008-03-14 08:38:46.000000000 +0100
+++ new/satsolver-0.0.22/src/solver.c 2008-03-17 16:11:26.000000000 +0100
@@ -3884,271 +3884,63 @@
/***********************************************************************/
-struct mptree {
- Id sibling;
- Id child;
- const char *comp;
- int compl;
- Id mountpoint;
-};
-
-struct ducbdata {
- DUChanges *mps;
- struct mptree *mptree;
- int addsub;
-
- Id *dirmap;
- int nmap;
- Repodata *olddata;
-};
-
-
-static int
-solver_fill_DU_cb(void *cbdata, Solvable *s, Repodata *data, Repokey *key, KeyValue *value)
-{
- struct ducbdata *cbd = cbdata;
- Id mp;
-
- if (data != cbd->olddata)
- {
- Id dn, mp, comp, *dirmap, *dirs;
- int i, compl;
- const char *compstr;
- struct mptree *mptree;
-
- /* create map from dir to mptree */
- cbd->dirmap = sat_free(cbd->dirmap);
- cbd->nmap = 0;
- dirmap = sat_calloc(data->dirpool.ndirs, sizeof(Id));
- mptree = cbd->mptree;
- mp = 0;
- for (dn = 2, dirs = data->dirpool.dirs + dn; dn < data->dirpool.ndirs; dn++)
- {
- comp = *dirs++;
- if (comp <= 0)
- {
- mp = dirmap[-comp];
- continue;
- }
- if (mp < 0)
- {
- /* unconnected */
- dirmap[dn] = mp;
- continue;
- }
- if (!mptree[mp].child)
- {
- dirmap[dn] = -mp;
- continue;
- }
- if (data->localpool)
- compstr = stringpool_id2str(&data->spool, comp);
- else
- compstr = id2str(data->repo->pool, comp);
- compl = strlen(compstr);
- for (i = mptree[mp].child; i; i = mptree[i].sibling)
- if (mptree[i].compl == compl && !strncmp(mptree[i].comp, compstr, compl))
- break;
- dirmap[dn] = i ? i : -mp;
- }
- /* change dirmap to point to mountpoint instead of mptree */
- for (dn = 0; dn < data->dirpool.ndirs; dn++)
- {
- mp = dirmap[dn];
- dirmap[dn] = mptree[mp > 0 ? mp : -mp].mountpoint;
- }
- cbd->dirmap = dirmap;
- cbd->nmap = data->dirpool.ndirs;
- cbd->olddata = data;
- }
- if (value->id < 0 || value->id >= cbd->nmap)
- return 0;
- mp = cbd->dirmap[value->id];
- if (mp < 0)
- return 0;
- if (cbd->addsub > 0)
- {
- cbd->mps[mp].kbytes += value->num;
- cbd->mps[mp].files += value->num2;
- }
- else
- {
- cbd->mps[mp].kbytes -= value->num;
- cbd->mps[mp].files -= value->num2;
- }
- return 0;
-}
-
-static void
-propagate_mountpoints(struct mptree *mptree, int pos, Id mountpoint)
-{
- int i;
- if (mptree[pos].mountpoint == -1)
- mptree[pos].mountpoint = mountpoint;
- else
- mountpoint = mptree[pos].mountpoint;
- for (i = mptree[pos].child; i; i = mptree[i].sibling)
- propagate_mountpoints(mptree, i, mountpoint);
-}
-
-#define MPTREE_BLOCK 15
-
void
-solver_calc_duchanges(Solver *solv, DUChanges *mps, int nmps)
+solver_calc_changed_pkgs(Solver *solv, Queue *pkgs)
{
Pool *pool = solv->pool;
- Solvable *s;
- char *p;
- const char *path, *compstr;
- struct mptree *mptree;
- int i, nmptree;
- int pos, compl;
- int mp;
Map installmap;
- struct ducbdata cbd;
-
- cbd.mps = mps;
- cbd.addsub = 0;
- cbd.dirmap = 0;
- cbd.nmap = 0;
- cbd.olddata = 0;
-
- mptree = sat_extend_resize(0, 1, sizeof(struct mptree), MPTREE_BLOCK);
-
- /* our root node */
- mptree[0].sibling = 0;
- mptree[0].child = 0;
- mptree[0].comp = 0;
- mptree[0].compl = 0;
- mptree[0].mountpoint = -1;
- nmptree = 1;
-
- /* create component tree */
- for (mp = 0; mp < nmps; mp++)
- {
- mps[mp].kbytes = 0;
- mps[mp].files = 0;
- pos = 0;
- path = mps[mp].path;
- while(*path == '/')
- path++;
- while (*path)
- {
- if ((p = strchr(path, '/')) == 0)
- {
- compstr = path;
- compl = strlen(compstr);
- path += compl;
- }
- else
- {
- compstr = path;
- compl = p - path;
- path = p + 1;
- while(*path == '/')
- path++;
- }
- for (i = mptree[pos].child; i; i = mptree[i].sibling)
- if (mptree[i].compl == compl && !strncmp(mptree[i].comp, compstr, compl))
- break;
- if (!i)
- {
- /* create new node */
- mptree = sat_extend(mptree, nmptree, 1, sizeof(struct mptree), MPTREE_BLOCK);
- i = nmptree++;
- mptree[i].sibling = mptree[pos].child;
- mptree[i].child = 0;
- mptree[i].comp = compstr;
- mptree[i].compl = compl;
- mptree[i].mountpoint = -1;
- mptree[pos].child = i;
- }
- pos = i;
- }
- mptree[pos].mountpoint = mp;
- }
-
- propagate_mountpoints(mptree, 0, mptree[0].mountpoint);
-
-#if 0
- for (i = 0; i < nmptree; i++)
- {
- printf("#%d sibling: %d\n", i, mptree[i].sibling);
- printf("#%d child: %d\n", i, mptree[i].child);
- printf("#%d comp: %s\n", i, mptree[i].comp);
- printf("#%d compl: %d\n", i, mptree[i].compl);
- printf("#%d mountpont: %d\n", i, mptree[i].mountpoint);
- }
-#endif
-
- cbd.mptree = mptree;
+ Solvable *s;
+ int i;
+ Id p;
/* create list of solvables that have to be installed */
/* (this is actually just a simple sort) */
map_init(&installmap, pool->nsolvables);
for (i = 1; i < solv->decisionq.count; i++)
{
- Id sp = solv->decisionq.elements[i];
- if (sp < 0)
+ Id p = solv->decisionq.elements[i];
+ if (p < 0)
continue;
- s = pool->solvables + sp;
+ s = pool->solvables + p;
if (!s->repo)
continue;
if (solv->installed && s->repo == solv->installed)
continue;
- MAPSET(&installmap, sp);
- }
- /* run through install solvable dudata */
- cbd.addsub = 1;
- for (i = 1; i < pool->nsolvables; i++)
- {
- if (!MAPTST(&installmap, i))
- continue;
- s = pool->solvables + i;
- repo_search(s->repo, i, SOLVABLE_DISKUSAGE, 0, 0, solver_fill_DU_cb, &cbd);
+ MAPSET(&installmap, p);
}
- map_free(&installmap);
+ for (p = 1; p < pool->nsolvables; p++)
+ if (MAPTST(&installmap, p))
+ queue_push(pkgs, p);
/* run through erase solvable dudata */
if (solv->installed)
{
- cbd.addsub = -1;
- FOR_REPO_SOLVABLES(solv->installed, i, s)
+ FOR_REPO_SOLVABLES(solv->installed, p, s)
{
- if (solv->decisionmap[i] >= 0)
- continue;
- repo_search(solv->installed, i, SOLVABLE_DISKUSAGE, 0, 0, solver_fill_DU_cb, &cbd);
+ if (solv->decisionmap[p] < 0)
+ queue_push(pkgs, -p);
}
}
- sat_free(cbd.dirmap);
- sat_free(mptree);
+}
+
+void
+solver_calc_duchanges(Solver *solv, DUChanges *mps, int nmps)
+{
+ Queue pkgs;
+ queue_init(&pkgs);
+ solver_calc_changed_pkgs(solv, &pkgs);
+ pool_calc_duchanges(solv->pool, &pkgs, mps, nmps);
+ queue_free(&pkgs);
}
int
solver_calc_installsizechange(Solver *solv)
{
- Pool *pool = solv->pool;
- int i, change;
- Id p;
- Solvable *s;
-
- change = 0;
- for (i = 1; i < solv->decisionq.count; i++)
- {
- Id p = solv->decisionq.elements[i];
- if (p < 0)
- continue;
- s = pool->solvables + p;
- if (!s->repo)
- continue;
- if (solv->installed && s->repo == solv->installed)
- continue;
- change += repo_lookup_num(s, SOLVABLE_INSTALLSIZE);
- }
- if (solv->installed)
- {
- FOR_REPO_SOLVABLES(solv->installed, p, s)
- if (solv->decisionmap[p] < 0)
- change -= repo_lookup_num(s, SOLVABLE_INSTALLSIZE);
- }
+ int change;
+ Queue pkgs;
+ queue_init(&pkgs);
+ solver_calc_changed_pkgs(solv, &pkgs);
+ change = pool_calc_installsizechange(solv->pool, &pkgs);
+ queue_free(&pkgs);
return change;
}
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/satsolver-0.0.22/src/solver.h new/satsolver-0.0.22/src/solver.h
--- old/satsolver-0.0.22/src/solver.h 2008-03-14 08:38:46.000000000 +0100
+++ new/satsolver-0.0.22/src/solver.h 2008-03-17 16:11:26.000000000 +0100
@@ -282,12 +282,7 @@
return 0;
}
-typedef struct _duchanges {
- const char *path;
- int kbytes;
- int files;
-} DUChanges;
-
+void solver_calc_changed_pkgs(Solver *solv, Queue *pkgs);
void solver_calc_duchanges(Solver *solv, DUChanges *mps, int nmps);
int solver_calc_installsizechange(Solver *solv);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/satsolver-0.0.22/src/util.h new/satsolver-0.0.22/src/util.h
--- old/satsolver-0.0.22/src/util.h 2008-03-14 08:38:46.000000000 +0100
+++ new/satsolver-0.0.22/src/util.h 2008-03-17 16:11:26.000000000 +0100
@@ -14,6 +14,7 @@
#define SATSOLVER_UTIL_H
#include