diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-05-08 10:33:30 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-05-08 10:33:30 +0000 |
commit | c68ebc6b6f93d5a4bba5d9d6d3252cc686594ffa (patch) | |
tree | ff05f03cd36b9a7e463d566060b5ebcf9fa00ffc | |
parent | 0518c9224e6b4e15cff0e252695ab37246dcbafe (diff) | |
download | portage-c68ebc6b6f93d5a4bba5d9d6d3252cc686594ffa.tar.gz portage-c68ebc6b6f93d5a4bba5d9d6d3252cc686594ffa.tar.bz2 portage-c68ebc6b6f93d5a4bba5d9d6d3252cc686594ffa.zip |
Don't use try/finally to close atomic_ofstream since we don't want to
call close() on this stream if an error occurs.
svn path=/main/trunk/; revision=10231
-rw-r--r-- | pym/portage/dbapi/vartree.py | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index f433789cd..abc7916c8 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -2313,24 +2313,22 @@ class dblink(object): for filename in collisions: del blocker_contents[filename] f = atomic_ofstream(os.path.join(blocker.dbdir, "CONTENTS")) - try: - for filename in sorted(blocker_contents): - entry_data = blocker_contents[filename] - entry_type = entry_data[0] - relative_filename = filename[destroot_len:] - if entry_type == "obj": - entry_type, mtime, md5sum = entry_data - line = "%s %s %s %s\n" % \ - (entry_type, relative_filename, md5sum, mtime) - elif entry_type == "sym": - entry_type, mtime, link = entry_data - line = "%s %s -> %s %s\n" % \ - (entry_type, relative_filename, link, mtime) - else: # dir, dev, fif - line = "%s %s\n" % (entry_type, relative_filename) - f.write(line) - finally: - f.close() + for filename in sorted(blocker_contents): + entry_data = blocker_contents[filename] + entry_type = entry_data[0] + relative_filename = filename[destroot_len:] + if entry_type == "obj": + entry_type, mtime, md5sum = entry_data + line = "%s %s %s %s\n" % \ + (entry_type, relative_filename, md5sum, mtime) + elif entry_type == "sym": + entry_type, mtime, link = entry_data + line = "%s %s -> %s %s\n" % \ + (entry_type, relative_filename, link, mtime) + else: # dir, dev, fif + line = "%s %s\n" % (entry_type, relative_filename) + f.write(line) + f.close() # Due to mtime granularity, mtime checks do not always properly # invalidate vardbapi caches. |