]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Add REPOSITORY_FILTEREDFILELIST id and filelist type
authorMichael Schroeder <mls@suse.de>
Mon, 10 Sep 2018 09:26:05 +0000 (11:26 +0200)
committerMichael Schroeder <mls@suse.de>
Mon, 10 Sep 2018 09:26:05 +0000 (11:26 +0200)
REPOSITORY_FILTEREDFILELIST is used to mark that the filelist
in the repodata is filtered with some filter.

The commit also adds a filelisttype element to the repodata
and sets it to filtered if REPOSITORY_FILTEREDFILELIST is set.
It also sets the filelisttype to extension if the repodata
has a filelist and was generated by extending solvables.

We'll use the filelisttype later to decide if we should use
the filtered filelist when searching for files.

ext/repo_rpmmd.c
ext/repo_susetags.c
src/knownid.h
src/libsolv.ver
src/repo_solv.c
src/repodata.c
src/repodata.h

index 6c05281d1cc335d845019e50129347b98ffb308c..d639856191477a5295b3e5333b110f13f31437fa 100644 (file)
@@ -1144,6 +1144,22 @@ repo_add_rpmmd(Repo *repo, FILE *fp, const char *language, int flags)
   repodata_free_dircache(data);
   queue_free(&pd.diskusageq);
 
+  if ((flags & REPO_EXTEND_SOLVABLES) != 0)
+    {
+      /* is this a filelist extension? */
+      if (repodata_has_keyname(data, SOLVABLE_FILELIST))
+       repodata_set_filelisttype(data, REPODATA_FILELIST_EXTENSION);
+    }
+  else
+    {
+      /* is this a primary with a filtered filelist? */
+      if (data->end > data->start)
+       {
+         repodata_set_filelisttype(data, REPODATA_FILELIST_FILTERED);
+         repodata_set_void(data, SOLVID_META, REPOSITORY_FILTEREDFILELIST);
+       }
+    }
+
   if (!(flags & REPO_NO_INTERNALIZE))
     repodata_internalize(data);
   POOL_DEBUG(SOLV_DEBUG_STATS, "repo_add_rpmmd took %d ms\n", solv_timems(now));
index 52d5e5e92f38343b8a8332d4f66882a39de555bd..6d03d231257e7e4cc28be7132349169bf0024d4a 100644 (file)
@@ -1062,6 +1062,23 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
 
   solv_free(joinhash);
   repodata_free_dircache(data);
+
+    if ((flags & REPO_EXTEND_SOLVABLES) != 0)
+    {    
+      /* is this a filelist extension? */
+      if (repodata_has_keyname(data, SOLVABLE_FILELIST))
+        repodata_set_filelisttype(data, REPODATA_FILELIST_EXTENSION);
+    }    
+  else 
+    {    
+      /* is this a primary with a filtered filelist? */
+      if (data->end > data->start)
+       {
+          repodata_set_filelisttype(data, REPODATA_FILELIST_FILTERED);
+         repodata_set_void(data, SOLVID_META, REPOSITORY_FILTEREDFILELIST);
+       }
+    }  
+
   if (!(flags & REPO_NO_INTERNALIZE))
     repodata_internalize(data);
 
index 64cc6fc00413cb1ee585ff0e3e582da34711bcc5..cacdaaa490d5b9a977037ffdf773f543e5e4b8f5 100644 (file)
@@ -261,6 +261,7 @@ KNOWNID(PRODUCT_REGISTER_FLAVOR,    "product:regflavor"),           /* installed and availab
 KNOWNID(SOLVABLE_INSTALLSTATUS,                "solvable:installstatus"),      /* debian install status */
 
 KNOWNID(SOLVABLE_PREREQ_IGNOREINST,    "solvable:prereq_ignoreinst"),  /* ignore these pre-requires for installed packages */
+KNOWNID(REPOSITORY_FILTEREDFILELIST,   "repository:filteredfilelist"), /* filelist in repository is filtered */
 
 KNOWNID(ID_NUM_INTERNAL,               0)
 
index 5c7c02fd476accef4dbfa15d82027b62f23d8b97..f023c8c9b9f3b9192c39e8f8af5ea2d59b5c6017 100644 (file)
@@ -224,6 +224,7 @@ SOLV_1.0 {
                repodata_set_constant;
                repodata_set_constantid;
                repodata_set_deltalocation;
+               repodata_set_filelisttype;
                repodata_set_id;
                repodata_set_idarray;
                repodata_set_location;
index 0cbd073a3fe866734c3a22642860b7580c8fd76d..d56b4e77ccf70f0cae40637ca0a946bb994e9bbd 100644 (file)
@@ -1327,6 +1327,17 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key
       repo->repodata[repo->nrepodata++] = data;
     }
 
