diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-05-23 00:55:58 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-05-23 00:55:58 +0000 |
commit | 9ec3cb8abadd77bdb8c645c92852e681e46a3196 (patch) | |
tree | a61c05fc9cfd5f82cf796596c47f307705d82924 | |
parent | bdcc125b3a103ce8a8b98099a14e218d79b4a0e0 (diff) | |
download | portage-9ec3cb8abadd77bdb8c645c92852e681e46a3196.tar.gz portage-9ec3cb8abadd77bdb8c645c92852e681e46a3196.tar.bz2 portage-9ec3cb8abadd77bdb8c645c92852e681e46a3196.zip |
Save memory by not holding a reference to the PackageIndex when it's not being used.
svn path=/main/trunk/; revision=6590
-rw-r--r-- | pym/portage/dbapi/bintree.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 83c9fecfd..dda35ce65 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -116,7 +116,6 @@ class binarytree(object): self._all_directory = os.path.isdir( os.path.join(self.pkgdir, "All")) self._pkgindex_file = os.path.join(self.pkgdir, "Packages") - self._pkgindex = None self._pkgindex_keys = set(["CPV", "SLOT", "MTIME", "SIZE"]) def move_ent(self, mylist): @@ -386,16 +385,16 @@ class binarytree(object): dirs.remove("All") dirs.sort() dirs.insert(0, "All") - self._pkgindex = portage.getbinpkg.PackageIndex() - header = self._pkgindex.header - metadata = self._pkgindex.packages + pkgindex = portage.getbinpkg.PackageIndex() + header = pkgindex.header + metadata = pkgindex.packages try: f = open(self._pkgindex_file) except EnvironmentError: pass else: try: - self._pkgindex.read(f) + pkgindex.read(f) finally: f.close() del f @@ -504,7 +503,7 @@ class binarytree(object): from portage.util import atomic_ofstream f = atomic_ofstream(self._pkgindex_file) try: - self._pkgindex.write(f) + pkgindex.write(f) finally: f.close() @@ -599,14 +598,14 @@ class binarytree(object): try: pkgindex_lock = lockfile(self._pkgindex_file, wantnewlockfile=1) - self._pkgindex = portage.getbinpkg.PackageIndex() + pkgindex = portage.getbinpkg.PackageIndex() try: f = open(self._pkgindex_file) except EnvironmentError: pass else: try: - self._pkgindex.read(f) + pkgindex.read(f) finally: f.close() del f @@ -616,11 +615,11 @@ class binarytree(object): d["MTIME"] = str(long(s.st_mtime)) d["SIZE"] = str(s.st_size) d["MD5"] = str(md5) - self._pkgindex.packages[cpv] = d + pkgindex.packages[cpv] = d from portage.util import atomic_ofstream f = atomic_ofstream(os.path.join(self.pkgdir, "Packages")) try: - self._pkgindex.write(f) + pkgindex.write(f) finally: f.close() finally: |