mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-20 05:51:18 +02:00
Merge pull request #872 from crawford/bash
app-shells/bash: sync ebuild and patches
This commit is contained in:
commit
2d27d88d32
@ -1,8 +1,8 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Copyright 1999-2014 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/bash-4.2_p20.ebuild,v 1.10 2012/03/25 16:31:53 maekke Exp $
|
||||
# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/bash-4.2_p48.ebuild,v 1.1 2014/09/24 17:23:53 polynomial-c Exp $
|
||||
|
||||
EAPI="1"
|
||||
EAPI="4"
|
||||
|
||||
inherit eutils flag-o-matic toolchain-funcs multilib
|
||||
|
||||
@ -34,15 +34,15 @@ SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
|
||||
|
||||
LICENSE="GPL-3"
|
||||
SLOT="0"
|
||||
KEYWORDS="~alpha amd64 arm hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86 ~sparc-fbsd ~x86-fbsd"
|
||||
IUSE="afs bashlogger examples mem-scramble +net nls plugins vanilla"
|
||||
KEYWORDS="alpha amd64 arm ~arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
|
||||
IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline vanilla"
|
||||
|
||||
DEPEND=">=sys-libs/ncurses-5.2-r2
|
||||
>=sys-libs/readline-6.2
|
||||
readline? ( >=sys-libs/readline-6.2 )
|
||||
nls? ( virtual/libintl )"
|
||||
RDEPEND="${DEPEND}
|
||||
!<sys-apps/portage-2.1.7.16
|
||||
!<sys-apps/paludis-0.26.0_alpha5"
|
||||
!!<sys-apps/portage-2.1.6.7_p1
|
||||
!!<sys-apps/paludis-0.26.0_alpha5"
|
||||
# we only need yacc when the .y files get patched (bash42-005)
|
||||
DEPEND+=" virtual/yacc"
|
||||
|
||||
@ -62,8 +62,9 @@ pkg_setup() {
|
||||
|
||||
src_unpack() {
|
||||
unpack ${MY_P}.tar.gz
|
||||
cd "${S}"
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
# Include official patches
|
||||
[[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
|
||||
|
||||
@ -78,10 +79,17 @@ src_unpack() {
|
||||
|
||||
epatch "${FILESDIR}"/${PN}-4.2-execute-job-control.patch #383237
|
||||
epatch "${FILESDIR}"/${PN}-4.2-parallel-build.patch
|
||||
epatch "${FILESDIR}"/${PN}-4.2-no-readline.patch
|
||||
epatch "${FILESDIR}"/${PN}-4.2-read-retry.patch #447810
|
||||
if ! use vanilla ; then
|
||||
epatch "${FILESDIR}"/${PN}-4.2-speed-up-read-N.patch
|
||||
fi
|
||||
|
||||
epatch_user
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
local myconf=
|
||||
src_configure() {
|
||||
local myconf=()
|
||||
|
||||
# For descriptions of these, see config-top.h
|
||||
# bashrc/#26952 bash_logout/#90488 ssh/#24762
|
||||
@ -98,7 +106,7 @@ src_compile() {
|
||||
# reading Bug 7714 first. If you still build it statically,
|
||||
# don't come crying to us with bugs ;).
|
||||
#use static && export LDFLAGS="${LDFLAGS} -static"
|
||||
use nls || myconf="${myconf} --disable-nls"
|
||||
use nls || myconf+=( --disable-nls )
|
||||
|
||||
# Historically, we always used the builtin readline, but since
|
||||
# our handling of SONAME upgrades has gotten much more stable
|
||||
@ -115,6 +123,7 @@ src_compile() {
|
||||
# ncurses in one or two small places :(.
|
||||
|
||||
use plugins && append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
|
||||
tc-export AR #444070
|
||||
econf \
|
||||
--with-installed-readline=. \
|
||||
--with-curses \
|
||||
@ -123,19 +132,25 @@ src_compile() {
|
||||
--disable-profiling \
|
||||
$(use_enable mem-scramble) \
|
||||
$(use_with mem-scramble bash-malloc) \
|
||||
${myconf}
|
||||
emake || die
|
||||
$(use_enable readline) \
|
||||
$(use_enable readline history) \
|
||||
$(use_enable readline bang-history) \
|
||||
"${myconf[@]}"
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
emake
|
||||
|
||||
if use plugins ; then
|
||||
emake -C examples/loadables all others || die
|
||||
emake -C examples/loadables all others
|
||||
fi
|
||||
}
|
||||
|
||||
src_install() {
|
||||
emake install DESTDIR="${D}" || die
|
||||
emake install DESTDIR="${D}"
|
||||
|
||||
dodir /bin
|
||||
mv "${D}"/usr/bin/bash "${D}"/bin/ || die
|
||||
mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
|
||||
dosym bash /bin/rbash
|
||||
|
||||
insinto /usr/share/bash
|
||||
@ -149,16 +164,27 @@ src_install() {
|
||||
dosym ../../usr/share/skel/.${f} /etc/skel/.${f}
|
||||
done
|
||||
|
||||
sed -i -e "s:#${USERLAND}#@::" \
|
||||
local sed_args=(
|
||||
-e "s:#${USERLAND}#@::"
|
||||
-e '/#@/d'
|
||||
)
|
||||
if ! use readline ; then
|
||||
sed_args+=( #432338
|
||||
-e '/^shopt -s histappend/s:^:#:'
|
||||
-e 's:use_color=true:use_color=false:'
|
||||
)
|
||||
fi
|
||||
sed -i \
|
||||
"${sed_args[@]}" \
|
||||
"${D}"/usr/share/skel/.bashrc \
|
||||
"${D}"/usr/share/bash/bashrc
|
||||
sed -i -e '/#@/d' \
|
||||
"${D}"/usr/share/skel/.bashrc \
|
||||
"${D}"/usr/share/bash/bashrc
|
||||
"${D}"/usr/share/bash/bashrc || die
|
||||
|
||||
if use plugins ; then
|
||||
exeinto /usr/$(get_libdir)/bash
|
||||
doexe $(echo examples/loadables/*.o | sed 's:\.o::g') || die
|
||||
doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
|
||||
insinto /usr/include/bash-plugins
|
||||
doins *.h builtins/*.h examples/loadables/*.h include/*.h \
|
||||
lib/{glob/glob.h,tilde/tilde.h}
|
||||
fi
|
||||
|
||||
if use examples ; then
|
||||
@ -181,24 +207,24 @@ src_install() {
|
||||
}
|
||||
|
||||
pkg_preinst() {
|
||||
if [[ -e ${ROOT}/etc/bashrc ]] && [[ ! -d ${ROOT}/etc/bash ]] ; then
|
||||
mkdir -p "${ROOT}"/etc/bash
|
||||
mv -f "${ROOT}"/etc/bashrc "${ROOT}"/etc/bash/
|
||||
if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
|
||||
mkdir -p "${EROOT}"/etc/bash
|
||||
mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
|
||||
fi
|
||||
|
||||
if [[ -L ${ROOT}/bin/sh ]]; then
|
||||
if [[ -L ${EROOT}/bin/sh ]]; then
|
||||
# rewrite the symlink to ensure that its mtime changes. having /bin/sh
|
||||
# missing even temporarily causes a fatal error with paludis.
|
||||
local target=$(readlink "${ROOT}"/bin/sh)
|
||||
local tmp=$(emktemp "${ROOT}"/bin)
|
||||
local target=$(readlink "${EROOT}"/bin/sh)
|
||||
local tmp=$(emktemp "${EROOT}"/bin)
|
||||
ln -sf "${target}" "${tmp}"
|
||||
mv -f "${tmp}" "${ROOT}"/bin/sh
|
||||
mv -f "${tmp}" "${EROOT}"/bin/sh
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
# If /bin/sh does not exist, provide it
|
||||
if [[ ! -e ${ROOT}/bin/sh ]]; then
|
||||
ln -sf bash "${ROOT}"/bin/sh
|
||||
if [[ ! -e ${EROOT}/bin/sh ]]; then
|
||||
ln -sf bash "${EROOT}"/bin/sh
|
||||
fi
|
||||
}
|
19
sdk_container/src/third_party/coreos-overlay/app-shells/bash/files/bash-4.2-no-readline.patch
vendored
Normal file
19
sdk_container/src/third_party/coreos-overlay/app-shells/bash/files/bash-4.2-no-readline.patch
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
fix building when readline is disabled
|
||||
|
||||
--- a/builtins/complete.def
|
||||
+++ b/builtins/complete.def
|
||||
@@ -49,6 +49,8 @@ $END
|
||||
|
||||
#include <config.h>
|
||||
|
||||
+#ifdef READLINE
|
||||
+
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../bashtypes.h"
|
||||
@@ -867,3 +869,5 @@ compopt_builtin (list)
|
||||
|
||||
return (ret);
|
||||
}
|
||||
+
|
||||
+#endif
|
41
sdk_container/src/third_party/coreos-overlay/app-shells/bash/files/bash-4.2-read-retry.patch
vendored
Normal file
41
sdk_container/src/third_party/coreos-overlay/app-shells/bash/files/bash-4.2-read-retry.patch
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
https://bugs.gentoo.org/447810
|
||||
|
||||
fix from upstream to workaround broken BSD kernels
|
||||
|
||||
commit 208fdb509e072977ae7a621e916dfcd32c76047d
|
||||
Author: Chet Ramey <chet@caleb.ins.cwru.edu>
|
||||
Date: Mon Mar 4 08:09:29 2013 -0500
|
||||
|
||||
commit bash-20130201 snapshot
|
||||
|
||||
diff --git a/redir.c b/redir.c
|
||||
index d7da2f3..aa3d16d 100644
|
||||
--- a/redir.c
|
||||
+++ b/redir.c
|
||||
@@ -650,7 +650,7 @@ redir_open (filename, flags, mode, ri)
|
||||
int flags, mode;
|
||||
enum r_instruction ri;
|
||||
{
|
||||
- int fd, r;
|
||||
+ int fd, r, e;
|
||||
|
||||
r = find_string_in_alist (filename, _redir_special_filenames, 1);
|
||||
if (r >= 0)
|
||||
@@ -666,7 +666,16 @@ redir_open (filename, flags, mode, ri)
|
||||
}
|
||||
else
|
||||
{
|
||||
- fd = open (filename, flags, mode);
|
||||
+ do
|
||||
+ {
|
||||
+ fd = open (filename, flags, mode);
|
||||
+ e = errno;
|
||||
+ if (fd < 0 && e == EINTR)
|
||||
+ QUIT;
|
||||
+ errno = e;
|
||||
+ }
|
||||
+ while (fd < 0 && errno == EINTR);
|
||||
+
|
||||
#if defined (AFS)
|
||||
if ((fd < 0) && (errno == EACCES))
|
||||
{
|
112
sdk_container/src/third_party/coreos-overlay/app-shells/bash/files/bash-4.2-speed-up-read-N.patch
vendored
Normal file
112
sdk_container/src/third_party/coreos-overlay/app-shells/bash/files/bash-4.2-speed-up-read-N.patch
vendored
Normal file
@ -0,0 +1,112 @@
|
||||
http://lists.gnu.org/archive/html/bug-bash/2012-11/msg00034.html
|
||||
|
||||
From 530d4988afd68ea9d2cf1b0267d4dc821d0d204f Mon Sep 17 00:00:00 2001
|
||||
From: Mike Frysinger <vapier@gentoo.org>
|
||||
Date: Mon, 19 Nov 2012 17:58:51 -0500
|
||||
Subject: [PATCH] bash: speed up `read -N`
|
||||
|
||||
Rather than using 1 byte reads, use the existing cache read logic.
|
||||
This could be sped up more, but this change is not as invasive and
|
||||
should (hopefully) be fairly safe.
|
||||
|
||||
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
||||
---
|
||||
builtins/read.def | 21 ++++++++++++++++-----
|
||||
externs.h | 1 +
|
||||
lib/sh/zread.c | 15 +++++++++++++--
|
||||
3 files changed, 30 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/builtins/read.def b/builtins/read.def
|
||||
index e32dec7..81a1b3f 100644
|
||||
--- a/builtins/read.def
|
||||
+++ b/builtins/read.def
|
||||
@@ -457,7 +457,10 @@ read_builtin (list)
|
||||
interrupt_immediately++;
|
||||
terminate_immediately++;
|
||||
|
||||
- unbuffered_read = (nchars > 0) || (delim != '\n') || input_is_pipe;
|
||||
+ if ((nchars > 0) && !input_is_tty && ignore_delim)
|
||||
+ unbuffered_read = 2;
|
||||
+ else if ((nchars > 0) || (delim != '\n') || input_is_pipe)
|
||||
+ unbuffered_read = 1;
|
||||
|
||||
if (prompt && edit == 0)
|
||||
{
|
||||
@@ -505,10 +508,18 @@ read_builtin (list)
|
||||
print_ps2 = 0;
|
||||
}
|
||||
|
||||
- if (unbuffered_read)
|
||||
- retval = zread (fd, &c, 1);
|
||||
- else
|
||||
- retval = zreadc (fd, &c);
|
||||
+ switch (unbuffered_read)
|
||||
+ {
|
||||
+ case 2:
|
||||
+ retval = zreadcn (fd, &c, nchars - nr);
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ retval = zread (fd, &c, 1);
|
||||
+ break;
|
||||
+ default:
|
||||
+ retval = zreadc (fd, &c);
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
if (retval <= 0)
|
||||
{
|
||||
diff --git a/externs.h b/externs.h
|
||||
index 09244fa..a5ad645 100644
|
||||
--- a/externs.h
|
||||
+++ b/externs.h
|
||||
@@ -479,6 +479,7 @@ extern ssize_t zread __P((int, char *, size_t));
|
||||
extern ssize_t zreadretry __P((int, char *, size_t));
|
||||
extern ssize_t zreadintr __P((int, char *, size_t));
|
||||
extern ssize_t zreadc __P((int, char *));
|
||||
+extern ssize_t zreadcn __P((int, char *, int));
|
||||
extern ssize_t zreadcintr __P((int, char *));
|
||||
extern void zreset __P((void));
|
||||
extern void zsyncfd __P((int));
|
||||
diff --git a/lib/sh/zread.c b/lib/sh/zread.c
|
||||
index 5db21a9..af7d02b 100644
|
||||
--- a/lib/sh/zread.c
|
||||
+++ b/lib/sh/zread.c
|
||||
@@ -101,15 +101,18 @@ static char lbuf[128];
|
||||
static size_t lind, lused;
|
||||
|
||||
ssize_t
|
||||
-zreadc (fd, cp)
|
||||
+zreadcn (fd, cp, len)
|
||||
int fd;
|
||||
char *cp;
|
||||
+ int len;
|
||||
{
|
||||
ssize_t nr;
|
||||
|
||||
if (lind == lused || lused == 0)
|
||||
{
|
||||
- nr = zread (fd, lbuf, sizeof (lbuf));
|
||||
+ if (len > sizeof (lbuf))
|
||||
+ len = sizeof (lbuf);
|
||||
+ nr = zread (fd, lbuf, len);
|
||||
lind = 0;
|
||||
if (nr <= 0)
|
||||
{
|
||||
@@ -123,6 +126,14 @@ zreadc (fd, cp)
|
||||
return 1;
|
||||
}
|
||||
|
||||
+ssize_t
|
||||
+zreadc (fd, cp)
|
||||
+ int fd;
|
||||
+ char *cp;
|
||||
+{
|
||||
+ return zreadcn (fd, cp, sizeof (lbuf));
|
||||
+}
|
||||
+
|
||||
/* Don't mix calls to zreadc and zreadcintr in the same function, since they
|
||||
use the same local buffer. */
|
||||
ssize_t
|
||||
--
|
||||
1.7.12.4
|
||||
|
Loading…
x
Reference in New Issue
Block a user