summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/rootfs.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/rootfs.py')
-rw-r--r--meta/lib/oe/rootfs.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index a9a6c85a2c..5f1f7b3e5d 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -95,6 +95,57 @@ class Rootfs(object):
95 def _cleanup(self): 95 def _cleanup(self):
96 pass 96 pass
97 97
98 def _setup_dbg_rootfs(self, dirs):
99 gen_debugfs = self.d.getVar('IMAGE_GEN_DEBUGFS', True) or '0'
100 if gen_debugfs != '1':
101 return
102
103 bb.note(" Renaming the original rootfs...")
104 try:
105 shutil.rmtree(self.image_rootfs + '-orig')
106 except:
107 pass
108 os.rename(self.image_rootfs, self.image_rootfs + '-orig')
109
110 bb.note(" Creating debug rootfs...")
111 bb.utils.mkdirhier(self.image_rootfs)
112
113 bb.note(" Copying back package database...")
114 for dir in dirs:
115 bb.utils.mkdirhier(self.image_rootfs + os.path.dirname(dir))
116 shutil.copytree(self.image_rootfs + '-orig' + dir, self.image_rootfs + dir)
117
118 cpath = oe.cachedpath.CachedPath()
119 # Copy files located in /usr/lib/debug or /usr/src/debug
120 for dir in ["/usr/lib/debug", "/usr/src/debug"]:
121 src = self.image_rootfs + '-orig' + dir
122 if cpath.exists(src):
123 dst = self.image_rootfs + dir
124 bb.utils.mkdirhier(os.path.dirname(dst))
125 shutil.copytree(src, dst)
126
127 # Copy files with suffix '.debug' or located in '.debug' dir.
128 for root, dirs, files in cpath.walk(self.image_rootfs + '-orig'):
129 relative_dir = root[len(self.image_rootfs + '-orig'):]
130 for f in files:
131 if f.endswith('.debug') or '/.debug' in relative_dir:
132 bb.utils.mkdirhier(self.image_rootfs + relative_dir)
133 shutil.copy(os.path.join(root, f),
134 self.image_rootfs + relative_dir)
135
136 bb.note(" Install complementary '*-dbg' packages...")
137 self.pm.install_complementary('*-dbg')
138
139 bb.note(" Rename debug rootfs...")
140 try:
141 shutil.rmtree(self.image_rootfs + '-dbg')
142 except:
143 pass
144 os.rename(self.image_rootfs, self.image_rootfs + '-dbg')
145
146 bb.note(" Restoreing original rootfs...")
147 os.rename(self.image_rootfs + '-orig', self.image_rootfs)
148
98 def _exec_shell_cmd(self, cmd): 149 def _exec_shell_cmd(self, cmd):
99 fakerootcmd = self.d.getVar('FAKEROOT', True) 150 fakerootcmd = self.d.getVar('FAKEROOT', True)
100 if fakerootcmd is not None: 151 if fakerootcmd is not None:
@@ -369,6 +420,8 @@ class RpmRootfs(Rootfs):
369 420
370 self.pm.install_complementary() 421 self.pm.install_complementary()
371 422
423 self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', '/var/lib/smart'])
424
372 if self.inc_rpm_image_gen == "1": 425 if self.inc_rpm_image_gen == "1":
373 self.pm.backup_packaging_data() 426 self.pm.backup_packaging_data()
374 427
@@ -475,6 +528,8 @@ class DpkgRootfs(Rootfs):
475 528
476 self.pm.install_complementary() 529 self.pm.install_complementary()
477 530
531 self._setup_dbg_rootfs(['/var/lib/dpkg'])
532
478 self.pm.fix_broken_dependencies() 533 self.pm.fix_broken_dependencies()
479 534
480 self.pm.mark_packages("installed") 535 self.pm.mark_packages("installed")
@@ -743,6 +798,8 @@ class OpkgRootfs(Rootfs):
743 798
744 self.pm.install_complementary() 799 self.pm.install_complementary()
745 800
801 self._setup_dbg_rootfs(['/var/lib/opkg'])
802
746 execute_pre_post_process(self.d, opkg_post_process_cmds) 803 execute_pre_post_process(self.d, opkg_post_process_cmds)
747 execute_pre_post_process(self.d, rootfs_post_install_cmds) 804 execute_pre_post_process(self.d, rootfs_post_install_cmds)
748 805