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, 11 May 2018 16:37:14
Message-Id: 1526056587.c6a11f48cf7e4a10694bb52c1e11899cc27bcb42.tomjbe@gentoo
1 commit: c6a11f48cf7e4a10694bb52c1e11899cc27bcb42
2 Author: Thomas Beierlein <tomjbe <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 11 16:35:29 2018 +0000
4 Commit: Thomas Beierlein <tomjbe <AT> gentoo <DOT> org>
5 CommitDate: Fri May 11 16:36:27 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c6a11f48
7
8 app-backup/bacula: Revbump with dropped Qt4 support.
9
10 Can be used as client for older bacula server installations.
11
12 Bug: https://bugs.gentoo.org/651078
13 Package-Manager: Portage-2.3.36, Repoman-2.3.9
14
15 app-backup/bacula/bacula-5.2.13-r6.ebuild | 397 ++++++++++++++++++++++++++++++
16 1 file changed, 397 insertions(+)
17
18 diff --git a/app-backup/bacula/bacula-5.2.13-r6.ebuild b/app-backup/bacula/bacula-5.2.13-r6.ebuild
19 new file mode 100644
20 index 00000000000..463523e8d36
21 --- /dev/null
22 +++ b/app-backup/bacula/bacula-5.2.13-r6.ebuild
23 @@ -0,0 +1,397 @@
24 +# Copyright 1999-2018 Gentoo Foundation
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI="5"
28 +
29 +PYTHON_COMPAT=( python2_7 )
30 +PYTHON_REQ_USE="threads"
31 +
32 +inherit eutils multilib python-single-r1 systemd user libtool
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 examples ipv6 libressl logwatch mysql postgres python readline +sqlite ssl static tcpd vim-syntax X"
45 +
46 +DEPEND="
47 + dev-libs/gmp:0
48 + !bacula-clientonly? (
49 + postgres? ( dev-db/postgresql:=[threads] )
50 + mysql? ( virtual/mysql )
51 + sqlite? ( dev-db/sqlite:3 )
52 + !bacula-nodir? ( virtual/mta )
53 + )
54 + logwatch? ( sys-apps/logwatch )
55 + tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
56 + readline? ( sys-libs/readline:0 )
57 + static? (
58 + acl? ( virtual/acl[static-libs] )
59 + sys-libs/zlib[static-libs]
60 + dev-libs/lzo[static-libs]
61 + sys-libs/ncurses:=[static-libs]
62 + ssl? (
63 + !libressl? ( dev-libs/openssl:0=[static-libs] )
64 + libressl? ( dev-libs/libressl:0=[static-libs] )
65 + )
66 + )
67 + !static? (
68 + acl? ( virtual/acl )
69 + sys-libs/zlib
70 + dev-libs/lzo
71 + sys-libs/ncurses:=
72 + ssl? (
73 + !libressl? ( dev-libs/openssl:0= )
74 + libressl? ( dev-libs/libressl:0= )
75 + )
76 + )
77 + python? ( ${PYTHON_DEPS} )
78 + "
79 +RDEPEND="${DEPEND}
80 + !bacula-clientonly? (
81 + !bacula-nosd? (
82 + sys-block/mtx
83 + app-arch/mt-st
84 + )
85 + )
86 + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
87 +
88 +REQUIRED_USE="!bacula-clientonly? ( ^^ ( mysql postgres sqlite ) )
89 + static? ( bacula-clientonly )
90 + python? ( ${PYTHON_REQUIRED_USE} )"
91 +
92 +S=${WORKDIR}/${MY_P}
93 +
94 +pkg_setup() {
95 + #XOR and !bacula-clientonly controlled by REQUIRED_USE
96 + use mysql && export mydbtype="mysql"
97 + use postgres && export mydbtype="postgresql"
98 + use sqlite && export mydbtype="sqlite3"
99 +
100 + # create the daemon group and user
101 + if [ -z "$(egetent group bacula 2>/dev/null)" ]; then
102 + enewgroup bacula
103 + einfo
104 + einfo "The group 'bacula' has been created. Any users you add to this"
105 + einfo "group have access to files created by the daemons."
106 + einfo
107 + fi
108 +
109 + if ! use bacula-clientonly; then
110 + if [ -z "$(egetent passwd bacula 2>/dev/null)" ]; then
111 + enewuser bacula -1 -1 /var/lib/bacula bacula,disk,tape,cdrom,cdrw
112 + einfo
113 + einfo "The user 'bacula' has been created. Please see the bacula manual"
114 + einfo "for information about running bacula as a non-root user."
115 + einfo
116 + fi
117 + fi
118 +
119 + use python && python-single-r1_pkg_setup
120 +}
121 +
122 +src_prepare() {
123 + # adjusts default configuration files for several binaries
124 + # to /etc/bacula/<config> instead of ./<config>
125 + pushd src >&/dev/null || die
126 + for f in console/console.c dird/dird.c filed/filed.c \
127 + stored/bcopy.c stored/bextract.c stored/bls.c \
128 + stored/bscan.c stored/btape.c stored/stored.c \
129 + qt-console/main.cpp; do
130 + sed -i -e 's|^\(#define CONFIG_FILE "\)|\1/etc/bacula/|g' "${f}" \
131 + || die "sed on ${f} failed"
132 + done
133 + popd >&/dev/null || die
134 +
135 + # bug 466688 drop deprecated categories from Desktop file
136 + sed -i -e 's/Application;//' scripts/bat.desktop.in || die
137 +
138 + # bug 466690 Use CXXFLAGS instead of CFLAGS
139 + sed -i -e 's/@CFLAGS@/@CXXFLAGS@/' autoconf/Make.common.in || die
140 +
141 + # drop automatic install of unneeded documentation (for bug 356499)
142 + epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-doc.patch
143 +
144 + # bug #310087
145 + epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-as-needed.patch
146 +
147 + # bug #311161
148 + epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-lib-search-path.patch
149 +
150 + # stop build for errors in subdirs
151 + epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-Makefile.patch
152 +
153 + # bat needs to respect LDFLAGS
154 + epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-ldflags.patch
155 +
156 + # bug #328701
157 + epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-openssl-1.patch
158 +
159 + epatch "${FILESDIR}"/5.2.10/${PN}-5.2.10-fix-static.patch
160 +
161 + # do not strip binaries
162 + sed -i -e "s/strip /# strip /" src/filed/Makefile.in || die
163 + sed -i -e "s/strip /# strip /" src/console/Makefile.in || die
164 +
165 + # fix file not found error during make depend
166 + epatch "${FILESDIR}"/5.2.12/${PN}-5.2.12-depend.patch
167 +
168 + # Fix systemd unit files:
169 + # bug 497748
170 + sed -i -e '/Requires/d' platforms/systemd/*.service.in || die
171 + sed -i -e '/StandardOutput/d' platforms/systemd/*.service.in || die
172 + # bug 504370
173 + sed -i -e '/Alias=bacula-dir/d' platforms/systemd/bacula-dir.service.in || die
174 + # bug 584442 and 504368
175 + sed -i -e 's/@dir_user@/root/g' platforms/systemd/bacula-dir.service.in || die
176 +
177 + # Fix tmpfiles config for client-only (no bacula user) install
178 + # NOTE: Change only first occurance (user) not second (group)
179 + # bug 528398 and 577486
180 + if use bacula-clientonly; then
181 + sed -i -e 's/bacula/root/' platforms/systemd/bacula.conf.in || die
182 + fi
183 +
184 + # fix bundled libtool (bug 466696)
185 + # But first move directory with M4 macros out of the way.
186 + # It is only needed by autoconf and gives errors during elibtoolize.
187 + mv autoconf/libtool autoconf/libtool1 || die
188 + elibtoolize
189 +}
190 +
191 +src_configure() {
192 + local myconf=''
193 +
194 + if use bacula-clientonly; then
195 + myconf="${myconf} \
196 + $(use_enable bacula-clientonly client-only) \
197 + $(use_enable !static libtool) \
198 + $(use_enable static static-cons) \
199 + $(use_enable static static-fd)"
200 + else
201 + myconf="${myconf} \
202 + $(use_enable !bacula-nodir build-dird) \
203 + $(use_enable !bacula-nosd build-stored)"
204 + # bug #311099
205 + # database support needed by dir-only *and* sd-only
206 + # build as well (for building bscan, btape, etc.)
207 + myconf="${myconf} \
208 + --with-${mydbtype} \
209 + --enable-batch-insert"
210 + fi
211 +
212 + myconf="${myconf} \
213 + --disable-tray-monitor \
214 + $(use_with X x) \
215 + $(use_with python) \
216 + $(use_enable !readline conio) \
217 + $(use_enable readline) \
218 + $(use_with readline readline /usr) \
219 + $(use_with ssl openssl) \
220 + $(use_enable ipv6) \
221 + $(use_enable acl) \
222 + $(use_with tcpd tcp-wrappers)"
223 +
224 + econf \
225 + --libdir=/usr/$(get_libdir) \
226 + --docdir=/usr/share/doc/${PF} \
227 + --htmldir=/usr/share/doc/${PF}/html \
228 + --with-pid-dir=/var/run \
229 + --sysconfdir=/etc/bacula \
230 + --with-subsys-dir=/var/lock/subsys \
231 + --with-working-dir=/var/lib/bacula \
232 + --with-logdir=/var/lib/bacula \
233 + --with-scriptdir=/usr/libexec/bacula \
234 + --with-systemd=$(systemd_get_unitdir) \
235 + --with-dir-user=bacula \
236 + --with-dir-group=bacula \
237 + --with-sd-user=root \
238 + --with-sd-group=bacula \
239 + --with-fd-user=root \
240 + --with-fd-group=bacula \
241 + --enable-smartalloc \
242 + --disable-afs \
243 + --host=${CHOST} \
244 + ${myconf}
245 +}
246 +
247 +src_compile() {
248 + # Make build log verbose (bug #447806)
249 + emake NO_ECHO=""
250 +}
251 +
252 +src_install() {
253 + emake DESTDIR="${D}" install
254 + doicon scripts/bacula.png
255 +
256 + # remove some scripts we don't need at all
257 + rm -f "${D}"/usr/libexec/bacula/{bacula,bacula-ctl-dir,bacula-ctl-fd,bacula-ctl-sd,startmysql,stopmysql}
258 +
259 + # rename statically linked apps
260 + if use bacula-clientonly && use static ; then
261 + pushd "${D}"/usr/sbin || die
262 + mv static-bacula-fd bacula-fd || die
263 + mv static-bconsole bconsole || die
264 + popd || die
265 + fi
266 +
267 + # extra files which 'make install' doesn't cover
268 + if ! use bacula-clientonly; then
269 + # the database update scripts
270 + diropts -m0750
271 + insinto /usr/libexec/bacula/updatedb
272 + insopts -m0754
273 + doins "${S}"/updatedb/*
274 + fperms 0640 /usr/libexec/bacula/updatedb/README
275 +
276 + # the logrotate configuration
277 + # (now unconditional wrt bug #258187)
278 + diropts -m0755
279 + insinto /etc/logrotate.d
280 + insopts -m0644
281 + newins "${S}"/scripts/logrotate bacula
282 +
283 + # the logwatch scripts
284 + if use logwatch; then
285 + diropts -m0750
286 + dodir /etc/log.d/scripts/services
287 + dodir /etc/log.d/scripts/shared
288 + dodir /etc/log.d/conf/logfiles
289 + dodir /etc/log.d/conf/services
290 + pushd "${S}"/scripts/logwatch >&/dev/null || die
291 + emake DESTDIR="${D}" install
292 + popd >&/dev/null || die
293 + fi
294 + fi
295 +
296 + rm -vf "${D}"/usr/share/man/man1/bacula-bwxconsole.1*
297 + rm -vf "${D}"/usr/share/man/man1/bat.1*
298 + rm -vf "${D}"/usr/share/man/man1/bacula-tray-monitor.1*
299 + if use bacula-clientonly || use bacula-nodir; then
300 + rm -vf "${D}"/usr/share/man/man8/bacula-dir.8*
301 + rm -vf "${D}"/usr/share/man/man8/dbcheck.8*
302 + rm -vf "${D}"/usr/share/man/man1/bsmtp.1*
303 + rm -vf "${D}"/usr/libexec/bacula/create_*_database
304 + rm -vf "${D}"/usr/libexec/bacula/drop_*_database
305 + rm -vf "${D}"/usr/libexec/bacula/make_*_tables
306 + rm -vf "${D}"/usr/libexec/bacula/update_*_tables
307 + rm -vf "${D}"/usr/libexec/bacula/drop_*_tables
308 + rm -vf "${D}"/usr/libexec/bacula/grant_*_privileges
309 + rm -vf "${D}"/usr/libexec/bacula/*_catalog_backup
310 + fi
311 + if use bacula-clientonly || use bacula-nosd; then
312 + rm -vf "${D}"/usr/share/man/man8/bacula-sd.8*
313 + rm -vf "${D}"/usr/share/man/man8/bcopy.8*
314 + rm -vf "${D}"/usr/share/man/man8/bextract.8*
315 + rm -vf "${D}"/usr/share/man/man8/bls.8*
316 + rm -vf "${D}"/usr/share/man/man8/bscan.8*
317 + rm -vf "${D}"/usr/share/man/man8/btape.8*
318 + rm -vf "${D}"/usr/libexec/bacula/disk-changer
319 + rm -vf "${D}"/usr/libexec/bacula/mtx-changer
320 + rm -vf "${D}"/usr/libexec/bacula/dvd-handler
321 + fi
322 +
323 + # documentation
324 + dodoc ChangeLog ReleaseNotes SUPPORT technotes
325 +
326 + # install examples (bug #457504)
327 + if use examples; then
328 + docinto examples/
329 + dodoc -r examples/*
330 + fi
331 +
332 + # vim-files
333 + if use vim-syntax; then
334 + insinto /usr/share/vim/vimfiles/syntax
335 + doins scripts/bacula.vim
336 + insinto /usr/share/vim/vimfiles/ftdetect
337 + newins scripts/filetype.vim bacula_ft.vim
338 + fi
339 +
340 + # setup init scripts
341 + myscripts="bacula-fd"
342 + if ! use bacula-clientonly; then
343 + if ! use bacula-nodir; then
344 + myscripts="${myscripts} bacula-dir"
345 + fi
346 + if ! use bacula-nosd; then
347 + myscripts="${myscripts} bacula-sd"
348 + fi
349 + fi
350 + for script in ${myscripts}; do
351 + # copy over init script and config to a temporary location
352 + # so we can modify them as needed
353 + cp "${FILESDIR}/${script}".confd "${T}/${script}".confd || die "failed to copy ${script}.confd"
354 + cp "${FILESDIR}/${script}".initd "${T}/${script}".initd || die "failed to copy ${script}.initd"
355 +
356 + # now set the database dependancy for the director init script
357 + case "${script}" in
358 + bacula-dir)
359 + case "${mydbtype}" in
360 + sqlite3)
361 + # sqlite databases don't have a daemon
362 + sed -i -e 's/need "%database%"/:/g' "${T}/${script}".initd || die
363 + ;;
364 + *)
365 + # all other databases have daemons
366 + sed -i -e "s:%database%:${mydbtype}:" "${T}/${script}".initd || die
367 + ;;
368 + esac
369 + ;;
370 + *)
371 + ;;
372 + esac
373 +
374 + # install init script and config
375 + newinitd "${T}/${script}".initd "${script}"
376 + newconfd "${T}/${script}".confd "${script}"
377 + done
378 +
379 + systemd_dounit "${S}"/platforms/systemd/bacula-{dir,fd,sd}.service
380 + systemd_dotmpfilesd "${S}"/platforms/systemd/bacula.conf
381 +
382 + # make sure the working directory exists
383 + diropts -m0750
384 + keepdir /var/lib/bacula
385 +
386 + # make sure bacula group can execute bacula libexec scripts
387 + fowners -R root:bacula /usr/libexec/bacula
388 +}
389 +
390 +pkg_postinst() {
391 + if use bacula-clientonly; then
392 + fowners root:bacula /var/lib/bacula
393 + else
394 + fowners bacula:bacula /var/lib/bacula
395 + fi
396 +
397 + einfo
398 + einfo "This Revision 6 of bacula-5.2.13 dropped support for building 'bat' as"
399 + einfo "Qt4 is not longer supported by Gentoo. Please use it only for installations"
400 + einfo "requiring an old file demon."
401 + einfo
402 + if ! use bacula-clientonly && ! use bacula-nodir; then
403 + einfo
404 + einfo "If this is a new install, you must create the ${mydbtype} databases with:"
405 + einfo " /usr/libexec/bacula/create_${mydbtype}_database"
406 + einfo " /usr/libexec/bacula/make_${mydbtype}_tables"
407 + einfo " /usr/libexec/bacula/grant_${mydbtype}_privileges"
408 + einfo
409 + fi
410 +
411 + if use sqlite; then
412 + einfo
413 + einfo "Be aware that Bacula does not officially support SQLite database anymore."
414 + einfo "Best use it only for a client-only installation. See Bug #445540."
415 + einfo
416 + fi
417 +
418 + einfo "Please note that 'bconsole' will always be installed."
419 + einfo
420 +}