]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
- rename pool_addfileprovides_ids to pool_addfileprovides_queue, make it fill a queue
authorMichael Schroeder <mls@suse.de>
Wed, 1 Feb 2012 15:52:35 +0000 (16:52 +0100)
committerMichael Schroeder <mls@suse.de>
Wed, 1 Feb 2012 15:52:35 +0000 (16:52 +0100)
bindings/solv.i
examples/p5solv
examples/pysolv
examples/rbsolv
examples/solv.c
src/libsolv.ver
src/pool.c
src/pool.h
tools/common_write.c

index ba926facdf49cd66f286d6d561f3cc6c9263dd91..a1d9d5b805a7e3529819c9a1d629e106012c73e2 100644 (file)
@@ -946,15 +946,10 @@ typedef struct {
   void addfileprovides() {
     pool_addfileprovides($self);
   }
-  Queue addfileprovides_ids() {
+  Queue addfileprovides_queue() {
     Queue r;
-    Id *addedfileprovides = 0;
     queue_init(&r);
-    pool_addfileprovides_ids($self, $self->installed, &addedfileprovides);
-    if (addedfileprovides) {
-      for (; *addedfileprovides; addedfileprovides++)
-        queue_push(&r, *addedfileprovides);
-    }
+    pool_addfileprovides_queue($self, &r);
     return r;
   }
   void createwhatprovides() {
index fd9915a91dfe45e040b4b9622bf182e9379bf4d0..f864997e7071ca4b402938856d09ea05b01d06ef 100755 (executable)
@@ -694,7 +694,7 @@ if ($cmd eq 'search') {
   exit(0);
 }
 
-my @addedprovides =  $pool->addfileprovides_ids();
+my @addedprovides = $pool->addfileprovides_queue();
 $pool->createwhatprovides();
 
 my @jobs;
index 5c7954af8a9b273acbb9b0a2bd6e4ec0872c9ae8..8dea8eaded988708ad4c5feb41da5f2eece8eb87 100755 (executable)
@@ -778,7 +778,7 @@ if cmd == 'list' or cmd == 'info' or cmd == 'install':
     if cmdlinerepo:
         cmdlinerepo.handle.internalize()
 
-addedprovides = pool.addfileprovides_ids()
+addedprovides = pool.addfileprovides_queue()
 if addedprovides:
     sysrepo.updateaddedprovides(addedprovides)
     for repo in repos:
index 00e8f050b2bbc707c0574df9c0a941a742e47cac..52853cf9bbb838fc6cc4b885db87f4a42d3b4307 100755 (executable)
@@ -687,7 +687,7 @@ if cmd == 'search'
   exit
 end
 
-addedprovides = pool.addfileprovides_ids()
+addedprovides = pool.addfileprovides_queue()
 if !addedprovides.empty?
   sysrepo.updateaddedprovides(addedprovides)
   for repo in repos
index 09a922138247594cd129d01934fce4af6c1f3fd2..9c87f8afb5b14033117f9c47ce03da15161cb688 100644 (file)
@@ -2481,20 +2481,19 @@ addsoftlocks(Pool *pool, Queue *job)
 
 
 void
-rewrite_repos(Pool *pool, Id *addedfileprovides)
+rewrite_repos(Pool *pool, Queue *addedfileprovides)
 {
   Repo *repo;
   Repodata *data;
   Map providedids;
   Queue fileprovidesq;
-  Id id;
-  int i, j, n, nprovidedids;
+  int i, j, n;
   struct repoinfo *cinfo;
 
   map_init(&providedids, pool->ss.nstrings);
   queue_init(&fileprovidesq);
-  for (nprovidedids = 0; (id = addedfileprovides[nprovidedids]) != 0; nprovidedids++)
-    MAPSET(&providedids, id);
+  for (i = 0; i < addedfileprovides->count; i++)
+    MAPSET(&providedids, addedfileprovides->elements[i]);
   FOR_REPOS(i, repo)
     {
       /* make sure this repo has just one main repodata */
@@ -2510,12 +2509,10 @@ rewrite_repos(Pool *pool, Id *addedfileprovides)
          for (j = 0; j < fileprovidesq.count; j++)
            if (MAPTST(&providedids, fileprovidesq.elements[j]))
              n++;
-         if (n == nprovidedids)
+         if (n == addedfileprovides->count)
            continue;   /* nothing new added */
        }
-      /* oh my! */
-      for (j = 0; addedfileprovides[j]; j++)
-       repodata_add_idarray(data, SOLVID_META, REPOSITORY_ADDEDFILEPROVIDES, addedfileprovides[j]);
+      repodata_set_idarray(data, SOLVID_META, REPOSITORY_ADDEDFILEPROVIDES, addedfileprovides);
       repodata_internalize(data);
       writecachedrepo(repo, data, 0, cinfo ? cinfo->cookie : installedcookie);
     }
@@ -2622,7 +2619,7 @@ main(int argc, char **argv)
   char inbuf[128], *ip;
   int allpkgs = 0;
   FILE **newpkgsfps;
-  Id *addedfileprovides = 0;
+  Queue addedfileprovides;
   Id repofilter = 0;
   int cleandeps = 0;
 
@@ -2836,11 +2833,11 @@ main(int argc, char **argv)
 
   // FOR_REPOS(i, repo)
   //   printf("%s: %d solvables\n", repo->name, repo->nsolvables);
-  addedfileprovides = 0;
-  pool_addfileprovides_ids(pool, pool->installed, &addedfileprovides);
-  if (addedfileprovides && *addedfileprovides)
-    rewrite_repos(pool, addedfileprovides);
-  solv_free(addedfileprovides);
+  queue_init(&addedfileprovides);
+  pool_addfileprovides_queue(pool, &addedfileprovides);
+  if (addedfileprovides.count)
+    rewrite_repos(pool, &addedfileprovides);
+  queue_free(&addedfileprovides);
   pool_createwhatprovides(pool);
 
   queue_init(&job);
index 57c6507dc37e9b59d559b65b800523f13fd49e91..4da45b269f5a060ab5494b38d03fdc3ebbf91496 100644 (file)
@@ -38,7 +38,7 @@ SOLV_1.0 {
                policy_is_illegal;
                pool_add_fileconflicts_deps;
                pool_addfileprovides;
-               pool_addfileprovides_ids;
+               pool_addfileprovides_queue;
                pool_addrelproviders;
                pool_alloctmpspace;
                pool_arch2color_slow;
index a3379147b9bfde215f48fb801522b0675cd62ef0..87240115848f5f46fbcbf67c2cea7fcc1d26f6c8 100644 (file)
@@ -1086,21 +1086,24 @@ pool_addfileprovides_search(Pool *pool, struct addfileprovides_cbdata *cbd, stru
 }
 
 void
-pool_addfileprovides_ids(Pool *pool, Repo *installed, Id **idp)
+pool_addfileprovides_queue(Pool *pool, Queue *idq)
 {
   Solvable *s;
-  Repo *repo;
+  Repo *installed, *repo;
   struct searchfiles sf, isf, *isfp;
   struct addfileprovides_cbdata cbd;
   int i;
   unsigned int now;
 
+  installed = pool->installed;
   now = solv_timems(0);
   memset(&sf, 0, sizeof(sf));
   map_init(&sf.seen, pool->ss.nstrings + pool->nrels);
   memset(&isf, 0, sizeof(isf));
   map_init(&isf.seen, pool->ss.nstrings + pool->nrels);
 
+  if (idq)
+    queue_empty(idq);
   isfp = installed ? &isf : 0;
   for (i = 1, s = pool->solvables + i; i < pool->nsolvables; i++, s++)
     {
@@ -1126,8 +1129,6 @@ pool_addfileprovides_ids(Pool *pool, Repo *installed, Id **idp)
   map_free(&isf.seen);
   POOL_DEBUG(SOLV_DEBUG_STATS, "found %d file dependencies, %d installed file dependencies\n", sf.nfiles, isf.nfiles);
   cbd.dids = 0;
-  if (idp)
-    *idp = 0;
   if (sf.nfiles)
     {
 #if 0
@@ -1135,13 +1136,9 @@ pool_addfileprovides_ids(Pool *pool, Repo *installed, Id **idp)
        POOL_DEBUG(SOLV_DEBUG_STATS, "looking up %s in filelist\n", pool_id2str(pool, sf.ids[i]));
 #endif
       pool_addfileprovides_search(pool, &cbd, &sf, 0);
-      if (idp)
-       {
-         sf.ids = solv_extend(sf.ids, sf.nfiles, 1, sizeof(Id), SEARCHFILES_BLOCK);
-         sf.ids[sf.nfiles] = 0;
-         *idp = sf.ids;
-         sf.ids = 0;
-       }
+      if (idq)
+        for (i = 0; i < sf.nfiles; i++)
+         queue_push(idq, sf.ids[i]);
       solv_free(sf.ids);
       for (i = 0; i < sf.nfiles; i++)
        {
@@ -1176,7 +1173,7 @@ pool_addfileprovides_ids(Pool *pool, Repo *installed, Id **idp)
 void
 pool_addfileprovides(Pool *pool)
 {
-  pool_addfileprovides_ids(pool, pool->installed, 0);
+  pool_addfileprovides_queue(pool, 0);
 }
 
 void
index 8b9997a1c24b8862e00cfc949bd169b511874e9e..4c1245d207e8eba8dd3e8bfe1d4089b854d0dbcc 100644 (file)
@@ -250,7 +250,7 @@ static inline int pool_match_nevr(Pool *pool, Solvable *s, Id d)
  */
 extern void pool_createwhatprovides(Pool *pool);
 extern void pool_addfileprovides(Pool *pool);
-extern void pool_addfileprovides_ids(Pool *pool, struct _Repo *installed, Id **idp);
+extern void pool_addfileprovides_queue(Pool *pool, Queue *idq);
 extern void pool_freewhatprovides(Pool *pool);
 extern Id pool_queuetowhatprovides(Pool *pool, Queue *q);
 
index ba45e6f362a0df2c9fed55624b9cf60816bcb89b..608ae965ee938bb06dfe760eb4a426191a34f5bd 100644 (file)
@@ -200,20 +200,20 @@ tool_write(Repo *repo, const char *basename, const char *attrname)
   char **languages = 0;
   int nlanguages = 0;
   int i, j, k, l;
-  Id *addedfileprovides = 0;
   struct keyfilter_data kd;
+  Queue addedfileprovides;
 
   memset(&kd, 0, sizeof(kd));
   info = repo_add_repodata(repo, 0);
   repodata_set_str(info, SOLVID_META, REPOSITORY_TOOLVERSION, LIBSOLV_TOOLVERSION);
-  pool_addfileprovides_ids(repo->pool, 0, &addedfileprovides);
-  if (addedfileprovides && *addedfileprovides)
+  queue_init(&addedfileprovides);
+  pool_addfileprovides_queue(repo->pool, &addedfileprovides);
+  if (addedfileprovides.count)
     {
       kd.haveaddedfileprovides = 1;
-      for (i = 0; addedfileprovides[i]; i++)
-        repodata_add_idarray(info, SOLVID_META, REPOSITORY_ADDEDFILEPROVIDES, addedfileprovides[i]);
+      repodata_set_idarray(info, SOLVID_META, REPOSITORY_ADDEDFILEPROVIDES, &addedfileprovides);
     }
-  solv_free(addedfileprovides);
+  queue_free(&addedfileprovides);
 
   pool_freeidhashes(repo->pool);       /* free some mem */