1 |
commit: 9df60459337bfbe3f3fe7bb2b48ef18c076284af |
2 |
Author: Michael Haubenwallner <michael.haubenwallner <AT> ssi-schaefer <DOT> com> |
3 |
AuthorDate: Mon May 2 09:15:21 2016 +0000 |
4 |
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon May 2 11:14:56 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=9df60459 |
7 |
|
8 |
+portage-2.2.28-r2: bump ebuildshell patch bug#155161 comment#32 |
9 |
|
10 |
Package-Manager: portage-2.2.28-prefix |
11 |
|
12 |
.../portage/files/portage-2.2.28-ebuildshell.patch | 92 +++++++++++++--------- |
13 |
...e-2.2.28-r1.ebuild => portage-2.2.28-r2.ebuild} | 0 |
14 |
2 files changed, 53 insertions(+), 39 deletions(-) |
15 |
|
16 |
diff --git a/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch b/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch |
17 |
index 7e7e71d..afd2f39 100644 |
18 |
--- a/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch |
19 |
+++ b/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch |
20 |
@@ -1,19 +1,19 @@ |
21 |
-From 096a74009cea9c79bcc2729d18a3cbcb99783aeb Mon Sep 17 00:00:00 2001 |
22 |
+From c93cb045630db71f8fbc0e0b67960a28764a6852 Mon Sep 17 00:00:00 2001 |
23 |
From: Michael Haubenwallner <michael.haubenwallner@×××××××.at> |
24 |
Date: Wed, 6 Nov 2013 12:40:05 +0100 |
25 |
Subject: [PATCH] Add ebuildshell feature, bug#155161. |
26 |
|
27 |
--- |
28 |
- bin/ebuild.sh | 102 ++++++++++++++++++++++++++++++++++- |
29 |
- bin/filter-bash-environment.py | 65 ++++++++++++++++------ |
30 |
+ bin/ebuild.sh | 131 ++++++++++++++++++++++++++++++++++- |
31 |
+ bin/filter-bash-environment.py | 50 ++++++++----- |
32 |
bin/save-ebuild-env.sh | 2 +- |
33 |
- man/make.conf.5 | 6 +++ |
34 |
+ man/make.conf.5 | 6 ++ |
35 |
pym/_emerge/AbstractEbuildProcess.py | 1 + |
36 |
pym/portage/const.py | 1 + |
37 |
- 6 files changed, 159 insertions(+), 18 deletions(-) |
38 |
+ 6 files changed, 173 insertions(+), 18 deletions(-) |
39 |
|
40 |
diff --git a/bin/ebuild.sh b/bin/ebuild.sh |
41 |
-index f1586b2..06c90df 100755 |
42 |
+index f1586b2..cb487c0 100755 |
43 |
--- a/bin/ebuild.sh |
44 |
+++ b/bin/ebuild.sh |
45 |
@@ -130,7 +130,7 @@ __qa_source() { |
46 |
@@ -25,7 +25,7 @@ index f1586b2..06c90df 100755 |
47 |
retval=$? |
48 |
set +e |
49 |
[[ $shopts != $(shopt) ]] && |
50 |
-@@ -537,6 +537,106 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then |
51 |
+@@ -537,6 +537,135 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then |
52 |
unset BIN_PATH BIN BODY FUNC_SRC |
53 |
fi |
54 |
|
55 |
@@ -74,14 +74,31 @@ index f1586b2..06c90df 100755 |
56 |
+ type $1 |
57 |
+ echo "WANTED: \$@" |
58 |
+ echo "or use: \"\\\$@\"" |
59 |
-+ # use bash history, but not the user's real one |
60 |
++ # use bash history, but not the 'user's real one |
61 |
+ HISTFILE=~/.bash_history |
62 |
-+ # for copy&paste function body lines containing: local |
63 |
-+ alias local=declare |
64 |
+ # for copy&paste function body lines containing: ! |
65 |
+ set +H |
66 |
++ # Support the 'local' keyword outside any shell function |
67 |
++ # for copy&paste of function body lines: Remember these |
68 |
++ # "local" variable names for filtering from return-env. |
69 |
++ __ebuildshell_local_vars= |
70 |
++ __ebuildshell_local() { |
71 |
++ local __ebuildshell_local_attr= |
72 |
++ while [[ \${1} == -* ]]; do |
73 |
++ __ebuildshell_local_attr+=" \${1}" |
74 |
++ shift |
75 |
++ done |
76 |
++ __ebuildshell_local_vars+=" \${1%%=*} " |
77 |
++ # Need to declare into the global shell namespace, |
78 |
++ # as we are in some shell function here apparently. |
79 |
++ declare -g \${__ebuildshell_local_attr} "\$@" |
80 |
++ } |
81 |
++ # within some function, BASH_LINENO is set, and we use real 'local' |
82 |
++ alias local='\$( (( \${#BASH_LINENO} > 0 )) && echo local || echo __ebuildshell_local)' |
83 |
+ # at exit, dump the current environment |
84 |
+ trap " |
85 |
++ unalias local |
86 |
++ unset -f __ebuildshell_local |
87 |
+ rm -f '${__ebuildshell_tmpf}.return-'* |
88 |
+ ( |
89 |
+ ( |
90 |
@@ -93,13 +110,14 @@ index f1586b2..06c90df 100755 |
91 |
+ ( |
92 |
+ # We may have more readonly variables now, but we |
93 |
+ # need to filter variables that are readonly already. |
94 |
-+ 2>"${__ebuildshell_tmpf}.return-rovars" \ |
95 |
-+ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \ |
96 |
++ 2>'${__ebuildshell_tmpf}.return-rovars' \\ |
97 |
++ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \\ |
98 |
+ '${PORTAGE_BIN_PATH}'/filter-bash-environment.py \\ |
99 |
-+ --report-readonly-variables \ |
100 |
-+ --preserve-readonly-attribute \ |
101 |
-+ --export-into-global-scope \ |
102 |
-+ '${__ebuildshell_bash_i_vars} ${__ebuildshell_ro_ebuild_vars}' \\ |
103 |
++ --report-readonly-variables \\ |
104 |
++ --preserve-readonly-attribute \\ |
105 |
++ '${__ebuildshell_bash_i_vars} |
106 |
++ ${__ebuildshell_ro_ebuild_vars} |
107 |
++ '\" \${__ebuildshell_local_vars}\" \\ |
108 |
+ || die 'filter-bash-environment.py failed' |
109 |
+ ) |
110 |
+ ) > '${__ebuildshell_tmpf}.return-env' |
111 |
@@ -120,12 +138,23 @@ index f1586b2..06c90df 100755 |
112 |
+ # The environment- and exit-status handling after leaving the ebuildshell |
113 |
+ # prompt is expected to be identical as without the ebuildshell prompt. |
114 |
+ local __ebuildshell_status=$? |
115 |
++ |
116 |
++ # Defining a variable without using the the local keyword makes this |
117 |
++ # variable visible to the 'global' shell namespace. But 'declare -p' |
118 |
++ # does not show the -g flag, so we need to add that one for all |
119 |
++ # variables that have been visible to the EXIT trap above. |
120 |
++ local __ebuildshell_orig_expand_aliases=$(shopt -p expand_aliases) |
121 |
++ alias declare='declare -g' |
122 |
++ shopt -s expand_aliases |
123 |
+ source "${__ebuildshell_tmpf}.return-env" |
124 |
++ unalias declare |
125 |
++ ${__ebuildshell_orig_expand_aliases} |
126 |
+ # Portage does whitelist readonly variables. If an ebuild defines |
127 |
+ # more readonly variables, their readonly attribute is removed. |
128 |
+ # If we ever want to preserve additional readonly variables across |
129 |
+ # phases, their names are in "${__ebuildshell_tmpf}.return-rovars". |
130 |
+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars} |
131 |
++ |
132 |
+ return ${__ebuildshell_status} |
133 |
+} |
134 |
+ |
135 |
@@ -133,20 +162,19 @@ index f1586b2..06c90df 100755 |
136 |
export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)} |
137 |
trap 'exit 1' SIGTERM |
138 |
diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py |
139 |
-index a4cdc54..a710e93 100755 |
140 |
+index a4cdc54..5ed2584 100755 |
141 |
--- a/bin/filter-bash-environment.py |
142 |
+++ b/bin/filter-bash-environment.py |
143 |
-@@ -14,7 +14,8 @@ func_end_re = re.compile(r'^\}$') |
144 |
+@@ -14,7 +14,7 @@ func_end_re = re.compile(r'^\}$') |
145 |
|
146 |
var_assign_re = re.compile(r'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$') |
147 |
close_quote_re = re.compile(r'(\\"|"|\')\s*$') |
148 |
-readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+') |
149 |
+readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+([^=\s]+)') |
150 |
-+export_re = re.compile(r'^declare\s+-(\S*x\S*)\s+') |
151 |
# declare without assignment |
152 |
var_declare_re = re.compile(r'^declare(\s+-\S+)?\s+([^=\s]+)\s*$') |
153 |
|
154 |
-@@ -29,7 +30,7 @@ def have_end_quote(quote, line): |
155 |
+@@ -29,7 +29,7 @@ def have_end_quote(quote, line): |
156 |
return close_quote_match is not None and \ |
157 |
close_quote_match.group(1) == quote |
158 |
|
159 |
@@ -155,7 +183,7 @@ index a4cdc54..a710e93 100755 |
160 |
readonly_match = readonly_re.match(line) |
161 |
if readonly_match is not None: |
162 |
declare_opts = '' |
163 |
-@@ -37,14 +38,29 @@ def filter_declare_readonly_opt(line): |
164 |
+@@ -37,14 +37,19 @@ def filter_declare_readonly_opt(line): |
165 |
group = readonly_match.group(i) |
166 |
if group is not None: |
167 |
declare_opts += group |
168 |
@@ -175,41 +203,29 @@ index a4cdc54..a710e93 100755 |
169 |
return line |
170 |
|
171 |
-def filter_bash_environment(pattern, file_in, file_out): |
172 |
-+def add_global_export_opt(line, options): |
173 |
-+ export_match = export_re.match(line) |
174 |
-+ if export_match is not None: |
175 |
-+ declare_opts = export_match.group(1) |
176 |
-+ if 'g' not in declare_opts and '--export-into-global-scope' in options: |
177 |
-+ declare_opts += 'g' |
178 |
-+ line = 'declare -%s %s' % \ |
179 |
-+ (declare_opts, line[export_match.end():]) |
180 |
-+ return line |
181 |
-+ |
182 |
+def filter_bash_environment(pattern, file_in, file_out, options): |
183 |
# Filter out any instances of the \1 character from variable values |
184 |
# since this character multiplies each time that the environment |
185 |
# is saved (strange bash behavior). This can eventually result in |
186 |
-@@ -77,7 +93,8 @@ def filter_bash_environment(pattern, file_in, file_out): |
187 |
+@@ -77,7 +82,7 @@ def filter_bash_environment(pattern, file_in, file_out): |
188 |
multi_line_quote = quote |
189 |
multi_line_quote_filter = filter_this |
190 |
if not filter_this: |
191 |
- line = filter_declare_readonly_opt(line) |
192 |
+ line = filter_declare_readonly_opt(line, options) |
193 |
-+ line = add_global_export_opt(line, options) |
194 |
file_out.write(line.replace("\1", "")) |
195 |
continue |
196 |
else: |
197 |
-@@ -87,7 +104,8 @@ def filter_bash_environment(pattern, file_in, file_out): |
198 |
+@@ -87,7 +92,7 @@ def filter_bash_environment(pattern, file_in, file_out): |
199 |
filter_this = pattern.match(declare_match.group(2)) \ |
200 |
is not None |
201 |
if not filter_this: |
202 |
- line = filter_declare_readonly_opt(line) |
203 |
+ line = filter_declare_readonly_opt(line, options) |
204 |
-+ line = add_global_export_opt(line, options) |
205 |
file_out.write(line) |
206 |
continue |
207 |
|
208 |
-@@ -124,13 +142,28 @@ if __name__ == "__main__": |
209 |
+@@ -124,13 +129,26 @@ if __name__ == "__main__": |
210 |
"while leaving bash function definitions and here-documents " + \ |
211 |
"intact. The PATTERN is a space separated list of variable names" + \ |
212 |
" and it supports python regular expression syntax." |
213 |
@@ -227,8 +243,6 @@ index a4cdc54..a710e93 100755 |
214 |
+ "Write names of readonly variables to stderr.", |
215 |
+ '--preserve-readonly-attribute': |
216 |
+ "Preserve the '-r' flag in 'declare -r'.", |
217 |
-+ '--export-into-global-scope': |
218 |
-+ "Add the '-g' flag to 'declare -x'.", |
219 |
+ } |
220 |
+ options = {} |
221 |
+ for arg in sys.argv[1:]: |
222 |
@@ -245,7 +259,7 @@ index a4cdc54..a710e93 100755 |
223 |
|
224 |
if len(args) != 1: |
225 |
sys.stderr.write(usage + "\n") |
226 |
-@@ -154,5 +187,5 @@ if __name__ == "__main__": |
227 |
+@@ -154,5 +172,5 @@ if __name__ == "__main__": |
228 |
|
229 |
var_pattern = "^(%s)$" % "|".join(var_pattern) |
230 |
filter_bash_environment( |
231 |
|
232 |
diff --git a/sys-apps/portage/portage-2.2.28-r1.ebuild b/sys-apps/portage/portage-2.2.28-r2.ebuild |
233 |
similarity index 100% |
234 |
rename from sys-apps/portage/portage-2.2.28-r1.ebuild |
235 |
rename to sys-apps/portage/portage-2.2.28-r2.ebuild |