changeset 1582:6a8114c148d1

Lots of small improvements: check for toybox instead of busybox for host-tools $PATH adjustment, better manifest generation (with toybox in list), make package_cache function to find extracted source (so root-image.sh works when packages contains linux-git snapshot), fix more/record-commands.sh path adjustment.
author Rob Landley <rob@landley.net>
date Sun, 17 Feb 2013 22:25:00 -0600
parents f9b0ebfbdd1b
children 307f4415d2bf
files host-tools.sh root-image.sh sources/download_functions.sh sources/functions.sh sources/include.sh
diffstat 5 files changed, 28 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/host-tools.sh	Sun Feb 17 22:19:55 2013 -0600
+++ b/host-tools.sh	Sun Feb 17 22:25:00 2013 -0600
@@ -24,6 +24,7 @@
 # false information to autoconf or attach themselves as dependencies to
 # the newly generated programs.  (In practice, this can be quite fiddly.)
 
+SAVEPATH="$PATH"
 source sources/include.sh || exit 1
 
 STAGE_DIR="${HOSTTOOLS}"
@@ -102,7 +103,7 @@
 
     X=0
     FALLBACK="$STAGE_DIR"
-    PATH="$OLDPATH" "$STAGE_DIR/which" -a "$i" | while read j
+    PATH="$SAVEPATH" "$STAGE_DIR/which" -a "$i" | while read j
     do
       if [ ! -e "$FALLBACK/$i" ]
       then
@@ -125,7 +126,7 @@
 # Workaround for a bug in Ubuntu 10.04 where gcc became a perl script calling
 # gcc.real.  Systems that aren't crazy don't need this.
 
-ET_TU_UBUNTU="$(PATH="$OLDPATH" "$STAGE_DIR/which" gcc.real)"
+ET_TU_UBUNTU="$(PATH="$SAVEPATH" "$STAGE_DIR/which" gcc.real)"
 [ ! -z "$ET_TU_UBUNTU" ] && ln -s "$ET_TU_UBUNTU" "$STAGE_DIR/gcc.real" 2>/dev/null
 
 # We now have all the tools we need in $STAGE_DIR, so trim the $PATH to
--- a/root-image.sh	Sun Feb 17 22:19:55 2013 -0600
+++ b/root-image.sh	Sun Feb 17 22:25:00 2013 -0600
@@ -37,7 +37,8 @@
 then
   # Borrow gen_init_cpio.c out of package cache copy of Linux source
   extract_package linux &&
-  $CC "$SRCTREE/$PACKAGE/usr/gen_init_cpio.c" -o my_gen_init_cpio || dienow
+  $CC "$(package_cache $PACKAGE)/usr/gen_init_cpio.c" -o my_gen_init_cpio ||
+    dienow
   ./my_gen_init_cpio <(
       "$SOURCES"/toys/gen_initramfs_list.sh "$NATIVE_ROOT" || dienow
       [ ! -e "$NATIVE_ROOT"/init ] &&
--- a/sources/download_functions.sh	Sun Feb 17 22:19:55 2013 -0600
+++ b/sources/download_functions.sh	Sun Feb 17 22:25:00 2013 -0600
@@ -49,6 +49,21 @@
   done
 }
 
+package_cache()
+{
+  SNAPFROM="$SRCDIR/$1"
+  (is_in_list "$1" "$IGNORE_REPOS" || [ ! -d "$SNAPFROM" ]) &&
+    SNAPFROM="$SRCTREE/$1"
+
+  if [ ! -d "$SNAPFROM" ]
+  then
+    echo "$1 not found.  Did you run download.sh?" >&2
+    dienow
+  fi
+
+  echo "$SNAPFROM"
+}
+
 # Extract tarball named in $1 and apply all relevant patches into
 # "$BUILD/packages/$1".  Record sha1sum of tarball and patch files in
 # sha1-for-source.txt.  Re-extract if tarball or patches change.
@@ -100,7 +115,7 @@
     for i in "$SHA1TAR" $(sha1file "$PATCHDIR/$PACKAGE"-* 2>/dev/null)
     do
       # Is this sha1 in the file?
-      if [ -z "$(echo "$SHALIST" | sed -n "s/$i/$i/p" )" ]
+      if [ -z "$(echo "$SHALIST" | grep "$i")" ]
       then
         SHALIST=missing
         break
--- a/sources/functions.sh	Sun Feb 17 22:19:55 2013 -0600
+++ b/sources/functions.sh	Sun Feb 17 22:25:00 2013 -0600
@@ -191,22 +191,13 @@
 
   # Make sure the source is already extracted and up-to-date.
   extract_package "$1" || exit 1
+  SNAPFROM="$(package_cache "$1")"
 
   # Delete old working copy (even in the NO_CLEANUP case) then make a new
   # tree of links to the package cache.
 
   echo "Snapshot '$PACKAGE'..."
 
-  SNAPFROM="$SRCDIR/$PACKAGE"
-  (is_in_list "$PACKAGE" "$IGNORE_REPOS" || [ ! -d "$SNAPFROM" ]) &&
-    SNAPFROM="$SRCTREE/$PACKAGE"
-
-  if [ ! -d "$SNAPFROM" ]
-  then
-    echo "$PACKAGE not found.  Did you run download.sh?" >&2
-    dienow
-  fi
-
   # Try hardlink, then symlink, then normal (noclobber) copy
   for LINKTYPE in l s n
   do
@@ -261,13 +252,13 @@
   then
     (
       cd "$DIR" || dienow
-      ID="$(git show --pretty=oneline | cut -b 1-16)"
+      ID="$(git log -1 --format=%H 2>/dev/null)"
       [ ! -z "$ID" ] && echo git "$ID" && return
 
-      ID="$(hg identify -n)"
+      ID="$(hg identify -n 2>/dev/null)"
       [ ! -z "$ID" ] && echo hg "$ID" && return
 
-      ID="$(svn info | sed -n "s/^Revision: //p")"
+      ID="$(svn info 2>/dev/null | sed -n "s/^Revision: //p")"
       [ ! -z "$ID" ] && echo svn "$ID" && return
     )
   fi
@@ -282,7 +273,7 @@
   # Grab build script version number
 
   [ -z "$SCRIPT_VERS" ] &&
-    SCRIPT_VERS="mercurial rev $(cd "$TOP"; hg tip 2>/dev/null | sed -n 's/changeset: *\([0-9]*\).*/\1/p')"
+    SCRIPT_VERS="mercurial rev $(cd "$TOP"; hg identify -n 2>/dev/null)"
 
   cat << EOF
 Built on $(date +%F) from:
@@ -294,6 +285,7 @@
     uClibc (http://uclibc.org) $(identify_release uClibc)
     BusyBox (http://busybox.net) $(identify_release busybox)
     Linux (http://kernel.org/pub/linux/kernel) $(identify_release linux)
+    toybox (http://landley.net/toybox) $(identify_release toybox)
 
   Toolchain packages:
     Binutils (http://www.gnu.org/software/binutils/) $(identify_release binutils)
--- a/sources/include.sh	Sun Feb 17 22:19:55 2013 -0600
+++ b/sources/include.sh	Sun Feb 17 22:25:00 2013 -0600
@@ -72,7 +72,7 @@
 if [ -z "$OLDPATH" ]
 then
   export OLDPATH="$PATH"
-  [ -f "$HOSTTOOLS/busybox" ] &&
+  [ -f "$HOSTTOOLS/toybox" ] &&
     PATH="$(hosttools_path)" ||
     PATH="$(hosttools_path):$PATH"