diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-05-08 10:34:52 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-05-08 10:34:52 +0000 |
commit | 3d819e8502be4e330f4ed6fafad7da74cc315e6b (patch) | |
tree | 65314203f7fd78f90a3f373f5a7004fedf58c6da | |
parent | b676418ca5e441c442ccf7d826c81e247e29a663 (diff) | |
download | portage-3d819e8502be4e330f4ed6fafad7da74cc315e6b.tar.gz portage-3d819e8502be4e330f4ed6fafad7da74cc315e6b.tar.bz2 portage-3d819e8502be4e330f4ed6fafad7da74cc315e6b.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. (trunk r10231)
svn path=/main/branches/2.1.2/; revision=10232
-rw-r--r-- | pym/portage.py | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/pym/portage.py b/pym/portage.py index 8d08ad53b..944499838 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -9610,24 +9610,22 @@ class dblink: 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. |