1 |
Author: grobian |
2 |
Date: 2009-07-31 07:38:05 +0000 (Fri, 31 Jul 2009) |
3 |
New Revision: 13868 |
4 |
|
5 |
Modified: |
6 |
main/branches/prefix/bin/ebuild.sh |
7 |
main/branches/prefix/bin/isolated-functions.sh |
8 |
main/branches/prefix/pym/_emerge/depgraph.py |
9 |
main/branches/prefix/pym/portage/__init__.py |
10 |
Log: |
11 |
Merged from trunk -r13854:13857 |
12 |
|
13 |
| 13855 | Fix depgraph._show_missed_update() to keep each $ROOT | |
14 |
| zmedico | separate. | |
15 |
|
16 |
| 13856 | Bug #278895 - Make ebuild.sh clean up orphaned processes | |
17 |
| zmedico | that may have been left behind by ebuild phases. This works | |
18 |
| | by using setsid to create a new login session for the | |
19 |
| | ebuild.sh process, and `kill -s SIGHUP 0` to send a SIGHUP | |
20 |
| | signal to all processes in the session. The setsid is | |
21 |
| | currently not done on the python side since that would cause | |
22 |
| | the sandbox process in the session, and sandbox produces a | |
23 |
| | warning message if it catches a SIGHUP signal. | |
24 |
|
25 |
| 13857 | Inside die(), only send the signal for subshell die support | |
26 |
| zmedico | when we are actually in a subshell. | |
27 |
|
28 |
|
29 |
Modified: main/branches/prefix/bin/ebuild.sh |
30 |
=================================================================== |
31 |
--- main/branches/prefix/bin/ebuild.sh 2009-07-31 07:36:27 UTC (rev 13867) |
32 |
+++ main/branches/prefix/bin/ebuild.sh 2009-07-31 07:38:05 UTC (rev 13868) |
33 |
@@ -73,6 +73,17 @@ |
34 |
PATH="$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}${DEFAULT_PATH}:${ROOTPATH:+:}$ROOTPATH" |
35 |
export PATH |
36 |
|
37 |
+if [[ -z $PORTAGE_SETSID && \ |
38 |
+ -n $EBUILD_SH_ARGS && $EBUILD_SH_ARGS != depend ]] ; then |
39 |
+ if type -P setsid >/dev/null ; then |
40 |
+ # Use setsid to create a new login session so that we can use SIGHUP |
41 |
+ # to ensure that no orphaned subprocesses are left running. |
42 |
+ export PORTAGE_SETSID=1 |
43 |
+ exec setsid "$PORTAGE_BIN_PATH/ebuild.sh" $EBUILD_SH_ARGS |
44 |
+ fi |
45 |
+fi |
46 |
+trap '[[ $PORTAGE_SETSID = 1 ]] && { trap : SIGHUP ; kill -s SIGHUP 0 ; }' EXIT |
47 |
+ |
48 |
source "${PORTAGE_BIN_PATH}/isolated-functions.sh" &>/dev/null |
49 |
|
50 |
# Set IMAGE for minimal backward compatibility with |
51 |
|
52 |
Modified: main/branches/prefix/bin/isolated-functions.sh |
53 |
=================================================================== |
54 |
--- main/branches/prefix/bin/isolated-functions.sh 2009-07-31 07:36:27 UTC (rev 13867) |
55 |
+++ main/branches/prefix/bin/isolated-functions.sh 2009-07-31 07:38:05 UTC (rev 13868) |
56 |
@@ -144,7 +144,7 @@ |
57 |
[ -n "$EBUILD_EXIT_STATUS_FILE" ] && > "$EBUILD_EXIT_STATUS_FILE" |
58 |
|
59 |
# subshell die support |
60 |
- kill -s SIGTERM ${EBUILD_MASTER_PID} |
61 |
+ [[ $BASHPID = $EBUILD_MASTER_PID ]] || kill -s SIGTERM $EBUILD_MASTER_PID |
62 |
exit 1 |
63 |
} |
64 |
|
65 |
@@ -538,7 +538,8 @@ |
66 |
PORTAGE_DEPCACHEDIR PORTAGE_GID PORTAGE_INST_GID \ |
67 |
PORTAGE_INST_UID PORTAGE_LOG_FILE PORTAGE_MASTER_PID \ |
68 |
PORTAGE_QUIET \ |
69 |
- PORTAGE_REPO_NAME PORTAGE_RESTRICT PORTAGE_UPDATE_ENV \ |
70 |
+ PORTAGE_REPO_NAME PORTAGE_RESTRICT \ |
71 |
+ PORTAGE_SETSID PORTAGE_UPDATE_ENV \ |
72 |
PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTDIR \ |
73 |
PORTDIR_OVERLAY ${!PORTAGE_SANDBOX_*} PREROOTPATH \ |
74 |
PROFILE_PATHS PWORKDIR QA_INTERCEPTORS \ |
75 |
|
76 |
Modified: main/branches/prefix/pym/_emerge/depgraph.py |
77 |
=================================================================== |
78 |
--- main/branches/prefix/pym/_emerge/depgraph.py 2009-07-31 07:36:27 UTC (rev 13867) |
79 |
+++ main/branches/prefix/pym/_emerge/depgraph.py 2009-07-31 07:38:05 UTC (rev 13868) |
80 |
@@ -287,15 +287,15 @@ |
81 |
# Exclude installed here since we only |
82 |
# want to show available updates. |
83 |
continue |
84 |
- if pkg.slot_atom in missed_updates: |
85 |
- other_pkg, mask_type, parent_atoms = \ |
86 |
- missed_updates[pkg.slot_atom] |
87 |
+ k = (pkg.root, pkg.slot_atom) |
88 |
+ if k in missed_updates: |
89 |
+ other_pkg, mask_type, parent_atoms = missed_updates[k] |
90 |
if other_pkg > pkg: |
91 |
continue |
92 |
for mask_type, parent_atoms in mask_reasons.iteritems(): |
93 |
if not parent_atoms: |
94 |
continue |
95 |
- missed_updates[pkg.slot_atom] = (pkg, mask_type, parent_atoms) |
96 |
+ missed_updates[k] = (pkg, mask_type, parent_atoms) |
97 |
break |
98 |
|
99 |
if not missed_updates: |
100 |
@@ -325,6 +325,8 @@ |
101 |
"due to unsatisfied dependencies:\n\n") |
102 |
|
103 |
write(str(pkg.slot_atom)) |
104 |
+ if pkg.root != '/': |
105 |
+ write(" for %s" % (pkg.root,)) |
106 |
write("\n") |
107 |
|
108 |
for parent, root, atom in parent_atoms: |
109 |
@@ -345,6 +347,8 @@ |
110 |
indent = " " |
111 |
for pkg, parent_atoms in missed_updates: |
112 |
msg.append(str(pkg.slot_atom)) |
113 |
+ if pkg.root != '/': |
114 |
+ msg.append(" for %s" % (pkg.root,)) |
115 |
msg.append("\n\n") |
116 |
|
117 |
for parent, atom in parent_atoms: |
118 |
|
119 |
Modified: main/branches/prefix/pym/portage/__init__.py |
120 |
=================================================================== |
121 |
--- main/branches/prefix/pym/portage/__init__.py 2009-07-31 07:36:27 UTC (rev 13867) |
122 |
+++ main/branches/prefix/pym/portage/__init__.py 2009-07-31 07:38:05 UTC (rev 13868) |
123 |
@@ -1049,6 +1049,7 @@ |
124 |
"EBUILD_PHASE", "EMERGE_FROM", "HOMEPAGE", "INHERITED", "IUSE", |
125 |
"KEYWORDS", "LICENSE", "PDEPEND", "PF", "PKGUSE", |
126 |
"PORTAGE_CONFIGROOT", "PORTAGE_IUSE", "PORTAGE_REPO_NAME", |
127 |
+ "PORTAGE_SETSID", |
128 |
"PORTAGE_USE", "PROPERTIES", "PROVIDE", "RDEPEND", "RESTRICT", |
129 |
"ROOT", "SLOT", "SRC_URI", "EPREFIX", "EROOT" |
130 |
] |