Gentoo Archives: gentoo-portage-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH] add support for compressing debug sections to save space
Date: Fri, 13 Jan 2012 20:30:19
Message-Id: 1326486597-28326-1-git-send-email-vapier@gentoo.org
1 Since binutils/gdb can compress the .debug* sections with zlib into
2 .zdebug*, we should be able to save quite a bit of space -- on my
3 system, I saw /usr/lib/debug/ go from ~20GB to ~7.5GB.
4
5 This requires binutils/gdb to be built with USE=zlib which is why
6 this defaults to off.
7
8 Signed-off-by: Mike Frysinger <vapier@g.o>
9 ---
10 bin/ebuild-helpers/prepstrip | 6 ++++--
11 man/make.conf.5 | 10 +++++++++-
12 pym/_emerge/EbuildPhase.py | 6 ++++--
13 pym/portage/const.py | 2 +-
14 4 files changed, 18 insertions(+), 6 deletions(-)
15
16 diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
17 index ee547f2..daaa252 100755
18 --- a/bin/ebuild-helpers/prepstrip
19 +++ b/bin/ebuild-helpers/prepstrip
20 @@ -15,7 +15,7 @@ exp_tf() {
21 eval ${var}_${flag}=$(tf has ${flag} ${!var})
22 done
23 }
24 -exp_tf FEATURES installsources nostrip splitdebug
25 +exp_tf FEATURES compressdebug installsources nostrip splitdebug
26 exp_tf RESTRICT binchecks installsources strip
27
28 [[ " ${FEATURES} " == *" force-prefix "* ]] || \
29 @@ -121,7 +121,9 @@ save_elf_debug() {
30 if [[ -e ${T}/prepstrip.split.debug ]] ; then
31 mv "${T}"/prepstrip.split.debug "${y}"
32 else
33 - ${OBJCOPY} --only-keep-debug "${x}" "${y}"
34 + local objcopy_flags="--only-keep-debug"
35 + ${FEATURES_compressdebug} && objcopy_flags+=" --compress-debug-sections"
36 + ${OBJCOPY} ${objcopy_flags} "${x}" "${y}"
37 ${OBJCOPY} --add-gnu-debuglink="${y}" "${x}"
38 fi
39 local args="a-x,o-w"
40 diff --git a/man/make.conf.5 b/man/make.conf.5
41 index f7491a9..e5a9ae1 100644
42 --- a/man/make.conf.5
43 +++ b/man/make.conf.5
44 @@ -260,6 +260,12 @@ Log file names have an extension that is appropriate for the compression
45 type. Currently, only \fBgzip\fR(1) compression is supported, so build
46 logs will have a '.gz' extension when this feature is enabled.
47 .TP
48 +.B compressdebug
49 +Compress the debug sections in the split debug files with zlib to save
50 +space. Make sure you have built both binutils and gdb with USE=zlib
51 +support for this to work. See \fBsplitdebug\fR for general split debug
52 +information (upon which this feature depends).
53 +.TP
54 .B config\-protect\-if\-modified
55 This causes the \fBCONFIG_PROTECT\fR behavior to be skipped for files
56 that have not been modified since they were installed.
57 @@ -476,7 +482,9 @@ instead of using \fBPORT_LOGDIR\fR directly.
58 .B splitdebug
59 Prior to stripping ELF etdyn and etexec files, the debugging info is
60 stored for later use by various debuggers. This feature is disabled by
61 -\fBnostrip\fR. For installation of source code, see \fBinstallsources\fR.
62 +\fBnostrip\fR. You should also consider setting \fBcompressdebug\fR so
63 +the files don't suck up a lot of space. For installation of source code,
64 +see \fBinstallsources\fR.
65 .TP
66 .B strict
67 Have portage react strongly to conditions that have the potential to be
68 diff --git a/pym/_emerge/EbuildPhase.py b/pym/_emerge/EbuildPhase.py
69 index ed0be0b..27944f4 100644
70 --- a/pym/_emerge/EbuildPhase.py
71 +++ b/pym/_emerge/EbuildPhase.py
72 @@ -33,11 +33,13 @@ class EbuildPhase(CompositeTask):
73 ("_ebuild_lock",)
74
75 # FEATURES displayed prior to setup phase
76 - _features_display = ("ccache", "distcc", "distcc-pump", "fakeroot",
77 + _features_display = (
78 + "ccache", "compressdebug", "distcc", "distcc-pump", "fakeroot",
79 "installsources", "keeptemp", "keepwork", "nostrip",
80 "preserve-libs", "sandbox", "selinux", "sesandbox",
81 "splitdebug", "suidctl", "test", "userpriv",
82 - "usersandbox")
83 + "usersandbox"
84 + )
85
86 # Locked phases
87 _locked_phases = ("setup", "preinst", "postinst", "prerm", "postrm")
88 diff --git a/pym/portage/const.py b/pym/portage/const.py
89 index 5fcb24f..bebb922 100644
90 --- a/pym/portage/const.py
91 +++ b/pym/portage/const.py
92 @@ -88,7 +88,7 @@ EBUILD_PHASES = ("pretend", "setup", "unpack", "prepare", "configure"
93 SUPPORTED_FEATURES = frozenset([
94 "assume-digests", "binpkg-logs", "buildpkg", "buildsyspkg", "candy",
95 "ccache", "chflags", "clean-logs",
96 - "collision-protect", "compress-build-logs",
97 + "collision-protect", "compress-build-logs", "compressdebug",
98 "config-protect-if-modified",
99 "digest", "distcc", "distcc-pump", "distlocks", "ebuild-locks", "fakeroot",
100 "fail-clean", "force-mirror", "force-prefix", "getbinpkg",
101 --
102 1.7.8.3

Replies