MOVE_BINARY, PRELINK_BINARY, WORLD_FILE, MAKE_CONF_FILE, MAKE_DEFAULTS_FILE, \
DEPRECATED_PROFILE_FILE, USER_VIRTUALS_FILE, EBUILD_SH_ENV_FILE, \
INVALID_ENV_FILE, CUSTOM_MIRRORS_FILE, CONFIG_MEMORY_FILE,\
- INCREMENTALS, EAPI, MISC_SH_BINARY
+ INCREMENTALS, EAPI, MISC_SH_BINARY, EPREFIX
from portage_data import ostype, lchown, userland, secpass, uid, wheelgid, \
portage_uid, portage_gid, userpriv_groups
if prev_mtimes is None:
global mtimedb
prev_mtimes = mtimedb["ldpath"]
- envd_dir = os.path.join(target_root + portage_const.EPREFIX, "etc", "env.d")
+ envd_dir = os.path.join(target_root + EPREFIX, "etc", "env.d")
portage_util.ensure_dirs(envd_dir, mode=0755)
fns = listdir(envd_dir, EmptyOnError=1)
fns.sort()
they won't be overwritten by this dict.update call."""
env.update(myconfig)
- ldsoconf_path = os.path.join(target_root + portage_const.EPREFIX, "etc", "ld.so.conf")
+ ldsoconf_path = os.path.join(target_root + EPREFIX, "etc", "ld.so.conf")
try:
myld = open(ldsoconf_path)
myldlines=myld.readlines()
#ld.so.conf needs updating and ldconfig needs to be run
myfd = atomic_ofstream(ldsoconf_path)
myfd.write("# ld.so.conf autogenerated by env-update; make all changes to\n")
- myfd.write("# contents of "+portage_const.EPREFIX+"/etc/env.d directory\n")
+ myfd.write("# contents of "+EPREFIX+"/etc/env.d directory\n")
for x in specials["LDPATH"]:
myfd.write(x+"\n")
myfd.close()
# Update prelink.conf if we are prelink-enabled
if prelink_capable:
newprelink = atomic_ofstream(
- os.path.join(target_root + portage_const.EPREFIX, "etc", "prelink.conf"))
+ os.path.join(target_root + EPREFIX, "etc", "prelink.conf"))
newprelink.write("# prelink.conf autogenerated by env-update; make all changes to\n")
- newprelink.write("# contents of "+portage_const.EPREFIX+"/etc/env.d directory\n")
+ newprelink.write("# contents of "+EPREFIX+"/etc/env.d directory\n")
- for x in map(lambda x: os.path.join(portage_const.EPREFIX,x), ["bin","sbin","usr/bin","usr/sbin","lib","usr/lib"]):
+ for x in map(lambda x: os.path.join(EPREFIX,x), ["bin","sbin","usr/bin","usr/sbin","lib","usr/lib"]):
newprelink.write("-l "+x+"\n");
for x in specials["LDPATH"]+specials["PATH"]+specials["PRELINK_PATH"]:
if not x:
mtime_changed = False
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(target_root + portage_const.EPREFIX, lib_dir.lstrip(os.sep))
+ x = os.path.join(target_root + EPREFIX, lib_dir.lstrip(os.sep))
try:
newldpathtime = os.stat(x)[stat.ST_MTIME]
lib_dirs.add(normalize_path(x))
# an older package installed ON TOP of a newer version will cause ldconfig
# 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" % (target_root+portage_const.EPREFIX))
+ writemsg(">>> Regenerating %s/etc/ld.so.cache...\n" % (target_root+EPREFIX))
if makelinks:
- commands.getstatusoutput("cd / ; "+portage_const.EPREFIX+"/sbin/ldconfig -r '%s'" % target_root)
+ commands.getstatusoutput("cd / ; "+EPREFIX+"/sbin/ldconfig -r '%s'" % target_root)
else:
- commands.getstatusoutput("cd / ; "+portage_const.EPREFIX+"/sbin/ldconfig -X -r '%s'" % target_root)
+ commands.getstatusoutput("cd / ; "+EPREFIX+"/sbin/ldconfig -X -r '%s'" % target_root)
elif ostype in ("FreeBSD","DragonFly"):
- writemsg(">>> Regenerating %svar/run/ld-elf.so.hints...\n" % target_root+portage_const.EPREFIX+os.sep)
+ writemsg(">>> Regenerating %svar/run/ld-elf.so.hints...\n" % target_root+EPREFIX+os.sep)
commands.getstatusoutput(
- "cd / ; "+portage_const.EPREFIX+"/sbin/ldconfig -elf -i -f '%s/var/run/ld-elf.so.hints' '%s/etc/ld.so.conf'" % \
- (target_root+portage_const.EPREFIX, target_root+portage_const.EPREFIX))
+ "cd / ; "+EPREFIX+"/sbin/ldconfig -elf -i -f '%s/var/run/ld-elf.so.hints' '%s/etc/ld.so.conf'" % \
+ (target_root+EPREFIX, target_root+EPREFIX))
del specials["LDPATH"]
penvnotice = "# THIS FILE IS AUTOMATICALLY GENERATED BY env-update.\n"
penvnotice += "# DO NOT EDIT THIS FILE. CHANGES TO STARTUP PROFILES\n"
cenvnotice = penvnotice[:]
- penvnotice += "# GO INTO "+portage_const.EPREFIX+"/etc/profile NOT "+portage_const.EPREFIX+"/etc/profile.env\n\n"
- cenvnotice += "# GO INTO "+portage_const.EPREFIX+"/etc/csh.cshrc NOT "+portage_const.EPREFIX+"/etc/csh.env\n\n"
+ penvnotice += "# GO INTO "+EPREFIX+"/etc/profile NOT "+EPREFIX+"/etc/profile.env\n\n"
+ cenvnotice += "# GO INTO "+EPREFIX+"/etc/csh.cshrc NOT "+EPREFIX+"/etc/csh.env\n\n"
#create /etc/profile.env for bash support
- outfile = atomic_ofstream(os.path.join(target_root + portage_const.EPREFIX, "etc", "profile.env"))
+ outfile = atomic_ofstream(os.path.join(target_root + EPREFIX, "etc", "profile.env"))
outfile.write(penvnotice)
env_keys = [ x for x in env if x != "LDPATH" ]
outfile.close()
#create /etc/csh.env for (t)csh support
- outfile = atomic_ofstream(os.path.join(target_root + portage_const.EPREFIX, "etc", "csh.env"))
+ outfile = atomic_ofstream(os.path.join(target_root + EPREFIX, "etc", "csh.env"))
outfile.write(cenvnotice)
for x in env_keys:
outfile.write("setenv %s '%s'\n" % (x, env[x]))
for k, v in (("PORTAGE_CONFIGROOT", config_root),
("ROOT", target_root)):
- v = v + portage_const.EPREFIX
+ v = v + EPREFIX
if not os.path.isdir(v):
writemsg("!!! Error: %s='%s' is not a directory. Please correct this.\n" % (k, v),
noiselevel=-1)
try:
mygcfg_dlists = [getconfig(os.path.join(x, "make.globals")) \
- for x in self.profiles + [os.path.join(config_root + portage_const.EPREFIX, "etc")]]
+ for x in self.profiles + [os.path.join(config_root + EPREFIX, "etc")]]
self.mygcfg = stack_dicts(mygcfg_dlists, incrementals=portage_const.INCREMENTALS, ignore_none=1)
if self.mygcfg is None:
raise
except Exception, e:
writemsg("!!! %s\n" % (e), noiselevel=-1)
- writemsg("!!! 'rm -Rf %s/usr/portage/profiles; emerge sync' may fix this. If it does\n" % portage_const.EPREFIX,
+ writemsg("!!! 'rm -Rf %s/usr/portage/profiles; emerge sync' may fix this. If it does\n" % EPREFIX,
noiselevel=-1)
writemsg("!!! not then please report this to bugs.gentoo.org and, if possible, a dev\n",
noiselevel=-1)
del blacklisted, cfg
env_d = getconfig(
- os.path.join(target_root + portage_const.EPREFIX, "etc", "profile.env"), expand=False)
+ os.path.join(target_root + EPREFIX, "etc", "profile.env"), expand=False)
# env_d will be None if profile.env doesn't exist.
if env_d:
self.configdict["env.d"].update(env_d)
def _init_dirs(self):
"""Create tmp, var/tmp and var/lib/portage (relative to $ROOT)."""
- if not os.access(self["ROOT"] + portage_const.EPREFIX, os.W_OK):
+ if not os.access(self["ROOT"] + EPREFIX, os.W_OK):
return
dir_mode_map = {
for mypath, (gid, mode, modemask) in dir_mode_map.iteritems():
try:
mydir = normalize_path(
- os.path.join(self["ROOT"] + portage_const.EPREFIX, mypath))
+ os.path.join(self["ROOT"] + EPREFIX, mypath))
portage_util.ensure_dirs(mydir, gid=gid, mode=mode, mask=modemask)
except portage_exception.PortageException, e:
writemsg("!!! Directory initialization failed: '%s'\n" % mydir,
# We grab the latest profile.env here since it changes frequently.
self.configdict["env.d"].clear()
env_d = getconfig(
- os.path.join(self["ROOT"] + portage_const.EPREFIX, "etc", "profile.env"), expand=False)
+ os.path.join(self["ROOT"] + EPREFIX, "etc", "profile.env"), expand=False)
if env_d:
# env_d will be None if profile.env doesn't exist.
self.configdict["env.d"].update(env_d)
# due to how it's coded... Don't overwrite this so we can use it.
mysettings["PORTAGE_DEBUG"] = "1"
- mysettings["EPREFIX"] = portage_const.EPREFIX.rstrip(os.sep)
+ mysettings["EPREFIX"] = EPREFIX.rstrip(os.sep)
mysettings["ROOT"] = myroot
mysettings["EROOT"] = normalize_path(myroot + mysettings["EPREFIX"]) + os.sep
mysettings["STARTDIR"] = getcwd()
#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(myroot + portage_const.EPREFIX, "usr/src/linux"))
+ mykv,err1=ExtractKernelVersion(os.path.join(myroot + EPREFIX, "usr/src/linux"))
if mykv:
# Regular source tree
mysettings["KV"]=mykv
def counter_tick_core(self,myroot,incrementing=1,mycpv=None):
"This method will grab the next COUNTER value and record it back to the global file. Returns new counter value."
- cpath=os.path.join(myroot+portage_const.EPREFIX, "var/cache/edb/counter")
+ cpath=os.path.join(myroot+EPREFIX, "var/cache/edb/counter")
changed=0
min_counter = 0
if mycpv:
raise ValueError
self.myroot=myroot
- protect_obj = portage_util.ConfigProtect(myroot + portage_const.EPREFIX,
+ protect_obj = portage_util.ConfigProtect(myroot + EPREFIX,
mysettings.get("CONFIG_PROTECT","").split(),
mysettings.get("CONFIG_PROTECT_MASK","").split())
self.updateprotect = protect_obj.updateprotect
# we do a first merge; this will recurse through all files in our srcroot but also build up a
# "second hand" of symlinks to merge later
- if self.mergeme(srcroot,destroot,outfile,secondhand,portage_const.EPREFIX.lstrip(os.path.sep),cfgfiledict,mymtime):
+ if self.mergeme(srcroot,destroot,outfile,secondhand,EPREFIX.lstrip(os.path.sep),cfgfiledict,mymtime):
return 1
# now, it's time for dealing our second hand; we'll loop until we can't merge anymore. The rest are