summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Kiernan <alex.kiernan@gmail.com>2023-07-20 11:20:12 +0100
committerSteve Sakoman <steve@sakoman.com>2023-08-15 06:18:49 -1000
commit9f3e151acd49421a9ba99669751b7543d905b0b3 (patch)
tree5031e2a8f053c39de7b3da3eb84cb0dc1155419b
parent07fc9ad254055ca87302e1c0c74d50775b8550a6 (diff)
downloadpoky-9f3e151acd49421a9ba99669751b7543d905b0b3.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: 4931839ff97e8746cdabe1d06298a96a47638b2b) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> (cherry picked from commit ce49ea435ce55eb5b6da442c12e03a806534c38d) Signed-off-by: Steve Sakoman <steve@sakoman.com>
-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')