public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r13333 - main/trunk/pym/portage/sets
@ 2009-04-12  7:16 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2009-04-12  7:16 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2009-04-12 07:16:18 +0000 (Sun, 12 Apr 2009)
New Revision: 13333

Modified:
   main/trunk/pym/portage/sets/libs.py
Log:
Add a LibraryFileConsumerSet class that can be used to rebuild all packages
that consume one or more given files. Note: This does not detect libtool
archive (*.la) files that consume the specified files (revdep-rebuild is able
to detect them).


Modified: main/trunk/pym/portage/sets/libs.py
===================================================================
--- main/trunk/pym/portage/sets/libs.py	2009-04-12 06:31:16 UTC (rev 13332)
+++ main/trunk/pym/portage/sets/libs.py	2009-04-12 07:16:18 UTC (rev 13333)
@@ -22,6 +22,39 @@
 			rValue.add("%s/%s:%s" % (cat, pn, slot))
 		return rValue
 
+class LibraryFileConsumerSet(LibraryConsumerSet):
+
+	"""
+	Note: This does not detect libtool archive (*.la) files that consume the
+	specified files (revdep-rebuild is able to detect them).
+	"""
+
+	description = "Package set which contains all packages " + \
+		"that consume the specified library file(s)."
+
+	def __init__(self, vardbapi, files, **kargs):
+		super(LibraryFileConsumerSet, self).__init__(vardbapi, **kargs)
+		self.files = files
+
+	def load(self):
+		consumers = set()
+		for lib in self.files:
+			consumers.update(self.dbapi.linkmap.findConsumers(lib))
+
+		if not consumers:
+			return
+		self._setAtoms(self.mapPathsToAtoms(consumers))
+
+	def singleBuilder(cls, options, settings, trees):
+		import shlex
+		files = tuple(shlex.split(options.get("files", "")))
+		if not files:
+			raise SetConfigError("no files given")
+		debug = get_boolean(options, "debug", False)
+		return LibraryFileConsumerSet(trees["vartree"].dbapi,
+			files, debug=debug)
+	singleBuilder = classmethod(singleBuilder)
+
 class PreservedLibraryConsumerSet(LibraryConsumerSet):
 	def load(self):
 		reg = self.dbapi.plib_registry
@@ -48,5 +81,6 @@
 
 	def singleBuilder(cls, options, settings, trees):
 		debug = get_boolean(options, "debug", False)
-		return PreservedLibraryConsumerSet(trees["vartree"].dbapi, debug)
+		return PreservedLibraryConsumerSet(trees["vartree"].dbapi,
+			debug=debug)
 	singleBuilder = classmethod(singleBuilder)




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

only message in thread, other threads:[~2009-04-12  7:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-12  7:16 [gentoo-commits] portage r13333 - main/trunk/pym/portage/sets Zac Medico (zmedico)

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