[elbe-devel] [PATCH v2 2/2] dump: only compare /usr-unprefixed file names
Bastian Germann
bage at linutronix.de
Tue Feb 21 09:52:48 CET 2023
Collect the apt package index without the /usr prefix.
Unprefix the comparisons against it as well.
This will result in falsely claimed "postinst generated" files being mapped
to their package, which potentially populates the target package list with
more packages on stripped-down (diet, tighten) systems.
Signed-off-by: Bastian Germann <bage at linutronix.de>
---
elbepack/dump.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/elbepack/dump.py b/elbepack/dump.py
index 6d889bd566..758c7a1baa 100644
--- a/elbepack/dump.py
+++ b/elbepack/dump.py
@@ -221,7 +221,7 @@ def elbe_report(xml, buildenv, cache, targetfs):
for p in instpkgs:
report.info("|%s|%s|%s", p.name, p.installed_version, p.origin)
- index = cache.get_fileindex()
+ index = cache.get_fileindex(removeprefix='/usr')
mt_index = targetfs.mtime_snap()
if xml.has("archive") and not xml.text("archive") is None:
@@ -247,8 +247,9 @@ def elbe_report(xml, buildenv, cache, targetfs):
tgt_pkg_list = set()
for fpath, _ in targetfs.walk_files():
- if fpath in index:
- pkg = index[fpath]
+ unprefixed = fpath[4:] if fpath.startswith('/usr') else fpath
+ if unprefixed in index:
+ pkg = index[unprefixed]
tgt_pkg_list.add(pkg)
else:
pkg = "postinst generated"
@@ -277,8 +278,9 @@ def elbe_report(xml, buildenv, cache, targetfs):
for fpath in list(mt_index.keys()):
if fpath not in mt_index_post_fine:
- if fpath in index:
- pkg = index[fpath]
+ unprefixed = fpath[4:] if fpath.startswith('/usr') else fpath
+ if unprefixed in index:
+ pkg = index[unprefixed]
else:
pkg = "postinst generated"
report.info("|+%s+|%s", fpath, pkg)
--
2.30.2
More information about the elbe-devel
mailing list