]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
- handle the poolusage=3, dirpoolusage=2 case a bit better
authorMichael Schroeder <mls@suse.de>
Fri, 7 Mar 2008 14:31:43 +0000 (14:31 +0000)
committerMichael Schroeder <mls@suse.de>
Fri, 7 Mar 2008 14:31:43 +0000 (14:31 +0000)
tools/repo_write.c

index 64bc59b87494fc00acb1dfe99bed3eb7dadbfb6f..ef0ae63eb6868b46161e1ae4c9d6af144109502f 100644 (file)
@@ -845,7 +845,7 @@ repo_write(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void
   int poolusage, dirpoolusage, idused, dirused;
   int reloff;
 
-  Repodata *data;
+  Repodata *data, *dirpooldata = 0;
   Stringpool ownspool, *spool;
   Dirpool owndirpool, *dirpool;
 
@@ -1051,6 +1051,7 @@ repo_write(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void
            {
              dirpoolusage = 2;
              dirpool = &data->dirpool;
+             dirpooldata = data;
            }
        }
     }
@@ -1071,8 +1072,6 @@ repo_write(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void
       else
        stringpool_init_empty(spool);
       cbdata.ownspool = spool;
-      if (dirpoolusage)
-        dirpoolusage = 3;      /* hmm, maybe not needed */
     }
   else if (poolusage == 0 || poolusage == 1)
     {
@@ -1082,6 +1081,7 @@ repo_write(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void
   if (dirpoolusage == 3)
     {
       dirpool = &owndirpool;
+      dirpooldata = 0;
       dirpool_create(dirpool);
       cbdata.owndirpool = dirpool;
     }
@@ -1215,8 +1215,6 @@ for (i = 1; i < cbdata.nmykeys; i++)
       n++;
     }
 
-  reloff = needid[0].map;
-
   /* If we have fileinfos to write, setup schemas and increment needid[]
      of the right strings.  */
   for (i = 0; i < nsubfiles; i++)
@@ -1320,10 +1318,18 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1);
            continue;
          if (cbdata.dirused && !cbdata.dirused[i])
            continue;
+         if (cbdata.ownspool && dirpooldata && id > 1)
+           {
+             id = putinownpool(&cbdata, dirpooldata->localpool ? &dirpooldata->spool : &pool->ss, id);
+             needid = cbdata.needid;
+           }
          needid[id].need++;
        }
     }
 
+  reloff = needid[0].map;
+
+
 /********************************************************************/
 
   /*
@@ -1397,7 +1403,10 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1);
          if (dirmap[i] <= 0)
            continue;
          cbdata.dirused[dirmap[i]] = i;
-         dirmap[i] = needid[dirpool->dirs[dirmap[i]]].need;
+         id = dirpool->dirs[dirmap[i]];
+         if (cbdata.ownspool && dirpooldata && id > 1)
+           id = putinownpool(&cbdata, dirpooldata->localpool ? &dirpooldata->spool : &pool->ss, id);
+         dirmap[i] = needid[id].need;
        }
     }