diff --git a/.gitignore b/.gitignore index 4e54968..c48ad36 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,7 @@ /sinatra-sugar-0.5.1.gem /pcsd-bundle-config-1 /pcs-0.9.150.tar.gz +/pcs-0.9.154.tar.gz +/sinatra-contrib-1.4.7.gem +/rack-1.6.4.gem +/sinatra-1.4.7.gem diff --git a/fedfix.patch b/fedfix.patch index d42ccc2..aa0e181 100644 --- a/fedfix.patch +++ b/fedfix.patch @@ -1,116 +1,99 @@ -From f4d4f7be4db101dafb7fc026824e7b215bb2f292 Mon Sep 17 00:00:00 2001 +From 1db647b1ecb6af2f819e97d5ae98e4d916ab2b5a Mon Sep 17 00:00:00 2001 From: Tomas Jelinek -Date: Mon, 11 Apr 2016 10:52:30 +0200 +Date: Thu, 22 Sep 2016 12:55:20 +0200 Subject: [PATCH] fedfix --- - pcsd/Gemfile | 16 +--------------- - pcsd/Gemfile.lock | 26 -------------------------- - pcsd/Makefile | 4 ++-- - pcsd/ssl.rb | 2 +- - 4 files changed, 4 insertions(+), 44 deletions(-) + pcs/pcs | 2 +- + pcsd/Makefile | 18 +++--------------- + pcsd/pcsd.rb | 1 + + pcsd/pcsd.service-runner | 3 ++- + pcsd/session.rb | 1 + + pcsd/ssl.rb | 1 + + 6 files changed, 9 insertions(+), 17 deletions(-) -diff --git a/pcsd/Gemfile b/pcsd/Gemfile -index e851eaf..3d426d8 100644 ---- a/pcsd/Gemfile -+++ b/pcsd/Gemfile -@@ -1,19 +1,5 @@ - source 'https://rubygems.org' +diff --git a/pcs/pcs b/pcs/pcs +index 4585fd5..d35933e 100755 +--- a/pcs/pcs ++++ b/pcs/pcs +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 --source 'https://tojeline.fedorapeople.org/rubygems/' do -- gem 'rpam-ruby19-feist', :platform => :ruby_18 --end -- --gem 'sinatra' - gem 'sinatra-contrib' --gem 'rack' --gem 'rack-protection' --gem 'tilt' --gem 'eventmachine' --gem 'rack-test' --gem 'backports' --gem 'rpam-ruby19', :platform => [:ruby_19, :ruby_20, :ruby_21, :ruby_22] --gem 'json' --gem 'multi_json' --gem 'open4' -+gem 'rpam-ruby19' - gem 'orderedhash' -diff --git a/pcsd/Gemfile.lock b/pcsd/Gemfile.lock -index 575a014..fc61d83 100644 ---- a/pcsd/Gemfile.lock -+++ b/pcsd/Gemfile.lock -@@ -1,23 +1,8 @@ - GEM - remote: https://rubygems.org/ -- remote: https://tojeline.fedorapeople.org/rubygems/ - specs: -- backports (3.6.4) -- eventmachine (1.0.7) -- json (1.8.3) -- multi_json (1.11.1) -- open4 (1.3.4) - orderedhash (0.0.6) -- rack (1.6.4) -- rack-protection (1.5.3) -- rack -- rack-test (0.6.3) -- rack (>= 1.0) - rpam-ruby19 (1.2.1) -- sinatra (1.4.6) -- rack (~> 1.4) -- rack-protection (~> 1.4) -- tilt (>= 1.3, < 3) - sinatra-contrib (1.4.4) - backports (>= 2.0) - multi_json -@@ -25,22 +10,11 @@ GEM - rack-test - sinatra (~> 1.4.0) - tilt (>= 1.3, < 3) -- tilt (1.4.1) - - PLATFORMS - ruby - - DEPENDENCIES -- backports -- eventmachine -- json -- multi_json -- open4 - orderedhash -- rack -- rack-protection -- rack-test - rpam-ruby19 -- sinatra - sinatra-contrib -- tilt + from __future__ import absolute_import + import os.path diff --git a/pcsd/Makefile b/pcsd/Makefile -index 8ae6bc4..1fdfea7 100644 +index 9a4a4ba..4fd3786 100644 --- a/pcsd/Makefile +++ b/pcsd/Makefile -@@ -1,5 +1,5 @@ +@@ -1,21 +1,9 @@ -build_gems: get_gems - bundle install --local --deployment +- +-# RHEL6 needs special rpam-ruby19 gem to work with 1.8.7 +-# also bundler is not available on RHEL6 in rpm +-build_gems_rhel6: +build_gems: -+ bundle install --verbose --local --path vendor/bundle + mkdir -p vendor/bundle/ruby +- gem install --verbose --no-rdoc --no-ri -l -i vendor/bundle/ruby \ +- vendor/cache/backports-3.6.8.gem \ +- vendor/cache/json-1.8.3.gem \ +- vendor/cache/multi_json-1.12.1.gem \ +- vendor/cache/open4-1.3.4.gem \ ++ gem install --force --verbose --no-rdoc --no-ri -l -i vendor/bundle/ruby \ + vendor/cache/orderedhash-0.0.6.gem \ + vendor/cache/rack-1.6.4.gem \ +- vendor/cache/rack-protection-1.5.3.gem \ +- vendor/cache/rack-test-0.6.3.gem \ +- vendor/cache/rpam-ruby19-feist-1.2.1.1.gem \ +- vendor/cache/tilt-2.0.3.gem \ ++ vendor/cache/rpam-ruby19-1.2.1.gem \ + vendor/cache/sinatra-1.4.7.gem \ + vendor/cache/sinatra-contrib-1.4.7.gem \ + -- '--with-ldflags="-Wl,-z,now -Wl,-z,relro"' +diff --git a/pcsd/pcsd.rb b/pcsd/pcsd.rb +index dcfd5a0..adc8dc2 100644 +--- a/pcsd/pcsd.rb ++++ b/pcsd/pcsd.rb +@@ -1,3 +1,4 @@ ++gem 'sinatra', '= 1.4.7' + require 'sinatra' + require 'sinatra/reloader' if development? + require 'sinatra/cookies' +diff --git a/pcsd/pcsd.service-runner b/pcsd/pcsd.service-runner +index 883d290..712913e 100644 +--- a/pcsd/pcsd.service-runner ++++ b/pcsd/pcsd.service-runner +@@ -3,8 +3,9 @@ + # it also serves as a holder of a selinux context - # RHEL6 needs special rpam-ruby19 gem to work with 1.8.7 - # also bundler is not available on RHEL6 in rpm + begin +- # add pcsd to the load path (ruby -I) ++ # add pcsd and bundled gems to the load path (ruby -I) + libdir = File.dirname(__FILE__) ++ $LOAD_PATH.unshift(*Dir[libdir + '/vendor/bundle/ruby/gems/*/lib']) + $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) + + # change current directory (ruby -C) +diff --git a/pcsd/session.rb b/pcsd/session.rb +index c54a493..79f305d 100644 +--- a/pcsd/session.rb ++++ b/pcsd/session.rb +@@ -1,3 +1,4 @@ ++gem 'rack', '= 1.6.4' + require 'rack/session/pool' + + class SessionPoolLifetime < Rack::Session::Pool diff --git a/pcsd/ssl.rb b/pcsd/ssl.rb -index f56c947..0ee8448 100644 +index 7bbff46..c4f5a90 100644 --- a/pcsd/ssl.rb +++ b/pcsd/ssl.rb -@@ -95,7 +95,7 @@ else - end - - default_bind = true --primary_addr = '::' -+primary_addr = nil - secondary_addrs = [] - if ENV['PCSD_BIND_ADDR'] - user_addrs = ENV['PCSD_BIND_ADDR'].split(',').collect { |x| x.strip() } +@@ -1,4 +1,5 @@ + require 'rubygems' ++gem 'rack', '= 1.6.4' + require 'webrick' + require 'webrick/https' + require 'openssl' -- -1.9.1 +2.9.3 diff --git a/fix-makefile-for-python3.patch b/fix-makefile-for-python3.patch deleted file mode 100644 index ebf0dc4..0000000 --- a/fix-makefile-for-python3.patch +++ /dev/null @@ -1,79 +0,0 @@ -From a575e14d20b8d63ebd998db8aa16b99abdb967c6 Mon Sep 17 00:00:00 2001 -From: Tomas Jelinek -Date: Mon, 11 Apr 2016 12:30:42 +0200 -Subject: [PATCH] fix makefile for python3 - ---- - Makefile | 20 ++++++++++++-------- - 1 file changed, 12 insertions(+), 8 deletions(-) - -diff --git a/Makefile b/Makefile -index d80f72b..89bb691 100644 ---- a/Makefile -+++ b/Makefile -@@ -4,6 +4,10 @@ DISTRO_DEBIAN := $(shell if [ -e /etc/debian_version ] ; then echo true; else ec - IS_DEBIAN=false - DISTRO_DEBIAN_VER_8=false - -+ifndef PYTHON -+ PYTHON=python -+endif -+ - ifeq ($(UNAME_OS_GNU),true) - ifeq ($(DISTRO_DEBIAN),true) - IS_DEBIAN=true -@@ -16,7 +20,7 @@ ifeq ($(UNAME_OS_GNU),true) - endif - - ifndef PYTHON_SITELIB -- PYTHON_SITELIB=$(shell python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") -+ PYTHON_SITELIB=$(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") - endif - ifeq ($(PYTHON_SITELIB), /usr/lib/python2.6/dist-packages) - EXTRA_SETUP_OPTS="--install-layout=deb" -@@ -53,7 +57,7 @@ endif - MANDIR=/usr/share/man - - ifndef PREFIX -- PREFIX=$(shell prefix=`python -c "import sys; print(sys.prefix)"` || prefix="/usr"; echo $$prefix) -+ PREFIX=$(shell prefix=`$(PYTHON) -c "import sys; print(sys.prefix)"` || prefix="/usr"; echo $$prefix) - endif - - ifndef systemddir -@@ -73,7 +77,7 @@ ifndef install_settings - endif - - install: bash_completion -- python setup.py install --root=$(or ${DESTDIR}, /) ${EXTRA_SETUP_OPTS} -+ $(PYTHON) setup.py install --root=$(or ${DESTDIR}, /) ${EXTRA_SETUP_OPTS} - mkdir -p ${DESTDIR}${PREFIX}/sbin/ - mv ${DESTDIR}${PREFIX}/bin/pcs ${DESTDIR}${PREFIX}/sbin/pcs - install -D pcs/bash_completion.d.pcs ${DESTDIR}/etc/bash_completion.d/pcs -@@ -85,7 +89,7 @@ ifeq ($(IS_DEBIAN),true) - sed s/DEB_HOST_MULTIARCH/${DEB_HOST_MULTIARCH}/g pcs/settings.py.debian > $$tmp_settings; \ - install -m644 $$tmp_settings ${DESTDIR}${PYTHON_SITELIB}/pcs/settings.py; \ - rm -f $$tmp_settings -- python -m compileall -fl ${DESTDIR}${PYTHON_SITELIB}/pcs/settings.py -+ $(PYTHON) -m compileall -fl ${DESTDIR}${PYTHON_SITELIB}/pcs/settings.py - endif - endif - -@@ -146,11 +150,11 @@ endif - rm -rf ${DESTDIR}/var/lib/pcsd - - tarball: bash_completion -- python setup.py sdist --formats=tar -- python maketarballs.py -+ $(PYTHON) setup.py sdist --formats=tar -+ $(PYTHON) maketarballs.py - - newversion: -- python newversion.py -+ $(PYTHON) newversion.py - - bash_completion: -- cd pcs ; python -c 'import usage; usage.sub_generate_bash_completion()' > bash_completion.d.pcs ; cd .. -+ cd pcs ; $(PYTHON) -c 'import usage; usage.sub_generate_bash_completion()' > bash_completion.d.pcs ; cd .. --- -2.5.5 - diff --git a/pcs.spec b/pcs.spec index a64df24..9b6729c 100644 --- a/pcs.spec +++ b/pcs.spec @@ -1,44 +1,75 @@ Name: pcs -Version: 0.9.150 -Release: 2%{?dist} +Version: 0.9.154 +Release: 1%{?dist} License: GPLv2 -URL: http://github.com/feist/pcs +URL: https://github.com/ClusterLabs/pcs Group: System Environment/Base - Summary: Pacemaker Configuration System -Source0: https://github.com/feist/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz + +#part after last slash is recognized as filename in look-aside repository +#desired name is achived by trick with hash anchor +Source0: %{url}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz Source1: pcsd-bundle-config-1 + +Source11: https://rubygems.org/downloads/orderedhash-0.0.6.gem +Source12: https://rubygems.org/downloads/rack-1.6.4.gem +Source13: https://rubygems.org/downloads/rpam-ruby19-1.2.1.gem +Source14: https://rubygems.org/downloads/sinatra-1.4.7.gem +Source15: https://rubygems.org/downloads/sinatra-contrib-1.4.7.gem + Patch0: fedfix.patch -Patch1: fix-makefile-for-python3.patch - -Source2: https://rubygems.org/downloads/orderedhash-0.0.6.gem -Source3: https://rubygems.org/downloads/rpam-ruby19-1.2.1.gem -Source4: https://rubygems.org/downloads/sinatra-contrib-1.4.4.gem +# git for patches +BuildRequires: git +# python for pcs BuildRequires: python3 python3-devel python3-setuptools +# gcc for compiling custom rubygems +BuildRequires: gcc gcc-c++ +# ruby and gems for pcsd BuildRequires: ruby ruby-devel rubygem-bundler rubygem-io-console -# pcsd gems start -BuildRequires: rubygem-sinatra rubygem-rack rubygem-rack-protection rubygem-tilt -BuildRequires: rubygem-eventmachine rubygem-rack-test rubygem-multi_json rubygem-json -BuildRequires: rubygem-open4 rubygem-backports -# pcsd gems end +BuildRequires: rubygem-backports rubygem-json rubygem-multi_json rubygem-open4 +BuildRequires: rubygem-rack-protection rubygem-rack-test rubygem-tilt +# pam devel for compiling rubygem-rpam-ruby19 BuildRequires: pam-devel # for post, preun and postun macros BuildRequires: systemd # for UpdateTimestamps sanitization function BuildRequires: diffstat +# for tests +BuildRequires: corosync +BuildRequires: pacemaker pacemaker-cli +BuildRequires: fence-agents-all fence-virt +BuildRequires: booth-site +BuildRequires: python3-lxml python3-mock +BuildRequires: rubygem-test-unit -Requires: pacemaker ruby python3 -Requires: psmisc openssl -Requires: python-clufter => 0.55.0 -Requires: python3-lxml -Requires: rubygem-sinatra rubygem-rack rubygem-rack-protection rubygem-tilt -Requires: rubygem-eventmachine rubygem-rack-test rubygem-multi_json rubygem-json -Requires: rubygem-open4 rubygem-backports +# python and libraries for pcs, setuptools for pcs entrypoint +Requires: python3 python3-setuptools python3-lxml +# ruby and gems for pcsd +Requires: ruby +Requires: rubygem-backports rubygem-json rubygem-multi_json rubygem-open4 +Requires: rubygem-rack-protection rubygem-rack-test rubygem-tilt +# for killall +Requires: psmisc +# for working with certificates (validation etc.) +Requires: openssl +# cluster stack and related packages +Requires: corosync pacemaker pacemaker-cli +# clufter currently doesn't have python3 package +Requires: python-clufter => 0.59.0 +# for post, preun and postun macros +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd Provides: bundled(rubygem-orderedhash) = 0.0.6 +# fedora provides version 2.0.1 which is not compatible with pcsd currently +Provides: bundled(rubygem-rack) = 1.6.4 Provides: bundled(rubygem-rpam-ruby19) = 1.2.1 -Provides: bundled(rubygem-sinatra-contrib) = 1.4.4 +# fedora provides a patched verison of sinatra which works with rack 2.0.1 but +# doesn't work with rack 1.6.4 +Provides: bundled(rubygem-sinatra) = 1.4.7 +Provides: bundled(rubygem-sinatra-contrib) = 1.4.7 %description pcs is a corosync and pacemaker configuration tool. It permits users to @@ -63,30 +94,88 @@ UpdateTimestamps() { %patch0 -p1 UpdateTimestamps -p1 %{PATCH0} -%patch1 -p1 -UpdateTimestamps -p1 %{PATCH1} mkdir -p pcsd/.bundle cp -f %SOURCE1 pcsd/.bundle/config mkdir -p pcsd/vendor/cache -cp -f %SOURCE2 pcsd/vendor/cache -cp -f %SOURCE3 pcsd/vendor/cache -cp -f %SOURCE4 pcsd/vendor/cache +#copy ruby gems +cp -f %SOURCE11 pcsd/vendor/cache +cp -f %SOURCE12 pcsd/vendor/cache +cp -f %SOURCE13 pcsd/vendor/cache +cp -f %SOURCE14 pcsd/vendor/cache +cp -f %SOURCE15 pcsd/vendor/cache +#ruby gems copied %build +%define PCS_PREFIX /usr %install rm -rf $RPM_BUILD_ROOT pwd -make install DESTDIR=$RPM_BUILD_ROOT PYTHON_SITELIB=%{python3_sitelib} PYTHON=%{__python3} -make install_pcsd DESTDIR=$RPM_BUILD_ROOT hdrdir="%{_includedir}" rubyhdrdir="%{_includedir}" includedir="%{_includedir}" -# quickfix for rubygems issue -# https://bugzilla.redhat.com/show_bug.cgi?id=1299835 -cd $RPM_BUILD_ROOT/usr/lib/pcsd/vendor/bundle/ruby -ln -s 2.3.0/extensions extensions -ln -s 2.3.0/gems gems -ln -s 2.3.0/specifications specifications -# quickfix end +make install \ + DESTDIR=$RPM_BUILD_ROOT \ + PREFIX=%{PCS_PREFIX} \ + PYTHON=%{__python3} \ + PYTHON_SITELIB=%{python3_sitelib} \ + BASH_COMPLETION_DIR=$RPM_BUILD_ROOT/usr/share/bash-completion/completions +make install_pcsd \ + DESTDIR=$RPM_BUILD_ROOT \ + PREFIX=%{PCS_PREFIX} \ + PYTHON=%{__python3} \ + PYTHON_SITELIB=%{python3_sitelib} \ + hdrdir="%{_includedir}" \ + rubyhdrdir="%{_includedir}" \ + includedir="%{_includedir}" + +%check +run_all_tests(){ + #prepare environmet for tests + sitelib=$RPM_BUILD_ROOT%{python3_sitelib} + pcsd_dir=$RPM_BUILD_ROOT%{PCS_PREFIX}/lib/pcsd + export PYTHONPATH="${PYTHONPATH}:${sitelib}" + + #run pcs tests and remove them, we do not distribute them in rpm + + # disabled tests: + # + # pcs.test.test_cluster.ClusterTest.testUIDGID + # touches live cluster configuration, cannot run in mock environment + # + # pcs.lib.booth.test.test_env.SetKeyfileAccessTest.test_set_desired_file_access + # touches live cluster configuration, test need to be fixed + # Traceback (most recent call last): + # File "/builddir/build/BUILDROOT/pcs-0.9.152-6.el7.x86_64/usr/lib/python2.7/site-packages/pcs/lib/booth/test/test_env.py", line 148, in test_set_desired_file_access + # env.set_keyfile_access(file_path) + # File "/builddir/build/BUILDROOT/pcs-0.9.152-6.el7.x86_64/usr/lib/python2.7/site-packages/pcs/lib/booth/env.py", line 63, in set_keyfile_access + # raise report_keyfile_io_error(file_path, "chown", e) + # LibraryError: ERROR FILE_IO_ERROR: {u'reason': u"Operation not permitted: '/builddir/build/BUILDROOT/pcs-0.9.152-6.el7.x86_64/usr/lib/python2.7/site-packages/pcs/test/resources/temp-keyfile'", u'file_role': u'BOOTH_KEY', u'file_path': u'/builddir/build/BUILDROOT/pcs-0.9.152-6.el7.x86_64/usr/lib/python2.7/site-packages/pcs/test/resources/temp-keyfile', u'operation': u'chown'} + + %{__python3} ${sitelib}/pcs/test/suite.py -v --no-color --all-but \ + pcs.test.test_cluster.ClusterTest.testUIDGID \ + pcs.lib.booth.test.test_env.SetKeyfileAccessTest.test_set_desired_file_access \ + + test_result_python=$? + + #remove pcs tests, we do not distribute them in rpm + find ${sitelib}/pcs -name test -type d -print0|xargs -0 rm -r -v -- + + + #run pcsd tests and remove them + GEM_HOME=${pcsd_dir}/vendor/bundle/ruby ruby \ + -I${pcsd_dir} \ + -I${pcsd_dir}/test \ + ${pcsd_dir}/test/test_all_suite.rb + test_result_ruby=$? + #remove pcsd tests, we do not distribute them in rpm + rm -r -v ${pcsd_dir}/test + + if [ $test_result_python -ne 0 ]; then + return $test_result_python + fi + return $test_result_ruby +} + +run_all_tests %post %systemd_post pcsd.service @@ -104,25 +193,34 @@ ln -s 2.3.0/specifications specifications /usr/lib/pcsd/* /usr/lib/pcsd/.bundle/config /usr/lib/systemd/system/pcsd.service +/usr/share/bash-completion/completions/pcs /var/lib/pcsd /etc/pam.d/pcsd -/etc/bash_completion.d/pcs /etc/logrotate.d/pcsd %dir /var/log/pcsd %config(noreplace) /etc/sysconfig/pcsd +%ghost %config(noreplace) /var/lib/pcsd/cfgsync_ctl +%ghost %config(noreplace) /var/lib/pcsd/pcsd.cookiesecret +%ghost %config(noreplace) /var/lib/pcsd/pcsd.crt +%ghost %config(noreplace) /var/lib/pcsd/pcsd.key +%ghost %config(noreplace) /var/lib/pcsd/pcs_settings.conf +%ghost %config(noreplace) /var/lib/pcsd/pcs_users.conf +%ghost %config(noreplace) /var/lib/pcsd/tokens %{_mandir}/man8/pcs.* %exclude /usr/lib/pcsd/*.debian -%exclude /usr/lib/pcsd/.gitignore -%exclude /usr/lib/pcsd/test %exclude /usr/lib/pcsd/pcsd.service %exclude /usr/lib/pcsd/pcsd.conf -%exclude %{python3_sitelib}/pcs/bash_completion.d.pcs +%exclude %{python3_sitelib}/pcs/bash_completion.sh %exclude %{python3_sitelib}/pcs/pcs.8 %exclude %{python3_sitelib}/pcs/pcs %doc COPYING README %changelog +* Thu Sep 22 2016 Tomas Jelinek - 0.9.154-1 +- Re-synced to upstream sources +- Spec file cleanup and fixes + * Tue Jul 19 2016 Fedora Release Engineering - 0.9.150-2 - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages diff --git a/sources b/sources index 4e2d02b..92f196a 100644 --- a/sources +++ b/sources @@ -1,6 +1,7 @@ -9ff7cd69ee65fb7c201924473321a987 pcs-0.9.149.tar.gz 1668db3c807839d5ff3f90d0d6c4dadb orderedhash-0.0.6.gem +7f11121a95fe4e59cd86af2b791a3590 rack-1.6.4.gem e4538ac4d9f20d3720c9fc73a0c58f6c rpam-ruby19-1.2.1.gem -aa1f67aac4d19f000297c91782d0b747 sinatra-contrib-1.4.4.gem +757adc7bc6bf427c0948e683ce07b441 sinatra-1.4.7.gem +f3273cde75651be7fdfc04c7bf0e2ef2 sinatra-contrib-1.4.7.gem 2c8c658b54face6f08f47cbdf848eeae pcsd-bundle-config-1 -53c6497971da685228b674b0eb91d4f2 pcs-0.9.150.tar.gz +a2e7e2a69a6337001bf4cd880aadf9c6 pcs-0.9.154.tar.gz