Use existing fingerprint for packages being removed
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 5 Sep 2012 16:40:07 +0000 (19:40 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 5 Sep 2012 16:40:07 +0000 (19:40 +0300)
- Missed opportunity in commit 1a3a4089def9b00790eeebd6f931c99a03a3d44b:
  removed packages have already gotten fingerprinted so there's no need
  to redo that here.

lib/transaction.c

index 011e345..4965a73 100644 (file)
@@ -969,7 +969,7 @@ void checkInstalledFiles(rpmts ts, uint64_t fileCount, rpmFpHash ht, fingerPrint
     while (h != NULL) {
        headerGetFlags hgflags = HEADERGET_MINMEM;
        struct rpmtd_s bnames, dnames, dindexes, ostates;
-       fingerPrint fp;
+       fingerPrint fp, *fpp;
        unsigned int installedPkg;
        int beingRemoved = 0;
        rpmfi otherFi = NULL;
@@ -1001,6 +1001,7 @@ void checkInstalledFiles(rpmts ts, uint64_t fileCount, rpmFpHash ht, fingerPrint
            const char * dirName;
            const char * baseName;
 
+           /* lookup finger print for this file */
            fileNum = rpmdbGetIteratorFileNum(mi);
            if (!beingRemoved) {
                rpmtdSetIndex(&bnames, fileNum);
@@ -1010,21 +1011,21 @@ void checkInstalledFiles(rpmts ts, uint64_t fileCount, rpmFpHash ht, fingerPrint
 
                dirName = rpmtdGetString(&dnames);
                baseName = rpmtdGetString(&bnames);
-           } else {
-               dirName = rpmfiDNIndex(otherFi, rpmfiDIIndex(otherFi, fileNum));
-               baseName = rpmfiBNIndex(otherFi, fileNum);
-           }
 
-           /* lookup finger print for this file */
-           if ( dirName == oldDir) {
-               /* directory is the same as last round */
-               fp.baseName = baseName;
+               if (dirName == oldDir) {
+                   /* directory is the same as last round */
+                   fp.baseName = baseName;
+               } else {
+                   fp = fpLookup(fpc, dirName, baseName, 1);
+                   oldDir = dirName;
+               }
+               fpp = &fp;
            } else {
-               fp = fpLookup(fpc, dirName, baseName, 1);
-               oldDir = dirName;
+               fpp = rpmfiFpsIndex(otherFi, fileNum);
            }
+
            /* search for files in the transaction with same finger print */
-           gotRecs = rpmFpHashGetEntry(ht, &fp, &recs, &numRecs, NULL);
+           gotRecs = rpmFpHashGetEntry(ht, fpp, &recs, &numRecs, NULL);
 
            for (j=0; (j<numRecs)&&gotRecs; j++) {
                p = recs[j].p;