Skip to content

fix(packages): a patch respin no longer sorts below the release it supersedes - #98

Merged
srpatcha merged 3 commits into
embeddedos-org:masterfrom
Kartikey1306:fix/letter-suffix-version-ordering
Sep 1, 2026
Merged

fix(packages): a patch respin no longer sorts below the release it supersedes#98
srpatcha merged 3 commits into
embeddedos-org:masterfrom
Kartikey1306:fix/letter-suffix-version-ordering

Conversation

@Kartikey1306

Copy link
Copy Markdown
Contributor

Stacked on #97, which restores this test module's import. Review the last commit; the diff collapses once #97 lands.

version_sort_key("1.2.11b") sorts below version_sort_key("1.2.11"), so a registry holding both resolves latest to the superseded release.

>>> version_sort_key("1.2.11")      # ((1,1,''), (1,2,''), (1,11,'')),  1, ()
>>> version_sort_key("1.2.11b")     # ((1,1,''), (1,2,''), (0,0,'11b')), 1, ()
>>> version_sort_key("1.2.11b") < version_sort_key("1.2.11")
True   # wrong

Cause

_component_key recognises a component only when it is entirely digits. The digits-then-letters form — 1.2.11b after 1.2.11, how zlib and OpenSSL number a patch respin — falls through to the text branch and returns (0, 0, "11b"). The leading 0 ranks it below every numeric component, including the (1, 11, "") it should immediately follow.

Fix

Give that form the numeric rank of its digits and order on the letters after them:

  • 1.2.11 < 1.2.11a < 1.2.11b
  • a genuinely textual component (1.2.beta) still ranks below any numeric one, so the order stays total
  • 3.6.0-rc1 < 3.6.0 and 1.3.1 < 2.9.3 < 11.1.0 are unchanged

test_letter_suffix_sorts_above_its_base already asserted the first of these. It has been failing since the module renamed version_keyversion_sort_key — which the suite could not report while collection was broken (#97). Two further tests added for respin-vs-respin and respin-vs-text ordering.

🤖 Generated with Claude Code

Kartikey1306 and others added 2 commits September 1, 2026 15:47
`import ebuild.cli.commands` raises NameError on master, so the `ebuild`
command does not start and pytest cannot collect nine test modules --
the suite reports "9 errors during collection" and runs zero tests.

Four PRs landed their tests while their implementation was discarded
during conflict resolution, and the merges that did it were not gated by
a run: f5209ac, current master, has no CI runs at all.

  embeddedos-org#64 (6a22e36)  tests/unit/test_golden_path_commands.py landed;
                 _workspace_repo_paths, _cached_repo_libraries,
                 _record_board_selection, _EOS_PROJECT_CONFIG and the
                 `configure --board` option did not.
  embeddedos-org#89 (32348f0)  commands.py gained five `re.` uses, no `import re`.
  embeddedos-org#90 (d3958f7)  the initramfs test kept its assertions but lost its
                 `_newc_members` helper and its `os` / `stat` imports.
  embeddedos-org#92            registry.version_key was renamed version_sort_key
                 without updating its caller in the tests.

Restoring them, taken verbatim from the branches that were merged:

* commands.py: `import re`; `_workspace_repo_paths`,
  `_cached_repo_libraries`, `_record_board_selection`,
  `_EOS_PROJECT_CONFIG`; the `--board` option on `configure` and the
  call that persists it; and the `{**_workspace_repo_paths(), **...}`
  merge at both `_install_packages` call sites.

  Without that last hunk a scaffolded project that `use`s eos or eboot
  gets no include or link paths from ~/.ebuild/repos, which is the
  "fatal error: eos/hal.h: No such file or directory" that embeddedos-org#64 fixed.
  Without the option, the documented golden path -- `configure --board`
  then a bare `build` -- fails with "no such option: --board".

* the initramfs test: `os` / `stat` imports and the `_newc_members`
  newc parser the assertions call.

* test_package_registry.py: import the name the module now exports.

Collection goes from 9 errors / 0 tests to 446 passing. The 12 that
still fail are pre-existing and out of scope here: `doctor` (embeddedos-org#72) and
`package` (embeddedos-org#77) are two more features whose implementations the same
merges dropped and which should be restored by their authors, and the
rest are separate bugs -- see the PR description.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…persedes

version_sort_key("1.2.11b") sorted *below* version_sort_key("1.2.11"),
so a registry holding both resolved "latest" to the superseded release.

_component_key only recognises a component that is entirely digits. The
digits-then-letters form -- 1.2.11b after 1.2.11, which is how zlib and
OpenSSL number a patch respin -- fell through to the text branch and
returned (0, 0, "11b"), and the leading 0 ranks it below every numeric
component, including the (1, 11, "") it should follow.

Give that form the numeric rank of its digits and order on the letters
after them, so 1.2.11 < 1.2.11a < 1.2.11b while a genuinely textual
component keeps ranking below any numeric one. tests/unit already
asserted the first of these; it has been failing since the module was
renamed, which the suite could not report while collection was broken.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@srpatcha
srpatcha merged commit a9e3c60 into embeddedos-org:master Sep 1, 2026
17 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants