support/scripts/pkg-stats: fix host/target infra filter

The filter is supposed to exclude host/target infra from output if the
respective package is not built with the current
configuration.

However, excluding host packages did not work correctly: If keep_host
is False because the host package is not built, the next branch was
checked and included the host infra in output with "target" type if
the target package is built. For a package that support host and
target build, but gets built only for the target, this leads to output
like (Meson example):

meson (target)
host-meson (target)

Skip host infra in the target branch instead. Also include
Package.infra in Package.__str__() result, which was needed for
debugging this bug.

Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
Signed-off-by: Arnout Vandecappelle <arnout@rnout.be>
(cherry picked from commit e8dcebf459)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
Fiona Klute
2026-04-26 17:33:32 +02:00
committed by Thomas Perale
parent 1f1a302056
commit 5c5c8f4b08

View File

@@ -205,7 +205,7 @@ class Package:
infra = match.group(1)
if infra.startswith("host-") and keep_host:
self.infras.append(("host", infra[5:]))
elif keep_target:
elif not infra.startswith("host-") and keep_target:
self.infras.append(("target", infra))
def set_license(self):
@@ -342,9 +342,10 @@ class Package:
return self.path < other.path
def __str__(self):
return "%s (path='%s', license='%s', license_files='%s', hash='%s', patches=%d)" % \
return "%s (path='%s', license='%s', license_files='%s', hash='%s', patches=%d, infras=%r)" % \
(self.name, self.path, self.is_status_ok('license'),
self.is_status_ok('license-files'), self.status['hash'], self.patch_count)
self.is_status_ok('license-files'), self.status['hash'], self.patch_count,
self.infras)
def get_pkglist(trees, npackages, package_list):