Use file info set of removed packages instead of new temporary one
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 30 Aug 2012 06:45:49 +0000 (09:45 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 30 Aug 2012 06:51:39 +0000 (09:51 +0300)
- When we get rpmdb hits on files from packages that are to be removed
  in the same transaction, we can use the exisiting file info set
  to avoid constructing a new temporary one. Might be measurable
  in large updates.

lib/transaction.c

index ab777e2..36fc228 100644 (file)
@@ -937,7 +937,6 @@ void checkInstalledFiles(rpmts ts, uint64_t fileCount, rpmFpHash ht, fingerPrint
     rpmte p;
     rpmfi fi;
     rpmfs fs;
-    rpmfi otherFi=NULL;
     int j;
     unsigned int fileNum;
     const char * oldDir;
@@ -945,8 +944,6 @@ void checkInstalledFiles(rpmts ts, uint64_t fileCount, rpmFpHash ht, fingerPrint
     rpmdbMatchIterator mi;
     Header h, newheader;
 
-    int beingRemoved;
-
     rpmlog(RPMLOG_DEBUG, "computing file dispositions\n");
 
     mi = rpmFindBaseNamesInDB(ts, fileCount);
@@ -967,10 +964,17 @@ void checkInstalledFiles(rpmts ts, uint64_t fileCount, rpmFpHash ht, fingerPrint
        struct rpmtd_s bnames, dnames, dindexes, ostates;
        fingerPrint fp;
        unsigned int installedPkg;
+       int beingRemoved = 0;
+       rpmfi otherFi = NULL;
+       rpmte *removedPkg = NULL;
 
        /* Is this package being removed? */
        installedPkg = rpmdbGetIteratorOffset(mi);
-       beingRemoved = removedHashHasEntry(tsmem->removedPackages, installedPkg);
+       if (removedHashGetEntry(tsmem->removedPackages, installedPkg,
+                               &removedPkg, NULL, NULL)) {
+           beingRemoved = 1;
+           otherFi = rpmfiLink(rpmteFI(removedPkg[0]));
+       }
 
        h = headerLink(h);
        headerGet(h, RPMTAG_BASENAMES, &bnames, hgflags);