* [gentoo-commits] repo/proj/guru:dev commit in: sys-cluster/pcs/files/, sys-cluster/pcs/
@ 2020-12-05 21:09 Andrea Postiglione
0 siblings, 0 replies; 3+ messages in thread
From: Andrea Postiglione @ 2020-12-05 21:09 UTC (permalink / raw
To: gentoo-commits
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.postiglione@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
+}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sys-cluster/pcs/files/, sys-cluster/pcs/
@ 2022-04-03 14:05 Andrea Postiglione
0 siblings, 0 replies; 3+ messages in thread
From: Andrea Postiglione @ 2022-04-03 14:05 UTC (permalink / raw
To: gentoo-commits
commit: e7063905e35ee1725909a63cc0227f877d02c1a9
Author: Andrea Postiglione <andrea.postiglione <AT> gmail <DOT> com>
AuthorDate: Sun Apr 3 14:05:05 2022 +0000
Commit: Andrea Postiglione <andrea.postiglione <AT> gmail <DOT> com>
CommitDate: Sun Apr 3 14:05:05 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=e7063905
sys-cluster/pcs 0.11.2 first release
Signed-off-by: Andrea Postiglione <andrea.postiglione <AT> gmail.com>
sys-cluster/pcs/Manifest | 1 +
.../pcs/files/pcs-0.11-gentoo-support.patch | 516 +++++++++++++++++++++
sys-cluster/pcs/files/pcs-0.11.initd | 35 ++
sys-cluster/pcs/files/pcsd-0.11.initd | 27 ++
sys-cluster/pcs/pcs-0.11.2.ebuild | 110 +++++
5 files changed, 689 insertions(+)
diff --git a/sys-cluster/pcs/Manifest b/sys-cluster/pcs/Manifest
index 95eae5e99..3b8504e14 100644
--- a/sys-cluster/pcs/Manifest
+++ b/sys-cluster/pcs/Manifest
@@ -1 +1,2 @@
DIST pcs-0.10.8.tar.gz 1852902 BLAKE2B ef023ca27c2dbd1d765e1d68f67a55c79f57b1dbc7d571b8f21e1c30f8a8510b1148459a0e683c682fb969c7635ef726c8e227b995d1a35dfd27894f40bdaa26 SHA512 8b9ba62279431e481d062e804d24480d2a274d2f4897a82149df6116ff3df2394d97a3ee77a6dee4c563d915bab0142124a8942524fcc4e894912086e865353c
+DIST pcs-0.11.2.tar.gz 1412048 BLAKE2B f94459516f3ad29061a80b3fbeb228eef687c7cbb181bd0af219e410d53b7618eb029a52d4cab8599511455183ecbc01e64ef3d5735350834bccf51b51aa291c SHA512 ee610a7626de8c6abeffc23943fd95250c8550bbff946cffed8f18748bb862694f7cbc384127e0f062f121f3c31b8197b4b5d4eb150c3efcb8045809e54c0bf5
diff --git a/sys-cluster/pcs/files/pcs-0.11-gentoo-support.patch b/sys-cluster/pcs/files/pcs-0.11-gentoo-support.patch
new file mode 100644
index 000000000..d2e6fb804
--- /dev/null
+++ b/sys-cluster/pcs/files/pcs-0.11-gentoo-support.patch
@@ -0,0 +1,516 @@
+diff -uPNr pcs-0.11.2/configure.ac pcs-0.11.2-openrc/configure.ac
+--- pcs-0.11.2/configure.ac 2022-02-03 13:37:44.000000000 +0100
++++ pcs-0.11.2-openrc/configure.ac 2022-04-02 16:47:45.968552397 +0200
+@@ -89,17 +89,17 @@
+ ])
+
+ # check for systemd
+-PKG_CHECK_MODULES([systemd], [systemd])
+-PCS_PKG_CHECK_VAR([SYSTEMD_UNIT_DIR_TMP], [systemd], [systemdsystemunitdir], [/usr/lib/systemd/system])
+-if test "${prefix}" != "/usr"; then
+- SYSTEMD_UNIT_DIR="${prefix}/$SYSTEMD_UNIT_DIR_TMP"
+-else
+- SYSTEMD_UNIT_DIR="$SYSTEMD_UNIT_DIR_TMP"
+-fi
+-AC_SUBST([SYSTEMD_UNIT_DIR])
+-PCS_PKG_CHECK_VAR([SYSTEMD_UNIT_PATH], [systemd], [systemdsystemunitpath],
+- [/etc/systemd/system:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:/usr/lib/systemd/system:/usr/lib/systemd/system:/lib/systemd/system])
+-AC_SUBST([SYSTEMD_UNIT_PATH])
++#PKG_CHECK_MODULES([systemd], [systemd])
++#PCS_PKG_CHECK_VAR([SYSTEMD_UNIT_DIR_TMP], [systemd], [systemdsystemunitdir], [/usr/lib/systemd/system])
++#if test "${prefix}" != "/usr"; then
++# SYSTEMD_UNIT_DIR="${prefix}/$SYSTEMD_UNIT_DIR_TMP"
++#else
++# SYSTEMD_UNIT_DIR="$SYSTEMD_UNIT_DIR_TMP"
++#fi
++#AC_SUBST([SYSTEMD_UNIT_DIR])
++#PCS_PKG_CHECK_VAR([SYSTEMD_UNIT_PATH], [systemd], [systemdsystemunitpath],
++# [/etc/systemd/system:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:/usr/lib/systemd/system:/usr/lib/systemd/system:/lib/systemd/system])
++#AC_SUBST([SYSTEMD_UNIT_PATH])
+
+ # check for ruby
+ AC_PATH_PROG([RUBY], [ruby])
+@@ -217,6 +217,15 @@
+ DISTROEXT=fedora
+ break
+ ;;
++ gentoo)
++ FOUND_DISTRO=1
++ CONFIGDIR="$sysconfdir/default"
++ PCSLIBDIR="$prefix/share"
++ PCMKDAEMONDIR="$prefix/libexec/pacemaker"
++ COROSYNCLOGDIR="$localstatedir/log/corosync"
++ DISTROEXT=gentoo
++ break
++ ;;
+ esac
+ done
+
+@@ -396,9 +405,9 @@
+ fi
+ AC_PATH_PROG([SYSTEMCTL], [systemctl])
+ if test "x$SYSTEMCTL" = "x"; then
+- AC_PATH_PROG([SERVICE], [service])
++ AC_PATH_PROG([SERVICE], [rc-service])
+ if test "x$SERVICE" = "x"; then
+- AC_MSG_ERROR([Unable to find systemctl or service in $PATH])
++ AC_MSG_ERROR([Unable to find systemctl or rc-service in $PATH])
+ fi
+ fi
+
+diff -uPNr pcs-0.11.2/pcs/common/services/drivers/__init__.py pcs-0.11.2-openrc/pcs/common/services/drivers/__init__.py
+--- pcs-0.11.2/pcs/common/services/drivers/__init__.py 2022-02-03 13:37:44.000000000 +0100
++++ pcs-0.11.2-openrc/pcs/common/services/drivers/__init__.py 2022-04-01 20:20:31.536218481 +0200
+@@ -1,2 +1,3 @@
+ from .systemd import SystemdDriver
+ from .sysvinit_rhel import SysVInitRhelDriver
++from .openrc_gentoo import OpenRCGentooDriver
+diff -uPNr pcs-0.11.2/pcs/common/services/drivers/openrc_gentoo.py pcs-0.11.2-openrc/pcs/common/services/drivers/openrc_gentoo.py
+--- pcs-0.11.2/pcs/common/services/drivers/openrc_gentoo.py 1970-01-01 01:00:00.000000000 +0100
++++ pcs-0.11.2-openrc/pcs/common/services/drivers/openrc_gentoo.py 2022-04-01 19:52:57.765788816 +0200
+@@ -0,0 +1,87 @@
++import os.path
++from typing import (
++ List,
++ Optional,
++)
++
++from .. import errors
++from ..interfaces import (
++ ExecutorInterface,
++ ServiceManagerInterface,
++)
++
++
++class OpenRCGentooDriver(ServiceManagerInterface):
++ def __init__(
++ self, executor: ExecutorInterface, rc_service_bin: str, rc_config_bin: str
++ ):
++ """
++ executor -- external commands used by this class are executed using
++ this object
++ rc_service_bin -- path to an executable used for starting and stopping
++ services and to check if a service is running
++ rc_config_bin -- path to an executable used for enabling, disabling and
++ listing available service and to check if service is enabled
++ """
++ self._executor = executor
++ self._rc_config_bin = rc_config_bin
++ self._rc_service_bin = rc_service_bin
++ self._available_services: List[str] = []
++
++ def start(self, service: str, instance: Optional[str] = None) -> None:
++ result = self._executor.run([self._rc_service_bin, service, "start"])
++ if result.retval != 0:
++ raise errors.StartServiceError(service, result.joined_output)
++
++ def stop(self, service: str, instance: Optional[str] = None) -> None:
++ result = self._executor.run([self._rc_service_bin, service, "stop"])
++ if result.retval != 0:
++ raise errors.StopServiceError(service, result.joined_output)
++
++ def enable(self, service: str, instance: Optional[str] = None) -> None:
++ result = self._executor.run([self._rc_config_bin, "add", service, "default"])
++ if result.retval != 0:
++ raise errors.EnableServiceError(service, result.joined_output)
++
++ def disable(self, service: str, instance: Optional[str] = None) -> None:
++ if not self.is_installed(service):
++ return
++ result = self._executor.run([self._rc_config_bin, "delete", service, "default"])
++ if result.retval != 0:
++ raise errors.DisableServiceError(service, result.joined_output)
++
++ def is_enabled(self, service: str, instance: Optional[str] = None) -> bool:
++ if not self._available_services:
++ self._available_services = self._get_available_services()
++ return ( service in self._available_services )
++
++ def is_running(self, service: str, instance: Optional[str] = None) -> bool:
++ result = self._executor.run([self._rc_service_bin, service, "status"]).stdout
++ return( result == " * status: started" )
++
++ def is_installed(self, service: str) -> bool:
++ return service in self.get_available_services()
++
++ def get_available_services(self) -> List[str]:
++ if not self._available_services:
++ self._available_services = self._get_available_services()
++ return self._available_services
++
++ def _get_available_services(self) -> List[str]:
++ result = self._executor.run([self._rc_config_bin])
++ if result.retval != 0:
++ return []
++
++ service_list = []
++ # skip first string that say 'Init scripts to be started by runlevel default'
++ for service in result.stdout.splitlines()[1:]:
++ service = service.strip()
++ if service:
++ service_list.append(service)
++ return service_list
++
++ def is_current_system_supported(self) -> bool:
++ return all(
++ os.path.isfile(binary)
++ for binary in (self._rc_service_bin, self._rc_config_bin)
++ )
+diff -uPNr pcs-0.11.2/pcs/lib/services.py pcs-0.11.2-openrc/pcs/lib/services.py
+--- pcs-0.11.2/pcs/lib/services.py 2022-02-03 13:37:44.000000000 +0100
++++ pcs-0.11.2-openrc/pcs/lib/services.py 2022-04-01 20:02:05.023001421 +0200
+@@ -84,6 +84,9 @@
+ services.drivers.SysVInitRhelDriver(
+ executor, settings.service_binary, settings.chkconfig_binary
+ ),
++ service.drivers.OpenRCGentooDriver(
++ executor, settings.rc_config_binary, settings.rc_service_binary
++ ),
+ ]
+
+ for driver in drivers:
+diff -uPNr pcs-0.11.2/pcs/Makefile.am pcs-0.11.2-openrc/pcs/Makefile.am
+--- pcs-0.11.2/pcs/Makefile.am 2022-02-03 13:37:44.000000000 +0100
++++ pcs-0.11.2-openrc/pcs/Makefile.am 2022-04-01 20:22:42.198605061 +0200
+@@ -131,6 +131,7 @@
+ common/services/drivers/__init__.py \
+ common/services/drivers/systemd.py \
+ common/services/drivers/sysvinit_rhel.py \
++ common/services/drivers/openrc_gentoo.py \
+ common/services_dto.py \
+ common/services/errors.py \
+ common/services/__init__.py \
+diff -uPNr pcs-0.11.2/pcs/settings.py.in pcs-0.11.2-openrc/pcs/settings.py.in
+--- pcs-0.11.2/pcs/settings.py.in 2022-02-03 13:37:44.000000000 +0100
++++ pcs-0.11.2-openrc/pcs/settings.py.in 2022-04-03 14:09:08.438232140 +0200
+@@ -4,6 +4,8 @@
+ systemd_unit_path = "@SYSTEMD_UNIT_PATH@".split(":")
+ chkconfig_binary = "/sbin/chkconfig"
+ service_binary = "@SERVICE@"
++rc_config_binary = "/usr/bin/rc-config"
++rc_service_binary = "/sbin/rc-service"
+ # Used only in utils.py in deprecated funcion
+ pacemaker_binaries = "@PCMKEXECPREFIX@/sbin"
+ corosync_binaries = "@COROEXECPREFIX@/sbin"
+@@ -52,8 +54,8 @@
+ cibadmin = "@PCMKEXECPREFIX@/sbin/cibadmin"
+ crm_mon_schema = "@PCMK_SCHEMA_DIR@/crm_mon.rng"
+ pacemaker_api_result_schema = "@PCMK_SCHEMA_DIR@/api/api-result.rng"
+-pcsd_var_location = "@LOCALSTATEDIR@/lib/pcsd"
+-pcsd_ruby_socket = "@LOCALSTATEDIR@/run/pcsd-ruby.socket"
++pcsd_var_location = "/var/lib/pcsd"
++pcsd_ruby_socket = "/var/run/pcsd.socket"
+ pcsd_cert_location = os.path.join(pcsd_var_location, "pcsd.crt")
+ pcsd_key_location = os.path.join(pcsd_var_location, "pcsd.key")
+ pcsd_known_hosts_location = os.path.join(pcsd_var_location, "known-hosts")
+@@ -63,7 +65,7 @@
+ )
+ pcsd_dr_config_location = os.path.join(pcsd_var_location, "disaster-recovery")
+ pcsd_exec_location = "@LIB_DIR@/pcsd"
+-pcsd_log_location = "@LOCALSTATEDIR@/log/pcsd/pcsd.log"
++pcsd_log_location = "/var/log/pcsd/pcsd.log"
+ pcsd_default_port = 2224
+ pcsd_config = "@CONF_DIR@/pcsd"
+ cib_dir = "@PCMK_CIB_DIR@"
+diff -uPNr pcs-0.11.2/pcsd/logrotate/pcsd.in pcs-0.11.2-openrc/pcsd/logrotate/pcsd.in
+--- pcs-0.11.2/pcsd/logrotate/pcsd.in 2022-02-03 13:37:44.000000000 +0100
++++ pcs-0.11.2-openrc/pcsd/logrotate/pcsd.in 2022-04-02 18:35:15.265764389 +0200
+@@ -1,4 +1,4 @@
+-@localstatedir@/log/pcsd/*.log {
++/var/log/pcsd/*.log {
+ rotate 5
+ weekly
+ missingok
+diff -uPNr pcs-0.11.2/pcsd/Makefile.am pcs-0.11.2-openrc/pcsd/Makefile.am
+--- pcs-0.11.2/pcsd/Makefile.am 2022-02-03 13:37:44.000000000 +0100
++++ pcs-0.11.2-openrc/pcsd/Makefile.am 2022-04-02 18:34:42.609049415 +0200
+@@ -80,8 +80,8 @@
+ cp -rp ../${PCSD_BUNDLED_DIR_ROOT_LOCAL}/* $(DESTDIR)${GEM_HOME}
+ rm -rf $(DESTDIR)${GEM_HOME}/cache
+ endif
+- $(MKDIR_P) -m 0700 $(DESTDIR)$(localstatedir)/log/pcsd
+- $(MKDIR_P) -m 0700 $(DESTDIR)$(localstatedir)/lib/pcsd
++ $(MKDIR_P) -m 0700 $(DESTDIR)/var/log/pcsd
++ $(MKDIR_P) -m 0700 $(DESTDIR)/var/lib/pcsd
+
+ uninstall-local:
+ rm -rf $(DESTDIR)/$(sysconfdir)/pam.d/pcsd
+@@ -89,5 +89,5 @@
+ if INSTALL_EMBEDDED_GEMS
+ rm -rf $(DESTDIR)/${GEM_HOME}
+ endif
+- rmdir $(DESTDIR)/$(localstatedir)/log/pcsd 2>/dev/null || :
+- rmdir $(DESTDIR)/$(localstatedir)/lib/pcsd 2>/dev/null || :
++ rmdir $(DESTDIR)/var/log/pcsd 2>/dev/null || :
++ rmdir $(DESTDIR)/var/lib/pcsd 2>/dev/null || :
+diff -uPNr pcs-0.11.2/pcsd/pam/pcsd.gentoo pcs-0.11.2-openrc/pcsd/pam/pcsd.gentoo
+--- pcs-0.11.2/pcsd/pam/pcsd.gentoo 1970-01-01 01:00:00.000000000 +0100
++++ pcs-0.11.2-openrc/pcsd/pam/pcsd.gentoo 2022-04-02 12:58:06.249036062 +0200
+@@ -0,0 +1,5 @@
++#%PAM-1.0
++auth include system-auth
++account include system-auth
++password include system-auth
++session include system-auth
+diff -uPNr pcs-0.11.2/pcsd/settings.rb.in pcs-0.11.2-openrc/pcsd/settings.rb.in
+--- pcs-0.11.2/pcsd/settings.rb.in 2022-02-03 13:37:44.000000000 +0100
++++ pcs-0.11.2-openrc/pcsd/settings.rb.in 2022-04-03 14:08:03.767014211 +0200
+@@ -2,9 +2,9 @@
+ PCS_EXEC = '@SBINDIR@/pcs'
+ PCS_INTERNAL_EXEC = '@LIB_DIR@/pcs/pcs_internal'
+ PCSD_EXEC_LOCATION = '@LIB_DIR@/pcsd'
+-PCSD_VAR_LOCATION = '@LOCALSTATEDIR@/lib/pcsd'
++PCSD_VAR_LOCATION = '/var/lib/pcsd'
+ PCSD_DEFAULT_PORT = 2224
+-PCSD_RUBY_SOCKET = '@LOCALSTATEDIR@/run/pcsd-ruby.socket'
++PCSD_RUBY_SOCKET = '/var/run/pcsd.socket'
+
+ CRT_FILE = File.join(PCSD_VAR_LOCATION, 'pcsd.crt')
+ KEY_FILE = File.join(PCSD_VAR_LOCATION, 'pcsd.key')
+diff -uPNr pcs-0.11.2/pcs_test/Makefile.am pcs-0.11.2-openrc/pcs_test/Makefile.am
+--- pcs-0.11.2/pcs_test/Makefile.am 2022-02-03 13:37:44.000000000 +0100
++++ pcs-0.11.2-openrc/pcs_test/Makefile.am 2022-04-01 20:23:35.837945885 +0200
+@@ -101,6 +101,7 @@
+ tier0/common/services/drivers/__init__.py \
+ tier0/common/services/drivers/test_systemd.py \
+ tier0/common/services/drivers/test_sysvinit_rhel.py \
++ tier0/common/services/drivers/test_openrc_gentoo.py \
+ tier0/common/services/__init__.py \
+ tier0/common/test_file.py \
+ tier0/common/test_host.py \
+diff -uPNr pcs-0.11.2/pcs_test/tier0/common/services/drivers/test_openrc_gentoo.py pcs-0.11.2-openrc/pcs_test/tier0/common/services/drivers/test_openrc_gentoo.py
+--- pcs-0.11.2/pcs_test/tier0/common/services/drivers/test_openrc_gentoo.py 1970-01-01 01:00:00.000000000 +0100
++++ pcs-0.11.2-openrc/pcs_test/tier0/common/services/drivers/test_openrc_gentoo.py 2022-04-01 20:29:57.272257820 +0200
+@@ -0,0 +1,232 @@
++from unittest import mock, TestCase
++
++
++from pcs.common.services import errors
++from pcs.common.services.drivers import OpenRCGentooDriver
++from pcs.common.services.interfaces import ExecutorInterface
++from pcs.common.services.types import ExecutorResult
++
++
++class Base(TestCase):
++ def setUp(self):
++ self.mock_executor = mock.MagicMock(spec_set=ExecutorInterface)
++ self.service = "service_name"
++ self.instance = "instance_name"
++ self.rc_service_bin = "rc_service_bin"
++ self.rc_config_bin = "rc_config_bin"
++ self.driver = OpenRCGentooDriver(
++ self.mock_executor, self.rc_service_bin, self.rc_config_bin
++ )
++
++
++class BaseTestMixin:
++ subcmd = None
++ exception = None
++ executable = None
++ driver_callback = staticmethod(lambda: None)
++
++ def test_success(self):
++ self.mock_executor.run.return_value = ExecutorResult(0, "", "")
++ self.driver_callback(self.service)
++ self.mock_executor.run.assert_called_once_with(
++ [self.executable, self.service, self.subcmd]
++ )
++
++ def test_instance_success(self):
++ self.mock_executor.run.return_value = ExecutorResult(0, "", "")
++ self.driver_callback(self.service, self.instance)
++ self.mock_executor.run.assert_called_once_with(
++ [self.executable, self.service, self.subcmd]
++ )
++
++ def test_failure(self):
++ result = ExecutorResult(1, "stdout", "stderr")
++ self.mock_executor.run.return_value = result
++ with self.assertRaises(self.exception) as cm:
++ self.driver_callback(self.service)
++
++ self.assertEqual(cm.exception.service, self.service)
++ self.assertEqual(cm.exception.message, result.joined_output)
++ self.assertIsNone(cm.exception.instance)
++ self.mock_executor.run.assert_called_once_with(
++ [self.executable, self.service, self.subcmd]
++ )
++
++ def test_instace_failure(self):
++ result = ExecutorResult(1, "stdout", "stderr")
++ self.mock_executor.run.return_value = result
++ with self.assertRaises(self.exception) as cm:
++ self.driver_callback(self.service, self.instance)
++
++ self.assertEqual(cm.exception.service, self.service)
++ self.assertEqual(cm.exception.message, result.joined_output)
++ self.assertIsNone(cm.exception.instance)
++ self.mock_executor.run.assert_called_once_with(
++ [self.executable, self.service, self.subcmd]
++ )
++
++
++class StartTest(Base, BaseTestMixin):
++ subcmd = "start"
++ exception = errors.StartServiceError
++
++ def setUp(self):
++ super().setUp()
++ self.driver_callback = self.driver.start
++ self.executable = self.rc_service_bin
++
++
++class StopTest(Base, BaseTestMixin):
++ subcmd = "stop"
++ exception = errors.StopServiceError
++
++ def setUp(self):
++ super().setUp()
++ self.driver_callback = self.driver.stop
++ self.executable = self.service_bin
++
++
++class EnableTest(Base, BaseTestMixin):
++ subcmd = "on"
++ exception = errors.EnableServiceError
++
++ def setUp(self):
++ super().setUp()
++ self.driver_callback = self.driver.enable
++ self.executable = self.rc_config_bin
++
++
++class DisableTest(Base, BaseTestMixin):
++ subcmd = "off"
++ exception = errors.DisableServiceError
++
++ def setUp(self):
++ super().setUp()
++ # pylint: disable=protected-access
++ self.driver._available_services = [self.service]
++ self.driver_callback = self.driver.disable
++ self.executable = self.rc_config_bin
++
++ def test_not_intalled(self):
++ # pylint: disable=protected-access
++ self.driver._available_services = [f"not_{self.service}"]
++ self.driver_callback(self.service)
++ self.mock_executor.run.assert_not_called()
++
++
++class IsEnabledTest(Base):
++ def test_enabled(self):
++ self.mock_executor.run.return_value = ExecutorResult(0, "", "")
++ self.assertTrue(self.driver.is_enabled(self.service))
++ self.mock_executor.run.assert_called_once_with(
++ [self.rc_config_bin, self.service]
++ )
++
++ def test_instance_enabled(self):
++ self.mock_executor.run.return_value = ExecutorResult(0, "", "")
++ self.assertTrue(self.driver.is_enabled(self.service, self.instance))
++ self.mock_executor.run.assert_called_once_with(
++ [self.rc_config_bin, self.service]
++ )
++
++ def test_disabled(self):
++ self.mock_executor.run.return_value = ExecutorResult(3, "", "")
++ self.assertFalse(self.driver.is_enabled(self.service))
++ self.mock_executor.run.assert_called_once_with(
++ [self.rc_config_bin, self.service]
++ )
++
++ def test_failure(self):
++ self.mock_executor.run.return_value = ExecutorResult(1, "", "")
++ self.assertFalse(self.driver.is_enabled(self.service))
++ self.mock_executor.run.assert_called_once_with(
++ [self.rc_config_bin, self.service]
++ )
++
++
++class IsRunningTest(Base):
++ def test_running(self):
++ self.mock_executor.run.return_value = ExecutorResult(
++ 0, " * status: started", ""
++ )
++ self.assertTrue(self.driver.is_running(self.service))
++ self.mock_executor.run.assert_called_once_with(
++ [self.rc_service_bin, self.service, "status"]
++ )
++
++ def test_instance_running(self):
++ self.mock_executor.run.return_value = ExecutorResult(
++ 0, " * status: started", ""
++ )
++ self.assertTrue(self.driver.is_running(self.service, self.instance))
++ self.mock_executor.run.assert_called_once_with(
++ [self.rc_service_bin, self.service, "status"]
++ )
++
++ def test_not_running(self):
++ self.mock_executor.run.return_value = ExecutorResult(
++ 0, " * status: stopped", ""
++ )
++ self.assertFalse(self.driver.is_running(self.service))
++ self.mock_executor.run.assert_called_once_with(
++ [self.rc_service_bin, self.service, "status"]
++ )
++
++ def test_failure(self):
++ self.mock_executor.run.return_value = ExecutorResult(1, "", "error")
++ self.assertFalse(self.driver.is_running(self.service))
++ self.mock_executor.run.assert_called_once_with(
++ [self.rc_service_bin, self.service, "status"]
++ )
++
++
++class IsInstalledTest(Base):
++ def test_installed(self):
++ output = (
++ "Init scripts to be started by runlevel default\n"
++ " service1\n"
++ " abc\n"
++ " xyz\n"
++ f" {self.service}\n"
++ )
++ self.mock_executor.run.return_value = ExecutorResult(0, output, "")
++ self.assertTrue(self.driver.is_installed(self.service))
++ # Intentionally called twice to make sure that unit files listing is
++ # done only once
++ self.assertTrue(self.driver.is_installed(self.service))
++ self.mock_executor.run.assert_called_once_with([self.rc_config_bin])
++
++ def test_not_installed(self):
++ output = (
++ "Init scripts to be started by runlevel default\n"
++ " service1\n"
++ " abc\n"
++ " xyz\n"
++ )
++ self.mock_executor.run.return_value = ExecutorResult(0, output, "")
++ self.assertFalse(self.driver.is_installed(self.service))
++ # Intentionally called twice to make sure that unit files listing is
++ # done only once
++ self.assertFalse(self.driver.is_installed(self.service))
++ self.mock_executor.run.assert_called_once_with([self.rc_config_bin])
++
++
++class GetAvailableServicesTest(Base):
++ def test_success(self):
++ output = (
++ "Init scripts to be started by runlevel default\n"
++ " service1\n"
++ " abc\n"
++ " xyz\n"
++ )
++ self.mock_executor.run.return_value = ExecutorResult(0, output, "")
++ self.assertEqual(
++ self.driver.get_available_services(),
++ ["service1", "abc", "xyz"],
++ )
++ self.mock_executor.run.assert_called_once_with([self.rc_config_bin])
++
++ def test_failure(self):
++ self.mock_executor.run.return_value = ExecutorResult(1, "", "error")
++ self.assertEqual(self.driver.get_available_services(), [])
++ self.mock_executor.run.assert_called_once_with([self.rc_config_bin])
diff --git a/sys-cluster/pcs/files/pcs-0.11.initd b/sys-cluster/pcs/files/pcs-0.11.initd
new file mode 100644
index 000000000..62ed7cccd
--- /dev/null
+++ b/sys-cluster/pcs/files/pcs-0.11.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="pcs"
+description="Pacemaker & Corosync configuration daemon"
+command=/usr/sbin/pcs
+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/pcsd-0.11.initd b/sys-cluster/pcs/files/pcsd-0.11.initd
new file mode 100644
index 000000000..da144d8e0
--- /dev/null
+++ b/sys-cluster/pcs/files/pcsd-0.11.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"
+description="PCS GUI and remote configuration interface (Ruby)"
+command=/usr/sbin/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/pcs-0.11.2.ebuild b/sys-cluster/pcs/pcs-0.11.2.ebuild
new file mode 100644
index 000000000..7cdce0605
--- /dev/null
+++ b/sys-cluster/pcs/pcs-0.11.2.ebuild
@@ -0,0 +1,110 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_SETUPTOOLS=rdepend
+PYTHON_COMPAT=( python3_{9..10} )
+USE_RUBY="ruby27 ruby30 ruby31"
+
+inherit autotools systemd python-single-r1 ruby-ng
+
+DESCRIPTION="Pacemaker/Corosync Configuration System"
+HOMEPAGE="https://github.com/ClusterLabs/pcs"
+SRC_URI="https://github.com/ClusterLabs/pcs/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/all/${P}"
+
+LICENSE="GPL-2"
+KEYWORDS="~amd64"
+IUSE="systemd"
+SLOT=0
+
+DEPEND="
+ dev-libs/libffi
+ sys-apps/coreutils
+"
+RDEPEND="
+ ${DEPEND}
+ ${PYTHON_DEPS}
+ $(python_gen_cond_dep '
+ dev-python/dacite[${PYTHON_USEDEP}]
+ dev-python/lxml[${PYTHON_USEDEP}]
+ dev-python/pycurl[${PYTHON_USEDEP}]
+ dev-python/pyparsing[${PYTHON_USEDEP}]
+ dev-python/python-dateutil[${PYTHON_USEDEP}]
+ >=www-servers/tornado-6.0[${PYTHON_USEDEP}]
+ <www-servers/tornado-7.0[${PYTHON_USEDEP}]
+ dev-python/pyagentx[${PYTHON_USEDEP}]
+ dev-python/cryptography[${PYTHON_USEDEP}]
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ dev-python/setuptools_scm[${PYTHON_USEDEP}]
+ dev-python/pip[${PYTHON_USEDEP}]
+ dev-python/python-dateutil[${PYTHON_USEDEP}]
+ ')
+ >=sys-cluster/corosync-3.0
+ >=sys-cluster/pacemaker-2.1.0
+ sys-libs/pam
+ sys-process/psmisc
+"
+
+ruby_add_rdepend "
+ dev-ruby/bundler
+ dev-ruby/rubygems
+ dev-ruby/backports
+ dev-ruby/power_assert
+ dev-ruby/daemons
+ dev-ruby/ethon
+ dev-ruby/eventmachine
+ dev-ruby/mustermann
+ dev-ruby/open4
+ dev-ruby/rack
+ dev-ruby/rack-protection
+ dev-ruby/rack-test
+ dev-ruby/sinatra
+ www-servers/thin"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+PATCHES="${FILESDIR}/pcs-0.11-gentoo-support.patch"
+
+src_prepare() {
+ default
+ eautoreconf
+}
+
+src_configure() {
+ econf
+}
+
+src_compile() {
+ return
+}
+
+src_install() {
+ python-single-r1_pkg_setup
+
+ local makeopts=(
+ DESTDIR="${D}"
+ )
+
+ emake install "${makeopts[@]}"
+
+ # mark log directories to be kept
+ keepdir /var/log/pcsd
+ keepdir /var/lib/pcsd
+
+ #fix statedir
+ sed -i ${D}/usr/share/pcsd/pcsd -e 's/\/var\/lib\/lib\//\/var\/lib\//g'
+
+ # custom service file for openRC
+ if ! use systemd ; then
+ newinitd "${FILESDIR}/pcs-0.11.initd" pcs
+ newinitd "${FILESDIR}/pcsd-0.11.initd" pcsd
+ fi
+
+ if use systemd ; then
+ systemd_newunit "${S}/pcsd/pcsd.service.in" "pcs.service"
+ systemd_newunit "${S}/pcsd/pcsd-ruby.service.in" "pcsd.service"
+ fi
+
+ python_optimize
+}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sys-cluster/pcs/files/, sys-cluster/pcs/
@ 2022-04-24 16:01 Alessandro Barbieri
0 siblings, 0 replies; 3+ messages in thread
From: Alessandro Barbieri @ 2022-04-24 16:01 UTC (permalink / raw
To: gentoo-commits
commit: 7236c8a1ef5340e1d2401bf566ee061271b739d0
Author: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
AuthorDate: Sun Apr 24 15:10:16 2022 +0000
Commit: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
CommitDate: Sun Apr 24 16:01:14 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=7236c8a1
sys-cluster/pcs: various fixes
Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>
.../pcs/files/pcs-0.11-gentoo-support.patch | 60 +++++++++-------------
sys-cluster/pcs/files/remove_bashism.patch | 6 ---
sys-cluster/pcs/pcs-0.11.2.ebuild | 33 ++++++------
3 files changed, 40 insertions(+), 59 deletions(-)
diff --git a/sys-cluster/pcs/files/pcs-0.11-gentoo-support.patch b/sys-cluster/pcs/files/pcs-0.11-gentoo-support.patch
index d2e6fb804..142eca091 100644
--- a/sys-cluster/pcs/files/pcs-0.11-gentoo-support.patch
+++ b/sys-cluster/pcs/files/pcs-0.11-gentoo-support.patch
@@ -1,6 +1,5 @@
-diff -uPNr pcs-0.11.2/configure.ac pcs-0.11.2-openrc/configure.ac
---- pcs-0.11.2/configure.ac 2022-02-03 13:37:44.000000000 +0100
-+++ pcs-0.11.2-openrc/configure.ac 2022-04-02 16:47:45.968552397 +0200
+--- a/configure.ac
++++ b/configure.ac
@@ -89,17 +89,17 @@
])
@@ -58,16 +57,14 @@ diff -uPNr pcs-0.11.2/configure.ac pcs-0.11.2-openrc/configure.ac
fi
fi
-diff -uPNr pcs-0.11.2/pcs/common/services/drivers/__init__.py pcs-0.11.2-openrc/pcs/common/services/drivers/__init__.py
---- pcs-0.11.2/pcs/common/services/drivers/__init__.py 2022-02-03 13:37:44.000000000 +0100
-+++ pcs-0.11.2-openrc/pcs/common/services/drivers/__init__.py 2022-04-01 20:20:31.536218481 +0200
+--- a/pcs/common/services/drivers/__init__.py
++++ b/pcs/common/services/drivers/__init__.py
@@ -1,2 +1,3 @@
from .systemd import SystemdDriver
from .sysvinit_rhel import SysVInitRhelDriver
+from .openrc_gentoo import OpenRCGentooDriver
-diff -uPNr pcs-0.11.2/pcs/common/services/drivers/openrc_gentoo.py pcs-0.11.2-openrc/pcs/common/services/drivers/openrc_gentoo.py
---- pcs-0.11.2/pcs/common/services/drivers/openrc_gentoo.py 1970-01-01 01:00:00.000000000 +0100
-+++ pcs-0.11.2-openrc/pcs/common/services/drivers/openrc_gentoo.py 2022-04-01 19:52:57.765788816 +0200
+--- a/pcs/common/services/drivers/openrc_gentoo.py
++++ b/pcs/common/services/drivers/openrc_gentoo.py
@@ -0,0 +1,87 @@
+import os.path
+from typing import (
@@ -156,9 +153,8 @@ diff -uPNr pcs-0.11.2/pcs/common/services/drivers/openrc_gentoo.py pcs-0.11.2-op
+ os.path.isfile(binary)
+ for binary in (self._rc_service_bin, self._rc_config_bin)
+ )
-diff -uPNr pcs-0.11.2/pcs/lib/services.py pcs-0.11.2-openrc/pcs/lib/services.py
---- pcs-0.11.2/pcs/lib/services.py 2022-02-03 13:37:44.000000000 +0100
-+++ pcs-0.11.2-openrc/pcs/lib/services.py 2022-04-01 20:02:05.023001421 +0200
+--- a/pcs/lib/services.py
++++ b/pcs/lib/services.py
@@ -84,6 +84,9 @@
services.drivers.SysVInitRhelDriver(
executor, settings.service_binary, settings.chkconfig_binary
@@ -169,9 +165,8 @@ diff -uPNr pcs-0.11.2/pcs/lib/services.py pcs-0.11.2-openrc/pcs/lib/services.py
]
for driver in drivers:
-diff -uPNr pcs-0.11.2/pcs/Makefile.am pcs-0.11.2-openrc/pcs/Makefile.am
---- pcs-0.11.2/pcs/Makefile.am 2022-02-03 13:37:44.000000000 +0100
-+++ pcs-0.11.2-openrc/pcs/Makefile.am 2022-04-01 20:22:42.198605061 +0200
+--- a/pcs/Makefile.am
++++ b/pcs/Makefile.am
@@ -131,6 +131,7 @@
common/services/drivers/__init__.py \
common/services/drivers/systemd.py \
@@ -180,9 +175,8 @@ diff -uPNr pcs-0.11.2/pcs/Makefile.am pcs-0.11.2-openrc/pcs/Makefile.am
common/services_dto.py \
common/services/errors.py \
common/services/__init__.py \
-diff -uPNr pcs-0.11.2/pcs/settings.py.in pcs-0.11.2-openrc/pcs/settings.py.in
---- pcs-0.11.2/pcs/settings.py.in 2022-02-03 13:37:44.000000000 +0100
-+++ pcs-0.11.2-openrc/pcs/settings.py.in 2022-04-03 14:09:08.438232140 +0200
+--- a/pcs/settings.py.in
++++ b/pcs/settings.py.in
@@ -4,6 +4,8 @@
systemd_unit_path = "@SYSTEMD_UNIT_PATH@".split(":")
chkconfig_binary = "/sbin/chkconfig"
@@ -212,18 +206,16 @@ diff -uPNr pcs-0.11.2/pcs/settings.py.in pcs-0.11.2-openrc/pcs/settings.py.in
pcsd_default_port = 2224
pcsd_config = "@CONF_DIR@/pcsd"
cib_dir = "@PCMK_CIB_DIR@"
-diff -uPNr pcs-0.11.2/pcsd/logrotate/pcsd.in pcs-0.11.2-openrc/pcsd/logrotate/pcsd.in
---- pcs-0.11.2/pcsd/logrotate/pcsd.in 2022-02-03 13:37:44.000000000 +0100
-+++ pcs-0.11.2-openrc/pcsd/logrotate/pcsd.in 2022-04-02 18:35:15.265764389 +0200
+--- a/pcsd/logrotate/pcsd.in
++++ b/pcsd/logrotate/pcsd.in
@@ -1,4 +1,4 @@
-@localstatedir@/log/pcsd/*.log {
+/var/log/pcsd/*.log {
rotate 5
weekly
missingok
-diff -uPNr pcs-0.11.2/pcsd/Makefile.am pcs-0.11.2-openrc/pcsd/Makefile.am
---- pcs-0.11.2/pcsd/Makefile.am 2022-02-03 13:37:44.000000000 +0100
-+++ pcs-0.11.2-openrc/pcsd/Makefile.am 2022-04-02 18:34:42.609049415 +0200
+--- a/pcsd/Makefile.am
++++ b/pcsd/Makefile.am
@@ -80,8 +80,8 @@
cp -rp ../${PCSD_BUNDLED_DIR_ROOT_LOCAL}/* $(DESTDIR)${GEM_HOME}
rm -rf $(DESTDIR)${GEM_HOME}/cache
@@ -243,18 +235,16 @@ diff -uPNr pcs-0.11.2/pcsd/Makefile.am pcs-0.11.2-openrc/pcsd/Makefile.am
- rmdir $(DESTDIR)/$(localstatedir)/lib/pcsd 2>/dev/null || :
+ rmdir $(DESTDIR)/var/log/pcsd 2>/dev/null || :
+ rmdir $(DESTDIR)/var/lib/pcsd 2>/dev/null || :
-diff -uPNr pcs-0.11.2/pcsd/pam/pcsd.gentoo pcs-0.11.2-openrc/pcsd/pam/pcsd.gentoo
---- pcs-0.11.2/pcsd/pam/pcsd.gentoo 1970-01-01 01:00:00.000000000 +0100
-+++ pcs-0.11.2-openrc/pcsd/pam/pcsd.gentoo 2022-04-02 12:58:06.249036062 +0200
+--- a/pcsd/pam/pcsd.gentoo
++++ b/pcsd/pam/pcsd.gentoo
@@ -0,0 +1,5 @@
+#%PAM-1.0
+auth include system-auth
+account include system-auth
+password include system-auth
+session include system-auth
-diff -uPNr pcs-0.11.2/pcsd/settings.rb.in pcs-0.11.2-openrc/pcsd/settings.rb.in
---- pcs-0.11.2/pcsd/settings.rb.in 2022-02-03 13:37:44.000000000 +0100
-+++ pcs-0.11.2-openrc/pcsd/settings.rb.in 2022-04-03 14:08:03.767014211 +0200
+--- a/pcsd/settings.rb.in
++++ b/pcsd/settings.rb.in
@@ -2,9 +2,9 @@
PCS_EXEC = '@SBINDIR@/pcs'
PCS_INTERNAL_EXEC = '@LIB_DIR@/pcs/pcs_internal'
@@ -267,9 +257,8 @@ diff -uPNr pcs-0.11.2/pcsd/settings.rb.in pcs-0.11.2-openrc/pcsd/settings.rb.in
CRT_FILE = File.join(PCSD_VAR_LOCATION, 'pcsd.crt')
KEY_FILE = File.join(PCSD_VAR_LOCATION, 'pcsd.key')
-diff -uPNr pcs-0.11.2/pcs_test/Makefile.am pcs-0.11.2-openrc/pcs_test/Makefile.am
---- pcs-0.11.2/pcs_test/Makefile.am 2022-02-03 13:37:44.000000000 +0100
-+++ pcs-0.11.2-openrc/pcs_test/Makefile.am 2022-04-01 20:23:35.837945885 +0200
+--- a/pcs_test/Makefile.am
++++ b/pcs_test/Makefile.am
@@ -101,6 +101,7 @@
tier0/common/services/drivers/__init__.py \
tier0/common/services/drivers/test_systemd.py \
@@ -278,9 +267,8 @@ diff -uPNr pcs-0.11.2/pcs_test/Makefile.am pcs-0.11.2-openrc/pcs_test/Makefile.a
tier0/common/services/__init__.py \
tier0/common/test_file.py \
tier0/common/test_host.py \
-diff -uPNr pcs-0.11.2/pcs_test/tier0/common/services/drivers/test_openrc_gentoo.py pcs-0.11.2-openrc/pcs_test/tier0/common/services/drivers/test_openrc_gentoo.py
---- pcs-0.11.2/pcs_test/tier0/common/services/drivers/test_openrc_gentoo.py 1970-01-01 01:00:00.000000000 +0100
-+++ pcs-0.11.2-openrc/pcs_test/tier0/common/services/drivers/test_openrc_gentoo.py 2022-04-01 20:29:57.272257820 +0200
+--- a/pcs_test/tier0/common/services/drivers/test_openrc_gentoo.py
++++ b/pcs_test/tier0/common/services/drivers/test_openrc_gentoo.py
@@ -0,0 +1,232 @@
+from unittest import mock, TestCase
+
diff --git a/sys-cluster/pcs/files/remove_bashism.patch b/sys-cluster/pcs/files/remove_bashism.patch
index a54d612f0..cfed6026c 100644
--- a/sys-cluster/pcs/files/remove_bashism.patch
+++ b/sys-cluster/pcs/files/remove_bashism.patch
@@ -4,12 +4,6 @@ Date: Thu, 7 Apr 2022 17:02:55 +0200
Subject: [PATCH] remove bashisms
`==` is not POSIX
----
- m4/ac_compare_versions.m4 | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/m4/ac_compare_versions.m4 b/m4/ac_compare_versions.m4
-index 77d03330a..74846704e 100644
--- a/m4/ac_compare_versions.m4
+++ b/m4/ac_compare_versions.m4
@@ -6,7 +6,7 @@ dnl op can be:
diff --git a/sys-cluster/pcs/pcs-0.11.2.ebuild b/sys-cluster/pcs/pcs-0.11.2.ebuild
index aeeddbed6..fdf6faf20 100644
--- a/sys-cluster/pcs/pcs-0.11.2.ebuild
+++ b/sys-cluster/pcs/pcs-0.11.2.ebuild
@@ -16,12 +16,11 @@ S="${WORKDIR}/all/${P}"
LICENSE="GPL-2"
KEYWORDS="~amd64"
-IUSE="systemd"
SLOT=0
DEPEND="
- dev-libs/libffi
- sys-apps/coreutils
+ dev-libs/libffi
+ sys-apps/coreutils
"
RDEPEND="
${DEPEND}
@@ -56,19 +55,23 @@ ruby_add_rdepend "
dev-ruby/daemons
dev-ruby/ethon
dev-ruby/eventmachine
+ dev-ruby/json
dev-ruby/mustermann
dev-ruby/open4
dev-ruby/rack
dev-ruby/rack-protection
dev-ruby/rack-test
dev-ruby/sinatra
- www-servers/thin
+ dev-ruby/test-unit
dev-ruby/webrick
- dev-ruby/json"
+ www-servers/thin
+"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-PATCHES="${FILESDIR}/pcs-0.11-gentoo-support.patch
- ${FILESDIR}/remove_bashism.patch"
+PATCHES="
+ ${FILESDIR}/pcs-0.11-gentoo-support.patch
+ ${FILESDIR}/remove_bashism.patch
+"
src_prepare() {
default
@@ -97,18 +100,14 @@ src_install() {
keepdir /var/lib/pcsd
#fix statedir
- sed -i "${D}/usr/share/pcsd/pcsd" -e 's/\/var\/lib\/lib\//\/var\/lib\//g'
+ sed -i "${D}/usr/share/pcsd/pcsd" -e 's/\/var\/lib\/lib\//\/var\/lib\//g' || die
# custom service file for openRC
- if ! use systemd ; then
- newinitd "${FILESDIR}/pcs-0.11.initd" pcs
- newinitd "${FILESDIR}/pcsd-0.11.initd" pcsd
- fi
-
- if use systemd ; then
- systemd_newunit "${S}/pcsd/pcsd.service.in" "pcs.service"
- systemd_newunit "${S}/pcsd/pcsd-ruby.service.in" "pcsd.service"
- fi
+ newinitd "${FILESDIR}/pcs-0.11.initd" pcs
+ newinitd "${FILESDIR}/pcsd-0.11.initd" pcsd
+
+ systemd_newunit "${S}/pcsd/pcsd.service.in" "pcs.service"
+ systemd_newunit "${S}/pcsd/pcsd-ruby.service.in" "pcsd.service"
python_optimize
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-24 16:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-03 14:05 [gentoo-commits] repo/proj/guru:dev commit in: sys-cluster/pcs/files/, sys-cluster/pcs/ Andrea Postiglione
-- strict thread matches above, loose matches on Subject: below --
2022-04-24 16:01 Alessandro Barbieri
2020-12-05 21:09 Andrea Postiglione
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox