commit:     b3a6959b9d383bb602c616668c3866e312ff6dbf
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Nov  5 19:21:28 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Nov  5 20:30:07 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b3a6959b

Support disabling stripping for binary packages

Similarly to FEATURES=binpkg-docompress, implement
FEATURES=binpkg-dostrip that controls whether stripping occurs before or
after building the binary package.

This makes it possible to build binary packages with some debug
information that is stripped upon installing.  Afterwards, the binary
packages can be reinstalled with debug info (either via nostrip or
splitdebug).  Real usability of this feature will be limited by
optimization levels applied but still, it's better than nothing.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/misc-functions.sh | 34 ++++++++++++++++++++++++++--------
 cnf/make.globals      |  4 ++--
 lib/portage/const.py  |  3 ++-
 man/make.conf.5       | 15 ++++++++++++---
 4 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 3b3a5e09c..5de26b44d 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 #
 # Miscellaneous shell functions that make use of the ebuild env but don't need
@@ -117,13 +117,18 @@ install_qa_check() {
                "${PORTAGE_BIN_PATH}"/ecompress --dequeue
        fi
 
-       export STRIP_MASK
-       if ___eapi_has_dostrip; then
-               "${PORTAGE_BIN_PATH}"/estrip --queue "${PORTAGE_DOSTRIP[@]}"
-               "${PORTAGE_BIN_PATH}"/estrip --ignore 
"${PORTAGE_DOSTRIP_SKIP[@]}"
-               "${PORTAGE_BIN_PATH}"/estrip --dequeue
-       else
-               prepallstrip
+       # If binpkg-dostrip is enabled, apply stripping before creating
+       # the binary package.
+       # Note: disabling it won't help with packages calling prepstrip 
directly.
+       if has binpkg-dostrip ${FEATURES}; then
+               export STRIP_MASK
+               if ___eapi_has_dostrip; then
+                       "${PORTAGE_BIN_PATH}"/estrip --queue 
"${PORTAGE_DOSTRIP[@]}"
+                       "${PORTAGE_BIN_PATH}"/estrip --ignore 
"${PORTAGE_DOSTRIP_SKIP[@]}"
+                       "${PORTAGE_BIN_PATH}"/estrip --dequeue
+               else
+                       prepallstrip
+               fi
        fi
 
        if has chflags $FEATURES ; then
@@ -186,6 +191,19 @@ __dyn_instprep() {
                "${PORTAGE_BIN_PATH}"/ecompress --dequeue
        fi
 
+       # If binpkg-dostrip is disabled, apply stripping before creating
+       # the binary package.
+       if ! has binpkg-dostrip ${FEATURES}; then
+               export STRIP_MASK
+               if ___eapi_has_dostrip; then
+                       "${PORTAGE_BIN_PATH}"/estrip --queue 
"${PORTAGE_DOSTRIP[@]}"
+                       "${PORTAGE_BIN_PATH}"/estrip --ignore 
"${PORTAGE_DOSTRIP_SKIP[@]}"
+                       "${PORTAGE_BIN_PATH}"/estrip --dequeue
+               else
+                       prepallstrip
+               fi
+       fi
+
        if has chflags ${FEATURES}; then
                # Restore all the file flags that were saved earlier on.
                mtree -U -e -p "${ED}" -k flags < "${T}/bsdflags.mtree" &> 
/dev/null

diff --git a/cnf/make.globals b/cnf/make.globals
index 72b567e98..d394a1890 100644
--- a/cnf/make.globals
+++ b/cnf/make.globals
@@ -1,4 +1,4 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 # System-wide defaults for the Portage system
 
@@ -50,7 +50,7 @@ RESUMECOMMAND_SSH=${FETCHCOMMAND_SSH}
 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}\""
 
 # Default user options
-FEATURES="assume-digests binpkg-docompress binpkg-logs
+FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs
           config-protect-if-modified distlocks ebuild-locks
           fixlafiles merge-sync multilib-strict news
           parallel-fetch preserve-libs protect-owned

diff --git a/lib/portage/const.py b/lib/portage/const.py
index a343fc040..602caeb34 100644
--- a/lib/portage/const.py
+++ b/lib/portage/const.py
@@ -1,5 +1,5 @@
 # portage: Constants
-# Copyright 1998-2018 Gentoo Foundation
+# Copyright 1998-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import unicode_literals
@@ -123,6 +123,7 @@ EBUILD_PHASES            = (
 SUPPORTED_FEATURES       = frozenset([
        "assume-digests",
        "binpkg-docompress",
+       "binpkg-dostrip",
        "binpkg-logs",
        "binpkg-multi-instance",
        "buildpkg",

diff --git a/man/make.conf.5 b/man/make.conf.5
index ec03c93ca..f69afd015 100644
--- a/man/make.conf.5
+++ b/man/make.conf.5
@@ -1,4 +1,4 @@
-.TH "MAKE.CONF" "5" "Feb 2016" "Portage VERSION" "Portage"
+.TH "MAKE.CONF" "5" "Nov 2018" "Portage VERSION" "Portage"
 .SH "NAME"
 make.conf \- custom settings for Portage
 .SH "SYNOPSIS"
@@ -281,6 +281,14 @@ package.  When this option is enabled (the default), 
documentation files are
 already compressed inside binary packages.  When it is disabled, binary 
packages
 contain uncompressed documentation and Portage compresses it before installing.
 .TP
+.B binpkg\-dostrip
+Perform file stripping before creating binary package.  When this option is
+enabled (the default), executables are already stripped inside binary packages.
+When it is disabled, binary packages contain unstripped executables and Portage
+strips (or splits) them before installing.
+
+\fBbinpkg\-dostrip\fR must be enabled for \fBinstallsources\fR to work.
+.TP
 .B binpkg\-logs
 Keep logs from successful binary package merges. This is relevant only when
 \fBPORT_LOGDIR\fR is set.
@@ -445,8 +453,9 @@ Enable portage support for the icecream package.
 .TP
 .B installsources
 Install source code into /usr/src/debug/${CATEGORY}/${PF} (also see
-\fBsplitdebug\fR). This feature works only if debugedit is installed and CFLAGS
-is set to include debug information (such as with the \-ggdb flag).
+\fBsplitdebug\fR). This feature works only if debugedit is installed, CFLAGS
+is set to include debug information (such as with the \-ggdb flag)
+and \fBbinpkg-dostrip\fR is enabled.
 .TP
 .B ipc\-sandbox
 Isolate the ebuild phase functions from host IPC namespace. Supported

Reply via email to