]>
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} |
b9727106 | 8 | Version: 7.4.0 |
3b794a9f | 9 | Release: 0.1 |
be317396 ER |
10 | License: Apache v2.0 |
11 | Group: Development/Languages | |
b9727106 ER |
12 | Source0: https://github.com/opscode/ohai/archive/%{version}/%{pkgname}-%{version}.tar.gz |
13 | # Source0-md5: 5275e5f79b618ce2af85311cd760b977 | |
410d4b64 | 14 | Patch0: virtualization-vserver.patch |
b9727106 | 15 | URL: http://docs.getchef.com/ohai.html |
be317396 | 16 | BuildRequires: rpm-rubyprov |
6892ed37 ER |
17 | BuildRequires: rpmbuild(macros) >= 1.665 |
18 | BuildRequires: ruby-rake | |
559cb08c ER |
19 | BuildRequires: sed >= 4.0 |
20 | %if %{with tests} | |
b9727106 ER |
21 | BuildRequires: ruby-ffi >= 1.9 |
22 | BuildRequires: ruby-ffi-yajl >= 1.0 | |
6497a7d8 ER |
23 | BuildRequires: ruby-ipaddress |
24 | BuildRequires: ruby-mixlib-config | |
25 | BuildRequires: ruby-mixlib-log | |
b9727106 | 26 | BuildRequires: ruby-mixlib-shellout >= 1.2 |
559cb08c | 27 | BuildRequires: ruby-rspec |
b9727106 | 28 | BuildRequires: ruby-systemu >= 2.6.4 |
559cb08c | 29 | %endif |
c40b9b81 | 30 | Requires: lsb-release |
b9727106 ER |
31 | Requires: ruby-ffi >= 1.9 |
32 | Requires: ruby-ffi-yajl >= 1.0 | |
e442943f | 33 | Requires: ruby-ipaddress |
7223e804 | 34 | Requires: ruby-mime-types >= 1.16 |
be317396 | 35 | Requires: ruby-mixlib-cli |
7223e804 | 36 | Requires: ruby-mixlib-config >= 2.0 |
be317396 | 37 | Requires: ruby-mixlib-log |
b9727106 ER |
38 | Requires: ruby-mixlib-shellout >= 1.2 |
39 | Requires: ruby-systemu >= 2.6.4 | |
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 | |
b9727106 | 57 | %setup -q -n ohai-%{version} |
410d4b64 | 58 | %patch0 -p1 |
559cb08c ER |
59 | %{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/* |
60 | ||
61 | # no plist and not darwin so don't care | |
62 | rm spec/unit/plugins/darwin/system_profiler_spec.rb | |
63 | ||
c40b9b81 | 64 | # can't figure how to fix -r rubygems does not help |
559cb08c ER |
65 | # ohai-6.16.0/spec/unit/plugins/ruby_spec.rb:52:in `block in <top (required)>': uninitialized cons tant Gem (NameError) |
66 | rm spec/unit/plugins/ruby_spec.rb | |
be317396 ER |
67 | |
68 | %build | |
6892ed37 | 69 | rake gem |
3b794a9f | 70 | %{__tar} -xmf pkg/ohai-%{version}*.gem |
6892ed37 ER |
71 | %__gem_helper spec |
72 | ||
be317396 ER |
73 | %if %{with tests} |
74 | # Occasionally fails with "undefined method `rfc2822' for nil:NilClass" during | |
75 | # mock. Unsure why - disable for now. | |
559cb08c ER |
76 | #sed -i 's^Time.should_receive(:now)^^' spec/ohai/plugins/ohai_time_spec.rb |
77 | LC_ALL=en_US.utf8 \ | |
78 | rake -r rubygems spec | |
be317396 ER |
79 | %endif |
80 | ||
81 | %install | |
82 | rm -rf $RPM_BUILD_ROOT | |
6892ed37 | 83 | install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{ruby_specdir},%{_bindir},%{_mandir}/man1} |
be317396 ER |
84 | cp -a bin/* $RPM_BUILD_ROOT%{_bindir} |
85 | cp -a lib/* $RPM_BUILD_ROOT%{ruby_vendorlibdir} | |
559cb08c | 86 | cp -p docs/man/man1/ohai.1 $RPM_BUILD_ROOT%{_mandir}/man1 |
3b794a9f ER |
87 | cp -p %{pkgname}-%{version}*.gemspec $RPM_BUILD_ROOT%{ruby_specdir} |
88 | ||
be317396 ER |
89 | %clean |
90 | rm -rf $RPM_BUILD_ROOT | |
91 | ||
92 | %files | |
93 | %defattr(644,root,root,755) | |
b9727106 | 94 | %doc README.md CHANGELOG.md RELEASE_NOTES.md OHAI_MVPS.md NOTICE |
be317396 ER |
95 | %attr(755,root,root) %{_bindir}/ohai |
96 | %{_mandir}/man1/ohai.1* | |
6892ed37 ER |
97 | %{ruby_vendorlibdir}/%{pkgname}.rb |
98 | %{ruby_vendorlibdir}/%{pkgname} | |
3b794a9f | 99 | %{ruby_specdir}/%{pkgname}-%{version}*.gemspec |