return 0;
}
+int
+repo_lookup_num(Solvable *s, Id key)
+{
+ Repo *repo = s->repo;
+ Pool *pool = repo->pool;
+ Repodata *data;
+ int i, j, n;
+
+ n = s - pool->solvables;
+ for (i = 0, data = repo->repodata; i < repo->nrepodata; i++, data++)
+ {
+ if (n < data->start || n >= data->end)
+ continue;
+ for (j = 1; j < data->nkeys; j++)
+ {
+ if (data->keys[j].name == key && (data->keys[j].type == TYPE_U32 || data->keys[j].type == TYPE_NUM))
+ return repodata_lookup_num(data, n - data->start, j);
+ }
+ }
+ return 0;
+}
+
Repodata *
repo_add_repodata(Repo *repo)
{
Repodata *repo_add_repodata(Repo *repo);
void repo_search(Repo *repo, Id p, Id key, const char *match, int flags, int (*callback)(void *cbdata, Solvable *s, Repodata *data, Repokey *key, KeyValue *kv), void *cbdata);
+/* returns the string value of the attribute, or NULL if not found */
+const char * repo_lookup_str(Solvable *s, Id key);
+/* returns the string value of the attribute, or 0 if not found */
+int repo_lookup_num(Solvable *s, Id key);
+
void repo_set_id(Repo *repo, Id p, Id keyname, Id id);
void repo_set_num(Repo *repo, Id p, Id keyname, Id num);
void repo_set_str(Repo *repo, Id p, Id keyname, const char *str);
return id2str(data->repo->pool, id);
}
+int
+repodata_lookup_num(Repodata *data, Id entry, Id keyid)
+{
+ Id schema;
+ Repokey *key;
+ Id *keyp;
+ KeyValue kv;
+ unsigned char *dp;
+
+ dp = data->incoredata + data->incoreoffset[entry];
+ dp = data_read_id(dp, &schema);
+ /* make sure the schema of this solvable contains the key */
+ for (keyp = data->schemadata + data->schemata[schema]; *keyp != keyid; keyp++)
+ if (!*keyp)
+ return 0;
+ dp = forward_to_key(data, keyid, schema, dp);
+ key = data->keys + keyid;
+ dp = get_data(data, key, &dp);
+ if (!dp)
+ return 0;
+ if (key->type == TYPE_NUM || key->type == TYPE_U32)
+ {
+ dp = data_fetch(dp, &kv, key);
+ return kv.num;
+ }
+ return 0;
+}
+
void
repodata_search(Repodata *data, Id entry, Id keyname, int (*callback)(void *cbdata, Solvable *s, Repodata *data, Repokey *key, KeyValue *kv), void *cbdata)
{
void repodata_search(Repodata *data, Id entry, Id keyname, int (*callback)(void *cbdata, Solvable *s, Repodata *data, struct _Repokey *key, struct _KeyValue *kv), void *cbdata);
const char *repodata_lookup_str(Repodata *data, Id entry, Id keyid);
+int repodata_lookup_num(Repodata *data, Id entry, Id keyid);
void repodata_extend(Repodata *data, Id p);