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/buildbot-worker-9999.ebuild
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/buildbot-worker-9999.ebuild')
-rw-r--r--dev-util/buildbot-worker/buildbot-worker-9999.ebuild60
1 files changed, 54 insertions, 6 deletions
diff --git a/dev-util/buildbot-worker/buildbot-worker-9999.ebuild b/dev-util/buildbot-worker/buildbot-worker-9999.ebuild
index e756aeaa6cc3..6c1b8bf74aaf 100644
--- a/dev-util/buildbot-worker/buildbot-worker-9999.ebuild
+++ b/dev-util/buildbot-worker/buildbot-worker-9999.ebuild
@@ -45,11 +45,11 @@ pkg_setup() {
DOC_CONTENTS="The \"buildbot\" user and the \"buildbot_worker\" init script has been added
to support starting buildbot_worker through Gentoo's init system. To use this,
- set up your build worker following the documentation, make sure the
+ execute \"emerge --config =${CATEGORY}/${PF}\" to create a new instance.
+ Set up your build worker following the documentation, make sure the
resulting directories are owned by the \"buildbot\" user and point
- \"${ROOT}etc/conf.d/buildbot_worker\" at the right location. The scripts can
- run as a different user if desired. If you need to run more than one
- build worker, just copy the scripts."
+ \"${ROOT}etc/conf.d/buildbot_worker.myinstance\" at the right location.
+ The scripts can run as a different user if desired."
}
python_test() {
@@ -63,12 +63,60 @@ python_install_all() {
doman docs/buildbot-worker.1
- newconfd "${FILESDIR}/buildbot_worker.confd" buildbot_worker
- newinitd "${FILESDIR}/buildbot_worker.initd" buildbot_worker
+ newconfd "${FILESDIR}/buildbot_worker.confd2" buildbot_worker
+ newinitd "${FILESDIR}/buildbot_worker.initd2" buildbot_worker
readme.gentoo_create_doc
}
pkg_postinst() {
readme.gentoo_print_elog
+
+ if [[ -n ${REPLACING_VERSIONS} ]]; then
+ ewarn
+ ewarn "Starting with buildbot-worker-0.9.10-r1, more than one instance of a buildbot_worker"
+ ewarn "can be run simultaneously. Note that \"BASEDIR\" in the buildbot_worker configuration file"
+ ewarn "is now the common base directory for all instances. If you are migrating from an older"
+ ewarn "version, make sure that you copy the current contents of \"BASEDIR\" to a subdirectory."
+ ewarn "The name of the subdirectory corresponds to the name of the buildbot_worker instance."
+ ewarn "In order to start the service running OpenRC-based systems need to link to the init file:"
+ ewarn " ln --symbolic --relative /etc/init.d/buildbot_worker /etc/init.d/buildbot_worker.myinstance"
+ ewarn " rc-update add buildbot_worker.myinstance default"
+ ewarn " /etc/init.d/buildbot_worker.myinstance start"
+ ewarn "Systems using systemd can do the following:"
+ ewarn " systemctl enable buildbot_worker@myinstance.service"
+ ewarn " systemctl enable buildbot_worker.target"
+ ewarn " systemctl start buildbot_worker.target"
+ fi
+}
+
+pkg_config() {
+ local buildworker_path="/var/lib/buildbot_worker"
+ einfo "This will prepare a new buildbot_worker instance in ${buildworker_path}."
+ einfo "Press Control-C to abort."
+
+ einfo "Enter the name for the new instance: "
+ read instance_name
+ [[ -z "${instance_name}" ]] && die "Invalid instance name"
+
+ local instance_path="${buildworker_path}/${instance_name}"
+ if [[ -e "${instance_path}" ]]; then
+ eerror "The instance with the specified name already exists:"
+ eerror "${instance_path}"
+ die "Instance already exists"
+ fi
+
+ local buildbot="/usr/bin/buildbot"
+ if [[ ! -d "${buildworker_path}" ]]; then
+ mkdir --parents "${buildworker_path}" || die "Unable to create directory ${buildworker_path}"
+ fi
+ "${buildbot}" create-master "${instance_path}" &>/dev/null || die "Creating instance failed"
+ chown --recursive buildbot "${instance_path}" || die "Setting permissions for instance failed"
+ mv "${instance_path}/master.cfg.sample" "${instance_path}/master.cfg" \
+ || die "Moving sample configuration failed"
+ ln --symbolic --relative "/etc/init.d/buildbot_worker" "/etc/init.d/buildbot_worker.${instance_name}" \
+ || die "Unable to create link to init file"
+
+ einfo "Successfully created a buildbot_worker instance at ${instance_path}."
+ einfo "To change the default settings edit the buildbot.tac file in this directory."
}