From 810b2e4ad158612e2702e55e414826c882fe2e77 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 11 Jun 2011 19:54:56 +0000 Subject: Version bump, disable a bunch of utils and devfs support #371059 by Kirill Elagin, and start using libtirpc for nfs support to replace glibc #371129 by Diego Elio Pettenò. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (Portage version: 2.2.0_alpha37/cvs/Linux x86_64) --- sys-apps/busybox/ChangeLog | 11 +- sys-apps/busybox/busybox-1.18.4.ebuild | 276 ++++++++++++++++++++++ sys-apps/busybox/files/busybox-1.18.4-fuser.patch | 11 + sys-apps/busybox/files/busybox-1.18.4-hush.patch | 183 ++++++++++++++ sys-apps/busybox/metadata.xml | 1 + 5 files changed, 481 insertions(+), 1 deletion(-) create mode 100644 sys-apps/busybox/busybox-1.18.4.ebuild create mode 100644 sys-apps/busybox/files/busybox-1.18.4-fuser.patch create mode 100644 sys-apps/busybox/files/busybox-1.18.4-hush.patch (limited to 'sys-apps/busybox') diff --git a/sys-apps/busybox/ChangeLog b/sys-apps/busybox/ChangeLog index d227c98f349d..6b5e30d79073 100644 --- a/sys-apps/busybox/ChangeLog +++ b/sys-apps/busybox/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for sys-apps/busybox # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/busybox/ChangeLog,v 1.271 2011/03/27 04:48:38 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/busybox/ChangeLog,v 1.272 2011/06/11 19:54:56 vapier Exp $ + +*busybox-1.18.4 (11 Jun 2011) + + 11 Jun 2011; Mike Frysinger +busybox-1.18.4.ebuild, + +files/busybox-1.18.4-fuser.patch, +files/busybox-1.18.4-hush.patch, + metadata.xml: + Version bump, disable a bunch of utils and devfs support #371059 by Kirill + Elagin, and start using libtirpc for nfs support to replace glibc #371129 by + Diego Elio Pettenò. 27 Mar 2011; Mike Frysinger busybox-1.18.3.ebuild: We respect $CC, and LD in build defaults to $CC, so dont force LD directly diff --git a/sys-apps/busybox/busybox-1.18.4.ebuild b/sys-apps/busybox/busybox-1.18.4.ebuild new file mode 100644 index 000000000000..8d40e8223cab --- /dev/null +++ b/sys-apps/busybox/busybox-1.18.4.ebuild @@ -0,0 +1,276 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/busybox/busybox-1.18.4.ebuild,v 1.1 2011/06/11 19:54:56 vapier Exp $ + +EAPI="2" +inherit eutils flag-o-matic savedconfig toolchain-funcs + +################################################################################ +# BUSYBOX ALTERNATE CONFIG MINI-HOWTO +# +# Busybox can be modified in many different ways. Here's a few ways to do it: +# +# (1) Emerge busybox with FEATURES=keepwork so the work directory won't +# get erased afterwards. Add a definition like ROOT=/my/root/path to the +# start of the line if you're installing to somewhere else than the root +# directory. This command will save the default configuration to +# ${PORTAGE_CONFIGROOT} (or ${ROOT} if ${PORTAGE_CONFIGROOT} is not +# defined), and it will tell you that it has done this. Note the location +# where the config file was saved. +# +# FEATURES=keepwork USE=savedconfig emerge busybox +# +# (2) Go to the work directory and change the configuration of busybox using its +# menuconfig feature. +# +# cd /var/tmp/portage/busybox*/work/busybox-* +# make menuconfig +# +# (3) Save your configuration to the default location and copy it to the +# one of the locations listed in /usr/portage/eclass/savedconfig.eclass +# +# (4) Emerge busybox with USE=savedconfig to use the configuration file you +# just generated. +# +################################################################################ +# +# (1) Alternatively skip the above steps and simply emerge busybox without +# USE=savedconfig. +# +# (2) Edit the file it saves by hand. ${ROOT}"/etc/portage/savedconfig/${CATEGORY}/${PF} +# +# (3) Remerge busybox as using USE=savedconfig. +# +################################################################################ + +#SNAPSHOT=20040726 +SNAPSHOT="" + +DESCRIPTION="Utilities for rescue and embedded systems" +HOMEPAGE="http://www.busybox.net/" +if [[ -n ${SNAPSHOT} ]] ; then + MY_P=${PN} + SRC_URI="http://www.busybox.net/downloads/snapshots/${PN}-${SNAPSHOT}.tar.bz2" +else + MY_P=${PN}-${PV/_/-} + SRC_URI="http://www.busybox.net/downloads/${MY_P}.tar.bz2" +fi +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="debug ipv6 make-symlinks +mdev nfs -pam selinux static elibc_glibc" +RESTRICT="test" + +RDEPEND="selinux? ( sys-libs/libselinux ) + pam? ( sys-libs/pam )" +DEPEND="${RDEPEND} + nfs? ( || ( =net-libs/libtirpc-0.2.2-r1 ) )" + +S=${WORKDIR}/${MY_P} + +busybox_config_option() { + case $1 in + y) sed -i -e "s:.*\.*set:CONFIG_$2=y:g" .config;; + n) sed -i -e "s:CONFIG_$2=y:# CONFIG_$2 is not set:g" .config;; + *) use $1 \ + && busybox_config_option y $2 \ + || busybox_config_option n $2 + return 0 + ;; + esac + einfo $(grep "CONFIG_$2[= ]" .config || echo Could not find CONFIG_$2 ...) +} + +src_prepare() { + unset KBUILD_OUTPUT #88088 + append-flags -fno-strict-aliasing #310413 + append-cppflags $($(tc-getPKG_CONFIG) libtirpc --cflags) + + # patches go here! + epatch "${FILESDIR}"/busybox-1.18.0-bb.patch + epatch "${FILESDIR}"/busybox-${PV}-*.patch + + # flag cleanup + sed -i -r \ + -e 's:[[:space:]]?-(Werror|Os|falign-(functions|jumps|loops|labels)=1|fomit-frame-pointer)\>::g' \ + Makefile.flags || die + #sed -i '/bbsh/s:^//::' include/applets.h + sed -i '/^#error Aborting compilation./d' applets/applets.c || die + use elibc_glibc && sed -i 's:-Wl,--gc-sections::' Makefile + sed -i \ + -e "/^CROSS_COMPILE/s:=.*:= ${CHOST}-:" \ + -e "/^AR\>/s:=.*:= $(tc-getAR):" \ + -e "/^CC\>/s:=.*:= $(tc-getCC):" \ + -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \ + Makefile || die +} + +src_configure() { + # check for a busybox config before making one of our own. + # if one exist lets return and use it. + + restore_config .config + if [ -f .config ]; then + yes "" | emake -j1 oldconfig > /dev/null + return 0 + else + ewarn "Could not locate user configfile, so we will save a default one" + fi + + # setup the config file + emake -j1 allyesconfig > /dev/null + busybox_config_option n DMALLOC + busybox_config_option n FEATURE_SUID_CONFIG + busybox_config_option n BUILD_AT_ONCE + busybox_config_option n BUILD_LIBBUSYBOX + busybox_config_option n NOMMU + busybox_config_option n MONOTONIC_SYSCALL + + # If these are not set and we are using a uclibc/busybox setup + # all calls to system() will fail. + busybox_config_option y ASH + busybox_config_option n HUSH + + # disable ipv6 applets + if ! use ipv6; then + busybox_config_option n FEATURE_IPV6 + busybox_config_option n TRACEROUTE6 + busybox_config_option n PING6 + fi + + if use static && use pam ; then + ewarn "You cannot have USE='static pam'. Assuming static is more important." + fi + busybox_config_option nfs FEATURE_MOUNT_NFS + use static \ + && busybox_config_option n PAM \ + || busybox_config_option pam PAM + busybox_config_option static STATIC + busybox_config_option debug DEBUG + use debug \ + && busybox_config_option y NO_DEBUG_LIB \ + && busybox_config_option n DMALLOC \ + && busybox_config_option n EFENCE + + busybox_config_option selinux SELINUX + + # default a bunch of uncommon options to off + local opt + for opt in \ + ADD_SHELL \ + BEEP BOOTCHARTD \ + CRONTAB \ + DC DEVFS{,D} DNSD DPKG{,_DEB} \ + FAKEIDENTD FBSPLASH FOLD FSCK_MINIX FTP{GET,PUT} \ + HOSTID HUSH \ + INETD INOTIFYD IPCALC \ + LASH LOCALE_SUPPORT LOGNAME LPD \ + MAKEMIME MKFS_MINIX MSH \ + OD \ + RDEV READPROFILE REFORMIME REMOVE_SHELL RFKILL RUNSV{,DIR} \ + SLATTACH SMEMCAP SULOGIN SV{,LOGD} \ + TASKSET TCPSVD \ + RPM RPM2CPIO \ + UDPSVD UUDECODE UUENCODE + do + busybox_config_option n ${opt} + done + + emake -j1 oldconfig > /dev/null +} + +src_compile() { + unset KBUILD_OUTPUT #88088 + export SKIP_STRIP=y + + emake busybox || die "build failed" + if ! use static ; then + cp .config{,.bak} + mv busybox_unstripped{,.bak} + use pam && busybox_config_option n PAM + emake CONFIG_STATIC=y busybox || die "static build failed" + mv busybox_unstripped bb + mv busybox_unstripped{.bak,} + mv .config{.bak,} + fi +} + +src_install() { + unset KBUILD_OUTPUT #88088 + save_config .config + + into / + newbin busybox_unstripped busybox || die + if use static ; then + dosym busybox /bin/bb || die + dosym bb /bin/busybox.static || die + else + dobin bb || die + fi + if use mdev ; then + dodir /$(get_libdir)/mdev/ + use make-symlinks || dosym /bin/bb /sbin/mdev + cp "${S}"/examples/mdev_fat.conf "${D}"/etc/mdev.conf + + exeinto /$(get_libdir)/mdev/ + doexe "${FILESDIR}"/mdev/* + + insinto /$(get_libdir)/rcscripts/addons + doins "${FILESDIR}"/mdev-start.sh || die + newinitd "${FILESDIR}"/mdev.rc mdev || die + fi + + # bundle up the symlink files for use later + emake install || die + rm _install/bin/busybox + tar cf busybox-links.tar -C _install . || : #;die + insinto /usr/share/${PN} + doins busybox-links.tar || die + newins .config ${PF}.config || die + + dodoc AUTHORS README TODO + + cd docs || die + docinto txt + dodoc *.txt + docinto pod + dodoc *.pod + dohtml *.html + + cd ../examples || die + docinto examples + dodoc inittab depmod.pl *.conf *.script undeb unrpm + + cd bootfloppy || die + docinto bootfloppy + dodoc $(find . -type f) +} + +pkg_preinst() { + if use make-symlinks && [[ ! ${VERY_BRAVE_OR_VERY_DUMB} == "yes" ]] && [[ ${ROOT} == "/" ]] ; then + ewarn "setting USE=make-symlinks and emerging to / is very dangerous." + ewarn "it WILL overwrite lots of system programs like: ls bash awk grep (bug 60805 for full list)." + ewarn "If you are creating a binary only and not merging this is probably ok." + ewarn "set env VERY_BRAVE_OR_VERY_DUMB=yes if this is realy what you want." + die "silly options will destroy your system" + fi + + if use make-symlinks ; then + mv "${D}"/usr/share/${PN}/busybox-links.tar "${T}"/ || die + fi +} + +pkg_postinst() { + if use make-symlinks ; then + cd "${T}" || die + mkdir _install + tar xf busybox-links.tar -C _install || die + cp -vpPR _install/* "${ROOT}"/ || die "copying links for ${x} failed" + fi + + echo + einfo "This ebuild has support for user defined configs" + einfo "Please read this ebuild for more details and re-emerge as needed" + einfo "if you want to add or remove functionality for ${PN}" + echo +} diff --git a/sys-apps/busybox/files/busybox-1.18.4-fuser.patch b/sys-apps/busybox/files/busybox-1.18.4-fuser.patch new file mode 100644 index 000000000000..838d9acca28b --- /dev/null +++ b/sys-apps/busybox/files/busybox-1.18.4-fuser.patch @@ -0,0 +1,11 @@ +--- busybox-1.18.4/procps/fuser.c ++++ busybox-1.18.4-fuser/procps/fuser.c +@@ -271,7 +271,7 @@ Find processes which use FILEs or PORTs + if (sscanf(*pp, "%u/%4s", &port, tproto) != 2) + goto file; + sprintf(path, "/proc/net/%s", tproto); +- if (access(path, R_OK) != 0) { /* PORT/PROTO */ ++ if (access(path, R_OK) == 0) { /* PORT/PROTO */ + scan_proc_net(path, port); + } else { /* FILE */ + file: diff --git a/sys-apps/busybox/files/busybox-1.18.4-hush.patch b/sys-apps/busybox/files/busybox-1.18.4-hush.patch new file mode 100644 index 000000000000..1e5a5cfcb4be --- /dev/null +++ b/sys-apps/busybox/files/busybox-1.18.4-hush.patch @@ -0,0 +1,183 @@ +--- busybox-1.18.4/shell/hush.c ++++ busybox-1.18.4-hush/shell/hush.c +@@ -427,6 +427,15 @@ enum { + /* Used for initialization: o_string foo = NULL_O_STRING; */ + #define NULL_O_STRING { NULL } + ++#ifndef debug_printf_parse ++static const char *const assignment_flag[] = { ++ "MAYBE_ASSIGNMENT", ++ "DEFINITELY_ASSIGNMENT", ++ "NOT_ASSIGNMENT", ++ "WORD_IS_KEYWORD", ++}; ++#endif ++ + /* I can almost use ordinary FILE*. Is open_memstream() universally + * available? Where is it documented? */ + typedef struct in_str { +@@ -2885,24 +2894,24 @@ static const struct reserved_combo* matc + */ + static const struct reserved_combo reserved_list[] = { + # if ENABLE_HUSH_IF +- { "!", RES_NONE, NOT_ASSIGNMENT , 0 }, +- { "if", RES_IF, WORD_IS_KEYWORD, FLAG_THEN | FLAG_START }, +- { "then", RES_THEN, WORD_IS_KEYWORD, FLAG_ELIF | FLAG_ELSE | FLAG_FI }, +- { "elif", RES_ELIF, WORD_IS_KEYWORD, FLAG_THEN }, +- { "else", RES_ELSE, WORD_IS_KEYWORD, FLAG_FI }, +- { "fi", RES_FI, NOT_ASSIGNMENT , FLAG_END }, ++ { "!", RES_NONE, NOT_ASSIGNMENT , 0 }, ++ { "if", RES_IF, MAYBE_ASSIGNMENT, FLAG_THEN | FLAG_START }, ++ { "then", RES_THEN, MAYBE_ASSIGNMENT, FLAG_ELIF | FLAG_ELSE | FLAG_FI }, ++ { "elif", RES_ELIF, MAYBE_ASSIGNMENT, FLAG_THEN }, ++ { "else", RES_ELSE, MAYBE_ASSIGNMENT, FLAG_FI }, ++ { "fi", RES_FI, NOT_ASSIGNMENT , FLAG_END }, + # endif + # if ENABLE_HUSH_LOOPS +- { "for", RES_FOR, NOT_ASSIGNMENT , FLAG_IN | FLAG_DO | FLAG_START }, +- { "while", RES_WHILE, WORD_IS_KEYWORD, FLAG_DO | FLAG_START }, +- { "until", RES_UNTIL, WORD_IS_KEYWORD, FLAG_DO | FLAG_START }, +- { "in", RES_IN, NOT_ASSIGNMENT , FLAG_DO }, +- { "do", RES_DO, WORD_IS_KEYWORD, FLAG_DONE }, +- { "done", RES_DONE, NOT_ASSIGNMENT , FLAG_END }, ++ { "for", RES_FOR, NOT_ASSIGNMENT , FLAG_IN | FLAG_DO | FLAG_START }, ++ { "while", RES_WHILE, MAYBE_ASSIGNMENT, FLAG_DO | FLAG_START }, ++ { "until", RES_UNTIL, MAYBE_ASSIGNMENT, FLAG_DO | FLAG_START }, ++ { "in", RES_IN, NOT_ASSIGNMENT , FLAG_DO }, ++ { "do", RES_DO, MAYBE_ASSIGNMENT, FLAG_DONE }, ++ { "done", RES_DONE, NOT_ASSIGNMENT , FLAG_END }, + # endif + # if ENABLE_HUSH_CASE +- { "case", RES_CASE, NOT_ASSIGNMENT , FLAG_MATCH | FLAG_START }, +- { "esac", RES_ESAC, NOT_ASSIGNMENT , FLAG_END }, ++ { "case", RES_CASE, NOT_ASSIGNMENT , FLAG_MATCH | FLAG_START }, ++ { "esac", RES_ESAC, NOT_ASSIGNMENT , FLAG_END }, + # endif + }; + const struct reserved_combo *r; +@@ -2968,6 +2977,7 @@ static int reserved_word(o_string *word, + ctx->ctx_res_w = r->res; + ctx->old_flag = r->flag; + word->o_assignment = r->assignment_flag; ++ debug_printf_parse("word->o_assignment='%s'\n", assignment_flag[word->o_assignment]); + + if (ctx->old_flag & FLAG_END) { + struct parse_context *old; +@@ -3034,18 +3044,6 @@ static int done_word(o_string *word, str + debug_printf_parse("word stored in rd_filename: '%s'\n", word->data); + ctx->pending_redirect = NULL; + } else { +- /* If this word wasn't an assignment, next ones definitely +- * can't be assignments. Even if they look like ones. */ +- if (word->o_assignment != DEFINITELY_ASSIGNMENT +- && word->o_assignment != WORD_IS_KEYWORD +- ) { +- word->o_assignment = NOT_ASSIGNMENT; +- } else { +- if (word->o_assignment == DEFINITELY_ASSIGNMENT) +- command->assignment_cnt++; +- word->o_assignment = MAYBE_ASSIGNMENT; +- } +- + #if HAS_KEYWORDS + # if ENABLE_HUSH_CASE + if (ctx->ctx_dsemicolon +@@ -3065,8 +3063,9 @@ static int done_word(o_string *word, str + && ctx->ctx_res_w != RES_CASE + # endif + ) { +- debug_printf_parse("checking '%s' for reserved-ness\n", word->data); +- if (reserved_word(word, ctx)) { ++ int reserved = reserved_word(word, ctx); ++ debug_printf_parse("checking for reserved-ness: %d\n", reserved); ++ if (reserved) { + o_reset_to_empty_unquoted(word); + debug_printf_parse("done_word return %d\n", + (ctx->ctx_res_w == RES_SNTX)); +@@ -3087,6 +3086,23 @@ static int done_word(o_string *word, str + "groups and arglists don't mix\n"); + return 1; + } ++ ++ /* If this word wasn't an assignment, next ones definitely ++ * can't be assignments. Even if they look like ones. */ ++ if (word->o_assignment != DEFINITELY_ASSIGNMENT ++ && word->o_assignment != WORD_IS_KEYWORD ++ ) { ++ word->o_assignment = NOT_ASSIGNMENT; ++ } else { ++ if (word->o_assignment == DEFINITELY_ASSIGNMENT) { ++ command->assignment_cnt++; ++ debug_printf_parse("++assignment_cnt=%d\n", command->assignment_cnt); ++ } ++ debug_printf_parse("word->o_assignment was:'%s'\n", assignment_flag[word->o_assignment]); ++ word->o_assignment = MAYBE_ASSIGNMENT; ++ } ++ debug_printf_parse("word->o_assignment='%s'\n", assignment_flag[word->o_assignment]); ++ + if (word->has_quoted_part + /* optimization: and if it's ("" or '') or ($v... or `cmd`...): */ + && (word->data[0] == '\0' || word->data[0] == SPECIAL_VAR_SYMBOL) +@@ -4105,6 +4121,7 @@ static struct pipe *parse_stream(char ** + && is_well_formed_var_name(dest.data, '=') + ) { + dest.o_assignment = DEFINITELY_ASSIGNMENT; ++ debug_printf_parse("dest.o_assignment='%s'\n", assignment_flag[dest.o_assignment]); + } + continue; + } +@@ -4154,6 +4171,7 @@ static struct pipe *parse_stream(char ** + heredoc_cnt = 0; + } + dest.o_assignment = MAYBE_ASSIGNMENT; ++ debug_printf_parse("dest.o_assignment='%s'\n", assignment_flag[dest.o_assignment]); + ch = ';'; + /* note: if (is_blank) continue; + * will still trigger for us */ +@@ -4203,6 +4221,7 @@ static struct pipe *parse_stream(char ** + } + done_pipe(&ctx, PIPE_SEQ); + dest.o_assignment = MAYBE_ASSIGNMENT; ++ debug_printf_parse("dest.o_assignment='%s'\n", assignment_flag[dest.o_assignment]); + /* Do we sit outside of any if's, loops or case's? */ + if (!HAS_KEYWORDS + IF_HAS_KEYWORDS(|| (ctx.ctx_res_w == RES_NONE && ctx.old_flag == 0)) +@@ -4309,6 +4328,7 @@ static struct pipe *parse_stream(char ** + /* ch is a special char and thus this word + * cannot be an assignment */ + dest.o_assignment = NOT_ASSIGNMENT; ++ debug_printf_parse("dest.o_assignment='%s'\n", assignment_flag[dest.o_assignment]); + } + + /* Note: nommu_addchr(&ctx.as_string, ch) is already done */ +@@ -4406,6 +4426,7 @@ static struct pipe *parse_stream(char ** + /* We just finished a cmd. New one may start + * with an assignment */ + dest.o_assignment = MAYBE_ASSIGNMENT; ++ debug_printf_parse("dest.o_assignment='%s'\n", assignment_flag[dest.o_assignment]); + break; + case '&': + if (done_word(&dest, &ctx)) { +@@ -7292,7 +7313,10 @@ static int run_list(struct pipe *pi) + #endif + #if ENABLE_HUSH_LOOPS + /* Beware of "while false; true; do ..."! */ +- if (pi->next && pi->next->res_word == RES_DO) { ++ if (pi->next ++ && (pi->next->res_word == RES_DO || pi->next->res_word == RES_DONE) ++ /* (the second check above is needed for "while ...; do \n done" case) */ ++ ) { + if (rword == RES_WHILE) { + if (rcode) { + /* "while false; do...done" - exitcode 0 */ +--- busybox-1.18.4/shell/hush_test/hush-misc/while3.right ++++ busybox-1.18.4-hush/shell/hush_test/hush-misc/while3.right +@@ -0,0 +1 @@ ++OK:0 +--- busybox-1.18.4/shell/hush_test/hush-misc/while3.tests ++++ busybox-1.18.4-hush/shell/hush_test/hush-misc/while3.tests +@@ -0,0 +1,4 @@ ++while false; do ++ # bash will require at least ":" here... ++done ++echo OK:$? diff --git a/sys-apps/busybox/metadata.xml b/sys-apps/busybox/metadata.xml index 38a4c15a0b94..dba645e38ea8 100644 --- a/sys-apps/busybox/metadata.xml +++ b/sys-apps/busybox/metadata.xml @@ -5,5 +5,6 @@ Create all the appropriate symlinks in /bin and /sbin. Create the appropriate symlink in /sbin and install mdev.conf and support files +Support mounting nfs shares -- cgit v1.2.3-65-gdbad