Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r10265 - in main/branches/2.1.2: bin pym
Date: Fri, 09 May 2008 04:19:26
Message-Id: E1JuK4p-00070M-4H@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-05-09 04:19:22 +0000 (Fri, 09 May 2008)
3 New Revision: 10265
4
5 Modified:
6 main/branches/2.1.2/bin/emerge
7 main/branches/2.1.2/pym/portage.py
8 Log:
9 For the "blockers" parameter that's passed into the dblink constructor
10 now, make it a callable since it really shouldn't be called until the
11 vdb lock has been acquired. (trunk r10264)
12
13
14 Modified: main/branches/2.1.2/bin/emerge
15 ===================================================================
16 --- main/branches/2.1.2/bin/emerge 2008-05-09 04:17:57 UTC (rev 10264)
17 +++ main/branches/2.1.2/bin/emerge 2008-05-09 04:19:22 UTC (rev 10265)
18 @@ -1147,7 +1147,8 @@
19 user doesn't necessarily need write access to the vardb in cases where
20 global updates are necessary (updates are performed when necessary if there
21 is not a matching ebuild in the tree)."""
22 - def __init__(self, real_vartree, portdb, db_keys, pkg_cache):
23 + def __init__(self, real_vartree, portdb,
24 + db_keys, pkg_cache, acquire_lock=1):
25 self.root = real_vartree.root
26 self.settings = real_vartree.settings
27 mykeys = db_keys[:]
28 @@ -1164,7 +1165,7 @@
29 pass
30 vdb_lock = None
31 try:
32 - if os.access(vdb_path, os.W_OK):
33 + if acquire_lock and os.access(vdb_path, os.W_OK):
34 vdb_lock = portage_locks.lockdir(vdb_path)
35 real_dbapi = real_vartree.dbapi
36 slot_counters = {}
37 @@ -1671,7 +1672,7 @@
38 "vartree" : self._vartree,
39 }}
40
41 - def findInstalledBlockers(self, new_pkg):
42 + def findInstalledBlockers(self, new_pkg, acquire_lock=0):
43 blocker_cache = self._blocker_cache
44 dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
45 dep_check_trees = self._dep_check_trees
46 @@ -1679,7 +1680,8 @@
47 stale_cache = set(blocker_cache)
48 fake_vartree = \
49 FakeVartree(self._vartree,
50 - self._portdb, Package.metadata_keys, {})
51 + self._portdb, Package.metadata_keys, {},
52 + acquire_lock=acquire_lock)
53 vardb = fake_vartree.dbapi
54 installed_pkgs = list(vardb)
55
56 @@ -5683,12 +5685,22 @@
57 self._spawned_pids = []
58
59 def _find_blockers(self, new_pkg):
60 + """
61 + Returns a callable which should be called only when
62 + the vdb lock has been acquired.
63 + """
64 + def get_blockers():
65 + return self._find_blockers_with_lock(new_pkg, acquire_lock=0)
66 + return get_blockers
67 +
68 + def _find_blockers_with_lock(self, new_pkg, acquire_lock=0):
69 if self._opts_ignore_blockers.intersection(self.myopts):
70 return None
71
72 blocker_dblinks = []
73 for blocking_pkg in self._blocker_db[
74 - new_pkg.root].findInstalledBlockers(new_pkg):
75 + new_pkg.root].findInstalledBlockers(new_pkg,
76 + acquire_lock=acquire_lock):
77 if new_pkg.slot_atom == blocking_pkg.slot_atom:
78 continue
79 if new_pkg.cpv == blocking_pkg.cpv:
80
81 Modified: main/branches/2.1.2/pym/portage.py
82 ===================================================================
83 --- main/branches/2.1.2/pym/portage.py 2008-05-09 04:17:57 UTC (rev 10264)
84 +++ main/branches/2.1.2/pym/portage.py 2008-05-09 04:19:22 UTC (rev 10265)
85 @@ -9311,7 +9311,11 @@
86 return 1
87
88 # check for package collisions
89 - blockers = self._blockers
90 + blockers = None
91 + if self._blockers is not None:
92 + # This is only supposed to be called when
93 + # the vdb is locked, like it is here.
94 + blockers = self._blockers()
95 if blockers is None:
96 blockers = []
97 if True:
98
99 --
100 gentoo-commits@l.g.o mailing list