Gentoo Archives: gentoo-commits

From: Thomas Beierlein <tomjbe@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-backup/bacula/
Date: Fri, 07 Dec 2018 15:43:08
Message-Id: 1544197362.b7c9719f45e95defe57d1c24ef6902aa0f913d32.tomjbe@gentoo
1 commit: b7c9719f45e95defe57d1c24ef6902aa0f913d32
2 Author: Thomas Beierlein <tomjbe <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 7 15:40:49 2018 +0000
4 Commit: Thomas Beierlein <tomjbe <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 7 15:42:42 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b7c9719f
7
8 app-backup/bacula: Reenable batch insert into mysql data base.
9
10 Using batch insert can now be controlled by an USE flag.
11
12 Suggested-by: Ortwin Glueck <odi <AT> odi.ch>
13 Closes: https://bugs.gentoo.org/671222
14 Package-Manager: Portage-2.3.52, Repoman-2.3.12
15 Signed-off-by: Thomas Beierlein <tomjbe <AT> gentoo.org>
16
17 app-backup/bacula/bacula-9.2.2-r1.ebuild | 434 +++++++++++++++++++++++++++++++
18 app-backup/bacula/metadata.xml | 1 +
19 2 files changed, 435 insertions(+)
20
21 diff --git a/app-backup/bacula/bacula-9.2.2-r1.ebuild b/app-backup/bacula/bacula-9.2.2-r1.ebuild
22 new file mode 100644
23 index 00000000000..019a34fdab1
24 --- /dev/null
25 +++ b/app-backup/bacula/bacula-9.2.2-r1.ebuild
26 @@ -0,0 +1,434 @@
27 +# Copyright 1999-2018 Gentoo Authors
28 +# Distributed under the terms of the GNU General Public License v2
29 +
30 +EAPI=6
31 +
32 +inherit desktop libtool qmake-utils systemd user
33 +
34 +MY_PV=${PV/_beta/-b}
35 +MY_P=${PN}-${MY_PV}
36 +
37 +DESCRIPTION="Featureful client/server network backup suite"
38 +HOMEPAGE="http://www.bacula.org/"
39 +SRC_URI="mirror://sourceforge/bacula/${MY_P}.tar.gz"
40 +
41 +LICENSE="AGPL-3"
42 +SLOT="0"
43 +KEYWORDS="~amd64 ~ppc ~sparc ~x86"
44 +IUSE="acl bacula-clientonly bacula-nodir bacula-nosd +batch-insert examples ipv6 libressl logwatch mysql postgres qt5 readline +sqlite ssl static tcpd vim-syntax X"
45 +
46 +DEPEND="
47 + !bacula-clientonly? (
48 + !bacula-nodir? ( virtual/mta )
49 + postgres? ( dev-db/postgresql:=[threads] )
50 + mysql? ( || ( dev-db/mysql-connector-c dev-db/mariadb-connector-c ) )
51 + sqlite? ( dev-db/sqlite:3 )
52 + )
53 + dev-libs/gmp:0
54 + qt5? (
55 + dev-qt/qtsvg:5
56 + x11-libs/qwt:6
57 + )
58 + logwatch? ( sys-apps/logwatch )
59 + readline? ( sys-libs/readline:0 )
60 + static? (
61 + dev-libs/lzo[static-libs]
62 + sys-libs/ncurses:=[static-libs]
63 + sys-libs/zlib[static-libs]
64 + acl? ( virtual/acl[static-libs] )
65 + ssl? (
66 + !libressl? ( dev-libs/openssl:0=[static-libs] )
67 + libressl? ( dev-libs/libressl:0=[static-libs] )
68 + )
69 + )
70 + !static? (
71 + dev-libs/lzo
72 + sys-libs/ncurses:=
73 + sys-libs/zlib
74 + acl? ( virtual/acl )
75 + ssl? (
76 + !libressl? ( dev-libs/openssl:0= )
77 + libressl? ( dev-libs/libressl:0= )
78 + )
79 + )
80 + tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
81 +"
82 +RDEPEND="${DEPEND}
83 + !bacula-clientonly? (
84 + !bacula-nosd? (
85 + app-arch/mt-st
86 + sys-block/mtx
87 + )
88 + )
89 + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )
90 +"
91 +
92 +REQUIRED_USE="
93 + !bacula-clientonly? ( ^^ ( mysql postgres sqlite ) )
94 + static? ( bacula-clientonly )
95 +"
96 +
97 +S=${WORKDIR}/${MY_P}
98 +
99 +pkg_setup() {
100 + #XOR and !bacula-clientonly controlled by REQUIRED_USE
101 + use mysql && export mydbtype="mysql"
102 + use postgres && export mydbtype="postgresql"
103 + use sqlite && export mydbtype="sqlite3"
104 +
105 + # create the daemon group and user
106 + if [ -z "$(egetent group bacula 2>/dev/null)" ]; then
107 + enewgroup bacula
108 + einfo
109 + einfo "The group 'bacula' has been created. Any users you add to this"
110 + einfo "group have access to files created by the daemons."
111 + einfo
112 + fi
113 +
114 + if use bacula-clientonly && use static && use qt5; then
115 + ewarn
116 + ewarn "Building statically linked 'bat' is not supported. Ignorig 'qt5' useflag."
117 + ewarn
118 + fi
119 +
120 + if ! use bacula-clientonly; then
121 + if [ -z "$(egetent passwd bacula 2>/dev/null)" ]; then
122 + enewuser bacula -1 -1 /var/lib/bacula bacula,disk,tape,cdrom,cdrw
123 + einfo
124 + einfo "The user 'bacula' has been created. Please see the bacula manual"
125 + einfo "for information about running bacula as a non-root user."
126 + einfo
127 + fi
128 + fi
129 +}
130 +
131 +src_prepare() {
132 + # adjusts default configuration files for several binaries
133 + # to /etc/bacula/<config> instead of ./<config>
134 + pushd src >&/dev/null || die
135 + for f in console/console.c dird/dird.c filed/filed.c \
136 + stored/bcopy.c stored/bextract.c stored/bls.c \
137 + stored/bscan.c stored/btape.c stored/stored.c \
138 + qt-console/main.cpp; do
139 + sed -i -e 's|^\(#define CONFIG_FILE "\)|\1/etc/bacula/|g' "${f}" \
140 + || die "sed on ${f} failed"
141 + done
142 + popd >&/dev/null || die
143 +
144 + # bug 466688 drop deprecated categories from Desktop file
145 + sed -i -e 's/Application;//' scripts/bat.desktop.in || die
146 +
147 + # bug 466690 Use CXXFLAGS instead of CFLAGS
148 + sed -i -e 's/@CFLAGS@/@CXXFLAGS@/' autoconf/Make.common.in || die
149 +
150 + # drop automatic install of unneeded documentation (for bug 356499)
151 + eapply -p0 "${FILESDIR}"/7.2.0/${PN}-7.2.0-doc.patch
152 +
153 + # bug #310087
154 + eapply "${FILESDIR}"/5.2.3/${PN}-5.2.3-as-needed.patch
155 +
156 + # bug #311161
157 + eapply -p0 "${FILESDIR}"/9.0.2/${PN}-9.0.2-lib-search-path.patch
158 +
159 + # bat needs to respect LDFLAGS and CFLAGS
160 + eapply -p0 "${FILESDIR}"/9.0.6/${PN}-9.0.6-bat-pro.patch
161 +
162 + # bug #328701
163 + eapply -p0 "${FILESDIR}"/5.2.3/${PN}-5.2.3-openssl-1.patch
164 +
165 + eapply -p0 "${FILESDIR}"/9.0.8/${PN}-9.0.8-fix-static.patch
166 +
167 + # fix soname in libbaccat.so bug #602952
168 + eapply -p0 "${FILESDIR}/bacula-fix-sonames.patch"
169 +
170 + # do not strip binaries
171 + sed -i -e "s/strip /# strip /" src/filed/Makefile.in || die
172 + sed -i -e "s/strip /# strip /" src/console/Makefile.in || die
173 +
174 + # fix file not found error during make depend
175 + eapply -p0 "${FILESDIR}"/7.0.2/${PN}-7.0.2-depend.patch
176 +
177 + eapply_user
178 +
179 + # Fix systemd unit files:
180 + # bug 497748
181 + sed -i -e '/Requires/d' platforms/systemd/*.service.in || die
182 + sed -i -e '/StandardOutput/d' platforms/systemd/*.service.in || die
183 + # bug 504370
184 + sed -i -e '/Alias=bacula-dir/d' platforms/systemd/bacula-dir.service.in || die
185 + # bug 584442 and 504368
186 + sed -i -e 's/@dir_user@/root/g' platforms/systemd/bacula-dir.service.in || die
187 +
188 + # build 'bat' for Qt5
189 + export QMAKE="$(qt5_get_bindir)"/qmake
190 +
191 + # adapt to >=Qt-5.9 (see bug #644566)
192 + # qmake needs an existing target file to generate install instructions
193 + sed -i -e 's#bins.files = bat#bins.files = .libs/bat#g' \
194 + src/qt-console/bat.pro.in || die
195 + mkdir src/qt-console/.libs || die
196 + touch src/qt-console/.libs/bat || die
197 + chmod 755 src/qt-console/.libs/bat || die
198 +
199 + # fix wrong handling of libressl version
200 + # needs separate handling for <libressl-2.7 and >=libressl2.7
201 + # (see bug #655520)
202 + if has_version "<dev-libs/libressl-2.7"; then
203 + eapply -p0 "${FILESDIR}"/9.0.6/${PN}-9.0.6-libressl26.patch
204 + else
205 + eapply -p0 "${FILESDIR}"/9.0.6/${PN}-9.0.6-libressl27.patch
206 + fi
207 +
208 + # Don't let program instal man pages directly
209 + rm "${S}"/manpages/Makefile.in || die "Unable to remove man pages Makefile.in"
210 + eapply -p1 "${FILESDIR}/bacula-fix-manpages.patch"
211 +
212 + # fix bundled libtool (bug 466696)
213 + # But first move directory with M4 macros out of the way.
214 + # It is only needed by autoconf and gives errors during elibtoolize.
215 + mv autoconf/libtool autoconf/libtool1 || die
216 + elibtoolize
217 +}
218 +
219 +src_configure() {
220 + local myconf=''
221 +
222 + if use bacula-clientonly; then
223 + myconf="${myconf} \
224 + $(use_enable bacula-clientonly client-only) \
225 + $(use_enable !static libtool) \
226 + $(use_enable static static-cons) \
227 + $(use_enable static static-fd)"
228 + else
229 + myconf="${myconf} \
230 + $(use_enable !bacula-nodir build-dird) \
231 + $(use_enable !bacula-nosd build-stored)"
232 + # bug #311099
233 + # database support needed by dir-only *and* sd-only
234 + # build as well (for building bscan, btape, etc.)
235 + myconf="${myconf}
236 + --with-${mydbtype}"
237 + fi
238 +
239 + # do not build bat if 'static' clientonly
240 + if ! use bacula-clientonly || ! use static; then
241 + myconf="${myconf} \
242 + $(use_enable qt5 bat)"
243 + fi
244 +
245 + myconf="${myconf} \
246 + $(use_with X x) \
247 + $(use_with batch-insert) \
248 + $(use_enable !readline conio) \
249 + $(use_enable readline) \
250 + $(use_with readline readline /usr) \
251 + $(use_with ssl openssl) \
252 + $(use_enable ipv6) \
253 + $(use_enable acl) \
254 + $(use_with tcpd tcp-wrappers)"
255 +
256 + econf \
257 + --libdir=/usr/$(get_libdir) \
258 + --docdir=/usr/share/doc/${PF} \
259 + --htmldir=/usr/share/doc/${PF}/html \
260 + --with-pid-dir=/var/run \
261 + --sysconfdir=/etc/bacula \
262 + --with-archivedir=/var/lib/bacula/tmp \
263 + --with-subsys-dir=/var/lock/subsys \
264 + --with-working-dir=/var/lib/bacula \
265 + --with-logdir=/var/lib/bacula \
266 + --with-scriptdir=/usr/libexec/bacula \
267 + --with-systemd=$(systemd_get_systemunitdir) \
268 + --with-dir-user=bacula \
269 + --with-dir-group=bacula \
270 + --with-sd-user=root \
271 + --with-sd-group=bacula \
272 + --with-fd-user=root \
273 + --with-fd-group=bacula \
274 + --enable-smartalloc \
275 + --disable-afs \
276 + --host=${CHOST} \
277 + ${myconf}
278 +}
279 +
280 +src_compile() {
281 + # Make build log verbose (bug #447806)
282 + emake NO_ECHO=""
283 +}
284 +
285 +src_install() {
286 + emake DESTDIR="${D}" install
287 + doicon scripts/bacula.png
288 +
289 + # install bat icon and desktop file when enabled
290 + # (for some reason ./configure doesn't pick this up)
291 + if use qt5 && ! use static ; then
292 + doicon src/qt-console/images/bat_icon.png
293 + domenu scripts/bat.desktop
294 + fi
295 +
296 + # remove some scripts we don't need at all
297 + rm -f "${D}"/usr/libexec/bacula/{bacula,bacula-ctl-dir,bacula-ctl-fd,bacula-ctl-sd,startmysql,stopmysql}
298 +
299 + # rename statically linked apps
300 + if use bacula-clientonly && use static ; then
301 + pushd "${D}"/usr/sbin || die
302 + mv static-bacula-fd bacula-fd || die
303 + mv static-bconsole bconsole || die
304 + popd || die
305 + fi
306 +
307 + # extra files which 'make install' doesn't cover
308 + if ! use bacula-clientonly; then
309 + # the database update scripts
310 + diropts -m0750
311 + insinto /usr/libexec/bacula/updatedb
312 + insopts -m0754
313 + doins "${S}"/updatedb/*
314 + fperms 0640 /usr/libexec/bacula/updatedb/README
315 +
316 + # the logrotate configuration
317 + # (now unconditional wrt bug #258187)
318 + diropts -m0755
319 + insinto /etc/logrotate.d
320 + insopts -m0644
321 + newins "${S}"/scripts/logrotate bacula
322 +
323 + # the logwatch scripts
324 + if use logwatch; then
325 + diropts -m0750
326 + dodir /usr/share/logwatch/scripts/services
327 + dodir /usr/share/logwatch/scripts/shared
328 + dodir /etc/logwatch/conf/logfiles
329 + dodir /etc/logwatch/conf/services
330 + pushd "${S}"/scripts/logwatch >&/dev/null || die
331 + emake DESTDIR="${D}" install
332 + popd >&/dev/null || die
333 + fi
334 + fi
335 +
336 + if ! use qt5; then
337 + rm -vf "${D}"/usr/share/man/man1/bat.1*
338 + fi
339 + rm -vf "${D}"/usr/share/man/man1/bacula-tray-monitor.1*
340 +
341 + if use bacula-clientonly || use bacula-nodir ; then
342 + rm -vf "${D}"/usr/libexec/bacula/create_*_database
343 + rm -vf "${D}"/usr/libexec/bacula/drop_*_database
344 + rm -vf "${D}"/usr/libexec/bacula/make_*_tables
345 + rm -vf "${D}"/usr/libexec/bacula/update_*_tables
346 + rm -vf "${D}"/usr/libexec/bacula/drop_*_tables
347 + rm -vf "${D}"/usr/libexec/bacula/grant_*_privileges
348 + rm -vf "${D}"/usr/libexec/bacula/*_catalog_backup
349 + fi
350 + if use bacula-clientonly || use bacula-nosd; then
351 + rm -vf "${D}"/usr/libexec/bacula/disk-changer
352 + rm -vf "${D}"/usr/libexec/bacula/mtx-changer
353 + rm -vf "${D}"/usr/libexec/bacula/dvd-handler
354 + fi
355 +
356 + # documentation
357 + dodoc ChangeLog ReleaseNotes SUPPORT
358 +
359 + # Install all man pages
360 + doman "${S}"/manpages/*
361 +
362 + # install examples (bug #457504)
363 + if use examples; then
364 + docinto examples/
365 + dodoc -r examples/*
366 + fi
367 +
368 + # vim-files
369 + if use vim-syntax; then
370 + insinto /usr/share/vim/vimfiles/syntax
371 + doins scripts/bacula.vim
372 + insinto /usr/share/vim/vimfiles/ftdetect
373 + newins scripts/filetype.vim bacula_ft.vim
374 + fi
375 +
376 + # setup init scripts
377 + myscripts="bacula-fd"
378 + if ! use bacula-clientonly; then
379 + if ! use bacula-nodir; then
380 + myscripts="${myscripts} bacula-dir"
381 + fi
382 + if ! use bacula-nosd; then
383 + myscripts="${myscripts} bacula-sd"
384 + fi
385 + fi
386 + for script in ${myscripts}; do
387 + # copy over init script and config to a temporary location
388 + # so we can modify them as needed
389 + cp "${FILESDIR}/${script}".confd "${T}/${script}".confd || die "failed to copy ${script}.confd"
390 + cp "${FILESDIR}/newscripts/${script}".initd "${T}/${script}".initd || die "failed to copy ${script}.initd"
391 +
392 + # now set the database dependancy for the director init script
393 + case "${script}" in
394 + bacula-dir)
395 + case "${mydbtype}" in
396 + sqlite3)
397 + # sqlite databases don't have a daemon
398 + sed -i -e 's/need "%database%"/:/g' "${T}/${script}".initd || die
399 + ;;
400 + *)
401 + # all other databases have daemons
402 + sed -i -e "s:%database%:${mydbtype}:" "${T}/${script}".initd || die
403 + ;;
404 + esac
405 + ;;
406 + *)
407 + ;;
408 + esac
409 +
410 + # install init script and config
411 + newinitd "${T}/${script}".initd "${script}"
412 + newconfd "${T}/${script}".confd "${script}"
413 + done
414 +
415 + systemd_dounit "${S}"/platforms/systemd/bacula-{dir,fd,sd}.service
416 +
417 + # make sure the working directory exists
418 + diropts -m0750
419 + keepdir /var/lib/bacula
420 +
421 + # make sure bacula group can execute bacula libexec scripts
422 + fowners -R root:bacula /usr/libexec/bacula
423 +}
424 +
425 +pkg_postinst() {
426 + if use bacula-clientonly; then
427 + fowners root:bacula /var/lib/bacula
428 + else
429 + fowners bacula:bacula /var/lib/bacula
430 + fi
431 +
432 + if ! use bacula-clientonly && ! use bacula-nodir; then
433 + einfo
434 + einfo "If this is a new install, you must create the ${mydbtype} databases with:"
435 + einfo " /usr/libexec/bacula/create_${mydbtype}_database"
436 + einfo " /usr/libexec/bacula/make_${mydbtype}_tables"
437 + einfo " /usr/libexec/bacula/grant_${mydbtype}_privileges"
438 + einfo
439 +
440 + ewarn "ATTENTION!"
441 + ewarn "The format of the database may have changed."
442 + ewarn "If you just upgraded from a version below 9.0.0 you must run"
443 + ewarn "'update_bacula_tables' now."
444 + ewarn "Make sure to have a backup of your catalog before."
445 + ewarn
446 + fi
447 +
448 + if use sqlite; then
449 + einfo
450 + einfo "Be aware that Bacula does not officially support SQLite database anymore."
451 + einfo "Best use it only for a client-only installation. See Bug #445540."
452 + einfo
453 + fi
454 +
455 + einfo "Please note that 'bconsole' will always be installed. To compile 'bat'"
456 + einfo "you have to enable 'USE=qt5'."
457 + einfo
458 + einfo "/var/lib/bacula/tmp was configured for archivedir. This dir will be used during"
459 + einfo "restores, so be sure to set it to an appropriate in dir in the bacula config."
460 +}
461
462 diff --git a/app-backup/bacula/metadata.xml b/app-backup/bacula/metadata.xml
463 index 1ebf5f232fa..ed8ab4a8542 100644
464 --- a/app-backup/bacula/metadata.xml
465 +++ b/app-backup/bacula/metadata.xml
466 @@ -10,6 +10,7 @@
467 client</flag>
468 <flag name="bacula-nodir">Disable building of director</flag>
469 <flag name="bacula-nosd">Disable building of storage daemon</flag>
470 + <flag name="batch-insert">Enable batch insert into data base</flag>
471 <flag name="logwatch">Install support files for logwatch</flag>
472 </use>
473 <upstream>