{
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;
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);
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)
{
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;
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");
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;
}
- /******* 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 */
data.keys = keys;
data.nkeys = numkeys;
- /******* Part 4: Schemata ********************************************/
+ /******* Part 5: Schemata ********************************************/
id = read_id(&data, 0);
schemadata = sat_calloc(id, sizeof(Id));
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
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)
{
exists[i] = read_id(&data, 0) != 0;
}
- /******* Part 7: item data *******************************************/
+ /******* Part 8: item data *******************************************/
/* calculate idarray size */
size_idarray = 0;
}
else
{
+ /* discard data */
+ sat_free(data.dirs);
sat_free(schemata);
sat_free(schemadata);
sat_free(keys);