1 |
commit: 8c67d8b37ea1f8ce7e29233e80229fc8fbf9fd35 |
2 |
Author: Michael Haubenwallner <michael.haubenwallner <AT> ssi-schaefer <DOT> com> |
3 |
AuthorDate: Wed Apr 27 13:03:36 2016 +0000 |
4 |
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Apr 27 13:03:36 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=8c67d8b3 |
7 |
|
8 |
prefix-portage: bump ebuildshell patch, bug#155161 |
9 |
|
10 |
.../portage/files/portage-2.2.28-ebuildshell.patch | 311 +++++++++++++++++++++ |
11 |
sys-apps/portage/portage-2.2.28-r1.ebuild | 259 +++++++++++++++++ |
12 |
2 files changed, 570 insertions(+) |
13 |
|
14 |
diff --git a/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch b/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch |
15 |
new file mode 100644 |
16 |
index 0000000..7e7e71d |
17 |
--- /dev/null |
18 |
+++ b/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch |
19 |
@@ -0,0 +1,311 @@ |
20 |
+From 096a74009cea9c79bcc2729d18a3cbcb99783aeb Mon Sep 17 00:00:00 2001 |
21 |
+From: Michael Haubenwallner <michael.haubenwallner@×××××××.at> |
22 |
+Date: Wed, 6 Nov 2013 12:40:05 +0100 |
23 |
+Subject: [PATCH] Add ebuildshell feature, bug#155161. |
24 |
+ |
25 |
+--- |
26 |
+ bin/ebuild.sh | 102 ++++++++++++++++++++++++++++++++++- |
27 |
+ bin/filter-bash-environment.py | 65 ++++++++++++++++------ |
28 |
+ bin/save-ebuild-env.sh | 2 +- |
29 |
+ man/make.conf.5 | 6 +++ |
30 |
+ pym/_emerge/AbstractEbuildProcess.py | 1 + |
31 |
+ pym/portage/const.py | 1 + |
32 |
+ 6 files changed, 159 insertions(+), 18 deletions(-) |
33 |
+ |
34 |
+diff --git a/bin/ebuild.sh b/bin/ebuild.sh |
35 |
+index f1586b2..06c90df 100755 |
36 |
+--- a/bin/ebuild.sh |
37 |
++++ b/bin/ebuild.sh |
38 |
+@@ -130,7 +130,7 @@ __qa_source() { |
39 |
+ __qa_call() { |
40 |
+ local shopts=$(shopt) OLDIFS="$IFS" |
41 |
+ local retval |
42 |
+- "$@" |
43 |
++ __call-ebuildshell "$@" |
44 |
+ retval=$? |
45 |
+ set +e |
46 |
+ [[ $shopts != $(shopt) ]] && |
47 |
+@@ -537,6 +537,106 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then |
48 |
+ unset BIN_PATH BIN BODY FUNC_SRC |
49 |
+ fi |
50 |
+ |
51 |
++__call-ebuildshell() { |
52 |
++ if ! has ebuildshell ${FEATURES}; then |
53 |
++ "$@" |
54 |
++ return $? |
55 |
++ fi |
56 |
++ local __ebuildshell_args=( "$@" ) |
57 |
++ # These are the variables I have seen 'bash -i' maintaining the values for: |
58 |
++ local __ebuildshell_bash_i_vars="__ebuildshell_.* |
59 |
++ _ BASH_ARGC BASH_ARGV BASH_COMMAND BASH_LINENO BASH_SOURCE |
60 |
++ BASH_VERSINFO BASH_SUBSHELL BASHOPTS BASHPID COMP_WORDBREAKS |
61 |
++ DIRSTACK EUID FUNCNAME GROUPS HISTCMD HISTFILE LINENO |
62 |
++ PIPESTATUS PPID PWD RANDOM SECONDS SHELLOPTS UID" |
63 |
++ # Allow recursive ebuildshell, for use in multibuild.eclass and similar: |
64 |
++ local __ebuildshell_pid=${BASHPID:-$(__bashpid)} |
65 |
++ local __ebuildshell_tmpf="${T}/ebuildshell.${__ebuildshell_pid}" |
66 |
++ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars} |
67 |
++ ( |
68 |
++ ( |
69 |
++ declare -p |
70 |
++ declare -fp |
71 |
++ shopt -p |
72 |
++ [[ ${BASH_VERSINFO[0]} == 3 ]] && export |
73 |
++ ) | |
74 |
++ ( |
75 |
++ # we need everything but the bash vars after 'env -i' |
76 |
++ 2>"${__ebuildshell_tmpf}.ebuild-rovars" \ |
77 |
++ "${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}" \ |
78 |
++ "${PORTAGE_BIN_PATH}"/filter-bash-environment.py \ |
79 |
++ --report-readonly-variables \ |
80 |
++ --preserve-readonly-attribute \ |
81 |
++ "${__ebuildshell_bash_i_vars}" \ |
82 |
++ || die "filter-bash-environment.py failed" |
83 |
++ ) |
84 |
++ # The already readonly variables, without bash maintained ones: |
85 |
++ __ebuildshell_ro_ebuild_vars=$(<"${__ebuildshell_tmpf}.ebuild-rovars") |
86 |
++ cat <<-EOE |
87 |
++ # properly quote the function arguments |
88 |
++ $(declare -p __ebuildshell_args) |
89 |
++ set -- "\${__ebuildshell_args[@]}" |
90 |
++ unset __ebuildshell_args |
91 |
++ # be informative about what to do |
92 |
++ PS1="EBUILD ${PN} $1 \$ " |
93 |
++ type $1 |
94 |
++ echo "WANTED: \$@" |
95 |
++ echo "or use: \"\\\$@\"" |
96 |
++ # use bash history, but not the user's real one |
97 |
++ HISTFILE=~/.bash_history |
98 |
++ # for copy&paste function body lines containing: local |
99 |
++ alias local=declare |
100 |
++ # for copy&paste function body lines containing: ! |
101 |
++ set +H |
102 |
++ # at exit, dump the current environment |
103 |
++ trap " |
104 |
++ rm -f '${__ebuildshell_tmpf}.return-'* |
105 |
++ ( |
106 |
++ ( |
107 |
++ declare -p |
108 |
++ declare -fp |
109 |
++ shopt -p | grep -v 'extdebug$' |
110 |
++ $([[ ${BASH_VERSINFO[0]} == 3 ]] && echo export) |
111 |
++ ) | |
112 |
++ ( |
113 |
++ # We may have more readonly variables now, but we |
114 |
++ # need to filter variables that are readonly already. |
115 |
++ 2>"${__ebuildshell_tmpf}.return-rovars" \ |
116 |
++ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \ |
117 |
++ '${PORTAGE_BIN_PATH}'/filter-bash-environment.py \\ |
118 |
++ --report-readonly-variables \ |
119 |
++ --preserve-readonly-attribute \ |
120 |
++ --export-into-global-scope \ |
121 |
++ '${__ebuildshell_bash_i_vars} ${__ebuildshell_ro_ebuild_vars}' \\ |
122 |
++ || die 'filter-bash-environment.py failed' |
123 |
++ ) |
124 |
++ ) > '${__ebuildshell_tmpf}.return-env' |
125 |
++ " EXIT |
126 |
++ # this is a debugging shell already |
127 |
++ shopt -u extdebug |
128 |
++ trap - DEBUG |
129 |
++ # can do some cleanup already |
130 |
++ rm -f '${__ebuildshell_tmpf}.ebuild-'* |
131 |
++ EOE |
132 |
++ ) > "${__ebuildshell_tmpf}.ebuild-env" |
133 |
++ |
134 |
++ # pre-fill the history with "$@" |
135 |
++ echo '"$@"' >> ~/.bash_history |
136 |
++ |
137 |
++ env -i ${BASH} --rcfile "${__ebuildshell_tmpf}.ebuild-env" -i |
138 |
++ |
139 |
++ # The environment- and exit-status handling after leaving the ebuildshell |
140 |
++ # prompt is expected to be identical as without the ebuildshell prompt. |
141 |
++ local __ebuildshell_status=$? |
142 |
++ source "${__ebuildshell_tmpf}.return-env" |
143 |
++ # Portage does whitelist readonly variables. If an ebuild defines |
144 |
++ # more readonly variables, their readonly attribute is removed. |
145 |
++ # If we ever want to preserve additional readonly variables across |
146 |
++ # phases, their names are in "${__ebuildshell_tmpf}.return-rovars". |
147 |
++ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars} |
148 |
++ return ${__ebuildshell_status} |
149 |
++} |
150 |
++ |
151 |
+ # Subshell/helper die support (must export for the die helper). |
152 |
+ export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)} |
153 |
+ trap 'exit 1' SIGTERM |
154 |
+diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py |
155 |
+index a4cdc54..a710e93 100755 |
156 |
+--- a/bin/filter-bash-environment.py |
157 |
++++ b/bin/filter-bash-environment.py |
158 |
+@@ -14,7 +14,8 @@ func_end_re = re.compile(r'^\}$') |
159 |
+ |
160 |
+ var_assign_re = re.compile(r'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$') |
161 |
+ close_quote_re = re.compile(r'(\\"|"|\')\s*$') |
162 |
+-readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+') |
163 |
++readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+([^=\s]+)') |
164 |
++export_re = re.compile(r'^declare\s+-(\S*x\S*)\s+') |
165 |
+ # declare without assignment |
166 |
+ var_declare_re = re.compile(r'^declare(\s+-\S+)?\s+([^=\s]+)\s*$') |
167 |
+ |
168 |
+@@ -29,7 +30,7 @@ def have_end_quote(quote, line): |
169 |
+ return close_quote_match is not None and \ |
170 |
+ close_quote_match.group(1) == quote |
171 |
+ |
172 |
+-def filter_declare_readonly_opt(line): |
173 |
++def filter_declare_readonly_opt(line, options): |
174 |
+ readonly_match = readonly_re.match(line) |
175 |
+ if readonly_match is not None: |
176 |
+ declare_opts = '' |
177 |
+@@ -37,14 +38,29 @@ def filter_declare_readonly_opt(line): |
178 |
+ group = readonly_match.group(i) |
179 |
+ if group is not None: |
180 |
+ declare_opts += group |
181 |
++ var = readonly_match.group(3) |
182 |
++ if '--report-readonly-variables' in options: |
183 |
++ sys.stderr.write(var + "\n") |
184 |
++ if '--preserve-readonly-attribute' in options: |
185 |
++ declare_opts += 'r' |
186 |
+ if declare_opts: |
187 |
+- line = 'declare -%s %s' % \ |
188 |
+- (declare_opts, line[readonly_match.end():]) |
189 |
++ line = 'declare -%s %s%s' % \ |
190 |
++ (declare_opts, var, line[readonly_match.end():]) |
191 |
+ else: |
192 |
+- line = 'declare ' + line[readonly_match.end():] |
193 |
++ line = 'declare ' + var + line[readonly_match.end():] |
194 |
+ return line |
195 |
+ |
196 |
+-def filter_bash_environment(pattern, file_in, file_out): |
197 |
++def add_global_export_opt(line, options): |
198 |
++ export_match = export_re.match(line) |
199 |
++ if export_match is not None: |
200 |
++ declare_opts = export_match.group(1) |
201 |
++ if 'g' not in declare_opts and '--export-into-global-scope' in options: |
202 |
++ declare_opts += 'g' |
203 |
++ line = 'declare -%s %s' % \ |
204 |
++ (declare_opts, line[export_match.end():]) |
205 |
++ return line |
206 |
++ |
207 |
++def filter_bash_environment(pattern, file_in, file_out, options): |
208 |
+ # Filter out any instances of the \1 character from variable values |
209 |
+ # since this character multiplies each time that the environment |
210 |
+ # is saved (strange bash behavior). This can eventually result in |
211 |
+@@ -77,7 +93,8 @@ def filter_bash_environment(pattern, file_in, file_out): |
212 |
+ multi_line_quote = quote |
213 |
+ multi_line_quote_filter = filter_this |
214 |
+ if not filter_this: |
215 |
+- line = filter_declare_readonly_opt(line) |
216 |
++ line = filter_declare_readonly_opt(line, options) |
217 |
++ line = add_global_export_opt(line, options) |
218 |
+ file_out.write(line.replace("\1", "")) |
219 |
+ continue |
220 |
+ else: |
221 |
+@@ -87,7 +104,8 @@ def filter_bash_environment(pattern, file_in, file_out): |
222 |
+ filter_this = pattern.match(declare_match.group(2)) \ |
223 |
+ is not None |
224 |
+ if not filter_this: |
225 |
+- line = filter_declare_readonly_opt(line) |
226 |
++ line = filter_declare_readonly_opt(line, options) |
227 |
++ line = add_global_export_opt(line, options) |
228 |
+ file_out.write(line) |
229 |
+ continue |
230 |
+ |
231 |
+@@ -124,13 +142,28 @@ if __name__ == "__main__": |
232 |
+ "while leaving bash function definitions and here-documents " + \ |
233 |
+ "intact. The PATTERN is a space separated list of variable names" + \ |
234 |
+ " and it supports python regular expression syntax." |
235 |
+- usage = "usage: %s PATTERN" % os.path.basename(sys.argv[0]) |
236 |
+- args = sys.argv[1:] |
237 |
+- |
238 |
+- if '-h' in args or '--help' in args: |
239 |
+- sys.stdout.write(usage + "\n") |
240 |
+- sys.stdout.flush() |
241 |
+- sys.exit(os.EX_OK) |
242 |
++ usage = "usage: %s [-h|<options>] PATTERN" % os.path.basename(sys.argv[0]) |
243 |
++ args = [] |
244 |
++ known_options = { |
245 |
++ '--report-readonly-variables': |
246 |
++ "Write names of readonly variables to stderr.", |
247 |
++ '--preserve-readonly-attribute': |
248 |
++ "Preserve the '-r' flag in 'declare -r'.", |
249 |
++ '--export-into-global-scope': |
250 |
++ "Add the '-g' flag to 'declare -x'.", |
251 |
++ } |
252 |
++ options = {} |
253 |
++ for arg in sys.argv[1:]: |
254 |
++ if arg in known_options.keys(): |
255 |
++ options[arg] = True |
256 |
++ continue |
257 |
++ if '-h' == arg or '--help' == arg: |
258 |
++ sys.stdout.write(usage + "\n\nKnown <options>:\n\n") |
259 |
++ for option, descr in known_options.items(): |
260 |
++ sys.stdout.write(" " + option + "\t" + descr + "\n") |
261 |
++ sys.stdout.flush() |
262 |
++ sys.exit(os.EX_OK) |
263 |
++ args.append(arg) |
264 |
+ |
265 |
+ if len(args) != 1: |
266 |
+ sys.stderr.write(usage + "\n") |
267 |
+@@ -154,5 +187,5 @@ if __name__ == "__main__": |
268 |
+ |
269 |
+ var_pattern = "^(%s)$" % "|".join(var_pattern) |
270 |
+ filter_bash_environment( |
271 |
+- re.compile(var_pattern), file_in, file_out) |
272 |
++ re.compile(var_pattern), file_in, file_out, options) |
273 |
+ file_out.flush() |
274 |
+diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh |
275 |
+index ddef1fd..7264ced 100644 |
276 |
+--- a/bin/save-ebuild-env.sh |
277 |
++++ b/bin/save-ebuild-env.sh |
278 |
+@@ -53,7 +53,7 @@ __save_ebuild_env() { |
279 |
+ einfo einfon ewarn eerror ebegin __eend eend KV_major \ |
280 |
+ KV_minor KV_micro KV_to_int get_KV has \ |
281 |
+ __has_phase_defined_up_to \ |
282 |
+- hasv hasq __qa_source __qa_call \ |
283 |
++ hasv hasq __qa_source __qa_call __call-ebuildshell \ |
284 |
+ addread addwrite adddeny addpredict __sb_append_var \ |
285 |
+ use usev useq has_version portageq \ |
286 |
+ best_version use_with use_enable register_die_hook \ |
287 |
+diff --git a/man/make.conf.5 b/man/make.conf.5 |
288 |
+index 26bbf06..865ede9 100644 |
289 |
+--- a/man/make.conf.5 |
290 |
++++ b/man/make.conf.5 |
291 |
+@@ -382,6 +382,12 @@ exist). Also see the related \fIunmerge\-backup\fR feature. |
292 |
+ Use locks to ensure that unsandboxed ebuild phases never execute |
293 |
+ concurrently. Also see \fIparallel\-install\fR. |
294 |
+ .TP |
295 |
++.B ebuildshell |
296 |
++Drop into an interactive shell for each phase function, meant for |
297 |
++debugging. Because the shell would normally be used to execute the |
298 |
++phase function, commands like src_unpack or epatch are available in the |
299 |
++interactive shell. Use `die` to terminate the merge. |
300 |
++.TP |
301 |
+ .B fail\-clean |
302 |
+ Clean up temporary files after a build failure. This is particularly useful |
303 |
+ if you have \fBPORTAGE_TMPDIR\fR on tmpfs. If this feature is enabled, you |
304 |
+diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py |
305 |
+index 8bd30a6..4ff78b4 100644 |
306 |
+--- a/pym/_emerge/AbstractEbuildProcess.py |
307 |
++++ b/pym/_emerge/AbstractEbuildProcess.py |
308 |
+@@ -161,6 +161,7 @@ class AbstractEbuildProcess(SpawnProcess): |
309 |
+ self.fd_pipes = {} |
310 |
+ null_fd = None |
311 |
+ if 0 not in self.fd_pipes and \ |
312 |
++ "ebuildshell" not in self.settings.features and \ |
313 |
+ self.phase not in self._phases_interactive_whitelist and \ |
314 |
+ "interactive" not in self.settings.get("PROPERTIES", "").split(): |
315 |
+ null_fd = os.open('/dev/null', os.O_RDONLY) |
316 |
+diff --git a/pym/portage/const.py b/pym/portage/const.py |
317 |
+index 814d7f4..d84f9bf 100644 |
318 |
+--- a/pym/portage/const.py |
319 |
++++ b/pym/portage/const.py |
320 |
+@@ -142,6 +142,7 @@ SUPPORTED_FEATURES = frozenset([ |
321 |
+ "distlocks", |
322 |
+ "downgrade-backup", |
323 |
+ "ebuild-locks", |
324 |
++ "ebuildshell", |
325 |
+ "fail-clean", |
326 |
+ "fakeroot", |
327 |
+ "fixlafiles", |
328 |
+-- |
329 |
+2.7.3 |
330 |
+ |
331 |
|
332 |
diff --git a/sys-apps/portage/portage-2.2.28-r1.ebuild b/sys-apps/portage/portage-2.2.28-r1.ebuild |
333 |
new file mode 100644 |
334 |
index 0000000..672b9da |
335 |
--- /dev/null |
336 |
+++ b/sys-apps/portage/portage-2.2.28-r1.ebuild |
337 |
@@ -0,0 +1,259 @@ |
338 |
+# Copyright 1999-2016 Gentoo Foundation |
339 |
+# Distributed under the terms of the GNU General Public License v2 |
340 |
+# $Id$ |
341 |
+ |
342 |
+EAPI=5 |
343 |
+ |
344 |
+PYTHON_COMPAT=( |
345 |
+ pypy |
346 |
+ python3_3 python3_4 python3_5 |
347 |
+ python2_7 |
348 |
+) |
349 |
+PYTHON_REQ_USE='bzip2(+)' |
350 |
+ |
351 |
+inherit eutils distutils-r1 multilib |
352 |
+ |
353 |
+DESCRIPTION="Portage package manager used in Gentoo Prefix" |
354 |
+HOMEPAGE="http://prefix.gentoo.org/" |
355 |
+LICENSE="GPL-2" |
356 |
+KEYWORDS="~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
357 |
+SLOT="0" |
358 |
+IUSE="build doc epydoc +ipc linguas_ru selinux xattr prefix-chaining" |
359 |
+ |
360 |
+DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') ) |
361 |
+ >=sys-devel/make-3.82 |
362 |
+ >=app-arch/tar-1.27 |
363 |
+ dev-lang/python-exec:2 |
364 |
+ >=sys-apps/sed-4.0.5 sys-devel/patch |
365 |
+ doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 ) |
366 |
+ epydoc? ( >=dev-python/epydoc-2.0[$(python_gen_usedep 'python2*')] )" |
367 |
+# Require sandbox-2.2 for bug #288863. |
368 |
+# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's |
369 |
+# quite slow, so it's not considered in the dependencies as an alternative to |
370 |
+# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so |
371 |
+# for now, don't pull in xattr deps for other kernels. |
372 |
+# For whirlpool hash, require python[ssl] (bug #425046). |
373 |
+# For compgen, require bash[readline] (bug #445576). |
374 |
+RDEPEND=" |
375 |
+ >=app-arch/tar-1.27 |
376 |
+ dev-lang/python-exec:2 |
377 |
+ !build? ( |
378 |
+ >=sys-apps/sed-4.0.5 |
379 |
+ app-shells/bash:0[readline] |
380 |
+ >=app-admin/eselect-1.2 |
381 |
+ ) |
382 |
+ elibc_FreeBSD? ( !prefix? ( sys-freebsd/freebsd-bin ) ) |
383 |
+ elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) ) |
384 |
+ elibc_uclibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) ) |
385 |
+ kernel_linux? ( >=app-misc/pax-utils-0.1.17 ) |
386 |
+ kernel_SunOS? ( >=app-misc/pax-utils-0.1.17 ) |
387 |
+ kernel_FreeBSD? ( >=app-misc/pax-utils-0.1.17 ) |
388 |
+ kernel_Darwin? ( >=app-misc/pax-utils-0.1.18 ) |
389 |
+ kernel_HPUX? ( !hppa-hpux? ( >=app-misc/pax-utils-0.1.19 ) ) |
390 |
+ kernel_AIX? ( >=sys-apps/aix-miscutils-0.1.1634 ) |
391 |
+ selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] ) |
392 |
+ xattr? ( kernel_linux? ( |
393 |
+ >=sys-apps/install-xattr-0.3 |
394 |
+ $(python_gen_cond_dep 'dev-python/pyxattr[${PYTHON_USEDEP}]' \ |
395 |
+ python2_7 pypy) |
396 |
+ ) ) |
397 |
+ !prefix? ( !<app-admin/logrotate-3.8.0 )" |
398 |
+PDEPEND=" |
399 |
+ !build? ( |
400 |
+ >=net-misc/rsync-2.6.4 |
401 |
+ userland_GNU? ( >=sys-apps/coreutils-6.4 ) |
402 |
+ )" |
403 |
+# coreutils-6.4 rdep is for date format in emerge-webrsync #164532 |
404 |
+# NOTE: FEATURES=installsources requires debugedit and rsync |
405 |
+ |
406 |
+REQUIRED_USE="epydoc? ( $(python_gen_useflags 'python2*') )" |
407 |
+ |
408 |
+SRC_ARCHIVES="https://dev.gentoo.org/~dolsen/releases/portage http://dev.gentoo.org/~grobian/distfiles" |
409 |
+ |
410 |
+prefix_src_archives() { |
411 |
+ local x y |
412 |
+ for x in ${@}; do |
413 |
+ for y in ${SRC_ARCHIVES}; do |
414 |
+ echo ${y}/${x} |
415 |
+ done |
416 |
+ done |
417 |
+} |
418 |
+ |
419 |
+TARBALL_PV=${PV} |
420 |
+SRC_URI="mirror://gentoo/prefix-${PN}-${TARBALL_PV}.tar.bz2 |
421 |
+ $(prefix_src_archives prefix-${PN}-${TARBALL_PV}.tar.bz2)" |
422 |
+ |
423 |
+S="${WORKDIR}"/prefix-${PN}-${TARBALL_PV} |
424 |
+ |
425 |
+pkg_setup() { |
426 |
+ use epydoc && DISTUTILS_ALL_SUBPHASE_IMPLS=( python2.7 ) |
427 |
+} |
428 |
+ |
429 |
+python_prepare_all() { |
430 |
+ distutils-r1_python_prepare_all |
431 |
+ |
432 |
+ epatch "${FILESDIR}"/${PN}-2.2.28-ebuildshell.patch # 155161 |
433 |
+ use prefix-chaining && |
434 |
+ epatch "${FILESDIR}"/${PN}-2.2.14-prefix-chaining.patch |
435 |
+ |
436 |
+ # solved in git already, remove at next version |
437 |
+ sed -i -e "s/version = '2.2.27'/version = '2.2.27-prefix'/" \ |
438 |
+ setup.py || die |
439 |
+ |
440 |
+ if ! use ipc ; then |
441 |
+ einfo "Disabling ipc..." |
442 |
+ sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \ |
443 |
+ -i pym/_emerge/AbstractEbuildProcess.py || \ |
444 |
+ die "failed to patch AbstractEbuildProcess.py" |
445 |
+ fi |
446 |
+ |
447 |
+ if use xattr && use kernel_linux ; then |
448 |
+ einfo "Adding FEATURES=xattr to make.globals ..." |
449 |
+ echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \ |
450 |
+ || die "failed to append to make.globals" |
451 |
+ fi |
452 |
+ |
453 |
+ if [[ -n ${EPREFIX} ]] ; then |
454 |
+ # PREFIX LOCAL: only hack const_autotool |
455 |
+ local extrapath="/usr/bin:/bin" |
456 |
+ # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people |
457 |
+ # tend not to update that often, as long as we are a separate ebuild |
458 |
+ # we can assume when unset, it's time for some older trick |
459 |
+ if [[ -z ${PORTAGE_ROOT_USER} ]] ; then |
460 |
+ PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser') |
461 |
+ fi |
462 |
+ # lazy check, but works for now |
463 |
+ if [[ ${PORTAGE_ROOT_USER} == "root" ]] ; then |
464 |
+ # we need this for e.g. mtree on FreeBSD (and Darwin) which is in |
465 |
+ # /usr/sbin |
466 |
+ extrapath="/usr/sbin:/usr/bin:/sbin:/bin" |
467 |
+ fi |
468 |
+ local defaultpath="${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin" |
469 |
+ # We need to probe for bash in the Prefix, because it may not |
470 |
+ # exist, in which case we fall back to the currently in use |
471 |
+ # bash. This logic is necessary in particular during bootstrap, |
472 |
+ # where we pull ourselves out of a temporary place with tools |
473 |
+ local bash="${EPREFIX}/bin/bash" |
474 |
+ [[ ! -x ${bash} ]] && bash=${BASH} |
475 |
+ |
476 |
+ einfo "Adjusting sources for ${EPREFIX}" |
477 |
+ find . -type f -exec \ |
478 |
+ sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \ |
479 |
+ -e "s|@PORTAGE_MV@|$(type -P mv)|" \ |
480 |
+ -e "s|@PORTAGE_BASH@|${bash}|" \ |
481 |
+ -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \ |
482 |
+ -e "s|@DEFAULT_PATH@|${defaultpath}|" \ |
483 |
+ -e "s|@EXTRA_PATH@|${extrapath}|" \ |
484 |
+ -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \ |
485 |
+ -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \ |
486 |
+ -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \ |
487 |
+ -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \ |
488 |
+ -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \ |
489 |
+ -e "s|@sysconfdir@|${EPREFIX}/etc|" \ |
490 |
+ -i '{}' + || \ |
491 |
+ die "Failed to patch sources" |
492 |
+ # We don't need the below, since setup.py deal with this (and |
493 |
+ # more) so we don't have to make this correct |
494 |
+ # -e "s|@PORTAGE_BASE@|${EPREFIX}/usr/lib/portage/${EPYTHON}|" \ |
495 |
+ |
496 |
+ # remove Makefiles, or else they will get installed |
497 |
+ find . -name "Makefile.*" -delete |
498 |
+ |
499 |
+ einfo "Prefixing shebangs ..." |
500 |
+ while read -r -d $'\0' ; do |
501 |
+ local shebang=$(head -n1 "$REPLY") |
502 |
+ if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then |
503 |
+ sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \ |
504 |
+ die "sed failed" |
505 |
+ fi |
506 |
+ done < <(find . -type f -print0) |
507 |
+ # END PREFIX LOCAL |
508 |
+ fi |
509 |
+ |
510 |
+ # PREFIX LOCAL: make.conf is written by bootstrap-prefix.sh |
511 |
+ if use !prefix ; then |
512 |
+ cd "${S}/cnf" || die |
513 |
+ if [ -f "make.conf.${ARCH}".diff ]; then |
514 |
+ patch make.conf "make.conf.${ARCH}".diff || \ |
515 |
+ die "Failed to patch make.conf.example" |
516 |
+ else |
517 |
+ eerror "" |
518 |
+ eerror "Portage does not have an arch-specific configuration for this arch." |
519 |
+ eerror "Please notify the arch maintainer about this issue. Using generic." |
520 |
+ eerror "" |
521 |
+ fi |
522 |
+ fi |
523 |
+} |
524 |
+ |
525 |
+python_compile_all() { |
526 |
+ local targets=() |
527 |
+ use doc && targets+=( docbook ) |
528 |
+ use epydoc && targets+=( epydoc ) |
529 |
+ |
530 |
+ if [[ ${targets[@]} ]]; then |
531 |
+ esetup.py "${targets[@]}" |
532 |
+ fi |
533 |
+} |
534 |
+ |
535 |
+python_test() { |
536 |
+ esetup.py test |
537 |
+} |
538 |
+ |
539 |
+python_install() { |
540 |
+ # Install sbin scripts to bindir for python-exec linking |
541 |
+ # they will be relocated in pkg_preinst() |
542 |
+ distutils-r1_python_install \ |
543 |
+ --system-prefix="${EPREFIX}/usr" \ |
544 |
+ --bindir="$(python_get_scriptdir)" \ |
545 |
+ --docdir="${EPREFIX}/usr/share/doc/${PF}" \ |
546 |
+ --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \ |
547 |
+ --portage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" \ |
548 |
+ --sbindir="$(python_get_scriptdir)" \ |
549 |
+ --sysconfdir="${EPREFIX}/etc" \ |
550 |
+ "${@}" |
551 |
+} |
552 |
+ |
553 |
+python_install_all() { |
554 |
+ distutils-r1_python_install_all |
555 |
+ |
556 |
+ local targets=() |
557 |
+ use doc && targets+=( install_docbook ) |
558 |
+ use epydoc && targets+=( install_epydoc ) |
559 |
+ |
560 |
+ # install docs |
561 |
+ if [[ ${targets[@]} ]]; then |
562 |
+ esetup.py "${targets[@]}" |
563 |
+ fi |
564 |
+ |
565 |
+ # Due to distutils/python-exec limitations |
566 |
+ # these must be installed to /usr/bin. |
567 |
+ local sbin_relocations='archive-conf dispatch-conf emaint env-update etc-update fixpackages regenworld' |
568 |
+ einfo "Moving admin scripts to the correct directory" |
569 |
+ dodir /usr/sbin |
570 |
+ for target in ${sbin_relocations}; do |
571 |
+ einfo "Moving /usr/bin/${target} to /usr/sbin/${target}" |
572 |
+ mv "${ED}usr/bin/${target}" "${ED}usr/sbin/${target}" || die "sbin scripts move failed!" |
573 |
+ done |
574 |
+} |
575 |
+ |
576 |
+pkg_preinst() { |
577 |
+ # comment out sanity test until it is fixed to work |
578 |
+ # with the new PORTAGE_PYM_PATH |
579 |
+ #if [[ $ROOT == / ]] ; then |
580 |
+ ## Run some minimal tests as a sanity check. |
581 |
+ #local test_runner=$(find "${ED}" -name runTests) |
582 |
+ #if [[ -n $test_runner && -x $test_runner ]] ; then |
583 |
+ #einfo "Running preinst sanity tests..." |
584 |
+ #"$test_runner" || die "preinst sanity tests failed" |
585 |
+ #fi |
586 |
+ #fi |
587 |
+ |
588 |
+ # elog dir must exist to avoid logrotate error for bug #415911. |
589 |
+ # This code runs in preinst in order to bypass the mapping of |
590 |
+ # portage:portage to root:root which happens after src_install. |
591 |
+ keepdir /var/log/portage/elog |
592 |
+ # This is allowed to fail if the user/group are invalid for prefix users. |
593 |
+ if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"var/log/portage{,/elog} 2>/dev/null ; then |
594 |
+ chmod g+s,ug+rwx "${ED}"var/log/portage{,/elog} |
595 |
+ fi |
596 |
+} |