summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2017-08-21 22:29:31 +0000
committerBrian Dolbec <dolsen@gentoo.org>2017-08-21 22:34:00 +0000
commit9cddfbc9d6e5a26811229b84daead5c5d04b21ab (patch)
treef54ad7654b6d5e7ce25afe12084e2d0860f1ca48 /dev-util/buildbot-worker/files
parentmedia-libs/opencv: Fix header wrapping w/[vtk], #627730 (diff)
downloadgentoo-9cddfbc9d6e5a26811229b84daead5c5d04b21ab.tar.gz
gentoo-9cddfbc9d6e5a26811229b84daead5c5d04b21ab.tar.bz2
gentoo-9cddfbc9d6e5a26811229b84daead5c5d04b21ab.zip
dev-util/buildbot-worker: Make the init script multi-instance capable
Use the same method as the buildbot master init script for multiple instances on the same host. Add RUNTIME_PYTHON variable (optional) to the conf.d to specify the desired python to run it from. Package-Manager: Portage-2.3.6_p65, Repoman-2.3.2_p133
Diffstat (limited to 'dev-util/buildbot-worker/files')
-rw-r--r--dev-util/buildbot-worker/files/buildbot_worker.confd214
-rw-r--r--dev-util/buildbot-worker/files/buildbot_worker.initd2
-rw-r--r--dev-util/buildbot-worker/files/buildbot_worker.initd257
3 files changed, 72 insertions, 1 deletions
diff --git a/dev-util/buildbot-worker/files/buildbot_worker.confd2 b/dev-util/buildbot-worker/files/buildbot_worker.confd2
new file mode 100644
index 000000000000..3ae1d865fdb1
--- /dev/null
+++ b/dev-util/buildbot-worker/files/buildbot_worker.confd2
@@ -0,0 +1,14 @@
+# Path to the build slave's basedir.
+BASEDIR="/var/lib/buildbot_worker"
+
+# User account for the buildslave.
+# The basedir should be owned by this user.
+USERNAME="buildbot"
+
+# Extra options passed to twistd.
+TWISTD_OPTS=""
+
+# Optional specifiv python version to run in
+# (if not the system default version)
+# ie: RUNTIME_PYTHON="/usr/bin/python2.7"
+RUNTIME_PYTHON=""
diff --git a/dev-util/buildbot-worker/files/buildbot_worker.initd b/dev-util/buildbot-worker/files/buildbot_worker.initd
index 5301ed546baf..8b13460491e4 100644
--- a/dev-util/buildbot-worker/files/buildbot_worker.initd
+++ b/dev-util/buildbot-worker/files/buildbot_worker.initd
@@ -1,5 +1,5 @@
#!/sbin/openrc-run
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
diff --git a/dev-util/buildbot-worker/files/buildbot_worker.initd2 b/dev-util/buildbot-worker/files/buildbot_worker.initd2
new file mode 100644
index 000000000000..453d207e5d88
--- /dev/null
+++ b/dev-util/buildbot-worker/files/buildbot_worker.initd2
@@ -0,0 +1,57 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+BUILDWORKER_NAME=${RC_SVCNAME:16}
+BUILDWORKER_PATH="${BASEDIR}/${BUILDWORKER_NAME}"
+depend() {
+ need net
+}
+
+checkconfig() {
+ if [ -z "${BUILDWORKER_NAME}" ]; then
+ eerror "Buildbot-worker name not defined. Please link buildbot_worker.foo to this file to start the buildbot_worker with the name \"foo\"."
+ return 1
+ fi
+ if [ -z "${BASEDIR}" ]; then
+ eerror "BASEDIR not set"
+ return 1
+ fi
+ if [ -z "${USERNAME}" ]; then
+ eerror "USERNAME not set"
+ return 1
+ fi
+ if [ ! -d "${BUILDWORKER_PATH}" ]; then
+ eerror "${BUILDWORKER_PATH} is not a directory"
+ return 1
+ fi
+ if [ ! -e "${BUILDWORKER_PATH}/buildbot.tac" ]; then
+ eerror "${BUILDWORKER_PATH} does not contain buildbot.tac"
+ return 1
+ fi
+ if [ ! -e "${RUNTIME_PYTHON}" ]; then
+ RUNTIME_PYTHON="/usr/bin/python"
+ fi
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting buildbot-worker in ${BUILDWORKER_PATH}"
+ # We set HOME here to make something valid show up in the env of child
+ # processes spawned by the buildbot-worker.
+ start-stop-daemon --start -u "${USERNAME}" \
+ --pidfile "${BUILDWORKER_PATH}/buildbot_worker.pid" \
+ --env HOME="${BUILDWORKER_PATH}" \
+ --exec "${RUNTIME_PYTHON}" -- /usr/bin/twistd \
+ --no_save \
+ --logfile="${BUILDWORKER_PATH}/twistd.log" \
+ --pidfile="${BUILDWORKER_PATH}/buildbot_worker.pid" \
+ --python="${BUILDWORKER_PATH}/buildbot.tac"
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping buildbot-worker in ${BUILDWORKER_PATH}"
+ start-stop-daemon --stop --pidfile "${BUILDWORKER_PATH}/buildbot_worker.pid"
+ eend $?
+}