teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.9.x-tstest-fileinfo.patch

Panu Matilainen d06308
commit 7d88d5e54a9c3fa2b7fb443921c8adb799051784
Panu Matilainen d06308
Author: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen d06308
Date:   Wed Feb 1 17:48:20 2012 +0200
Panu Matilainen d06308
Panu Matilainen d06308
    Don't free up file info sets on transaction test-runs
Panu Matilainen d06308
    
Panu Matilainen d06308
    - We'd like to get rid of the potentially huge amounts of memory
Panu Matilainen d06308
      eaten by file info sets as early as possible, but when there's a
Panu Matilainen d06308
      chance that we'll get called again with either added transacation
Panu Matilainen d06308
      elements or on-disk changes, such as %pretrans changing something
Panu Matilainen d06308
      underneath us, we need to (be able to) recalculate everything
Panu Matilainen d06308
      from scratch. Only free up the memory when we know we dont need
Panu Matilainen d06308
      it anymore, ie on an actual transaction run.
Panu Matilainen d06308
    - This doesn't change anything for rpm itself, for yum and others
Panu Matilainen d06308
      which do a separate test-transaction first, it means %pretrans
Panu Matilainen d06308
      directory<->symlink replacement hacks and the like have a chance
Panu Matilainen d06308
      of working again. I'm sure there's a bug filed on this somewhere but...
Panu Matilainen d06308
    (cherry picked from commit cef18c94807af0935b7796c462aab8ed39f0f376)
Panu Matilainen d06308
Panu Matilainen d06308
diff --git a/lib/transaction.c b/lib/transaction.c
Panu Matilainen d06308
index 56ebc17..8d29ab9 100644
Panu Matilainen d06308
--- a/lib/transaction.c
Panu Matilainen d06308
+++ b/lib/transaction.c
Panu Matilainen d06308
@@ -1355,12 +1355,14 @@ static int rpmtsPrepare(rpmts ts)
Panu Matilainen d06308
     if (rpmChrootOut())
Panu Matilainen d06308
 	rc = -1;
Panu Matilainen d06308
 
Panu Matilainen d06308
-    /* File info sets, fp caches etc not needed beyond here, free 'em up. */
Panu Matilainen d06308
-    pi = rpmtsiInit(ts);
Panu Matilainen d06308
-    while ((p = rpmtsiNext(pi, 0)) != NULL) {
Panu Matilainen d06308
-	rpmteSetFI(p, NULL);
Panu Matilainen d06308
+    /* On actual transaction, file info sets are not needed after this */
Panu Matilainen d06308
+    if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_TEST|RPMTRANS_FLAG_BUILD_PROBS))) {
Panu Matilainen d06308
+	pi = rpmtsiInit(ts);
Panu Matilainen d06308
+	while ((p = rpmtsiNext(pi, 0)) != NULL) {
Panu Matilainen d06308
+	    rpmteSetFI(p, NULL);
Panu Matilainen d06308
+	}
Panu Matilainen d06308
+	rpmtsiFree(pi);
Panu Matilainen d06308
     }
Panu Matilainen d06308
-    pi = rpmtsiFree(pi);
Panu Matilainen d06308
 
Panu Matilainen d06308
 exit:
Panu Matilainen d06308
     ht = rpmFpHashFree(ht);