Gentoo Archives: gentoo-portage-dev

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

Replies