From 05595a922a1b4775adb345d4a55f49ec60c783e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Wed, 24 Sep 2014 22:28:54 +0200 Subject: [PATCH] Changes mostly due to proper testing: 1) Remove %check section and dependencies for tests: - move it to documentation - distribute Gemfiles modified for using in tests 2) Less conditions by using %{openssl_cms} with openssl_cms_* package name 3) Move rdoc documentation do rdoc subdirectory in _pkgdocdir 4) Remove Capfile from the main package and move it to -doc subpackage --- README.Fedora | 26 ++++++++++++++++ rOCCI-server.spec | 89 +++++++++++++++++++++++++++++++------------------------ 2 files changed, 76 insertions(+), 39 deletions(-) diff --git a/README.Fedora b/README.Fedora index d2fd585..4647748 100644 --- a/README.Fedora +++ b/README.Fedora @@ -1,3 +1,6 @@ +Installation +============ + Machine certificate is required in /etc/grid-security. Start and enable required daemons: @@ -13,3 +16,26 @@ By default only dummy backend is activated. For more information visit: https://github.com/EGI-FCTF/rOCCI-server/wiki/rOCCI-Server-Admin-Guide + + +Testing +======= + +Requirements: + + rOCCI-server-doc + rubygem(bundler) + rubygem(guard-test) + rubygem(rspec-rails) < 3 + rubygem(simplecov) + +Launch: + + cd /usr/share/rOCCI-server + + # use local versions of all gems + rm -f Gemfile.lock + bundle install --local + + # launch the tests using bundler + bundle exec rspec -Ilib spec --require spec_helper diff --git a/rOCCI-server.spec b/rOCCI-server.spec index 46fbb29..2897820 100644 --- a/rOCCI-server.spec +++ b/rOCCI-server.spec @@ -6,6 +6,12 @@ %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global date 20140918 +%if 0%{?fedora} && 0%{?fedora} <= 20 || 0%{?rhel} && 0%{?rhel} <= 7 +%global openssl_cms openssl_cms_2_0_0 +%else +%global openssl_cms openssl_cms_2_1 +%endif + Name: rOCCI-server Version: 1.0.5 Release: 1.%{date}git%{shortcommit}%{?dist} @@ -27,11 +33,6 @@ BuildRequires: policycoreutils-python BuildRequires: ruby(release) >= 1.9.3 BuildRequires: rubygems-devel BuildRequires: rubygem(rdoc) -# for tests (all runtimes also needed) -# TODO: more dependencies (some guard-*, ...) -#BuildRequires: rubygem(bunder) -#BuildRequires: rubygem(rspec) < 3 -#BuildRequires: rubygem(rspec-rails) < 3 Requires(pre): shadow-utils Requires(post): policycoreutils-python Requires(preun): policycoreutils-python @@ -54,13 +55,11 @@ Requires: rubygem(occi-core) >= 4.2.16 Requires: rubygem(occi-core) < 4.3 Requires: rubygem(rack-cors) Requires: rubygem(warden) >= 1.2.3 +Requires: %{openssl_cms} %if 0%{?fedora} && 0%{?fedora} <= 20 || 0%{?rhel} && 0%{?rhel} <= 7 Requires: ruby(release) Requires: ruby(rubygems) -Requires: rubygem(openssl_cms_2_0_0) Provides: rubygem(%{gem_name}) = %{version} -%else -Requires: rubygem(openssl_cms_2_1) %endif %description @@ -122,8 +121,40 @@ This package provides Opennebula backend for OCCI server. # kill bundler %patch0 -p1 -mv Gemfile Gemfile.unused -mv Gemfile.lock Gemfile.lock.unused + +# updates to keep bundler working (for tests) +mv Gemfile.lock Gemfile.lock.upstream +cp -p Gemfile Gemfile.upstream +cp -p lib/authentication_strategies/bundles/Gemfile.keystone Gemfile.keystone.upstream +cp -p lib/backends/bundles/Gemfile.opennebula Gemfile.opennebula.upstream +cp -p lib/backends/bundles/Gemfile.ec2 Gemfile.ec2.upstream +# relax upstream requirements: +# rails ~> 4.0.8 +# rails-api ~> 0.2.0 +# jbuilder ~> 2.1.0 +# passenger ~> 4.0.48 +# rspec-rails ~> 2.99.0 +# opennebula ~> 4.4.0 +# aws-sdk-core ~> 2.0.0.rc16 +while read name ver; do + echo "'$name' '$ver'" + sed -i "s/\(gem ['\"]$name['\"]\).*/\1, '>= $ver'/" Gemfile +done << EOF +rails 4.0.0 +rails-api 0.1.0 +jbuilder 1.5.0 +passenger 4.0.18 +rspec-rails 2.14.0 +EOF +sed -i "s/\(gem ['\"]opennebula['\"]\).*/\1, '>= 4.4.0'/" lib/backends/bundles/Gemfile.opennebula +sed -i "s/\(gem ['\"]aws-sdk-core['\"]\).*/\1, '>= 2.0.0'/" lib/backends/bundles/Gemfile.ec2 +# gems not needed for tests +for p in sdoc capistrano rvm-capistrano debugger fuubar pry-rails pry-rescue pry-stack_explorer guard-bundler guard-rails rb-inotify libnotify yard redcarpet bond hirb; do + sed -i "s/^\(\s*gem ['\"]$p['\"].*\)/#disabled: \1/" Gemfile +done +# logstasher and openssl_cms not from git +sed -i "s/, git:.*//" Gemfile +echo 'gem "%{openssl_cms}' > lib/authentication_strategies/bundles/Gemfile.keystone # apache >= 2.4 syntax, applicaton prefix sed -i examples/etc/apache2/sites-available/occi-ssl \ @@ -160,14 +191,15 @@ rm -rf %{buildroot}/%{app_root}/log ln -s %{_localstatedir}/log/rocci-server %{buildroot}/%{app_root}/log install -p -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} -rdoc --op %{buildroot}%{_pkgdocdir} lib app *.md +rdoc --op %{buildroot}%{_pkgdocdir}/rdoc lib app *.md # fix permissions (but it conflicts with COPR buildsystem for F21+) %if 0%{?fedora} && 0%{?fedora} <= 20 || 0%{?rhel} && 0%{?rhel} <= 7 -chmod -x %{buildroot}%{_pkgdocdir}/images/*.png +chmod -x %{buildroot}%{_pkgdocdir}/rdoc/images/*.png %endif # Fedora README install -p -m 0644 %{SOURCE4} %{buildroot}%{_pkgdocdir} +ln -s %{app_root}/LICENSE %{buildroot}%{_pkgdocdir} # SELinux mkdir -p %{buildroot}%{_datadir}/selinux/packages/%{name} @@ -182,28 +214,8 @@ echo "Listen 11443" >> %{buildroot}%{_sysconfdir}/httpd/conf.d/occi-listen.conf install -p -m 0644 examples/etc/apache2/conf.d/security %{buildroot}%{_sysconfdir}/httpd/conf.d/occi-security.conf +# Testsuite requires running server #%%check -## upstream: rails ~> 4.0.8 -## F20: 4.0.0, F21: 4.1.x -#sed -i "s/\(gem 'rails'\).*/\1, >= 4.0.0/" Gemfile -## upstream: rails-api ~> 0.2.0 -## F20: 0.1.0 -#sed -i "s/\(gem 'rails-api'\).*/\1, >= 0.1.0/" Gemfile -## upstream: jbuilder ~> 2.1.0 -## F20: 1.5.0 -#sed -i "s/\(gem 'jbuilder'\).*/\1, >= 1.5.0/" Gemfile -## upstream: ~> 4.0.48 -## F20: 4.0.18 -#sed -i "s/\(gem 'passenger'\).*/\1, >= 4.0.18/" Gemfile -## not needed -#for p in sdoc capistrano rvm-capistrano debugger fuubar; do -# sed -i "s/^\(\s*gem '$p'.*\)/#disabled: \1/" Gemfile -#done -## local versions of gems -#rm Gemfile.lock -#bundle install --local -# -#bundle exec rspec -Ilib spec --require spec_helper %pre @@ -231,8 +243,9 @@ fi %files -%doc %{_pkgdocdir}/README.Fedora %doc %{app_root}/LICENSE +%{_pkgdocdir}/LICENSE +%{_pkgdocdir}/README.Fedora %config(noreplace) %{_sysconfdir}/rocci-server/ %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %config(noreplace) %{_sysconfdir}/httpd/conf.d/occi-listen.conf @@ -260,7 +273,6 @@ fi %{app_root}/vendor/ %{app_root}/etc %{app_root}/log -%{app_root}/Capfile %{app_root}/config.ru %attr(-,rocci,rocci) %{_localstatedir}/log/rocci-server/ %{_datadir}/selinux/packages/%{name}/%{semodule_name}.pp @@ -270,15 +282,14 @@ fi %exclude %{app_root}/.travis.yml %exclude %{app_root}/.yardopts %exclude %{app_root}/Guardfile -%exclude %{_pkgdocdir}/ %files doc -%{_pkgdocdir}/ +%{_pkgdocdir}/rdoc/ %{app_root}/lib/backends/bundles/ %{app_root}/spec/ %{app_root}/test/ -%{app_root}/Gemfile.unused -%{app_root}/Gemfile.lock.unused +%{app_root}/Capfile +%{app_root}/Gemfile* %{app_root}/README.md %{app_root}/Rakefile -- 1.8.2.3