]>
Commit | Line | Data |
---|---|---|
559cb08c ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # build without tests | |
4 | ||
6892ed37 | 5 | %define pkgname ohai |
be317396 | 6 | Summary: Profiles your system and emits JSON |
6892ed37 | 7 | Name: ruby-%{pkgname} |
f15e4545 | 8 | Version: 6.20.0 |
084be688 | 9 | Release: 2 |
be317396 ER |
10 | License: Apache v2.0 |
11 | Group: Development/Languages | |
2214528e | 12 | Source0: https://github.com/opscode/ohai/archive/%{version}/%{pkgname}-%{version}.tar.gz |
f15e4545 | 13 | # Source0-md5: 1a3091bb1d06fda9e15447edbc4a2f77 |
410d4b64 | 14 | Patch0: virtualization-vserver.patch |
38a0d445 | 15 | Patch1: php-builddate.patch |
0955027e | 16 | URL: http://docs.opscode.com/ohai.html |
be317396 | 17 | BuildRequires: rpm-rubyprov |
6892ed37 ER |
18 | BuildRequires: rpmbuild(macros) >= 1.665 |
19 | BuildRequires: ruby-rake | |
559cb08c ER |
20 | BuildRequires: sed >= 4.0 |
21 | %if %{with tests} | |
6497a7d8 ER |
22 | BuildRequires: ruby-ipaddress |
23 | BuildRequires: ruby-mixlib-config | |
24 | BuildRequires: ruby-mixlib-log | |
25 | BuildRequires: ruby-mixlib-shellout | |
559cb08c | 26 | BuildRequires: ruby-rspec |
f15e4545 | 27 | BuildRequires: ruby-systemu >= 2.5.2 |
6497a7d8 | 28 | BuildRequires: ruby-yajl |
559cb08c | 29 | %endif |
b4153370 | 30 | Requires: iproute2 |
c40b9b81 | 31 | Requires: lsb-release |
e442943f | 32 | Requires: ruby-ipaddress |
be317396 ER |
33 | Requires: ruby-mixlib-cli |
34 | Requires: ruby-mixlib-config | |
35 | Requires: ruby-mixlib-log | |
084be688 | 36 | Requires: mount |
ebd314a9 | 37 | Requires: ruby-mixlib-shellout |
f15e4545 | 38 | Requires: ruby-systemu >= 2.5.2 |
e442943f | 39 | Requires: ruby-yajl |
be317396 ER |
40 | BuildArch: noarch |
41 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
42 | ||
43 | %description | |
44 | Ohai detects data about your operating system and prints out a JSON | |
45 | data blob. It can be used standalone, but it's primary purpose is to | |
46 | provide node data to Chef. | |
47 | ||
48 | %package doc | |
49 | Summary: Documentation for %{name} | |
50 | Group: Documentation | |
51 | Requires: %{name} = %{version}-%{release} | |
52 | ||
53 | %description doc | |
54 | This package contains documentation for %{name}. | |
55 | ||
56 | %prep | |
559cb08c | 57 | %setup -q -n ohai-%{version} |
410d4b64 | 58 | %patch0 -p1 |
38a0d445 | 59 | %patch1 -p1 |
559cb08c ER |
60 | %{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/* |
61 | ||
62 | # no plist and not darwin so don't care | |
63 | rm spec/unit/plugins/darwin/system_profiler_spec.rb | |
64 | ||
c40b9b81 | 65 | # can't figure how to fix -r rubygems does not help |
559cb08c ER |
66 | # ohai-6.16.0/spec/unit/plugins/ruby_spec.rb:52:in `block in <top (required)>': uninitialized cons tant Gem (NameError) |
67 | rm spec/unit/plugins/ruby_spec.rb | |
be317396 ER |
68 | |
69 | %build | |
6892ed37 ER |
70 | rake gem |
71 | %{__tar} -xmf pkg/ohai-%{version}.gem | |
72 | %__gem_helper spec | |
73 | ||
be317396 ER |
74 | %if %{with tests} |
75 | # Occasionally fails with "undefined method `rfc2822' for nil:NilClass" during | |
76 | # mock. Unsure why - disable for now. | |
559cb08c ER |
77 | #sed -i 's^Time.should_receive(:now)^^' spec/ohai/plugins/ohai_time_spec.rb |
78 | LC_ALL=en_US.utf8 \ | |
79 | rake -r rubygems spec | |
be317396 ER |
80 | %endif |
81 | ||
82 | %install | |
83 | rm -rf $RPM_BUILD_ROOT | |
6892ed37 | 84 | install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{ruby_specdir},%{_bindir},%{_mandir}/man1} |
be317396 ER |
85 | cp -a bin/* $RPM_BUILD_ROOT%{_bindir} |
86 | cp -a lib/* $RPM_BUILD_ROOT%{ruby_vendorlibdir} | |
559cb08c | 87 | cp -p docs/man/man1/ohai.1 $RPM_BUILD_ROOT%{_mandir}/man1 |
6892ed37 | 88 | cp -p %{pkgname}-%{version}.gemspec $RPM_BUILD_ROOT%{ruby_specdir} |
be317396 ER |
89 | |
90 | %clean | |
91 | rm -rf $RPM_BUILD_ROOT | |
92 | ||
93 | %files | |
94 | %defattr(644,root,root,755) | |
559cb08c | 95 | %doc README.rdoc CHANGELOG NOTICE |
be317396 ER |
96 | %attr(755,root,root) %{_bindir}/ohai |
97 | %{_mandir}/man1/ohai.1* | |
6892ed37 ER |
98 | %{ruby_vendorlibdir}/%{pkgname}.rb |
99 | %{ruby_vendorlibdir}/%{pkgname} | |
100 | %{ruby_specdir}/%{pkgname}-%{version}.gemspec |