]> git.pld-linux.org Git - packages/ruby-ohai.git/blob - ruby-ohai.spec
74991ce0acb625adff0a07380e5f0d74d7a9d956
[packages/ruby-ohai.git] / ruby-ohai.spec
1 #
2 # Release Notes: https://github.com/chef/ohai/blob/master/CHANGELOG.md
3 #
4 # Conditional build:
5 %bcond_with     tests           # build without tests
6
7 %define pkgname ohai
8 Summary:        Profiles your system and emits JSON
9 Name:           ruby-%{pkgname}
10 Version:        14.2.4
11 Release:        3
12 License:        Apache v2.0
13 Group:          Development/Languages
14 Source0:        https://github.com/opscode/ohai/archive/v%{version}/%{pkgname}-%{version}.tar.gz
15 # Source0-md5:  09fe81cb0b178bad4ad9898c6cc72c57
16 Patch1:         platform-pld.patch
17 URL:            https://docs.getchef.com/ohai.html
18 BuildRequires:  rpm-rubyprov
19 BuildRequires:  rpmbuild(macros) >= 1.665
20 BuildRequires:  ruby-rake
21 BuildRequires:  sed >= 4.0
22 %if %{with tests}
23 BuildRequires:  ruby-ffi >= 1.9
24 BuildRequires:  ruby-ffi-yajl >= 1.1
25 BuildRequires:  ruby-ipaddress
26 BuildRequires:  ruby-mixlib-config
27 BuildRequires:  ruby-mixlib-log
28 BuildRequires:  ruby-mixlib-shellout >= 1.2
29 BuildRequires:  ruby-rspec
30 BuildRequires:  ruby-systemu >= 2.6.4
31 %endif
32 Requires:       iproute2
33 Requires:       lsb-release
34 Requires:       mount
35 Requires:       ruby(abi) >= 2.0
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
53 %setup -q -n ohai-%{version}
54 %patch1 -p1
55 %{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/*
56
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
63 %{__sed} -i -e '/plist/d' %{pkgname}.gemspec
64 # dev dep
65 %{__sed} -i -e '/rake/d' %{pkgname}.gemspec
66
67 # no plist and not darwin so don't care
68 rm spec/unit/plugins/darwin/system_profiler_spec.rb
69
70 # can't figure how to fix -r rubygems does not help
71 # ohai-6.16.0/spec/unit/plugins/ruby_spec.rb:52:in `block in <top (required)>': uninitialized constant Gem (NameError)
72 rm spec/unit/plugins/ruby_spec.rb
73
74 %build
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'
80
81 %if %{with tests}
82 # Occasionally fails with "undefined method `rfc2822' for nil:NilClass" during
83 # mock. Unsure why - disable for now.
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
87 %endif
88
89 %install
90 rm -rf $RPM_BUILD_ROOT
91 install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{ruby_specdir},%{_bindir},%{_mandir}/man1}
92 cp -a bin/* $RPM_BUILD_ROOT%{_bindir}
93 cp -a lib/* $RPM_BUILD_ROOT%{ruby_vendorlibdir}
94 cp -p %{pkgname}-%{version}*.gemspec $RPM_BUILD_ROOT%{ruby_specdir}
95
96 %clean
97 rm -rf $RPM_BUILD_ROOT
98
99 %files
100 %defattr(644,root,root,755)
101 %doc README.md CHANGELOG.md RELEASE_NOTES.md OHAI_MVPS.md NOTICE
102 %attr(755,root,root) %{_bindir}/ohai
103 %{ruby_vendorlibdir}/%{pkgname}.rb
104 %{ruby_vendorlibdir}/%{pkgname}
105 %{ruby_specdir}/%{pkgname}-%{version}*.gemspec
This page took 0.109173 seconds and 3 git commands to generate.