From: Fabian Groffen Date: Fri, 31 Jul 2009 07:38:05 +0000 (-0000) Subject: Merged from trunk -r13854:13857 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=a8b96130049d6bb3a4177b80b5ce4ab8dffd7d87;p=portage.git Merged from trunk -r13854:13857 | 13855 | Fix depgraph._show_missed_update() to keep each $ROOT | | zmedico | separate. | | 13856 | Bug #278895 - Make ebuild.sh clean up orphaned processes | | zmedico | that may have been left behind by ebuild phases. This works | | | by using setsid to create a new login session for the | | | ebuild.sh process, and `kill -s SIGHUP 0` to send a SIGHUP | | | signal to all processes in the session. The setsid is | | | currently not done on the python side since that would cause | | | the sandbox process in the session, and sandbox produces a | | | warning message if it catches a SIGHUP signal. | | 13857 | Inside die(), only send the signal for subshell die support | | zmedico | when we are actually in a subshell. | svn path=/main/branches/prefix/; revision=13868 --- diff --git a/bin/ebuild.sh b/bin/ebuild.sh index fc43d7f5a..6ee314564 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -73,6 +73,17 @@ PREROOTPATH=${PREROOTPATH%%:} PATH="$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}${DEFAULT_PATH}:${ROOTPATH:+:}$ROOTPATH" export PATH +if [[ -z $PORTAGE_SETSID && \ + -n $EBUILD_SH_ARGS && $EBUILD_SH_ARGS != depend ]] ; then + if type -P setsid >/dev/null ; then + # Use setsid to create a new login session so that we can use SIGHUP + # to ensure that no orphaned subprocesses are left running. + export PORTAGE_SETSID=1 + exec setsid "$PORTAGE_BIN_PATH/ebuild.sh" $EBUILD_SH_ARGS + fi +fi +trap '[[ $PORTAGE_SETSID = 1 ]] && { trap : SIGHUP ; kill -s SIGHUP 0 ; }' EXIT + source "${PORTAGE_BIN_PATH}/isolated-functions.sh" &>/dev/null # Set IMAGE for minimal backward compatibility with diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index b6044b26b..947da3946 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -144,7 +144,7 @@ die() { [ -n "$EBUILD_EXIT_STATUS_FILE" ] && > "$EBUILD_EXIT_STATUS_FILE" # subshell die support - kill -s SIGTERM ${EBUILD_MASTER_PID} + [[ $BASHPID = $EBUILD_MASTER_PID ]] || kill -s SIGTERM $EBUILD_MASTER_PID exit 1 } @@ -538,7 +538,8 @@ save_ebuild_env() { PORTAGE_DEPCACHEDIR PORTAGE_GID PORTAGE_INST_GID \ PORTAGE_INST_UID PORTAGE_LOG_FILE PORTAGE_MASTER_PID \ PORTAGE_QUIET \ - PORTAGE_REPO_NAME PORTAGE_RESTRICT PORTAGE_UPDATE_ENV \ + PORTAGE_REPO_NAME PORTAGE_RESTRICT \ + PORTAGE_SETSID PORTAGE_UPDATE_ENV \ PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTDIR \ PORTDIR_OVERLAY ${!PORTAGE_SANDBOX_*} PREROOTPATH \ PROFILE_PATHS PWORKDIR QA_INTERCEPTORS \ diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index afa976f02..8feef733a 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -287,15 +287,15 @@ class depgraph(object): # Exclude installed here since we only # want to show available updates. continue - if pkg.slot_atom in missed_updates: - other_pkg, mask_type, parent_atoms = \ - missed_updates[pkg.slot_atom] + k = (pkg.root, pkg.slot_atom) + if k in missed_updates: + other_pkg, mask_type, parent_atoms = missed_updates[k] if other_pkg > pkg: continue for mask_type, parent_atoms in mask_reasons.iteritems(): if not parent_atoms: continue - missed_updates[pkg.slot_atom] = (pkg, mask_type, parent_atoms) + missed_updates[k] = (pkg, mask_type, parent_atoms) break if not missed_updates: @@ -325,6 +325,8 @@ class depgraph(object): "due to unsatisfied dependencies:\n\n") write(str(pkg.slot_atom)) + if pkg.root != '/': + write(" for %s" % (pkg.root,)) write("\n") for parent, root, atom in parent_atoms: @@ -345,6 +347,8 @@ class depgraph(object): indent = " " for pkg, parent_atoms in missed_updates: msg.append(str(pkg.slot_atom)) + if pkg.root != '/': + msg.append(" for %s" % (pkg.root,)) msg.append("\n\n") for parent, atom in parent_atoms: diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index f65197cfb..57b491d71 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -1049,6 +1049,7 @@ class config(object): "EBUILD_PHASE", "EMERGE_FROM", "HOMEPAGE", "INHERITED", "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PF", "PKGUSE", "PORTAGE_CONFIGROOT", "PORTAGE_IUSE", "PORTAGE_REPO_NAME", + "PORTAGE_SETSID", "PORTAGE_USE", "PROPERTIES", "PROVIDE", "RDEPEND", "RESTRICT", "ROOT", "SLOT", "SRC_URI", "EPREFIX", "EROOT" ]