diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-05-13 18:30:55 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-05-13 18:30:55 -0700 |
commit | 6133891d39f8fc5d1aa1650fd3c5ad2b2321c93b (patch) | |
tree | 546f61ea58e40b0d158ec8656739973e1b545105 | |
parent | e9702f17c6ac1f185cf58b45d7bba1b2df51a8b7 (diff) | |
download | portage-6133891d39f8fc5d1aa1650fd3c5ad2b2321c93b.tar.gz portage-6133891d39f8fc5d1aa1650fd3c5ad2b2321c93b.tar.bz2 portage-6133891d39f8fc5d1aa1650fd3c5ad2b2321c93b.zip |
Don't use finally with atomic_ofstream since that prevents it from
aborting when appropriate.
-rw-r--r-- | pym/portage/dbapi/bintree.py | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 0f7d56810..cc53d45a5 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -10,7 +10,8 @@ portage.proxy.lazyimport.lazyimport(globals(), 'portage.output:EOutput,colorize', 'portage.package.ebuild.doebuild:_vdb_use_conditional_atoms', 'portage.update:update_dbentries', - 'portage.util:ensure_dirs,normalize_path,writemsg,writemsg_stdout', + 'portage.util:atomic_ofstream,ensure_dirs,normalize_path,' + \ + 'writemsg,writemsg_stdout', 'portage.util.listdir:listdir', 'portage.versions:best,catpkgsplit,catsplit', ) @@ -696,12 +697,9 @@ class binarytree(object): del pkgindex.packages[:] pkgindex.packages.extend(iter(metadata.values())) self._update_pkgindex_header(pkgindex.header) - from portage.util import atomic_ofstream f = atomic_ofstream(self._pkgindex_file) - try: - pkgindex.write(f) - finally: - f.close() + pkgindex.write(f) + f.close() if getbinpkgs and not self.settings["PORTAGE_BINHOST"]: writemsg(_("!!! PORTAGE_BINHOST unset, but use is requested.\n"), @@ -768,7 +766,6 @@ class binarytree(object): pkgindex = None if pkgindex is rmt_idx: pkgindex.modified = False # don't update the header - from portage.util import atomic_ofstream, ensure_dirs try: ensure_dirs(os.path.dirname(pkgindex_file)) f = atomic_ofstream(pkgindex_file) @@ -981,12 +978,9 @@ class binarytree(object): pkgindex.packages.append(d) self._update_pkgindex_header(pkgindex.header) - from portage.util import atomic_ofstream f = atomic_ofstream(os.path.join(self.pkgdir, "Packages")) - try: - pkgindex.write(f) - finally: - f.close() + pkgindex.write(f) + f.close() finally: if pkgindex_lock: unlockfile(pkgindex_lock) |