2 # Release Notes: https://github.com/opscode/ohai/blob/master/CHANGELOG.md
5 %bcond_with tests # build without tests
8 Summary: Profiles your system and emits JSON
13 Group: Development/Languages
14 Source0: https://github.com/opscode/ohai/archive/%{version}/%{pkgname}-%{version}.tar.gz
15 # Source0-md5: 7a2182e562bab7dcc48e0b68e07daf92
16 Patch1: platform-pld.patch
17 #Patch2: soft-net-dhcp.patch
18 URL: http://docs.getchef.com/ohai.html
19 BuildRequires: rpm-rubyprov
20 BuildRequires: rpmbuild(macros) >= 1.665
21 BuildRequires: ruby-rake
22 BuildRequires: sed >= 4.0
23 # rake gem uses installed ohai version not version we intend to build!
24 BuildConflicts: ruby-ohai
26 BuildRequires: ruby-ffi >= 1.9
27 BuildRequires: ruby-ffi-yajl >= 1.1
28 BuildRequires: ruby-ipaddress
29 BuildRequires: ruby-mixlib-config
30 BuildRequires: ruby-mixlib-log
31 BuildRequires: ruby-mixlib-shellout >= 1.2
32 BuildRequires: ruby-rspec
33 BuildRequires: ruby-systemu >= 2.6.4
38 Requires: ruby(abi) >= 2.0
39 Requires: ruby-ffi >= 1.9
40 Requires: ruby-ffi-yajl >= 1.1
41 Requires: ruby-ipaddress
42 Requires: ruby-mime-types >= 1.16
43 Requires: ruby-mixlib-cli
44 Requires: ruby-mixlib-config >= 2.0
45 Requires: ruby-mixlib-log
46 Requires: ruby-mixlib-shellout >= 1.2
47 Requires: ruby-systemu >= 2.6.4
48 Suggests: ruby-net-dhcp
50 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
53 Ohai detects data about your operating system and prints out a JSON
54 data blob. It can be used standalone, but it's primary purpose is to
55 provide node data to Chef.
58 Summary: Documentation for %{name}
60 Requires: %{name} = %{version}-%{release}
63 This package contains documentation for %{name}.
66 %setup -q -n ohai-%{version}
69 %{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/*
71 # don't need shellout 2.0 yet, but 2.0 is ok
72 %{__sed} -i -e '/mixlib-shellout/ s/">= 2.0.0.rc.0", "< 3.0"/">= 1.2", "< 3.0"/' %{pkgname}.gemspec
74 %{__sed} -i -e '/net-dhcp/d' %{pkgname}.gemspec
75 # platform specific and optional
76 %{__sed} -i -e '/wmi-lite/d' %{pkgname}.gemspec
77 %{__sed} -i -e '/plist/d' %{pkgname}.gemspec
79 %{__sed} -i -e '/rake/d' %{pkgname}.gemspec
81 # no plist and not darwin so don't care
82 rm spec/unit/plugins/darwin/system_profiler_spec.rb
84 # can't figure how to fix -r rubygems does not help
85 # ohai-6.16.0/spec/unit/plugins/ruby_spec.rb:52:in `block in <top (required)>': uninitialized constant Gem (NameError)
86 rm spec/unit/plugins/ruby_spec.rb
89 # make gemspec self-contained
90 ruby -r rubygems -e 'spec = eval(File.read("%{pkgname}.gemspec"))
91 File.open("%{pkgname}-%{version}.gemspec", "w") do |file|
92 file.puts spec.to_ruby_for_cache
96 # Occasionally fails with "undefined method `rfc2822' for nil:NilClass" during
97 # mock. Unsure why - disable for now.
98 #sed -i 's^Time.should_receive(:now)^^' spec/ohai/plugins/ohai_time_spec.rb
100 rake -r rubygems spec
104 rm -rf $RPM_BUILD_ROOT
105 install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{ruby_specdir},%{_bindir},%{_mandir}/man1}
106 cp -a bin/* $RPM_BUILD_ROOT%{_bindir}
107 cp -a lib/* $RPM_BUILD_ROOT%{ruby_vendorlibdir}
108 cp -p docs/man/man1/ohai.1 $RPM_BUILD_ROOT%{_mandir}/man1
109 cp -p %{pkgname}-%{version}*.gemspec $RPM_BUILD_ROOT%{ruby_specdir}
112 rm -rf $RPM_BUILD_ROOT
115 %defattr(644,root,root,755)
116 %doc README.md CHANGELOG.md RELEASE_NOTES.md OHAI_MVPS.md NOTICE
117 %attr(755,root,root) %{_bindir}/ohai
118 %{_mandir}/man1/ohai.1*
119 %{ruby_vendorlibdir}/%{pkgname}.rb
120 %{ruby_vendorlibdir}/%{pkgname}
121 %{ruby_specdir}/%{pkgname}-%{version}*.gemspec