- add SOLVER_NOAUTOSET to disable automatic SET deduction
[platform/upstream/libsolv.git] / src / repodata.h
index e425482..feac731 100644 (file)
@@ -47,6 +47,8 @@ typedef struct _Repodata {
 #define REPODATA_STUB          1
 #define REPODATA_ERROR         2
 #define REPODATA_STORE         3
+#define REPODATA_LOADING       4
+
   int state;                   /* available, stub or error */
 
   void (*loadcallback)(struct _Repodata *);
@@ -113,7 +115,10 @@ typedef struct _Repodata {
 /*-----
  * management functions
  */
-void repodata_init(Repodata *data, struct _Repo *repo, int localpool);
+void repodata_initdata(Repodata *data, struct _Repo *repo, int localpool);
+void repodata_freedata(Repodata *data);
+
+Repodata *repodata_create(struct _Repo *repo, int localpool);
 void repodata_free(Repodata *data);
 
 
@@ -150,6 +155,19 @@ repodata_precheck_keyname(Repodata *data, Id keyname)
   return x && (x & (1 << (keyname & 7))) ? 1 : 0;
 }
 
+/* check if the repodata contains data for the specified keyname */
+static inline int
+repodata_has_keyname(Repodata *data, Id keyname)
+{
+  int i;
+  if (!repodata_precheck_keyname(data, keyname))
+    return 0;
+  for (i = 1; i < data->nkeys; i++)
+    if (data->keys[i].name == keyname)
+      return 1;
+  return 0;
+}
+
 /* search key <keyname> (all keys, if keyname == 0) for Id <solvid>
  * Call <callback> for each match */
 void repodata_search(Repodata *data, Id solvid, Id keyname, int flags, int (*callback)(void *cbdata, Solvable *s, Repodata *data, Repokey *key, struct _KeyValue *kv), void *cbdata);
@@ -158,6 +176,8 @@ void repodata_search(Repodata *data, Id solvid, Id keyname, int flags, int (*cal
  * if not possible */
 int repodata_stringify(Pool *pool, Repodata *data, Repokey *key, struct _KeyValue *kv, int flags);
 
+int repodata_filelistfilter_matches(Repodata *data, const char *str);
+
 
 /* lookup functions */
 Id repodata_lookup_id(Repodata *data, Id solvid, Id keyname);
@@ -165,7 +185,7 @@ const char *repodata_lookup_str(Repodata *data, Id solvid, Id keyname);
 int repodata_lookup_num(Repodata *data, Id solvid, Id keyname, unsigned int *value);
 int repodata_lookup_void(Repodata *data, Id solvid, Id keyname);
 const unsigned char *repodata_lookup_bin_checksum(Repodata *data, Id solvid, Id keyname, Id *typep);
-
+int repodata_lookup_idarray(Repodata *data, Id solvid, Id keyname, Queue *q);
 
 
 /*-----
@@ -178,6 +198,7 @@ const unsigned char *repodata_lookup_bin_checksum(Repodata *data, Id solvid, Id
  */
 void repodata_extend(Repodata *data, Id p);
 void repodata_extend_block(Repodata *data, Id p, int num);
+void repodata_shrink(Repodata *data, int end);
 
 /* internalize freshly set data, so that it is found by the search
  * functions and written out */
@@ -192,6 +213,7 @@ void repodata_set_void(Repodata *data, Id solvid, Id keyname);
 void repodata_set_num(Repodata *data, Id solvid, Id keyname, unsigned int num);
 void repodata_set_id(Repodata *data, Id solvid, Id keyname, Id id);
 void repodata_set_str(Repodata *data, Id solvid, Id keyname, const char *str);
+void repodata_set_binary(Repodata *data, Id solvid, Id keyname, void *buf, int len);
 /* create id from string, then set_id */
 void repodata_set_poolstr(Repodata *data, Id solvid, Id keyname, const char *str);
 
@@ -218,11 +240,17 @@ void repodata_add_poolstr_array(Repodata *data, Id solvid, Id keyname, const cha
 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_uninternalized(Repodata *data, Id solvid, Id keyname);
+
 /* 
  merge attributes from one solvable to another
  works only if the data is not yet internalized
 */
 void repodata_merge_attrs(Repodata *data, Id dest, Id src);
+void repodata_merge_some_attrs(Repodata *data, Id dest, Id src, Map *keyidmap, int overwrite);
+
+void repodata_create_stubs(Repodata *data);
+void repodata_join(Repodata *data, Id joinkey);
 
 /*
  * load all paged data, used to speed up copying in repo_rpmdb
@@ -230,7 +258,7 @@ void repodata_merge_attrs(Repodata *data, Id dest, Id src);
 void repodata_disable_paging(Repodata *data);
 
 /* helper functions */
-Id repodata_globalize_id(Repodata *data, Id id);
+Id repodata_globalize_id(Repodata *data, Id id, int create);
 Id repodata_str2dir(Repodata *data, const char *dir, int create);
 const char *repodata_dir2str(Repodata *data, Id did, const char *suf);
 const char *repodata_chk2str(Repodata *data, Id type, const unsigned char *buf);