sys-process/glances: 3.1.4.1-r1 amd64 stable, bug #720368
[gentoo.git] / dev-util / buildbot / buildbot-2.7.0.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="7"
5 PYTHON_REQ_USE="sqlite"
6 PYTHON_COMPAT=( python3_{6,7,8} )
7
8 EGIT_REPO_URI="https://github.com/buildbot/${PN}.git"
9
10 DISTUTILS_USE_SETUPTOOLS="rdepend"
11
12 [[ ${PV} == *9999 ]] && inherit git-r3
13 inherit readme.gentoo-r1 systemd distutils-r1
14
15 MY_PV="${PV/_p/.post}"
16 MY_P="${PN}-${MY_PV}"
17
18 DESCRIPTION="BuildBot build automation system"
19 HOMEPAGE="https://buildbot.net/ https://github.com/buildbot/buildbot https://pypi.org/project/buildbot/"
20 [[ ${PV} == *9999 ]] || SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${MY_P}.tar.gz"
21
22 LICENSE="GPL-2"
23 SLOT="0"
24 if [[ ${PV} == *9999 ]]; then
25         KEYWORDS=""
26 else
27         KEYWORDS="~amd64 ~amd64-linux ~x86-linux"
28 fi
29
30 IUSE="crypt docker examples irc test"
31 RESTRICT="!test? ( test )"
32
33 RDEPEND="
34         acct-user/buildbot
35         >=dev-python/jinja-2.1[${PYTHON_USEDEP}]
36         >=dev-python/twisted-17.9.0[${PYTHON_USEDEP}]
37         >=dev-python/autobahn-0.16.0[${PYTHON_USEDEP}]
38         >=dev-python/sqlalchemy-0.8[${PYTHON_USEDEP}]
39         >=dev-python/sqlalchemy-migrate-0.9[${PYTHON_USEDEP}]
40         dev-python/future[${PYTHON_USEDEP}]
41         >=dev-python/python-dateutil-1.5[${PYTHON_USEDEP}]
42         >=dev-python/txaio-2.2.2[${PYTHON_USEDEP}]
43         dev-python/pyjwt[${PYTHON_USEDEP}]
44         dev-python/pyyaml[${PYTHON_USEDEP}]
45         >=dev-python/zope-interface-4.1.1[${PYTHON_USEDEP}]
46         ~dev-util/buildbot-worker-${PV}[${PYTHON_USEDEP}]
47         crypt? (
48                 >=dev-python/twisted-17.9.0[${PYTHON_USEDEP},crypt]
49                 >=dev-python/pyopenssl-16.0.0[${PYTHON_USEDEP}]
50                 <dev-python/idna-2.9[${PYTHON_USEDEP}]
51                 dev-python/service_identity[${PYTHON_USEDEP}]
52         )
53         irc? (
54                 dev-python/txrequests[${PYTHON_USEDEP}]
55         )
56         docker? (
57                 >=dev-python/docker-py-2.2.0[${PYTHON_USEDEP}]
58                 dev-python/requests[${PYTHON_USEDEP}]
59         )
60 "
61 DEPEND="${RDEPEND}
62         test? (
63                 >=dev-python/mock-2.0.0[${PYTHON_USEDEP}]
64                 dev-python/moto[${PYTHON_USEDEP}]
65                 >=dev-python/boto3-1.12.48[${PYTHON_USEDEP}]
66                 dev-python/parameterized[${PYTHON_USEDEP}]
67                 dev-python/pypugjs[${PYTHON_USEDEP}]
68                 dev-python/txrequests[${PYTHON_USEDEP}]
69                 dev-python/lz4[${PYTHON_USEDEP}]
70                 dev-python/treq[${PYTHON_USEDEP}]
71                 dev-python/setuptools_trial[${PYTHON_USEDEP}]
72                 ~dev-util/buildbot-pkg-${PV}[${PYTHON_USEDEP}]
73                 ~dev-util/buildbot-worker-${PV}[${PYTHON_USEDEP}]
74                 ~dev-util/buildbot-www-${PV}[${PYTHON_USEDEP}]
75                 crypt? (
76                         >=dev-python/twisted-17.9.0[${PYTHON_USEDEP},crypt]
77                         >=dev-python/pyopenssl-16.0.0[${PYTHON_USEDEP}]
78                         <dev-python/idna-2.9[${PYTHON_USEDEP}]
79                         dev-python/service_identity[${PYTHON_USEDEP}]
80                 )
81         )"
82
83 S=${WORKDIR}/${MY_P}
84 [[ ${PV} == *9999 ]] && S=${S}/master
85
86 if [[ ${PV} != *9999 ]]; then
87         PATCHES=(
88                 "${FILESDIR}/Add-gentoo-to-the-VERSION_ID-check-exclusion.patch"
89                 "${FILESDIR}/pypugjs.patch"
90         )
91 fi
92
93 distutils_enable_tests setup.py
94
95 pkg_setup() {
96         DOC_CONTENTS="The \"buildbot\" user and the \"buildmaster\" init script has been added
97                 to support starting buildbot through Gentoo's init system. To use this,
98                 execute \"emerge --config =${CATEGORY}/${PF}\" to create a new instance.
99                 The scripts can run as a different user if desired."
100 }
101
102 src_install() {
103         distutils-r1_src_install
104
105         doman docs/buildbot.1
106
107         if use examples; then
108                 insinto /usr/share/doc/${PF}
109                 doins -r docs/examples
110         fi
111
112         newconfd "${FILESDIR}/buildmaster.confd" buildmaster
113         newinitd "${FILESDIR}/buildmaster.initd" buildmaster
114         systemd_dounit "${FILESDIR}/buildmaster.target"
115         systemd_newunit "${FILESDIR}/buildmaster_at.service" "buildmaster@.service"
116         systemd_install_serviced "${FILESDIR}/buildmaster_at.service.conf" "buildmaster@.service"
117
118         readme.gentoo_create_doc
119 }
120
121 pkg_postinst() {
122         readme.gentoo_print_elog
123
124         if [[ -n ${REPLACING_VERSIONS} ]]; then
125                 ewarn
126                 ewarn "Starting with buildbot-0.8.12-r2, more than one instance of buildmaster"
127                 ewarn "can be run simultaneously. Note that \"BASEDIR\" in the buildbot configuration file"
128                 ewarn "is now the common base directory for all instances. If you are migrating from an older"
129                 ewarn "version, make sure that you copy the current contents of \"BASEDIR\" to a subdirectory."
130                 ewarn "The name of the subdirectory corresponds to the name of the buildmaster instance."
131                 ewarn "In order to start the service running OpenRC-based systems need to link to the init file:"
132                 ewarn "    ln --symbolic --relative /etc/init.d/buildmaster /etc/init.d/buildmaster.myinstance"
133                 ewarn "    rc-update add buildmaster.myinstance default"
134                 ewarn "    /etc/init.d/buildmaster.myinstance start"
135                 ewarn "Systems using systemd can do the following:"
136                 ewarn "    systemctl enable buildmaster@myinstance.service"
137                 ewarn "    systemctl enable buildmaster.target"
138                 ewarn "    systemctl start buildmaster.target"
139                 elog
140                 elog "Upstream recommends the following when upgrading:"
141                 elog "Each time you install a new version of Buildbot, you should run the"
142                 elog "\"buildbot upgrade-master\" command on each of your pre-existing build masters."
143                 elog "This will add files and fix (or at least detect) incompatibilities between"
144                 elog "your old config and the new code."
145         fi
146         elog
147         elog "In order to create a new instance of buildmaster, execute:"
148         elog "    emerge --config =${CATEGORY}/${PF}"
149 }
150
151 pkg_config() {
152         local buildmaster_path="/var/lib/buildmaster"
153         local log_path="/var/log/buildmaster"
154
155         einfo "This will prepare a new buildmaster instance in ${buildmaster_path}."
156         einfo "Press Control-C to abort."
157
158         einfo "Enter the name for the new instance: "
159         read instance_name
160         [[ -z "${instance_name}" ]] && die "Invalid instance name"
161
162         local instance_path="${buildmaster_path}/${instance_name}"
163         local instance_log_path="${log_path}/${instance_name}"
164
165         if [[ -e "${instance_path}" ]]; then
166                 eerror "The instance with the specified name already exists:"
167                 eerror "${instance_path}"
168                 die "Instance already exists"
169         fi
170
171         local buildbot="/usr/bin/buildbot"
172         if [[ ! -d "${buildmaster_path}" ]]; then
173                 mkdir --parents "${buildmaster_path}" || die "Unable to create directory ${buildmaster_path}"
174         fi
175         "${buildbot}" create-master "${instance_path}" &>/dev/null || die "Creating instance failed"
176         chown --recursive buildbot:buildbot "${instance_path}" || die "Setting permissions for instance failed"
177         mv "${instance_path}/master.cfg.sample" "${instance_path}/master.cfg" \
178                 || die "Moving sample configuration failed"
179         ln --symbolic --relative "/etc/init.d/buildmaster" "/etc/init.d/buildmaster.${instance_name}" \
180                 || die "Unable to create link to init file"
181
182         if [[ ! -d "${instance_log_path}" ]]; then
183                 mkdir --parents "${instance_log_path}" || die "Unable to create directory ${instance_log_path}"
184                 chown --recursive buildbot:buildbot "${instance_log_path}" \
185                         || die "Setting permissions for instance failed"
186         fi
187         ln --symbolic --relative "${instance_log_path}/twistd.log" "${instance_path}/twistd.log" \
188                 || die "Unable to create link to log file"
189
190         einfo "Successfully created a buildmaster instance at ${instance_path}."
191         einfo "To change the default settings edit the master.cfg file in this directory."
192 }