Make rpmdb2solv reasonably fast again.
authorMichael Matz <matz@suse.de>
Fri, 7 Mar 2008 19:19:46 +0000 (19:19 +0000)
committerMichael Matz <matz@suse.de>
Fri, 7 Mar 2008 19:19:46 +0000 (19:19 +0000)
src/repo.c
src/repo.h
src/repodata.c
src/repodata.h
tools/rpmdb2solv.c

index f6b1e79..e147cfb 100644 (file)
@@ -920,6 +920,15 @@ repo_internalize(Repo *repo)
       repodata_internalize(data);
 }
 
+void
+repo_disable_paging(Repo *repo)
+{
+  int i;
+  Repodata *data;
+
+  for (i = 0, data = repo->repodata; i < repo->nrepodata; i++, data++)
+    repodata_disable_paging(data);
+}
 // EOF
 /*
 vim:cinoptions={.5s,g0,p5,t0,(0,^-0.5s,n-0.5s:tw=78:cindent:sw=4:
index fc78dd1..2661835 100644 (file)
@@ -201,5 +201,6 @@ 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);
 void repo_set_poolstr(Repo *repo, Id p, Id keyname, const char *str);
 void repo_internalize(Repo *repo);
+void repo_disable_paging(Repo *repo);
 
 #endif /* SATSOLVER_REPO_H */
index 214ec1d..53571c7 100644 (file)
@@ -1609,6 +1609,13 @@ repodata_read_or_setup_pages(Repodata *data, unsigned int pagesz, unsigned int b
     }
 }
 
+void
+repodata_disable_paging(Repodata *data)
+{
+  if (maybe_load_repodata(data, 0)
+      && data->num_pages)
+    load_page_range (data, 0, data->num_pages - 1);
+}
 /*
 vim:cinoptions={.5s,g0,p5,t0,(0,^-0.5s,n-0.5s:tw=78:cindent:sw=4:
 */
index 8bf79e6..a1c8bc9 100644 (file)
@@ -137,6 +137,7 @@ void repodata_add_dirstr(Repodata *data, Id entry, Id keyname, Id dir, const cha
 void repodata_merge_attrs (Repodata *data, Id dest, Id src);
 
 void repodata_internalize(Repodata *data);
+void repodata_disable_paging(Repodata *data);
 
 Id repodata_str2dir(Repodata *data, const char *dir, int create);
 
index e5a303a..f46b30f 100644 (file)
@@ -65,6 +65,7 @@ main(int argc, char **argv)
         }
       ref = repo_create(refpool, "ref");
       repo_add_solv(ref, fp);
+      repo_disable_paging(ref);
       fclose(fp);
     }