Index: trunk/essentials/sys-apps/prefix-portage/pym/emerge/__init__.py
===================================================================
--- trunk/essentials/sys-apps/prefix-portage/pym/emerge/__init__.py	(revision 3501)
+++ trunk/essentials/sys-apps/prefix-portage/pym/emerge/__init__.py	(revision 3502)
@@ -48,5 +48,5 @@
 import portage.locks
 import portage.exception
-from portage.const import EPREFIX
+from portage.const import EPREFIX, EXEEXT
 from portage.data import secpass
 from portage.util import normalize_path as normpath
@@ -3848,6 +3848,6 @@
 	from portage.util import normalize_path
 	if "noinfo" not in settings.features:
-		chk_updated_info_files(normalize_path(target_root + EPREFIX), infodirs, info_mtimes, retval)
-	chk_updated_cfg_files(normalize_path(target_root + EPREFIX), config_protect)
+		chk_updated_info_files(target_root + EPREFIX.lstrip(os.path.sep), infodirs, info_mtimes, retval)
+	chk_updated_cfg_files(target_root + EPREFIX.lstrip(os.path.sep), config_protect)
 	
 	display_news_notification(settings)
@@ -3980,5 +3980,5 @@
 		tmpservertimestampfile = None
 	elif syncuri[:8]=="rsync://":
-		if not os.path.exists(EPREFIX+"/usr/bin/rsync"):
+		if not os.path.exists(EPREFIX+"/usr/bin/rsync"+EXEEXT):
 			print "!!! rsync does not exist, so rsync support is disabled."
 			print "!!! Type \"emerge net-misc/rsync\" to enable rsync support."
@@ -4196,5 +4196,5 @@
 				print ">>> Checking server timestamp ..."
 
-			rsynccommand = [EPREFIX+"/usr/bin/rsync"] + rsync_opts + extra_rsync_opts
+			rsynccommand = [EPREFIX+"/usr/bin/rsync"+EXEEXT] + rsync_opts + extra_rsync_opts
 
 			if "--debug" in myopts:
@@ -4335,5 +4335,5 @@
 			sys.exit(exitcode)
 	elif syncuri[:6]=="cvs://":
-		if not os.path.exists(EPREFIX+"/usr/bin/cvs"):
+		if not os.path.exists(EPREFIX+"/usr/bin/cvs"+EXEEXT):
 			print "!!! cvs does not exist, so CVS support is disabled."
 			print "!!! Type \"emerge dev-util/cvs\" to enable CVS support."
@@ -4369,5 +4369,5 @@
 	elif syncuri[:11]=="svn+http://":
 		# this should be way more generic!
-		if not os.path.exists(EPREFIX+"/usr/bin/svn"):
+		if not os.path.exists(EPREFIX+"/usr/bin/svn"+EXEEXT):
 			print "!!! svn does not exist, so SVN support is disabled."
 			print "!!! Type \"emerge dev-util/subversion\" to enable SVN support."
@@ -4648,6 +4648,8 @@
 	print header_width * "="
 	print "System uname: "+unameout
+	from portage.util import normalize_path
+	foo = os.path.join(settings["PORTAGE_CONFIGROOT"] + EPREFIX.lstrip(os.path.sep), "etc", "gentoo-release")
 	gentoo_release = portage.grabfile(os.path.join(
-		settings["PORTAGE_CONFIGROOT"] + EPREFIX, "etc", "gentoo-release"))
+		settings["PORTAGE_CONFIGROOT"] + EPREFIX.lstrip(os.path.sep), "etc", "gentoo-release"))
 	if gentoo_release:
 		print gentoo_release[0]
Index: trunk/essentials/sys-apps/prefix-portage/pym/portage/__init__.py
===================================================================
--- trunk/essentials/sys-apps/prefix-portage/pym/portage/__init__.py	(revision 3501)
+++ trunk/essentials/sys-apps/prefix-portage/pym/portage/__init__.py	(revision 3502)
@@ -472,5 +472,5 @@
 	if env is None:
 		env = os.environ
-	envd_dir = os.path.join(normalize_path(target_root + EPREFIX), "etc", "env.d")
+	envd_dir = os.path.join(target_root + EPREFIX.lstrip(os.path.sep), "etc", "env.d")
 	portage.util.ensure_dirs(envd_dir, mode=0755)
 	fns = listdir(envd_dir, EmptyOnError=1)
@@ -547,5 +547,5 @@
 		env.update(myconfig)
 
-	ldsoconf_path = os.path.join(normalize_path(target_root + EPREFIX), "etc", "ld.so.conf")
+	ldsoconf_path = os.path.join(target_root + EPREFIX.lstrip(os.path.sep), "etc", "ld.so.conf")
 	try:
 		myld = open(ldsoconf_path)
@@ -579,5 +579,5 @@
 	if prelink_capable:
 		newprelink = atomic_ofstream(
-			os.path.join(normalize_path(target_root + EPREFIX), "etc", "prelink.conf"))
+			os.path.join(target_root + EPREFIX.lstrip(os.path.sep), "etc", "prelink.conf"))
 		newprelink.write("# prelink.conf autogenerated by env-update; make all changes to\n")
 		newprelink.write("# contents of "+EPREFIX+"/etc/env.d directory\n")
