[facter] Make spec file work for EPEL and Fedora
Todd Zullinger
tmz at fedoraproject.org
Wed Feb 15 17:20:02 UTC 2012
commit 37f8e75937b42c1b5a17620f54186a232093c432
Author: Todd Zullinger <tmz at pobox.com>
Date: Tue Feb 14 10:36:03 2012 -0500
Make spec file work for EPEL and Fedora
The move to ruby-1.9 in Feodra 17 means we have to take different
installation locations into account. The ruby(abi) requirement also
needs to be changed.
Also drop %%has_ruby_{abi,noarch} macros. All supported releases have
these.
facter.spec | 41 +++++++++++++++++++++++++++++------------
1 files changed, 29 insertions(+), 12 deletions(-)
---
diff --git a/facter.spec b/facter.spec
index 7ee8977..a815f5a 100644
--- a/facter.spec
+++ b/facter.spec
@@ -1,9 +1,17 @@
-%global has_ruby_abi 0%{?fedora} || 0%{?rhel} >= 5
-%global has_ruby_noarch %has_ruby_abi
+# F-17 and above have ruby-1.9.x, and place libs in a different location
+%if 0%{?fedora} >= 17
+%global facter_libdir %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["vendorlibdir"]')
+%else
+%global facter_libdir %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["sitelibdir"]')
+%endif
+
+%global enable_check 0%{?fedora}
+
+%global ruby_version %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["ruby_version"]')
Name: facter
Version: 1.6.5
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Ruby module for collecting simple facts about a host operating system
Group: System Environment/Base
@@ -13,21 +21,22 @@ Source0: http://downloads.puppetlabs.com/%{name}/%{name}-%{version}.tar.g
Source1: http://downloads.puppetlabs.com/%{name}/%{name}-%{version}.tar.gz.asc
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-%if %has_ruby_noarch
BuildArch: noarch
-%endif
BuildRequires: ruby >= 1.8.1
BuildRequires: ruby-devel
-BuildRequires: rubygem(rspec-core)
-BuildRequires: rubygem(mocha)
+%if %{enable_check}
BuildRequires: net-tools
+BuildRequires: rubygem(mocha)
+BuildRequires: rubygem(rspec-core)
+%endif
+
Requires: dmidecode
Requires: net-tools
Requires: pciutils
-Requires: ruby >= 1.8.1
-%if %has_ruby_abi
-Requires: ruby(abi) = 1.9.1
+# Work around the lack of ruby in the default mock buildroot
+%if "%{ruby_version}"
+Requires: ruby(abi) = %{ruby_version}
%endif
Requires: which
@@ -46,22 +55,30 @@ operating system. Additional facts can be added through simple Ruby scripts
%install
rm -rf %{buildroot}
-ruby install.rb --destdir=%{buildroot} --quick --no-rdoc --sitelibdir=%{ruby_vendorlibdir}
+ruby install.rb --destdir=%{buildroot} --quick --no-rdoc --sitelibdir=%{facter_libdir}
+
%clean
rm -rf %{buildroot}
+
%check
+%if %{enable_check}
rspec spec
+%endif
+
%files
%defattr(-,root,root,-)
%doc CHANGELOG INSTALL LICENSE README.md
%{_bindir}/%{name}
-%{ruby_vendorlibdir}/%{name}*
+%{facter_libdir}/%{name}*
%changelog
+* Mon Feb 13 2012 Todd Zullinger <tmz at pobox.com> - 1.6.5-3
+- Make spec file work for EPEL and Fedora
+
* Thu Feb 02 2012 Bohuslav Kabrda <bkabrda at redhat.com> - 1.6.5-2
- Rebuilt for Ruby 1.9.3.
More information about the scm-commits
mailing list