From 559cb08c6c4c3787fb4ce1ef311a6646ce29c1d5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 30 Apr 2013 01:08:02 +0300 Subject: [PATCH] use full tarball, run tests --- ruby-ohai.spec | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/ruby-ohai.spec b/ruby-ohai.spec index 7b1f293..b61b783 100644 --- a/ruby-ohai.spec +++ b/ruby-ohai.spec @@ -1,18 +1,25 @@ +# +# Conditional build: +%bcond_without tests # build without tests + %define gemname ohai Summary: Profiles your system and emits JSON Name: ruby-%{gemname} Version: 6.16.0 -Release: 0.2 +Release: 1 License: Apache v2.0 Group: Development/Languages -Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem -# Source0-md5: 5193426deeb67ff7560e05000c55d4d3 +Source0: https://github.com/opscode/ohai/archive/%{version}.tar.gz +# Source0-md5: 5c00b0ba4c313bedfec62cd5e1525551 URL: http://docs.opscode.com/ohai.html BuildRequires: rpm-rubyprov BuildRequires: rpmbuild(macros) >= 1.656 -Requires: ruby-extlib +BuildRequires: sed >= 4.0 +%if %{with tests} +BuildRequires: ruby-rake +BuildRequires: ruby-rspec +%endif Requires: ruby-ipaddress -Requires: ruby-json Requires: ruby-mixlib-cli Requires: ruby-mixlib-config Requires: ruby-mixlib-log @@ -36,37 +43,39 @@ Requires: %{name} = %{version}-%{release} This package contains documentation for %{name}. %prep -%setup -q +%setup -q -n ohai-%{version} +%{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/* + +# no plist and not darwin so don't care +rm spec/unit/plugins/darwin/system_profiler_spec.rb + +# can't figure how ti fix -r rubygems does not help +# ohai-6.16.0/spec/unit/plugins/ruby_spec.rb:52:in `block in ': uninitialized cons tant Gem (NameError) +rm spec/unit/plugins/ruby_spec.rb %build %if %{with tests} # Occasionally fails with "undefined method `rfc2822' for nil:NilClass" during # mock. Unsure why - disable for now. -sed -i 's^Time.should_receive(:now)^^' spec/ohai/plugins/ohai_time_spec.rb -rake spec +#sed -i 's^Time.should_receive(:now)^^' spec/ohai/plugins/ohai_time_spec.rb +LC_ALL=en_US.utf8 \ +rake -r rubygems spec %endif %install rm -rf $RPM_BUILD_ROOT -install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{_bindir}} +install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{_bindir},%{_mandir}/man1} cp -a bin/* $RPM_BUILD_ROOT%{_bindir} cp -a lib/* $RPM_BUILD_ROOT%{ruby_vendorlibdir} - -install -d $RPM_BUILD_ROOT%{_mandir}/man1 -cp -p docs/man/man1/ohai.1 $RPM_BUILD_ROOT%{_mandir}/man1/ohai.1 +cp -p docs/man/man1/ohai.1 $RPM_BUILD_ROOT%{_mandir}/man1 %clean rm -rf $RPM_BUILD_ROOT %files %defattr(644,root,root,755) -%doc README.rdoc +%doc README.rdoc CHANGELOG NOTICE %attr(755,root,root) %{_bindir}/ohai %{_mandir}/man1/ohai.1* %{ruby_vendorlibdir}/ohai.rb %{ruby_vendorlibdir}/ohai - -%if 0 -%files doc -%defattr(644,root,root,755) -%endif -- 2.44.0