Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r10231 - main/trunk/pym/portage/dbapi
Date: Thu, 08 May 2008 10:33:39
Message-Id: E1Ju3RL-0004R0-Cw@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-05-08 10:33:30 +0000 (Thu, 08 May 2008)
3 New Revision: 10231
4
5 Modified:
6 main/trunk/pym/portage/dbapi/vartree.py
7 Log:
8 Don't use try/finally to close atomic_ofstream since we don't want to
9 call close() on this stream if an error occurs.
10
11
12 Modified: main/trunk/pym/portage/dbapi/vartree.py
13 ===================================================================
14 --- main/trunk/pym/portage/dbapi/vartree.py 2008-05-08 09:29:13 UTC (rev 10230)
15 +++ main/trunk/pym/portage/dbapi/vartree.py 2008-05-08 10:33:30 UTC (rev 10231)
16 @@ -2313,24 +2313,22 @@
17 for filename in collisions:
18 del blocker_contents[filename]
19 f = atomic_ofstream(os.path.join(blocker.dbdir, "CONTENTS"))
20 - try:
21 - for filename in sorted(blocker_contents):
22 - entry_data = blocker_contents[filename]
23 - entry_type = entry_data[0]
24 - relative_filename = filename[destroot_len:]
25 - if entry_type == "obj":
26 - entry_type, mtime, md5sum = entry_data
27 - line = "%s %s %s %s\n" % \
28 - (entry_type, relative_filename, md5sum, mtime)
29 - elif entry_type == "sym":
30 - entry_type, mtime, link = entry_data
31 - line = "%s %s -> %s %s\n" % \
32 - (entry_type, relative_filename, link, mtime)
33 - else: # dir, dev, fif
34 - line = "%s %s\n" % (entry_type, relative_filename)
35 - f.write(line)
36 - finally:
37 - f.close()
38 + for filename in sorted(blocker_contents):
39 + entry_data = blocker_contents[filename]
40 + entry_type = entry_data[0]
41 + relative_filename = filename[destroot_len:]
42 + if entry_type == "obj":
43 + entry_type, mtime, md5sum = entry_data
44 + line = "%s %s %s %s\n" % \
45 + (entry_type, relative_filename, md5sum, mtime)
46 + elif entry_type == "sym":
47 + entry_type, mtime, link = entry_data
48 + line = "%s %s -> %s %s\n" % \
49 + (entry_type, relative_filename, link, mtime)
50 + else: # dir, dev, fif
51 + line = "%s %s\n" % (entry_type, relative_filename)
52 + f.write(line)
53 + f.close()
54
55 # Due to mtime granularity, mtime checks do not always properly
56 # invalidate vardbapi caches.
57
58 --
59 gentoo-commits@l.g.o mailing list