Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/man-db/
Date: Thu, 08 Feb 2018 11:57:04
Message-Id: 1518091017.08429f5cb1667cb39b0bbb91336179005a51d05f.polynomial-c@gentoo
1 commit: 08429f5cb1667cb39b0bbb91336179005a51d05f
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Thu Feb 8 11:56:41 2018 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Thu Feb 8 11:56:57 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08429f5c
7
8 sys-apps/man-db: Added live ebuild.
9
10 Package-Manager: Portage-2.3.24, Repoman-2.3.6
11
12 sys-apps/man-db/man-db-9999.ebuild | 122 +++++++++++++++++++++++++++++++++++++
13 1 file changed, 122 insertions(+)
14
15 diff --git a/sys-apps/man-db/man-db-9999.ebuild b/sys-apps/man-db/man-db-9999.ebuild
16 new file mode 100644
17 index 00000000000..627b8941479
18 --- /dev/null
19 +++ b/sys-apps/man-db/man-db-9999.ebuild
20 @@ -0,0 +1,122 @@
21 +# Copyright 1999-2018 Gentoo Foundation
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=6
25 +
26 +inherit ltprune user versionator
27 +
28 +DESCRIPTION="a man replacement that utilizes berkdb instead of flat files"
29 +HOMEPAGE="http://www.nongnu.org/man-db/"
30 +if [[ "${PV}" = 9999* ]] ; then
31 + inherit git-r3
32 + EGIT_REPO_URI="https://git.savannah.gnu.org/git/man-db.git"
33 +else
34 + SRC_URI="mirror://nongnu/${PN}/${P}.tar.xz"
35 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux"
36 +fi
37 +
38 +LICENSE="GPL-3"
39 +SLOT="0"
40 +IUSE="berkdb +gdbm +manpager nls seccomp selinux static-libs zlib"
41 +
42 +CDEPEND="
43 + !sys-apps/man
44 + >=dev-libs/libpipeline-1.5.0
45 + sys-apps/groff
46 + berkdb? ( sys-libs/db:= )
47 + gdbm? ( sys-libs/gdbm:= )
48 + !berkdb? ( !gdbm? ( sys-libs/gdbm:= ) )
49 + seccomp? ( sys-libs/libseccomp )
50 + zlib? ( sys-libs/zlib )
51 +"
52 +DEPEND="
53 + ${CDEPEND}
54 + app-arch/xz-utils
55 + virtual/pkgconfig
56 + nls? (
57 + >=app-text/po4a-0.45
58 + sys-devel/gettext
59 + )
60 +"
61 +RDEPEND="
62 + ${CDEPEND}
63 + selinux? ( sec-policy/selinux-mandb )
64 +"
65 +PDEPEND="manpager? ( app-text/manpager )"
66 +
67 +pkg_setup() {
68 + # Create user now as Makefile in src_install does setuid/chown
69 + enewgroup man 15
70 + enewuser man 13 -1 /usr/share/man man
71 +
72 + if (use gdbm && use berkdb) || (use !gdbm && use !berkdb) ; then #496150
73 + ewarn "Defaulting to USE=gdbm due to ambiguous berkdb/gdbm USE flag settings"
74 + fi
75 +}
76 +
77 +src_configure() {
78 + export ac_cv_lib_z_gzopen=$(usex zlib)
79 + local myeconfargs=(
80 + --docdir='$(datarootdir)'/doc/${PF}
81 + --with-systemdtmpfilesdir="${EPREFIX}"/usr/lib/tmpfiles.d
82 + --enable-setuid
83 + --enable-cache-owner=man
84 + --with-sections="1 1p 8 2 3 3p 4 5 6 7 9 0p tcl n l p o 1x 2x 3x 4x 5x 6x 7x 8x"
85 + $(use_enable nls)
86 + $(use_enable static-libs static)
87 + $(use_with seccomp libseccomp)
88 + --with-db=$(usex gdbm gdbm $(usex berkdb db gdbm))
89 + )
90 + econf "${myeconfargs[@]}"
91 +
92 + # Disable color output from groff so that the manpager can add it. #184604
93 + sed -i \
94 + -e '/^#DEFINE.*\<[nt]roff\>/{s:^#::;s:$: -c:}' \
95 + src/man_db.conf || die
96 +}
97 +
98 +src_install() {
99 + default
100 + dodoc docs/{HACKING,TODO}
101 + prune_libtool_files
102 +
103 + exeinto /etc/cron.daily
104 + newexe "${FILESDIR}"/man-db.cron man-db #289884
105 +}
106 +
107 +pkg_preinst() {
108 + local cachedir="${EROOT}var/cache/man"
109 + # If the system was already exploited, and the attacker is hiding in the
110 + # cachedir of the old man-db, let's wipe them out.
111 + # see bug #602588 comment 18
112 + local _replacing_version=
113 + local _setgid_vuln=0
114 + for _replacing_version in ${REPLACING_VERSIONS}; do
115 + if version_is_at_least '2.7.6.1-r2' "${_replacing_version}"; then
116 + debug-print "Skipping security bug #602588 ... existing installation (${_replacing_version}) should not be affected!"
117 + else
118 + _setgid_vuln=1
119 + debug-print "Applying cleanup for security bug #602588"
120 + fi
121 + done
122 + [[ ${_setgid_vuln} -eq 1 ]] && rm -rf "${cachedir}"
123 +
124 + # Fall back to recreating the cachedir
125 + if [[ ! -d ${cachedir} ]] ; then
126 + mkdir -p "${cachedir}" || die
127 + chown man:man "${cachedir}" || die
128 + fi
129 +
130 + # Update the whatis cache
131 + if [[ -f ${cachedir}/whatis ]] ; then
132 + einfo "Cleaning ${cachedir} from sys-apps/man"
133 + find "${cachedir}" -type f '!' '(' -name index.bt -o -name index.db ')' -delete
134 + fi
135 +}
136 +
137 +pkg_postinst() {
138 + if [[ $(get_version_component_range 2 ${REPLACING_VERSIONS}) -lt 7 ]] ; then
139 + einfo "Rebuilding man-db from scratch with new database format!"
140 + mandb --quiet --create
141 + fi
142 +}