Module: Prebake::PortabilityGuard
- Defined in:
- lib/prebake/portability_guard.rb
Overview
Host-side portability guards for cached gems: ensures the cached binary will actually load on this host (glibc version + libruby.so presence).
Class Method Summary collapse
- .glibc_ok?(gem_path, spec_name:) ⇒ Boolean
- .libruby_ok?(gem_path, spec_name:) ⇒ Boolean
- .portable_for_host?(gem_path, spec_name:) ⇒ Boolean
Class Method Details
.glibc_ok?(gem_path, spec_name:) ⇒ Boolean
20 21 22 23 24 25 26 27 |
# File 'lib/prebake/portability_guard.rb', line 20 def glibc_ok?(gem_path, spec_name:) required = ElfInspector.required_glibc_for_gem(gem_path) return true if Glibc.compatible?(required) Logger.warn "Cached #{spec_name} requires glibc #{required}, " \ "host has #{Glibc.detected_version || 'unknown'}; falling back to source build" false end |
.libruby_ok?(gem_path, spec_name:) ⇒ Boolean
29 30 31 32 33 34 35 36 |
# File 'lib/prebake/portability_guard.rb', line 29 def libruby_ok?(gem_path, spec_name:) return true if Prebake.libruby_available? return true unless ElfInspector.libruby_needed_for_gem?(gem_path) Logger.warn "Cached #{spec_name} requires libruby.so (dynamic Ruby build) " \ "but this host has a static Ruby; falling back to source build" false end |
.portable_for_host?(gem_path, spec_name:) ⇒ Boolean
13 14 15 16 17 18 |
# File 'lib/prebake/portability_guard.rb', line 13 def portable_for_host?(gem_path, spec_name:) return true unless Glibc.linux? return true if Prebake.skip_portability_check? glibc_ok?(gem_path, spec_name:) && libruby_ok?(gem_path, spec_name:) end |