Skip to content

Absorb simp-build-helpers into this project - #274

Open
silug wants to merge 2 commits into
simp:masterfrom
silug:absorb-simp-build-helpers
Open

Absorb simp-build-helpers into this project#274
silug wants to merge 2 commits into
simp:masterfrom
silug:absorb-simp-build-helpers

Conversation

@silug

@silug silug commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Problem

simp/rake/build/auto.rb:15 hard-requires Simp::Build::ReleaseMapper from the simp-build-helpers gem, and Simp::Rake::Build::Helpers loads auto.rb unconditionally — so the entire Simp::Rake::Build::* task tree fails to load without that gem.

Three things were wrong:

  1. Undeclared runtime dependency. simp-build-helpers was never in this project's gemspec, only in its Gemfile. So gem install simp-rake-helpers + any use of the build tasks = LoadError. simp-core papered over it by declaring the gem in its own Gemfile, and simp-core/Rakefile catches the LoadError and merely warns — so the failure mode was every build task silently disappearing.

  2. The published gem is broken on modern Ruby. The latest release on RubyGems is 0.1.1 (2016-09-28), which calls File.exists? in sanitize_iso_list. That method is gone from current Rubies, so rake build:auto raised NoMethodError on its first ISO path check. Verified against simp-core's real CentOS/8Stream/x86_64/release_mappings.yaml:

    published 0.1.1 => NoMethodError: undefined method 'exists?' for class File
    

    The one-line fix was committed to that project's master in 2023 as 0.1.2 but never released, and the repo has no git tags.

  3. Nobody noticed, which suggests build:auto is dormant: simp-core has release_mappings.yaml only for CentOS 7/8/8Stream and RedHat 7/8 (nothing for EL9/10), the ISO build docs were last touched 2023-03, and no simp-core CI workflow invokes build:auto.

Approach

The gem was a single 142-line class with no other consumers, so absorbing it beats tagging a release for a project dormant since 2016. Simp::Build::ReleaseMapper keeps its namespace, so auto.rb needs no change.

Changes

  • Add lib/simp/build/release_mapper.rb, reformatted to pass this project's enforced RuboCop config
  • Add spec/lib/simp/build/release_mapper_spec.rb plus fixtures under spec/lib/simp/files/release_mapper/ (matching the existing spec/lib/simp/files/<name> convention)
  • Drop the simp-build-helpers Gemfile entry and remove it from the acceptance-test build project scaffold
  • Bump to 6.1.0

Behavior change worth a look

Simp::Build::SIMPBuildException now inherits StandardError rather than Exception, matching the sibling SIMPBuildException classes already in auto.rb:12 and build.rb:13, and satisfying Lint/InheritException.

build:auto wraps each distro/version/arch build in rescue StandardError (auto.rb:420), and get_target_data (auto.rb:252) sits inside that block. So ISO mapping failures are now collected into the "Failed ISOs" summary and exit 1, instead of aborting the whole run on the first failure. That's what the per-ISO loop appears to intend, but it is a change — happy to keep Exception with an inline cop disable if you'd rather preserve it exactly.

Also fixed a missing closing quote in the Recognized SIMP ISOs for '<release>' error message header.

Verification

  • bundle exec rake spec170 examples, 0 failures, 5 pending (all pre-existing)
  • bundle exec rubocop69 files, no offenses
  • Diffed old vs. new implementations directly: every error message byte-identical and all get_flavor return values identical, except the intentional quote fix
  • Confirmed auto.rb resolves Simp::Build::ReleaseMapper with the gem absent, and that SIMPBuildException is rescuable as StandardError
  • Exercised against simp-core's real release_mappings.yaml

Merge order

Please merge and release 6.1.0 before simp/simp-core#942, which raises its floor to simp-rake-helpers ~> 6.1.

`simp/rake/build/auto.rb` has always hard-required
`Simp::Build::ReleaseMapper` from the `simp-build-helpers` gem, and
`Simp::Rake::Build::Helpers` loads `auto.rb` unconditionally -- so the entire
`Simp::Rake::Build::*` task tree fails to load without it. That gem was never
declared as a runtime dependency here, only as a `Gemfile` entry, so
`gem install simp-rake-helpers` produced a `LoadError` for every build task.
simp-core worked around it by declaring the gem in its own Gemfile.

The gem was also broken. Its last release on RubyGems is 0.1.1 (2016-09-28),
which calls `File.exists?` in `sanitize_iso_list`. That method no longer
exists in current Rubies, so `rake build:auto` raised `NoMethodError` on its
first ISO path check. The fix was committed to that project's `master` in 2023
but never released, and no git tags were ever pushed.

Since the gem was a single 142-line class with no other consumers, absorb it
rather than releasing a 10-year-dormant project. `Simp::Build::ReleaseMapper`
keeps its namespace, so `auto.rb` needs no change, and its unit tests come
along with it.

Verified equivalent against the pre-move implementation: every error message
is byte-identical and all `get_flavor` return values match, except the
intentional typo fix noted below.

- Add lib/simp/build/release_mapper.rb, reformatted to pass this project's
  enforced RuboCop config
- Add spec/lib/simp/build/release_mapper_spec.rb plus fixtures under
  spec/lib/simp/files/release_mapper/
- Drop the simp-build-helpers Gemfile entry and remove it from the
  acceptance-test build project scaffold
- `Simp::Build::SIMPBuildException` now inherits `StandardError` rather than
  `Exception`, matching the sibling `SIMPBuildException` classes in auto.rb and
  build.rb. `build:auto` wraps each distro/version/arch build in
  `rescue StandardError`, so ISO mapping failures are now collected in the
  "Failed ISOs" summary (exit 1) instead of aborting the whole run on the
  first failure.
- Add the missing closing quote in the "Recognized SIMP ISOs for '<release>'"
  error message header

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Comment thread lib/simp/build/release_mapper.rb Outdated
When the checksum branch was taken (`@do_checksums`, or a flavor with
non-unique ISO sizes) and verification *failed*, control fell out of the inner
`if` into the unconditional `result = flavor; break` -- so instead of moving on
to the next flavor and ultimately returning nil, `get_flavor` returned the
flavor with `result_isos` still `[]`.

Downstream this was silent rather than loud: `simp/rake/build/auto.rb:353`
drives `unpack` by iterating `target_data['isos']`, so an empty list meant
unpack was simply never invoked and `build:auto` carried on against an empty or
stale staging directory with a corrupt ISO accepted as valid. That made
`SIMP_BUILD_checksum=true` worse than useless.

Now takes `next` when the checksums do not account for every ISO the flavor
expects, so the search continues and `autoscan_unpack_list` raises
`No flavors for target release` if nothing verifies.

Inherited from simp-build-helpers rather than introduced by the port, but this
is where the code enters this repo and the ported spec only covered the
checksum-success path, so nothing caught it. Adds three regression tests, all
of which fail against the previous implementation:

- `#get_flavor` returns nil when checksum verification fails
- `#get_flavor` does not report a flavor with an empty ISO list
- `#autoscan_unpack_list` raises when checksum verification fails

Also drops a tautological guard: after
`matched_isos = iso_checksums.select { |_iso, sum| checksums.include?(sum) }`,
the subsequent `matched_isos.values.all? { |sum| checksums.include?(sum) }` was
always true, so only the `uniq.size` comparison did any work.

Thanks to @michael-riddle for catching this in review.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@op-ct op-ct added this to Org Triage Sep 3, 2026
@simp-automation simp-automation Bot moved this from New to In Review in Org Triage Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

3 participants