support/scripts/pkg-stats: don't buffer whole file searching for infra

The file handle can be iterated over directly and each line is used
exactly once, so the only effect of reading all lines into a list
first was higher memory use and complexity.

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

View File

@@ -197,8 +197,7 @@ class Package:
self.infras = list()
with open(self.pkgfile, 'r') as f:
lines = f.readlines()
for line in lines:
for line in f:
match = INFRA_RE.match(line)
if not match:
continue