]>
Commit | Line | Data |
---|---|---|
559cb08c | 1 | # |
373c014d | 2 | # Release Notes: https://github.com/chef/ohai/blob/master/CHANGELOG.md |
c5abc602 | 3 | # |
559cb08c | 4 | # Conditional build: |
3b794a9f | 5 | %bcond_with tests # build without tests |
559cb08c | 6 | |
6892ed37 | 7 | %define pkgname ohai |
be317396 | 8 | Summary: Profiles your system and emits JSON |
6892ed37 | 9 | Name: ruby-%{pkgname} |
85ad1ec3 | 10 | Version: 14.2.4 |
ae471ff5 | 11 | Release: 3 |
be317396 ER |
12 | License: Apache v2.0 |
13 | Group: Development/Languages | |
b5b87a62 | 14 | Source0: https://github.com/opscode/ohai/archive/v%{version}/%{pkgname}-%{version}.tar.gz |
85ad1ec3 | 15 | # Source0-md5: 09fe81cb0b178bad4ad9898c6cc72c57 |
6f310904 | 16 | Patch1: platform-pld.patch |
b5b87a62 | 17 | URL: https://docs.getchef.com/ohai.html |
be317396 | 18 | BuildRequires: rpm-rubyprov |
6892ed37 ER |
19 | BuildRequires: rpmbuild(macros) >= 1.665 |
20 | BuildRequires: ruby-rake | |
559cb08c ER |
21 | BuildRequires: sed >= 4.0 |
22 | %if %{with tests} | |
b9727106 | 23 | BuildRequires: ruby-ffi >= 1.9 |
704947ba | 24 | BuildRequires: ruby-ffi-yajl >= 1.1 |
6497a7d8 ER |
25 | BuildRequires: ruby-ipaddress |
26 | BuildRequires: ruby-mixlib-config | |
27 | BuildRequires: ruby-mixlib-log | |
86596299 | 28 | BuildRequires: ruby-mixlib-shellout >= 1.2 |
559cb08c | 29 | BuildRequires: ruby-rspec |
b9727106 | 30 | BuildRequires: ruby-systemu >= 2.6.4 |
559cb08c | 31 | %endif |
b4153370 | 32 | Requires: iproute2 |
c40b9b81 | 33 | Requires: lsb-release |
956fb169 | 34 | Requires: mount |
8444e825 | 35 | Requires: ruby(abi) >= 2.0 |
be317396 ER |
36 | BuildArch: noarch |
37 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
38 | ||
39 | %description | |
40 | Ohai detects data about your operating system and prints out a JSON | |
41 | data blob. It can be used standalone, but it's primary purpose is to | |
42 | provide node data to Chef. | |
43 | ||
44 | %package doc | |
45 | Summary: Documentation for %{name} | |
46 | Group: Documentation | |
47 | Requires: %{name} = %{version}-%{release} | |
48 | ||
49 | %description doc | |
50 | This package contains documentation for %{name}. | |
51 | ||
52 | %prep | |
559cb08c | 53 | %setup -q -n ohai-%{version} |
38a0d445 | 54 | %patch1 -p1 |
559cb08c ER |
55 | %{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/* |
56 | ||
86596299 ER |
57 | # don't need shellout 2.0 yet, but 2.0 is ok |
58 | %{__sed} -i -e '/mixlib-shellout/ s/">= 2.0.0.rc.0", "< 3.0"/">= 1.2", "< 3.0"/' %{pkgname}.gemspec | |
59 | # optional | |
60 | %{__sed} -i -e '/net-dhcp/d' %{pkgname}.gemspec | |
61 | # platform specific and optional | |
62 | %{__sed} -i -e '/wmi-lite/d' %{pkgname}.gemspec | |
e5bdf1ce | 63 | %{__sed} -i -e '/plist/d' %{pkgname}.gemspec |
86596299 ER |
64 | # dev dep |
65 | %{__sed} -i -e '/rake/d' %{pkgname}.gemspec | |
66 | ||
559cb08c ER |
67 | # no plist and not darwin so don't care |
68 | rm spec/unit/plugins/darwin/system_profiler_spec.rb | |
69 | ||
c40b9b81 | 70 | # can't figure how to fix -r rubygems does not help |
2b26b7f0 | 71 | # ohai-6.16.0/spec/unit/plugins/ruby_spec.rb:52:in `block in <top (required)>': uninitialized constant Gem (NameError) |
559cb08c | 72 | rm spec/unit/plugins/ruby_spec.rb |
be317396 ER |
73 | |
74 | %build | |
2b26b7f0 ER |
75 | # make gemspec self-contained |
76 | ruby -r rubygems -e 'spec = eval(File.read("%{pkgname}.gemspec")) | |
77 | File.open("%{pkgname}-%{version}.gemspec", "w") do |file| | |
78 | file.puts spec.to_ruby_for_cache | |
79 | end' | |
6892ed37 | 80 | |
be317396 ER |
81 | %if %{with tests} |
82 | # Occasionally fails with "undefined method `rfc2822' for nil:NilClass" during | |
83 | # mock. Unsure why - disable for now. | |
559cb08c ER |
84 | #sed -i 's^Time.should_receive(:now)^^' spec/ohai/plugins/ohai_time_spec.rb |
85 | LC_ALL=en_US.utf8 \ | |
86 | rake -r rubygems spec | |
be317396 ER |
87 | %endif |
88 | ||
89 | %install | |
90 | rm -rf $RPM_BUILD_ROOT | |
6892ed37 | 91 | install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{ruby_specdir},%{_bindir},%{_mandir}/man1} |
be317396 ER |
92 | cp -a bin/* $RPM_BUILD_ROOT%{_bindir} |
93 | cp -a lib/* $RPM_BUILD_ROOT%{ruby_vendorlibdir} | |
3b794a9f | 94 | cp -p %{pkgname}-%{version}*.gemspec $RPM_BUILD_ROOT%{ruby_specdir} |
be317396 ER |
95 | |
96 | %clean | |
97 | rm -rf $RPM_BUILD_ROOT | |
98 | ||
99 | %files | |
100 | %defattr(644,root,root,755) | |
b9727106 | 101 | %doc README.md CHANGELOG.md RELEASE_NOTES.md OHAI_MVPS.md NOTICE |
be317396 | 102 | %attr(755,root,root) %{_bindir}/ohai |
6892ed37 ER |
103 | %{ruby_vendorlibdir}/%{pkgname}.rb |
104 | %{ruby_vendorlibdir}/%{pkgname} | |
3b794a9f | 105 | %{ruby_specdir}/%{pkgname}-%{version}*.gemspec |