Gentoo Archives: gentoo-commits

From: "Andreas Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-backup/backuppc/, app-backup/backuppc/files/
Date: Fri, 07 Jul 2017 22:35:43
Message-Id: 1499466923.ecb172112c03bebc7862a6d04967f25a4d27b847.dilfridge@gentoo
1 commit: ecb172112c03bebc7862a6d04967f25a4d27b847
2 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 7 22:35:23 2017 +0000
4 Commit: Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 7 22:35:23 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ecb17211
7
8 app-backup/backuppc: Add revision bump with Perl 5.26 compatibility patch, bug 594128
9
10 Package-Manager: Portage-2.3.6, Repoman-2.3.2
11
12 app-backup/backuppc/backuppc-3.3.1-r5.ebuild | 197 +++++++++++++++++++++
13 .../backuppc/files/backuppc-3.3.1-perl526.patch | 21 +++
14 2 files changed, 218 insertions(+)
15
16 diff --git a/app-backup/backuppc/backuppc-3.3.1-r5.ebuild b/app-backup/backuppc/backuppc-3.3.1-r5.ebuild
17 new file mode 100644
18 index 00000000000..a506f581e20
19 --- /dev/null
20 +++ b/app-backup/backuppc/backuppc-3.3.1-r5.ebuild
21 @@ -0,0 +1,197 @@
22 +# Copyright 1999-2017 Gentoo Foundation
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI=5
26 +inherit depend.apache eutils user systemd
27 +
28 +MY_P="BackupPC-${PV}"
29 +
30 +DESCRIPTION="High-performance backups to a server's disk"
31 +HOMEPAGE="http://backuppc.sourceforge.net/"
32 +SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
33 +
34 +LICENSE="GPL-2"
35 +KEYWORDS="~amd64 ~x86"
36 +
37 +IUSE="rss samba"
38 +
39 +# The CGI modules are handled in $RDEPEND.
40 +APACHE_MODULES="apache2_modules_alias," # RedirectMatch
41 +APACHE_MODULES+="apache2_modules_authn_core," # AuthType
42 +APACHE_MODULES+="apache2_modules_authz_core," # Require
43 +APACHE_MODULES+="apache2_modules_authz_host," # Require host
44 +APACHE_MODULES+="apache2_modules_authz_user" # Require valid-user
45 +
46 +DEPEND="dev-lang/perl
47 + app-admin/apache-tools
48 + app-admin/makepasswd"
49 +
50 +# Older versions of mod_perl think they're compatibile with apache-2.4,
51 +# so we require the new one explicitly.
52 +RDEPEND="${DEPEND}
53 + virtual/perl-IO-Compress
54 + dev-perl/Archive-Zip
55 + dev-perl/CGI
56 + dev-perl/libwww-perl
57 + app-arch/tar
58 + app-arch/par2cmdline
59 + app-arch/gzip
60 + app-arch/bzip2
61 + virtual/mta
62 + >=www-apache/mod_perl-2.0.9
63 + www-apache/mpm_itk
64 + || ( >=www-servers/apache-2.4[${APACHE_MODULES},apache2_modules_cgi]
65 + >=www-servers/apache-2.4[${APACHE_MODULES},apache2_modules_cgid]
66 + >=www-servers/apache-2.4[${APACHE_MODULES},apache2_modules_fcgid] )
67 + net-misc/rsync
68 + dev-perl/File-RsyncP
69 + rss? ( dev-perl/XML-RSS )
70 + samba? ( net-fs/samba )"
71 +
72 +need_apache2_4
73 +
74 +SLOT="0"
75 +
76 +S="${WORKDIR}/${MY_P}"
77 +
78 +CGIDIR="/usr/lib/backuppc/htdocs"
79 +CONFDIR="/etc/BackupPC"
80 +DATADIR="/var/lib/backuppc"
81 +DOCDIR="/usr/share/doc/${PF}"
82 +LOGDIR="/var/log/BackupPC"
83 +
84 +pkg_setup() {
85 + enewgroup backuppc
86 + enewuser backuppc -1 /bin/bash /var/lib/backuppc backuppc
87 +}
88 +
89 +src_prepare() {
90 + epatch "${FILESDIR}/3.3.0/01-fix-configure.pl.patch"
91 + epatch "${FILESDIR}/3.3.0/02-fix-config.pl-formatting.patch"
92 + epatch "${FILESDIR}/3.3.0/03-reasonable-config.pl-defaults.patch"
93 +
94 + epatch "${FILESDIR}/3.2.0/04-add-docdir-marker.patch"
95 + epatch "${FILESDIR}/3.2.0/05-nicelevel.patch"
96 +
97 + epatch "${FILESDIR}"/${P}-perl522.patch #580254
98 + epatch "${FILESDIR}"/${P}-perl526.patch #594128
99 +
100 + # Fix docs location using the marker that we've patched in.
101 + sed -i "s+__DOCDIR__+${DOCDIR}+" "lib/BackupPC/CGI/View.pm" \
102 + || die "failed to sed the documentation location"
103 +}
104 +
105 +src_install() {
106 + local myconf
107 + myconf=""
108 + if use samba ; then
109 + myconf="--bin-path smbclient=$(type -p smbclient)"
110 + myconf="${myconf} --bin-path nmblookup=$(type -p nmblookup)"
111 + fi
112 +
113 + /usr/bin/env perl ./configure.pl \
114 + --batch \
115 + --bin-path perl=$(type -p perl) \
116 + --bin-path tar=$(type -p tar) \
117 + --bin-path rsync=$(type -p rsync) \
118 + --bin-path ping=$(type -p ping) \
119 + --bin-path df=$(type -p df) \
120 + --bin-path ssh=$(type -p ssh) \
121 + --bin-path sendmail=$(type -p sendmail) \
122 + --bin-path hostname=$(type -p hostname) \
123 + --bin-path gzip=$(type -p gzip) \
124 + --bin-path bzip2=$(type -p bzip2) \
125 + --config-dir "${CONFDIR}" \
126 + --install-dir /usr \
127 + --data-dir "${DATADIR}" \
128 + --hostname 127.0.0.1 \
129 + --uid-ignore \
130 + --dest-dir "${D%/}" \
131 + --html-dir "${CGIDIR}"/image \
132 + --html-dir-url /image \
133 + --cgi-dir "${CGIDIR}" \
134 + --fhs \
135 + ${myconf} || die "failed the configure.pl script"
136 +
137 + ebegin "Installing documentation"
138 +
139 + pod2man \
140 + -errors=none \
141 + --section=8 \
142 + --center="BackupPC manual" \
143 + "${S}"/doc/BackupPC.pod backuppc.8 \
144 + || die "failed to generate man page"
145 +
146 + doman backuppc.8
147 +
148 + # Place the documentation in the correct location
149 + dodoc "${D}/usr/doc/BackupPC.html"
150 + dodoc "${D}/usr/doc/BackupPC.pod"
151 + rm -rf "${D}/usr/doc" || die
152 +
153 + eend 0
154 +
155 + # Setup directories
156 + dodir "${CONFDIR}/pc"
157 +
158 + keepdir "${CONFDIR}"
159 + keepdir "${CONFDIR}/pc"
160 + keepdir "${DATADIR}"/{trash,pool,pc,cpool}
161 + keepdir "${LOGDIR}"
162 +
163 + ebegin "Setting up init.d/conf.d/systemd scripts"
164 + newinitd "${S}"/init.d/gentoo-backuppc backuppc
165 + newconfd "${S}"/init.d/gentoo-backuppc.conf backuppc
166 + systemd_dounit "${FILESDIR}/${PN}.service"
167 +
168 + insinto "${APACHE_MODULES_CONFDIR}"
169 + doins "${FILESDIR}"/99_backuppc.conf
170 +
171 + # Make sure that the ownership is correct
172 + chown -R backuppc:backuppc "${D}${CONFDIR}" || die
173 + chown -R backuppc:backuppc "${D}${DATADIR}" || die
174 + chown -R backuppc:backuppc "${D}${LOGDIR}" || die
175 +}
176 +
177 +pkg_postinst() {
178 + elog "Installation finished, you may now start using BackupPC."
179 + elog
180 + elog "- Read the documentation in /usr/share/doc/${PF}/BackupPC.html"
181 + elog " Please pay special attention to the security section."
182 + elog
183 + elog "- You can launch backuppc by running:"
184 + elog
185 + elog " # /etc/init.d/backuppc start"
186 + elog
187 + elog "- To enable the GUI, first edit ${ROOT}etc/conf.d/apache2 and add,"
188 + elog
189 + elog " \"-D BACKUPPC -D PERL -D MPM_ITK\""
190 + elog
191 + elog " to the APACHE2_OPTS line."
192 + elog
193 + elog " Then you must edit ${ROOT}etc/apache2/modules.d/00_mpm_itk.conf"
194 + elog " and adjust the values of LimitUIDRange/LimitGIDRange to include"
195 + elog " the UID and GID of the backuppc user."
196 + elog
197 + elog " Finally, start apache:"
198 + elog
199 + elog " # /etc/init.d/apache2 start"
200 + elog
201 + elog " The web interface should now be running on,"
202 + elog
203 + elog " http://127.0.0.1:8080/"
204 + elog
205 +
206 + # Generate a new password if there's no auth file
207 + if [[ ! -f "${CONFDIR}/users.htpasswd" ]]; then
208 + adminuser="backuppc"
209 + adminpass=$( makepasswd --chars=12 )
210 + htpasswd -bc "${CONFDIR}/users.htpasswd" $adminuser $adminpass
211 +
212 + elog ""
213 + elog "- Created admin user $adminuser with password $adminpass"
214 + elog " To add new users, run: "
215 + elog ""
216 + elog " # htpasswd ${CONFDIR}/users.htpasswd newUser"
217 + fi
218 +}
219
220 diff --git a/app-backup/backuppc/files/backuppc-3.3.1-perl526.patch b/app-backup/backuppc/files/backuppc-3.3.1-perl526.patch
221 new file mode 100644
222 index 00000000000..3a04f94835c
223 --- /dev/null
224 +++ b/app-backup/backuppc/files/backuppc-3.3.1-perl526.patch
225 @@ -0,0 +1,21 @@
226 +diff -ruN BackupPC-3.3.1.orig/lib/BackupPC/Lib.pm BackupPC-3.3.1/lib/BackupPC/Lib.pm
227 +--- BackupPC-3.3.1.orig/lib/BackupPC/Lib.pm 2015-01-12 01:19:53.000000000 +0100
228 ++++ BackupPC-3.3.1/lib/BackupPC/Lib.pm 2017-07-08 00:31:52.100003197 +0200
229 +@@ -1261,7 +1261,7 @@
230 + #
231 + # Replace scalar variables first
232 + #
233 +- $arg =~ s[\${(\w+)}(\+?)]{
234 ++ $arg =~ s[\$\{(\w+)}(\+?)]{
235 + exists($vars->{$1}) && ref($vars->{$1}) ne "ARRAY"
236 + ? ($2 eq "+" ? $bpc->shellEscape($vars->{$1}) : $vars->{$1})
237 + : "\${$1}$2"
238 +@@ -1270,7 +1270,7 @@
239 + # Now replicate any array arguments; this just works for just one
240 + # array var in each argument.
241 + #
242 +- if ( $arg =~ m[(.*)\${(\w+)}(\+?)(.*)] && ref($vars->{$2}) eq "ARRAY" ) {
243 ++ if ( $arg =~ m[(.*)\$\{(\w+)}(\+?)(.*)] && ref($vars->{$2}) eq "ARRAY" ) {
244 + my $pre = $1;
245 + my $var = $2;
246 + my $esc = $3;