]> git.wh0rd.org - patches.git/blob - portage-debug-build.patch
initial import
[patches.git] / portage-debug-build.patch
1 --- pym/portage.py (revision 2565)
2 +++ pym/portage.py (working copy)
3 @@ -1266,10 +1266,6 @@
4 if "usersandbox" in self.features:
5 self.features.remove("usersandbox")
6
7 - self.features.sort()
8 - self["FEATURES"] = " ".join(["-*"]+self.features)
9 - self.backup_changes("FEATURES")
10 -
11 if not len(self["CBUILD"]) and len(self["CHOST"]):
12 self["CBUILD"] = self["CHOST"]
13 self.backup_changes("CBUILD")
14 @@ -1277,6 +1273,32 @@
15 if mycpv:
16 self.setcpv(mycpv)
17
18 + self.mutate_env
19 +
20 + def mutate_env(self):
21 + "emerge may have mutated the env slightly, so we may have to rebuild some things"
22 +
23 + if "debug-build" in self.features:
24 + # the profile should be setting these, but just in case ...
25 + if not len(self["DEBUG_CFLAGS"]):
26 + self["DEBUG_CFLAGS"] = "-g -O"
27 + self.backup_changes("DEBUG_CFLAGS")
28 + if not len(self["DEBUG_CXXFLAGS"]):
29 + self["DEBUG_CXXFLAGS"] = self["DEBUG_CFLAGS"]
30 + self.backup_changes("DEBUG_CXXFLAGS")
31 + # replace user vars with debug version
32 + for var in ["CFLAGS","CXXFLAGS","LDFLAGS"]:
33 + self[var]=self["DEBUG_"+var]
34 + self.backup_changes(var)
35 + # if user has splitdebug, the debug info will be auto saved for
36 + # gdb, otherwise we want to keep the binaries from being stripped
37 + if not "splitdebug" in self.features:
38 + self.features.append("nostrip")
39 +
40 + self.features.sort()
41 + self["FEATURES"] = " ".join(["-*"]+self.features)
42 + self.backup_changes("FEATURES")
43 +
44 def loadVirtuals(self,root):
45 self.virtuals = self.getvirtuals(root)
46
47 --- pym/portage_const.py (revision 2565)
48 +++ pym/portage_const.py (working copy)
49 @@ -40,7 +40,7 @@
50 CONFIG_MEMORY_FILE = PRIVATE_PATH + "/config"
51
52 INCREMENTALS=["USE","USE_EXPAND","USE_EXPAND_HIDDEN","FEATURES","ACCEPT_KEYWORDS","ACCEPT_LICENSE","CONFIG_PROTECT_MASK","CONFIG_PROTECT","PRELINK_PATH","PRELINK_PATH_MASK"]
53 -STICKIES=["KEYWORDS_ACCEPT","USE","CFLAGS","CXXFLAGS","MAKEOPTS","EXTRA_ECONF","EXTRA_EINSTALL","EXTRA_EMAKE"]
54 +STICKIES=["KEYWORDS_ACCEPT","USE","CFLAGS","CXXFLAGS","LDFLAGS","DEBUG_CFLAGS","DEBUG_CXXFLAGS","DEBUG_LDFLAGS","MAKEOPTS","EXTRA_ECONF","EXTRA_EINSTALL","EXTRA_EMAKE"]
55 EBUILD_PHASES = ["setup","unpack","compile","test","install","preinst","postinst","prerm","postrm"]
56
57 EAPI = 0
58 --- bin/emerge (revision 2565)
59 +++ bin/emerge (working copy)
60 @@ -173,6 +173,7 @@
61 "--ask",
62 "--buildpkg", "--buildpkgonly",
63 "--changelog", "--columns", "--cols",
64 +"--debug-build", "--debugbuild"
65 "--debug", "--deep",
66 "--digest",
67 "--emptytree",
68 @@ -429,6 +430,13 @@
69 if ("--nocolor" in myopts) and (sys.stdout.isatty()):
70 nocolor()
71
72 +# Now mutate portage env based upon options user gave us
73 +if ("--debug-build" in myopts):
74 + portage.settings.unlock()
75 + portage.settings.features.append("debug-build")
76 + portage.settings.mutate_env()
77 + portage.settings.lock()
78 +
79 CLEAN_DELAY = 5
80 EMERGE_WARNING_DELAY = 10
81 if portage.settings["CLEAN_DELAY"]: