Skip to content

Commit

Permalink
dev-util/buildbot-worker: Version bump, fix pkg_config()
Browse files Browse the repository at this point in the history
Include a sample buildbot.tac file.
Remove older 0.9.10 ebuild versions.

Package-Manager: Portage-2.3.6, Repoman-2.3.3
  • Loading branch information
dol-sen committed Sep 15, 2017
1 parent 448797e commit 29ea36e
Show file tree
Hide file tree
Showing 6 changed files with 202 additions and 80 deletions.
1 change: 1 addition & 0 deletions dev-util/buildbot-worker/Manifest
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
DIST buildbot-worker-0.9.10.tar.gz 99028 SHA256 1793631d74629cd73bc0df1fadf28fb34d87e63aa72cba82058122bde165a824 SHA512 0f515610d9c788657b10ba6624745841241fe554b472e53abdda221a678eb73d7a21a6529eb0769450de3a79b43bb6e51f4208247a4d8ef25c3d36b6ced6ec89 WHIRLPOOL 67cb199328428167c7e52f7b6ecbe7aa73729b5b453b5a8c16ba4999502bf30d9b139788f755eb4811968a60ce61fde32cdc29a31242d3777302792bb04863a6
DIST buildbot-worker-0.9.11.tar.gz 100746 SHA256 4254bf964465acb6586fda36b26a424466a265b6a5259138cf4fa63a1e9f6851 SHA512 c7209c3fff8c43a23de71fa61709c9f02a5bdd9c8c8980ac5d205f720abdaa9bdb78d0d4e40fe9f915c8d5cf253b9e3c63401712ee121ac085909b0244d82897 WHIRLPOOL 30e1fb17eda975ff3a1e333a0ae17bdc2b432bd9c139a0c1f8dbea69984311add3a6f0659b7add0a3fecc2acf9460a908709efa8994f5763bfbbd2618df67050
DIST buildbot-worker-0.9.4.tar.gz 100889 SHA256 129e0d3fa9ee34f0f227487b6d1645820d2d4853099a1b0aed56587d3acab965 SHA512 7d055b7b005ebf1cc8033fb86f5321a9d80e0505c1a8b28b9ba3945323f157d34f34066ee9513e82b05c63af099d6030bf42d6f44533859b4e01983f1114462b WHIRLPOOL 8f2b95a476e93beaba5305137bb1d219a9aff59e8bb4450d6352babe799bb0166c299e7c8ea69e53c467e7e58be2681ddba4ae74ad8ba945221e1059906e5fc1
DIST buildbot-worker-0.9.7.tar.gz 96416 SHA256 a41b4e0c7329821a0d85ee0e6edbde3db403676c62e59a6f436a048a008ac268 SHA512 84ccaf0472553f8422b342163e44e55481f6691338df38db6b1be74f0a79c13e2a52be56df632491662ab79648cd5034ce04d906bbedb01030e4fa96f1689ef9 WHIRLPOOL 70379e6f34ea30aef0e0008fd098a53ba144696f1416ac77c3756018bc371646d2261a28589ad5131f7be7de930189bd771b4a82de27343441543da5c683e122
DIST buildbot-worker-0.9.8.tar.gz 97193 SHA256 825e022a794c7470276169b6ac1b774f39f60d16545bb46fdf5b4a3b2c78f44f SHA512 43cb7d83835d009c3d4f9a9671d3bd1037d50969b6238f9c77e9f1caedea83c9b9f77d642743d47ff2eea8f3c6549b9e4c843b7d9f638dc5a28339e034ea9b47 WHIRLPOOL 1127b956c3a94ad426c686e42dcbdf6a6f4427751c4ddf247569bc0ee03e86d1ae609263386e730d92b2a572be76208cb999c571fdee9f85de49de161a5c1ab1
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ python_install_all() {
newconfd "${FILESDIR}/buildbot_worker.confd2" buildbot_worker
newinitd "${FILESDIR}/buildbot_worker.initd2" buildbot_worker

dodir /var/lib/buildbot_worker
cp "${FILESDIR}/buildbot.tac.sample" "${D}/var/lib/buildbot_worker"|| die "Install failed!"

readme.gentoo_create_doc
}

Expand Down Expand Up @@ -106,13 +109,11 @@ pkg_config() {
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" \
cp "${buildworker_path}/buildbot.tac.sample" "${instance_path}/buildbot.tac" \
|| 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"
Expand Down
74 changes: 0 additions & 74 deletions dev-util/buildbot-worker/buildbot-worker-0.9.10.ebuild

This file was deleted.

123 changes: 123 additions & 0 deletions dev-util/buildbot-worker/buildbot-worker-0.9.11.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI="5"
PYTHON_COMPAT=( python2_7 python3_5 )

EGIT_REPO_URI="https://github.com/buildbot/buildbot.git"

[[ ${PV} == *9999 ]] && inherit git-r3
inherit readme.gentoo user distutils-r1

DESCRIPTION="BuildBot Worker (slave) Daemon"
HOMEPAGE="https://buildbot.net/ https://github.com/buildbot/buildbot https://pypi.python.org/pypi/buildbot-worker"

MY_V="${PV/_p/p}"
MY_P="${PN}-${MY_V}"
[[ ${PV} == *9999 ]] || SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${MY_P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
if [[ ${PV} == *9999 ]]; then
KEYWORDS=""
else
KEYWORDS="~amd64"
fi
IUSE="test"

RDEPEND=">=dev-python/setuptools-21.2.1[${PYTHON_USEDEP}]
>=dev-python/twisted-17.5.0[${PYTHON_USEDEP}]
dev-python/future[${PYTHON_USEDEP}]
!<dev-util/buildbot-0.9.7
"
DEPEND="${RDEPEND}
test? (
dev-python/mock[${PYTHON_USEDEP}]
dev-python/setuptools_trial[${PYTHON_USEDEP}]
)
"

S="${WORKDIR}/${MY_P}"
[[ ${PV} == *9999 ]] && S=${S}/slave

pkg_setup() {
enewuser buildbot

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,
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.myinstance\" at the right location.
The scripts can run as a different user if desired."
}

python_test() {
distutils_install_for_testing

esetup.py test || die "Tests failed under ${EPYTHON}"
}

python_install_all() {
distutils-r1_python_install_all

doman docs/buildbot-worker.1

newconfd "${FILESDIR}/buildbot_worker.confd2" buildbot_worker
newinitd "${FILESDIR}/buildbot_worker.initd2" buildbot_worker

dodir /var/lib/buildbot_worker
cp "${FILESDIR}/buildbot.tac.sample" "${D}/var/lib/buildbot_worker"|| die "Install failed!"

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 [email protected]"
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

if [[ ! -d "${buildworker_path}" ]]; then
mkdir --parents "${buildworker_path}" || die "Unable to create directory ${buildworker_path}"
fi
chown --recursive buildbot "${instance_path}" || die "Setting permissions for instance failed"
cp "${buildworker_path}/buildbot.tac.sample" "${instance_path}/buildbot.tac" \
|| 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."
}
7 changes: 4 additions & 3 deletions dev-util/buildbot-worker/buildbot-worker-9999.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ python_install_all() {
newconfd "${FILESDIR}/buildbot_worker.confd2" buildbot_worker
newinitd "${FILESDIR}/buildbot_worker.initd2" buildbot_worker

dodir /var/lib/buildbot_worker
cp "${FILESDIR}/buildbot.tac.sample" "${D}/var/lib/buildbot_worker"|| die "Install failed!"

readme.gentoo_create_doc
}

Expand Down Expand Up @@ -106,13 +109,11 @@ pkg_config() {
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" \
cp "${buildworker_path}/buildbot.tac.sample" "${instance_path}/buildbot.tac" \
|| 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"
Expand Down
70 changes: 70 additions & 0 deletions dev-util/buildbot-worker/files/buildbot.tac.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
'''
This is a sample buildbot.tac file to initalize
a buildbot worker complete with logging.
'''

import os.path
import socket

from twisted.application import service
from twisted.python.logfile import LogFile
from twisted.python.log import ILogObserver, FileLogObserver

from buildbot_worker.bot import Worker

################################
# Set the following variables
# to your desired values
#################################

# use the current directory or
# set to an absolute value
basedir = '.'

# logging
rotateLength = 10000000
maxRotatedFiles = 10

# buildbot communication port
port = 9989

# worker settings
worker_name = 'worker-1'
passwd = 'mypasswd'
buildmaster_host = 'mybuildbot.foobar.org'
keepalive = 600
umask = None
maxdelay = 300
numcpus = None
allow_shutdown = None


# Begin starting up the worker
# if this is a relocatable tac file, get the directory containing the TAC
if basedir == '.':
basedir = os.path.abspath(os.path.dirname(__file__))

# note: this line is matched against to check that this is
# a buildbot-worker directory; do not edit it.
application = service.Application('buildbot-worker')

# set up logging
logfile = LogFile.fromFullPath(os.path.join(basedir, "twistd.log"),
rotateLength=rotateLength,
maxRotatedFiles=maxRotatedFiles
)
application.setComponent(ILogObserver, FileLogObserver(logfile).emit)

worker = Worker(buildmaster_host,
port,
worker_name,
passwd,
basedir,
keepalive,
umask=umask,
maxdelay=maxdelay,
numcpus=numcpus,
allow_shutdown=allow_shutdown
)

worker.setServiceParent(application)

0 comments on commit 29ea36e

Please sign in to comment.