public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r11615 - in main/branches/prefix: bin doc/config pym/_emerge pym/portage/elog pym/portage/sets
@ 2008-10-03 16:53 Fabian Groffen (grobian)
  0 siblings, 0 replies; only message in thread
From: Fabian Groffen (grobian) @ 2008-10-03 16:53 UTC (permalink / raw
  To: gentoo-commits

Author: grobian
Date: 2008-10-03 16:53:25 +0000 (Fri, 03 Oct 2008)
New Revision: 11615

Modified:
   main/branches/prefix/bin/isolated-functions.sh
   main/branches/prefix/doc/config/sets.docbook
   main/branches/prefix/pym/_emerge/__init__.py
   main/branches/prefix/pym/portage/elog/messages.py
   main/branches/prefix/pym/portage/sets/__init__.py
   main/branches/prefix/pym/portage/sets/base.py
   main/branches/prefix/pym/portage/sets/dbapi.py
Log:
   Merged from trunk -r11593:11602

   | 11594   | For compatibility with long-standing --columns behavior, do  |
   | zmedico | not display "uninstall" or satsified "blocks" nodes in the   |
   |         | merge list when --columns is enabled. Thanks to solar for    |
   |         | the suggestion.                                              |
   
   | 11595   | make sure that cli-defined sets aren't added to @world       |
   | genone  |                                                              |
   
   | 11596   | allow selection of metadata source for VariableSet           |
   | genone  |                                                              |
   
   | 11597   | remove the 'repository' option from CategorySet in favor of  |
   | genone  | the generic 'intersect' option                               |
   
   | 11598   | Add a new DummyPackageSet handler to make set operators      |
   | genone  | easier to use                                                |
   
   | 11599   | allow the portage.sets. prefix to be omitted in 'class'      |
   | genone  | options of set definitions                                   |
   
   | 11600   | Bug #239006 - In FakeVartree._aux_get_wrapper(), fall back   |
   | zmedico | to vdb metadata if the live ebuild's EAPI is unsupported.    |
   
   | 11601   | Now that elog_base() uses 'echo -e' to expand escape codes   |
   | zmedico | prior to using 'read' to split on newlines, it's safe to use |
   |         | newlines as delimiters in the log file since 'read' is       |
   |         | guaranteed to split any newlines contained in the arguments. |
   
   | 11602   | Handle InvalidDependString from portdbapi.getFetchMap()      |
   | zmedico | inside search.output(). Thanks to agaffney for reporting.    |


Modified: main/branches/prefix/bin/isolated-functions.sh
===================================================================
--- main/branches/prefix/bin/isolated-functions.sh	2008-10-03 16:50:31 UTC (rev 11614)
+++ main/branches/prefix/bin/isolated-functions.sh	2008-10-03 16:53:25 UTC (rev 11615)
@@ -177,12 +177,8 @@
 			return 1
 			;;
 	esac
-	# Note: Even though the message is split on $'\n' here, it's still
-	# not entirely safe to use it as a delimiter in the log file since
-	# there can still be escaped newlines that will be expanded due to
-	# the echo -e parameter.
 	echo -e "$@" | while read line ; do
-		echo -ne "${messagetype} ${line}\n\0" >> \
+		echo "${messagetype} ${line}" >> \
 			"${T}/logging/${EBUILD_PHASE:-other}"
 	done
 	return 0

Modified: main/branches/prefix/doc/config/sets.docbook
===================================================================
--- main/branches/prefix/doc/config/sets.docbook	2008-10-03 16:50:31 UTC (rev 11614)
+++ main/branches/prefix/doc/config/sets.docbook	2008-10-03 16:53:25 UTC (rev 11615)
@@ -123,8 +123,8 @@
 			[installed category packages]
 			class = portage.sets.dbapi.CategorySet
 			multiset = true
-			repository = vartree
 			name_pattern = $category/*
+			intersect = installed
 			</programlisting>
 			</para>
 			<!-- TODO: reference list of available set handler classes here -->
@@ -437,13 +437,6 @@
 			<listitem><varname>category</varname>: Required. The name of an existing ebuild
 				category which should be used to create the package set.
 			</listitem>
-			<listitem><varname>repository</varname>: Optional, defaults to 
-				<parameter>porttree</parameter>. It determines which repository class should
-				be used to create the package set. Valid values for this option are:
-				<parameter>porttree</parameter> (normal ebuild repository), 
-				<parameter>vartree</parameter> (installed package repository)
-				and <parameter>bintree</parameter> (local binary package repository).
-			</listitem>
 			<listitem><varname>only_visible</varname>: Optional, defaults to <parameter>true</parameter>.
 				When set to <parameter>true</parameter> the set will only include visible packages, 
 				when set to <parameter>false</parameter> it will also include masked packages.
@@ -523,6 +516,9 @@
 		values that must not be contained within the specified
 		variable.
 		</listitem>
+		<listitem><varname>metadata-source</varname>: Optional, defaults to
+		"vartree". Specifies the repository to use for getting the metadata
+		to check.</listitem>
 		</itemizedlist>
 		</para>
 		</sect2>

Modified: main/branches/prefix/pym/_emerge/__init__.py
===================================================================
--- main/branches/prefix/pym/_emerge/__init__.py	2008-10-03 16:50:31 UTC (rev 11614)
+++ main/branches/prefix/pym/_emerge/__init__.py	2008-10-03 16:53:25 UTC (rev 11615)
@@ -699,12 +699,18 @@
 						from portage import manifest
 						mf = manifest.Manifest(
 							pkgdir, self.settings["DISTDIR"])
-						fetchlist = self.portdb.getFetchMap(mycpv)
 						try:
-							mysum[0] = mf.getDistfilesSize(fetchlist)
-						except KeyError, e:
-							file_size_str = "Unknown (missing digest for %s)" % \
-								str(e)
+							uri_map = self.portdb.getFetchMap(mycpv)
+						except portage.exception.InvalidDependString, e:
+							file_size_str = "Unknown (%s)" % (e,)
+							del e
+						else:
+							try:
+								mysum[0] = mf.getDistfilesSize(uri_map)
+							except KeyError, e:
+								file_size_str = "Unknown (missing " + \
+									"digest for %s)" % (e,)
+								del e
 
 					available = False
 					for db in self._dbs:
@@ -1117,7 +1123,7 @@
 		self._match = self.dbapi.match
 		self.dbapi.match = self._match_wrapper
 		self._aux_get_history = set()
-		self._portdb_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
+		self._portdb_keys = ["EAPI", "DEPEND", "RDEPEND", "PDEPEND"]
 		self._portdb = portdb
 		self._global_updates = None
 
@@ -1143,6 +1149,8 @@
 			# Use the live ebuild metadata if possible.
 			live_metadata = dict(izip(self._portdb_keys,
 				self._portdb.aux_get(pkg, self._portdb_keys)))
+			if not portage.eapi_is_supported(live_metadata["EAPI"]):
+				raise KeyError(pkg)
 			self.dbapi.aux_update(pkg, live_metadata)
 		except (KeyError, portage.exception.PortageException):
 			if self._global_updates is None:
@@ -6729,6 +6737,7 @@
 		favorites_set = InternalPackageSet(favorites)
 		oneshot = "--oneshot" in self.myopts or \
 			"--onlydeps" in self.myopts
+		columns = "--columns" in self.myopts
 		changelogs=[]
 		p=[]
 		blockers = []
@@ -7004,6 +7013,8 @@
 					addl += colorize(blocker_style,
 						" (is blocking %s)") % block_parents
 				if isinstance(x, Blocker) and x.satisfied:
+					if columns:
+						continue
 					p.append(addl)
 				else:
 					blockers.append(addl)
@@ -7396,6 +7407,8 @@
 								(pkgprint(pkg_type), addl, indent,
 								pkgprint(pkg.cpv), myoldbest)
 
+				if columns and pkg.operation == "uninstall":
+					continue
 				p.append((myprint, verboseadd, repoadd))
 
 				if "--tree" not in self.myopts and \

Modified: main/branches/prefix/pym/portage/elog/messages.py
===================================================================
--- main/branches/prefix/pym/portage/elog/messages.py	2008-10-03 16:50:31 UTC (rev 11614)
+++ main/branches/prefix/pym/portage/elog/messages.py	2008-10-03 16:53:25 UTC (rev 11615)
@@ -35,7 +35,7 @@
 			logentries[msgfunction] = []
 		lastmsgtype = None
 		msgcontent = []
-		for l in open(filename, "r").read().split("\0"):
+		for l in open(filename, "rb"):
 			if not l:
 				continue
 			try:

Modified: main/branches/prefix/pym/portage/sets/__init__.py
===================================================================
--- main/branches/prefix/pym/portage/sets/__init__.py	2008-10-03 16:50:31 UTC (rev 11614)
+++ main/branches/prefix/pym/portage/sets/__init__.py	2008-10-03 16:53:25 UTC (rev 11615)
@@ -37,6 +37,7 @@
 		self.errors = []
 		if not setname in self.psets:
 			options["name"] = setname
+			options["world-candidate"] = "False"
 			
 			# for the unlikely case that there is already a section with the requested setname
 			import random
@@ -69,8 +70,11 @@
 			try:
 				setclass = load_mod(classname)
 			except (ImportError, AttributeError):
-				self.errors.append("Could not import '%s' for section '%s'" % (classname, sname))
-				continue
+				try:
+					setclass = load_mod("portage.sets."+classname)
+				except (ImportError, AttributeError):
+					self.errors.append("Could not import '%s' for section '%s'" % (classname, sname))
+					continue
 			# prepare option dict for the current section
 			optdict = {}
 			for oname in self.options(sname):

Modified: main/branches/prefix/pym/portage/sets/base.py
===================================================================
--- main/branches/prefix/pym/portage/sets/base.py	2008-10-03 16:50:31 UTC (rev 11614)
+++ main/branches/prefix/pym/portage/sets/base.py	2008-10-03 16:53:25 UTC (rev 11615)
@@ -219,3 +219,16 @@
 	def write(self):
 		pass
 
+class DummyPackageSet(PackageSet):
+	def __init__(self, atoms=None):
+		super(DummyPackageSet, self).__init__()
+		if atoms:
+			self._setAtoms(atoms)
+	
+	def load(self):
+		pass
+	
+	def singleBuilder(cls, options, settings, trees):
+		atoms = options.get("packages", "").split()
+		return DummyPackageSet(atoms=atoms)
+	singleBuilder = classmethod(singleBuilder)

Modified: main/branches/prefix/pym/portage/sets/dbapi.py
===================================================================
--- main/branches/prefix/pym/portage/sets/dbapi.py	2008-10-03 16:50:31 UTC (rev 11614)
+++ main/branches/prefix/pym/portage/sets/dbapi.py	2008-10-03 16:53:25 UTC (rev 11615)
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-from portage.versions import catpkgsplit, catsplit, pkgcmp
+from portage.versions import catpkgsplit, catsplit, pkgcmp, best
 from portage.dep import Atom
 from portage.sets.base import PackageSet
 from portage.sets import SetConfigError, get_boolean
@@ -96,18 +96,18 @@
 	description = "Package set which contains all packages " + \
 		"that match specified values of a specified variable."
 
-	def __init__(self, vardb, portdb=None, variable=None, includes=None, excludes=None):
+	def __init__(self, vardb, metadatadb=None, variable=None, includes=None, excludes=None):
 		super(VariableSet, self).__init__(vardb)
-		self._portdb = portdb
+		self._metadatadb = metadatadb
 		self._variable = variable
 		self._includes = includes
 		self._excludes = excludes
 
 	def _filter(self, atom):
-		ebuild = self._portdb.xmatch("bestmatch-visible", atom)
+		ebuild = best(self._metadatadb.match(atom))
 		if not ebuild:
 			return False
-		values, = self._portdb.aux_get(ebuild, [self._variable])
+		values, = self._metadatadb.aux_get(ebuild, [self._variable])
 		values = values.split()
 		if self._includes and not self._includes.intersection(values):
 			return False
@@ -126,9 +126,13 @@
 
 		if not (includes or excludes):
 			raise SetConfigError("no includes or excludes given")
+		
+		metadatadb = options.get("metadata-source", "vartree")
+		if not metadatadb in trees.keys():
+			raise SetConfigError("invalid value '%s' for option metadata-source" % metadatadb)
 
 		return cls(trees["vartree"].dbapi,
-			portdb=trees["porttree"].dbapi,
+			metadatadb=trees[metadatadb].dbapi,
 			excludes=frozenset(excludes.split()),
 			includes=frozenset(includes.split()),
 			variable=variable)
@@ -197,13 +201,6 @@
 					myatoms.append(cp)
 		self._setAtoms(myatoms)
 	
-	def _builderGetRepository(cls, options, repositories):
-		repository = options.get("repository", "porttree")
-		if not repository in repositories:
-			raise SetConfigError("invalid repository class '%s'" % repository)
-		return repository
-	_builderGetRepository = classmethod(_builderGetRepository)
-
 	def _builderGetVisible(cls, options):
 		return get_boolean(options, "only_visible", True)
 	_builderGetVisible = classmethod(_builderGetVisible)
@@ -216,10 +213,9 @@
 		if not category in settings.categories:
 			raise SetConfigError("invalid category name '%s'" % category)
 
-		repository = cls._builderGetRepository(options, trees.keys())
 		visible = cls._builderGetVisible(options)
 		
-		return CategorySet(category, dbapi=trees[repository].dbapi, only_visible=visible)
+		return CategorySet(category, dbapi=trees["porttree"].dbapi, only_visible=visible)
 	singleBuilder = classmethod(singleBuilder)
 
 	def multiBuilder(cls, options, settings, trees):
@@ -233,7 +229,6 @@
 		else:
 			categories = settings.categories
 	
-		repository = cls._builderGetRepository(options, trees.keys())
 		visible = cls._builderGetVisible(options)
 		name_pattern = options.get("name_pattern", "$category/*")
 	
@@ -241,7 +236,7 @@
 			raise SetConfigError("name_pattern doesn't include $category placeholder")
 	
 		for cat in categories:
-			myset = CategorySet(cat, trees[repository].dbapi, only_visible=visible)
+			myset = CategorySet(cat, trees["porttree"].dbapi, only_visible=visible)
 			myname = name_pattern.replace("$category", cat)
 			myname = myname.replace("${category}", cat)
 			rValue[myname] = myset




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-10-03 17:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-03 16:53 [gentoo-commits] portage r11615 - in main/branches/prefix: bin doc/config pym/_emerge pym/portage/elog pym/portage/sets Fabian Groffen (grobian)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox