commit: 32affc186e1f6661c0a2ff1e3d1a5c5cb2df50c2 Author: Andrea Postiglione <andrea.postiglione <AT> gmail <DOT> com> AuthorDate: Sat Dec 5 21:08:33 2020 +0000 Commit: Andrea Postiglione <andrea.postiglione <AT> gmail <DOT> com> CommitDate: Sat Dec 5 21:08:33 2020 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=32affc18
sys-cluster/pcs-0.10.7: initial ebuild Package-Manager: Portage-3.0.11, Repoman-3.0.2 Signed-off-by: Andrea Postiglione <andrea.postiglione <AT> gmail.com> sys-cluster/pcs/Manifest | 1 + sys-cluster/pcs/files/openrc-0.10.7.patch | 118 +++++++++++++++++++++ sys-cluster/pcs/files/pcsd-daemon.initd | 27 +++++ sys-cluster/pcs/files/pcsd.initd | 35 ++++++ .../pcs/files/remove-ruby-bundle-path.patch | 11 ++ sys-cluster/pcs/metadata.xml | 18 ++++ sys-cluster/pcs/pcs-0.10.7.ebuild | 106 ++++++++++++++++++ 7 files changed, 316 insertions(+) diff --git a/sys-cluster/pcs/Manifest b/sys-cluster/pcs/Manifest new file mode 100644 index 00000000..ecae6dae --- /dev/null +++ b/sys-cluster/pcs/Manifest @@ -0,0 +1 @@ +DIST pcs-0.10.7.tar.gz 1818215 BLAKE2B 345ba114f92c1f555a948b1f6eafb532056d3196c9f0cf3007d7d27d8a8957c886f3a5ab2519e0922908c3d11ed9dc54632376d5556f6b1dc5dfb035bcfda4bf SHA512 c76a11fa162258ee311dcceca50674d7638396880596a826a711d944aab421ed06a6c4eb41f9dc997c01b72bce73c98c4f7be3fcd8fafb8ae16902f6a1e0c521 diff --git a/sys-cluster/pcs/files/openrc-0.10.7.patch b/sys-cluster/pcs/files/openrc-0.10.7.patch new file mode 100644 index 00000000..a2cd30d0 --- /dev/null +++ b/sys-cluster/pcs/files/openrc-0.10.7.patch @@ -0,0 +1,118 @@ +--- a/pcs/settings_default.py 2019-06-12 23:35:02.146909492 +0900 ++++ b/pcs/settings_default.py 2019-06-12 23:31:27.795771910 +0900 +@@ -1,8 +1,8 @@ + import os.path + + systemctl_binary = "/bin/systemctl" +-chkconfig_binary = "/sbin/chkconfig" +-service_binary = "/sbin/service" ++chkconfig_binary = "/usr/bin/rc-config" ++service_binary = "/sbin/rc-service" + pacemaker_binaries = "/usr/sbin/" + crm_resource_binary = os.path.join(pacemaker_binaries, "crm_resource") + corosync_binaries = "/usr/sbin/" +--- a/pcsd/pcs.rb 2019-06-12 23:35:13.882862268 +0900 ++++ b/pcsd/pcs.rb 2019-06-12 23:31:11.357838047 +0900 +@@ -1712,7 +1712,7 @@ + if ISSYSTEMCTL + cmd = ['systemctl', 'is-enabled', "#{service}.service"] + else +- cmd = ['chkconfig', service] ++ cmd = ['/usr/bin/rc-config','list default|/bin/grep -ow', service] + end + _, _, retcode = run_cmd(PCSAuth.getSuperuserAuth(), *cmd) + return (retcode == 0) +@@ -1722,7 +1722,7 @@ + if ISSYSTEMCTL + cmd = ['systemctl', 'status', "#{service}.service"] + else +- cmd = ['service', service, 'status'] ++ cmd = ['/bin/rc-status', 'default|/bin/grep started| /bin/grep -ow', service] + end + _, _, retcode = run_cmd(PCSAuth.getSuperuserAuth(), *cmd) + return (retcode == 0) +@@ -1778,11 +1778,12 @@ + class ServiceInstalledCheckerChkconfig < ServiceInstalledChecker + protected + def run_command +- return run_cmd(PCSAuth.getSuperuserAuth(), 'chkconfig') ++ cmd = ['/usr/bin/rc-config', 'list'] ++ return run_cmd(PCSAuth.getSuperuserAuth(), *cmd) + end + + def contains_line_service?(line, service) +- return line.split(' ')[0] == service ++ return line.strip == service + end + end + +@@ -1765,7 +1766,7 @@ + cmd = ['systemctl', 'enable', "#{service}.service"] + else + # fails when the service is not installed +- cmd = ['chkconfig', service, 'on'] ++ cmd = ['/usr/bin/rc-config', 'add', service, 'default'] + end + _, _, retcode = run_cmd(PCSAuth.getSuperuserAuth(), *cmd) + return (retcode == 0) +@@ -1780,7 +1781,7 @@ + if ISSYSTEMCTL + cmd = ['systemctl', 'disable', "#{service}.service"] + else +- cmd = ['chkconfig', service, 'off'] ++ cmd = ['/usr/bin/rc-config', 'delete', service, 'default'] + end + _, _, retcode = run_cmd(PCSAuth.getSuperuserAuth(), *cmd) + return (retcode == 0) +--- a/pcs/lib/external.py 2019-06-12 23:35:06.017893916 +0900 ++++ b/pcs/lib/external.py 2019-06-12 23:31:18.962807448 +0900 +@@ -69,7 +69,7 @@ + _systemctl, "disable", _get_service_name(service, instance) + ]) + else: +- stdout, stderr, retval = runner.run([_chkconfig, service, "off"]) ++ stdout, stderr, retval = runner.run([_chkconfig, 'delete', service, "default"]) + if retval != 0: + raise DisableServiceError( + service, +@@ -93,7 +93,7 @@ + _systemctl, "enable", _get_service_name(service, instance) + ]) + else: +- stdout, stderr, retval = runner.run([_chkconfig, service, "on"]) ++ stdout, stderr, retval = runner.run([_chkconfig, 'add', service, "default"]) + if retval != 0: + raise EnableServiceError( + service, +@@ -177,8 +177,12 @@ + [_systemctl, "is-enabled", _get_service_name(service, instance)] + ) + else: +- dummy_stdout, dummy_stderr, retval = runner.run([_chkconfig, service]) +- ++ stdout, dummy_stderr, dummy_retval = runner.run([_chkconfig, 'list', 'default']) ++ retval = 1 ++ for line in stdout.splitlines(): ++ line = line.strip() ++ if service == line: ++ retval = 0 + return retval == 0 + + +@@ -225,14 +229,13 @@ + """ + if is_systemctl(): + return [] +- +- stdout, dummy_stderr, return_code = runner.run([_chkconfig]) ++ stdout, dummy_stderr, return_code = runner.run([_chkconfig, "list"]) + if return_code != 0: + return [] + + service_list = [] + for service in stdout.splitlines(): +- service = service.split(" ", 1)[0] ++ service = service.strip().split(' ')[0] + if service: + service_list.append(service) + return service_list diff --git a/sys-cluster/pcs/files/pcsd-daemon.initd b/sys-cluster/pcs/files/pcsd-daemon.initd new file mode 100644 index 00000000..1e93f85c --- /dev/null +++ b/sys-cluster/pcs/files/pcsd-daemon.initd @@ -0,0 +1,27 @@ +#!/sbin/openrc-run +# Copyright 2019-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +name="pcsd-daemon" +description="PCS GUI and remote configuration interface (Ruby)" +command=/usr/lib/pcsd/pcsd +command_args="${pcsd_args}" + +PIDFILE=/var/run/$name.pid + +start() { + nc=0 + ebegin "Starting $description" + + mkdir -p /var/run + + start-stop-daemon --start -q --exec $command $command_args \ + --pidfile "${PIDFILE}" --make-pidfile --background + eend $? +} + +stop() { + ebegin "Stopping $description" + start-stop-daemon --stop -q --pidfile "${PIDFILE}" + eend $? +} diff --git a/sys-cluster/pcs/files/pcsd.initd b/sys-cluster/pcs/files/pcsd.initd new file mode 100644 index 00000000..9f3010ba --- /dev/null +++ b/sys-cluster/pcs/files/pcsd.initd @@ -0,0 +1,35 @@ +#!/sbin/openrc-run +# Copyright 2019-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +name="pcsd" +description="Pacemaker & Corosync configuration daemon" +command=/usr/sbin/pcsd +command_args="${pcsd_args}" + +PIDFILE=/var/run/$name.pid + +# load defaults +if [ -f /etc/default/pcsd ]; then source /etc/default/pcsd; fi + +depend() { + need net pcsd-daemon + use syslog +} + +start() { + nc=0 + ebegin "Starting $description" + + mkdir -p /var/run + + start-stop-daemon --start -q --exec $command $command_args \ + --pidfile "${PIDFILE}" --make-pidfile --background + eend $? +} + +stop() { + ebegin "Stopping $description" + start-stop-daemon --stop -q --pidfile "${PIDFILE}" + eend $? +} diff --git a/sys-cluster/pcs/files/remove-ruby-bundle-path.patch b/sys-cluster/pcs/files/remove-ruby-bundle-path.patch new file mode 100644 index 00000000..69052b8e --- /dev/null +++ b/sys-cluster/pcs/files/remove-ruby-bundle-path.patch @@ -0,0 +1,11 @@ +--- a/pcs/settings_default.py 2018-11-23 12:57:53.000000000 +0000 ++++ b/pcs/settings_default.py 2019-05-11 20:07:19.080000000 +0000 +@@ -81,7 +81,7 @@ + ]) + # Set pcsd_gem_path to None if there are no bundled ruby gems and the path does + # not exists. +-pcsd_gem_path = "vendor/bundle/ruby" ++pcsd_gem_path = "" + ruby_executable = "/usr/bin/ruby" + + gui_session_lifetime_seconds = 60 * 60 diff --git a/sys-cluster/pcs/metadata.xml b/sys-cluster/pcs/metadata.xml new file mode 100644 index 00000000..fd9a0180 --- /dev/null +++ b/sys-cluster/pcs/metadata.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>andrea.postigli...@gmail.com</email> + <name>Andrea Postiglione</name> + </maintainer> + <longdescription> + Pcs is a Corosync and Pacemaker configuration tool. It permits users to easily view, modify and + create Pacemaker based clusters. Pcs contains pcsd, a pcs daemon, which operates as a remote server + for pcs and provides a web UI. + </longdescription> + <use> + </use> + <upstream> + <remote-id type="github">ClusterLabs/pcs</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-cluster/pcs/pcs-0.10.7.ebuild b/sys-cluster/pcs/pcs-0.10.7.ebuild new file mode 100644 index 00000000..b1a76287 --- /dev/null +++ b/sys-cluster/pcs/pcs-0.10.7.ebuild @@ -0,0 +1,106 @@ +# Copyright 2019-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{7..9} ) +#inherit distutils-r1 +inherit python-utils-r1 systemd + +DESCRIPTION="Pacemaker/Corosync Configuration System" +HOMEPAGE="https://github.com/ClusterLabs/pcs" +SRC_URI="https://github.com/ClusterLabs/pcs/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64" +IUSE="snmp systemd" + +DEPEND="media-libs/fontconfig + >=dev-lang/ruby-2.2 + dev-ruby/rubygems + dev-ruby/bundler + sys-devel/gcc + dev-libs/libffi + sys-apps/coreutils +" +RDEPEND="${DEPEND} + >=www-servers/tornado-6.0 + <www-servers/tornado-7.0 + dev-python/python-dateutil + dev-python/distro + dev-python/dacite + dev-python/lxml + dev-python/pyopenssl + dev-python/pycurl + dev-python/pyparsing + sys-process/psmisc + dev-libs/openssl + dev-ruby/open4 + dev-ruby/highline + dev-ruby/json + dev-ruby/multi_json + dev-ruby/rack + dev-ruby/rack-protection + dev-ruby/rack-test + dev-ruby/thor + dev-ruby/ethon + dev-ruby/thin + dev-ruby/tilt + dev-ruby/sinatra + dev-ruby/open4 + dev-ruby/backports + sys-libs/pam + >=sys-cluster/corosync-3.0 + >=sys-cluster/pacemaker-2.0 +" + +REQUIRED_USE=${PYTHON_REQUIRED_USE} + +PATCHES=( "${FILESDIR}/remove-ruby-bundle-path.patch" "${FILESDIR}/openrc-0.10.7.patch" ) + +src_compile() { + return +} + +src_install() { + # pre-create directory that is needed by 'make install' + dodir "/usr/lib/pcs" + # install files using 'make install' + emake install \ + SYSTEMCTL_OVERRIDE=$(use systemd) \ + DESTDIR="${D}" \ + CONF_DIR="/etc/default/" \ + PREFIX="/usr${EPREFIX}" \ + BUNDLE_INSTALL_PYAGENTX=false \ + BUNDLE_TO_INSTALL=false \ + BUILD_GEMS=false + + # mark log directories to be kept + keepdir /var/log/pcsd + keepdir /var/lib/pcsd + + # symlink the /usr/lib/pcs/pcs to /usr/sbin/pcs for pcsd + dosym /usr/sbin/pcs "${EPREFIX}/usr/lib/pcs/pcs" + + # use Debian style systemd unit (with config in /etc/default/pcsd) + cp -a "${S}/pcsd/pcsd.service.debian" "${D}/usr/lib/systemd/system/pcsd.service" + #cp -a "${S}/pcsd/pcsd-ruby.service.debian" "${D}/usr/lib/systemd/system/pcsd.service" + # custom service file for openRC + newinitd "${FILESDIR}/pcsd.initd" pcsd || die + newinitd "${FILESDIR}/pcsd-daemon.initd" pcsd-daemon || die + + # move config files to right places - we use debian-style /etc/default + cp -a "${S}/pcs/settings.py.debian" "${D}/usr/lib/pcs/settings.py" + cp -a "${S}/pcsd/settings.rb.debian" "${D}/usr/lib/pcsd/settings.rb" + + # unless support for SNMP was requested remove SNMP related files + if ! use snmp; then + rm -rf "${D}/usr/share/snmp" + rm -rf "${D}/usr/lib64/python*/site-packages/pcs/snmp" #FIXME + rm "${D}/usr/share/man/man8/pcs_snmp_agent.8" + rm "${D}/usr/lib/systemd/system/pcs_snmp_agent.service" + rm "${D}/usr/lib/pcs/pcs_snmp_agent" + rm "${D}/etc/default/pcs_snmp_agent" + fi +}