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: app-shells/bash/
Date: Sun, 04 Dec 2016 16:09:56
Message-Id: 1480867784.c3d3bdc215881e2712843708c42978b7bac96ba9.polynomial-c@gentoo
1 commit: c3d3bdc215881e2712843708c42978b7bac96ba9
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Sun Dec 4 16:06:54 2016 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 4 16:09:44 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c3d3bdc2
7
8 app-shells/bash: Revbump to add popd offset overflow fix to bash-4.3 (#600174).
9
10 Package-Manager: portage-2.3.2
11
12 app-shells/bash/bash-4.3_p48-r1.ebuild | 253 +++++++++++++++++++++++++++++++++
13 1 file changed, 253 insertions(+)
14
15 diff --git a/app-shells/bash/bash-4.3_p48-r1.ebuild b/app-shells/bash/bash-4.3_p48-r1.ebuild
16 new file mode 100644
17 index 00000000..96ab004
18 --- /dev/null
19 +++ b/app-shells/bash/bash-4.3_p48-r1.ebuild
20 @@ -0,0 +1,253 @@
21 +# Copyright 1999-2016 Gentoo Foundation
22 +# Distributed under the terms of the GNU General Public License v2
23 +# $Id$
24 +
25 +EAPI="5"
26 +
27 +inherit eutils flag-o-matic toolchain-funcs multilib
28 +
29 +# Official patchlevel
30 +# See ftp://ftp.cwru.edu/pub/bash/bash-4.3-patches/
31 +PLEVEL=${PV##*_p}
32 +MY_PV=${PV/_p*}
33 +MY_PV=${MY_PV/_/-}
34 +MY_P=${PN}-${MY_PV}
35 +[[ ${PV} != *_p* ]] && PLEVEL=0
36 +patches() {
37 + local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
38 + [[ ${plevel} -eq 0 ]] && return 1
39 + eval set -- {1..${plevel}}
40 + set -- $(printf "${pn}${pv/\.}-%03d " "$@")
41 + if [[ ${opt} == -s ]] ; then
42 + echo "${@/#/${DISTDIR}/}"
43 + else
44 + local u
45 + for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
46 + printf "${u}/${pn}-${pv}-patches/%s " "$@"
47 + done
48 + fi
49 +}
50 +
51 +# The version of readline this bash normally ships with.
52 +READLINE_VER="6.3"
53 +
54 +DESCRIPTION="The standard GNU Bourne again shell"
55 +HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
56 +SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
57 +[[ ${PV} == *_rc* ]] && SRC_URI+=" ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
58 +
59 +LICENSE="GPL-3"
60 +SLOT="0"
61 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
62 +IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
63 +
64 +DEPEND=">=sys-libs/ncurses-5.2-r2:0=
65 + readline? ( >=sys-libs/readline-${READLINE_VER}:0= )
66 + nls? ( virtual/libintl )"
67 +RDEPEND="${DEPEND}
68 + !<sys-apps/portage-2.1.6.7_p1
69 + !<sys-apps/paludis-0.26.0_alpha5"
70 +# we only need yacc when the .y files get patched (bash42-005)
71 +DEPEND+=" virtual/yacc"
72 +
73 +PATCHES=(
74 + "${FILESDIR}"/${PN}-4.3-mapfile-improper-array-name-validation.patch
75 + "${FILESDIR}"/${PN}-4.3-arrayfunc.patch
76 + "${FILESDIR}"/${PN}-4.3-protos.patch
77 + "${FILESDIR}"/${PN}-4.4-popd-offset-overflow.patch #600174
78 +)
79 +
80 +S=${WORKDIR}/${MY_P}
81 +
82 +pkg_setup() {
83 + if is-flag -malign-double ; then #7332
84 + eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
85 + eerror "as it breaks LFS (struct stat64) on x86."
86 + die "remove -malign-double from your CFLAGS mr ricer"
87 + fi
88 + if use bashlogger ; then
89 + ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
90 + ewarn "This will log ALL output you enter into the shell, you have been warned."
91 + fi
92 +}
93 +
94 +src_unpack() {
95 + unpack ${MY_P}.tar.gz
96 +}
97 +
98 +src_prepare() {
99 + # Include official patches
100 + [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
101 +
102 + # Clean out local libs so we know we use system ones w/releases.
103 + if [[ ${PV} != *_rc* ]] ; then
104 + rm -rf lib/{readline,termcap}/*
105 + touch lib/{readline,termcap}/Makefile.in # for config.status
106 + sed -ri -e 's:\$[(](RL|HIST)_LIBSRC[)]/[[:alpha:]]*.h::g' Makefile.in || die
107 + fi
108 +
109 + # Avoid regenerating docs after patches #407985
110 + sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
111 + touch -r . doc/*
112 +
113 + epatch "${PATCHES[@]}"
114 +
115 + epatch_user
116 +}
117 +
118 +src_configure() {
119 + local myconf=()
120 +
121 + # For descriptions of these, see config-top.h
122 + # bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
123 + append-cppflags \
124 + -DDEFAULT_PATH_VALUE=\'\"${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin\"\' \
125 + -DSTANDARD_UTILS_PATH=\'\"${EPREFIX}/bin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/usr/sbin\"\' \
126 + -DSYS_BASHRC=\'\"${EPREFIX}/etc/bash/bashrc\"\' \
127 + -DSYS_BASH_LOGOUT=\'\"${EPREFIX}/etc/bash/bash_logout\"\' \
128 + -DNON_INTERACTIVE_LOGIN_SHELLS \
129 + -DSSH_SOURCE_BASHRC \
130 + -DUSE_MKTEMP -DUSE_MKSTEMP \
131 + $(use bashlogger && echo -DSYSLOG_HISTORY)
132 +
133 + # Don't even think about building this statically without
134 + # reading Bug 7714 first. If you still build it statically,
135 + # don't come crying to us with bugs ;).
136 + #use static && export LDFLAGS="${LDFLAGS} -static"
137 + use nls || myconf+=( --disable-nls )
138 +
139 + # Historically, we always used the builtin readline, but since
140 + # our handling of SONAME upgrades has gotten much more stable
141 + # in the PM (and the readline ebuild itself preserves the old
142 + # libs during upgrades), linking against the system copy should
143 + # be safe.
144 + # Exact cached version here doesn't really matter as long as it
145 + # is at least what's in the DEPEND up above.
146 + export ac_cv_rl_version=${READLINE_VER}
147 +
148 + # Force linking with system curses ... the bundled termcap lib
149 + # sucks bad compared to ncurses. For the most part, ncurses
150 + # is here because readline needs it. But bash itself calls
151 + # ncurses in one or two small places :(.
152 +
153 + if [[ ${PV} != *_rc* ]] ; then
154 + # Use system readline only with released versions.
155 + myconf+=( --with-installed-readline=. )
156 + fi
157 +
158 + if use plugins; then
159 + append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
160 + else
161 + # Disable the plugins logic by hand since bash doesn't
162 + # provide a way of doing it.
163 + export ac_cv_func_dl{close,open,sym}=no \
164 + ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
165 + sed -i \
166 + -e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
167 + configure || die
168 + fi
169 + tc-export AR #444070
170 + econf \
171 + --docdir='$(datarootdir)'/doc/${PF} \
172 + --htmldir='$(docdir)/html' \
173 + --with-curses \
174 + $(use_with afs) \
175 + $(use_enable net net-redirections) \
176 + --disable-profiling \
177 + $(use_enable mem-scramble) \
178 + $(use_with mem-scramble bash-malloc) \
179 + $(use_enable readline) \
180 + $(use_enable readline history) \
181 + $(use_enable readline bang-history) \
182 + "${myconf[@]}"
183 +}
184 +
185 +src_compile() {
186 + emake
187 +
188 + if use plugins ; then
189 + emake -C examples/loadables all others
190 + fi
191 +}
192 +
193 +src_install() {
194 + local d f
195 +
196 + default
197 +
198 + dodir /bin
199 + mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
200 + dosym bash /bin/rbash
201 +
202 + insinto /etc/bash
203 + doins "${FILESDIR}"/bash_logout
204 + doins "${FILESDIR}"/bashrc
205 + keepdir /etc/bash/bashrc.d
206 + insinto /etc/skel
207 + for f in bash{_logout,_profile,rc} ; do
208 + newins "${FILESDIR}"/dot-${f} .${f}
209 + done
210 +
211 + local sed_args=(
212 + -e "s:#${USERLAND}#@::"
213 + -e '/#@/d'
214 + )
215 + if ! use readline ; then
216 + sed_args+=( #432338
217 + -e '/^shopt -s histappend/s:^:#:'
218 + -e 's:use_color=true:use_color=false:'
219 + )
220 + fi
221 + sed -i \
222 + "${sed_args[@]}" \
223 + "${ED}"/etc/skel/.bashrc \
224 + "${ED}"/etc/bash/bashrc || die
225 +
226 + if use plugins ; then
227 + exeinto /usr/$(get_libdir)/bash
228 + doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
229 + insinto /usr/include/bash-plugins
230 + doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
231 + fi
232 +
233 + if use examples ; then
234 + for d in examples/{functions,misc,scripts,startup-files} ; do
235 + exeinto /usr/share/doc/${PF}/${d}
236 + insinto /usr/share/doc/${PF}/${d}
237 + for f in ${d}/* ; do
238 + if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
239 + doexe ${f}
240 + else
241 + doins ${f}
242 + fi
243 + done
244 + done
245 + fi
246 +
247 + doman doc/*.1
248 + newdoc CWRU/changelog ChangeLog
249 + dosym bash.info /usr/share/info/bashref.info
250 +}
251 +
252 +pkg_preinst() {
253 + if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
254 + mkdir -p "${EROOT}"/etc/bash
255 + mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
256 + fi
257 +
258 + if [[ -L ${EROOT}/bin/sh ]] ; then
259 + # rewrite the symlink to ensure that its mtime changes. having /bin/sh
260 + # missing even temporarily causes a fatal error with paludis.
261 + local target=$(readlink "${EROOT}"/bin/sh)
262 + local tmp=$(emktemp "${EROOT}"/bin)
263 + ln -sf "${target}" "${tmp}"
264 + mv -f "${tmp}" "${EROOT}"/bin/sh
265 + fi
266 +}
267 +
268 +pkg_postinst() {
269 + # If /bin/sh does not exist, provide it
270 + if [[ ! -e ${EROOT}/bin/sh ]] ; then
271 + ln -sf bash "${EROOT}"/bin/sh
272 + fi
273 +}