public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] Extra info about installed packages feature
@ 2005-09-27  6:04 Jason Stubbs
  2005-09-27  9:50 ` Jason Stubbs
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Stubbs @ 2005-09-27  6:04 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

This patch is by swegener. It allows one to specify atoms after `emerge info` 
that will be matched to installed packages. Any installed packages found that 
have settings differing to the current settings will have those settings 
printed out along with the global info.

[-- Attachment #2: per-package-info.patch --]
[-- Type: text/x-diff, Size: 2573 bytes --]

diff -u -r1.345.2.37 emerge
--- bin/emerge	5 Aug 2005 04:15:00 -0000	1.345.2.37
+++ bin/emerge	11 Aug 2005 14:26:16 -0000
@@ -2838,6 +2879,8 @@
 	unameout=commands.getstatusoutput("uname -mrp")[1]
 	print getportageversion()
 	print "================================================================="
+	print "                       System Settings"
+	print "================================================================="
 	print "System uname: "+unameout
 	if os.path.exists("/etc/gentoo-release"):
 		os.system("cat /etc/gentoo-release")
@@ -2914,6 +2957,61 @@
 			if "cvs_id_string" in dir(module):
 				print "%s: %s" % (str(x), str(module.cvs_id_string))
 
+	# See if we can find any packages installed matching the strings
+	# passed on the command line
+	mypkgs = {}
+	for x in myfiles:
+		for y in portage.db[portage.root]["vartree"].dbapi.match(x):
+			if y:
+				mypkgs[y] = True
+	mypkgs = mypkgs.keys()
+	mypkgs.sort()
+
+	# If some packages were found...
+	if mypkgs:
+		# Get our global settings (we only print stuff if it varies from
+		# the current config)
+		mydesiredvars = [ 'CHOST', 'CFLAGS', 'CXXFLAGS', 'USE' ]
+
+		# Loop through each package
+		# Only print settings if they differ from global settings
+		header_printed = False
+		for pkg in mypkgs:
+
+			# Get the directory where the files are stored
+			prefix = os.path.join(portage.root, portage.VDB_PATH, pkg)
+
+			# Get all package specific variables
+			tmp = portage.db[portage.root]["vartree"].dbapi.aux_get(pkg, mydesiredvars)
+			diff_found = False
+			for i in range(len(mydesiredvars)):
+				# If the package variable doesn't match the
+				# current global variable, something has changed
+				# so set diff_found so we know to print
+				if tmp[i] != portage.settings[mydesiredvars[i]]:
+					diff_found = True
+
+			# If a difference was found, print the info for
+			# this package.
+			if diff_found:
+
+				# If we have not yet printed the header, 
+				# print it now
+				if not header_printed:
+					print "================================================================="
+					print "                       Package Settings"
+					print "================================================================="
+					header_printed = True
+
+				# Print package info
+				print "%s was built with the following:" % pkg
+				for i in range(len(mydesiredvars)):
+					if tmp[i] != portage.settings[mydesiredvars[i]]:
+						print "%s=\"%s\"" % (mydesiredvars[i], tmp[i])
+				print ""
+				diff_found = False
+
+
 # SEARCH action
 elif "search"==myaction:
 	if not myfiles:

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gentoo-portage-dev] [PATCH] Extra info about installed packages feature
  2005-09-27  6:04 [gentoo-portage-dev] [PATCH] Extra info about installed packages feature Jason Stubbs
@ 2005-09-27  9:50 ` Jason Stubbs
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Stubbs @ 2005-09-27  9:50 UTC (permalink / raw
  To: gentoo-portage-dev

On Tuesday 27 September 2005 15:04, Jason Stubbs wrote:
> This patch is by swegener.

Apologies. This patch is by npmccallum.
http://bugs.gentoo.org/95741
-- 
gentoo-portage-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-09-27  9:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-27  6:04 [gentoo-portage-dev] [PATCH] Extra info about installed packages feature Jason Stubbs
2005-09-27  9:50 ` Jason Stubbs

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