dev-python/kiwisolver: arm64 keyworded (bug #721130)
[gentoo.git] / app-emulation / ganeti / ganeti-2.15.2-r10.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_COMPAT=(python2_7)
6 PYTHON_REQ_USE="ipv6(+)?"
7
8 inherit user autotools bash-completion-r1 python-single-r1
9
10 MY_PV="${PV/_rc/~rc}"
11 MY_PV="${MY_PV/_beta/~beta}"
12 MY_P="${PN}-${MY_PV}"
13 SERIES="$(ver_cut 1-2)"
14
15 DEBIAN_PATCH=11
16 SRC_URI="
17         http://downloads.ganeti.org/releases/${SERIES}/${MY_P}.tar.gz
18         mirror://debian/pool/main/g/ganeti-${SERIES}/ganeti-${SERIES}_${PV}-${DEBIAN_PATCH}.debian.tar.xz
19 "
20 KEYWORDS="~amd64 ~x86"
21 PATCHES=(
22         "${FILESDIR}"/ganeti-2.15-use-balloon-device.patch
23         "${WORKDIR}"/debian/patches/do-not-backup-export-dir.patch
24         "${WORKDIR}"/debian/patches/Makefile.am-use-C.UTF-8
25         "${WORKDIR}"/debian/patches/relax-deps
26         "${WORKDIR}"/debian/patches/zlib-0.6-compatibility
27         "${WORKDIR}"/debian/patches/fix_FTBFS_with_sphinx-1.3.5
28         "${WORKDIR}"/debian/patches/fix_ftbfs_with_sphinx_1.4
29         "${WORKDIR}"/debian/patches/use-proper-cabal-dev.patch
30         "${WORKDIR}"/debian/patches/0001-Drop-dependency-on-MonadCatchIO-transformers.patch
31         "${WORKDIR}"/debian/patches/0001-GHC-8-support.patch
32         "${WORKDIR}"/debian/patches/ghc8-fixes
33         "${WORKDIR}"/debian/patches/snap-server-1.0-compat
34         "${WORKDIR}"/debian/patches/non-DSA-SSH-key-support.patch
35         "${WORKDIR}"/debian/patches/fix-ssh-key-renewal-on-single-node-clusters.patch
36         "${WORKDIR}"/debian/patches/set-defaults-for-ssh-type-bits.patch
37         "${WORKDIR}"/debian/patches/use-hv-class-to-check-for-migration.patch
38         "${WORKDIR}"/debian/patches/do-not-specify-socat-ssl-method.patch
39         "${WORKDIR}"/debian/patches/fix-ftbfs-with-sphinx-1.5.patch
40         "${WORKDIR}"/debian/patches/fix-failover-from-dead-node.patch
41         "${WORKDIR}"/debian/patches/fix-cpu-affinity.patch
42         "${WORKDIR}"/debian/patches/fix-fcntl-i386.patch
43         "${WORKDIR}"/debian/patches/fix-ovf-test-path.patch
44         "${WORKDIR}"/debian/patches/fix-qa-ssconf-race.patch
45         "${WORKDIR}"/debian/patches/relax-sphinx-version-check.patch
46         #"${WORKDIR}"/debian/patches/THH-2.12.patch
47         "${WORKDIR}"/debian/patches/sphinx-1.7.patch
48         "${WORKDIR}"/debian/patches/ca-use-sha256-md.patch
49         "${WORKDIR}"/debian/patches/impexpd-fix-certificate-verification-with-new-socat.patch
50         "${WORKDIR}"/debian/patches/impexpd-fix-certificate-verification-with-new-socat-2.patch
51 )
52
53 DESCRIPTION="Ganeti is a virtual server management software tool"
54 HOMEPAGE="http://www.ganeti.org/"
55
56 LICENSE="GPL-2"
57 SLOT="0"
58 IUSE="drbd experimental haskell-daemons htools ipv6 kvm lxc monitoring multiple-users rbd syslog test xen restricted-commands"
59 RESTRICT="!test? ( test )"
60
61 REQUIRED_USE="|| ( kvm xen lxc )
62         test? ( ipv6 )
63         kvm? ( || ( amd64 x86 ) )
64         ${PYTHON_REQUIRED_USE}"
65
66 USER_PREFIX="${GANETI_USER_PREFIX:-"gnt-"}"
67 GROUP_PREFIX="${GANETI_GROUP_PREFIX:-"${USER_PREFIX}"}"
68
69 DEPEND="
70         dev-libs/openssl:0
71         $(python_gen_cond_dep '
72                 dev-python/paramiko[${PYTHON_MULTI_USEDEP}]
73                 dev-python/pyopenssl[${PYTHON_MULTI_USEDEP}]
74                 dev-python/simplejson[${PYTHON_MULTI_USEDEP}]
75                 dev-python/pyparsing[${PYTHON_MULTI_USEDEP}]
76                 dev-python/pyinotify[${PYTHON_MULTI_USEDEP}]
77                 dev-python/pycurl[${PYTHON_MULTI_USEDEP}]
78                 dev-python/ipaddr[${PYTHON_MULTI_USEDEP}]
79                 dev-python/bitarray[${PYTHON_MULTI_USEDEP}]
80                 dev-python/docutils[${PYTHON_MULTI_USEDEP}]
81                 dev-python/fdsend[${PYTHON_MULTI_USEDEP}]
82         ')
83         || (
84                 net-misc/iputils[arping]
85                 net-analyzer/arping
86         )
87         net-analyzer/fping
88         net-misc/bridge-utils
89         net-misc/curl[ssl]
90         net-misc/openssh
91         net-misc/socat
92         sys-apps/iproute2
93         >=sys-fs/lvm2-2.02.181
94         >=sys-apps/baselayout-2.0
95         >=dev-lang/ghc-8.0:0=
96         <dev-lang/ghc-8.1:0=
97         dev-haskell/cabal:0=
98         dev-haskell/cabal-install:0=
99         !<app-emulation/ganeti-instance-image-0.6-r1
100         >=dev-haskell/mtl-2.1.1:0=
101         >=dev-haskell/old-time-1.1.0.0:0=
102         >=dev-haskell/random-1.0.1.1:0=
103         haskell-daemons? ( >=dev-haskell/text-0.11.1.13:0= )
104         >=dev-haskell/transformers-0.3.0.0:0=
105
106         >=dev-haskell/attoparsec-0.10.1.1:0=
107         <dev-haskell/attoparsec-0.14:0
108         >=dev-haskell/base64-bytestring-1.0.0.1:0=
109         <dev-haskell/base64-bytestring-1.1:0=
110         >=dev-haskell/crypto-4.2.4:0=
111         <dev-haskell/crypto-4.3:0=
112         >=dev-haskell/curl-1.3.7:0=
113         <dev-haskell/curl-1.4:0=
114         >=dev-haskell/hinotify-0.3.2:0=
115         <dev-haskell/hinotify-0.4:0=
116         >=dev-haskell/hslogger-1.1.4:0=
117         <dev-haskell/hslogger-1.3:0=
118         >=dev-haskell/json-0.5:0=
119         >=dev-haskell/lens-3.10:0=
120         >=dev-haskell/lifted-base-0.2.0.3:0=
121         <dev-haskell/lifted-base-0.3:0=
122         >=dev-haskell/monad-control-1.0.1.0:0=
123         <dev-haskell/monad-control-1.0.2:0=
124         >=dev-haskell/network-2.3.0.13:0=
125         <dev-haskell/network-2.7:0=
126         >=dev-haskell/parallel-3.2.0.2:3=
127         <dev-haskell/parallel-3.3:3=
128         >=dev-haskell/temporary-1.1.2.3:0=
129         <dev-haskell/temporary-1.3:0=
130         >=dev-haskell/regex-pcre-0.94.2:0=
131         <dev-haskell/regex-pcre-0.95:0=
132         >=dev-haskell/transformers-base-0.4:0=
133         <dev-haskell/transformers-base-0.5:0=
134         >=dev-haskell/utf8-string-0.3.7:0=
135         >=dev-haskell/zlib-0.5.3.3:0=
136         <dev-haskell/zlib-0.7:0=
137
138         >=dev-haskell/psqueue-1.1:0=
139         <dev-haskell/psqueue-1.2:0=
140         >=dev-haskell/snap-core-1.0.1:0=
141         <dev-haskell/snap-core-1.1:0=
142         >=dev-haskell/snap-server-1.0.1:0=
143         <dev-haskell/snap-server-1.1:0=
144         >=dev-haskell/case-insensitive-0.4.0.1
145
146         dev-haskell/vector:0=
147         xen? ( >=app-emulation/xen-3.0 )
148         kvm? (
149                 dev-python/psutil
150                 app-emulation/qemu
151         )
152         lxc? ( app-emulation/lxc )
153         drbd? ( sys-cluster/drbd-utils )
154         rbd? ( sys-cluster/ceph )
155         ipv6? ( net-misc/ndisc6 )
156         ${PYTHON_DEPS}"
157 RDEPEND="${DEPEND}
158         !app-emulation/ganeti-htools"
159 DEPEND+="
160         sys-devel/m4
161         app-text/pandoc
162         $(python_gen_cond_dep '
163                 dev-python/sphinx[${PYTHON_MULTI_USEDEP}]
164         ')
165         media-fonts/urw-fonts
166         media-gfx/graphviz
167         >=dev-haskell/test-framework-0.6:0=
168         <dev-haskell/test-framework-0.9:0=
169         >=dev-haskell/test-framework-hunit-0.2.7:0=
170         <dev-haskell/test-framework-hunit-0.4:0=
171         >=dev-haskell/test-framework-quickcheck2-0.2.12.1:0=
172         <dev-haskell/test-framework-quickcheck2-0.4:0=
173         test? (
174                 dev-python/mock
175                 dev-python/pyyaml
176                 dev-haskell/haddock:0=
177                 >=dev-haskell/hunit-1.2.4.2:0=
178                 <dev-haskell/hunit-1.3:0=
179                 >=dev-haskell/quickcheck-2.4.2:2=
180                 <dev-haskell/quickcheck-2.8.3:2=
181                 sys-apps/fakeroot
182                 >=net-misc/socat-1.7
183                 dev-util/shelltestrunner
184         )"
185
186 PATCHES+=(
187         "${FILESDIR}/${PN}-2.12-start-stop-daemon-args.patch"
188         "${FILESDIR}/${PN}-2.11-add-pgrep.patch"
189         "${FILESDIR}/${PN}-2.15-daemon-util.patch"
190         "${FILESDIR}/${PN}-2.9-disable-root-tests.patch"
191         "${FILESDIR}/${PN}-2.9-skip-cli-test.patch"
192         "${FILESDIR}/${PN}-2.10-rundir.patch"
193         "${FILESDIR}/${PN}-2.12-qemu-enable-kvm.patch"
194         "${FILESDIR}/${PN}-2.11-tests.patch"
195         "${FILESDIR}/${PN}-lockdir.patch"
196         "${FILESDIR}/${PN}-2.11-dont-nest-libdir.patch"
197         "${FILESDIR}/${PN}-2.11-dont-print-man-help.patch"
198         "${FILESDIR}/${PN}-2.11-daemon-util-tests.patch"
199         "${FILESDIR}/${PN}-2.13-process_unittest.patch"
200         "${FILESDIR}/${PN}-2.15-python-mock.patch"
201         "${FILESDIR}/${PN}-2.15.2-remove-sandbox-failing-tests.patch"
202         "${FILESDIR}/${PN}-2.15-noded-must-run-as-root.patch"
203         "${FILESDIR}/${PN}-2.15-kvmd-run-as-daemon-user.patch"
204         "${FILESDIR}/${PN}-2.15-dont-invert-return-values-for-man-warnings.patch"
205         "${FILESDIR}/${PN}-2.15-respect-HFLAGS.patch"
206         "${FILESDIR}/ganeti-2.15.2-bdev_py.patch"
207         "${FILESDIR}/ganeti-2.15.2-check-man-warnings.patch"
208         "${FILESDIR}/ganeti-2.15.2-ftbfs-sphinx-warning.patch"
209         "${FILESDIR}/ganeti-2.15.2-pyopenssl.patch"
210 )
211
212 S="${WORKDIR}/${MY_P}"
213
214 QA_WX_LOAD="
215         usr/lib*/${PN}/${SERIES}/usr/sbin/ganeti-*d
216         usr/lib*/${PN}/${SERIES}/usr/bin/htools
217 "
218 # haskell...
219 QA_FLAGS_IGNORED="
220         /usr/lib64/ganeti/2.15/usr/sbin/ganeti-metad
221         /usr/lib64/ganeti/2.15/usr/sbin/ganeti-wconfd
222         /usr/lib64/ganeti/2.15/usr/sbin/ganeti-confd
223         /usr/lib64/ganeti/2.15/usr/sbin/ganeti-luxid
224         /usr/lib64/ganeti/2.15/usr/sbin/ganeti-kvmd
225         /usr/lib64/ganeti/2.15/usr/bin/htools
226 "
227
228 pkg_setup() {
229         local user
230         python-single-r1_pkg_setup
231
232         if use multiple-users; then
233                 for user in gnt-{masterd,confd,luxid,rapi,daemons,admin}; do
234                         enewgroup ${user}
235                         enewuser ${user} -1 -1 -1 ${user}
236                 done
237         fi
238 }
239
240 src_prepare() {
241         local testfile
242         if has_version '>=dev-lang/ghc-7.10'; then
243                 # Breaks the build on 7.8
244                 PATCHES+=(
245                         "${WORKDIR}"/debian/patches/ghc-7.10-compatibility.patch
246                 )
247         fi
248         if use experimental; then
249                 ewarn "Experimental patches have been applied! RPC between daemons with different patches applied may cause breakage!"
250                 PATCHES+=(
251                         # QEMU Agent accepted upstream for 2.16, not yet in a tagged release
252                         # backport available for 2.15, but refused upstream due to RPC breakage.
253                         "${FILESDIR}"/0001-kvm-use_guest_agent-QEMU-Guest-Agent-sup.stable-2.15.patch
254                 )
255         fi
256         eapply "${PATCHES[@]}"
257         # Upstream commits:
258         # 4c3c2ca2a97a69c0287a3d23e064bc17978105eb
259         # 24618882737fd7c189adf99f4acc767d48f572c3
260         sed -i \
261                 -e '/QuickCheck/s,< 2.8,< 2.8.3,g' \
262                 cabal/ganeti.template.cabal
263         # Neuter -Werror
264         sed -i \
265                 -e '/^if DEVELOPER_MODE/,/^endif/s/-Werror//' \
266                 Makefile.am
267
268         # not sure why these tests are failing
269         # should remove this on next version bump if possible
270         for testfile in test/py/import-export_unittest.bash; do
271                 printf '#!/bin/bash\ntrue\n' > "${testfile}"
272         done
273
274         # take the sledgehammer approach to bug #526270
275         grep -lr '/bin/sh' "${S}" | xargs -r -- sed -i 's:/bin/sh:/bin/bash:g'
276
277         sed "s:%LIBDIR%:$(get_libdir):g" "${FILESDIR}/ganeti.initd-r4" \
278                 > "${T}/ganeti.initd"
279
280         eapply_user
281
282         [[ ${PV} =~ [9]{4,} ]] && ./autogen.sh
283         rm autotools/missing
284         eautoreconf
285 }
286
287 src_configure() {
288         # this is kind of a hack to work around the removal of the qemu-kvm wrapper
289         local kvm_arch
290
291         if use amd64; then
292                 kvm_arch=x86_64
293         elif use x86; then
294                 kvm_arch=i386
295         elif use kvm; then
296                 die "Could not determine qemu system to use for kvm"
297         fi
298
299         econf --localstatedir=/var \
300                 --sharedstatedir=/var \
301                 --disable-symlinks \
302                 --with-ssh-initscript=/etc/init.d/sshd \
303                 --with-export-dir=/var/lib/ganeti-storage/export \
304                 --with-os-search-path=/usr/share/${PN}/os \
305                 $(use_enable restricted-commands) \
306                 $(use_enable test haskell-tests) \
307                 $(usex multiple-users "--with-default-user=" "" "gnt-daemons" "") \
308                 $(usex multiple-users "--with-user-prefix=" "" "${USER_PREFIX}" "") \
309                 $(usex multiple-users "--with-default-group=" "" "gnt-daemons" "") \
310                 $(usex multiple-users "--with-group-prefix=" "" "${GROUP_PREFIX}" "") \
311                 $(use_enable syslog) \
312                 $(use_enable monitoring) \
313                 $(usex kvm '--with-kvm-path=' '' "/usr/bin/qemu-system-${kvm_arch}" '') \
314                 $(usex haskell-daemons "--enable-confd=haskell" '' '' '') \
315                 --with-haskell-flags="-optl -Wl,-z,relro -optl -Wl,--as-needed" \
316                 --enable-socat-escape \
317                 --enable-socat-compress
318 }
319
320 src_install() {
321         emake V=1 DESTDIR="${D}" install
322
323         newinitd "${T}"/ganeti.initd ${PN}
324         newconfd "${FILESDIR}"/ganeti.confd-r2 ${PN}
325
326         if use kvm; then
327                 newinitd "${FILESDIR}"/ganeti-kvm-poweroff.initd ganeti-kvm-poweroff
328                 newconfd "${FILESDIR}"/ganeti-kvm-poweroff.confd ganeti-kvm-poweroff
329         fi
330
331         # ganeti installs it's own docs in a generic location
332         rm -rf "${D}"/{usr/share/doc/${PN},run}
333
334         sed -i "s:/usr/$(get_libdir)/${PN}/tools/burnin:burnin:" doc/examples/bash_completion
335         newbashcomp doc/examples/bash_completion gnt-instance
336         bashcomp_alias gnt-instance burnin ganeti-{cleaner,confd} \
337                 h{space,check,scan,info,ail,arep,roller,squeeze,bal} \
338                 gnt-{os,job,filter,debug,storage,group,node,network,backup,cluster}
339
340         use monitoring && bashcomp_alias gnt-instance mon-collector
341
342         dodoc INSTALL UPGRADE NEWS README doc/*.rst
343
344         docinto html
345         dodoc -r doc/html/* doc/css/*.css
346
347         docinto examples
348         dodoc doc/examples/{ganeti.cron,gnt-config-backup} doc/examples/*.ocf
349
350         docinto examples/hooks
351         dodoc doc/examples/hooks/{ipsec,ethers}
352
353         insinto /etc/cron.d
354         newins doc/examples/ganeti.cron ${PN}
355
356         insinto /etc/logrotate.d
357         newins doc/examples/ganeti.logrotate ${PN}
358
359         # need to dodir rather than keepdir here (bug #552482)
360         dodir /var/lib/${PN}
361
362         keepdir /var/log/${PN}/
363         keepdir /usr/share/${PN}/${SERIES}/os/
364         keepdir /var/lib/ganeti-storage/{export,file,shared}/
365
366         dosym ${SERIES} "/usr/share/${PN}/default"
367         dosym ${SERIES} "/usr/$(get_libdir)/${PN}/default"
368
369         python_fix_shebang "${ED}" "${D}"/usr/"$(get_libdir)"/${PN}/${SERIES}
370 }
371
372 pkg_postinst() {
373         if use multiple-users; then
374                 elog "You have enable multiple user support, the users for this must"
375                 elog "be created. You can use the provided tool for this, which is"
376                 elog "located at:"
377                 elog "    /usr/$(get_libdir)/${PN}/tools/users-setup"
378         fi
379 }
380
381 src_test() {
382         PATH="${S}/scripts:${S}/src:${PATH}" \
383                 TMPDIR="/tmp" \
384                 GANETI_MASTER="$(hostname -f)" \
385                 emake check
386 }