@@ -614,5 +614,5 @@
 	lib_dirs = set()
 	for lib_dir in portage.util.unique_array(specials["LDPATH"]+['usr/lib','usr/lib64','usr/lib32','lib','lib64','lib32']):
-		x = os.path.join(normalize_path(target_root + EPREFIX), lib_dir.lstrip(os.sep))
+		x = os.path.join(target_root + EPREFIX.lstrip(os.path.sep), lib_dir.lstrip(os.sep))
 		try:
 			newldpathtime = long(os.stat(x).st_mtime)
@@ -670,5 +670,5 @@
 			# to overwrite the symlinks we just made. -X means no links. After 'clean'
 			# we can safely create links.
-			writemsg(">>> Regenerating %s/etc/ld.so.cache...\n" % (normalize_path(target_root+EPREFIX)))
+			writemsg(">>> Regenerating %s/etc/ld.so.cache...\n" % (target_root+EPREFIX.lstrip(os.path.sep)))
 			if makelinks:
 				os.system("cd / ; %s -r '%s'" % (ldconfig, target_root))
@@ -677,8 +677,8 @@
 		elif ostype in ("FreeBSD","DragonFly"):
 			writemsg(">>> Regenerating %svar/run/ld-elf.so.hints...\n" % \
-				normalize_path(target_root+EPREFIX))
+				target_root+EPREFIX.lstrip(os.path.sep))
 			os.system(("cd / ; %s -elf -i " + \
 				"-f '%svar/run/ld-elf.so.hints' '%setc/ld.so.conf'") % \
-				(ldconfig, normalize_path(target_root+EPREFIX), normalize_path(target_root+EPREFIX)))
+				(ldconfig, target_root+EPREFIX.lstrip(os.path.sep), target_root+EPREFIX.lstrip(os.path.sep)))
 
 	del specials["LDPATH"]
@@ -691,5 +691,5 @@
 
 	#create /etc/profile.env for bash support
-	outfile = atomic_ofstream(os.path.join(normalize_path(target_root + EPREFIX), "etc", "profile.env"))
+	outfile = atomic_ofstream(os.path.join(target_root + EPREFIX.lstrip(os.path.sep), "etc", "profile.env"))
 	outfile.write(penvnotice)
 
@@ -701,5 +701,5 @@
 
 	#create /etc/csh.env for (t)csh support
-	outfile = atomic_ofstream(os.path.join(normalize_path(target_root + EPREFIX), "etc", "csh.env"))
+	outfile = atomic_ofstream(os.path.join(target_root + EPREFIX.lstrip(os.path.sep), "etc", "csh.env"))
 	outfile.write(cenvnotice)
 	for x in env_keys:
@@ -944,5 +944,5 @@
 				config_root)).rstrip(os.path.sep) + os.path.sep
 
-			check_var_directory("PORTAGE_CONFIGROOT", normalize_path(config_root + EPREFIX))
+			check_var_directory("PORTAGE_CONFIGROOT", config_root + EPREFIX.lstrip(os.path.sep))
 
 			self.depcachedir = DEPCACHE_PATH
@@ -1080,5 +1080,5 @@
 
 			try:
-				self.mygcfg   = getconfig(os.path.join(normalize_path(config_root + EPREFIX), "etc", "make.globals"))
+				self.mygcfg   = getconfig(os.path.join(config_root + EPREFIX.lstrip(os.path.sep), "etc", "make.globals"))
 
 				if self.mygcfg is None:
@@ -1190,8 +1190,8 @@
 				target_root)).rstrip(os.path.sep) + os.path.sep
 
-			check_var_directory("ROOT", normalize_path(target_root + EPREFIX))
+			check_var_directory("ROOT", target_root + EPREFIX.lstrip(os.path.sep))
 
 			env_d = getconfig(
-				os.path.join(normalize_path(target_root + EPREFIX), "etc", "profile.env"), expand=False)
+				os.path.join(target_root + EPREFIX.lstrip(os.path.sep), "etc", "profile.env"), expand=False)
 			# env_d will be None if profile.env doesn't exist.
 			if env_d:
@@ -1216,5 +1216,5 @@
 			self["EPREFIX"] = EPREFIX
 			self.backup_changes("EPREFIX")
-			self["EROOT"] = normalize_path(target_root + EPREFIX) + os.sep
+			self["EROOT"] = normalize_path(target_root + EPREFIX.lstrip(os.path.sep)) + os.sep
 			self.backup_changes("EROOT")
 
@@ -1490,5 +1490,5 @@
 		for mypath, (gid, mode, modemask) in dir_mode_map.iteritems():
 			try:
-				mydir = normalize_path(os.path.join(self["ROOT"] + EPREFIX, mypath))
+				mydir = normalize_path(os.path.join(self["ROOT"] + EPREFIX.lstrip(os.path.sep), mypath))
 				portage.util.ensure_dirs(mydir, gid=gid, mode=mode, mask=modemask)
 			except portage.exception.PortageException, e:
