diff options
author | Michael Schroeder <mls@suse.de> | 2008-10-22 08:56:40 +0000 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2008-10-22 08:56:40 +0000 |
commit | 65c03f653ca233e092f2ebe7f0254146d71a1b2d (patch) | |
tree | 367fad5ca79e82d3d90801b9b62aef6127e1a6e4 /src | |
parent | 9c2b1f4cd5e7e32901a620af158b2ce3ea65a43b (diff) | |
download | libsolv-65c03f653ca233e092f2ebe7f0254146d71a1b2d.tar.gz libsolv-65c03f653ca233e092f2ebe7f0254146d71a1b2d.tar.bz2 libsolv-65c03f653ca233e092f2ebe7f0254146d71a1b2d.zip |
- add pool_set_installed() function, remove no longer needed "installed"
argument from some other functions
Diffstat (limited to 'src')
-rw-r--r-- | src/pool.c | 30 | ||||
-rw-r--r-- | src/pool.h | 18 | ||||
-rw-r--r-- | src/repo.c | 2 | ||||
-rw-r--r-- | src/repodata.c | 11 | ||||
-rw-r--r-- | src/repopage.c | 4 | ||||
-rw-r--r-- | src/solver.c | 10 | ||||
-rw-r--r-- | src/solver.h | 2 | ||||
-rw-r--r-- | src/solverdebug.c | 2 | ||||
-rw-r--r-- | src/util.c | 5 |
9 files changed, 51 insertions, 33 deletions
@@ -123,6 +123,15 @@ pool_free_solvable_block(Pool *pool, Id start, int count, int reuseids) } +void +pool_set_installed(Pool *pool, Repo *installed) +{ + if (pool->installed == installed) + return; + pool->installed = installed; + pool_freewhatprovides(pool); +} + static Pool *pool_shrink_whatprovides_sortcmp_data; static int @@ -251,6 +260,7 @@ pool_createwhatprovides(Pool *pool) Offset *idp, n; Offset *whatprovides; Id *whatprovidesdata, *d; + Repo *installed = pool->installed; POOL_DEBUG(SAT_DEBUG_STATS, "number of solvables: %d\n", pool->nsolvables); POOL_DEBUG(SAT_DEBUG_STATS, "number of ids: %d + %d\n", pool->ss.nstrings, pool->nrels); @@ -268,7 +278,9 @@ pool_createwhatprovides(Pool *pool) s = pool->solvables + i; if (!s->provides) continue; - if (!pool_installable(pool, s)) + /* we always need the installed solvable in the whatprovides data, + otherwise obsoletes/conflicts on them won't work */ + if (s->repo != installed && !pool_installable(pool, s)) continue; pp = s->repo->idarraydata + s->provides; while ((id = *pp++) != ID_NULL) @@ -314,7 +326,7 @@ pool_createwhatprovides(Pool *pool) s = pool->solvables + i; if (!s->provides) continue; - if (!pool_installable(pool, s)) + if (s->repo != installed && !pool_installable(pool, s)) continue; /* for all provides of this solvable */ @@ -989,9 +1001,9 @@ pool_addfileprovides_ids(Pool *pool, Repo *installed, Id **idp) } void -pool_addfileprovides(Pool *pool, Repo *installed) +pool_addfileprovides(Pool *pool) { - pool_addfileprovides_ids(pool, installed, 0); + pool_addfileprovides_ids(pool, pool->installed, 0); } void @@ -1188,7 +1200,7 @@ propagate_mountpoints(struct mptree *mptree, int pos, Id mountpoint) #define MPTREE_BLOCK 15 void -pool_calc_duchanges(Pool *pool, Repo *oldinstalled, Map *installedmap, DUChanges *mps, int nmps) +pool_calc_duchanges(Pool *pool, Map *installedmap, DUChanges *mps, int nmps) { char *p; const char *path, *compstr; @@ -1200,6 +1212,7 @@ pool_calc_duchanges(Pool *pool, Repo *oldinstalled, Map *installedmap, DUChanges Solvable *s; Id sp; Map ignoredu; + Repo *oldinstalled = pool->installed; memset(&ignoredu, 0, sizeof(ignoredu)); cbd.mps = mps; @@ -1326,11 +1339,12 @@ pool_calc_duchanges(Pool *pool, Repo *oldinstalled, Map *installedmap, DUChanges } int -pool_calc_installsizechange(Pool *pool, Repo *oldinstalled, Map *installedmap) +pool_calc_installsizechange(Pool *pool, Map *installedmap) { Id sp; Solvable *s; int change = 0; + Repo *oldinstalled = pool->installed; for (sp = 1, s = pool->solvables + sp; sp < pool->nsolvables; sp++, s++) { @@ -1396,7 +1410,7 @@ static inline int providedbyinstalled(Pool *pool, unsigned char *map, Id dep) */ void -pool_trivial_installable(Pool *pool, Repo *oldinstalled, Map *installedmap, Queue *pkgs, Queue *res) +pool_trivial_installable(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res) { int i, r, m, did; Id p, *dp, con, *conp, req, *reqp; @@ -1512,7 +1526,7 @@ pool_trivial_installable(Pool *pool, Repo *oldinstalled, Map *installedmap, Queu #endif if (m != map[p]) { - map[p] = m; + map[p] = m; did = 0; } } @@ -54,14 +54,16 @@ typedef struct _Repopos { struct _Pool { struct _Stringpool ss; - Reldep *rels; // table of rels: Id -> Reldep - int nrels; // number of unique rels - Hashtable relhashtbl; // hash table: (name,evr,op ->) Hash -> Id + Reldep *rels; /* table of rels: Id -> Reldep */ + int nrels; /* number of unique rels */ + Hashtable relhashtbl; /* hashtable: (name,evr,op)Hash -> Id */ Hashmask relhashmask; struct _Repo **repos; int nrepos; + struct _Repo *installed; /* packages considered installed */ + Solvable *solvables; int nsolvables; @@ -163,6 +165,8 @@ extern void pool_debug(Pool *pool, int type, const char *format, ...) __attribut extern char *pool_alloctmpspace(Pool *pool, int len); +extern void pool_set_installed(Pool *pool, struct _Repo *repo); + /** * Solvable management */ @@ -212,7 +216,7 @@ static inline int pool_match_nevr(Pool *pool, Solvable *s, Id d) * Prepares a pool for solving */ extern void pool_createwhatprovides(Pool *pool); -extern void pool_addfileprovides(Pool *pool, struct _Repo *installed); +extern void pool_addfileprovides(Pool *pool); extern void pool_addfileprovides_ids(Pool *pool, struct _Repo *installed, Id **idp); extern void pool_freewhatprovides(Pool *pool); extern Id pool_queuetowhatprovides(Pool *pool, Queue *q); @@ -280,9 +284,9 @@ typedef struct _duchanges { int files; } DUChanges; -void pool_calc_duchanges(Pool *pool, struct _Repo *oldinstalled, Map *installedmap, DUChanges *mps, int nmps); -int pool_calc_installsizechange(Pool *pool, struct _Repo *oldinstalled, Map *installedmap); -void pool_trivial_installable(Pool *pool, struct _Repo *oldinstalled, Map *installedmap, Queue *pkgs, Queue *res); +void pool_calc_duchanges(Pool *pool, Map *installedmap, DUChanges *mps, int nmps); +int pool_calc_installsizechange(Pool *pool, Map *installedmap); +void pool_trivial_installable(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res); /* loop over all providers of d */ @@ -275,6 +275,8 @@ repo_free(Repo *repo, int reuseids) int i; pool_freewhatprovides(pool); + if (repo == pool->installed) + pool->installed = 0; if (reuseids && repo->end == pool->nsolvables) { diff --git a/src/repodata.c b/src/repodata.c index ec5bb4f..c32f248 100644 --- a/src/repodata.c +++ b/src/repodata.c @@ -1758,10 +1758,7 @@ repodata_set_checksum(Repodata *data, Id solvid, Id keyname, Id type, if (!l) return; if (hexstr2bytes(buf, str, l) != l) - { - fprintf(stderr, "Invalid hex character in '%s'\n", str); - return; - } + return; repodata_set_bin_checksum(data, solvid, keyname, type, buf); } @@ -2020,7 +2017,7 @@ repodata_serialize_key(Repodata *data, struct extdata *newincore, schemaid = repodata_schema2id(data, schema, 1); else if (schemaid != repodata_schema2id(data, schema, 0)) { - fprintf(stderr, " not yet implemented: substructs with different schemas\n"); + pool_debug(data->repo->pool, SAT_FATAL, "substructs with different schemas\n"); exit(1); } #if 0 @@ -2074,7 +2071,7 @@ repodata_serialize_key(Repodata *data, struct extdata *newincore, break; } default: - fprintf(stderr, "don't know how to handle type %d\n", key->type); + pool_debug(data->repo->pool, SAT_FATAL, "don't know how to handle type %d\n", key->type); exit(1); } if (key->storage == KEY_STORAGE_VERTICAL_OFFSET) @@ -2149,7 +2146,7 @@ fprintf(stderr, "schemadata %p\n", data->schemadata); { if (seen[*keyp]) { - fprintf(stderr, "Inconsistent old data (key occured twice).\n"); + pool_debug(data->repo->pool, SAT_FATAL, "Inconsistent old data (key occured twice).\n"); exit(1); } seen[*keyp] = -1; diff --git a/src/repopage.c b/src/repopage.c index 1e5abb6..4c08d3e 100644 --- a/src/repopage.c +++ b/src/repopage.c @@ -704,7 +704,9 @@ repopagestore_load_page_range(Repopagestore *store, unsigned int pstart, unsigne dest, BLOB_PAGESIZE); if (out_len != BLOB_PAGESIZE && i < store->num_pages - 1) { +#ifdef DEBUG_PAGING fprintf(stderr, "can't decompress\n"); +#endif return 0; } #ifdef DEBUG_PAGING @@ -801,8 +803,6 @@ repopagestore_read_or_setup_pages(Repopagestore *store, FILE *fp, unsigned int p p->file_size = in_len * 2 + compressed; if (fseek(fp, in_len, SEEK_CUR) < 0) { - perror ("fseek"); - fprintf (stderr, "can't seek after we thought we can\n"); /* We can't fall back to non-seeking behaviour as we already read over some data pages without storing them away. */ close(store->pagefd); diff --git a/src/solver.c b/src/solver.c index 3532313..f55d691 100644 --- a/src/solver.c +++ b/src/solver.c @@ -2320,12 +2320,12 @@ selectandinstall(Solver *solv, int level, Queue *dq, Id inst, int disablerules) */ Solver * -solver_create(Pool *pool, Repo *installed) +solver_create(Pool *pool) { Solver *solv; solv = (Solver *)sat_calloc(1, sizeof(Solver)); solv->pool = pool; - solv->installed = installed; + solv->installed = pool->installed; queue_init(&solv->ruletojob); queue_init(&solv->decisionq); @@ -2343,7 +2343,7 @@ solver_create(Pool *pool, Repo *installed) map_init(&solv->recommendsmap, pool->nsolvables); map_init(&solv->suggestsmap, pool->nsolvables); - map_init(&solv->noupdate, installed ? installed->end - installed->start : 0); + map_init(&solv->noupdate, solv->installed ? solv->installed->end - solv->installed->start : 0); solv->recommends_index = 0; solv->decisionmap = (Id *)sat_calloc(pool->nsolvables, sizeof(Id)); @@ -4545,7 +4545,7 @@ solver_calc_duchanges(Solver *solv, DUChanges *mps, int nmps) Map installedmap; solver_create_state_maps(solv, &installedmap, 0); - pool_calc_duchanges(solv->pool, solv->installed, &installedmap, mps, nmps); + pool_calc_duchanges(solv->pool, &installedmap, mps, nmps); map_free(&installedmap); } @@ -4562,7 +4562,7 @@ solver_calc_installsizechange(Solver *solv) int change; solver_create_state_maps(solv, &installedmap, 0); - change = pool_calc_installsizechange(solv->pool, solv->installed, &installedmap); + change = pool_calc_installsizechange(solv->pool, &installedmap); map_free(&installedmap); return change; } diff --git a/src/solver.h b/src/solver.h index 9c0dd05..441fc1e 100644 --- a/src/solver.h +++ b/src/solver.h @@ -262,7 +262,7 @@ typedef enum { } SolverProbleminfo; -extern Solver *solver_create(Pool *pool, Repo *installed); +extern Solver *solver_create(Pool *pool); extern void solver_free(Solver *solv); extern void solver_solve(Solver *solv, Queue *job); extern int solver_dep_installed(Solver *solv, Id dep); diff --git a/src/solverdebug.c b/src/solverdebug.c index 42d48ba..3bc3ee1 100644 --- a/src/solverdebug.c +++ b/src/solverdebug.c @@ -566,7 +566,7 @@ solver_printtrivial(Solver *solv) } solver_create_state_maps(solv, &installedmap, 0); queue_init(&out); - pool_trivial_installable(pool, solv->installed, &installedmap, &in, &out); + pool_trivial_installable(pool, &installedmap, &in, &out); POOL_DEBUG(SAT_DEBUG_RESULT, "trivial installable status:\n"); for (i = 0; i < in.count; i++) POOL_DEBUG(SAT_DEBUG_RESULT, " %s: %d\n", solvable2str(pool, pool->solvables + in.elements[i]), out.elements[i]); @@ -18,7 +18,8 @@ sat_oom(size_t num, size_t len) if (num) fprintf(stderr, "Out of memory allocating %zu*%zu bytes!\n", num, len); else - fprintf(stderr, "Out of memory allocating %zu bytes!\n", num); + fprintf(stderr, "Out of memory allocating %zu bytes!\n", len); + abort(); exit(1); } @@ -55,7 +56,7 @@ void * sat_realloc2(void *old, size_t num, size_t len) { if (len && (num * len) / len != num) - sat_oom(num, len); + sat_oom(num, len); return sat_realloc(old, num * len); } |