1 |
commit: dd933901852a54f7c3367e84eeacec80456355ae |
2 |
Author: Michael Weiser <michael <AT> weiser <DOT> dinsnail <DOT> net> |
3 |
AuthorDate: Thu Feb 28 19:19:54 2013 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Feb 28 19:19:54 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=dd933901 |
7 |
|
8 |
macosxsandbox: allow writes in distdir |
9 |
|
10 |
Because vcs-based eclasses tend to write in DISTDIR for their sources, |
11 |
we need to allow this since macosxsandbox cannot dynamically add |
12 |
locations, such as sandbox can. This is a sort of workaround for |
13 |
bug #443444. |
14 |
|
15 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
16 |
|
17 |
--- |
18 |
pym/portage/const.py | 6 ++++-- |
19 |
pym/portage/package/ebuild/doebuild.py | 26 +++++++++++++++++--------- |
20 |
2 files changed, 21 insertions(+), 11 deletions(-) |
21 |
|
22 |
diff --git a/pym/portage/const.py b/pym/portage/const.py |
23 |
index 84c6865..360625b 100644 |
24 |
--- a/pym/portage/const.py |
25 |
+++ b/pym/portage/const.py |
26 |
@@ -85,13 +85,15 @@ MACOSSANDBOX_PROFILE = '''(version 1) |
27 |
|
28 |
(allow file-read* file-write* |
29 |
(literal |
30 |
- #"@@WRITEABLE_PREFIX@@" |
31 |
+ ;;#"@@PORTAGE_BUILDDIR@@" |
32 |
+ ;;#"@@PORTAGE_ACTUAL_DISTDIR@@" |
33 |
#"/dev/tty" |
34 |
#"/dev/dtracehelper" |
35 |
) |
36 |
|
37 |
(regex |
38 |
- #"^@@WRITEABLE_PREFIX_RE@@/" |
39 |
+ ;;#"^@@PORTAGE_BUILDDIR_RE@@/" |
40 |
+ ;;#"^@@PORTAGE_ACTUAL_DISTDIR_RE@@/" |
41 |
#"^(/private)?/var/tmp" |
42 |
#"^(/private)?/tmp" |
43 |
) |
44 |
|
45 |
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py |
46 |
index 1917e25..87ca58b 100644 |
47 |
--- a/pym/portage/package/ebuild/doebuild.py |
48 |
+++ b/pym/portage/package/ebuild/doebuild.py |
49 |
@@ -1477,17 +1477,25 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero |
50 |
spawn_func = portage.process.spawn_fakeroot |
51 |
elif "sandbox" in features and platform.system() == 'Darwin': |
52 |
keywords["opt_name"] += " macossandbox" |
53 |
- sbprefixpath = mysettings["PORTAGE_BUILDDIR"] |
54 |
- |
55 |
- # escape some characters with special meaning in re's |
56 |
- sbprefixre = sbprefixpath.replace("+", "\+") |
57 |
- sbprefixre = sbprefixre.replace("*", "\*") |
58 |
- sbprefixre = sbprefixre.replace("[", "\[") |
59 |
- sbprefixre = sbprefixre.replace("[", "\[") |
60 |
|
61 |
sbprofile = MACOSSANDBOX_PROFILE |
62 |
- sbprofile = sbprofile.replace("@@WRITEABLE_PREFIX@@", sbprefixpath) |
63 |
- sbprofile = sbprofile.replace("@@WRITEABLE_PREFIX_RE@@", sbprefixre) |
64 |
+ for pathvar in [ "PORTAGE_BUILDDIR", "PORTAGE_ACTUAL_DISTDIR" ]: |
65 |
+ if pathvar not in mysettings: |
66 |
+ continue |
67 |
+ |
68 |
+ sbprefixpath = mysettings[pathvar] |
69 |
+ |
70 |
+ # escape some characters with special meaning in re's |
71 |
+ sbprefixre = sbprefixpath.replace("+", "\+") |
72 |
+ sbprefixre = sbprefixre.replace("*", "\*") |
73 |
+ sbprefixre = sbprefixre.replace("[", "\[") |
74 |
+ sbprefixre = sbprefixre.replace("[", "\[") |
75 |
+ |
76 |
+ sbprofile = sbprofile.replace("@@%s@@" % pathvar, sbprefixpath) |
77 |
+ sbprofile = sbprofile.replace("@@%s_RE@@" % pathvar, sbprefixre) |
78 |
+ |
79 |
+ # uncomment all rules that don't contain any @@'s any more |
80 |
+ sbprofile = re.sub(r';;(#"[^@"]*")', r'\1', sbprofile) |
81 |
|
82 |
keywords["profile"] = sbprofile |
83 |
spawn_func = portage.process.spawn_macossandbox |