[yum-commits] Branch 'yum-3_2_X' - yum/depsolve.py

Panu Matilainen pmatilai at osuosl.org
Thu Feb 17 15:03:43 UTC 2011


 yum/depsolve.py |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 3302369486dc07edc2428c616ed2b8843562f615
Author: Panu Matilainen <pmatilai at laiskiainen.org>
Date:   Thu Feb 17 08:56:58 2011 +0200

    Don't keep full headers in memory during transaction
    
    The open/close file callbacks only need NEVRA information in the "key".
    Copy the necessary bits into a regular dict and pass that instead
    of the entire header, the callback wont even know the difference
    as the header behaves like a dict.
    Saves (tens of) megabytes of memory on large transactions.

diff --git a/yum/depsolve.py b/yum/depsolve.py
index 3aaba0e..997c66d 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -220,8 +220,12 @@ class Depsolve(object):
                         txmbr.ts_state = 'i'
                         txmbr.output_state = TS_INSTALL
 
+                # grab essential data for callback use in hdr-like form
+                minhdr = {}
+                for item in ['epoch', 'name', 'version', 'release', 'arch']:
+                    minhdr[item] = hdr[item]
                 
-                self.ts.addInstall(hdr, (hdr, rpmfile), txmbr.ts_state)
+                self.ts.addInstall(hdr, (minhdr, rpmfile), txmbr.ts_state)
                 self.verbose_logger.log(logginglevels.DEBUG_1,
                     _('Adding Package %s in mode %s'), txmbr.po, txmbr.ts_state)
                 if self.dsCallback:


More information about the Yum-commits mailing list