Only create the first instance of a file shared between packages
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 17 Aug 2012 11:07:05 +0000 (14:07 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 17 Aug 2012 11:07:05 +0000 (14:07 +0300)
- When packages share an identical file, we only need to create the
  first one we encounter and skip it for the rest (reverse already
  happens, and must happen, on erase). This has the benefit of
  getting the timestamp to match the first file, which often is
  also the last one to get removed. Also when lots of shared files
  are involved (such as in multilib installations), this can give
  several percents worth of speed gain as we dont unnecessarily rewrite
  the same contents over and over.

lib/transaction.c

index 9a7e4a2..74ecc49 100644 (file)
@@ -500,6 +500,12 @@ assert(otherFi != NULL);
                                    rpmteNEVRA(otherTe), fn, 0);
                    free(fn);
                }
+           } else {
+               /* Skip create on all but the first instance of a shared file */
+               if (rpmfsGetAction(otherFs, otherFileNum) != FA_UNKNOWN) {
+                   rpmfsSetAction(fs, i, FA_SKIP);
+                   done = 1;
+               }
            }
 
            /* Try to get the disk accounting correct even if a conflict. */