*/*: [QA] Fix trivial cases of MissingTestRestrict
[gentoo.git] / net-analyzer / mk-livestatus / mk-livestatus-1.2.8_p26.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 GENTOO_DEPEND_ON_PERL=no
7 PYTHON_COMPAT=( python2_7 )
8 inherit autotools perl-module python-single-r1
9
10 MY_PV="${PV/_p/p}"
11 MY_P="${PN}-${MY_PV}"
12
13 DESCRIPTION="Nagios/Icinga event broker that allows quick/direct access to your status data"
14 HOMEPAGE="http://mathias-kettner.de/checkmk_livestatus.html"
15 SRC_URI="http://mathias-kettner.de/download/${MY_P}.tar.gz"
16
17 LICENSE="GPL-2"
18 SLOT="0"
19 KEYWORDS="~amd64 ~ppc ~x86"
20 IUSE="examples nagios4 perl python test"
21 RESTRICT="!test? ( test )"
22 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
23
24 RDEPEND="!sys-apps/ucspi-unix:0
25         perl? (
26                 dev-lang/perl:0
27                 virtual/perl-Digest-MD5:0
28                 virtual/perl-Scalar-List-Utils:0
29                 >=virtual/perl-Thread-Queue-2.11:0
30                 virtual/perl-Encode:0
31                 dev-perl/JSON-XS:0
32         )
33         python? ( ${PYTHON_DEPS} )"
34 DEPEND="${RDEPEND}
35         perl? (
36                 dev-perl/Module-Install:0
37                 virtual/perl-ExtUtils-MakeMaker:0
38                 virtual/perl-File-Path:0
39                 virtual/perl-File-Spec:0
40                 virtual/perl-File-Temp:0
41                 test? (
42                         dev-perl/File-Copy-Recursive:0
43                         dev-perl/Test-Pod:0
44                         dev-perl/Test-Perl-Critic:0
45                         dev-perl/Test-Pod-Coverage:0
46                         dev-perl/Perl-Critic:0
47                         dev-perl/Perl-Critic-Policy-Dynamic-NoIndirect:0
48                         dev-perl/Perl-Critic-Deprecated:0
49                         dev-perl/Perl-Critic-Nits:0
50                 )
51         )"
52
53 # For perl test
54 SRC_TEST="parallel"
55
56 S="${WORKDIR}/${MY_P}"
57
58 PATCHES=(
59         "${FILESDIR}/1.2.8_p10-MEDIUM-Drop-default-strip.patch"
60         "${FILESDIR}/1.2.8_p10-MINOR-test-Remove-the-usage-of-Perl-Critic-Policy-Mo.patch"
61 )
62
63 src_prepare() {
64         default
65
66         # Use system Module::Install instead, it will be copied to $S by
67         # Module::install itself.
68         rm -rf api/perl/inc || die
69
70         if use perl; then
71                 # Ensure patches are not applied twice
72                 unset PATCHES
73                 perl-module_src_prepare
74         fi
75
76         eautoreconf
77 }
78
79 src_configure() {
80         econf \
81                 $(use_with nagios4)
82
83         if use perl; then
84                 cd api/perl || die
85                 perl-module_src_configure
86         fi
87 }
88
89 src_compile() {
90         emake
91
92         if use perl; then
93                 cd api/perl || die
94                 perl-module_src_compile
95         fi
96 }
97
98 src_test() {
99         if use perl; then
100                 cd api/perl || die
101
102                 export TEST_AUTHOR="Test Author"
103                 perl-module_src_test
104         fi
105 }
106
107 src_install() {
108         emake install DESTDIR="${ED}"
109
110         # install a config file showing whats needed to enable livestatus for nagios
111         cat <<EOF >"${T}"/nagios.cfg
112 # Ensure all data is set to event brokers
113 event_broker_options=-1
114 broker_module=${EPREFIX%/}/usr/$(get_libdir)/${PN}/livestatus.o
115 EOF
116         # same for icigna
117         cat <<EOF >"${T}"/icigna.cfg
118 define module{
119         module_name             ${PN}
120         module_type             neb
121         path                    /usr/$(get_libdir)/${PN}/livestatus.o
122         args                    /var/lib/icigna/rw/live
123         }
124 EOF
125         insinto /usr/share/${PN}
126         doins "${T}"/{nagios,icigna}.cfg
127
128         if use perl; then
129                 cd api/perl || die
130                 perl-module_src_install
131                 cd "${S}"
132
133                 if use examples; then
134                         docinto /
135                         newdoc api/perl/README README.perl
136
137                         docinto examples
138                         dodoc api/perl/examples/dump.pl
139                 fi
140         fi
141
142         if use python; then
143                 python_foreach_impl python_domodule api/python/livestatus.py
144
145                 if use examples; then
146                         docinto /
147                         newdoc api/python/README README.python
148
149                         docinto examples
150                         dodoc api/python/{example,example_multisite,make_nagvis_map}.py
151                 fi
152         fi
153 }
154
155 pkg_postinst() {
156         elog "Sample configurations for icigna and nagios are available in"
157         elog "/usr/share/${PN}"
158 }