changeset 9:242a1e03ce15 1.1.0

Move repeated wrapper code into top level build.sh.
author Rob Landley <rob@landley.net>
date Sun, 18 Sep 2011 18:03:47 -0500
parents 3db62f3c2ac3
children 49b4a99dcf03
files build.sh common/builder.sh images/busybox-test/build.sh images/hello-world/build.sh images/static-tools/build.sh
diffstat 5 files changed, 16 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/build.sh	Sun Sep 18 17:58:55 2011 -0500
+++ b/build.sh	Sun Sep 18 18:03:47 2011 -0500
@@ -7,12 +7,26 @@
   exit 1
 fi
 
+build_control_image()
+{
+  (
+    IMAGENAME="$1"
+    MYDIR=$(readlink -f images/"$1")
+
+    source common/include.sh &&
+    source images/"$1"/build.sh &&
+    squash_image
+  )
+}
+
 if [ "$1" != all ]
 then
-  images/"$1"/build.sh
+  build_control_image "$1"
 else
   for i in $(ls images)
   do
-    images/"$i"/build.sh || exit 1
+    echo "=== Checking $i"
+    [ -e build/$i.hdc ] && echo "build/$i.hdc exists" && continue
+    build_control_image "$i" || exit 1
   done
 fi
--- a/common/builder.sh	Sun Sep 18 17:58:55 2011 -0500
+++ b/common/builder.sh	Sun Sep 18 18:03:47 2011 -0500
@@ -2,8 +2,6 @@
 
 # Control image generation infrastructure using common bootstrap files.
 
-source common/include.sh
-
 # Copy common infrastructure to target
 
 cp "$TOP/common/"{utility_functions.sh,bootstrap/*} "$WORK" || exit 1
@@ -21,4 +19,3 @@
 EXTRACT_ALL=1 source "$MYDIR"/download.sh || exit 1
 
 cleanup_oldfiles
-squash_image
--- a/images/busybox-test/build.sh	Sun Sep 18 17:58:55 2011 -0500
+++ b/images/busybox-test/build.sh	Sun Sep 18 18:03:47 2011 -0500
@@ -2,10 +2,6 @@
 
 # Run the busybox test suite.
 
-source common/include.sh || exit 1
-
-# Don't download busybox, it's got to already be there in standard sources.
-
 EXTRACT_ALL=1
 
 URL=http://www.busybox.net/downloads/busybox-1.18.4.tar.bz2 \
@@ -29,5 +25,3 @@
 
 EOF
 chmod +x "$WORK"/init || dienow
-
-squash_image
--- a/images/hello-world/build.sh	Sun Sep 18 17:58:55 2011 -0500
+++ b/images/hello-world/build.sh	Sun Sep 18 18:03:47 2011 -0500
@@ -5,13 +5,6 @@
 # program from the Aboriginal Linux /usr/src directory as a build environment
 # smoketest.  Grep the output for "Hello world!" to test for success.
 
-# Download all the source tarballs we haven't got up-to-date copies of.
-
-# The tarballs are downloaded into the "packages" directory, which is
-# created as needed.
-
-source common/include.sh || exit 1
-
 # Write init script via a "here" document.
 
 cat > "$WORK"/init << 'EOF' || dienow
@@ -33,5 +26,3 @@
 EOF
 
 chmod +x "$WORK"/init || dienow
-
-squash_image
--- a/images/static-tools/build.sh	Sun Sep 18 17:58:55 2011 -0500
+++ b/images/static-tools/build.sh	Sun Sep 18 18:03:47 2011 -0500
@@ -5,8 +5,6 @@
 # The tarballs are downloaded into the "packages" directory, which is
 # created as needed.
 
-source common/include.sh || exit 1
-
 EXTRACT_ALL=1
 
 echo "=== Download source code."
@@ -83,7 +81,3 @@
 EOF
 
 chmod +x "$WORK"/init || dienow
-
-cd "$TOP"
-
-squash_image