projects: Make the build order and package list deterministic #119

Merged
Jan Lindemann merged 2 commits from jan/feature/20260922-deterministic-output into master 2026-09-22 09:17:55 +02:00 AGit

The output of projects build --build-order and of required-os-pkg is correct but not reproducible: both are built by iterating Python sets, so the order followed the hash seed of the Python process, and two runs of the same invocation could print different orders. Makes debugging harder, so make the output stable.

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.

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.

The output of `projects build --build-order` and of `required-os-pkg` is correct but not reproducible: both are built by iterating Python sets, so the order followed the hash seed of the Python process, and two runs of the same invocation could print different orders. Makes debugging harder, so make the output stable. #### 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. #### 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.
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 <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.86.1
cmds.projects.CmdRequiredOsPkg: Sort output
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m36s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m45s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 5m36s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m34s
CI / Packaging test (push) Successful in 0s
3dc64050b5
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 <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.86.1
Jan Lindemann scheduled this pull request to auto merge when all checks succeed 2026-09-22 09:07:28 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
janware/jw-pkg!119
No description provided.