@@ -1898,5 +1898,5 @@
 		self.configdict["env.d"].clear()
 		env_d = getconfig(
-			os.path.join(normalize_path(self["ROOT"] + EPREFIX), "etc", "profile.env"), expand=False)
+			os.path.join(self["ROOT"] + EPREFIX.lstrip(os.path.sep), "etc", "profile.env"), expand=False)
 		if env_d:
 			# env_d will be None if profile.env doesn't exist.
@@ -3213,5 +3213,5 @@
 	mysettings["EPREFIX"]  = EPREFIX.rstrip(os.sep)
 	mysettings["ROOT"]     = myroot
-	mysettings["EROOT"]    = normalize_path(myroot + mysettings["EPREFIX"]) + os.sep
+	mysettings["EROOT"]    = normalize_path(myroot + mysettings["EPREFIX"].lstrip(os.path.sep)) + os.sep
 	mysettings["STARTDIR"] = getcwd()
 
@@ -3289,5 +3289,5 @@
 	#set up KV variable -- DEP SPEEDUP :: Don't waste time. Keep var persistent.
 	if (mydo!="depend") or not mysettings.has_key("KV"):
-		mykv,err1=ExtractKernelVersion(os.path.join(normalize_path(myroot + EPREFIX), "usr/src/linux"))
+		mykv,err1=ExtractKernelVersion(os.path.join(myroot + EPREFIX.lstrip(os.path.sep), "usr/src/linux"))
 		if mykv:
 			# Regular source tree
@@ -4153,7 +4153,7 @@
 def merge(mycat, mypkg, pkgloc, infloc, myroot, mysettings, myebuild=None,
 	mytree=None, mydbapi=None, vartree=None, prev_mtimes=None):
-	if not os.access(normalize_path(myroot+EPREFIX).lstrip("/"), os.W_OK):
+	if not os.access(myroot+EPREFIX.lstrip(os.path.sep), os.W_OK):
 		writemsg("Permission denied: access('%s', W_OK)\n" %
-				(normalize_path(myroot+EPREFIX).lstrip("/")), noiselevel=-1)
+				(myroot+EPREFIX.lstrip(os.path.sep)), noiselevel=-1)
 		return errno.EACCES
 	mylink = dblink(mycat, mypkg, myroot, mysettings, treetype=mytree,
Index: trunk/essentials/sys-apps/prefix-portage/pym/portage/const.py
===================================================================
--- trunk/essentials/sys-apps/prefix-portage/pym/portage/const.py	(revision 3501)
+++ trunk/essentials/sys-apps/prefix-portage/pym/portage/const.py	(revision 3502)
@@ -73,4 +73,9 @@
 	MANIFEST1_HASH_FUNCTIONS = ["MD5"]
 	MANIFEST2_HASH_FUNCTIONS = ["SHA1"]
+    
+# bird: Added EXEEXT for appending ".exe" on OS/2 and windows.
+EXEEXT                  = "@EXEEXT"
+if EXEEXT == "@"+"EXEEXT"+"@":
+	EXEEXT              = ""
 
 # ===========================================================================
Index: trunk/essentials/sys-apps/prefix-portage/pym/portage/dbapi/vartree.py
===================================================================
--- trunk/essentials/sys-apps/prefix-portage/pym/portage/dbapi/vartree.py	(revision 3501)
+++ trunk/essentials/sys-apps/prefix-portage/pym/portage/dbapi/vartree.py	(revision 3502)
@@ -404,5 +404,5 @@
 			return mymatch
 		try:
-			curmtime = os.stat(self.root+VDB_PATH+"/"+mycat)[stat.ST_MTIME]
+			curmtime = os.stat(os.path.join(self.root, VDB_PATH+"/"+mycat))[stat.ST_MTIME]
 		except (IOError, OSError):
 			curmtime=0
Index: trunk/essentials/sys-apps/prefix-portage/pym/portage/util.py
===================================================================
--- trunk/essentials/sys-apps/prefix-portage/pym/portage/util.py	(revision 3501)
+++ trunk/essentials/sys-apps/prefix-portage/pym/portage/util.py	(revision 3502)
@@ -48,5 +48,4 @@
 			 mypath = mypath[1:]
 		elif mypath[:12] == "///@unixroot":
-			 print "dbg: %s -> %s\n" % (mypath, mypath[2:])
 			 mypath = mypath[2:]
 		return os.path.normpath(mypath)
@@ -948,5 +947,5 @@
 		for x in self.protect_list:
 			ppath = normalize_path(
-				os.path.join(self.myroot + EPREFIX, x.lstrip(os.path.sep)))
+				os.path.join(self.myroot + EPREFIX.lstrip(os.path.sep), x.lstrip(os.path.sep)))
 			mystat = None
 			try:
@@ -961,5 +960,5 @@
 		for x in self.mask_list:
 			ppath = normalize_path(
-				os.path.join(self.myroot + EPREFIX, x.lstrip(os.path.sep)))
+				os.path.join(self.myroot + EPREFIX.lstrip(os.path.sep), x.lstrip(os.path.sep)))
 			mystat = None
 			try:
