Skip to content

Commit

Permalink
Merge pull request #3078 from g7/solve-project-return
Browse files Browse the repository at this point in the history
pkglistgen: tool: decouple summary dict creation
  • Loading branch information
g7 committed May 14, 2024
2 parents ed30d28 + d297625 commit 7b5a3b7
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions pkglistgen/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -200,6 +195,15 @@ def write_all_groups(self):
x = re.sub(r'\s*<!-- reason:', ' <!-- reason:', x)
fh.write(x)

def make_summary(self):
self._check_supplements()
summary = dict()
for name in self.groups:
group = self.groups[name]
if not group.solved:
continue
summary[name] = group.summary()

return summary

def solve_module(self, groupname, includes, excludes, use_recommends):
Expand Down Expand Up @@ -613,8 +617,6 @@ def solve_project(
module.solved_packages[arch].pop(p, None)

self._collect_unsorted_packages(modules, self.groups.get('unsorted'))
if not self.skip_productcompose:
self.write_productcompose()

def strip_medium_from_staging(self, path):
# staging projects don't need source and debug medium - and the glibc source
Expand Down Expand Up @@ -798,15 +800,21 @@ def update_and_solve_target(
self.load_all_groups()
self.write_group_stubs()
else:
summary = self.solve_project(
self.solve_project(
ignore_unresolvable=str2bool(target_config.get('pkglistgen-ignore-unresolvable')),
ignore_recommended=str2bool(target_config.get('pkglistgen-ignore-recommended')),
locale=target_config.get('pkglistgen-locale'),
locales_from=target_config.get('pkglistgen-locales-from')
)

if not self.skip_productcompose:
self.write_productcompose()

if product_dir:
self.write_all_groups()

summary = self.make_summary()

if stop_after_solve:
return

Expand Down

0 comments on commit 7b5a3b7

Please sign in to comment.