1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 PYTHON_REQ_USE="sqlite"
6 PYTHON_COMPAT=( python2_7 python3_6 )
8 EGIT_REPO_URI="https://github.com/buildbot/${PN}.git"
10 [[ ${PV} == *9999 ]] && inherit git-r3
11 inherit readme.gentoo-r1 user systemd distutils-r1
13 MY_PV="${PV/_p/.post}"
16 DESCRIPTION="BuildBot build automation system"
17 HOMEPAGE="https://buildbot.net/ https://github.com/buildbot/buildbot https://pypi.org/project/buildbot/"
18 [[ ${PV} == *9999 ]] || SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${MY_P}.tar.gz"
22 if [[ ${PV} == *9999 ]]; then
28 IUSE="crypt docker examples irc test"
29 RESTRICT="!test? ( test )"
32 >=dev-python/jinja-2.1[${PYTHON_USEDEP}]
33 >=dev-python/twisted-17.9.0[${PYTHON_USEDEP}]
34 >=dev-python/autobahn-0.16.0[${PYTHON_USEDEP}]
35 >=dev-python/sqlalchemy-0.8[${PYTHON_USEDEP}]
36 >=dev-python/sqlalchemy-migrate-0.9[${PYTHON_USEDEP}]
37 dev-python/future[${PYTHON_USEDEP}]
38 >=dev-python/python-dateutil-1.5[${PYTHON_USEDEP}]
39 >=dev-python/txaio-2.2.2[${PYTHON_USEDEP}]
40 dev-python/pyjwt[${PYTHON_USEDEP}]
41 >=dev-python/zope-interface-4.1.1[${PYTHON_USEDEP}]
42 ~dev-util/buildbot-worker-${PV}[${PYTHON_USEDEP}]
44 >=dev-python/twisted-17.9.0[${PYTHON_USEDEP},crypt]
45 >=dev-python/pyopenssl-16.0.0[${PYTHON_USEDEP}]
46 dev-python/idna[${PYTHON_USEDEP}]
47 dev-python/service_identity[${PYTHON_USEDEP}]
50 dev-python/txrequests[${PYTHON_USEDEP}]
53 >=dev-python/docker-py-2.2.0[${PYTHON_USEDEP}]
57 >=dev-python/setuptools-21.2.1[${PYTHON_USEDEP}]
59 >=dev-python/python-dateutil-1.5[${PYTHON_USEDEP}]
60 >=dev-python/mock-2.0.0[${PYTHON_USEDEP}]
61 dev-python/moto[${PYTHON_USEDEP}]
62 dev-python/boto3[${PYTHON_USEDEP}]
63 dev-python/pyjade[${PYTHON_USEDEP}]
64 dev-python/txgithub[${PYTHON_USEDEP}]
65 dev-python/txrequests[${PYTHON_USEDEP}]
66 dev-python/lz4[${PYTHON_USEDEP}]
67 dev-python/treq[${PYTHON_USEDEP}]
68 dev-python/setuptools_trial[${PYTHON_USEDEP}]
69 ~dev-util/buildbot-worker-${PV}[${PYTHON_USEDEP}]
70 >=dev-python/docker-py-2.2.0[${PYTHON_USEDEP}]
74 [[ ${PV} == *9999 ]] && S=${S}/master
76 if [[ ${PV} != *9999 ]]; then
78 "${FILESDIR}/Remove-distro-version-test.patch"
85 DOC_CONTENTS="The \"buildbot\" user and the \"buildmaster\" init script has been added
86 to support starting buildbot through Gentoo's init system. To use this,
87 execute \"emerge --config =${CATEGORY}/${PF}\" to create a new instance.
88 The scripts can run as a different user if desired."
92 distutils-r1_src_install
97 insinto /usr/share/doc/${PF}
98 doins -r docs/examples
101 newconfd "${FILESDIR}/buildmaster.confd" buildmaster
102 newinitd "${FILESDIR}/buildmaster.initd" buildmaster
103 systemd_dounit "${FILESDIR}/buildmaster.target"
104 systemd_newunit "${FILESDIR}/buildmaster_at.service" "buildmaster@.service"
105 systemd_install_serviced "${FILESDIR}/buildmaster_at.service.conf" "buildmaster@.service"
107 readme.gentoo_create_doc
111 distutils_install_for_testing
113 esetup.py test || die "Tests failed under ${EPYTHON}"
117 readme.gentoo_print_elog
119 if [[ -n ${REPLACING_VERSIONS} ]]; then
121 ewarn "Starting with buildbot-0.8.12-r2, more than one instance of buildmaster"
122 ewarn "can be run simultaneously. Note that \"BASEDIR\" in the buildbot configuration file"
123 ewarn "is now the common base directory for all instances. If you are migrating from an older"
124 ewarn "version, make sure that you copy the current contents of \"BASEDIR\" to a subdirectory."
125 ewarn "The name of the subdirectory corresponds to the name of the buildmaster instance."
126 ewarn "In order to start the service running OpenRC-based systems need to link to the init file:"
127 ewarn " ln --symbolic --relative /etc/init.d/buildmaster /etc/init.d/buildmaster.myinstance"
128 ewarn " rc-update add buildmaster.myinstance default"
129 ewarn " /etc/init.d/buildmaster.myinstance start"
130 ewarn "Systems using systemd can do the following:"
131 ewarn " systemctl enable buildmaster@myinstance.service"
132 ewarn " systemctl enable buildmaster.target"
133 ewarn " systemctl start buildmaster.target"
135 elog "Upstream recommends the following when upgrading:"
136 elog "Each time you install a new version of Buildbot, you should run the"
137 elog "\"buildbot upgrade-master\" command on each of your pre-existing build masters."
138 elog "This will add files and fix (or at least detect) incompatibilities between"
139 elog "your old config and the new code."
142 elog "In order to create a new instance of buildmaster, execute:"
143 elog " emerge --config =${CATEGORY}/${PF}"
147 local buildmaster_path="/var/lib/buildmaster"
148 local log_path="/var/log/buildmaster"
150 einfo "This will prepare a new buildmaster instance in ${buildmaster_path}."
151 einfo "Press Control-C to abort."
153 einfo "Enter the name for the new instance: "
155 [[ -z "${instance_name}" ]] && die "Invalid instance name"
157 local instance_path="${buildmaster_path}/${instance_name}"
158 local instance_log_path="${log_path}/${instance_name}"
160 if [[ -e "${instance_path}" ]]; then
161 eerror "The instance with the specified name already exists:"
162 eerror "${instance_path}"
163 die "Instance already exists"
166 local buildbot="/usr/bin/buildbot"
167 if [[ ! -d "${buildmaster_path}" ]]; then
168 mkdir --parents "${buildmaster_path}" || die "Unable to create directory ${buildmaster_path}"
170 "${buildbot}" create-master "${instance_path}" &>/dev/null || die "Creating instance failed"
171 chown --recursive buildbot "${instance_path}" || die "Setting permissions for instance failed"
172 mv "${instance_path}/master.cfg.sample" "${instance_path}/master.cfg" \
173 || die "Moving sample configuration failed"
174 ln --symbolic --relative "/etc/init.d/buildmaster" "/etc/init.d/buildmaster.${instance_name}" \
175 || die "Unable to create link to init file"
177 if [[ ! -d "${instance_log_path}" ]]; then
178 mkdir --parents "${instance_log_path}" || die "Unable to create directory ${instance_log_path}"
180 ln --symbolic --relative "${instance_log_path}/twistd.log" "${instance_path}/twistd.log" \
181 || die "Unable to create link to log file"
183 einfo "Successfully created a buildmaster instance at ${instance_path}."
184 einfo "To change the default settings edit the master.cfg file in this directory."