Changeset 3502


Ignore:
Timestamp:
Jun 19, 2007, 4:04:19 AM (18 years ago)
Author:
bird
Message:

use EPREFIX.lstrip(os.path.sep) instead of normalize_path. Added EXEEXT.

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

Legend:

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

    r3494 r3502  
    4848import portage.locks
    4949import portage.exception
    50 from portage.const import EPREFIX
     50from portage.const import EPREFIX, EXEEXT
    5151from portage.data import secpass
    5252from portage.util import normalize_path as normpath
     
    38483848        from portage.util import normalize_path
    38493849        if "noinfo" not in settings.features:
    3850                 chk_updated_info_files(normalize_path(target_root + EPREFIX), infodirs, info_mtimes, retval)
    3851         chk_updated_cfg_files(normalize_path(target_root + EPREFIX), config_protect)
     3850                chk_updated_info_files(target_root + EPREFIX.lstrip(os.path.sep), infodirs, info_mtimes, retval)
     3851        chk_updated_cfg_files(target_root + EPREFIX.lstrip(os.path.sep), config_protect)
    38523852       
    38533853        display_news_notification(settings)
     
    39803980                tmpservertimestampfile = None
    39813981        elif syncuri[:8]=="rsync://":
    3982                 if not os.path.exists(EPREFIX+"/usr/bin/rsync"):
     3982                if not os.path.exists(EPREFIX+"/usr/bin/rsync"+EXEEXT):
    39833983                        print "!!! rsync does not exist, so rsync support is disabled."
    39843984                        print "!!! Type \"emerge net-misc/rsync\" to enable rsync support."
     
    41964196                                print ">>> Checking server timestamp ..."
    41974197
    4198                         rsynccommand = [EPREFIX+"/usr/bin/rsync"] + rsync_opts + extra_rsync_opts
     4198                        rsynccommand = [EPREFIX+"/usr/bin/rsync"+EXEEXT] + rsync_opts + extra_rsync_opts
    41994199
    42004200                        if "--debug" in myopts:
     
    43354335                        sys.exit(exitcode)
    43364336        elif syncuri[:6]=="cvs://":
    4337                 if not os.path.exists(EPREFIX+"/usr/bin/cvs"):
     4337                if not os.path.exists(EPREFIX+"/usr/bin/cvs"+EXEEXT):
    43384338                        print "!!! cvs does not exist, so CVS support is disabled."
    43394339                        print "!!! Type \"emerge dev-util/cvs\" to enable CVS support."
     
    43694369        elif syncuri[:11]=="svn+http://":
    43704370                # this should be way more generic!
    4371                 if not os.path.exists(EPREFIX+"/usr/bin/svn"):
     4371                if not os.path.exists(EPREFIX+"/usr/bin/svn"+EXEEXT):
    43724372                        print "!!! svn does not exist, so SVN support is disabled."
    43734373                        print "!!! Type \"emerge dev-util/subversion\" to enable SVN support."
     
    46484648        print header_width * "="
    46494649        print "System uname: "+unameout
     4650        from portage.util import normalize_path
     4651        foo = os.path.join(settings["PORTAGE_CONFIGROOT"] + EPREFIX.lstrip(os.path.sep), "etc", "gentoo-release")
    46504652        gentoo_release = portage.grabfile(os.path.join(
    4651                 settings["PORTAGE_CONFIGROOT"] + EPREFIX, "etc", "gentoo-release"))
     4653                settings["PORTAGE_CONFIGROOT"] + EPREFIX.lstrip(os.path.sep), "etc", "gentoo-release"))
    46524654        if gentoo_release:
    46534655                print gentoo_release[0]
  • trunk/essentials/sys-apps/prefix-portage/pym/portage/__init__.py

    r3501 r3502  
    472472        if env is None:
    473473                env = os.environ
    474         envd_dir = os.path.join(normalize_path(target_root + EPREFIX), "etc", "env.d")
     474        envd_dir = os.path.join(target_root + EPREFIX.lstrip(os.path.sep), "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(normalize_path(target_root + EPREFIX), "etc", "ld.so.conf")
     549        ldsoconf_path = os.path.join(target_root + EPREFIX.lstrip(os.path.sep), "etc", "ld.so.conf")
    550550        try:
    551551                myld = open(ldsoconf_path)
     
    579579        if prelink_capable:
    580580                newprelink = atomic_ofstream(
    581                         os.path.join(normalize_path(target_root + EPREFIX), "etc", "prelink.conf"))
     581                        os.path.join(target_root + EPREFIX.lstrip(os.path.sep), "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(normalize_path(target_root + EPREFIX), lib_dir.lstrip(os.sep))
     616                x = os.path.join(target_root + EPREFIX.lstrip(os.path.sep), 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" % (normalize_path(target_root+EPREFIX)))
     672                        writemsg(">>> Regenerating %s/etc/ld.so.cache...\n" % (target_root+EPREFIX.lstrip(os.path.sep)))
    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                                 normalize_path(target_root+EPREFIX))
     679                                target_root+EPREFIX.lstrip(os.path.sep))
    680680                        os.system(("cd / ; %s -elf -i " + \
    681681                                "-f '%svar/run/ld-elf.so.hints' '%setc/ld.so.conf'") % \
    682                                 (ldconfig, normalize_path(target_root+EPREFIX), normalize_path(target_root+EPREFIX)))
     682                                (ldconfig, target_root+EPREFIX.lstrip(os.path.sep), target_root+EPREFIX.lstrip(os.path.sep)))
    683683
    684684        del specials["LDPATH"]
     
    691691
    692692        #create /etc/profile.env for bash support
    693         outfile = atomic_ofstream(os.path.join(normalize_path(target_root + EPREFIX), "etc", "profile.env"))
     693        outfile = atomic_ofstream(os.path.join(target_root + EPREFIX.lstrip(os.path.sep), "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(normalize_path(target_root + EPREFIX), "etc", "csh.env"))
     703        outfile = atomic_ofstream(os.path.join(target_root + EPREFIX.lstrip(os.path.sep), "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", normalize_path(config_root + EPREFIX))
     946                        check_var_directory("PORTAGE_CONFIGROOT", config_root + EPREFIX.lstrip(os.path.sep))
    947947
    948948                        self.depcachedir = DEPCACHE_PATH
     
    10801080
    10811081                        try:
    1082                                 self.mygcfg   = getconfig(os.path.join(normalize_path(config_root + EPREFIX), "etc", "make.globals"))
     1082                                self.mygcfg   = getconfig(os.path.join(config_root + EPREFIX.lstrip(os.path.sep), "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", normalize_path(target_root + EPREFIX))
     1192                        check_var_directory("ROOT", target_root + EPREFIX.lstrip(os.path.sep))
    11931193
    11941194                        env_d = getconfig(
    1195                                 os.path.join(normalize_path(target_root + EPREFIX), "etc", "profile.env"), expand=False)
     1195                                os.path.join(target_root + EPREFIX.lstrip(os.path.sep), "etc", "profile.env"), expand=False)
    11961196                        # env_d will be None if profile.env doesn't exist.
    11971197                        if env_d:
     
    12161216                        self["EPREFIX"] = EPREFIX
    12171217                        self.backup_changes("EPREFIX")
    1218                         self["EROOT"] = normalize_path(target_root + EPREFIX) + os.sep
     1218                        self["EROOT"] = normalize_path(target_root + EPREFIX.lstrip(os.path.sep)) + os.sep
    12191219                        self.backup_changes("EROOT")
    12201220
     
    14901490                for mypath, (gid, mode, modemask) in dir_mode_map.iteritems():
    14911491                        try:
    1492                                 mydir = normalize_path(os.path.join(self["ROOT"] + EPREFIX, mypath))
     1492                                mydir = normalize_path(os.path.join(self["ROOT"] + EPREFIX.lstrip(os.path.sep), mypath))
    14931493                                portage.util.ensure_dirs(mydir, gid=gid, mode=mode, mask=modemask)
    14941494                        except portage.exception.PortageException, e:
     
    18981898                self.configdict["env.d"].clear()
    18991899                env_d = getconfig(
    1900                         os.path.join(normalize_path(self["ROOT"] + EPREFIX), "etc", "profile.env"), expand=False)
     1900                        os.path.join(self["ROOT"] + EPREFIX.lstrip(os.path.sep), "etc", "profile.env"), expand=False)
    19011901                if env_d:
    19021902                        # env_d will be None if profile.env doesn't exist.
     
    32133213        mysettings["EPREFIX"]  = EPREFIX.rstrip(os.sep)
    32143214        mysettings["ROOT"]     = myroot
    3215         mysettings["EROOT"]    = normalize_path(myroot + mysettings["EPREFIX"]) + os.sep
     3215        mysettings["EROOT"]    = normalize_path(myroot + mysettings["EPREFIX"].lstrip(os.path.sep)) + os.sep
    32163216        mysettings["STARTDIR"] = getcwd()
    32173217
     
    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(normalize_path(myroot + EPREFIX), "usr/src/linux"))
     3291                mykv,err1=ExtractKernelVersion(os.path.join(myroot + EPREFIX.lstrip(os.path.sep), "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(normalize_path(myroot+EPREFIX).lstrip("/"), os.W_OK):
     4155        if not os.access(myroot+EPREFIX.lstrip(os.path.sep), os.W_OK):
    41564156                writemsg("Permission denied: access('%s', W_OK)\n" %
    4157                                 (normalize_path(myroot+EPREFIX).lstrip("/")), noiselevel=-1)
     4157                                (myroot+EPREFIX.lstrip(os.path.sep)), noiselevel=-1)
    41584158                return errno.EACCES
    41594159        mylink = dblink(mycat, mypkg, myroot, mysettings, treetype=mytree,
  • trunk/essentials/sys-apps/prefix-portage/pym/portage/const.py

    r3499 r3502  
    7373        MANIFEST1_HASH_FUNCTIONS = ["MD5"]
    7474        MANIFEST2_HASH_FUNCTIONS = ["SHA1"]
     75   
     76# bird: Added EXEEXT for appending ".exe" on OS/2 and windows.
     77EXEEXT                  = "@EXEEXT"
     78if EXEEXT == "@"+"EXEEXT"+"@":
     79        EXEEXT              = ""
    7580
    7681# ===========================================================================
  • trunk/essentials/sys-apps/prefix-portage/pym/portage/dbapi/vartree.py

    r3488 r3502  
    404404                        return mymatch
    405405                try:
    406                         curmtime = os.stat(self.root+VDB_PATH+"/"+mycat)[stat.ST_MTIME]
     406                        curmtime = os.stat(os.path.join(self.root, VDB_PATH+"/"+mycat))[stat.ST_MTIME]
    407407                except (IOError, OSError):
    408408                        curmtime=0
  • trunk/essentials/sys-apps/prefix-portage/pym/portage/util.py

    r3501 r3502  
    4848                         mypath = mypath[1:]
    4949                elif mypath[:12] == "///@unixroot":
    50                          print "dbg: %s -> %s\n" % (mypath, mypath[2:])
    5150                         mypath = mypath[2:]
    5251                return os.path.normpath(mypath)
     
    948947                for x in self.protect_list:
    949948                        ppath = normalize_path(
    950                                 os.path.join(self.myroot + EPREFIX, x.lstrip(os.path.sep)))
     949                                os.path.join(self.myroot + EPREFIX.lstrip(os.path.sep), x.lstrip(os.path.sep)))
    951950                        mystat = None
    952951                        try:
     
    961960                for x in self.mask_list:
    962961                        ppath = normalize_path(
    963                                 os.path.join(self.myroot + EPREFIX, x.lstrip(os.path.sep)))
     962                                os.path.join(self.myroot + EPREFIX.lstrip(os.path.sep), x.lstrip(os.path.sep)))
    964963                        mystat = None
    965964                        try:
Note: See TracChangeset for help on using the changeset viewer.