[elbe-devel] [PATCH v2 2/2] dump: only compare /usr-unprefixed file names

Bastian Germann bage at linutronix.de
Tue Feb 21 12:34:38 CET 2023


Am 21.02.23 um 12:30 schrieb Kurt Kanzenbach:
> On Tue Feb 21 2023, Bastian Germann wrote:
>> 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>
> 
> Any bug reference available?

No, that came via phone.

>> ---
>>   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
> 
> fpath[len('/usr'):] maybe?

Okay, I'll take this one.

> Not sure whether it is important, some strings use single quotes and
> some double quotes in this file.

We do not really have a standard for this in elbe.
I prefer to use single quotes when there is nothing being evaluated in a string.

> Thanks,
> Kurt


More information about the elbe-devel mailing list