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