summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe
diff options
context:
space:
mode:
authorAlex Kiernan <alex.kiernan@gmail.com>2023-07-20 11:20:12 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-07-21 11:52:26 +0100
commit18f080fbe4cf51824e5f1d73a10e06e3a5724423 (patch)
tree9554889163bf595328fd709a65db19b1a8d85ee1 /meta/lib/oe
parentc15e506a4674e558922c5a75512ca2b5c296cd44 (diff)
downloadpoky-18f080fbe4cf51824e5f1d73a10e06e3a5724423.tar.gz
rootfs: Add debugfs package db file copy and cleanup
When copying the package database files for the debugfs, add individual file copy as well as tree copying. After the debug rootfs has been created, cleanup the package files. This then allows us to avoid a problem where (for rpm at least) extraneous files in the debug rootfs would cause failures during oe-selftest because some files existed in both regular and debugfs images. (From OE-Core rev: ce49ea435ce55eb5b6da442c12e03a806534c38d) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r--meta/lib/oe/rootfs.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index 890ba5f039..1a48ed10b3 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -106,7 +106,7 @@ class Rootfs(object, metaclass=ABCMeta):
106 def _cleanup(self): 106 def _cleanup(self):
107 pass 107 pass
108 108
109 def _setup_dbg_rootfs(self, dirs): 109 def _setup_dbg_rootfs(self, package_paths):
110 gen_debugfs = self.d.getVar('IMAGE_GEN_DEBUGFS') or '0' 110 gen_debugfs = self.d.getVar('IMAGE_GEN_DEBUGFS') or '0'
111 if gen_debugfs != '1': 111 if gen_debugfs != '1':
112 return 112 return
@@ -122,11 +122,12 @@ class Rootfs(object, metaclass=ABCMeta):
122 bb.utils.mkdirhier(self.image_rootfs) 122 bb.utils.mkdirhier(self.image_rootfs)
123 123
124 bb.note(" Copying back package database...") 124 bb.note(" Copying back package database...")
125 for dir in dirs: 125 for path in package_paths:
126 if not os.path.isdir(self.image_rootfs + '-orig' + dir): 126 bb.utils.mkdirhier(self.image_rootfs + os.path.dirname(path))
127 continue 127 if os.path.isdir(self.image_rootfs + '-orig' + path):
128 bb.utils.mkdirhier(self.image_rootfs + os.path.dirname(dir)) 128 shutil.copytree(self.image_rootfs + '-orig' + path, self.image_rootfs + path, symlinks=True)
129 shutil.copytree(self.image_rootfs + '-orig' + dir, self.image_rootfs + dir, symlinks=True) 129 elif os.path.isfile(self.image_rootfs + '-orig' + path):
130 shutil.copyfile(self.image_rootfs + '-orig' + path, self.image_rootfs + path)
130 131
131 # Copy files located in /usr/lib/debug or /usr/src/debug 132 # Copy files located in /usr/lib/debug or /usr/src/debug
132 for dir in ["/usr/lib/debug", "/usr/src/debug"]: 133 for dir in ["/usr/lib/debug", "/usr/src/debug"]:
@@ -162,6 +163,13 @@ class Rootfs(object, metaclass=ABCMeta):
162 bb.note(" Install extra debug packages...") 163 bb.note(" Install extra debug packages...")
163 self.pm.install(extra_debug_pkgs.split(), True) 164 self.pm.install(extra_debug_pkgs.split(), True)
164 165
166 bb.note(" Removing package database...")
167 for path in package_paths:
168 if os.path.isdir(self.image_rootfs + path):
169 shutil.rmtree(self.image_rootfs + path)
170 elif os.path.isfile(self.image_rootfs + path):
171 os.remove(self.image_rootfs + path)
172
165 bb.note(" Rename debug rootfs...") 173 bb.note(" Rename debug rootfs...")
166 try: 174 try:
167 shutil.rmtree(self.image_rootfs + '-dbg') 175 shutil.rmtree(self.image_rootfs + '-dbg')