Author: mlschroe Date: Tue Jan 15 16:37:29 2008 New Revision: 8291 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8291&view=rev Log: - add dir reading code to solv reader - change DU skeleton to use new layout - add new type TYPE_DIR Modified: trunk/sat-solver/doc/README.format trunk/sat-solver/src/pool.c trunk/sat-solver/src/pool.h trunk/sat-solver/src/pooltypes.h trunk/sat-solver/src/repo.c trunk/sat-solver/src/repo.h trunk/sat-solver/src/repo_solv.c Modified: trunk/sat-solver/doc/README.format URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/doc/README.format?rev=8291&r1=8290&r2=8291&view=diff ============================================================================== --- trunk/sat-solver/doc/README.format (original) +++ trunk/sat-solver/doc/README.format Tue Jan 15 16:37:29 2008 @@ -39,14 +39,15 @@ U8*: DATA -V1 format +V4 format ========= MAGIC: 'SOLV' - U32: 1 + U32: 4 U32: NUMID /* number of Ids (names) */ U32: NUMREL /* number of RelDeps (dependencies) */ + U32: NUMDIR /* number of directories */ U32: NUMITEM /* number of items (packages) */ U32: NUMKEYS U32: NUMSCHEMATA /* number of schemata */ @@ -62,6 +63,8 @@ -- reldep data -- U8*: RELDICT /* Buffer for RandDeps (Id,Id,u8) */ + -- directory data -- + U8*: DIRDICT /* Buffer for dirs (Id,Id) */ -- key data -- NUMKEYS * Modified: trunk/sat-solver/src/pool.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pool.c?rev=8291&r1=8290&r2=8291&view=diff ============================================================================== --- trunk/sat-solver/src/pool.c (original) +++ trunk/sat-solver/src/pool.c Tue Jan 15 16:37:29 2008 @@ -938,39 +938,43 @@ { for_all_repodatas_containing_DU { - dirmap = xcalloc2(data->ndirs, sizeof(Id)); - dirnum = 0; - for (;;) + /* create map from dir to mptree */ + dirmap = xcalloc2(pool->ndirs, sizeof(Id)); + mp = 0; + for (dn = 2, dirs = pool->dirs + dn; dn < pool->ndirs; dn++) { - parent = readid(); - mp = parent ? dirmap[parent] : 0; - while (id = readid()) + id = *dirs++; + if (id <= 0) { - if (mp < 0) - { - /* unconnected */ - dirmap[dirnum++] = mp; - continue; - } - if (!mptree[mp].child) - { - dirmap[dirnum++] = -mp; - continue; - } - comp = id2str(pool, id); - compl = strlen(comp); - for (i = mptree[mp].child; i; i = mptree[i].sibling) - if (mptree[i].compl == compl && !strncmp(mptree[i].comp, comp, compl)) - break; - dirmap[dirnum++] = i ? i : -mp; + mp = dirmap[-id]; + continue; } + if (mp < 0) + { + /* unconnected */ + dirmap[dn] = mp; + continue; + } + if (!mptree[mp].child) + { + dirmap[dn] = -mp; + continue; + } + comp = id2str(pool, id); + compl = strlen(comp); + for (i = mptree[mp].child; i; i = mptree[i].sibling) + if (mptree[i].compl == compl && !strncmp(mptree[i].comp, comp, compl)) + break; + dirmap[dn] = i ? i : -mp; } - for (i = 0; i < dirnum; i++) + /* change dirmap to point to mountpoint instead of mptree */ + for (dn = 0; dn < pool->ndirs; dn++) { mp = dirmap[i]; dirmap[i] = mptree[mp > 0 ? mp : -mp].mountpoint; } - cbdata.nmap = dirnum; + + cbdata.nmap = pool->ndirs; cbdata.dirmap = dirmap; md.callback = pool_fill_DU_add_cb; Modified: trunk/sat-solver/src/pool.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pool.h?rev=8291&r1=8290&r2=8291&view=diff ============================================================================== --- trunk/sat-solver/src/pool.h (original) +++ trunk/sat-solver/src/pool.h Tue Jan 15 16:37:29 2008 @@ -151,9 +151,11 @@ #define TYPE_COUNTED 12 #define TYPE_IDVALUEARRAY 13 -#define TYPE_IDVALUEVALUEARRAY 14 -#define TYPE_ATTR_TYPE_MAX TYPE_IDVALUEVALUEARRAY +#define TYPE_DIR 14 +#define TYPE_DIRVALUEVALUEARRAY 15 + +#define TYPE_ATTR_TYPE_MAX TYPE_DIRVALUEVALUEARRAY //----------------------------------------------- Modified: trunk/sat-solver/src/pooltypes.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pooltypes.h?rev=8291&r1=8290&r2=8291&view=diff ============================================================================== --- trunk/sat-solver/src/pooltypes.h (original) +++ trunk/sat-solver/src/pooltypes.h Tue Jan 15 16:37:29 2008 @@ -18,6 +18,8 @@ #define SOLV_VERSION_1 1 #define SOLV_VERSION_2 2 #define SOLV_VERSION_3 3 +#define SOLV_VERSION_4 4 + #define SOLV_FLAG_PACKEDSIZES 1 #define SOLV_FLAG_VERTICAL 2 #define SOLV_FLAG_PREFIX_POOL 4 Modified: trunk/sat-solver/src/repo.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repo.c?rev=8291&r1=8290&r2=8291&view=diff ============================================================================== --- trunk/sat-solver/src/repo.c (original) +++ trunk/sat-solver/src/repo.c Tue Jan 15 16:37:29 2008 @@ -482,13 +482,14 @@ case TYPE_VOID: return dp; case TYPE_ID: + case TYPE_DIR: while ((*dp & 0x80) != 0) dp++; return dp; case TYPE_IDARRAY: case TYPE_REL_IDARRAY: case TYPE_IDVALUEARRAY: - case TYPE_IDVALUEVALUEARRAY: + case TYPE_DIRVALUEVALUEARRAY: while ((*dp & 0xc0) != 0) dp++; return dp; @@ -583,7 +584,7 @@ case TYPE_IDARRAY: case TYPE_REL_IDARRAY: case TYPE_IDVALUEARRAY: - case TYPE_IDVALUEVALUEARRAY: + case TYPE_DIRVALUEVALUEARRAY: for (i = 0; i < plen; i++) if ((dp[i] & 0xc0) == 0) return dp; Modified: trunk/sat-solver/src/repo.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repo.h?rev=8291&r1=8290&r2=8291&view=diff ============================================================================== --- trunk/sat-solver/src/repo.h (original) +++ trunk/sat-solver/src/repo.h Tue Jan 15 16:37:29 2008 @@ -64,9 +64,9 @@ Id *incoreoffset; /* offset for all entries (ent2attr) */ Id verticaloffset; /* file offset of verticals */ - char *strbuf; /* just for testing */ - int strbuflen; /* just for testing */ + Id *dirs; /* directory list */ + int ndirs; /* its size */ /* The attribute store itself. */ Attrstore *s; Modified: trunk/sat-solver/src/repo_solv.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repo_solv.c?rev=8291&r1=8290&r2=8291&view=diff ============================================================================== --- trunk/sat-solver/src/repo_solv.c (original) +++ trunk/sat-solver/src/repo_solv.c Tue Jan 15 16:37:29 2008 @@ -255,7 +255,10 @@ case TYPE_VOID: break; case TYPE_ID: - read_id(data, numid + numrel); /* just check Id */ + read_id(data, numid + numrel); /* just check Id */ + break; + case TYPE_DIR: + read_id(data, numid + data->ndirs); /* just check Id */ break; case TYPE_U32: read_u32(data); @@ -267,7 +270,7 @@ break; case TYPE_IDARRAY: case TYPE_IDVALUEARRAY: - case TYPE_IDVALUEVALUEARRAY: + case TYPE_DIRVALUEVALUEARRAY: case TYPE_REL_IDARRAY: case TYPE_ATTR_INTLIST: while ((read_u8(data) & 0xc0) != 0) @@ -478,7 +481,7 @@ { Pool *pool = repo->pool; int i, l; - unsigned int numid, numrel, numsolv; + unsigned int numid, numrel, numdir, numsolv; unsigned int numkeys, numschemata, numinfo; #if 0 Attrstore *embedded_store = 0; @@ -525,6 +528,7 @@ case SOLV_VERSION_1: case SOLV_VERSION_2: case SOLV_VERSION_3: + case SOLV_VERSION_4: break; default: pool_debug(pool, SAT_ERROR, "unsupported SOLV version\n"); @@ -535,14 +539,22 @@ numid = read_u32(&data); numrel = read_u32(&data); + if (solvversion >= SOLV_VERSION_4) + numdir = read_u32(&data); + else + numdir = 0; numsolv = read_u32(&data); numkeys = read_u32(&data); numschemata = read_u32(&data); numinfo = read_u32(&data); solvflags = read_u32(&data); - if (solvversion < SOLV_VERSION_3 - && numinfo) + if (numdir && numdir < 2) + { + pool_debug(pool, SAT_ERROR, "bad number of dirs\n"); + return SOLV_ERROR_CORRUPT; + } + if (numinfo && solvversion < SOLV_VERSION_3) { pool_debug(pool, SAT_ERROR, "unsupported SOLV format (has info)\n"); return SOLV_ERROR_UNSUPPORTED; @@ -768,7 +780,25 @@ } - /******* Part 3: Keys ***********************************************/ + /******* Part 3: Dirs ***********************************************/ + if (numdir) + { + data.dirs = sat_calloc(numdir, sizeof(Id)); + data.ndirs = numdir; + /* dir 0: no directory + * dir 1: / + */ + for (i = 2; i < numdir; i++) + { + id = read_id(&data, i + numid); + if (i > numid) + data.dirs[i] = -(id - numid); + else + data.dirs[i] = idmap[id]; + } + } + + /******* Part 4: Keys ***********************************************/ keys = sat_calloc(numkeys, sizeof(*keys)); /* keys start at 1 */ @@ -821,7 +851,7 @@ data.keys = keys; data.nkeys = numkeys; - /******* Part 4: Schemata ********************************************/ + /******* Part 5: Schemata ********************************************/ id = read_id(&data, 0); schemadata = sat_calloc(id, sizeof(Id)); @@ -837,7 +867,7 @@ data.nschemata = numschemata; data.schemadata = schemadata; - /******* Part 5: Info ***********************************************/ + /******* Part 6: Info ***********************************************/ for (i = 0; i < numinfo; i++) { /* for now we're just interested in data that starts with @@ -854,7 +884,7 @@ skip_schema(&data, keyp, keys, numid, numrel); } - /******* Part 6: packed sizes (optional) ****************************/ + /******* Part 7: packed sizes (optional) ****************************/ char *exists = 0; if ((solvflags & SOLV_FLAG_PACKEDSIZES) != 0) { @@ -863,7 +893,7 @@ exists[i] = read_id(&data, 0) != 0; } - /******* Part 7: item data *******************************************/ + /******* Part 8: item data *******************************************/ /* calculate idarray size */ size_idarray = 0; @@ -1089,6 +1119,8 @@ } else { + /* discard data */ + sat_free(data.dirs); sat_free(schemata); sat_free(schemadata); sat_free(keys); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org