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