Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-commits
Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-commits@g.o
From: "Zac Medico (zmedico)" <zmedico@g.o>
Subject: portage r13688 - main/trunk/pym/_emerge
Date: Thu, 25 Jun 2009 01:53:59 +0000
Author: zmedico
Date: 2009-06-25 01:53:58 +0000 (Thu, 25 Jun 2009)
New Revision: 13688

Modified:
   main/trunk/pym/_emerge/depgraph.py
Log:
Use depgraph._pkg() to construct Package instances inside
_select_pkg_highest_available_imp().


Modified: main/trunk/pym/_emerge/depgraph.py
===================================================================
--- main/trunk/pym/_emerge/depgraph.py	2009-06-25 00:45:05 UTC (rev 13687)
+++ main/trunk/pym/_emerge/depgraph.py	2009-06-25 01:53:58 UTC (rev 13688)
@@ -1875,9 +1875,7 @@
 
 				if not cpv_list:
 					continue
-				pkg_status = "merge"
-				if installed or onlydeps:
-					pkg_status = "nomerge"
+
 				# descending order
 				cpv_list.reverse()
 				for cpv in cpv_list:
@@ -1889,18 +1887,11 @@
 						# in case there is a visible downgrade.
 						continue
 					reinstall_for_flags = None
-					cache_key = (pkg_type, root, cpv, pkg_status)
-					pkg = self._pkg_cache.get(cache_key)
-					if pkg is None:
-						try:
-							metadata = izip(db_keys, db.aux_get(cpv, db_keys))
-						except KeyError:
-							continue
-						pkg = Package(built=built, cpv=cpv,
-							installed=installed, metadata=metadata,
-							onlydeps=onlydeps, root_config=root_config,
-							type_name=pkg_type)
-						self._pkg_cache[pkg] = pkg
+					try:
+						pkg = self._pkg(cpv, pkg_type, root_config,
+							installed=installed, onlydeps=onlydeps)
+					except portage.exception.PackageNotFound:
+						continue
 
 					if not installed or (built and matched_packages):
 						# Only enforce visibility on installed packages
@@ -2194,18 +2185,24 @@
 					return 0
 		return 1
 
-	def _pkg(self, cpv, type_name, root_config, installed=False):
+	def _pkg(self, cpv, type_name, root_config, installed=False, 
+		onlydeps=False):
 		"""
 		Get a package instance from the cache, or create a new
-		one if necessary. Raises KeyError from aux_get if it
+		one if necessary. Raises PackageNotFound from aux_get if it
 		failures for some reason (package does not exist or is
 		corrupt).
 		"""
 		operation = "merge"
-		if installed:
+		if installed or onlydeps:
 			operation = "nomerge"
 		pkg = self._pkg_cache.get(
 			(type_name, root_config.root, cpv, operation))
+		if pkg is None and onlydeps and not installed:
+			# Maybe it already got pulled in as a "merge" node.
+			pkg = self.mydbapi[root_config.root].get(
+				(type_name, root_config.root, cpv, 'merge'))
+
 		if pkg is None:
 			tree_type = self.pkg_tree_map[type_name]
 			db = root_config.trees[tree_type].dbapi
@@ -2216,8 +2213,8 @@
 			except KeyError:
 				raise portage.exception.PackageNotFound(cpv)
 			pkg = Package(built=(type_name != "ebuild"), cpv=cpv,
-				metadata=metadata,
-				root_config=root_config, installed=installed)
+				installed=installed, metadata=metadata,
+				root_config=root_config, type_name=type_name)
 			self._pkg_cache[pkg] = pkg
 		return pkg
 



Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
portage r13686 - main/trunk/pym/_emerge
Next by thread:
portage r13689 - main/trunk/pym/_emerge
Previous by date:
gentoo-x86 commit in app-antivirus/clamav: ChangeLog clamav-0.95.2.ebuild
Next by date:
portage r13689 - main/trunk/pym/_emerge


Updated Jun 26, 2012

Summary: Archive of the gentoo-commits mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.