+  if ((flags & REPO_EXTEND_SOLVABLES) != 0)
+    {
+      if (repodata_has_keyname(&data, SOLVABLE_FILELIST))
+       repodata_set_filelisttype(repo->repodata + data.repodataid, REPODATA_FILELIST_EXTENSION);
+    }
+  else
+    {
+      if (repodata_lookup_type(&data, SOLVID_META, REPOSITORY_FILTEREDFILELIST))
+        repodata_set_filelisttype(repo->repodata + data.repodataid, REPODATA_FILELIST_FILTERED);
+    }
+
   /* create stub repodata entries for all external */
   if (!(flags & SOLV_ADD_NO_STUBS) && !parent)
     {
@@ -1334,7 +1345,7 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key
        if (data.keys[key].name == REPOSITORY_EXTERNAL && data.keys[key].type == REPOKEY_TYPE_FLEXARRAY)
          break;
       if (key < data.nkeys)
-       repodata_create_stubs(repo->repodata + (repo->nrepodata - 1));
+       repodata_create_stubs(repo->repodata + data.repodataid);
     }
 
   POOL_DEBUG(SOLV_DEBUG_STATS, "repo_add_solv took %d ms\n", solv_timems(now));
index 8663925272564d10e425182e72bfa5ffb9416ee6..24e3f5a418ddedf1afcb4c22b266f40cca9162e2 100644 (file)
@@ -3570,6 +3570,7 @@ repodata_disable_paging(Repodata *data)
     }
 }
 
+/* call the pool's loadcallback to load a stub repodata */
 static void
 repodata_stub_loader(Repodata *data)
 {
@@ -3642,6 +3643,7 @@ repodata_create_stubs(Repodata *data)
   Dataiterator di;
   Id xkeyname = 0;
   int i, cnt = 0;
+  int filelisttype = data->filelisttype;
 
   dataiterator_init(&di, pool, repo, SOLVID_META, REPOSITORY_EXTERNAL, 0, 0);
   while (dataiterator_step(&di))
@@ -3681,6 +3683,8 @@ repodata_create_stubs(Repodata *data)
          else
            {
              repodata_add_stubkey(sdata, xkeyname, di.kv.id);
+             if (xkeyname == SOLVABLE_FILELIST && filelisttype == REPODATA_FILELIST_FILTERED)
+               repodata_set_filelisttype(sdata, REPODATA_FILELIST_EXTENSION);
              xkeyname = 0;
            }
        }
@@ -3692,6 +3696,12 @@ repodata_create_stubs(Repodata *data)
   return data;
 }
 
+void
+repodata_set_filelisttype(Repodata *data, int type)
+{
+  data->filelisttype = type;
+}
+
 unsigned int
 repodata_memused(Repodata *data)
 {
index 2e02f66d6bc991d76a1fdefd2abd8a23d206a2d6..f377a31f3be345febc904f5a16709284cb5b37f3 100644 (file)
@@ -53,16 +53,23 @@ typedef struct _Repokey {
 struct dircache;
 #endif
 
-typedef struct _Repodata {
-  Id repodataid;               /* our id */
-  struct _Repo *repo;          /* back pointer to repo */
-
+/* repodata states */
 #define REPODATA_AVAILABLE     0
 #define REPODATA_STUB          1
 #define REPODATA_ERROR         2
 #define REPODATA_STORE         3
 #define REPODATA_LOADING       4
 
+/* repodata filelist types */
+/* note that FILELIST_FILTERED means that the data contains a filtered
+ * filelist *AND* that it is authoritative for all included solvables. */
+#define REPODATA_FILELIST_FILTERED     1
+#define REPODATA_FILELIST_EXTENSION    2
+
+typedef struct _Repodata {
+  Id repodataid;               /* our id */
+  struct _Repo *repo;          /* back pointer to repo */
+
   int state;                   /* available, stub or error */
 
   void (*loadcallback)(struct _Repodata *);
@@ -87,6 +94,8 @@ typedef struct _Repodata {
   FILE *fp;                    /* file pointer of solv file */
   int error;                   /* corrupt solv file */
 
+  int filelisttype;            /* type of filelist */
+
   unsigned int schemadatalen;   /* schema storage size */
   Id *schematahash;            /* unification helper */
 
@@ -203,9 +212,10 @@ void repodata_search(Repodata *data, Id solvid, Id keyname, int flags, int (*cal
  * if valid, NULL if not possible */
 const char *repodata_stringify(Pool *pool, Repodata *data, Repokey *key, struct _KeyValue *kv, int flags);
 
+/* filelist filter support */
+void repodata_set_filelisttype(Repodata *data, int filelisttype);
 int repodata_filelistfilter_matches(Repodata *data, const char *str);
 
-
 /* lookup functions */
 Id repodata_lookup_type(Repodata *data, Id solvid, Id keyname);
 Id repodata_lookup_id(Repodata *data, Id solvid, Id keyname);