400 lines
13 KiB
RPMSpec
400 lines
13 KiB
RPMSpec
Name: pcs
|
|
Version: 0.10.8
|
|
Release: 1
|
|
License: GPLv2 and BSD-2-Clause and ASL 2.0 and MIT
|
|
URL: https://github.com/ClusterLabs/pcs
|
|
Summary: Pacemaker Configuration System
|
|
|
|
%global version_or_commit %{version}
|
|
%global pcs_source_name %{name}-%{version_or_commit}
|
|
|
|
# ui_commit can be determined by hash, tag or branch
|
|
%global ui_commit 0.1.5
|
|
%global ui_src_name pcs-web-ui-%{ui_commit}
|
|
|
|
%global pcs_snmp_pkg_name pcs-snmp
|
|
|
|
%global pyagentx_version 0.4.pcs.2
|
|
%global dacite_version 1.6.0
|
|
|
|
# bundled libraries for old web-ui
|
|
%global ember_version 1.4.0
|
|
%global jquery_version 1.9.1
|
|
%global jquery_ui_version 1.10.1
|
|
%global handlebars_version 1.2.1
|
|
|
|
# We do not use _libdir macro because upstream is not prepared for it.
|
|
# Pcs does not include binaries and thus it should live in /usr/lib. Tornado
|
|
# and gems include binaries and thus it should live in /usr/lib64. But the
|
|
# path to tornado/gems is hardcoded in pcs sources. Modify hard links in pcs
|
|
# sources is not the way since then rpmdiff complains that the same file has
|
|
# different content in different architectures.
|
|
%global pcs_libdir %{_prefix}/lib
|
|
%global bundled_src_dir pcs/bundled
|
|
%global pcsd_public_dir pcsd/public
|
|
|
|
#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_or_commit}/%{pcs_source_name}.tar.gz
|
|
Source1: https://github.com/ondrejmular/pyagentx/archive/v%{pyagentx_version}/pyagentx-%{pyagentx_version}.tar.gz
|
|
Source2: https://github.com/konradhalas/dacite/archive/v%{dacite_version}/dacite-%{dacite_version}.tar.gz
|
|
Source3: https://github.com/idevat/pcs-web-ui/archive/%{ui_commit}/%{ui_src_name}.tar.gz
|
|
Source4: https://github.com/idevat/pcs-web-ui/releases/download/%{ui_commit}/pcs-web-ui-node-modules-%{ui_commit}.tar.xz
|
|
|
|
Patch0: 0001-Resolve-the-failure-of-field-matching-in-test-cases.patch
|
|
# git for patches
|
|
BuildRequires: make
|
|
BuildRequires: git-core
|
|
#printf from coreutils is used in makefile
|
|
BuildRequires: coreutils
|
|
# python for pcs
|
|
BuildRequires: python3 >= 3.6
|
|
BuildRequires: python3-dateutil >= 2.7.0
|
|
BuildRequires: python3-devel
|
|
BuildRequires: python3-setuptools
|
|
BuildRequires: python3-pycurl
|
|
BuildRequires: python3-pyparsing
|
|
BuildRequires: python3-tornado
|
|
# ruby and gems for pcsd
|
|
BuildRequires: ruby >= 2.2.0
|
|
BuildRequires: ruby-devel
|
|
BuildRequires: rubygem-backports
|
|
BuildRequires: rubygem-ethon
|
|
BuildRequires: rubygem-ffi
|
|
BuildRequires: rubygem-io-console
|
|
BuildRequires: rubygem-json
|
|
BuildRequires: rubygem-open4
|
|
BuildRequires: rubygem-rack
|
|
BuildRequires: rubygem-rack-protection
|
|
BuildRequires: rubygem-rack-test
|
|
BuildRequires: rubygem-sinatra
|
|
BuildRequires: rubygem(rexml)
|
|
BuildRequires: rubygem-tilt
|
|
# ruby libraries for tests
|
|
BuildRequires: rubygem-test-unit
|
|
# for touching patch files (sanitization function)
|
|
BuildRequires: diffstat
|
|
# for post, preun and postun macros
|
|
BuildRequires: systemd
|
|
# for tests
|
|
BuildRequires: python3-lxml
|
|
BuildRequires: python3-pyOpenSSL
|
|
# pcsd fonts and font management tools for creating symlinks to fonts
|
|
BuildRequires: fontconfig
|
|
BuildRequires: liberation-sans-fonts
|
|
BuildRequires: overpass-fonts
|
|
|
|
# for building web ui
|
|
BuildRequires: npm
|
|
|
|
# python and libraries for pcs, setuptools for pcs entrypoint
|
|
Requires: python3 >= 3.6
|
|
Requires: python3-lxml
|
|
Requires: python3-setuptools
|
|
Requires: python3-pycurl
|
|
Requires: python3-dateutil >= 2.7.0
|
|
Requires: python3-pyparsing
|
|
Requires: python3-tornado
|
|
# ruby and gems for pcsd
|
|
Requires: ruby >= 2.2.0
|
|
Requires: rubygem-backports
|
|
Requires: rubygem-ethon
|
|
Requires: rubygem-ffi
|
|
Requires: rubygem-json
|
|
Requires: rubygem-open4
|
|
Requires: rubygem-rack
|
|
Requires: rubygem-rack-protection
|
|
Requires: rubygem-rack-test
|
|
Requires: rubygem(rexml)
|
|
Requires: rubygem(webrick)
|
|
Requires: rubygem-tilt
|
|
Requires: rubygem-sinatra
|
|
# ruby and gems for pcsd-ruby
|
|
Requires: rubygem-daemons
|
|
Requires: rubygem-eventmachine
|
|
Requires: rubygem-thin
|
|
# for killall
|
|
Requires: psmisc
|
|
# for working with certificates (validation etc.)
|
|
Requires: openssl
|
|
Requires: python3-pyOpenSSL
|
|
# cluster stack and related packages
|
|
Suggests: pacemaker
|
|
Requires: (corosync >= 2.99 if pacemaker)
|
|
# pcs enables corosync encryption by default so we require libknet1-plugins-all
|
|
Requires: (libknet1-plugins-all if corosync)
|
|
Requires: pacemaker-cli >= 2.0.0
|
|
# for post, preun and postun macros
|
|
Requires(post): systemd
|
|
Requires(preun): systemd
|
|
Requires(postun): systemd
|
|
# pam is used for authentication inside daemon (python ctypes)
|
|
# more details: https://bugzilla.redhat.com/show_bug.cgi?id=1717113
|
|
Requires: pam
|
|
# pcsd fonts
|
|
Requires: liberation-sans-fonts
|
|
Requires: overpass-fonts
|
|
|
|
Provides: bundled(dacite) = %{dacite_version}
|
|
Provides: bundled(ember) = %{ember_version}
|
|
Provides: bundled(handlebars) = %{handlebars_version}
|
|
Provides: bundled(jquery) = %{jquery_version}
|
|
Provides: bundled(jquery-ui) = %{jquery_ui_version}
|
|
|
|
%description
|
|
pcs is a corosync and pacemaker configuration tool. It permits users to
|
|
easily view, modify and create pacemaker based clusters.
|
|
|
|
# pcs-snmp package definition
|
|
%package -n %{pcs_snmp_pkg_name}
|
|
Summary: Pacemaker cluster SNMP agent
|
|
License: GPLv2 and BSD-2-Clause
|
|
|
|
# tar for unpacking pyagetx source tar ball
|
|
BuildRequires: tar
|
|
|
|
Requires: pcs = %{version}-%{release}
|
|
Requires: pacemaker
|
|
Requires: net-snmp
|
|
|
|
Provides: bundled(pyagentx) = %{pyagentx_version}
|
|
|
|
%description -n %{pcs_snmp_pkg_name}
|
|
SNMP agent that provides information about pacemaker cluster to the master agent (snmpd)
|
|
|
|
%prep
|
|
%autosetup -p1 -S git -n %{pcs_source_name}
|
|
|
|
# -- following is inspired by python-simplejon.el5 --
|
|
# Update timestamps on the files touched by a patch, to avoid non-equal
|
|
# .pyc/.pyo files across the multilib peers within a build
|
|
|
|
update_times(){
|
|
# update_times <reference_file> <file_to_touch> ...
|
|
# set the access and modification times of each file_to_touch to the times
|
|
# of reference_file
|
|
|
|
# put all args to file_list
|
|
file_list=("$@")
|
|
# first argument is reference_file: so take it and remove from file_list
|
|
reference_file=${file_list[0]}
|
|
unset file_list[0]
|
|
|
|
for fname in ${file_list[@]}; do
|
|
touch -r $reference_file $fname
|
|
done
|
|
}
|
|
|
|
update_times_patch(){
|
|
# update_times_patch <patch_file_name>
|
|
# set the access and modification times of each file in patch to the times
|
|
# of patch_file_name
|
|
|
|
patch_file_name=$1
|
|
|
|
# diffstat
|
|
# -l lists only the filenames. No histogram is generated.
|
|
# -p override the logic that strips common pathnames,
|
|
# simulating the patch "-p" option. (Strip the smallest prefix containing
|
|
# num leading slashes from each file name found in the patch file)
|
|
update_times ${patch_file_name} `diffstat -p1 -l ${patch_file_name}`
|
|
}
|
|
|
|
# update_times_patch %%{PATCH0}
|
|
|
|
# prepare dirs/files necessary for building web ui
|
|
# inside SOURCE3 is only directory %%{ui_src_name}
|
|
tar -xzf %SOURCE3 -C %{pcsd_public_dir}
|
|
tar -xf %SOURCE4 -C %{pcsd_public_dir}/%{ui_src_name}
|
|
|
|
# dir for python bundles
|
|
mkdir -p %{bundled_src_dir}
|
|
|
|
# sources for pyagentx
|
|
tar -xzf %SOURCE1 -C %{bundled_src_dir}
|
|
mv %{bundled_src_dir}/pyagentx-%{pyagentx_version} %{bundled_src_dir}/pyagentx
|
|
update_times %SOURCE1 `find %{bundled_src_dir}/pyagentx -follow`
|
|
cp %{bundled_src_dir}/pyagentx/LICENSE.txt pyagentx_LICENSE.txt
|
|
cp %{bundled_src_dir}/pyagentx/CONTRIBUTORS.txt pyagentx_CONTRIBUTORS.txt
|
|
cp %{bundled_src_dir}/pyagentx/README.md pyagentx_README.md
|
|
|
|
# sources for python dacite
|
|
tar -xzf %SOURCE2 -C %{bundled_src_dir}
|
|
mv %{bundled_src_dir}/dacite-%{dacite_version} %{bundled_src_dir}/dacite
|
|
cp %{bundled_src_dir}/dacite/LICENSE dacite_LICENSE
|
|
cp %{bundled_src_dir}/dacite/README.md dacite_README.md
|
|
|
|
%build
|
|
%define debug_package %{nil}
|
|
|
|
%install
|
|
rm -rf $RPM_BUILD_ROOT
|
|
pwd
|
|
|
|
# build web ui and put it to pcsd
|
|
make -C %{pcsd_public_dir}/%{ui_src_name} build
|
|
mv %{pcsd_public_dir}/%{ui_src_name}/build pcsd/public/ui
|
|
rm -r %{pcsd_public_dir}/%{ui_src_name}
|
|
|
|
# main pcs install
|
|
%make_install \
|
|
PREFIX=%{_prefix} \
|
|
SYSTEMD_UNIT_DIR=%{_unitdir} \
|
|
LIB_DIR=%{pcs_libdir} \
|
|
PYTHON=%{__python3} \
|
|
PYTHON_SITELIB=%{python3_sitelib} \
|
|
BASH_COMPLETION_DIR=%{_datadir}/bash-completion/completions \
|
|
BUNDLE_PYAGENTX_SRC_DIR=`readlink -f %{bundled_src_dir}/pyagentx` \
|
|
BUNDLE_DACITE_SRC_DIR=`readlink -f %{bundled_src_dir}/dacite` \
|
|
BUILD_GEMS=false \
|
|
SYSTEMCTL_OVERRIDE=true \
|
|
hdrdir="%{_includedir}" \
|
|
rubyhdrdir="%{_includedir}" \
|
|
includedir="%{_includedir}"
|
|
|
|
%check
|
|
# In the building environment LC_CTYPE is set to C which causes tests to fail
|
|
# due to python prints a warning about it to stderr. The following environment
|
|
# variable disables the warning.
|
|
# On the live system either UTF8 locale is set or the warning is emmited
|
|
# which breaks pcs. That is the correct behavior since with wrong locales it
|
|
# would be probably broken anyway.
|
|
# The main concern here is to make the tests pass.
|
|
# See https://fedoraproject.org/wiki/Changes/python3_c.utf-8_locale for details.
|
|
export PYTHONCOERCECLOCALE=0
|
|
|
|
run_all_tests(){
|
|
#run pcs tests
|
|
|
|
# disabled tests:
|
|
#
|
|
BUNDLED_LIB_LOCATION=$RPM_BUILD_ROOT%{pcs_libdir}/pcs/bundled/packages \
|
|
%{__python3} pcs_test/suite.py --tier0 -v --vanilla --all-but \
|
|
pcs_test.tier0.daemon.app.test_app_remote.SyncConfigMutualExclusive.test_get_not_locked \
|
|
pcs_test.tier0.daemon.app.test_app_remote.SyncConfigMutualExclusive.test_post_not_locked \
|
|
|
|
test_result_python=$?
|
|
|
|
#run pcsd tests and remove them
|
|
pcsd_dir=$RPM_BUILD_ROOT%{pcs_libdir}/pcsd
|
|
GEM_HOME=$RPM_BUILD_ROOT%{pcs_libdir}/%{rubygem_bundle_dir} ruby \
|
|
-I${pcsd_dir} \
|
|
-I${pcsd_dir}/test \
|
|
${pcsd_dir}/test/test_all_suite.rb
|
|
test_result_ruby=$?
|
|
|
|
if [ $test_result_python -ne 0 ]; then
|
|
return $test_result_python
|
|
fi
|
|
return $test_result_ruby
|
|
}
|
|
|
|
remove_all_tests() {
|
|
pcsd_dir=$RPM_BUILD_ROOT%{pcs_libdir}/pcsd
|
|
#remove pcsd tests, we do not distribute them in the rpm
|
|
rm -r -v ${pcsd_dir}/test
|
|
|
|
# remove javascript testing files
|
|
rm -r -v ${pcsd_dir}/public/js/dev
|
|
}
|
|
|
|
run_all_tests
|
|
remove_all_tests
|
|
|
|
%posttrans
|
|
# Make sure the new version of the daemon is runnning.
|
|
# Also, make sure to start pcsd-ruby if it hasn't been started or even
|
|
# installed before. This is done by restarting pcsd.service.
|
|
%{_bindir}/systemctl daemon-reload
|
|
%{_bindir}/systemctl try-restart pcsd.service
|
|
|
|
%post
|
|
%systemd_post pcsd.service
|
|
%systemd_post pcsd-ruby.service
|
|
|
|
%post -n %{pcs_snmp_pkg_name}
|
|
%systemd_post pcs_snmp_agent.service
|
|
|
|
%preun
|
|
%systemd_preun pcsd.service
|
|
%systemd_preun pcsd-ruby.service
|
|
|
|
%preun -n %{pcs_snmp_pkg_name}
|
|
%systemd_preun pcs_snmp_agent.service
|
|
|
|
%postun
|
|
%systemd_postun_with_restart pcsd.service
|
|
%systemd_postun_with_restart pcsd-ruby.service
|
|
|
|
%postun -n %{pcs_snmp_pkg_name}
|
|
%systemd_postun_with_restart pcs_snmp_agent.service
|
|
|
|
%files
|
|
%doc CHANGELOG.md
|
|
%doc README.md
|
|
%doc dacite_README.md
|
|
%license dacite_LICENSE
|
|
%license COPYING
|
|
%{python3_sitelib}/pcs
|
|
%{python3_sitelib}/pcs-%{version}-py3.*.egg-info
|
|
%{_sbindir}/pcs
|
|
%{_sbindir}/pcsd
|
|
%{pcs_libdir}/pcs/pcs_internal
|
|
%{pcs_libdir}/pcsd/*
|
|
%{pcs_libdir}/pcs/bundled/packages/dacite*
|
|
%{_unitdir}/pcsd.service
|
|
%{_unitdir}/pcsd-ruby.service
|
|
%{_datadir}/bash-completion/completions/pcs
|
|
%{_sharedstatedir}/pcsd
|
|
%{_sysconfdir}/pam.d/pcsd
|
|
%dir %{_var}/log/pcsd
|
|
%config(noreplace) %{_sysconfdir}/logrotate.d/pcsd
|
|
%config(noreplace) %{_sysconfdir}/sysconfig/pcsd
|
|
%ghost %config(noreplace) %attr(0600,root,root) %{_sharedstatedir}/pcsd/cfgsync_ctl
|
|
%ghost %config(noreplace) %attr(0600,root,root) %{_sharedstatedir}/pcsd/known-hosts
|
|
%ghost %config(noreplace) %attr(0600,root,root) %{_sharedstatedir}/pcsd/pcsd.cookiesecret
|
|
%ghost %config(noreplace) %attr(0600,root,root) %{_sharedstatedir}/pcsd/pcsd.crt
|
|
%ghost %config(noreplace) %attr(0600,root,root) %{_sharedstatedir}/pcsd/pcsd.key
|
|
%ghost %config(noreplace) %attr(0644,root,root) %{_sharedstatedir}/pcsd/pcs_settings.conf
|
|
%ghost %config(noreplace) %attr(0644,root,root) %{_sharedstatedir}/pcsd/pcs_users.conf
|
|
%{_mandir}/man8/pcs.*
|
|
%{_mandir}/man8/pcsd.*
|
|
%exclude %{pcs_libdir}/pcsd/*.debian
|
|
%exclude %{pcs_libdir}/pcsd/Gemfile
|
|
%exclude %{pcs_libdir}/pcsd/Gemfile.lock
|
|
%exclude %{pcs_libdir}/pcsd/Makefile
|
|
%exclude %{pcs_libdir}/pcsd/pcsd.conf
|
|
%exclude %{pcs_libdir}/pcsd/pcsd.service
|
|
%exclude %{pcs_libdir}/pcsd/pcsd-ruby.service
|
|
%exclude %{pcs_libdir}/pcsd/pcsd.8
|
|
%exclude %{pcs_libdir}/pcsd/public/js/dev/*
|
|
%exclude %{python3_sitelib}/pcs/bash_completion
|
|
%exclude %{python3_sitelib}/pcs/pcs.8
|
|
%exclude %{python3_sitelib}/pcs/pcs
|
|
|
|
%files -n %{pcs_snmp_pkg_name}
|
|
%{pcs_libdir}/pcs/pcs_snmp_agent
|
|
%{pcs_libdir}/pcs/bundled/packages/pyagentx*
|
|
%{_unitdir}/pcs_snmp_agent.service
|
|
%{_datadir}/snmp/mibs/PCMK-PCS*-MIB.txt
|
|
%{_mandir}/man8/pcs_snmp_agent.*
|
|
%config(noreplace) %{_sysconfdir}/sysconfig/pcs_snmp_agent
|
|
%doc CHANGELOG.md
|
|
%doc pyagentx_CONTRIBUTORS.txt
|
|
%doc pyagentx_README.md
|
|
%license COPYING
|
|
%license pyagentx_LICENSE.txt
|
|
|
|
%changelog
|
|
* Thu Mar 10 2022 jiangxinyu <jiangxinyu@kylinos.cn> - 0.10.8-1
|
|
- update to 0.10.8
|
|
|
|
* Fri Oct 30 2020 jiangxinyu <jiangxinyu@kylinos.cn> - 0.10.5-1
|
|
- Upgrade the pcs package version to 0.10.5-1
|
|
|
|
* Sun Apr 26 2020 wangmian<wangmian@kylinos.cn> - 0.10.2-5
|
|
- Change pcs ui
|
|
|
|
* Wed Apr 22 2020 houjian<houjian@kylinos.cn> - 0.10.2-4
|
|
- Init the project
|