#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
#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;
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 */
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)
{
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)
{
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;
}
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;
#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;
#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;
#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;
}
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)
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);
*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)
{
}
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])