Changeset 3501


Ignore:
Timestamp:
Jun 19, 2007, 2:44:17 AM (18 years ago)
Author:
bird
Message:

config_root + EPREFIX; target_root + EPREFIX; and someothers must be normalized to prevent them from ending up with stuff like '@unixroot' that would be interpreted as the start of an UNC path on OS/2. We enlist nromalize_path in this scheme.

Location:
trunk/essentials/sys-apps/prefix-portage/pym/portage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/essentials/sys-apps/prefix-portage/pym/portage/__init__.py

    r3488 r3501  
    472472        if env is None:
    473473                env = os.environ
    474         envd_dir = os.path.join(target_root + EPREFIX, "etc", "env.d")
     474        envd_dir = os.path.join(normalize_path(target_root + EPREFIX), "etc", "env.d")
    475475        portage.util.ensure_dirs(envd_dir, mode=0755)
    476476        fns = listdir(envd_dir, EmptyOnError=1)
     
    547547                env.update(myconfig)
    548548
    549         ldsoconf_path = os.path.join(target_root + EPREFIX, "etc", "ld.so.conf")
     549        ldsoconf_path = os.path.join(normalize_path(target_root + EPREFIX), "etc", "ld.so.conf")
    550550        try:
    551551                myld = open(ldsoconf_path)
     
    579579        if prelink_capable:
    580580                newprelink = atomic_ofstream(
    581                         os.path.join(target_root + EPREFIX, "etc", "prelink.conf"))
     581                        os.path.join(normalize_path(target_root + EPREFIX), "etc", "prelink.conf"))
    582582                newprelink.write("# prelink.conf autogenerated by env-update; make all changes to\n")
    583583                newprelink.write("# contents of "+EPREFIX+"/etc/env.d directory\n")
     
    614614        lib_dirs = set()
    615615        for lib_dir in portage.util.unique_array(specials["LDPATH"]+['usr/lib','usr/lib64','usr/lib32','lib','lib64','lib32']):
    616                 x = os.path.join(target_root + EPREFIX, lib_dir.lstrip(os.sep))
     616                x = os.path.join(normalize_path(target_root + EPREFIX), lib_dir.lstrip(os.sep))
    617617                try:
    618618                        newldpathtime = long(os.stat(x).st_mtime)
     
    670670                        # to overwrite the symlinks we just made. -X means no links. After 'clean'
    671671                        # we can safely create links.
    672                         writemsg(">>> Regenerating %s/etc/ld.so.cache...\n" % (target_root+EPREFIX))
     672                        writemsg(">>> Regenerating %s/etc/ld.so.cache...\n" % (normalize_path(target_root+EPREFIX)))
    673673                        if makelinks:
    674674                                os.system("cd / ; %s -r '%s'" % (ldconfig, target_root))
     
    677677                elif ostype in ("FreeBSD","DragonFly"):
    678678                        writemsg(">>> Regenerating %svar/run/ld-elf.so.hints...\n" % \
    679                                 target_root+EPREFIX)
     679                                normalize_path(target_root+EPREFIX))
    680680                        os.system(("cd / ; %s -elf -i " + \
    681681                                "-f '%svar/run/ld-elf.so.hints' '%setc/ld.so.conf'") % \
    682                                 (ldconfig, target_root+EPREFIX, target_root+EPREFIX))
     682                                (ldconfig, normalize_path(target_root+EPREFIX), normalize_path(target_root+EPREFIX)))
    683683
    684684        del specials["LDPATH"]
     
    691691
    692692        #create /etc/profile.env for bash support
    693         outfile = atomic_ofstream(os.path.join(target_root + EPREFIX, "etc", "profile.env"))
     693        outfile = atomic_ofstream(os.path.join(normalize_path(target_root + EPREFIX), "etc", "profile.env"))
    694694        outfile.write(penvnotice)
    695695
     
    701701
    702702        #create /etc/csh.env for (t)csh support
    703         outfile = atomic_ofstream(os.path.join(target_root + EPREFIX, "etc", "csh.env"))
     703        outfile = atomic_ofstream(os.path.join(normalize_path(target_root + EPREFIX), "etc", "csh.env"))
    704704        outfile.write(cenvnotice)
    705705        for x in env_keys:
     
    944944                                config_root)).rstrip(os.path.sep) + os.path.sep
    945945
    946                         check_var_directory("PORTAGE_CONFIGROOT", config_root + EPREFIX)
     946                        check_var_directory("PORTAGE_CONFIGROOT", normalize_path(config_root + EPREFIX))
    947947
    948948                        self.depcachedir = DEPCACHE_PATH
     
    10801080
    10811081                        try:
    1082                                 self.mygcfg   = getconfig(os.path.join(config_root + EPREFIX, "etc", "make.globals"))
     1082                                self.mygcfg   = getconfig(os.path.join(normalize_path(config_root + EPREFIX), "etc", "make.globals"))
    10831083
    10841084                                if self.mygcfg is None:
     
    11901190                                target_root)).rstrip(os.path.sep) + os.path.sep
    11911191
    1192                         check_var_directory("ROOT", target_root + EPREFIX)
     1192                        check_var_directory("ROOT", normalize_path(target_root + EPREFIX))
    11931193
    11941194                        env_d = getconfig(
    1195                                 os.path.join(target_root + EPREFIX, "etc", "profile.env"), expand=False)
     1195                                os.path.join(normalize_path(target_root + EPREFIX), "etc", "profile.env"), expand=False)
    11961196                        # env_d will be None if profile.env doesn't exist.
    11971197                        if env_d:
     
    14781478                Create a few directories that are critical to portage operation
    14791479                """
    1480                 if not os.access(self["ROOT"] + EPREFIX, os.W_OK):
     1480                if not os.access(normalize_path(self["ROOT"] + EPREFIX), os.W_OK):
    14811481                        return
    14821482
     
    18981898                self.configdict["env.d"].clear()
    18991899                env_d = getconfig(
    1900                         os.path.join(self["ROOT"] + EPREFIX, "etc", "profile.env"), expand=False)
     1900                        os.path.join(normalize_path(self["ROOT"] + EPREFIX), "etc", "profile.env"), expand=False)
    19011901                if env_d:
    19021902                        # env_d will be None if profile.env doesn't exist.
     
    32893289        #set up KV variable -- DEP SPEEDUP :: Don't waste time. Keep var persistent.
    32903290        if (mydo!="depend") or not mysettings.has_key("KV"):
    3291                 mykv,err1=ExtractKernelVersion(os.path.join(myroot + EPREFIX, "usr/src/linux"))
     3291                mykv,err1=ExtractKernelVersion(os.path.join(normalize_path(myroot + EPREFIX), "usr/src/linux"))
    32923292                if mykv:
    32933293                        # Regular source tree
     
    41534153def merge(mycat, mypkg, pkgloc, infloc, myroot, mysettings, myebuild=None,
    41544154        mytree=None, mydbapi=None, vartree=None, prev_mtimes=None):
    4155         if not os.access(myroot+EPREFIX.lstrip("/"), os.W_OK):
     4155        if not os.access(normalize_path(myroot+EPREFIX).lstrip("/"), os.W_OK):
    41564156                writemsg("Permission denied: access('%s', W_OK)\n" %
    4157                                 (myroot+EPREFIX.lstrip("/")), noiselevel=-1)
     4157                                (normalize_path(myroot+EPREFIX).lstrip("/")), noiselevel=-1)
    41584158                return errno.EACCES
    41594159        mylink = dblink(mycat, mypkg, myroot, mysettings, treetype=mytree,
  • trunk/essentials/sys-apps/prefix-portage/pym/portage/util.py

    r3494 r3501  
    4040        This doesn't apply to OS/2 kNIX where "//foo/bar" differs
    4141        from "/foo/bar" in that the former is a UNC path while the
    42         later is a local path.
     42        later is a local path. However, on OS/2 we must fix the silly
     43    //@unixroot -> /@unixroot that's caused by config_target+EPREFIX
     44    all over the 'ing place.
    4345        """
    44         if mypath.startswith(os.path.sep) and sys.platform != "os2knix"::
     46        if sys.platform == "os2knix":
     47                if mypath[:11] == "//@unixroot":
     48                         mypath = mypath[1:]
     49                elif mypath[:12] == "///@unixroot":
     50                         print "dbg: %s -> %s\n" % (mypath, mypath[2:])
     51                         mypath = mypath[2:]
     52                return os.path.normpath(mypath)
     53        elif mypath.startswith(os.path.sep):
    4554                # posixpath.normpath collapses 3 or more leading slashes to just 1.
    4655                return os.path.normpath(2*os.path.sep + mypath)
Note: See TracChangeset for help on using the changeset viewer.