%global ruby_ver 3.2 %global ruby_vendorlib %{_datadir}/ruby%{ruby_ver}/vendor_ruby %global facter_version 4.10.0 %global hocon_version 1.4.0 %global thor_version 1.2.2 Name: facter Version: %{facter_version} Release: 1%{?dist} Summary: System inventory tool for Puppet License: Apache-2.0 URL: https://github.com/puppetlabs/facter Source0: https://github.com/puppetlabs/facter/archive/%{facter_version}/facter-%{facter_version}.tar.gz Source1: https://rubygems.org/downloads/hocon-%{hocon_version}.gem Source2: https://rubygems.org/downloads/thor-%{thor_version}.gem BuildArch: noarch BuildRequires: ruby%{ruby_ver} BuildRequires: ruby%{ruby_ver}-rubygems Requires: ruby%{ruby_ver} Provides: bundled(rubygem-hocon) = %{hocon_version} Provides: bundled(rubygem-thor) = %{thor_version} %description Facter is a system inventory tool that collects facts about a system and reports them as key-value pairs. Puppet uses Facter to discover system information used in manifests. %prep %setup -q -n facter-%{facter_version} # Extract bundled gems from .gem files (tar format containing data.tar.gz) mkdir -p vendor/gems/hocon vendor/gems/thor cd vendor/gems/hocon && tar xf %{SOURCE1} && tar xzf data.tar.gz && rm -f data.tar.gz metadata.gz checksums.yaml.gz cd %{_builddir}/facter-%{facter_version} cd vendor/gems/thor && tar xf %{SOURCE2} && tar xzf data.tar.gz && rm -f data.tar.gz metadata.gz checksums.yaml.gz cd %{_builddir}/facter-%{facter_version} %build # Pure Ruby, nothing to compile %install # Install facter library install -d %{buildroot}%{ruby_vendorlib} cp -a lib/* %{buildroot}%{ruby_vendorlib}/ # Install vendored gems cp -a vendor/gems/hocon/lib/* %{buildroot}%{ruby_vendorlib}/ cp -a vendor/gems/thor/lib/* %{buildroot}%{ruby_vendorlib}/ # Install facter binary install -d %{buildroot}%{_bindir} install -m 0755 bin/facter %{buildroot}%{_bindir}/facter # Fix shebang to use namespaced ruby sed -i '1s|^#!/usr/bin/env ruby|#!/usr/bin/ruby%{ruby_ver}|' %{buildroot}%{_bindir}/facter # Remove docs generator (not needed at runtime) rm -rf %{buildroot}%{ruby_vendorlib}/docs %files %license LICENSE %doc README.md %{_bindir}/facter %{ruby_vendorlib}/facter.rb %{ruby_vendorlib}/facter/ %{ruby_vendorlib}/hocon.rb %{ruby_vendorlib}/hocon/ %{ruby_vendorlib}/thor.rb %{ruby_vendorlib}/thor/ %{ruby_vendorlib}/schema/ %changelog * Tue Jul 01 2026 yhw - 4.10.0-1 - Initial package for AL2023 COPR - Bundle hocon and thor as vendored dependencies