From: Fabian Groffen Date: Mon, 30 Jul 2007 20:36:30 +0000 (-0000) Subject: Merged from trunk 7399:7428 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=496c14d797e720f0c00df5f2e441c1184af3ccf5;p=portage.git Merged from trunk 7399:7428 +------------------------------------------------------------------------+ | 7400 | When setting the size of the pty for logging, check if | | zmedico | stdout isatty rather than stdin. | |---------+--------------------------------------------------------------| | 7402 | For bug #186610, use `find ` to scan for config updates | | zmedico | since `cd ` could fail and cause the cwd to be scanned. | |---------+--------------------------------------------------------------| | 7405 | For --buildpkgonly, say "built" instead of "merged" in the | | zmedico | "These are the packages that would be " message. | |---------+--------------------------------------------------------------| | 7407 | For bug #186826, always show --newuse flags that trigger | | zmedico | reinstallation even when not in --verbose mode. | |---------+--------------------------------------------------------------| | 7410 | For bug #186480, while we transition to repository labels, | | zmedico | avoid ? spam in the repository display by ignoring a missing | | | repository label for an installed package. (branches/2.1.2 | | | r7409) | |---------+--------------------------------------------------------------| | 7411 | For bug #186639, add more clarification about the | | zmedico | relationship between /etc/make.profile/ and | | | /etc/portage/profile/. | |---------+--------------------------------------------------------------| | 7413 | For bug #186639, note that /etc/portage/profile/ supports | | zmedico | all of the same file types that /etc/make.profile/ does, | | | except parent. | |---------+--------------------------------------------------------------| | 7415 | For bug #185048, make emerge-webrsync honor http_proxy and | | zmedico | ftp_proxy from make.conf. | |---------+--------------------------------------------------------------| | 7417 | Handle 2 more cases where elog_process() needs to be called: | | zmedico | - binary install via pkgmerge() fails before reaching the | | | merge phase (pkg_setup dies) - doebuild() is called for the | | | merge phase but it dies before reaching the merge phase | |---------+--------------------------------------------------------------| | 7419 | When the fetch phase fails inside doebuild(), create an | | zmedico | eerror log 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. | |---------+--------------------------------------------------------------| | 7422 | For bug #186876, fall back it os.pipe() if pty.openpty() | | zmedico | fails. | |---------+--------------------------------------------------------------| | 7424 | For pty logging, handle the EAGAIN error that is thrown from | | zmedico | fcntl when the slave end of the pty is closed on FreeBSD. | |---------+--------------------------------------------------------------| | 7426 | Change "output" import to portage.output. | | zmedico | | |---------+--------------------------------------------------------------| | 7427 | For bug #187016, and env.d to the default USE_ORDER. | | zmedico | | |---------+--------------------------------------------------------------| | 7428 | Update USE_ORDER docs for bug #187016. | | zmedico | | +------------------------------------------------------------------------+ svn path=/main/branches/prefix/; revision=7520 --- diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index 4ce47ac49..1e3854c62 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -8,8 +8,9 @@ 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. diff --git a/cnf/make.globals b/cnf/make.globals index 3997599bb..94b7aa548 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -60,7 +60,7 @@ PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress 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@" diff --git a/man/make.conf.5 b/man/make.conf.5 index e1e11dafb..9402f2114 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -494,11 +494,16 @@ This variable contains options that control the build behavior of several 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. @@ -512,7 +517,7 @@ you fix it. .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)) @@ -525,6 +530,9 @@ USE from make.defaults and package.use in the profile (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" diff --git a/man/portage.5 b/man/portage.5 index 78b2623d6..b94b2fdbd 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -22,11 +22,13 @@ make.globals .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 @@ -127,9 +129,10 @@ may easily be updated/regenerated by running `emerge \-\-sync`. It defines 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 diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index e746ce130..4aa612888 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -2534,7 +2534,8 @@ class depgraph(object): 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: @@ -2552,16 +2553,18 @@ class depgraph(object): 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 += "*" @@ -2569,7 +2572,9 @@ class depgraph(object): 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) @@ -2879,22 +2884,24 @@ class depgraph(object): # 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) @@ -2911,7 +2918,8 @@ class depgraph(object): 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 @@ -2956,7 +2964,11 @@ class depgraph(object): 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" % ( @@ -4366,17 +4378,17 @@ def chk_updated_cfg_files(target_root, config_protect): 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): @@ -5651,6 +5663,8 @@ def action_build(settings, trees, mtimedb, 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 diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index e8bbdbcf1..399450754 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -1389,7 +1389,7 @@ class config(object): # 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") @@ -2390,6 +2390,7 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero master_fd = None slave_fd = None fd_pipes_orig = None + got_pty = False if logfile: del keywords["logfile"] fd_pipes = keywords.get("fd_pipes") @@ -2398,12 +2399,17 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero 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] @@ -2457,7 +2463,7 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero 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 = [] @@ -2472,8 +2478,16 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero 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) @@ -3832,10 +3846,12 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, 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": @@ -3950,6 +3966,18 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, 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: @@ -4069,6 +4097,12 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, 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"], @@ -5070,6 +5104,9 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, vartree=None, prev_mtimes 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.""" @@ -5142,11 +5179,18 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, vartree=None, prev_mtimes 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: