From d297625fba059f4f65a415d20ea43d4c08732e67 Mon Sep 17 00:00:00 2001 From: Eugenio Paolantonio Date: Mon, 13 May 2024 14:45:51 +0200 Subject: [PATCH] pkglistgen: tool: decouple summary dict creation The summary dictionary used to create summary-{scope}.txt was previously returned by solve_project() via write_all_groups(). After c46dd3e304d8e66e5f8f6a51bfa3ebda8cba8936, solve_project() doesn't return anything anymore, as write_all_groups() is being invoked just after solve_project(). Thus, the "summary" dictionary would always be None. Since the summary dict creation is generic enough, move it to its own function, and call it afterwards after project solving. This commit also drops the return statement both on write_all_groups() and write_productcompose() (where it would always return an empty dictionary), and moves the write_productcompose() call after solve_project() as well to match the change with write_all_groups(). Signed-off-by: Eugenio Paolantonio --- pkglistgen/tool.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/pkglistgen/tool.py b/pkglistgen/tool.py index ac272466c..cf0071916 100644 --- a/pkglistgen/tool.py +++ b/pkglistgen/tool.py @@ -138,7 +138,6 @@ def write_group_stubs(self): def write_productcompose(self): self._check_supplements() - summary = dict() archs = ['*'] + self.all_architectures # a single file covering all builds via multibuild flavors with open(os.path.join(self.productcompose_dir, 'default.productcompose'), 'a') as opfh: @@ -178,17 +177,13 @@ def write_productcompose(self): for included_arch in self.all_architectures: opfh.write(' - ' + f + '_' + included_arch + '\n') - return summary - def write_all_groups(self): self._check_supplements() - summary = dict() archs = ['*'] + self.all_architectures for name in self.groups: group = self.groups[name] if not group.solved: continue - summary[name] = group.summary() fn = f'{group.name}.group' with open(os.path.join(self.output_dir, fn), 'w') as fh: comment = group.comment @@ -200,6 +195,15 @@ def write_all_groups(self): x = re.sub(r'\s*