Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-backup/bareos/
Date: Sun, 13 May 2018 06:56:59
Message-Id: 1526194594.304df6a54e558cdbfe368eda492feab499ce09d2.asturm@gentoo
1 commit: 304df6a54e558cdbfe368eda492feab499ce09d2
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 10 19:46:42 2018 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Sun May 13 06:56:34 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=304df6a5
7
8 app-backup/bareos: Drop USE=qt4 and superfluous qt4-r2.eclass
9
10 Bug: https://bugs.gentoo.org/644568
11 Package-Manager: Portage-2.3.36, Repoman-2.3.9
12
13 app-backup/bareos/bareos-16.2.7-r1.ebuild | 398 ++++++++++++++++++++++++++++++
14 1 file changed, 398 insertions(+)
15
16 diff --git a/app-backup/bareos/bareos-16.2.7-r1.ebuild b/app-backup/bareos/bareos-16.2.7-r1.ebuild
17 new file mode 100644
18 index 00000000000..efeb4ae8479
19 --- /dev/null
20 +++ b/app-backup/bareos/bareos-16.2.7-r1.ebuild
21 @@ -0,0 +1,398 @@
22 +# Copyright 1999-2018 Gentoo Foundation
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI="5"
26 +
27 +PYTHON_COMPAT=( python2_7 )
28 +PYTHON_REQ_USE="threads"
29 +
30 +inherit eutils multilib python-single-r1 user
31 +
32 +DESCRIPTION="Featureful client/server network backup suite"
33 +HOMEPAGE="http://www.bareos.org/"
34 +SRC_URI="https://github.com/${PN}/${PN}/archive/Release/${PV}.tar.gz -> ${P}.tar.gz"
35 +RESTRICT="mirror"
36 +
37 +LICENSE="AGPL-3"
38 +SLOT="0"
39 +KEYWORDS="~amd64 ~x86"
40 +IUSE="X acl cephfs clientonly +director fastlz glusterfs gnutls ipv6 jansson lmdb libressl
41 + logwatch mysql ndmp postgres python rados rados-striper readline scsi-crypto
42 + sql-pooling +sqlite ssl static +storage-daemon tcpd vim-syntax"
43 +REQUIRED_USE="!clientonly? ( || ( mysql postgres sqlite ) )"
44 +
45 +DEPEND="
46 + !app-backup/bacula
47 + cephfs? ( sys-cluster/ceph )
48 + rados? ( sys-cluster/ceph )
49 + rados-striper? ( >=sys-cluster/ceph-0.94.2 )
50 + glusterfs? ( sys-cluster/glusterfs )
51 + lmdb? ( dev-db/lmdb )
52 + dev-libs/gmp:0
53 + !clientonly? (
54 + postgres? ( dev-db/postgresql:*[threads] )
55 + mysql? ( virtual/mysql )
56 + sqlite? ( dev-db/sqlite:3 )
57 + director? (
58 + virtual/mta
59 + jansson? ( dev-libs/jansson )
60 + )
61 + )
62 + fastlz? ( dev-libs/bareos-fastlzlib )
63 + logwatch? ( sys-apps/logwatch )
64 + tcpd? ( sys-apps/tcp-wrappers )
65 + readline? ( sys-libs/readline:0 )
66 + static? (
67 + acl? ( virtual/acl[static-libs] )
68 + sys-libs/zlib[static-libs]
69 + dev-libs/lzo[static-libs]
70 + sys-libs/ncurses:=[static-libs]
71 + ssl? (
72 + !gnutls? (
73 + !libressl? ( dev-libs/openssl:0=[static-libs] )
74 + libressl? ( dev-libs/libressl:0=[static-libs] )
75 + )
76 + gnutls? ( net-libs/gnutls[static-libs] )
77 + )
78 + )
79 + !static? (
80 + acl? ( virtual/acl )
81 + dev-libs/lzo
82 + ssl? (
83 + !gnutls? (
84 + !libressl? ( dev-libs/openssl:0= )
85 + libressl? ( dev-libs/libressl:0= )
86 + )
87 + gnutls? ( net-libs/gnutls )
88 + )
89 + sys-libs/ncurses:=
90 + sys-libs/zlib
91 + )
92 + python? ( ${PYTHON_DEPS} )
93 + "
94 +RDEPEND="${DEPEND}
95 + !clientonly? (
96 + storage-daemon? (
97 + sys-block/mtx
98 + app-arch/mt-st
99 + )
100 + )
101 + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
102 +
103 +REQUIRED_USE="static? ( clientonly )
104 + python? ( ${PYTHON_REQUIRED_USE} )"
105 +
106 +S=${WORKDIR}/${PN}-Release-${PV}
107 +
108 +pkg_setup() {
109 + use mysql && export mydbtypes+="mysql"
110 + use postgres && export mydbtypes+=" postgresql"
111 + use sqlite && export mydbtypes+=" sqlite"
112 +
113 + # create the daemon group and user
114 + if [ -z "$(egetent group bareos 2>/dev/null)" ]; then
115 + enewgroup bareos
116 + einfo
117 + einfo "The group 'bareos' has been created. Any users you add to this"
118 + einfo "group have access to files created by the daemons."
119 + einfo
120 + fi
121 +
122 + if ! use clientonly; then
123 + if [ -z "$(egetent passwd bareos 2>/dev/null)" ]; then
124 + enewuser bareos -1 -1 /var/lib/bareos bareos,disk,tape,cdrom,cdrw
125 + einfo
126 + einfo "The user 'bareos' has been created. Please see the bareos manual"
127 + einfo "for information about running bareos as a non-root user."
128 + einfo
129 + fi
130 + fi
131 +
132 + use python && python-single-r1_pkg_setup
133 +}
134 +
135 +src_prepare() {
136 + # adjusts default configuration files for several binaries
137 + # to /etc/bareos/<config> instead of ./<config>
138 + pushd src >&/dev/null || die
139 + for f in console/console.c dird/dird.c filed/filed.c \
140 + stored/bcopy.c stored/bextract.c stored/bls.c \
141 + stored/bscan.c stored/btape.c stored/stored.c \
142 + qt-console/main.cpp; do
143 + sed -i -e 's|^\(#define CONFIG_FILE "\)|\1/etc/bareos/|g' "${f}" \
144 + || die "sed on ${f} failed"
145 + done
146 + popd >&/dev/null || die
147 +
148 + # bug 466690 Use CXXFLAGS instead of CFLAGS
149 + sed -i -e 's/@CFLAGS@/@CXXFLAGS@/' autoconf/Make.common.in || die
150 +
151 + # stop build for errors in subdirs
152 + epatch "${FILESDIR}"/${PN}-12.4.5-Makefile.patch
153 +
154 + # bat needs to respect LDFLAGS
155 + epatch "${FILESDIR}"/${PN}-12.4.5-bat-ldflags.patch
156 +
157 + # do not strip binaries
158 + for d in filed console dird stored; do
159 + sed -i -e "s/strip /# strip /" src/$d/Makefile.in || die
160 + done
161 +}
162 +
163 +src_configure() {
164 + local myconf=''
165 +
166 + addpredict /var/lib/logrotate.status
167 +
168 + if use clientonly; then
169 + myconf="${myconf} \
170 + $(use_enable clientonly client-only) \
171 + $(use_enable !static libtool) \
172 + $(use_enable static static-cons) \
173 + $(use_enable static static-fd)"
174 + fi
175 +
176 + # do not build bat and traymonitor if 'static' clientonly
177 + if ! use clientonly || ! use static; then
178 + myconf="${myconf} \
179 + --disable-bat \
180 + --disable-traymonitor"
181 + fi
182 +
183 + myconf="${myconf} \
184 + $(use_with X x) \
185 + $(use_enable acl) \
186 + $(use_enable ipv6) \
187 + $(use_enable ndmp) \
188 + $(use_enable readline) \
189 + $(use_enable !readline conio) \
190 + $(use_enable scsi-crypto) \
191 + $(use_enable sql-pooling) \
192 + $(use_with fastlz) \
193 + $(use_with mysql) \
194 + $(use_with postgres postgresql) \
195 + $(use_with python) \
196 + $(use_with readline) \
197 + $(use_with sqlite sqlite3) \
198 + $(use sqlite || echo "--without-sqlite3") \
199 + $(use_with ssl openssl) \
200 + $(use_with tcpd tcp-wrappers) \
201 + $(use_enable lmdb) \
202 + $(use_with glusterfs) \
203 + $(use_with rados) \
204 + $(use_with rados-striper) \
205 + $(use_with cephfs) \
206 + $(use_with jansson) \
207 + "
208 +
209 + econf \
210 + --libdir=/usr/$(get_libdir) \
211 + --docdir=/usr/share/doc/${PF} \
212 + --htmldir=/usr/share/doc/${PF}/html \
213 + --with-pid-dir=/run/bareos \
214 + --sysconfdir=/etc \
215 + --with-subsys-dir=/run/lock/subsys \
216 + --with-working-dir=/var/lib/bareos \
217 + --with-logdir=/var/log/bareos \
218 + --with-scriptdir=/usr/libexec/bareos \
219 + --with-plugindir=/usr/$(get_libdir)/${PN}/plugin \
220 + --with-backenddir=/usr/$(get_libdir)/${PN}/backend \
221 + --with-dir-user=bareos \
222 + --with-dir-group=bareos \
223 + --with-sd-user=root \
224 + --with-sd-group=bareos \
225 + --with-fd-user=root \
226 + --with-fd-group=bareos \
227 + --with-sbin-perm=0755 \
228 + --with-systemd \
229 + --enable-dynamic-cats-backends \
230 + --enable-dynamic-storage-backends \
231 + --enable-batch-insert \
232 + --disable-afs \
233 + --host=${CHOST} \
234 + ${myconf}
235 +}
236 +
237 +src_compile() {
238 + # workaround for build failing with high -j values
239 + # if ndmp is enabled
240 + use ndmp && MAKEOPTS="$MAKEOPTS -j1"
241 +
242 + # Make build log verbose (bug #447806)
243 + emake NO_ECHO=""
244 +}
245 +
246 +src_install() {
247 + emake DESTDIR="${D}" install
248 + newicon src/images/bareos_logo_shadow.png bareos.png
249 +
250 + # remove some scripts we don't need at all
251 + rm -f "${D}"/usr/libexec/bareos/{bareos,bareos-ctl-dir,bareos-ctl-fd,bareos-ctl-sd,startmysql,stopmysql}
252 + rm -f "${D}"/usr/sbin/bareos
253 +
254 + # remove upstream init scripts
255 + rm -f "${D}"/etc/init.d/bareos-*
256 +
257 + # rename statically linked apps
258 + if use clientonly && use static ; then
259 + pushd "${D}"/usr/sbin || die
260 + mv static-bareos-fd bareos-fd || die
261 + mv static-bconsole bconsole || die
262 + popd || die
263 + fi
264 +
265 + # extra files which 'make install' doesn't cover
266 + if ! use clientonly; then
267 + # the logrotate configuration
268 + # (now unconditional wrt bug #258187)
269 + diropts -m0755
270 + insinto /etc/logrotate.d
271 + insopts -m0644
272 + newins "${S}"/scripts/logrotate bareos
273 +
274 + # the logwatch scripts
275 + if use logwatch; then
276 + diropts -m0750
277 + dodir /etc/log.d/scripts/services
278 + dodir /etc/log.d/scripts/shared
279 + dodir /etc/log.d/conf/logfiles
280 + dodir /etc/log.d/conf/services
281 + pushd "${S}"/scripts/logwatch >&/dev/null || die
282 + emake DESTDIR="${D}" install
283 + popd >&/dev/null || die
284 + fi
285 + fi
286 +
287 + rm -vf "${D}"/usr/share/man/man1/bareos-bwxconsole.1*
288 + rm -vf "${D}"/usr/share/man/man1/bat.1*
289 +
290 + if use clientonly || ! use director; then
291 + rm -vf "${D}"/usr/share/man/man8/bareos-dir.8*
292 + rm -vf "${D}"/usr/share/man/man8/bareos-dbcheck.8*
293 + rm -vf "${D}"/usr/share/man/man1/bsmtp.1*
294 + rm -vf "${D}"/usr/share/man/man8/bwild.8*
295 + rm -vf "${D}"/usr/share/man/man8/bregex.8*
296 + rm -vf "${D}"/usr/share/man/man8/bpluginfo.8*
297 + rm -vf "${D}"/usr/libexec/bareos/create_*_database
298 + rm -vf "${D}"/usr/libexec/bareos/drop_*_database
299 + rm -vf "${D}"/usr/libexec/bareos/make_*_tables
300 + rm -vf "${D}"/usr/libexec/bareos/update_*_tables
301 + rm -vf "${D}"/usr/libexec/bareos/drop_*_tables
302 + rm -vf "${D}"/usr/libexec/bareos/grant_*_privileges
303 + rm -vf "${D}"/usr/libexec/bareos/*_catalog_backup
304 + fi
305 + if use clientonly || ! use storage-daemon; then
306 + rm -vf "${D}"/usr/share/man/man8/bareos-sd.8*
307 + rm -vf "${D}"/usr/share/man/man8/bcopy.8*
308 + rm -vf "${D}"/usr/share/man/man8/bextract.8*
309 + rm -vf "${D}"/usr/share/man/man8/bls.8*
310 + rm -vf "${D}"/usr/share/man/man8/bscan.8*
311 + rm -vf "${D}"/usr/share/man/man8/btape.8*
312 + rm -vf "${D}"/usr/libexec/bareos/disk-changer
313 + rm -vf "${D}"/usr/libexec/bareos/mtx-changer
314 + rm -vf "${D}"/usr/libexec/bareos/dvd-handler
315 + rm -vf "${D}"/etc/bareos/mtx-changer.conf
316 + fi
317 + if ! use scsi-crypto; then
318 + rm -vf "${D}"/usr/share/man/man8/bscrypto.8*
319 + fi
320 + rm -vf "${D}"/usr/share/man/man1/bareos-tray-monitor.1*
321 +
322 + # documentation
323 + dodoc README.md
324 + use ndmp && dodoc README.NDMP
325 + use scsi-crypto && dodoc README.scsicrypto
326 +
327 + # vim-files
328 + if use vim-syntax; then
329 + insinto /usr/share/vim/vimfiles/syntax
330 + doins scripts/bareos.vim
331 + insinto /usr/share/vim/vimfiles/ftdetect
332 + newins scripts/filetype.vim bareos_ft.vim
333 + fi
334 +
335 + # setup init scripts
336 + myscripts="bareos-fd"
337 + if ! use clientonly; then
338 + if use director; then
339 + myscripts="${myscripts} bareos-dir"
340 + fi
341 + if use storage-daemon; then
342 + myscripts="${myscripts} bareos-sd"
343 + fi
344 + fi
345 + for script in ${myscripts}; do
346 + # copy over init script and config to a temporary location
347 + # so we can modify them as needed
348 + cp "${FILESDIR}/${script}".confd-16 "${T}/${script}".confd || die "failed to copy ${script}.confd"
349 + cp "${FILESDIR}/${script}".initd "${T}/${script}".initd || die "failed to copy ${script}.initd"
350 +
351 + # now set the database dependency for the director init script
352 + case "${script}" in
353 + bareos-dir)
354 + sed -i -e "s:%databasetypes%:${mydbtypes}:" "${T}/${script}".confd || die
355 + ;;
356 + *)
357 + ;;
358 + esac
359 +
360 + # install init script and config
361 + newinitd "${T}/${script}".initd "${script}"
362 + newconfd "${T}/${script}".confd "${script}"
363 + done
364 +
365 + # make sure the working directory exists
366 + diropts -m0750
367 + keepdir /var/lib/bareos
368 +
369 + # make sure bareos group can execute bareos libexec scripts
370 + fowners -R root:bareos /usr/libexec/bareos
371 +}
372 +
373 +pkg_postinst() {
374 + if use clientonly; then
375 + fowners root:bareos /var/lib/bareos
376 + else
377 + fowners bareos:bareos /var/lib/bareos
378 + fi
379 +
380 + if ! use clientonly && use director; then
381 + einfo
382 + einfo "If this is a new install, you must create the databases with:"
383 + if use postgres; then
384 + einfo
385 + einfo "For postgresql:"
386 + einfo " su postgres -c '/usr/libexec/bareos/create_bareos_database postgresql'"
387 + einfo " su postgres -c '/usr/libexec/bareos/make_bareos_tables postgresql'"
388 + einfo " su postgres -c '/usr/libexec/bareos/grant_bareos_privileges postgresql'"
389 + fi
390 + if use mysql; then
391 + einfo
392 + einfo "For mysql:"
393 + einfo
394 + einfo " Make sure root has direct access to your mysql server. You may want to"
395 + einfo " create a /root/.my.cnf file with"
396 + einfo " [client]"
397 + einfo " user=root"
398 + einfo " password=YourPasswordForAccessingMysqlAsRoot"
399 + einfo " before running:"
400 + einfo " /usr/libexec/bareos/create_bareos_database mysql"
401 + einfo " /usr/libexec/bareos/make_bareos_tables mysql"
402 + einfo " /usr/libexec/bareos/grant_bareos_privileges mysql"
403 + fi
404 + einfo
405 + fi
406 +
407 + if use sqlite; then
408 + einfo
409 + einfo "Be aware that Bareos does not officially support SQLite database."
410 + einfo "Best use it only for a client-only installation. See Bug #445540."
411 + einfo
412 + einfo "It is strongly recommended to use either postgresql or mysql as"
413 + einfo "catalog database backend."
414 + einfo
415 + fi
416 +
417 + einfo "Please note that 'bconsole' will always be installed."
418 + einfo
419 +}