changeset 1740:258427b0c8be draft

Add more/tweak.sh to rebuild a package in a stage. ex: more/tweak.sh i686 native-compiler build_section ccwrap
author Rob Landley <rob@landley.net>
date Sat, 21 Feb 2015 16:34:42 -0600
parents 4ca4ddd185db
children 189a1748c8bf
files build.sh more/tweak.sh
diffstat 2 files changed, 40 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/build.sh	Fri Feb 20 13:14:50 2015 -0600
+++ b/build.sh	Sat Feb 21 16:34:42 2015 -0600
@@ -76,24 +76,37 @@
 {
   for i in "$@"
   do
-    rm -f "$BUILD/$i-$ARCH.tar.bz2"
+    rm -f "$BUILD/$i-$ARCH.tar.gz"
   done
 }
 
+do_stage()
+{
+  STAGE="$1"
+  shift
+
+  if [ "$AFTER" == "$STAGE" ]
+  then
+    unset AFTER
+  else
+    time ./"$STAGE".sh "$@" || exit 1
+  fi
+}
+
 # The first two stages (download.sh and host-tools.sh) are architecture
 # independent.  In order to allow multiple builds in parallel, re-running
 # them after they've already completed must be a safe NOP.
 
 # Download source code.
 
-time ./download.sh || exit 1
+do_stage download
 
 # Build host tools.  This populates a single directory with every command the
 # build needs, so we can ditch the host's $PATH afterwards.
 
 if [ -z "$NO_HOST_TOOLS" ]
 then
-  time ./host-tools.sh || exit 1
+  do_stage host-tools
 fi
 
 # Do we need to build the simple cross compiler?
@@ -104,7 +117,7 @@
 
   zap root-filesystem cross-compiler native-compiler linux-kernel
 
-  time ./simple-cross-compiler.sh "$ARCH" || exit 1
+  do_stage simple-cross-compiler "$ARCH"
 fi
 
 # Optionally, we can build a more capable statically linked compiler via
@@ -119,10 +132,10 @@
 
   if ARCH="$CROSS_COMPILER_HOST" not_already simple-cross-compiler
   then
-    time ./simple-cross-compiler.sh "$CROSS_COMPILER_HOST" || exit 1
+    do_stage simple-cross-compiler "$CROSS_COMPILER_HOST"
   fi
 
-  time ./cross-compiler.sh "$ARCH" || exit 1
+  do_stage cross-compiler "$ARCH"
 fi
 
 # Build the basic root filesystem.
@@ -132,7 +145,7 @@
   zap system-image
   [ "$SYSIMAGE_TYPE" == rootfs ] && zap linux-kernel
 
-  time ./root-filesystem.sh "$ARCH" || exit 1
+  do_stage root-filesystem "$ARCH"
 fi
 
 # Build a native compiler.  It's statically linked by default so it can
@@ -142,12 +155,12 @@
 then
   zap system-image
 
-  time ./native-compiler.sh "$ARCH" || exit 1
+  do_stage native-compiler "$ARCH"
 fi
 
 # Package it all up into something qemu can boot.
 
 if not_already system-image
 then
-  time ./system-image.sh $1 || exit 1
+  do_stage system-image "$ARCH"
 fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/more/tweak.sh	Sat Feb 21 16:34:42 2015 -0600
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# Rerun 
+
+if [ $# -lt 2 ]
+then
+  echo "usage: more/tweak.sh ARCH STAGE COMMAND..." >&1
+  exit 1
+fi
+
+[ ! -e "$2".sh ] && echo "No stage $2" >&2 && exit 1
+ARCH="$1"
+export STAGE_NAME="$2"
+shift
+shift
+
+NO_CLEANUP=1 more/test.sh "$ARCH" "$@" ";create_stage_tarball"
+AFTER="$STAGE_NAME" ./build.sh "$ARCH" "$STAGE_NAME"