public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:2.1.9 commit in: pym/_emerge/
Date: Thu,  5 May 2011 18:12:59 +0000 (UTC)	[thread overview]
Message-ID: <c603773283a5288c702a742a0eb2b10f49915809.zmedico@gentoo> (raw)

commit:     c603773283a5288c702a742a0eb2b10f49915809
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May  5 17:21:43 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May  5 18:10:17 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c6037732

depgraph: simplify break_refs

---
 pym/_emerge/RootConfig.py |   10 +++++++++-
 pym/_emerge/depgraph.py   |   34 ++++++++++++++--------------------
 2 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/pym/_emerge/RootConfig.py b/pym/_emerge/RootConfig.py
index 110f116..d84f108 100644
--- a/pym/_emerge/RootConfig.py
+++ b/pym/_emerge/RootConfig.py
@@ -1,9 +1,10 @@
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 class RootConfig(object):
 	"""This is used internally by depgraph to track information about a
 	particular $ROOT."""
+	__slots__ = ("root", "setconfig", "sets", "settings", "trees")
 
 	pkg_tree_map = {
 		"ebuild"    : "porttree",
@@ -24,3 +25,10 @@ class RootConfig(object):
 			self.sets = {}
 		else:
 			self.sets = self.setconfig.getSets()
+
+	def update(self, other):
+		"""
+		Shallow copy all attributes from another instance.
+		"""
+		for k in self.__slots__:
+			setattr(self, k, getattr(other, k))

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 9e7b0bb..23197db 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -4217,8 +4217,6 @@ class depgraph(object):
 		mergelist = self.altlist()
 		self._implicit_libc_deps(mergelist,
 			self._dynamic_config._scheduler_graph)
-		self.break_refs(mergelist)
-		self.break_refs(self._dynamic_config._scheduler_graph.order)
 
 		# Break DepPriority.satisfied attributes which reference
 		# installed Package instances.
@@ -4240,31 +4238,27 @@ class depgraph(object):
 
 		for root in trees:
 			trees[root]['vartree']._pkg_cache = pruned_pkg_cache
-			self.break_refs(trees[root]['vartree'].dbapi)
 
-		self.break_refs(pruned_pkg_cache)
+		self.break_refs()
 		sched_config = \
 			_scheduler_graph_config(trees, pruned_pkg_cache, graph, mergelist)
 
 		return sched_config
 
-	def break_refs(self, nodes):
+	def break_refs(self):
 		"""
-		Take a mergelist like that returned from self.altlist() and
-		break any references that lead back to the depgraph. This is
-		useful if you want to hold references to packages without
-		also holding the depgraph on the heap.
+		Break any references in Package instances that lead back to the depgraph.
+		This is useful if you want to hold references to packages without also
+		holding the depgraph on the heap. It should only be called after the
+		depgraph will not be used for any more calculations.
 		"""
-		for node in nodes:
-			if hasattr(node, "root_config"):
-				# The FakeVartree references the _package_cache which
-				# references the depgraph. So that Package instances don't
-				# hold the depgraph and FakeVartree on the heap, replace
-				# the RootConfig that references the FakeVartree with the
-				# original RootConfig instance which references the actual
-				# vartree.
-				node.root_config = \
-					self._frozen_config._trees_orig[node.root_config.root]["root_config"]
+		for root_config in self._frozen_config.roots.values():
+			root_config.update(self._frozen_config._trees_orig[
+				root_config.root]["root_config"])
+			# Both instances are now identical, so discard the
+			# original which should have no other references.
+			self._frozen_config._trees_orig[
+				root_config.root]["root_config"] = root_config
 
 	def _resolve_conflicts(self):
 		if not self._complete_graph():
@@ -6029,7 +6023,7 @@ def _resume_depgraph(settings, trees, mtimedb, myopts, myparams, spinner):
 			# package has already been installed.
 			dropped_tasks.update(pkg for pkg in \
 				unsatisfied_parents if pkg.operation != "nomerge")
-			mydepgraph.break_refs(unsatisfied_parents)
+			mydepgraph.break_refs()
 
 			del e, graph, traversed_nodes, \
 				unsatisfied_parents, unsatisfied_stack



             reply	other threads:[~2011-05-05 18:13 UTC|newest]

Thread overview: 136+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05 18:12 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-27  3:36 [gentoo-commits] proj/portage:2.1.9 commit in: pym/_emerge/ Zac Medico
2011-05-27  1:26 Zac Medico
2011-05-27  0:40 Zac Medico
2011-05-26 22:34 Zac Medico
2011-05-26 21:37 Zac Medico
2011-05-26 13:04 Zac Medico
2011-05-26 12:52 Zac Medico
2011-05-26 12:26 Zac Medico
2011-05-26 12:05 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-05 16:01 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-04-13  7:52 Zac Medico
2011-04-13  7:52 Zac Medico
2011-04-13  7:52 Zac Medico
2011-04-13  7:52 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-01 21:54 Zac Medico
2011-03-01 20:55 Zac Medico
2011-03-01 20:55 Zac Medico
2011-03-01 20:55 Zac Medico
2011-02-22 17:41 Zac Medico
2011-02-22  3:16 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-14 17:02 Zac Medico
2011-02-14 16:45 Zac Medico
2011-02-14 16:35 Zac Medico
2011-02-14 16:04 Zac Medico
2011-02-14  7:49 Zac Medico
2011-02-14  7:49 Zac Medico
2011-02-14  7:49 Zac Medico
2011-02-14  7:49 Zac Medico
2011-02-14  7:49 Zac Medico
2011-02-14  5:04 Zac Medico
2011-02-14  4:31 Zac Medico
2011-02-14  4:31 Zac Medico
2011-02-14  4:31 Zac Medico
2011-02-14  4:31 Zac Medico
2011-02-14  4:31 Zac Medico
2011-02-08 20:48 Zac Medico
2011-02-05  3:37 Zac Medico
2011-02-04 17:47 zmedico
2011-02-04 15:57 zmedico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c603773283a5288c702a742a0eb2b10f49915809.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox