summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-07-06 16:40:01 +0000
committerZac Medico <zmedico@gentoo.org>2006-07-06 16:40:01 +0000
commit46f48080571b71a267edfb892b78cf42de74ea91 (patch)
treea759cf0875fea5527926c7fd475a87ff157c1f4b
parent8e0efd760c12858138fbdef29e06eaa2c472b36d (diff)
downloadportage-46f48080571b71a267edfb892b78cf42de74ea91.tar.gz
portage-46f48080571b71a267edfb892b78cf42de74ea91.tar.bz2
portage-46f48080571b71a267edfb892b78cf42de74ea91.zip
Clean up getportageversion() profile logic and fix a ValueError that occurs when profile is None.
svn path=/main/trunk/; revision=3798
-rwxr-xr-xbin/emerge22
1 files changed, 12 insertions, 10 deletions
diff --git a/bin/emerge b/bin/emerge
index 1fd46d019..b5f203cb0 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -311,17 +311,19 @@ def getgccversion(chost):
return "[unavailable]"
def getportageversion(portdir, target_root, profile, chost, vardb):
- try:
- import re
- profilever = os.path.normpath("///"+os.readlink(profile))
- basepath = os.path.normpath("///" + portdir + "/profiles")
- if re.match(basepath,profilever):
- profilever = profilever[len(basepath)+1:]
+ profilever = "unavailable"
+ 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 = "!"+profilever
- del basepath
- except (OSError,IOError):
- profilever="unavailable"
+ try:
+ profilever = "!" + os.readlink(profile)
+ except (OSError):
+ pass
+ del realpath, basepath
+
libcver=[]
libclist = vardb.match("virtual/libc")
libclist += vardb.match("virtual/glibc")