type portageq > /dev/null || exit $?
eval $(portageq envvar -v FEATURES FETCHCOMMAND GENTOO_MIRRORS \
PORTAGE_BIN_PATH PORTAGE_INST_UID PORTAGE_INST_GID PORTAGE_NICENESS \
- PORTAGE_TMPDIR PORTDIR PORTAGE_RSYNC_EXTRA_OPTS EPREFIX)
+ PORTAGE_TMPDIR PORTDIR PORTAGE_RSYNC_EXTRA_OPTS http_proxy ftp_proxy EPREFIX)
DISTDIR="${PORTAGE_TMPDIR}/emerge-webrsync"
+export http_proxy ftp_proxy
# If PORTAGE_NICENESS is overriden via the env then it will
# still pass through the portageq call and override properly.
CONFIG_PROTECT="/etc"
# Disable auto-use
-USE_ORDER="env:pkg:conf:defaults:pkginternal"
+USE_ORDER="env:pkg:conf:defaults:pkginternal:env.d"
# Default portage user/group
PORTAGE_USER="@portageuser@"
packages. More information in \fBebuild\fR(5). Possible USE values
can be found in \fI/usr/portage/profiles/use.desc\fR.
.TP
+\fBUSE_EXPAND\fR = \fI[space delimited list of variable names]\fR
+Any variable listed here will be used to augment USE by inserting a new flag
+for every value in that variable, so USE_EXPAND="FOO" and FOO="bar bla" results
+in USE="foo_bar foo_bla".
+.TP
\fBUSE_EXPAND_HIDDEN\fR = \fI[space delimited list of variable names]\fR
Names of \fBUSE_EXPAND\fR variables that should not be shown in the verbose merge
list output of the \fBemerge\fR(1) command.
.TP
-\fBUSE_ORDER\fR = \fI"env:pkg:conf:defaults:pkginternal"\fR
+\fBUSE_ORDER\fR = \fI"env:pkg:conf:defaults:pkginternal:env.d"\fR
Determines the precedence of layers in the incremental stacking of the USE
variable. Precedence decreases from left to right such that env overrides
pkg, pkg overrides conf, and so forth.
.RS
.TP
.B env
-USE from the current USE environment variable if it exists
+USE from the current environment variables (USE and those listed in USE_EXPAND)
.TP
.B pkg
Per\-package USE from \fB/etc/portage/package.use\fR (see \fBportage\fR(5))
.TP
.B pkginternal
USE from ebuild IUSE defaults (flags enabled via a + prefix; see \fBebuild\fR(5))
+.TP
+.B env.d
+USE from the environment variables defined by files in \fI/etc/env.d/\fR
.RE
.SH "REPORTING BUGS"
.fi
.TP
.BR /etc/make.profile/
+site\-specific overrides go in \fB/etc/portage/profile/\fR
.nf
deprecated
make.defaults
packages
packages.build
+package.mask
package.provided
package.use
package.use.force
what a profile is (usually arch specific stuff). If you need a custom
profile, then you should make your own \fB/etc/make.profile/\fR
directory and populate it. However, if you just wish to override some
-settings, do NOT edit these files because they WILL be lost with the
-next `emerge \-\-sync`. See the section below on \fB/etc/portage/\fR for
-overriding.
+settings, use \fB/etc/portage/profile/\fR (it supports all of the same file
+types that \fB/etc/make.profile/\fR does, except parent). Do NOT edit the
+settings in \fB/etc/make.profile/\fR because they WILL be lost with the next
+`emerge \-\-sync`.
.RS
.TP
.BR deprecated
else:
def create_use_string(name, cur_iuse, iuse_forced, cur_use,
old_iuse, old_use,
- is_new, all_flags=(verbosity == 3 or "--quiet" in self.myopts),
+ is_new, reinst_flags,
+ all_flags=(verbosity == 3 or "--quiet" in self.myopts),
alphabetical=("--alphabetical" in self.myopts)):
enabled = []
if alphabetical:
for flag in any_iuse:
flag_str = None
isEnabled = False
+ reinst_flag = reinst_flags and flag in reinst_flags
if flag in enabled_flags:
isEnabled = True
- if is_new or flag in old_use and all_flags:
+ if is_new or flag in old_use and \
+ (all_flags or reinst_flag):
flag_str = red(flag)
elif flag not in old_iuse:
flag_str = yellow(flag) + "%*"
elif flag not in old_use:
flag_str = green(flag) + "*"
elif flag in removed_iuse:
- if all_flags:
+ if all_flags or reinst_flag:
flag_str = yellow("-" + flag) + "%"
if flag in old_use:
flag_str += "*"
removed.append(flag_str)
continue
else:
- if is_new or flag in old_iuse and flag not in old_use and all_flags:
+ if is_new or flag in old_iuse and \
+ flag not in old_use and \
+ (all_flags or reinst_flag):
flag_str = blue("-" + flag)
elif flag not in old_iuse:
flag_str = yellow("-" + flag)
# Prevent USE_EXPAND_HIDDEN flags from being hidden if they
# are the only thing that triggered reinstallation.
- reinst_flags_map = None
+ reinst_flags_map = {}
reinstall_for_flags = self._reinstall_nodes.get(pkg_node)
+ reinst_expand_map = None
if reinstall_for_flags:
reinst_flags_map = map_to_use_expand(
list(reinstall_for_flags), removeHidden=False)
- if reinst_flags_map["USE"]:
- reinst_flags_map = None
- else:
- for k in reinst_flags_map.keys():
- if not reinst_flags_map[k]:
- del reinst_flags_map[k]
- if reinst_flags_map and \
- not set(reinst_flags_map).difference(
+ for k in list(reinst_flags_map):
+ if not reinst_flags_map[k]:
+ del reinst_flags_map[k]
+ if not reinst_flags_map.get("USE"):
+ reinst_expand_map = reinst_flags_map.copy()
+ reinst_expand_map.pop("USE", None)
+ if reinst_expand_map and \
+ not set(reinst_expand_map).difference(
use_expand_hidden):
- use_expand_hidden = set(use_expand_hidden).difference(
- reinst_flags_map)
+ use_expand_hidden = \
+ set(use_expand_hidden).difference(
+ reinst_expand_map)
cur_iuse_map, iuse_forced = \
map_to_use_expand(cur_iuse, forcedFlags=True)
verboseadd += create_use_string(key.upper(),
cur_iuse_map[key], iuse_forced[key],
cur_use_map[key], old_iuse_map[key],
- old_use_map[key], is_new)
+ old_use_map[key], is_new,
+ reinst_flags_map.get(key))
if verbosity == 3:
# size verbose
if repo_name_prev:
repo_path_prev = portdb.getRepositoryPath(
repo_name_prev)
- if repo_path_prev == repo_path_real:
+ # To avoid spam during the transition period, don't
+ # show ? if the installed package is missing a
+ # repository label.
+ if not repo_path_prev or \
+ repo_path_prev == repo_path_real:
repoadd = repo_display.repoStr(repo_path_real)
else:
repoadd = "%s=>%s" % (
except OSError:
continue
if stat.S_ISDIR(mymode):
- mycommand = "cd '%s'; find . -iname '._cfg????_*'" % x
+ mycommand = "find '%s' -iname '._cfg????_*'" % x
else:
- mycommand = "cd '%s'; find . -maxdepth 1 -iname '._cfg????_%s'" % \
+ mycommand = "find '%s' -maxdepth 1 -iname '._cfg????_%s'" % \
os.path.split(x.rstrip(os.path.sep))
a = commands.getstatusoutput(mycommand + \
- " ! -iname '.*~' ! -iname '.*.bak'")
+ " ! -iname '.*~' ! -iname '.*.bak' -print0")
if a[0] != 0:
print >> sys.stderr, " " + bad("*")+ " error scanning '%s'" % x
else:
- files = a[1].split()
- if files:
+ files = a[1].split('\0')
+ if files != ['']:
procount += 1
print colorize("WARN", " * IMPORTANT:"),
if stat.S_ISDIR(mymode):
action = ""
if "--fetchonly" in myopts or "--fetch-all-uri" in myopts:
action = "fetched"
+ elif "--buildpkgonly" in myopts:
+ action = "built"
else:
action = "merged"
if "--tree" in myopts and action != "fetched": # Tree doesn't work with fetching
# reasonable defaults; this is important as without USE_ORDER,
# USE will always be "" (nothing set)!
if "USE_ORDER" not in self:
- self.backupenv["USE_ORDER"] = "env:pkg:conf:defaults:pkginternal"
+ self.backupenv["USE_ORDER"] = "env:pkg:conf:defaults:pkginternal:env.d"
self["PORTAGE_GID"] = str(portage_gid)
self.backup_changes("PORTAGE_GID")
master_fd = None
slave_fd = None
fd_pipes_orig = None
+ got_pty = False
if logfile:
del keywords["logfile"]
fd_pipes = keywords.get("fd_pipes")
elif 1 not in fd_pipes or 2 not in fd_pipes:
raise ValueError(fd_pipes)
from pty import openpty
- master_fd, slave_fd = openpty()
+ try:
+ master_fd, slave_fd = openpty()
+ got_pty = True
+ except EnvironmentError, e:
+ writemsg("openpty failed: '%s'\n" % str(e), noiselevel=1)
+ del e
+ master_fd, slave_fd = os.pipe()
fd_pipes.setdefault(0, sys.stdin.fileno())
fd_pipes_orig = fd_pipes.copy()
- stdin_fd = fd_pipes[0]
- if os.isatty(stdin_fd):
- from output import get_term_size, set_term_size
+ if got_pty and os.isatty(fd_pipes_orig[1]):
+ from portage.output import get_term_size, set_term_size
rows, columns = get_term_size()
set_term_size(rows, columns, slave_fd)
fd_pipes[0] = fd_pipes_orig[0]
if logfile:
log_file = open(logfile, 'a')
stdout_file = os.fdopen(os.dup(fd_pipes_orig[1]), 'w')
- master_file = os.fdopen(master_fd, 'w+')
+ master_file = os.fdopen(master_fd, 'r')
iwtd = [master_file]
owtd = []
ewtd = []
for f in events[0]:
# Use non-blocking mode to prevent read
# calls from blocking indefinitely.
- fcntl.fcntl(f.fileno(), fcntl.F_SETFL,
- fd_flags[f] | os.O_NONBLOCK)
+ try:
+ fcntl.fcntl(f.fileno(), fcntl.F_SETFL,
+ fd_flags[f] | os.O_NONBLOCK)
+ except EnvironmentError, e:
+ if e.errno != errno.EAGAIN:
+ raise
+ del e
+ # The EAGAIN error signals eof on FreeBSD.
+ eof = True
+ break
buf = array.array('B')
try:
buf.fromfile(f, buffsize)
return 1
# Build directory creation isn't required for any of these.
+ have_build_dirs = False
if mydo not in ("digest", "fetch", "help", "manifest"):
mystatus = prepare_build_dirs(myroot, mysettings, cleanup)
if mystatus:
return mystatus
+ have_build_dirs = True
# PORTAGE_LOG_FILE is set above by the prepare_build_dirs() call.
logfile = mysettings.get("PORTAGE_LOG_FILE", None)
if mydo == "unmerge":
mydo not in ("digest", "manifest") and "noauto" not in features)
if need_distfiles and not fetch(
fetchme, mysettings, listonly=listonly, fetchonly=fetchonly):
+ if have_build_dirs:
+ # Create an elog message for this fetch failure since the
+ # mod_echo module might push the original message off of the
+ # top of the terminal and prevent the user from being able to
+ # see it.
+ mysettings["EBUILD_PHASE"] = "unpack"
+ cmd = "source '%s/isolated-functions.sh' ; " % PORTAGE_BIN_PATH
+ cmd += "eerror \"Fetch failed for '%s'\"" % mycpv
+ portage.process.spawn(["bash", "-c", cmd],
+ env=mysettings.environ())
+ from portage.elog import elog_process
+ elog_process(mysettings.mycpv, mysettings)
return 1
if mydo == "fetch" and listonly:
elif mydo=="merge":
retval = spawnebuild("install", actionmap, mysettings, debug,
alwaysdep=1, logfile=logfile)
+ if retval != os.EX_OK:
+ # The merge phase handles this already. Callers don't know how
+ # far this function got, so we have to call elog_process() here
+ # so that it's only called once.
+ from portage.elog import elog_process
+ elog_process(mysettings.mycpv, mysettings)
if retval == os.EX_OK:
retval = merge(mysettings["CATEGORY"], mysettings["PF"],
mysettings["D"], os.path.join(mysettings["PORTAGE_BUILDDIR"],
tbz2_lock = None
builddir_lock = None
catdir_lock = None
+ mycat = None
+ mypkg = None
+ did_merge_phase = False
try:
""" Don't lock the tbz2 file because the filesytem could be readonly or
shared by a cluster."""
treetype="bintree")
retval = mylink.merge(pkgloc, infloc, myroot, myebuild, cleanup=0,
mydbapi=mydbapi, prev_mtimes=prev_mtimes)
+ did_merge_phase = True
return retval
finally:
if tbz2_lock:
portage.locks.unlockfile(tbz2_lock)
if builddir_lock:
+ if not did_merge_phase:
+ # The merge phase handles this already. Callers don't know how
+ # far this function got, so we have to call elog_process() here
+ # so that it's only called once.
+ from portage.elog import elog_process
+ elog_process(mycat + "/" + mypkg, mysettings)
try:
shutil.rmtree(builddir)
except (IOError, OSError), e: