--- /usr/bin/emerge 2005-06-11 00:35:35.000000000 -0400 +++ emerge 2005-06-11 00:34:09.000000000 -0400 @@ -2832,6 +2832,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") @@ -2908,6 +2910,70 @@ 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: + mypkgs = mypkgs + portage.db[portage.root]["vartree"].dbapi.match(x) + + # 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' ] + mysettings = {} + for x in mydesiredvars: + if portage.settings.has_key(x): + mysettings["GLOBAL_" + x] = portage.settings[x] + else: + mysettings["GLOBAL_" + x] = None + + # Loop through each package + # Only print settings if they differ from global settings + diff_found = False + 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 + for x in mydesiredvars: + if os.path.exists(os.path.join(prefix, x)): + mysettings[x] = open(os.path.join(prefix, x)).read().strip() + else: + if portage.settings.has_key(x): + mysettings[x] = portage.settings[x] + else: + mysettings[x] = None + + # If the package variable doesn't match the + # current global variable, something has changed + # so set diff_found so we know to print + if mysettings[x] != mysettings["GLOBAL_" + x]: + 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 x in mydesiredvars: + if mysettings[x] != mysettings["GLOBAL_" + x]: + print "%s=\"%s\"" % (x, mysettings[x]) + print "" + diff_found = False + + # SEARCH action elif "search"==myaction: if not myfiles: