- CONFIG_FEATURE_READLINK_FOLLOW readlink -f patch from Colin Watson <cjwatson@debian...
authorNed Ludd <solar@gentoo.org>
Sat, 11 Dec 2004 14:15:53 +0000 (14:15 +0000)
committerNed Ludd <solar@gentoo.org>
Sat, 11 Dec 2004 14:15:53 +0000 (14:15 +0000)
sys-apps/busybox/ChangeLog
sys-apps/busybox/Manifest
sys-apps/busybox/busybox-1.00-r1.ebuild [new file with mode: 0644]
sys-apps/busybox/files/1.00/busybox-read-timeout.patch [new file with mode: 0644]
sys-apps/busybox/files/1.00/readlink-follow.patch [new file with mode: 0644]
sys-apps/busybox/files/digest-busybox-1.00-r1 [new file with mode: 0644]

index 556bdb50b270ea59c711bdb264a8a9fafc5ec542..4b73cfe760011123fd09483cf3fdf13d9dc38210 100644 (file)
@@ -1,6 +1,14 @@
 # ChangeLog for sys-apps/busybox
 # Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/busybox/ChangeLog,v 1.51 2004/12/08 13:42:45 dragonheart Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/busybox/ChangeLog,v 1.52 2004/12/11 14:15:53 solar Exp $
+
+*busybox-1.00-r1 (11 Dec 2004)
+
+  11 Dec 2004; <solar@gentoo.org> +files/1.00/busybox-read-timeout.patch,
+  +files/1.00/readlink-follow.patch, +busybox-1.00-r1.ebuild:
+  - CONFIG_FEATURE_READLINK_FOLLOW readlink -f patch from Colin Watson
+  <cjwatson@debian.org> on busybox mailing list 08/11/04. - Added ash -t timeout
+  patch from plasmaroo.
 
   08 Dec 2004; Daniel Black <dragonheart@gentoo.org> busybox-1.00.ebuild:
   ppc stable as per bug 73241
index 562abd034187b68f935fa394416349f8b6e65b45..fb7f39c78b034f6a9a9b1466a16515e4ab7e94ea 100644 (file)
@@ -1,31 +1,37 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-MD5 de92a071726144028bc7cbbd9f9c51d5 ChangeLog 9846
-MD5 99fad2bf0042dc1141d3089e9f6baeb2 busybox-1.00_rc3.ebuild 6871
-MD5 f98f75be102af5709caff4cf84eaeb90 busybox-0.60.3-r1.ebuild 1091
 MD5 0e53f2aa3a8c8f426721a31ac9d978a5 busybox-1.00.ebuild 6822
-MD5 9a09f8d531c582e78977dbfd96edc1f2 metadata.xml 164
 MD5 bb58878c35f17f5bad4aa060f1dcc25e busybox-0.60.3-r2.ebuild 1183
+MD5 f5178c8fd8c1421ea0f6fa05918d1d4a busybox-1.00-r1.ebuild 7009
+MD5 f98f75be102af5709caff4cf84eaeb90 busybox-0.60.3-r1.ebuild 1091
+MD5 99fad2bf0042dc1141d3089e9f6baeb2 busybox-1.00_rc3.ebuild 6871
+MD5 e670b6cbe61335991795e8b9a777d3bb ChangeLog 10185
+MD5 9a09f8d531c582e78977dbfd96edc1f2 metadata.xml 164
+MD5 d9841a0171170d16bb121c696591e7ef files/config-netboot 9853
+MD5 335f1c2b99e52e880f3a490df9be39da files/digest-busybox-1.00-r1 66
+MD5 335f1c2b99e52e880f3a490df9be39da files/digest-busybox-1.00 66
 MD5 9ce965b12114a360496fe06e952139a8 files/Config.h 11695
 MD5 24ec3839ecb3e429bf29a819398b7753 files/Config.h-0.60.2-cd 13772
 MD5 af127cfced92352c0a43cbf63cde52bd files/Config.h-0.60.3-cd 14319
 MD5 1bce86c66f42d204c0780faee28004d6 files/Config.h-0.60.5-cd 14299
-MD5 9af76647376bd7228609763aaad090e8 files/busybox-0.60.5-dietlibc.diff 13526
-MD5 9167897ed0b558e714a92f7e2d2fe534 files/busybox-1.00-pre3.config 8804
-MD5 335f1c2b99e52e880f3a490df9be39da files/digest-busybox-1.00 66
-MD5 75d3d96c0d23ddd4ffae3daa59e0fb1e files/digest-busybox-1.00_rc3 70
-MD5 61ecae720ff226b1e543f7c1d0900043 files/digest-busybox-0.60.3-r1 66
-MD5 d9841a0171170d16bb121c696591e7ef files/config-netboot 9853
 MD5 9750d4004e6507d35f9aa67d2785fdd3 files/dodeps 2015
-MD5 3a4b93f7ec6f3aaade20029a81562b88 files/msh.diff 433
-MD5 61ecae720ff226b1e543f7c1d0900043 files/digest-busybox-0.60.3-r2 66
 MD5 4e80b04a6c57cb7341be774b55b7229c files/busybox-cmdedit-sparc.diff 568
+MD5 9167897ed0b558e714a92f7e2d2fe534 files/busybox-1.00-pre3.config 8804
 MD5 8eae5b311553ee77cda4524ab892468c files/busybox-1.00_rc3-amd64.patch 658
+MD5 61ecae720ff226b1e543f7c1d0900043 files/digest-busybox-0.60.3-r1 66
+MD5 61ecae720ff226b1e543f7c1d0900043 files/digest-busybox-0.60.3-r2 66
+MD5 9af76647376bd7228609763aaad090e8 files/busybox-0.60.5-dietlibc.diff 13526
+MD5 75d3d96c0d23ddd4ffae3daa59e0fb1e files/digest-busybox-1.00_rc3 70
+MD5 3a4b93f7ec6f3aaade20029a81562b88 files/msh.diff 433
+MD5 1587853e73bcbda7157048299fc659fe files/1.00/busybox-read-timeout.patch 1964
+MD5 f16657b6a3bf9602a65dbb5f431afbda files/1.00/readlink-follow.patch 2795
 -----BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.2.6 (GNU/Linux)
+Version: GnuPG v1.2.4 (GNU/Linux)
 
-iD8DBQFBtwTbmdTrptrqvGERAmU9AJ9of4YsyLFXGMoQLzm6lbuDfmEIhACeI6Le
-tEa2jAm1zgzkqzujPtt71dQ=
-=BbPC
+iQCVAwUBQbsA+Z4WFLgrx1GWAQKgAgP/e4Ut5PeriHOWkKKqtWlhlLw4gQPQxWwj
+4Cf/UCQrmhHhGcUSeWCm7nQafYfab5JyLvGAkBKGWyqmUYVosKBxrTo1lY8qnu5m
+yaWWKCbOkgbTANRytNpjuPJFDQ5BmEAEzJZa4wwZ4DZWBGZmSt8MaXWFpOfGnQV5
+t9y1s45Eb68=
+=n469
 -----END PGP SIGNATURE-----
diff --git a/sys-apps/busybox/busybox-1.00-r1.ebuild b/sys-apps/busybox/busybox-1.00-r1.ebuild
new file mode 100644 (file)
index 0000000..c934cfa
--- /dev/null
@@ -0,0 +1,247 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/busybox/busybox-1.00-r1.ebuild,v 1.1 2004/12/11 14:15:53 solar Exp $
+
+inherit eutils
+
+DESCRIPTION="Utilities for rescue and embedded systems"
+#SNAPSHOT=20040726
+HOMEPAGE="http://www.busybox.net/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~ppc ~mips ~arm ~amd64 ~sparc ~hppa"
+IUSE="debug uclibc static savedconfig netboot make-busybox-symlinks"
+#IUSE="${IUSE} cross"
+
+MY_PV=${PV/_/-}
+
+if [ "$SNAPSHOT" != "" ]; then
+       MY_P=${PN}
+       SRC_URI="http://www.busybox.net/downloads/snapshots/${PN}-${SNAPSHOT}.tar.bz2"
+else
+       MY_P=${PN}-${MY_PV}
+       SRC_URI="http://www.busybox.net/downloads/${MY_P}.tar.bz2"
+fi
+
+S=${WORKDIR}/${MY_P}
+
+DEPEND="virtual/libc
+       !amd64? ( uclibc? ( dev-libs/uclibc ) )
+       >=sys-apps/sed-4"
+RDEPEND="!static? ( virtual/libc )"
+
+# <pebenito> then eventually turning on selinux would mean
+# adding a dep: selinux? ( sys-libs/libselinux )
+
+busybox_config_option() {
+       [ "$2" = "" ] && return 1
+       case $1 in
+               y) sed -i -e "s:.*CONFIG_$2.*set:CONFIG_$2=y:g" .config;;
+               n) sed -i -e "s:CONFIG_$2=y:# CONFIG_$2 is not set:g" .config;;
+               *) return 1;;
+       esac
+       einfo `grep CONFIG_$2 .config`
+}
+
+src_unpack() {
+       unpack ${A}
+       cd ${S}
+
+       # patches for 1.00 go here.
+       epatch ${FILESDIR}/1.00/busybox-read-timeout.patch
+       epatch ${FILESDIR}/1.00/readlink-follow.patch
+
+       #bunzip
+       #ftp://ftp.simtreas.ru/pub/my/bb/new/find.c.gz
+
+       # check for a busybox config before making one of our own.
+       # if one exist lets return and use it.
+       # fine grained config control for user defined busybox configs.
+       # [package]-[version]-[revision].config
+       # [package]-[version].config
+       # [package].config
+
+       if use netboot ; then
+               cp ${FILESDIR}/config-netboot .config
+               sed -i \
+                       -e '/DEFAULT_SCRIPT/s:/share/udhcpc/default.script:/lib/udhcpc.script:' \
+                       networking/udhcp/libbb_udhcp.h \
+                       || die "fixing netboot/udhcpc"
+       elif use savedconfig ; then
+               [ -r .config ] && rm .config
+               for conf in ${PN}-${PV}-${PR} ${PN}-${PV} ${PN}; do
+                       configfile=/etc/${PN}/${CHOST}/${conf}.config
+                       if [ -r ${configfile} ]; then
+                               cp ${configfile} ${S}/.config
+                               break;
+                       fi
+               done
+               if [ -r "${S}/.config" ]; then
+                       einfo "Found your ${configfile} and using it."
+                       return 0
+               fi
+       fi
+
+       # busybox has changed quite a bit from 0.[5-6]* to 1.x so this
+       # config might not be cd ready.
+
+       make allyesconfig > /dev/null
+       busybox_config_option n DMALLOC
+       busybox_config_option n FEATURE_SUID
+
+       # If these are not set and we are using a uclibc/busybox setup
+       # all calls to system() will fail.
+       busybox_config_option y FEATURE_SH_IS_ASH
+       busybox_config_option n FEATURE_SH_IS_NONE
+
+       # setting the cross compiler from here would be somewhat of a
+       # pain do to as we would need a multiline sed expression which
+       # does not always seem to work so hot for me.
+
+       use static \
+               && busybox_config_option y STATIC \
+               || busybox_config_option n STATIC
+
+       # 1.00-pre2 uses the old selinux api which is no longer
+       # maintained. perhaps the next stable release will include
+       # support. 
+       # 1.00-pre5  pebenito says busybox is still using the old se api.
+       #use selinux \
+       #       && busybox_config_option y SELINUX \
+       #       || 
+       busybox_config_option n SELINUX
+
+       use debug \
+               && busybox_config_option y DEBUG \
+               || busybox_config_option n DEBUG
+
+       # Supported architectures:
+
+       # Busybox in general will build on any architecture supported by
+       # gcc.  It has a few specialized features added for __sparc__
+       # and __alpha__.  insmod functionality is currently limited to
+       # x86, ARM, SH3/4, powerpc, m68k, MIPS, and v850e.
+       case ${ARCH} in
+               alpha|sparc*)
+                       # non x86 needs to figure out what works for
+                       # them the best. sparc64 bobmed while building
+                       # ash in my tests
+                       busybox_config_option n INSMOD
+                       busybox_config_option n MODPROBE
+                       busybox_config_option n RMMOD;;
+               hppa)
+                        busybox_config_option n INSMOD;;
+               *) ;;
+       esac
+
+       #busybox_features=`grep CONFIG_ .config | tr '#' '\n' | 
+       #       awk  '{print $1}' | cut -d = -f 1 | grep -v ^$ | cut -c 8- | 
+       #               tr [A-Z] [a-z] | awk '{print "busybox_"$1}'`
+       #for f in $busybox_features; do
+       #       has $f ${FEATURES} && busybox_config_option y `echo ${f/busybox_/}|tr [a-z] [A-Z]`
+       #done
+       ( echo | make clean oldconfig > /dev/null ) || :
+}
+
+busybox_set_cross_compiler() {
+       return 0
+       # revisit this another day.
+       #if use cross ; then
+       #       case ${ARCH} in
+       #               x86*) CROSS="/usr/i386-linux-uclibc/bin/i386-uclibc-";;
+       #               *) ;;
+       #       esac
+       #fi
+       [ -n "${CROSS}" ] && einfo "Setting cross compiler prefix to ${CROSS}"
+}
+
+src_compile() {
+       busybox_set_cross_compiler
+       #emake -j1 CROSS="${CROSS}" include/config.h busybox || die
+       emake -j1 CROSS="${CROSS}" busybox || die
+}
+
+src_install() {
+       busybox_set_cross_compiler
+
+       into /
+       dobin busybox
+       if use netboot ; then
+               dosym busybox /bin/sh
+               return 0
+       fi
+       if use make-busybox-symlinks ; then
+               if [ ! "${VERY_BRAVE_OR_VERY_DUMB}" = "yes" ] && [ "${ROOT}" = "/" ];
+               then
+                       ewarn "setting USE=make-busybox-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
+               make CROSS="${CROSS}" install || die
+               dodir /bin
+               cp -a _install/bin/* ${D}/bin/
+               dodir /sbin
+               cp -a _install/sbin/* ${D}/sbin/
+               cd ${D}
+               local symlink
+               for symlink in {bin,sbin}/* ; do
+                       [ -L "${symlink}" ] || continue
+                       [ -e "${ROOT}/${symlink}" ] \
+                               && eerror "Deleting symlink ${symlink} because it exists in ${ROOT}" \
+                               && rm ${symlink}
+               done
+               cd ${S}
+       fi
+
+       dodoc AUTHORS Changelog README TODO
+
+       cd docs || die
+       docinto txt
+       dodoc *.txt
+       docinto pod
+       dodoc *.pod
+       dohtml *.html *.sgml
+
+       # no man files?
+       # cd ../man && doman *.1
+
+       cd ../examples || die
+       docinto examples
+       dodoc inittab depmod.pl
+
+       cd bootfloppy || die
+       docinto bootfloppy
+       dodoc bootfloppy.txt display.txt mkdevs.sh etc/* etc/init.d/* 2>/dev/null
+
+       cd ../../ || die
+       if has buildpkg ${FEATURES} && has keepwork ${FEATURES} ; then
+               cd ${S}
+               # this should install to the ./_install/ dir by default.
+               # we make a micro pkg of busybox that can be used for
+               # embedded systems -solar
+               if ! use make-busybox-symlinks ; then
+                       make CROSS="${CROSS}" install || die
+               fi
+               cd ./_install/ \
+                       && tar --no-same-owner -jcvf ${WORKDIR}/${MY_P}-${ARCH}.bz2 . \
+                       && cd ..
+       fi
+
+       if use savedconfig ; then
+               einfo "Saving this build config to /etc/${PN}/${CHOST}/${PN}-${PV}-${PR}.config"
+               einfo "Read this ebuild for more info on how to take advantage of this option"
+               insinto /etc/${PN}/${CHOST}/
+               newins ${S}/.config ${PN}-${PV}-${PR}.config
+       fi
+}
+
+pkg_postinst() {
+       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/1.00/busybox-read-timeout.patch b/sys-apps/busybox/files/1.00/busybox-read-timeout.patch
new file mode 100644 (file)
index 0000000..04f5d13
--- /dev/null
@@ -0,0 +1,92 @@
+diff -ur busybox-1.00/shell/ash.c busybox-1.00.plasmaroo/shell/ash.c
+--- busybox-1.00/shell/ash.c   2004-08-06 02:49:04.000000000 +0100
++++ busybox-1.00.plasmaroo/shell/ash.c 2004-10-16 20:15:43.023201048 +0100
+@@ -12580,17 +12580,33 @@
+       char *prompt;
+       const char *ifs;
+       char *p;
++#if JOBS
++      fd_set set;
++      int timeout;
++      struct timeval timeout_struct;
++      struct termios tty, old_tty;
++#endif
+       int startword;
+       int status;
+       int i;
+ 
+       rflag = 0;
+       prompt = NULL;
++#if JOBS
++      timeout = 0;
++
++      while ((i = nextopt("p:rt:")) != '\0') {
++#else
+       while ((i = nextopt("p:r")) != '\0') {
++#endif
+               if (i == 'p')
+                       prompt = optionarg;
+-              else
++              else if (i == 'r')
+                       rflag = 1;
++#if JOBS
++              else
++                      timeout = atoi(optionarg);
++#endif
+       }
+       if (prompt && isatty(0)) {
+               out2str(prompt);
+@@ -12599,11 +12615,53 @@
+               error("arg count");
+       if ((ifs = bltinlookup("IFS")) == NULL)
+               ifs = defifs;
++#if JOBS
++      c = 0;
++#endif
+       status = 0;
+       startword = 1;
+       backslash = 0;
++
+       STARTSTACKSTR(p);
++#if JOBS
++      if (timeout > 0) {
++              tcgetattr(0, &tty);
++              old_tty = tty;
++
++              /* cfmakeraw(...) disables too much; we just do this instead. */
++              tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
++              tcsetattr(0, TCSANOW, &tty);
++
++              FD_ZERO (&set);
++              FD_SET (0, &set);
++
++              timeout_struct.tv_sec = timeout;
++              timeout_struct.tv_usec = 0;
++
++              i = select (FD_SETSIZE, &set, NULL, NULL, &timeout_struct);
++              if(i == 1)
++              {
++                      read(0, &c, 1);
++                      if(c == '\n' || c == 4) /* Handle newlines and EOF */
++                              i = 0; /* Don't read further... */
++                      else
++                              STPUTC(c, p); /* Keep reading... */
++              }
++              tcsetattr(0, TCSANOW, &old_tty);
++
++              /* Echo the character so the user knows it was read...
++                 Yes, this can be done by setting the ECHO flag, but that
++                 echoes ^D and other control characters at this state */
++              if(c != 0)
++                      write(1, &c, 1);
++
++      } else
++              i = 1;
++
++      for (;i == 1;) {
++#else
+       for (;;) {
++#endif
+               if (read(0, &c, 1) != 1) {
+                       status = 1;
+                       break;
diff --git a/sys-apps/busybox/files/1.00/readlink-follow.patch b/sys-apps/busybox/files/1.00/readlink-follow.patch
new file mode 100644 (file)
index 0000000..d7ecd1b
--- /dev/null
@@ -0,0 +1,97 @@
+Index: debianutils/Config.in
+===================================================================
+RCS file: /var/cvs/busybox/debianutils/Config.in,v
+retrieving revision 1.7
+diff -p -u -r1.7 Config.in
+--- debianutils/Config.in      15 Mar 2004 08:28:24 -0000      1.7
++++ debianutils/Config.in      16 Nov 2004 11:46:41 -0000
+@@ -24,6 +24,13 @@ config CONFIG_READLINK
+         This program reads a symbolic link and returns the name
+         of the file it points to
+ 
++config CONFIG_FEATURE_READLINK_FOLLOW
++      bool "  Enable canonicalization by following all symlinks (-f)"
++      default n
++      depends on CONFIG_READLINK
++      help
++        Enable the readlink option (-f).
++
+ config CONFIG_RUN_PARTS
+       bool "run-parts"
+       default n
+Index: debianutils/readlink.c
+===================================================================
+RCS file: /var/cvs/busybox/debianutils/readlink.c,v
+retrieving revision 1.2
+diff -p -u -r1.2 readlink.c
+--- debianutils/readlink.c     19 Mar 2003 09:11:41 -0000      1.2
++++ debianutils/readlink.c     16 Nov 2004 11:46:41 -0000
+@@ -23,18 +23,38 @@
+ #include <errno.h>
+ #include <unistd.h>
+ #include <stdlib.h>
++#include <getopt.h>
+ #include "busybox.h"
+ 
++#ifdef CONFIG_FEATURE_READLINK_FOLLOW
++# define READLINK_FOLLOW      "f"
++# define READLINK_FLAG_f      (1 << 0)
++#else
++# define READLINK_FOLLOW      ""
++#endif
++
++static const char readlink_options[] = READLINK_FOLLOW;
++
+ int readlink_main(int argc, char **argv)
+ {
+       char *buf = NULL;
++      unsigned long opt = bb_getopt_ulflags(argc, argv, readlink_options);
++#ifdef CONFIG_FEATURE_READLINK_FOLLOW
++      RESERVE_CONFIG_BUFFER(resolved_path, PATH_MAX);
++#endif
+ 
+       /* no options, no getopt */
+ 
+-      if (argc != 2)
++      if (optind + 1 != argc)
+               bb_show_usage();
+ 
+-      buf = xreadlink(argv[1]);
++#ifdef CONFIG_FEATURE_READLINK_FOLLOW
++      if (opt & READLINK_FLAG_f) {
++              buf = realpath(argv[optind], resolved_path);
++      } else
++#endif
++              buf = xreadlink(argv[optind]);
++
+       if (!buf)
+               return EXIT_FAILURE;
+       puts(buf);
+Index: include/usage.h
+===================================================================
+RCS file: /var/cvs/busybox/include/usage.h,v
+retrieving revision 1.222
+diff -p -u -r1.222 usage.h
+--- include/usage.h    14 Sep 2004 16:23:56 -0000      1.222
++++ include/usage.h    16 Nov 2004 11:46:42 -0000
+@@ -1985,10 +1985,18 @@
+       "\t-s\tSet the system date and time (default).\n" \
+       "\t-p\tPrint the date and time."
+ 
++#ifdef CONFIG_FEATURE_READLINK_FOLLOW
++#define USAGE_READLINK_FOLLOW(a) a
++#else
++#define USAGE_READLINK_FOLLOW(a)
++#endif
++
+ #define readlink_trivial_usage \
+-      ""
++      USAGE_READLINK_FOLLOW("[-f] ") "FILE"
+ #define readlink_full_usage \
+-      "Displays the value of a symbolic link."
++      "Displays the value of a symbolic link." \
++      USAGE_READLINK_FOLLOW("\n\nOptions:\n" \
++      "\t-f\tcanonicalize by following all symlinks")
+ 
+ #define realpath_trivial_usage \
+       "pathname  ..."
diff --git a/sys-apps/busybox/files/digest-busybox-1.00-r1 b/sys-apps/busybox/files/digest-busybox-1.00-r1
new file mode 100644 (file)
index 0000000..659145b
--- /dev/null
@@ -0,0 +1 @@
+MD5 5c7ea9b5d3b3677dfcdcec38b281a756 busybox-1.00.tar.bz2 1118427