Gentoo Archives: gentoo-commits

From: Matt Thode <prometheanfire@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/icinga2/
Date: Fri, 25 Dec 2015 20:21:01
Message-Id: 1451074817.497f43cb722fdae31bf1fc0aeef94d8c806bfd43.prometheanfire@gentoo
1 commit: 497f43cb722fdae31bf1fc0aeef94d8c806bfd43
2 Author: Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 25 20:19:42 2015 +0000
4 Commit: Matt Thode <prometheanfire <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 25 20:20:17 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=497f43cb
7
8 net-analyzer/icinga2: fix bug 567050 (always building with debug flags)
9
10 Package-Manager: portage-2.2.24
11
12 net-analyzer/icinga2/icinga2-2.4.1-r1.ebuild | 156 +++++++++++++++++++++++++++
13 1 file changed, 156 insertions(+)
14
15 diff --git a/net-analyzer/icinga2/icinga2-2.4.1-r1.ebuild b/net-analyzer/icinga2/icinga2-2.4.1-r1.ebuild
16 new file mode 100644
17 index 0000000..c1aeb36
18 --- /dev/null
19 +++ b/net-analyzer/icinga2/icinga2-2.4.1-r1.ebuild
20 @@ -0,0 +1,156 @@
21 +# Copyright 1999-2015 Gentoo Foundation
22 +# Distributed under the terms of the GNU General Public License v2
23 +# $Id$
24 +
25 +EAPI=5
26 +inherit cmake-utils depend.apache eutils systemd toolchain-funcs user
27 +
28 +DESCRIPTION="Distributed, general purpose, network monitoring engine"
29 +HOMEPAGE="http://icinga.org/icinga2"
30 +SRC_URI="https://github.com/Icinga/icinga2/archive/v${PV}.tar.gz -> ${P}.tar.gz"
31 +
32 +LICENSE="GPL-2"
33 +SLOT="0"
34 +KEYWORDS="~amd64 ~x86"
35 +IUSE="+mysql postgres classicui lto minimal nano-syntax +plugins studio +vim-syntax"
36 +
37 +DEPEND="
38 + dev-libs/openssl:0
39 + >=dev-libs/boost-1.41
40 + sys-devel/bison
41 + >=sys-devel/flex-2.5.35
42 + mysql? ( virtual/mysql )
43 + postgres? ( dev-db/postgresql:= )"
44 +
45 +RDEPEND="
46 + ${DEPEND}
47 + plugins? ( || (
48 + net-analyzer/monitoring-plugins
49 + net-analyzer/nagios-plugins
50 + ) )
51 + classicui? ( net-analyzer/icinga[web] )
52 + studio? ( x11-libs/wxGTK:2.9 )"
53 +
54 +REQUIRED_USE="!minimal? ( || ( mysql postgres ) )"
55 +
56 +want_apache2
57 +
58 +pkg_setup() {
59 + depend.apache_pkg_setup
60 + enewgroup icinga
61 + enewgroup icingacmd
62 + enewgroup nagios # for plugins
63 + enewuser icinga -1 -1 /var/lib/icinga2 "icinga,icingacmd,nagios"
64 +}
65 +
66 +src_configure() {
67 + sed -i 's/FLAGS\}\ \-g/FLAGS\}\ /g' CMakeLists.txt || die
68 + local mycmakeargs=(
69 + -DICINGA2_UNITY_BUILD=FALSE
70 + -DCMAKE_VERBOSE_MAKEFILE=ON
71 + -DCMAKE_BUILD_TYPE=None
72 + -DCMAKE_INSTALL_PREFIX=/usr
73 + -DCMAKE_INSTALL_SYSCONFDIR=/etc
74 + -DCMAKE_INSTALL_LOCALSTATEDIR=/var
75 + -DICINGA2_SYSCONFIGFILE=/etc/conf.d/icinga2
76 + -DICINGA2_USER=icinga
77 + -DICINGA2_GROUP=icingacmd
78 + -DICINGA2_COMMAND_USER=icinga
79 + -DICINGA2_COMMAND_GROUP=icingacmd
80 + -DINSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT=yes
81 + )
82 + # default to off if minimal, allow the flags to be set otherwise
83 + if use minimal; then
84 + mycmakeargs+=(
85 + -DICINGA2_WITH_MYSQL=OFF
86 + -DICINGA2_WITH_PGSQL=OFF
87 + )
88 + else
89 + mycmakeargs+=(
90 + -DICINGA2_WITH_PGSQL=$(usex postgres ON OFF)
91 + -DICINGA2_WITH_MYSQL=$(usex mysql ON OFF)
92 + )
93 + fi
94 + # LTO
95 + if use lto; then
96 + mycmakeargs+=(
97 + -DICINGA2_LTO_BUILD=ON
98 + )
99 + else
100 + mycmakeargs+=(
101 + -DICINGA2_LTO_BUILD=OFF
102 + )
103 + fi
104 + # STUDIO
105 + if use studio; then
106 + mycmakeargs+=(
107 + -DICINGA2_WITH_STUDIO=ON
108 + )
109 + else
110 + mycmakeargs+=(
111 + -DICINGA2_WITH_STUDIO=OFF
112 + )
113 + fi
114 +
115 + cmake-utils_src_configure
116 +}
117 +
118 +src_install() {
119 + BUILDDIR="${WORKDIR}"/icinga2-${PV}_build
120 + cd "${BUILDDIR}" || die
121 +
122 + emake DESTDIR="${D}" install
123 +
124 + einstalldocs
125 +
126 + newinitd "${FILESDIR}"/icinga2.initd icinga2
127 + newconfd "${FILESDIR}"/icinga2.confd icinga2
128 +
129 + if use mysql ; then
130 + docinto schema
131 + newdoc "${WORKDIR}"/icinga2-${PV}/lib/db_ido_mysql/schema/mysql.sql mysql.sql
132 + docinto schema/upgrade
133 + dodoc "${WORKDIR}"/icinga2-${PV}/lib/db_ido_mysql/schema/upgrade/*
134 + elif use postgres ; then
135 + docinto schema
136 + newdoc "${WORKDIR}"/icinga2-${PV}/lib/db_ido_pgsql/schema/pgsql.sql pgsql.sql
137 + docinto schema/upgrade
138 + dodoc "${WORKDIR}"/icinga2-${PV}/lib/db_ido_pgsql/schema/upgrade/*
139 + fi
140 +
141 + keepdir /etc/icinga2
142 + keepdir /var/lib/icinga2/api/zones
143 + keepdir /var/lib/icinga2/api/repository
144 + keepdir /var/lib/icinga2/api/log
145 + keepdir /var/spool/icinga2/perfdata
146 +
147 + rm -r "${D}/var/run" || die "failed to remove /var/run"
148 + rm -r "${D}/var/cache" || die "failed to remove /var/cache"
149 +
150 + fowners icinga:icinga /etc/icinga2
151 + fowners icinga:icinga /var/lib/icinga2
152 + fowners icinga:icinga /var/spool/icinga2
153 + fowners icinga:icinga /var/spool/icinga2/perfdata
154 + fowners icinga:icingacmd /var/log/icinga2
155 +
156 + fperms ug+rwX,o-rwx /etc/icinga2
157 + fperms ug+rwX,o-rwx /var/lib/icinga2
158 + fperms ug+rwX,o-rwx /var/spool/icinga2
159 + fperms ug+rwX,o-rwx /var/log/icinga2
160 +
161 + if use vim-syntax; then
162 + insinto /usr/share/vim/vimfiles
163 + doins -r "${WORKDIR}"/${P}/tools/syntax/vim/ftdetect
164 + doins -r "${WORKDIR}"/${P}/tools/syntax/vim/syntax
165 + fi
166 +
167 + if use nano-syntax; then
168 + insinto /usr/share/nano
169 + doins "${WORKDIR}"/${P}/tools/syntax/nano/icinga2.nanorc
170 + fi
171 +}
172 +
173 +pkg_postinst() {
174 + elog "DB IDO schema upgrade required. http://docs.icinga.org/icinga2/snapshot/chapter-2.html#upgrading-the-mysql-database"
175 + elog "You will need to update your configuration files, see https://dev.icinga.org/issues/5909"
176 +}