public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r15787 - main/trunk/pym/_emerge
@ 2010-03-09  4:24 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2010-03-09  4:24 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2010-03-09 04:24:16 +0000 (Tue, 09 Mar 2010)
New Revision: 15787

Modified:
   main/trunk/pym/_emerge/actions.py
Log:
Add support for displaying profile listed in make.profile/parent when
make.profile is not a symlink. The first parent with a path inside
$PORTDIR is displayed.


Modified: main/trunk/pym/_emerge/actions.py
===================================================================
--- main/trunk/pym/_emerge/actions.py	2010-03-09 03:59:01 UTC (rev 15786)
+++ main/trunk/pym/_emerge/actions.py	2010-03-09 04:24:16 UTC (rev 15787)
@@ -2429,20 +2429,39 @@
 	writemsg_level("".join("%s\n" % l for l in msg),
 		level=logging.ERROR, noiselevel=-1)
 
+def relative_profile_path(portdir, abs_profile):
+	realpath = os.path.realpath(abs_profile)
+	basepath   = os.path.realpath(os.path.join(portdir, "profiles"))
+	if realpath.startswith(basepath):
+		profilever = realpath[1 + len(basepath):]
+	else:
+		profilever = None
+	return profilever
+
 def getportageversion(portdir, target_root, profile, chost, vardb):
-	profilever = "unavailable"
+	profilever = None
 	if profile:
-		realpath = os.path.realpath(profile)
-		basepath   = os.path.realpath(os.path.join(portdir, "profiles"))
-		if realpath.startswith(basepath):
-			profilever = realpath[1 + len(basepath):]
-		else:
+		profilever = relative_profile_path(portdir, profile)
+		if profilever is None:
 			try:
-				profilever = "!" + os.readlink(profile)
-			except (OSError):
+				for parent in portage.grabfile(
+					os.path.join(profile, 'parent')):
+					profilever = relative_profile_path(portdir,
+						os.path.join(profile, parent))
+					if profilever is not None:
+						break
+			except portage.exception.PortageException:
 				pass
-		del realpath, basepath
 
+			if profilever is None:
+				try:
+					profilever = "!" + os.readlink(profile)
+				except (OSError):
+					pass
+
+	if profilever is None:
+		profilever = "unavailable"
+
 	libcver=[]
 	libclist  = vardb.match("virtual/libc")
 	libclist += vardb.match("virtual/glibc")




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

only message in thread, other threads:[~2010-03-09  4:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-09  4:24 [gentoo-commits] portage r15787 - main/trunk/pym/_emerge 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