continue
prot_num = prot_num + 1
- new_pfile = os.path.normpath(real_dirname+"/._cfg"+string.zfill(prot_num,4)+"_"+real_filename)
- old_pfile = os.path.normpath(real_dirname+"/"+last_pfile)
+ new_pfile = normalize_path(os.path.join(real_dirname,
+ "._cfg" + str(prot_num).zfill(4) + "_" + real_filename))
+ old_pfile = normalize_path(os.path.join(real_dirname, last_pfile))
if last_pfile and newmd5:
if portage_checksum.perform_md5(real_dirname+"/"+last_pfile) == newmd5:
return old_pfile
self.backupenv = os.environ.copy()
config_root = \
- os.path.normpath(config_root).rstrip(os.path.sep) + os.path.sep
+ normalize_path(config_root).rstrip(os.path.sep) + os.path.sep
target_root = \
- os.path.normpath(target_root).rstrip(os.path.sep) + os.path.sep
+ normalize_path(target_root).rstrip(os.path.sep) + os.path.sep
for k, v in (("PORTAGE_CONFIGROOT", config_root),
("ROOT", target_root)):
raise portage_exception.ParseError(
"Expected 1 parent and got %i: '%s'" % \
(len(parents), parents_file))
- mypath = os.path.normpath(os.path.join(
+ mypath = normalize_path(os.path.join(
mypath, parents[0]))
if os.path.exists(mypath):
self.profiles.insert(0, mypath)
abs_user_config]
overlay_profiles = []
for ov in self["PORTDIR_OVERLAY"].split():
- ov = os.path.normpath(ov)
+ ov = normalize_path(ov)
profiles_dir = os.path.join(ov, "profiles")
if os.path.isdir(profiles_dir):
overlay_profiles.append(profiles_dir)
if overlays:
new_ov=[]
for ov in overlays:
- ov=os.path.normpath(ov)
+ ov = normalize_path(ov)
if os.path.isdir(ov):
new_ov.append(ov)
else:
if mysettings.configdict["pkg"].has_key("CATEGORY"):
cat = mysettings.configdict["pkg"]["CATEGORY"]
else:
- cat = os.path.basename(os.path.normpath(pkg_dir+"/.."))
+ cat = os.path.basename(normalize_path(os.path.join(pkg_dir, "..")))
mypv = os.path.basename(ebuild_path)[:-7]
mycpv = cat+"/"+mypv
mysplit=pkgsplit(mypv,silent=0)
locations.append(os.path.join(settings["PORTAGE_CONFIGROOT"],
USER_CONFIG_PATH.lstrip(os.path.sep)))
for ov in settings["PORTDIR_OVERLAY"].split():
- profdir = os.path.join(os.path.normpath(ov), "profiles")
+ profdir = os.path.join(normalize_path(ov), "profiles")
if os.path.isdir(profdir):
locations.append(profdir)
locations.reverse()
vartree = db[myroot]["vartree"]
self.vartree = vartree
- self.dbroot = os.path.normpath(myroot+VDB_PATH)
+ self.dbroot = normalize_path(os.path.join(myroot, VDB_PATH))
self.dbcatdir = self.dbroot+"/"+cat
self.dbpkgdir = self.dbcatdir+"/"+pkg
self.dbtmpdir = self.dbcatdir+"/-MERGING-"+pkg
# we do this so we can remove from non-root filesystems
# (use the ROOT var to allow maintenance on other partitions)
try:
- mydat[1] = os.path.normpath(os.path.join(
+ mydat[1] = normalize_path(os.path.join(
self.myroot, mydat[1].lstrip(os.path.sep)))
if mydat[0]=="obj":
#format: type, mtime, md5sum
mydirs=[]
modprotect="/lib/modules/"
for objkey in mykeys:
- obj=os.path.normpath(objkey)
+ obj = normalize_path(objkey)
if obj[:2]=="//":
obj=obj[1:]
statobj = None
def isowner(self,filename,destroot):
""" check if filename is a new file or belongs to this package
(for this or a previous version)"""
- destfile = os.path.normpath(destroot+"/"+filename)
+ destfile = normalize_path(
+ os.path.join(destroot, filename.lstrip(os.path.sep)))
if not os.path.exists(destfile):
return True
if self.getcontents() and filename in self.getcontents().keys():
return 0
def mergeme(self,srcroot,destroot,outfile,secondhand,stufftomerge,cfgfiledict,thismtime):
- from os.path import sep, normpath, join
- srcroot = normpath(3*sep + srcroot).rstrip(sep) + sep
- destroot = normpath(3*sep + destroot).rstrip(sep) + sep
+ from os.path import sep, join
+ srcroot = normalize_path(srcroot).rstrip(sep) + sep
+ destroot = normalize_path(destroot).rstrip(sep) + sep
# this is supposed to merge a list of files. There will be 2 forms of argument passing.
if type(stufftomerge)==types.StringType:
#A directory is specified. Figure out protection paths, listdir() it and process it.
myto=myto[len(self.settings["D"]):]
# myrealto contains the path of the real file to which this symlink points.
# we can simply test for existence of this file to see if the target has been merged yet
- myrealto=os.path.normpath(os.path.join(destroot,myabsto))
+ myrealto = normalize_path(os.path.join(destroot, myabsto))
if mydmode!=None:
#destination exists
if not stat.S_ISLNK(mydmode):