1 |
On 11/05/2018 11:58 AM, Michał Górny wrote: |
2 |
> Similarly to FEATURES=binpkg-docompress, implement |
3 |
> FEATURES=binpkg-dostrip that controls whether stripping occurs before or |
4 |
> after building the binary package. |
5 |
> |
6 |
> This makes it possible to build binary packages with some debug |
7 |
> information that is stripped upon installing. Afterwards, the binary |
8 |
> packages can be reinstalled with debug info (either via nostrip or |
9 |
> splitdebug). Real usability of this feature will be limited by |
10 |
> optimization levels applied but still, it's better than nothing. |
11 |
> |
12 |
> Signed-off-by: Michał Górny <mgorny@g.o> |
13 |
> --- |
14 |
> bin/misc-functions.sh | 34 ++++++++++++++++++++++++++-------- |
15 |
> cnf/make.globals | 4 ++-- |
16 |
> lib/portage/const.py | 3 ++- |
17 |
> man/make.conf.5 | 15 ++++++++++++--- |
18 |
> 4 files changed, 42 insertions(+), 14 deletions(-) |
19 |
> |
20 |
> Changes in v2: |
21 |
> - manpage now mentions incompatibility with FEATURES=installsources. |
22 |
> |
23 |
> diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh |
24 |
> index 3b3a5e09c..5de26b44d 100755 |
25 |
> --- a/bin/misc-functions.sh |
26 |
> +++ b/bin/misc-functions.sh |
27 |
> @@ -1,5 +1,5 @@ |
28 |
> #!/bin/bash |
29 |
> -# Copyright 1999-2018 Gentoo Foundation |
30 |
> +# Copyright 1999-2018 Gentoo Authors |
31 |
> # Distributed under the terms of the GNU General Public License v2 |
32 |
> # |
33 |
> # Miscellaneous shell functions that make use of the ebuild env but don't need |
34 |
> @@ -117,13 +117,18 @@ install_qa_check() { |
35 |
> "${PORTAGE_BIN_PATH}"/ecompress --dequeue |
36 |
> fi |
37 |
> |
38 |
> - export STRIP_MASK |
39 |
> - if ___eapi_has_dostrip; then |
40 |
> - "${PORTAGE_BIN_PATH}"/estrip --queue "${PORTAGE_DOSTRIP[@]}" |
41 |
> - "${PORTAGE_BIN_PATH}"/estrip --ignore "${PORTAGE_DOSTRIP_SKIP[@]}" |
42 |
> - "${PORTAGE_BIN_PATH}"/estrip --dequeue |
43 |
> - else |
44 |
> - prepallstrip |
45 |
> + # If binpkg-dostrip is enabled, apply stripping before creating |
46 |
> + # the binary package. |
47 |
> + # Note: disabling it won't help with packages calling prepstrip directly. |
48 |
> + if has binpkg-dostrip ${FEATURES}; then |
49 |
> + export STRIP_MASK |
50 |
> + if ___eapi_has_dostrip; then |
51 |
> + "${PORTAGE_BIN_PATH}"/estrip --queue "${PORTAGE_DOSTRIP[@]}" |
52 |
> + "${PORTAGE_BIN_PATH}"/estrip --ignore "${PORTAGE_DOSTRIP_SKIP[@]}" |
53 |
> + "${PORTAGE_BIN_PATH}"/estrip --dequeue |
54 |
> + else |
55 |
> + prepallstrip |
56 |
> + fi |
57 |
> fi |
58 |
> |
59 |
> if has chflags $FEATURES ; then |
60 |
> @@ -186,6 +191,19 @@ __dyn_instprep() { |
61 |
> "${PORTAGE_BIN_PATH}"/ecompress --dequeue |
62 |
> fi |
63 |
> |
64 |
> + # If binpkg-dostrip is disabled, apply stripping before creating |
65 |
> + # the binary package. |
66 |
> + if ! has binpkg-dostrip ${FEATURES}; then |
67 |
> + export STRIP_MASK |
68 |
> + if ___eapi_has_dostrip; then |
69 |
> + "${PORTAGE_BIN_PATH}"/estrip --queue "${PORTAGE_DOSTRIP[@]}" |
70 |
> + "${PORTAGE_BIN_PATH}"/estrip --ignore "${PORTAGE_DOSTRIP_SKIP[@]}" |
71 |
> + "${PORTAGE_BIN_PATH}"/estrip --dequeue |
72 |
> + else |
73 |
> + prepallstrip |
74 |
> + fi |
75 |
> + fi |
76 |
> + |
77 |
> if has chflags ${FEATURES}; then |
78 |
> # Restore all the file flags that were saved earlier on. |
79 |
> mtree -U -e -p "${ED}" -k flags < "${T}/bsdflags.mtree" &> /dev/null |
80 |
> diff --git a/cnf/make.globals b/cnf/make.globals |
81 |
> index 72b567e98..d394a1890 100644 |
82 |
> --- a/cnf/make.globals |
83 |
> +++ b/cnf/make.globals |
84 |
> @@ -1,4 +1,4 @@ |
85 |
> -# Copyright 1999-2013 Gentoo Foundation |
86 |
> +# Copyright 1999-2018 Gentoo Authors |
87 |
> # Distributed under the terms of the GNU General Public License v2 |
88 |
> # System-wide defaults for the Portage system |
89 |
> |
90 |
> @@ -50,7 +50,7 @@ RESUMECOMMAND_SSH=${FETCHCOMMAND_SSH} |
91 |
> FETCHCOMMAND_SFTP="bash -c \"x=\\\${2#sftp://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port= ; eval \\\"declare -a ssh_opts=(\\\${3})\\\" ; exec sftp \\\${port:+-P \\\${port}} \\\"\\\${ssh_opts[@]}\\\" \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" sftp \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\"" |
92 |
> |
93 |
> # Default user options |
94 |
> -FEATURES="assume-digests binpkg-docompress binpkg-logs |
95 |
> +FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs |
96 |
> config-protect-if-modified distlocks ebuild-locks |
97 |
> fixlafiles merge-sync multilib-strict news |
98 |
> parallel-fetch preserve-libs protect-owned |
99 |
> diff --git a/lib/portage/const.py b/lib/portage/const.py |
100 |
> index a343fc040..602caeb34 100644 |
101 |
> --- a/lib/portage/const.py |
102 |
> +++ b/lib/portage/const.py |
103 |
> @@ -1,5 +1,5 @@ |
104 |
> # portage: Constants |
105 |
> -# Copyright 1998-2018 Gentoo Foundation |
106 |
> +# Copyright 1998-2018 Gentoo Authors |
107 |
> # Distributed under the terms of the GNU General Public License v2 |
108 |
> |
109 |
> from __future__ import unicode_literals |
110 |
> @@ -123,6 +123,7 @@ EBUILD_PHASES = ( |
111 |
> SUPPORTED_FEATURES = frozenset([ |
112 |
> "assume-digests", |
113 |
> "binpkg-docompress", |
114 |
> + "binpkg-dostrip", |
115 |
> "binpkg-logs", |
116 |
> "binpkg-multi-instance", |
117 |
> "buildpkg", |
118 |
> diff --git a/man/make.conf.5 b/man/make.conf.5 |
119 |
> index ec03c93ca..f69afd015 100644 |
120 |
> --- a/man/make.conf.5 |
121 |
> +++ b/man/make.conf.5 |
122 |
> @@ -1,4 +1,4 @@ |
123 |
> -.TH "MAKE.CONF" "5" "Feb 2016" "Portage VERSION" "Portage" |
124 |
> +.TH "MAKE.CONF" "5" "Nov 2018" "Portage VERSION" "Portage" |
125 |
> .SH "NAME" |
126 |
> make.conf \- custom settings for Portage |
127 |
> .SH "SYNOPSIS" |
128 |
> @@ -281,6 +281,14 @@ package. When this option is enabled (the default), documentation files are |
129 |
> already compressed inside binary packages. When it is disabled, binary packages |
130 |
> contain uncompressed documentation and Portage compresses it before installing. |
131 |
> .TP |
132 |
> +.B binpkg\-dostrip |
133 |
> +Perform file stripping before creating binary package. When this option is |
134 |
> +enabled (the default), executables are already stripped inside binary packages. |
135 |
> +When it is disabled, binary packages contain unstripped executables and Portage |
136 |
> +strips (or splits) them before installing. |
137 |
> + |
138 |
> +\fBbinpkg\-dostrip\fR must be enabled for \fBinstallsources\fR to work. |
139 |
> +.TP |
140 |
> .B binpkg\-logs |
141 |
> Keep logs from successful binary package merges. This is relevant only when |
142 |
> \fBPORT_LOGDIR\fR is set. |
143 |
> @@ -445,8 +453,9 @@ Enable portage support for the icecream package. |
144 |
> .TP |
145 |
> .B installsources |
146 |
> Install source code into /usr/src/debug/${CATEGORY}/${PF} (also see |
147 |
> -\fBsplitdebug\fR). This feature works only if debugedit is installed and CFLAGS |
148 |
> -is set to include debug information (such as with the \-ggdb flag). |
149 |
> +\fBsplitdebug\fR). This feature works only if debugedit is installed, CFLAGS |
150 |
> +is set to include debug information (such as with the \-ggdb flag) |
151 |
> +and \fBbinpkg-dostrip\fR is enabled. |
152 |
> .TP |
153 |
> .B ipc\-sandbox |
154 |
> Isolate the ebuild phase functions from host IPC namespace. Supported |
155 |
> |
156 |
|
157 |
Looks good, please merge. |
158 |
-- |
159 |
Thanks, |
160 |
Zac |