From 7af9a705d761ae265a62ea7d0312a7b5f4ac8b4d Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Tue, 22 Sep 2026 06:40:51 +0200 Subject: [PATCH 1/2] cmds.projects.CmdBuild: Sort build order The build order printed by projects build is not reproducible: calculate_order() picks the next module by iterating all_deps, a set, so the order among modules that are ready at the same time depends on the hash seed of the Python process, and two runs of the same invocation can print different orders. Select the next module from the sorted set instead. The order stays topologically valid, and is now identical across runs and hash seeds. Sort the unresolvable-dependency error message the same way, so that it is stable, too. Signed-off-by: Jan Lindemann Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.86.1 --- src/python/jw/pkg/cmds/projects/CmdBuild.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/python/jw/pkg/cmds/projects/CmdBuild.py b/src/python/jw/pkg/cmds/projects/CmdBuild.py index 09f71122..3a29b899 100644 --- a/src/python/jw/pkg/cmds/projects/CmdBuild.py +++ b/src/python/jw/pkg/cmds/projects/CmdBuild.py @@ -162,15 +162,16 @@ class CmdBuild(Cmd): # export log(DEBUG, f'--- Adding dependency tree of module "{m}"') add_dep_tree(m, dep_flavours, dep_tree, all_deps) while len(all_deps): - # Find any leaf - for d in all_deps: + # Find any leaf, deterministically: sorted, so that the + # order is reproducible across runs + for d in sorted(all_deps): # Dependency d doesn't have dependencies itself if not len(dep_tree[d]): break # found else: # no Leaf found raise Exception( 'Fatal: Dependencies between these modules are unresolvable: ' - ', '.join(all_deps) + ', '.join(sorted(all_deps)) ) order.append(d) # do it # bookkeep it -- 2.55.0 From 3dc64050b5a37d422af55dc6cbcfd7e079eb5af5 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Tue, 22 Sep 2026 06:48:01 +0200 Subject: [PATCH 2/2] cmds.projects.CmdRequiredOsPkg: Sort output The list of OS packages printed by required-os-pkg is not reproducible: the packages are collected in a set, and the set's iteration order depends on the hash seed of the Python process, so two runs of the same invocation can print the same packages in different orders. Print the sorted list instead. The order of a package list is meaningless to the package manager, and the output is now stable across runs and hash seeds. Signed-off-by: Jan Lindemann Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.86.1 --- src/python/jw/pkg/cmds/projects/CmdRequiredOsPkg.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python/jw/pkg/cmds/projects/CmdRequiredOsPkg.py b/src/python/jw/pkg/cmds/projects/CmdRequiredOsPkg.py index 329b941f..c19ebb47 100644 --- a/src/python/jw/pkg/cmds/projects/CmdRequiredOsPkg.py +++ b/src/python/jw/pkg/cmds/projects/CmdRequiredOsPkg.py @@ -66,6 +66,7 @@ class CmdRequiredOsPkg(Cmd): # export vals = self.app.get_values(deps, ['pkg.requires.' + sec], [flavour]) if vals: requires |= set(vals) - out = [f'"{dep}"' for dep in requires] if args.quote else requires + out = sorted(requires) + out = [f'"{dep}"' for dep in out] if args.quote else out # TODO: add all not in build tree as -devel print(' '.join(out)) -- 2.55.0