1 |
commit: 45bedf9cdc10fafd94858f67d62b36d35dd99544 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Sep 30 08:18:45 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Sep 30 08:18:45 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=45bedf9c |
7 |
|
8 |
Add chown and chgrp wrappers for prefix. |
9 |
|
10 |
For prefix, there is typically only a single unprivileged user who owns |
11 |
everthing that is built and installed, and in this case it's desirable |
12 |
to ignore chown and chrgrp failures. So, move the logic from fowners |
13 |
into chown and chgrp wrappers, as discussed in bug #433453. |
14 |
|
15 |
--- |
16 |
bin/ebuild-helpers/fowners | 5 ---- |
17 |
bin/ebuild-helpers/unprivileged/chgrp | 1 + |
18 |
bin/ebuild-helpers/unprivileged/chown | 33 ++++++++++++++++++++++++++++++++ |
19 |
pym/portage/package/ebuild/doebuild.py | 4 +++ |
20 |
4 files changed, 38 insertions(+), 5 deletions(-) |
21 |
|
22 |
diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners |
23 |
index b664ec7..cee4108 100755 |
24 |
--- a/bin/ebuild-helpers/fowners |
25 |
+++ b/bin/ebuild-helpers/fowners |
26 |
@@ -14,10 +14,5 @@ slash="/" |
27 |
chown "${@/#${slash}/${ED}${slash}}" |
28 |
ret=$? |
29 |
|
30 |
-if [[ ${ret} != 0 && -n ${EPREFIX} && ${EUID} != 0 ]] ; then |
31 |
- ewarn "fowners failure ignored in Prefix with non-privileged user" |
32 |
- exit 0 |
33 |
-fi |
34 |
- |
35 |
[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed" |
36 |
exit $ret |
37 |
|
38 |
diff --git a/bin/ebuild-helpers/unprivileged/chgrp b/bin/ebuild-helpers/unprivileged/chgrp |
39 |
new file mode 120000 |
40 |
index 0000000..6fb0fcd |
41 |
--- /dev/null |
42 |
+++ b/bin/ebuild-helpers/unprivileged/chgrp |
43 |
@@ -0,0 +1 @@ |
44 |
+chown |
45 |
\ No newline at end of file |
46 |
|
47 |
diff --git a/bin/ebuild-helpers/unprivileged/chown b/bin/ebuild-helpers/unprivileged/chown |
48 |
new file mode 100755 |
49 |
index 0000000..cad34d9 |
50 |
--- /dev/null |
51 |
+++ b/bin/ebuild-helpers/unprivileged/chown |
52 |
@@ -0,0 +1,33 @@ |
53 |
+#!/bin/bash |
54 |
+# Copyright 2012 Gentoo Foundation |
55 |
+# Distributed under the terms of the GNU General Public License v2 |
56 |
+ |
57 |
+scriptpath=${BASH_SOURCE[0]} |
58 |
+scriptname=${scriptpath##*/} |
59 |
+ |
60 |
+IFS=':' |
61 |
+ |
62 |
+for path in ${PATH}; do |
63 |
+ [[ -x ${path}/${scriptname} ]] || continue |
64 |
+ [[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue |
65 |
+ IFS=$' \t\n' |
66 |
+ output=$("${path}/${scriptname}" "$@" 2>&1) |
67 |
+ if [[ $? -ne 0 ]] ; then |
68 |
+ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh |
69 |
+ |
70 |
+ if ! ___eapi_has_prefix_variables; then |
71 |
+ EPREFIX= |
72 |
+ fi |
73 |
+ msg="${scriptname} failure ignored with unprivileged user:\n ${scriptname} $*\n ${output}" |
74 |
+ # Reverse expansion of ${D} and ${EPREFIX}, for readability. |
75 |
+ msg=${msg//${D}/'${D}'} |
76 |
+ if [[ -n ${EPREFIX} ]] ; then |
77 |
+ msg=${msg//${EPREFIX}/'${EPREFIX}'} |
78 |
+ msg=${msg//${EPREFIX#/}/'${EPREFIX}'} |
79 |
+ fi |
80 |
+ ewarn "${msg}" |
81 |
+ fi |
82 |
+ exit 0 |
83 |
+done |
84 |
+ |
85 |
+exit 1 |
86 |
|
87 |
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py |
88 |
index 04d0808..9deed98 100644 |
89 |
--- a/pym/portage/package/ebuild/doebuild.py |
90 |
+++ b/pym/portage/package/ebuild/doebuild.py |
91 |
@@ -158,6 +158,10 @@ def _doebuild_path(settings, eapi=None): |
92 |
|
93 |
path = [] |
94 |
|
95 |
+ if eprefix and uid != 0 and "fakeroot" not in settings.features: |
96 |
+ path.append(os.path.join(portage_bin_path, |
97 |
+ "ebuild-helpers", "unprivileged")) |
98 |
+ |
99 |
if settings.get("USERLAND", "GNU") != "GNU": |
100 |
path.append(os.path.join(portage_bin_path, "ebuild-helpers", "bsd")) |