here's what i was talking about when i mentioned the mutate() idea
tested and it works for me ... binary is built properly and environment.bz2
contains the correct values
-mike
--- pym/portage.py (revision 2565)
+++ pym/portage.py (working copy)
@@ -1266,10 +1266,6 @@
if usersandbox in self.features:
self.features.remove(usersandbox)
- self.features.sort()
- self[FEATURES] = .join([-*]+self.features)
- self.backup_changes(FEATURES)
-
if not len(self[CBUILD]) and len(self[CHOST]):
self[CBUILD] = self[CHOST]
self.backup_changes(CBUILD)
@@ -1277,6 +1273,32 @@
if mycpv:
self.setcpv(mycpv)
+ self.mutate_env
+
+ def mutate_env(self):
+ emerge may have mutated the env slightly, so we may have to rebuild some things
+
+ if debug-build in self.features:
+ # the profile should be setting these, but just in case ...
+ if not len(self[DEBUG_CFLAGS]):
+self[DEBUG_CFLAGS] = -g -O
+self.backup_changes(DEBUG_CFLAGS)
+ if not len(self[DEBUG_CXXFLAGS]):
+self[DEBUG_CXXFLAGS] = self[DEBUG_CFLAGS]
+self.backup_changes(DEBUG_CXXFLAGS)
+ # replace user vars with debug version
+ for var in [CFLAGS,CXXFLAGS,LDFLAGS]:
+self[var]=self[DEBUG_+var]
+self.backup_changes(var)
+ # if user has splitdebug, the debug info will be auto saved for
+ # gdb, otherwise we want to keep the binaries from being stripped
+ if not splitdebug in self.features:
+self.features.append(nostrip)
+
+ self.features.sort()
+ self[FEATURES] = .join([-*]+self.features)
+ self.backup_changes(FEATURES)
+
def loadVirtuals(self,root):
self.virtuals = self.getvirtuals(root)
--- pym/portage_const.py (revision 2565)
+++ pym/portage_const.py (working copy)
@@ -40,7 +40,7 @@
CONFIG_MEMORY_FILE = PRIVATE_PATH + /config
INCREMENTALS=[USE,USE_EXPAND,USE_EXPAND_HIDDEN,FEATURES,ACCEPT_KEYWORDS,ACCEPT_LICENSE,CONFIG_PROTECT_MASK,CONFIG_PROTECT,PRELINK_PATH,PRELINK_PATH_MASK]
-STICKIES=[KEYWORDS_ACCEPT,USE,CFLAGS,CXXFLAGS,MAKEOPTS,EXTRA_ECONF,EXTRA_EINSTALL,EXTRA_EMAKE]
+STICKIES=[KEYWORDS_ACCEPT,USE,CFLAGS,CXXFLAGS,LDFLAGS,DEBUG_CFLAGS,DEBUG_CXXFLAGS,DEBUG_LDFLAGS,MAKEOPTS,EXTRA_ECONF,EXTRA_EINSTALL,EXTRA_EMAKE]
EBUILD_PHASES = [setup,unpack,compile,test,install,preinst,postinst,prerm,postrm]
EAPI = 0
--- bin/emerge (revision 2565)
+++ bin/emerge (working copy)
@@ -173,6 +173,7 @@
--ask,
--buildpkg, --buildpkgonly,
--changelog,--columns, --cols,
+--debug-build, --debugbuild
--debug,--deep,
--digest,
--emptytree,
@@ -429,6 +430,13 @@
if (--nocolor in myopts) and (sys.stdout.isatty()):
nocolor()
+# Now mutate portage env based upon options user gave us
+if (--debug-build in myopts):
+ portage.settings.unlock()
+ portage.settings.features.append(debug-build)
+ portage.settings.mutate_env()
+ portage.settings.lock()
+
CLEAN_DELAY = 5
EMERGE_WARNING_DELAY = 10
if portage.settings[CLEAN_DELAY]: