lookup_shared_id(Repodata *data, Id p, Id keyname, Id voidid, int uninternalized)
{
Id r;
- if (repodata_lookup_void(data, p, keyname))
- return voidid;
- r = repodata_lookup_id(data, p, keyname);
+ r = repodata_lookup_type(data, p, keyname);
if (r)
- return r;
+ {
+ if (r == REPOKEY_TYPE_VOID)
+ return voidid;
+ r = repodata_lookup_id(data, p, keyname);
+ if (r)
+ return r;
+ }
if (uninternalized && data->attrs)
{
Id *ap = data->attrs[p - data->start];
if (!*kp)
return 0;
*keypp = key = data->keys + *kp;
+ if (key->type == REPOKEY_TYPE_DELETED)
+ return 0;
if (key->type == REPOKEY_TYPE_VOID || key->type == REPOKEY_TYPE_CONSTANT || key->type == REPOKEY_TYPE_CONSTANTID)
return dp; /* no need to forward... */
dp = forward_to_key(data, *kp, keyp, dp);
return get_data(data, key, &dp, 0);
}
+Id
+repodata_lookup_type(Repodata *data, Id solvid, Id keyname)
+{
+ Id schema, *keyp, *kp;
+ if (!maybe_load_repodata(data, keyname))
+ return 0;
+ if (!solvid2data(data, solvid, &schema))
+ return 0;
+ keyp = data->schemadata + data->schemata[schema];
+ for (kp = keyp; *kp; kp++)
+ if (data->keys[*kp].name == keyname)
+ return data->keys[*kp].type == REPOKEY_TYPE_DELETED ? 0 : data->keys[*kp].type;
+ return 0;
+}
Id
repodata_lookup_id(Repodata *data, Id solvid, Id keyname)
return id;
}
-Id
-repodata_globalize_id(Repodata *data, Id id, int create)
-{
- if (!id || !data || !data->localpool)
- return id;
- return str2id(data->repo->pool, stringpool_id2str(&data->spool, id), create);
-}
-
const char *
repodata_lookup_str(Repodata *data, Id solvid, Id keyname)
{
return 1;
}
+Id
+repodata_globalize_id(Repodata *data, Id id, int create)
+{
+ if (!id || !data || !data->localpool)
+ return id;
+ return str2id(data->repo->pool, stringpool_id2str(&data->spool, id), create);
+}
+
+
/************************************************************************
* data search
*/
key = data->keys + keyid;
ddp = get_data(data, key, &dp, *keyp ? 1 : 0);
+ if (key->type == REPOKEY_TYPE_DELETED)
+ continue;
if (key->type == REPOKEY_TYPE_FLEXARRAY || key->type == REPOKEY_TYPE_FIXARRAY)
{
struct subschema_data subd;
di->ddp = get_data(di->data, di->key, &di->dp, di->keyp[1] && (!di->keyname || (di->flags & SEARCH_SUB) != 0) ? 1 : 0);
if (!di->ddp)
goto di_nextkey;
+ if (di->key->type == REPOKEY_TYPE_DELETED)
+ goto di_nextkey;
if (di->key->type == REPOKEY_TYPE_FIXARRAY || di->key->type == REPOKEY_TYPE_FLEXARRAY)
goto di_enterarray;
if (di->nkeynames && di->nparents - di->rootlevel < di->nkeynames)
*pp = 0;
}
-/* add all attrs from src to dest */
+/* XXX: does not work correctly, needs fix in iterators! */
+void
+repodata_delete(Repodata *data, Id solvid, Id keyname)
+{
+ Repokey key;
+ key.name = keyname;
+ key.type = REPOKEY_TYPE_DELETED;
+ key.size = 0;
+ key.storage = KEY_STORAGE_INCORE;
+ repodata_set(data, solvid, &key, 0);
+}
+
+/* add all (uninternalized) attrs from src to dest */
void
repodata_merge_attrs(Repodata *data, Id dest, Id src)
{
repodata_insert_keyid(data, dest, keyp[0], keyp[1], 0);
}
+/* add some (uninternalized) attrs from src to dest */
void
repodata_merge_some_attrs(Repodata *data, Id dest, Id src, Map *keyidmap, int overwrite)
{
repodata_key2id(sdata, &xkey, 1);
xkeyname = 0;
}
+ default:
+ break;
}
}
dataiterator_free(&di);
/* lookup functions */
+Id repodata_lookup_type(Repodata *data, Id solvid, Id keyname);
Id repodata_lookup_id(Repodata *data, Id solvid, Id keyname);
const char *repodata_lookup_str(Repodata *data, Id solvid, Id keyname);
int repodata_lookup_num(Repodata *data, Id solvid, Id keyname, unsigned int *value);
void repodata_add_fixarray(Repodata *data, Id solvid, Id keyname, Id ghandle);
void repodata_add_flexarray(Repodata *data, Id solvid, Id keyname, Id ghandle);
+void repodata_delete(Repodata *data, Id solvid, Id keyname);
void repodata_delete_uninternalized(Repodata *data, Id solvid, Id keyname);
/*