[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-portage-dev
Subject:    [gentoo-portage-dev] [PATCH] Support disabling stripping for binary packages
From:       Michał Górny <mgorny () gentoo ! org>
Date:       2018-11-05 19:39:16
Message-ID: 20181105193916.16394-1-mgorny () gentoo ! org
[Download RAW message or body]

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@gentoo.org>
---
 bin/misc-functions.sh | 34 ++++++++++++++++++++++++++--------
 cnf/make.globals      |  4 ++--
 lib/portage/const.py  |  3 ++-
 man/make.conf.5       |  8 +++++++-
 4 files changed, 37 insertions(+), 12 deletions(-)

Note:
Tested it with both FEATURES=binpkg-dostrip states, and -K installs
of package with stripping on, nostrip and splitdebug.

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..44640238a 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,12 @@ 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.
+.TP
 .B binpkg\-logs
 Keep logs from successful binary package merges. This is relevant only when
 \fBPORT_LOGDIR\fR is set.
-- 
2.19.1


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic