p = p + data->extrastart;
else
p = p - data->start;
- repodata_set_id(data, p, keyname, id);
+ repodata_set_id(data, repodata_get_handle(data, p), keyname, id);
}
void
p = p + data->extrastart;
else
p = p - data->start;
- repodata_set_num(data, p, keyname, num);
+ repodata_set_num(data, repodata_get_handle(data, p), keyname, num);
}
void
p = p + data->extrastart;
else
p = p - data->start;
- repodata_set_str(data, p, keyname, str);
+ repodata_set_str(data, repodata_get_handle(data, p), keyname, str);
}
void
p = p + data->extrastart;
else
p = p - data->start;
- repodata_set_poolstr(data, p, keyname, str);
+ repodata_set_poolstr(data, repodata_get_handle(data, p), keyname, str);
}
void
STATE_PACKAGE,
STATE_NAME,
STATE_VENDOR,
- STATE_BUILDTIME,
+ STATE_BUILDTIME,
STATE_HISTORY,
STATE_UPDATE,
STATE_EPOCH,
s->vendor = str2id(pool, pd->content, 1);
break;
case STATE_BUILDTIME:
- t = atoi (pd->content);
- if (t)
- repodata_set_num(pd->data, (s - pool->solvables) - pd->repo->start, SOLVABLE_BUILDTIME, t);
+ t = atoi (pd->content);
+ if (t)
+ repodata_set_num(pd->data, repodata_get_handle(pd->data, (s - pool->solvables) - pd->repo->start), SOLVABLE_BUILDTIME, t);
break;
case STATE_UPDATE: /* new version, keeping all other metadata */
evr = evr2id(pool, pd,
XML_ParserFree(parser);
if (pd.data)
- repodata_internalize(pd.data);
+ repodata_internalize(pd.data);
free(pd.content);
free(pd.evrspace);
int new = p - data->end + 1;
if (data->attrs)
{
- data->attrs = sat_extend(data->attrs, old, new, sizeof(Id *), REPODATA_BLOCK);
- memset(data->attrs + old, 0, new * sizeof(Id *));
+ data->attrs = sat_extend(data->attrs, old, new, sizeof(Id), REPODATA_BLOCK);
+ memset(data->attrs + old, 0, new * sizeof(Id));
}
data->incoreoffset = sat_extend(data->incoreoffset, old, new, sizeof(Id), REPODATA_BLOCK);
memset(data->incoreoffset + old, 0, new * sizeof(Id));
int new = data->start - p;
if (data->attrs)
{
- data->attrs = sat_extend_resize(data->attrs, old + new, sizeof(Id *), REPODATA_BLOCK);
- memmove(data->attrs + new, data->attrs, old * sizeof(Id *));
- memset(data->attrs, 0, new * sizeof(Id *));
+ data->attrs = sat_extend_resize(data->attrs, old + new, sizeof(Id), REPODATA_BLOCK);
+ memmove(data->attrs + new, data->attrs, old * sizeof(Id));
+ memset(data->attrs, 0, new * sizeof(Id));
}
data->incoreoffset = sat_extend_resize(data->incoreoffset, old + new, sizeof(Id), REPODATA_BLOCK);
memmove(data->incoreoffset + new, data->incoreoffset, old * sizeof(Id));
return;
if (data->extraattrs)
{
- data->extraattrs = sat_extend(data->extraattrs, data->nextra, nextra - data->nextra, sizeof(Id *), REPODATA_BLOCK);
- memset(data->extraattrs + data->nextra, 0, (nextra - data->nextra) * sizeof (Id *));
+ data->extraattrs = sat_extend(data->extraattrs, data->nextra, nextra - data->nextra, sizeof(Id), REPODATA_BLOCK);
+ memset(data->extraattrs + data->nextra, 0, (nextra - data->nextra) * sizeof (Id));
}
data->extraoffset = sat_extend(data->extraoffset, data->nextra, nextra - data->nextra, sizeof(Id), REPODATA_BLOCK);
memset(data->extraoffset + data->nextra, 0, (nextra - data->nextra) * sizeof(Id));
#define REPODATA_ATTRDATA_BLOCK 1023
#define REPODATA_ATTRIDDATA_BLOCK 63
-static void
-repodata_insert_keyid(Repodata *data, Id entry, Id keyid, Id val, int overwrite)
+static inline Id
+get_new_struct(Repodata *data)
+{
+ /* Make sure to never give out struct id 0. */
+ if (!data->structs)
+ {
+ data->structs = sat_extend(0, 0, 2, sizeof(Id *), REPODATA_BLOCK);
+ data->structs[0] = 0;
+ data->structs[1] = 0;
+ data->nstructs = 2;
+ return 1;
+ }
+ data->structs = sat_extend(data->structs, data->nstructs, 1, sizeof(Id *), REPODATA_BLOCK);
+ data->structs[data->nstructs] = 0;
+ return data->nstructs++;
+}
+
+static Id
+repodata_get_handle_int(Repodata *data, Id entry)
{
- Id *pp;
Id *ap;
- int i;
if (!data->attrs && entry >= 0)
{
- data->attrs = sat_calloc_block(data->end - data->start, sizeof(Id *),
+ data->attrs = sat_calloc_block(data->end - data->start, sizeof(Id),
REPODATA_BLOCK);
}
else if (!data->extraattrs && entry < 0)
- data->extraattrs = sat_calloc_block(data->nextra, sizeof(Id *), REPODATA_BLOCK);
+ data->extraattrs = sat_calloc_block(data->nextra, sizeof(Id), REPODATA_BLOCK);
if (entry < 0)
- ap = data->extraattrs[-1 - entry];
+ ap = &data->extraattrs[-1 - entry];
else
- ap = data->attrs[entry];
+ ap = &data->attrs[entry];
+ if (!*ap)
+ *ap = get_new_struct(data);
+ return *ap;
+}
+
+Id
+repodata_get_handle(Repodata *data, Id entry)
+{
+ return repodata_get_handle_int(data, entry);
+}
+
+static void
+repodata_insert_keyid(Repodata *data, Id handle, Id keyid, Id val, int overwrite)
+{
+ Id *pp;
+ Id *ap;
+ Id sid;
+ int i;
+ //sid = repodata_get_handle(data, handle);
+ sid = handle;
+ ap = data->structs[sid];
i = 0;
if (ap)
{
i = pp - ap;
}
ap = sat_extend(ap, i, 3, sizeof(Id), REPODATA_ATTRS_BLOCK);
- if (entry < 0)
- data->extraattrs[-1 - entry] = ap;
- else
- data->attrs[entry] = ap;
+ data->structs[sid] = ap;
pp = ap + i;
*pp++ = keyid;
*pp++ = val;
}
void
-repodata_set(Repodata *data, Id entry, Repokey *key, Id val)
+repodata_set(Repodata *data, Id handle, Repokey *key, Id val)
{
Id keyid;
data->verticaloffset[data->nkeys - 1] = 0;
}
}
- repodata_insert_keyid(data, entry, keyid, val, 1);
+ repodata_insert_keyid(data, handle, keyid, val, 1);
}
void
-repodata_set_id(Repodata *data, Id entry, Id keyname, Id id)
+repodata_set_id(Repodata *data, Id handle, Id keyname, Id id)
{
Repokey key;
key.name = keyname;
key.type = REPOKEY_TYPE_ID;
key.size = 0;
key.storage = KEY_STORAGE_INCORE;
- repodata_set(data, entry, &key, id);
+ repodata_set(data, handle, &key, id);
}
void
-repodata_set_num(Repodata *data, Id entry, Id keyname, unsigned int num)
+repodata_set_num(Repodata *data, Id handle, Id keyname, unsigned int num)
{
Repokey key;
key.name = keyname;
key.type = REPOKEY_TYPE_NUM;
key.size = 0;
key.storage = KEY_STORAGE_INCORE;
- repodata_set(data, entry, &key, (Id)num);
+ repodata_set(data, handle, &key, (Id)num);
}
void
-repodata_set_poolstr(Repodata *data, Id entry, Id keyname, const char *str)
+repodata_set_poolstr(Repodata *data, Id handle, Id keyname, const char *str)
{
Repokey key;
Id id;
key.type = REPOKEY_TYPE_ID;
key.size = 0;
key.storage = KEY_STORAGE_INCORE;
- repodata_set(data, entry, &key, id);
+ repodata_set(data, handle, &key, id);
}
void
-repodata_set_constant(Repodata *data, Id entry, Id keyname, unsigned int constant)
+repodata_set_constant(Repodata *data, Id handle, Id keyname, unsigned int constant)
{
Repokey key;
key.name = keyname;
key.type = REPOKEY_TYPE_CONSTANT;
key.size = constant;
key.storage = KEY_STORAGE_INCORE;
- repodata_set(data, entry, &key, 0);
+ repodata_set(data, handle, &key, 0);
}
void
-repodata_set_constantid(Repodata *data, Id entry, Id keyname, Id id)
+repodata_set_constantid(Repodata *data, Id handle, Id keyname, Id id)
{
Repokey key;
key.name = keyname;
key.type = REPOKEY_TYPE_CONSTANTID;
key.size = id;
key.storage = KEY_STORAGE_INCORE;
- repodata_set(data, entry, &key, 0);
+ repodata_set(data, handle, &key, 0);
}
void
-repodata_set_void(Repodata *data, Id entry, Id keyname)
+repodata_set_void(Repodata *data, Id handle, Id keyname)
{
Repokey key;
key.name = keyname;
key.type = REPOKEY_TYPE_VOID;
key.size = 0;
key.storage = KEY_STORAGE_INCORE;
- repodata_set(data, entry, &key, 0);
+ repodata_set(data, handle, &key, 0);
}
void
-repodata_set_str(Repodata *data, Id entry, Id keyname, const char *str)
+repodata_set_str(Repodata *data, Id handle, Id keyname, const char *str)
{
Repokey key;
int l;
key.storage = KEY_STORAGE_INCORE;
data->attrdata = sat_extend(data->attrdata, data->attrdatalen, l, 1, REPODATA_ATTRDATA_BLOCK);
memcpy(data->attrdata + data->attrdatalen, str, l);
- repodata_set(data, entry, &key, data->attrdatalen);
+ repodata_set(data, handle, &key, data->attrdatalen);
data->attrdatalen += l;
}
static void
-repoadata_add_array(Repodata *data, Id entry, Id keyname, Id keytype, int entrysize)
+repoadata_add_array(Repodata *data, Id handle, Id keyname, Id keytype, int entrysize)
{
int oldsize;
Id *ida, *pp;
- if (entry < 0)
- pp = data->extraattrs ? data->extraattrs[-1 - entry] : 0;
- else
- pp = data->attrs ? data->attrs[entry] : 0;
+ pp = data->structs[handle];
if (pp)
for (; *pp; pp += 2)
if (data->keys[*pp].name == keyname && data->keys[*pp].type == keytype)
key.size = 0;
key.storage = KEY_STORAGE_INCORE;
data->attriddata = sat_extend(data->attriddata, data->attriddatalen, entrysize + 1, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK);
- repodata_set(data, entry, &key, data->attriddatalen);
+ repodata_set(data, handle, &key, data->attriddatalen);
return;
}
oldsize = 0;
}
void
-repodata_set_bin_checksum(Repodata *data, Id entry, Id keyname, Id type,
+repodata_set_bin_checksum(Repodata *data, Id handle, Id keyname, Id type,
const unsigned char *str)
{
Repokey key;
key.storage = KEY_STORAGE_INCORE;
data->attrdata = sat_extend(data->attrdata, data->attrdatalen, l, 1, REPODATA_ATTRDATA_BLOCK);
memcpy(data->attrdata + data->attrdatalen, str, l);
- repodata_set(data, entry, &key, data->attrdatalen);
+ repodata_set(data, handle, &key, data->attrdatalen);
data->attrdatalen += l;
}
}
void
-repodata_set_checksum(Repodata *data, Id entry, Id keyname, Id type,
+repodata_set_checksum(Repodata *data, Id handle, Id keyname, Id type,
const char *str)
{
unsigned char buf[64];
fprintf(stderr, "Invalid hex character in '%s'\n", str);
return;
}
- repodata_set_bin_checksum(data, entry, keyname, type, buf);
+ repodata_set_bin_checksum(data, handle, keyname, type, buf);
}
const char *
}
void
-repodata_add_dirnumnum(Repodata *data, Id entry, Id keyname, Id dir, Id num, Id num2)
+repodata_add_dirnumnum(Repodata *data, Id handle, Id keyname, Id dir, Id num, Id num2)
{
#if 0
-fprintf(stderr, "repodata_add_dirnumnum %d %d %d %d (%d)\n", entry, dir, num, num2, data->attriddatalen);
+fprintf(stderr, "repodata_add_dirnumnum %d %d %d %d (%d)\n", handle, dir, num, num2, data->attriddatalen);
#endif
- repoadata_add_array(data, entry, keyname, REPOKEY_TYPE_DIRNUMNUMARRAY, 3);
+ repoadata_add_array(data, handle, keyname, REPOKEY_TYPE_DIRNUMNUMARRAY, 3);
data->attriddata[data->attriddatalen++] = dir;
data->attriddata[data->attriddatalen++] = num;
data->attriddata[data->attriddatalen++] = num2;
}
void
-repodata_add_dirstr(Repodata *data, Id entry, Id keyname, Id dir, const char *str)
+repodata_add_dirstr(Repodata *data, Id handle, Id keyname, Id dir, const char *str)
{
Id stroff;
int l;
data->attrdatalen += l;
#if 0
-fprintf(stderr, "repodata_add_dirstr %d %d %s (%d)\n", entry, dir, str, data->attriddatalen);
+fprintf(stderr, "repodata_add_dirstr %d %d %s (%d)\n", handle, dir, str, data->attriddatalen);
#endif
- repoadata_add_array(data, entry, keyname, REPOKEY_TYPE_DIRSTRARRAY, 2);
+ repoadata_add_array(data, handle, keyname, REPOKEY_TYPE_DIRSTRARRAY, 2);
data->attriddata[data->attriddatalen++] = dir;
data->attriddata[data->attriddatalen++] = stroff;
data->attriddata[data->attriddatalen++] = 0;
}
void
-repodata_add_idarray(Repodata *data, Id entry, Id keyname, Id id)
+repodata_add_idarray(Repodata *data, Id handle, Id keyname, Id id)
{
#if 0
-fprintf(stderr, "repodata_add_idarray %d %d (%d)\n", entry, id, data->attriddatalen);
+fprintf(stderr, "repodata_add_idarray %d %d (%d)\n", handle, id, data->attriddatalen);
#endif
- repoadata_add_array(data, entry, keyname, REPOKEY_TYPE_IDARRAY, 1);
+ repoadata_add_array(data, handle, keyname, REPOKEY_TYPE_IDARRAY, 1);
data->attriddata[data->attriddatalen++] = id;
data->attriddata[data->attriddatalen++] = 0;
}
void
-repodata_add_poolstr_array(Repodata *data, Id entry, Id keyname,
+repodata_add_poolstr_array(Repodata *data, Id handle, Id keyname,
const char *str)
{
Id id;
id = stringpool_str2id(&data->spool, str, 1);
else
id = str2id(data->repo->pool, str, 1);
- repodata_add_idarray(data, entry, keyname, id);
+ 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)
+{
+}
+#endif
+
void
repodata_merge_attrs(Repodata *data, Id dest, Id src)
{
Id *keyp;
if (dest == src
- || !(keyp = src < 0 ? data->extraattrs[-1 - src] : data->attrs[src]))
+ || !(keyp = data->structs[src < 0
+ ? data->extraattrs[-1 - src]
+ : data->attrs[src]]))
return;
+ dest = repodata_get_handle_int(data, dest);
for (; *keyp; keyp += 2)
repodata_insert_keyid(data, dest, keyp[0], keyp[1], 0);
}
nentry = 0;
for (entry = data->extraattrs ? -data->nextra : 0; entry < nentry; entry++)
{
+ Id sid;
memset(seen, 0, data->nkeys * sizeof(Id));
sp = schema;
dp = entry2data(data, entry);
*sp++ = *keyp;
oldcount++;
}
- keyp = entry < 0 ? data->extraattrs[-1 - entry] : data->attrs[entry];
+ sid = entry < 0 ? data->extraattrs[-1 - entry] : data->attrs[entry];
+ keyp = data->structs[sid];
if (keyp)
for (; *keyp; keyp += 2)
{
}
dp = ndp;
}
- if (entry < 0 && data->extraattrs[-1 - entry])
- sat_free(data->extraattrs[-1 - entry]);
- else if (entry >= 0 && data->attrs[entry])
- sat_free(data->attrs[entry]);
+ if (data->structs[sid])
+ data->structs[sid] = sat_free(data->structs[sid]);
}
+ for (entry = 0; entry < data->nstructs; entry++)
+ if (data->structs[entry])
+ sat_free(data->structs[entry]);
+ data->structs = sat_free(data->structs);
sat_free(schema);
sat_free(seen);
unsigned char *vincore;
unsigned int vincorelen;
- Id **attrs; /* un-internalized attributes */
- Id **extraattrs; /* Same, but for extra objects. */
+ Id *attrs; /* un-internalized attributes */
+ Id *extraattrs; /* Same, but for extra objects. */
unsigned char *attrdata; /* their string data space */
unsigned int attrdatalen;
Id *attriddata; /* their id space */
unsigned int attriddatalen;
+ Id **structs; /* key-value lists */
+ unsigned int nstructs;
Id *addedfileprovides;
} Repodata;
* data assignment functions
*/
+/* Returns a handle for the attributes of ENTRY. ENTRY >= 0
+ corresponds to data associated with a solvable, ENTRY < 0 is
+ extra data. The returned handle is used in the various repodata_set_*
+ functions to add attributes to it. */
+Id repodata_get_handle(Repodata *data, Id entry);
+
/* basic types: void, num, string, Id */
-void repodata_set_void(Repodata *data, Id entry, Id keyname);
-void repodata_set_num(Repodata *data, Id entry, Id keyname, unsigned int num);
-void repodata_set_str(Repodata *data, Id entry, Id keyname, const char *str);
-void repodata_set_id(Repodata *data, Id entry, Id keyname, Id id);
+void repodata_set_void(Repodata *data, Id handle, Id keyname);
+void repodata_set_num(Repodata *data, Id handle, Id keyname, unsigned int num);
+void repodata_set_str(Repodata *data, Id handle, Id keyname, const char *str);
+void repodata_set_id(Repodata *data, Id handle, Id keyname, Id id);
/* */
-void repodata_set_poolstr(Repodata *data, Id entry, Id keyname, const char *str);
+void repodata_set_poolstr(Repodata *data, Id handle, Id keyname, const char *str);
/* set numeric constant */
-void repodata_set_constant(Repodata *data, Id entry, Id keyname, unsigned int constant);
+void repodata_set_constant(Repodata *data, Id handle, Id keyname, unsigned int constant);
/* set Id constant */
-void repodata_set_constantid(Repodata *data, Id entry, Id keyname, Id id);
+void repodata_set_constantid(Repodata *data, Id handle, Id keyname, Id id);
/* checksum */
-void repodata_set_bin_checksum(Repodata *data, Id entry, Id keyname, Id type,
+void repodata_set_bin_checksum(Repodata *data, Id handle, Id keyname, Id type,
const unsigned char *buf);
-void repodata_set_checksum(Repodata *data, Id entry, Id keyname, Id type,
+void repodata_set_checksum(Repodata *data, Id handle, Id keyname, Id type,
const char *str);
/* directory (for package file list) */
-void repodata_add_dirnumnum(Repodata *data, Id entry, Id keyname, Id dir, Id num, Id num2);
-void repodata_add_dirstr(Repodata *data, Id entry, Id keyname, Id dir, const char *str);
+void repodata_add_dirnumnum(Repodata *data, Id handle, Id keyname, Id dir, Id num, Id num2);
+void repodata_add_dirstr(Repodata *data, Id handle, Id keyname, Id dir, const char *str);
/* Arrays */
-void repodata_add_idarray(Repodata *data, Id entry, Id keyname, Id id);
-void repodata_add_poolstr_array(Repodata *data, Id entry, Id keyname,
+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);
/*-----
{
pd->datanum = (pd->solvable - pool->solvables) - pd->repo->start;
repodata_extend(pd->data, pd->solvable - pool->solvables);
+ pd->datanum = repodata_get_handle(pd->data, pd->datanum);
repodata_set_num(pd->data, pd->datanum, SOLVABLE_BUILDTIME, pd->timestamp);
}
#if 0
static void
adddudata(Pool *pool, Repo *repo, Repodata *repodata, Solvable *s, RpmHead *rpmhead, char **dn, unsigned int *di, int fc, int dic)
{
- Id entry, did;
+ Id handle, did;
int i, fszc;
unsigned int *fkb, *fn, *fsz, *fm, *fino;
unsigned int inotest[256], inotestok;
sat_free(fm);
/* commit */
repodata_extend(repodata, s - pool->solvables);
- entry = (s - pool->solvables) - repodata->start;
+ handle = (s - pool->solvables) - repodata->start;
+ handle = repodata_get_handle(repodata, handle);
for (i = 0; i < fc; i++)
{
if (!fn[i])
did = repodata_str2dir(repodata, "/usr/src", 1);
else
did = repodata_str2dir(repodata, dn[i], 1);
- repodata_add_dirnumnum(repodata, entry, SOLVABLE_DISKUSAGE, did, fkb[i], fn[i]);
+ repodata_add_dirnumnum(repodata, handle, SOLVABLE_DISKUSAGE, did, fkb[i], fn[i]);
}
sat_free(fn);
sat_free(fkb);
#endif
if (repodata)
{
- Id entry, did;
+ Id handle, did;
repodata_extend(repodata, s - pool->solvables);
- entry = (s - pool->solvables) - repodata->start;
+ handle = (s - pool->solvables) - repodata->start;
+ handle = repodata_get_handle(repodata, handle);
did = repodata_str2dir(repodata, dn[di[i]], 1);
- repodata_add_dirstr(repodata, entry, SOLVABLE_FILELIST, did, bn[i]);
+ repodata_add_dirstr(repodata, handle, SOLVABLE_FILELIST, did, bn[i]);
}
}
#if 0
}
static void
-addsourcerpm(Pool *pool, Repodata *repodata, Solvable *s, char *sourcerpm, char *name, char *evr)
+addsourcerpm(Pool *pool, Repodata *repodata, Id handle, char *sourcerpm, char *name, char *evr)
{
- Id entry;
const char *p, *sevr, *sarch;
p = strrchr(sourcerpm, '.');
if (*p != '-' || p == sourcerpm)
return;
sevr = p + 1;
- entry = (s - pool->solvables) - repodata->start;
if (!strcmp(sarch, "src.rpm"))
- repodata_set_constantid(repodata, entry, SOLVABLE_SOURCEARCH, ARCH_SRC);
+ repodata_set_constantid(repodata, handle, SOLVABLE_SOURCEARCH, ARCH_SRC);
else if (!strcmp(sarch, "nosrc.rpm"))
- repodata_set_constantid(repodata, entry, SOLVABLE_SOURCEARCH, ARCH_NOSRC);
+ repodata_set_constantid(repodata, handle, SOLVABLE_SOURCEARCH, ARCH_NOSRC);
else
- repodata_set_constantid(repodata, entry, SOLVABLE_SOURCEARCH, strn2id(pool, sarch, strlen(sarch) - 4, 1));
+ repodata_set_constantid(repodata, handle, SOLVABLE_SOURCEARCH, strn2id(pool, sarch, strlen(sarch) - 4, 1));
if (!strncmp(sevr, evr, sarch - sevr - 1) && evr[sarch - sevr - 1] == 0)
- repodata_set_void(repodata, entry, SOLVABLE_SOURCEEVR);
+ repodata_set_void(repodata, handle, SOLVABLE_SOURCEEVR);
else
- repodata_set_id(repodata, entry, SOLVABLE_SOURCEEVR, strn2id(pool, sevr, sarch - sevr - 1, 1));
+ repodata_set_id(repodata, handle, SOLVABLE_SOURCEEVR, strn2id(pool, sevr, sarch - sevr - 1, 1));
if (!strncmp(sourcerpm, name, sevr - sourcerpm - 1) && name[sevr - sourcerpm - 1] == 0)
- repodata_set_void(repodata, entry, SOLVABLE_SOURCENAME);
+ repodata_set_void(repodata, handle, SOLVABLE_SOURCENAME);
else
- repodata_set_id(repodata, entry, SOLVABLE_SOURCENAME, strn2id(pool, sourcerpm, sevr - sourcerpm - 1, 1));
+ repodata_set_id(repodata, handle, SOLVABLE_SOURCENAME, strn2id(pool, sourcerpm, sevr - sourcerpm - 1, 1));
}
static int
if (repodata)
{
- Id entry;
+ Id handle;
char *str;
unsigned int u32;
repodata_extend(repodata, s - pool->solvables);
- entry = (s - pool->solvables) - repodata->start;
+ handle = repodata_get_handle(repodata, (s - pool->solvables) - repodata->start);
str = headstring(rpmhead, TAG_SUMMARY);
if (str)
- repodata_set_str(repodata, entry, SOLVABLE_SUMMARY, str);
+ repodata_set_str(repodata, handle, SOLVABLE_SUMMARY, str);
str = headstring(rpmhead, TAG_DESCRIPTION);
if (str)
{
while (l > 0 && str[l - 1] == '\n')
str[--l] = 0;
if (l)
- repodata_set_str(repodata, entry, SOLVABLE_DESCRIPTION, str);
+ repodata_set_str(repodata, handle, SOLVABLE_DESCRIPTION, str);
p = aut + 19;
aut = str; /* copy over */
while (*p == ' ' || *p == '\n')
aut--;
*aut = 0;
if (*str)
- repodata_set_str(repodata, entry, SOLVABLE_AUTHORS, str);
+ repodata_set_str(repodata, handle, SOLVABLE_AUTHORS, str);
free(str);
}
else if (*str)
- repodata_set_str(repodata, entry, SOLVABLE_DESCRIPTION, str);
+ repodata_set_str(repodata, handle, SOLVABLE_DESCRIPTION, str);
}
str = headstring(rpmhead, TAG_GROUP);
if (str)
- repodata_set_poolstr(repodata, entry, SOLVABLE_GROUP, str);
+ repodata_set_poolstr(repodata, handle, SOLVABLE_GROUP, str);
str = headstring(rpmhead, TAG_LICENSE);
if (str)
- repodata_set_poolstr(repodata, entry, SOLVABLE_LICENSE, str);
+ repodata_set_poolstr(repodata, handle, SOLVABLE_LICENSE, str);
u32 = headint32(rpmhead, TAG_BUILDTIME);
if (u32)
- repodata_set_num(repodata, entry, SOLVABLE_BUILDTIME, u32);
+ repodata_set_num(repodata, handle, SOLVABLE_BUILDTIME, u32);
u32 = headint32(rpmhead, TAG_INSTALLTIME);
if (u32)
- repodata_set_num(repodata, entry, SOLVABLE_INSTALLTIME, u32);
+ repodata_set_num(repodata, handle, SOLVABLE_INSTALLTIME, u32);
u32 = headint32(rpmhead, TAG_SIZE);
if (u32)
- repodata_set_num(repodata, entry, SOLVABLE_INSTALLSIZE, (u32 + 1023) / 1024);
+ repodata_set_num(repodata, handle, SOLVABLE_INSTALLSIZE, (u32 + 1023) / 1024);
if (sourcerpm)
- addsourcerpm(pool, repodata, s, sourcerpm, name, evr);
+ addsourcerpm(pool, repodata, handle, sourcerpm, name, evr);
}
sat_free(evr);
return 1;
struct solvable_copy_cbdata {
Repodata *data;
- Id entry;
+ Id handle;
};
static int
{
Id id, keyname;
Repodata *data = ((struct solvable_copy_cbdata *)cbdata)->data;
- Id entry = ((struct solvable_copy_cbdata *)cbdata)->entry;
+ Id handle = ((struct solvable_copy_cbdata *)cbdata)->handle;
Pool *pool = data->repo->pool, *frompool = fromdata->repo->pool;
Stringpool *fromspool = fromdata->localpool ? &fromdata->spool : &frompool->ss;
id = str2id(pool, stringpool_id2str(fromspool, id), 1);
}
if (key->type == REPOKEY_TYPE_ID)
- repodata_set_id(data, entry, keyname, id);
+ repodata_set_id(data, handle, keyname, id);
else
- repodata_set_constantid(data, entry, keyname, id);
+ repodata_set_constantid(data, handle, keyname, id);
break;
case REPOKEY_TYPE_STR:
- repodata_set_str(data, entry, keyname, kv->str);
+ repodata_set_str(data, handle, keyname, kv->str);
break;
case REPOKEY_TYPE_VOID:
- repodata_set_void(data, entry, keyname);
+ repodata_set_void(data, handle, keyname);
break;
case REPOKEY_TYPE_NUM:
- repodata_set_num(data, entry, keyname, kv->num);
+ repodata_set_num(data, handle, keyname, kv->num);
break;
case REPOKEY_TYPE_CONSTANT:
- repodata_set_constant(data, entry, keyname, kv->num);
+ repodata_set_constant(data, handle, keyname, kv->num);
break;
case REPOKEY_TYPE_DIRNUMNUMARRAY:
id = kv->id;
assert(!data->localpool); /* implement me! */
id = copydir(pool, data, fromspool, fromdata, id);
- repodata_add_dirnumnum(data, entry, keyname, id, kv->num, kv->num2);
+ repodata_add_dirnumnum(data, handle, keyname, id, kv->num, kv->num2);
break;
case REPOKEY_TYPE_DIRSTRARRAY:
id = kv->id;
assert(!data->localpool); /* implement me! */
id = copydir(pool, data, fromspool, fromdata, id);
- repodata_add_dirstr(data, entry, keyname, id, kv->str);
+ repodata_add_dirstr(data, handle, keyname, id, kv->str);
break;
default:
break;
return;
repodata_extend(data, s - pool->solvables);
cbdata.data = data;
- cbdata.entry = (s - pool->solvables) - data->start;
+ cbdata.handle = repodata_get_handle(data, (s - pool->solvables) - data->start);
repo_search(fromrepo, (r - fromrepo->pool->solvables), 0, 0, SEARCH_NO_STORAGE_SOLVABLE, solvable_copy_cb, &cbdata);
}
/* only works if nothing is already internalized! */
if (data && data->attrs)
{
- Id *tmpattrs = data->attrs[pa - data->start];
+ Id tmpattrs = data->attrs[pa - data->start];
data->attrs[pa - data->start] = data->attrs[pb - data->start];
data->attrs[pb - data->start] = tmpattrs;
}
}
static void
-add_location(Repodata *data, Solvable *s, const char *location)
+add_location(Repodata *data, Solvable *s, Id handle, const char *location)
{
Pool *pool = s->repo->pool;
const char *name, *n1, *n2;
int l;
- Id entry;
repodata_extend(data, s - pool->solvables);
- entry = (s - pool->solvables) - data->start;
/* skip ./ prefix */
if (location[0] == '.' && location[1] == '/' && location[2] != '/')
/* too bad, need to store directory */
char *dir = strdup(location);
dir[name - location - 1] = 0;
- repodata_set_str(data, entry, SOLVABLE_MEDIADIR, dir);
+ repodata_set_str(data, handle, SOLVABLE_MEDIADIR, dir);
free(dir);
}
else
- repodata_set_void(data, entry, SOLVABLE_MEDIADIR);
+ repodata_set_void(data, handle, SOLVABLE_MEDIADIR);
}
n1 = name;
for (n2 = id2str(pool, s->name); *n2; n1++, n2++)
break;
if (*n2 || strcmp (n1, ".rpm"))
goto nontrivial;
- repodata_set_void(data, entry, SOLVABLE_MEDIAFILE);
+ repodata_set_void(data, handle, SOLVABLE_MEDIAFILE);
return;
nontrivial:
- repodata_set_str(data, entry, SOLVABLE_MEDIAFILE, name);
+ repodata_set_str(data, handle, SOLVABLE_MEDIAFILE, name);
return;
}
fclose(fp);
s = pool_id2solvable(pool, repo_add_solvable(repo));
rpm2solv(pool, repo, repodata, s, rpmhead);
- add_location(repodata, s, rpms[i]);
if (repodata)
{
- Id entry = (s - pool->solvables) - repodata->start;
- repodata_set_num(repodata, entry, SOLVABLE_DOWNLOADSIZE, (unsigned int)((stb.st_size + 1023) / 1024));
- repodata_set_num(repodata, entry, SOLVABLE_HEADEREND, headerend);
+ Id handle = (s - pool->solvables) - repodata->start;
+ handle = repodata_get_handle(repodata, handle);
+ add_location(repodata, s, handle, rpms[i]);
+ repodata_set_num(repodata, handle, SOLVABLE_DOWNLOADSIZE, (unsigned int)((stb.st_size + 1023) / 1024));
+ repodata_set_num(repodata, handle, SOLVABLE_HEADEREND, headerend);
}
}
if (rpmhead)
// while the tag ends
const char *tmpattr;
Repodata *data;
+ Id handle;
};
static char *flagtabnum[] = {
}
static void
-set_desciption_author(Repodata *data, Id entry, char *str)
+set_desciption_author(Repodata *data, Id handle, char *str)
{
char *aut, *p;
while (l > 0 && str[l - 1] == '\n')
str[--l] = 0;
if (l)
- repodata_set_str(data, entry, SOLVABLE_DESCRIPTION, str);
+ repodata_set_str(data, handle, SOLVABLE_DESCRIPTION, str);
p = aut + 19;
aut = str; /* copy over */
while (*p == ' ' || *p == '\n')
aut--;
*aut = 0;
if (*str)
- repodata_set_str(data, entry, SOLVABLE_AUTHORS, str);
+ repodata_set_str(data, handle, SOLVABLE_AUTHORS, str);
}
else if (*str)
- repodata_set_str(data, entry, SOLVABLE_DESCRIPTION, str);
+ repodata_set_str(data, handle, SOLVABLE_DESCRIPTION, str);
}
static void
-set_sourcerpm(Repodata *data, Solvable *s, Id entry, char *sourcerpm)
+set_sourcerpm(Repodata *data, Solvable *s, Id handle, char *sourcerpm)
{
const char *p, *sevr, *sarch, *name, *evr;
Pool *pool;
- p = strrchr(sourcerpm, '.');
+ p = strrchr(sourcerpm, '.');
if (!p || strcmp(p, ".rpm") != 0)
return;
p--;
name = id2str(pool, s->name);
evr = id2str(pool, s->evr);
if (!strcmp(sarch, "src.rpm"))
- repodata_set_constantid(data, entry, SOLVABLE_SOURCEARCH, ARCH_SRC);
+ repodata_set_constantid(data, handle, SOLVABLE_SOURCEARCH, ARCH_SRC);
else if (!strcmp(sarch, "nosrc.rpm"))
- repodata_set_constantid(data, entry, SOLVABLE_SOURCEARCH, ARCH_NOSRC);
+ repodata_set_constantid(data, handle, SOLVABLE_SOURCEARCH, ARCH_NOSRC);
else
- repodata_set_constantid(data, entry, SOLVABLE_SOURCEARCH, strn2id(pool, sarch, strlen(sarch) - 4, 1));
+ repodata_set_constantid(data, handle, SOLVABLE_SOURCEARCH, strn2id(pool, sarch, strlen(sarch) - 4, 1));
if (!strncmp(sevr, evr, sarch - sevr - 1) && evr[sarch - sevr - 1] == 0)
- repodata_set_void(data, entry, SOLVABLE_SOURCEEVR);
+ repodata_set_void(data, handle, SOLVABLE_SOURCEEVR);
else
- repodata_set_id(data, entry, SOLVABLE_SOURCEEVR, strn2id(pool, sevr, sarch - sevr - 1, 1));
+ repodata_set_id(data, handle, SOLVABLE_SOURCEEVR, strn2id(pool, sevr, sarch - sevr - 1, 1));
if (!strncmp(sourcerpm, name, sevr - sourcerpm - 1) && name[sevr - sourcerpm -
1] == 0)
- repodata_set_void(data, entry, SOLVABLE_SOURCENAME);
+ repodata_set_void(data, handle, SOLVABLE_SOURCENAME);
else
- repodata_set_id(data, entry, SOLVABLE_SOURCENAME, strn2id(pool, sourcerpm, sevr - sourcerpm - 1, 1));
+ repodata_set_id(data, handle, SOLVABLE_SOURCENAME, strn2id(pool, sourcerpm, sevr - sourcerpm - 1, 1));
}
static void XMLCALL
Solvable *s = pd->solvable;
struct stateswitch *sw;
const char *str;
- Id entry = s ? (s - pool->solvables) - pd->data->start : 0;
+ Id handle = pd->handle;
// fprintf(stderr, "into %s, from %d, depth %d, statedepth %d\n", name, pd->state, pd->depth, pd->statedepth);
pd->solvable = pool_id2solvable(pool, repo_add_solvable(pd->common.repo));
repodata_extend(pd->data, pd->solvable - pool->solvables);
+ pd->handle = repodata_get_handle(pd->data, (pd->solvable - pool->solvables) - pd->data->start);
#if 0
fprintf(stderr, "package #%d\n", pd->solvable - pool->solvables);
#endif
{
char *str3 = strdup(str);
str3[str2 - str] = 0;
- repodata_set_poolstr(pd->data, entry, SOLVABLE_MEDIADIR, str3);
+ repodata_set_poolstr(pd->data, handle, SOLVABLE_MEDIADIR, str3);
free(str3);
- repodata_set_str(pd->data, entry, SOLVABLE_MEDIAFILE, str2 + 1);
+ repodata_set_str(pd->data, handle, SOLVABLE_MEDIAFILE, str2 + 1);
}
else
- repodata_set_str(pd->data, entry, SOLVABLE_MEDIAFILE, str);
+ repodata_set_str(pd->data, handle, SOLVABLE_MEDIAFILE, str);
}
break;
case STATE_CHECKSUM:
unsigned int t;
str = find_attr("build", atts);
if (str && (t = atoi(str)) != 0)
- repodata_set_num(pd->data, entry, SOLVABLE_BUILDTIME, t);
+ repodata_set_num(pd->data, handle, SOLVABLE_BUILDTIME, t);
break;
}
case STATE_SIZE:
unsigned int k;
str = find_attr("installed", atts);
if (str && (k = atoi(str)) != 0)
- repodata_set_num(pd->data, entry, SOLVABLE_INSTALLSIZE, (k + 1023) / 1024);
+ repodata_set_num(pd->data, handle, SOLVABLE_INSTALLSIZE, (k + 1023) / 1024);
/* XXX the "package" attribute gives the size of the rpm file,
i.e. the download size. Except on packman, there it seems to be
something else entirely, it has a value near to the other two
values, as if the rpm is uncompressed. */
str = find_attr("package", atts);
if (str && (k = atoi(str)) != 0)
- repodata_set_num(pd->data, entry, SOLVABLE_DOWNLOADSIZE, (k + 1023) / 1024);
+ repodata_set_num(pd->data, handle, SOLVABLE_DOWNLOADSIZE, (k + 1023) / 1024);
break;
}
case STATE_HEADERRANGE:
unsigned int end;
str = find_attr("end", atts);
if (str && (end = atoi(str)) != 0)
- repodata_set_num(pd->data, entry, SOLVABLE_HEADEREND, end);
+ repodata_set_num(pd->data, handle, SOLVABLE_HEADEREND, end);
}
default:
break;
Pool *pool = pd->common.pool;
Solvable *s = pd->solvable;
Repo *repo = pd->common.repo;
- Id entry = s ? (s - pool->solvables) - pd->data->start : 0;
+ Id handle = pd->handle;
Id id;
char *p;
s->vendor = str2id(pool, pd->content, 1);
break;
case STATE_RPM_GROUP:
- repodata_set_poolstr(pd->data, entry, SOLVABLE_GROUP, pd->content);
+ repodata_set_poolstr(pd->data, handle, SOLVABLE_GROUP, pd->content);
break;
case STATE_RPM_LICENSE:
- repodata_set_poolstr(pd->data, entry, SOLVABLE_LICENSE, pd->content);
+ repodata_set_poolstr(pd->data, handle, SOLVABLE_LICENSE, pd->content);
break;
case STATE_FILE:
#if 0
p = pd->content;
id = repodata_str2dir(pd->data, "/", 1);
}
- repodata_add_dirstr(pd->data, entry, SOLVABLE_FILELIST, id, p);
+ repodata_add_dirstr(pd->data, handle, SOLVABLE_FILELIST, id, p);
break;
// xml store capabilities
case STATE_CAP_PROVIDES:
break;
case STATE_SUMMARY:
pd->lang = 0;
- repodata_set_str(pd->data, entry, SOLVABLE_SUMMARY, pd->content);
+ repodata_set_str(pd->data, handle, SOLVABLE_SUMMARY, pd->content);
break;
case STATE_DESCRIPTION:
pd->lang = 0;
- set_desciption_author(pd->data, entry, pd->content);
+ set_desciption_author(pd->data, handle, pd->content);
break;
case STATE_SOURCERPM:
- set_sourcerpm(pd->data, s, entry, pd->content);
+ set_sourcerpm(pd->data, s, handle, pd->content);
break;
default:
break;
*/
static void
-add_location(struct parsedata *pd, char *line, Solvable *s, unsigned entry)
+add_location(struct parsedata *pd, char *line, Solvable *s, unsigned handle)
{
Pool *pool = s->repo->pool;
char *sp[3];
{
/* medianr filename dir
don't optimize this one */
- repodata_set_constant(pd->data, entry, SOLVABLE_MEDIANR, atoi(sp[0]));
- repodata_set_poolstr(pd->data, entry, SOLVABLE_MEDIADIR, sp[2]);
- repodata_set_str(pd->data, entry, SOLVABLE_MEDIAFILE, sp[1]);
+ repodata_set_constant(pd->data, handle, SOLVABLE_MEDIANR, atoi(sp[0]));
+ repodata_set_poolstr(pd->data, handle, SOLVABLE_MEDIADIR, sp[2]);
+ repodata_set_str(pd->data, handle, SOLVABLE_MEDIAFILE, sp[1]);
return;
}
else
if (*n2 || strcmp (n1, ".rpm"))
goto nontrivial;
- repodata_set_constant(pd->data, entry, SOLVABLE_MEDIANR, medianr);
- repodata_set_void(pd->data, entry, SOLVABLE_MEDIADIR);
- repodata_set_void(pd->data, entry, SOLVABLE_MEDIAFILE);
+ repodata_set_constant(pd->data, handle, SOLVABLE_MEDIANR, medianr);
+ repodata_set_void(pd->data, handle, SOLVABLE_MEDIADIR);
+ repodata_set_void(pd->data, handle, SOLVABLE_MEDIAFILE);
return;
nontrivial:
- repodata_set_constant(pd->data, entry, SOLVABLE_MEDIANR, medianr);
- repodata_set_void(pd->data, entry, SOLVABLE_MEDIADIR);
- repodata_set_str(pd->data, entry, SOLVABLE_MEDIAFILE, sp[1]);
+ repodata_set_constant(pd->data, handle, SOLVABLE_MEDIANR, medianr);
+ repodata_set_void(pd->data, handle, SOLVABLE_MEDIADIR);
+ repodata_set_str(pd->data, handle, SOLVABLE_MEDIAFILE, sp[1]);
return;
}
}
*/
static void
-add_source(struct parsedata *pd, char *line, Solvable *s, unsigned entry)
+add_source(struct parsedata *pd, char *line, Solvable *s, unsigned handle)
{
Repo *repo = s->repo;
Pool *pool = repo->pool;
Id arch = str2id(pool, sp[3], 1);
/* XXX: could record a dep here, depends on where we want to store the data */
if (name == s->name)
- repodata_set_void(pd->data, entry, SOLVABLE_SOURCENAME);
+ repodata_set_void(pd->data, handle, SOLVABLE_SOURCENAME);
else
- repodata_set_id(pd->data, entry, SOLVABLE_SOURCENAME, name);
+ repodata_set_id(pd->data, handle, SOLVABLE_SOURCENAME, name);
if (evr == s->evr)
- repodata_set_void(pd->data, entry, SOLVABLE_SOURCEEVR);
+ repodata_set_void(pd->data, handle, SOLVABLE_SOURCEEVR);
else
- repodata_set_id(pd->data, entry, SOLVABLE_SOURCEEVR, evr);
- repodata_set_constantid(pd->data, entry, SOLVABLE_SOURCEARCH, arch);
+ repodata_set_id(pd->data, handle, SOLVABLE_SOURCEEVR, evr);
+ repodata_set_constantid(pd->data, handle, SOLVABLE_SOURCEARCH, arch);
}
/*
}
static void
-set_checksum(Repodata *data, int last_found_pack, Id keyname, char *line)
+set_checksum(Repodata *data, int handle, Id keyname, char *line)
{
char *sp[3];
int l;
fprintf(stderr, "Invalid checksum length for %s: %s\n", sp[0], sp[1]);
exit(1);
}
- repodata_set_checksum(data, last_found_pack, keyname, type, sp[1]);
+ repodata_set_checksum(data, handle, keyname, type, sp[1]);
}
/*
*/
static void
-commit_diskusage (struct parsedata *pd, unsigned entry)
+commit_diskusage (struct parsedata *pd, unsigned handle)
{
unsigned i;
Dirpool *dp = &pd->data->dirpool;
for (i = 0; i < pd->ndirs; i++)
if (pd->dirs[i][1] || pd->dirs[i][2])
{
- repodata_add_dirnumnum(pd->data, entry, SOLVABLE_DISKUSAGE, pd->dirs[i][0], pd->dirs[i][1], pd->dirs[i][2]);
+ repodata_add_dirnumnum(pd->data, handle, SOLVABLE_DISKUSAGE, pd->dirs[i][0], pd->dirs[i][1], pd->dirs[i][2]);
}
pd->ndirs = 0;
}
*/
void
-finish_solvable(struct parsedata *pd, Solvable *s, int last_found_pack)
+finish_solvable(struct parsedata *pd, Solvable *s, int handle)
{
Pool *pool = pd->repo->pool;
sdup[sp - str] = 0;
did = repodata_str2dir(pd->data, sdup, 1);
}
- repodata_add_dirstr(pd->data, last_found_pack, SOLVABLE_FILELIST, did, sp + 1);
+ repodata_add_dirstr(pd->data, handle, SOLVABLE_FILELIST, did, sp + 1);
*p = 0;
}
}
harmless to do twice. */
s->supplements = repo_fix_legacy(pd->repo, s->provides, s->supplements);
if (pd->ndirs)
- commit_diskusage (pd, last_found_pack);
+ commit_diskusage (pd, handle);
}
void
struct parsedata pd;
Repodata *data = 0;
Id blanr = -1;
+ Id handle = 0;
if ((flags & SUSETAGS_EXTEND) && repo->nrepodata)
indesc = 1;
/* If we have an old solvable, complete it by filling in some
default stuff. */
if (s)
- finish_solvable(&pd, s, last_found_pack);
+ finish_solvable(&pd, s, handle);
/*
* define kind
if (n == repo->end)
s = 0;
else
- last_found_pack = nn - repo->start;
+ {
+ last_found_pack = nn - repo->start;
+ handle = repodata_get_handle(data, last_found_pack);
+ }
}
/* And if we still don't have a solvable, create a new one. */
s = pool_id2solvable(pool, repo_add_solvable(repo));
last_found_pack = (s - pool->solvables) - repo->start;
if (data)
- repodata_extend(data, s - pool->solvables);
+ {
+ repodata_extend(data, s - pool->solvables);
+ handle = repodata_get_handle(data, last_found_pack);
+ }
if (name)
s->name = name;
else if (pd.kind)
if (pd.kind)
{
if (flags & SUSETAGS_KINDS_SEPARATELY)
- repodata_set_poolstr(data, last_found_pack, str2id(pool, "solvable:must", 1), line + 6);
+ repodata_set_poolstr(data, handle, str2id(pool, "solvable:must", 1), line + 6);
else
s->requires = adddep(pool, &pd, s->requires, line, 0, 0); /* patterns: a required package */
}
continue;
case CTAG('=', 'P', 'r', 'c'): /* packages recommended */
if (flags & SUSETAGS_KINDS_SEPARATELY)
- repodata_set_poolstr(data, last_found_pack, str2id(pool, "solvable:should", 1), line + 6);
+ repodata_set_poolstr(data, handle, str2id(pool, "solvable:should", 1), line + 6);
else
s->recommends = adddep(pool, &pd, s->recommends, line, 0, 0);
continue;
case CTAG('=', 'P', 's', 'g'): /* packages suggested */
if (flags & SUSETAGS_KINDS_SEPARATELY)
- repodata_set_poolstr(data, last_found_pack, str2id(pool, "solvable:may", 1), line + 6);
+ repodata_set_poolstr(data, handle, str2id(pool, "solvable:may", 1), line + 6);
else
s->suggests = adddep(pool, &pd, s->suggests, line, 0, 0);
continue;
continue;
case CTAG('=', 'V', 'e', 'r'): /* - version - */
last_found_pack = 0;
+ handle = 0;
indesc++;
continue;
/* From here it's the attribute tags. */
case CTAG('=', 'G', 'r', 'p'):
- repodata_set_poolstr(data, last_found_pack, SOLVABLE_GROUP, line + 6);
+ repodata_set_poolstr(data, handle, SOLVABLE_GROUP, line + 6);
continue;
case CTAG('=', 'L', 'i', 'c'):
- repodata_set_poolstr(data, last_found_pack, SOLVABLE_LICENSE, line + 6);
+ repodata_set_poolstr(data, handle, SOLVABLE_LICENSE, line + 6);
continue;
case CTAG('=', 'L', 'o', 'c'):
- add_location(&pd, line + 6, s, last_found_pack);
+ add_location(&pd, line + 6, s, handle);
continue;
case CTAG('=', 'S', 'r', 'c'):
- add_source(&pd, line + 6, s, last_found_pack);
+ add_source(&pd, line + 6, s, handle);
continue;
case CTAG('=', 'S', 'i', 'z'):
if (split (line + 6, sp, 3) == 2)
{
- repodata_set_num(data, last_found_pack, SOLVABLE_DOWNLOADSIZE, (atoi(sp[0]) + 1023) / 1024);
- repodata_set_num(data, last_found_pack, SOLVABLE_INSTALLSIZE, (atoi(sp[1]) + 1023) / 1024);
+ repodata_set_num(data, handle, SOLVABLE_DOWNLOADSIZE, (atoi(sp[0]) + 1023) / 1024);
+ repodata_set_num(data, handle, SOLVABLE_INSTALLSIZE, (atoi(sp[1]) + 1023) / 1024);
}
continue;
case CTAG('=', 'T', 'i', 'm'):
{
unsigned int t = atoi (line + 6);
if (t)
- repodata_set_num(data, last_found_pack, SOLVABLE_BUILDTIME, t);
+ repodata_set_num(data, handle, SOLVABLE_BUILDTIME, t);
}
continue;
case CTAG('=', 'K', 'w', 'd'):
- repodata_add_poolstr_array(data, last_found_pack, SOLVABLE_KEYWORDS, line + 6);
+ repodata_add_poolstr_array(data, handle, SOLVABLE_KEYWORDS, line + 6);
continue;
case CTAG('=', 'A', 'u', 't'):
- repodata_set_str(data, last_found_pack, SOLVABLE_AUTHORS, line + 6);
+ repodata_set_str(data, handle, SOLVABLE_AUTHORS, line + 6);
continue;
case CTAG('=', 'S', 'u', 'm'):
- repodata_set_str(data, last_found_pack, langtag(&pd, SOLVABLE_SUMMARY, language), line + 6);
+ repodata_set_str(data, handle, langtag(&pd, SOLVABLE_SUMMARY, language), line + 6);
continue;
case CTAG('=', 'D', 'e', 's'):
- repodata_set_str(data, last_found_pack, langtag(&pd, SOLVABLE_DESCRIPTION, language), line + 6);
+ repodata_set_str(data, handle, langtag(&pd, SOLVABLE_DESCRIPTION, language), line + 6);
continue;
case CTAG('=', 'E', 'u', 'l'):
- repodata_set_str(data, last_found_pack, langtag(&pd, SOLVABLE_EULA, language), line + 6);
+ repodata_set_str(data, handle, langtag(&pd, SOLVABLE_EULA, language), line + 6);
continue;
case CTAG('=', 'I', 'n', 's'):
- repodata_set_str(data, last_found_pack, langtag(&pd, SOLVABLE_MESSAGEINS, language), line + 6);
+ repodata_set_str(data, handle, langtag(&pd, SOLVABLE_MESSAGEINS, language), line + 6);
if (blanr)
{
/* XXX testcode */
}
continue;
case CTAG('=', 'D', 'e', 'l'):
- repodata_set_str(data, last_found_pack, langtag(&pd, SOLVABLE_MESSAGEDEL, language), line + 6);
+ repodata_set_str(data, handle, langtag(&pd, SOLVABLE_MESSAGEDEL, language), line + 6);
continue;
case CTAG('=', 'V', 'i', 's'):
{
unsigned k;
k = atoi (line + 6);
if (k || !strcasecmp (line + 6, "true"))
- repodata_set_constant(data, last_found_pack, SOLVABLE_ISVISIBLE, 1);
+ repodata_set_constant(data, handle, SOLVABLE_ISVISIBLE, 1);
}
continue;
case CTAG('=', 'S', 'h', 'r'):
add_dirline (&pd, line + 6);
continue;
case CTAG('=', 'C', 'a', 't'):
- repodata_set_poolstr(data, last_found_pack, SOLVABLE_CATEGORY, line + 6);
+ repodata_set_poolstr(data, handle, SOLVABLE_CATEGORY, line + 6);
break;
case CTAG('=', 'O', 'r', 'd'):
/* Order is a string not a number, so we can retroactively insert
new patterns in the middle, i.e. 1 < 15 < 2. */
- repodata_set_str(data, last_found_pack, SOLVABLE_ORDER, line + 6);
+ repodata_set_str(data, handle, SOLVABLE_ORDER, line + 6);
break;
case CTAG('=', 'I', 'c', 'o'):
- repodata_set_str(data, last_found_pack, SOLVABLE_ICON, line + 6);
+ repodata_set_str(data, handle, SOLVABLE_ICON, line + 6);
break;
case CTAG('=', 'E', 'x', 't'):
- repodata_add_poolstr_array(data, last_found_pack, SOLVABLE_EXTENDS, join2("pattern", ":", line + 6));
+ repodata_add_poolstr_array(data, handle, SOLVABLE_EXTENDS, join2("pattern", ":", line + 6));
break;
case CTAG('=', 'I', 'n', 'c'):
- repodata_add_poolstr_array(data, last_found_pack, SOLVABLE_INCLUDES, join2("pattern", ":", line + 6));
+ repodata_add_poolstr_array(data, handle, SOLVABLE_INCLUDES, join2("pattern", ":", line + 6));
break;
case CTAG('=', 'C', 'k', 's'):
- set_checksum(data, last_found_pack, SOLVABLE_CHECKSUM, line + 6);
+ set_checksum(data, handle, SOLVABLE_CHECKSUM, line + 6);
break;
case CTAG('=', 'L', 'a', 'n'):
language = strdup(line + 6);
} /* for(;;) */
if (s)
- finish_solvable(&pd, s, last_found_pack);
+ finish_solvable(&pd, s, handle);
/* Shared attributes
* (e.g. multiple binaries built from same source)
free(pd.common.tmp);
free(line);
}
-
#include "repo_updateinfoxml.h"
#include "tools_util.h"
-//#define TESTMM
-
/*
* <updates>
* <update from="rel-eng@fedoraproject.org" status="stable" type="security" version="1.4">
solvable = pd->solvable = pool_id2solvable(pool, repo_add_solvable(pd->repo));
pd->datanum = (pd->solvable - pool->solvables) - pd->repo->start;
repodata_extend(pd->data, pd->solvable - pool->solvables);
+ pd->datanum = repodata_get_handle(pd->data, pd->datanum);
solvable->vendor = str2id(pool, from, 1);
solvable->evr = str2id(pool, version, 1);
/* util function to set a translated string */
-static inline void repodata_set_tstr(Repodata *data, Id rid, const char *attrname, const char *lang, const char *str)
+static inline void repodata_set_tstr(Repodata *data, Id handle, const char *attrname, const char *lang, const char *str)
{
Id attrid;
attrid = str2id(data->repo->pool, join2(attrname, ":", lang), 1);
- repodata_set_str(data, rid, attrid, str);
+ repodata_set_str(data, handle, attrid, str);
}
#endif /* SATSOLVER_TOOLS_UTIL_H */