Author: matz Date: Mon Apr 14 14:58:23 2008 New Revision: 9611 URL: http://svn.opensuse.org/viewcvs/zypp?rev=9611&view=rev Log: Add REPOKEY_TYPE_COUNTED type (for arrays of structures). We can add substructures now, but can't write or read them :) Add version for the attributes to SOLV_VERSION_7 (not yet written). Some cleanups. Modified: trunk/sat-solver/src/knownid.h trunk/sat-solver/src/pooltypes.h trunk/sat-solver/src/repo.h trunk/sat-solver/src/repo_solv.c trunk/sat-solver/src/repodata.c trunk/sat-solver/src/repodata.h trunk/sat-solver/tools/repo_write.c Modified: trunk/sat-solver/src/knownid.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/knownid.h?rev=9611&r1=9610&r2=9611&view=diff ============================================================================== --- trunk/sat-solver/src/knownid.h (original) +++ trunk/sat-solver/src/knownid.h Mon Apr 14 14:58:23 2008 @@ -75,6 +75,7 @@ KNOWNID(REPOKEY_TYPE_MD5, "repokey:type:md5"), KNOWNID(REPOKEY_TYPE_SHA1, "repokey:type:sha1"), KNOWNID(REPOKEY_TYPE_SHA256, "repokey:type:sha256"), +KNOWNID(REPOKEY_TYPE_COUNTED, "repokey:type:counted"), KNOWNID(SOLVABLE_SUMMARY, "solvable:summary"), KNOWNID(SOLVABLE_DESCRIPTION, "solvable:description"), Modified: trunk/sat-solver/src/pooltypes.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pooltypes.h?rev=9611&r1=9610&r2=9611&view=diff ============================================================================== --- trunk/sat-solver/src/pooltypes.h (original) +++ trunk/sat-solver/src/pooltypes.h Mon Apr 14 14:58:23 2008 @@ -13,7 +13,7 @@ #ifndef SATSOLVER_POOLTYPES_H #define SATSOLVER_POOLTYPES_H -/* version number for .solv files */ +/* format version number for .solv files */ #define SOLV_VERSION_0 0 #define SOLV_VERSION_1 1 #define SOLV_VERSION_2 2 @@ -23,6 +23,18 @@ #define SOLV_VERSION_6 6 #define SOLV_VERSION_7 7 +/* The format of .solv files might change incompatibly, and that is described + by the above version number. But sometimes we also extend the emitted + attributes (e.g. by adding a new one for solvables, for instance patch + category). Consumers need to know if the .solv file they have needs to + be regenerated by newer converters or not (or better, if regenerating them + would give a different .solv file). We use this serial number for that. + We increase it every time we add or remove attributes (or change the + interpretation of them). Tools installed by the user will have their + version compiled in, so they can detect mismatches between .solv files + they see and themself. */ +#define SOLV_CONTENT_VERSION 1 + #define SOLV_FLAG_PREFIX_POOL 4 struct _Stringpool; Modified: trunk/sat-solver/src/repo.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repo.h?rev=9611&r1=9610&r2=9611&view=diff ============================================================================== --- trunk/sat-solver/src/repo.h (original) +++ trunk/sat-solver/src/repo.h Mon Apr 14 14:58:23 2008 @@ -17,9 +17,6 @@ #include "pooltypes.h" #include "pool.h" -#if 0 -#include "attr_store.h" -#endif #include "repodata.h" typedef struct _Repokey { Modified: trunk/sat-solver/src/repo_solv.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repo_solv.c?rev=9611&r1=9610&r2=9611&view=diff ============================================================================== --- trunk/sat-solver/src/repo_solv.c (original) +++ trunk/sat-solver/src/repo_solv.c Mon Apr 14 14:58:23 2008 @@ -722,7 +722,7 @@ Pool *pool = repo->pool; int i, l; unsigned int numid, numrel, numdir, numsolv; - unsigned int numkeys, numschemata, numinfo, numextra; + unsigned int numkeys, numschemata, numinfo, numextra, contentver; Offset sizeid; Offset *str; /* map Id -> Offset into string space */ @@ -789,9 +789,12 @@ numschemata = read_u32(&data); numinfo = read_u32(&data); if (solvversion > SOLV_VERSION_6) - numextra = read_u32(&data); + { + numextra = read_u32(&data); + contentver = read_u32(&data); + } else - numextra = 0; + numextra = 0, contentver = 1; solvflags = read_u32(&data); if (numdir && numdir < 2) Modified: trunk/sat-solver/src/repodata.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repodata.c?rev=9611&r1=9610&r2=9611&view=diff ============================================================================== --- trunk/sat-solver/src/repodata.c (original) +++ trunk/sat-solver/src/repodata.c Mon Apr 14 14:58:23 2008 @@ -1167,11 +1167,8 @@ { Id *pp; Id *ap; - Id sid; int i; - //sid = repodata_get_handle(data, handle); - sid = handle; - ap = data->structs[sid]; + ap = data->structs[handle]; i = 0; if (ap) { @@ -1192,7 +1189,7 @@ i = pp - ap; } ap = sat_extend(ap, i, 3, sizeof(Id), REPODATA_ATTRS_BLOCK); - data->structs[sid] = ap; + data->structs[handle] = ap; pp = ap + i; *pp++ = keyid; *pp++ = val; @@ -1315,7 +1312,7 @@ } static void -repoadata_add_array(Repodata *data, Id handle, Id keyname, Id keytype, int entrysize) +repodata_add_array(Repodata *data, Id handle, Id keyname, Id keytype, int entrysize) { int oldsize; Id *ida, *pp; @@ -1470,7 +1467,7 @@ #if 0 fprintf(stderr, "repodata_add_dirnumnum %d %d %d %d (%d)\n", handle, dir, num, num2, data->attriddatalen); #endif - repoadata_add_array(data, handle, keyname, REPOKEY_TYPE_DIRNUMNUMARRAY, 3); + repodata_add_array(data, handle, keyname, REPOKEY_TYPE_DIRNUMNUMARRAY, 3); data->attriddata[data->attriddatalen++] = dir; data->attriddata[data->attriddatalen++] = num; data->attriddata[data->attriddatalen++] = num2; @@ -1492,7 +1489,7 @@ #if 0 fprintf(stderr, "repodata_add_dirstr %d %d %s (%d)\n", handle, dir, str, data->attriddatalen); #endif - repoadata_add_array(data, handle, keyname, REPOKEY_TYPE_DIRSTRARRAY, 2); + repodata_add_array(data, handle, keyname, REPOKEY_TYPE_DIRSTRARRAY, 2); data->attriddata[data->attriddatalen++] = dir; data->attriddata[data->attriddatalen++] = stroff; data->attriddata[data->attriddatalen++] = 0; @@ -1504,7 +1501,7 @@ #if 0 fprintf(stderr, "repodata_add_idarray %d %d (%d)\n", handle, id, data->attriddatalen); #endif - repoadata_add_array(data, handle, keyname, REPOKEY_TYPE_IDARRAY, 1); + repodata_add_array(data, handle, keyname, REPOKEY_TYPE_IDARRAY, 1); data->attriddata[data->attriddatalen++] = id; data->attriddata[data->attriddatalen++] = 0; } @@ -1521,17 +1518,13 @@ repodata_add_idarray(data, handle, keyname, id); } -#if 0 -void -repodata_open_struct(Repodata *data, Id handle, Id keyname) -{ -} - -void -repodata_close_struct(Repodata *data, Id entry, Id keyname) +Id +repodata_create_struct(Repodata *data, Id handle, Id keyname) { + Id newhandle = get_new_struct(data); + repodata_add_idarray(data, handle, keyname, newhandle); + return newhandle; } -#endif void repodata_merge_attrs(Repodata *data, Id dest, Id src) @@ -1685,7 +1678,7 @@ nentry = 0; for (entry = data->extraattrs ? -data->nextra : 0; entry < nentry; entry++) { - Id sid; + Id handle; memset(seen, 0, data->nkeys * sizeof(Id)); sp = schema; dp = entry2data(data, entry); @@ -1712,8 +1705,8 @@ *sp++ = *keyp; oldcount++; } - sid = entry < 0 ? data->extraattrs[-1 - entry] : data->attrs[entry]; - keyp = data->structs[sid]; + handle = entry < 0 ? data->extraattrs[-1 - entry] : data->attrs[entry]; + keyp = data->structs[handle]; if (keyp) for (; *keyp; keyp += 2) { @@ -1840,8 +1833,8 @@ } dp = ndp; } - if (data->structs[sid]) - data->structs[sid] = sat_free(data->structs[sid]); + if (data->structs[handle]) + data->structs[handle] = sat_free(data->structs[handle]); } for (entry = 0; entry < data->nstructs; entry++) if (data->structs[entry]) Modified: trunk/sat-solver/src/repodata.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repodata.h?rev=9611&r1=9610&r2=9611&view=diff ============================================================================== --- trunk/sat-solver/src/repodata.h (original) +++ trunk/sat-solver/src/repodata.h Mon Apr 14 14:58:23 2008 @@ -188,6 +188,9 @@ void repodata_add_idarray(Repodata *data, Id handle, Id keyname, Id id); void repodata_add_poolstr_array(Repodata *data, Id handle, Id keyname, const char *str); +/* Creates a new substructure. Returns a handle for it (usable with the + other repodata_{set,add}_* functions. */ +Id repodata_create_struct(Repodata *data, Id handle, Id keyname); /*----- * data management Modified: trunk/sat-solver/tools/repo_write.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/tools/repo_write.c?rev=9611&r1=9610&r2=9611&view=diff ============================================================================== --- trunk/sat-solver/tools/repo_write.c (original) +++ trunk/sat-solver/tools/repo_write.c Mon Apr 14 14:58:23 2008 @@ -1536,7 +1536,10 @@ write_u32(fp, cbdata.nmyschemata); write_u32(fp, nsubfiles); /* info blocks. */ if (repo->nextra) - write_u32(fp, repo->nextra); + { + write_u32(fp, repo->nextra); + write_u32(fp, SOLV_CONTENT_VERSION); + } solv_flags = 0; solv_flags |= SOLV_FLAG_PREFIX_POOL; write_u32(fp, solv_flags); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org