changeset 1258:c264495fbf21

Update the common code, use "files" directory instead of build for subdir.
author Rob Landley <rob@landley.net>
date Thu, 07 Oct 2010 23:50:12 -0500
parents 1461d20bb6a7
children 3ffcb56847e3
files sources/native-builds/bootstrap-skeleton/build/build-one-package.sh sources/native-builds/bootstrap-skeleton/build/functions.sh sources/native-builds/bootstrap-skeleton/build/init sources/native-builds/bootstrap-skeleton/build/run-build-stages.sh sources/native-builds/bootstrap-skeleton/control-image-wrapper.sh sources/native-builds/bootstrap-skeleton/files/build-one-package.sh sources/native-builds/bootstrap-skeleton/files/functions.sh sources/native-builds/bootstrap-skeleton/files/init sources/native-builds/bootstrap-skeleton/files/run-build-stages.sh
diffstat 9 files changed, 144 insertions(+), 122 deletions(-) [+]
line wrap: on
line diff
--- a/sources/native-builds/bootstrap-skeleton/build/build-one-package.sh	Thu Oct 07 23:46:30 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#!/bin/sh
-
-source /mnt/functions.sh || exit 1
-
-# build $1 using manifest file $2
-
-# Is it already installed?
-
-if [ ! -z "$2" ] && [ -z "$FORCE" ] && grep -q "$1" "$2"
-then
-  echo "$1 already installed"
-  exit 0
-fi
-
-set_titlebar "$1"
-
-# Snapshot source
-
-cd /home &&
-rm -rf "/home/$1" &&
-cp -sfR "/mnt/packages/$1" "$1" &&
-cd "$1" || exit 1
-
-# Lobotomize config.guess so it won't complain about unknown target types.
-
-for guess in $(find . -name config.guess)
-do
-  rm "$guess" &&
-  echo -e "#!/bin/sh\ngcc -dumpmachine" > "$guess" || exit 1
-done
-
-# Call package build script
-
-time "/mnt/build/${1}-build" || exit 1
-
-# Add file to manifest, removing previous version (if any).
-
-if [ ! -z "$2" ]
-then
-  sed -i -e "/$1/d" "$2" &&
-  echo "$1" >> "$2" || exit 1
-fi
-
-# Delete copy of source if build succeeded
-
-cd /home &&
-rm -rf "$1" &&
-sync
--- a/sources/native-builds/bootstrap-skeleton/build/functions.sh	Thu Oct 07 23:46:30 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#!/bin/echo This file is sourced not run
-
-upload_result()
-{
-  ftpput $FTP_SERVER -P $FTP_PORT "$1-$HOST" "$1"
-}
-
-set_titlebar()
-{
-  echo -en "\033]2;($HOST) $1\007"
-  echo === "$1"
-}
-
-dotprogress()
-{
-  while read i; do echo -n .; done; echo
-}
-
-do_in_chroot()
-{
-  # Copy root filesystem into a new chroot directory and restart in there.
-
-  CHROOT="$1"
-  shift
-
-  set_titlebar "Setup chroot"
-  mkdir "$CHROOT"
-  cp -a /mnt/files/. "$CHROOT"
-  find / -xdev | cpio -m -v -p "$CHROOT" | dotprogress
-  for i in mnt proc sys dev; do mount --bind /$i "$CHROOT"/$i; done
-
-  echo Chroot
-  chroot "$CHROOT" "$@"
-  RC=$?
-
-  echo Chroot cleanup
-  for i in mnt proc sys dev; do umount "$CHROOT"/$i; done
-
-  return $RC
-}
--- a/sources/native-builds/bootstrap-skeleton/build/init	Thu Oct 07 23:46:30 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-# Start running here, and hand off to run-build-stages.sh in chroot.
-
-. /mnt/functions.sh
-
-# Always chroot, because even if root filesystem is writeable it's hard to
-# tell tar to skip /proc and /sys and such without unmounting bits of the
-# host environment.
-
-do_in_chroot /home/chroot /mnt/run-build-stages.sh
-
-if [ $? -eq 0 ]
-then
-  set_titlebar "upload tarball"
-  tar czvf gentoo-stage1.tar.gz gentoo-stage1 | dotprogress &&
-  upload_result gentoo-stage1.tar.gz
-fi
--- a/sources/native-builds/bootstrap-skeleton/build/run-build-stages.sh	Thu Oct 07 23:46:30 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-# Run each of the individual package build files, in order.
-
-for i in zlib ncurses python bash rsync patch file portage
-do
-  cd /home && /mnt/${i}-build || exit 1
-done
--- a/sources/native-builds/bootstrap-skeleton/control-image-wrapper.sh	Thu Oct 07 23:46:30 2010 -0500
+++ b/sources/native-builds/bootstrap-skeleton/control-image-wrapper.sh	Thu Oct 07 23:50:12 2010 -0500
@@ -12,7 +12,7 @@
 
 # Find path to our working directory.
 
-MYDIR="$(dirname "$(readlink -f "$(which "$0")")")"
+MYDIR="$(readlink -f "$(dirname "$(which "$0")")")"
 IMAGENAME="${MYDIR/*\//}"
 
 # Use our own directories for downloaded source tarballs and patches.
@@ -27,22 +27,27 @@
 
 WORK="$WORK/$IMAGENAME" &&
 blank_tempdir "$WORK" &&
-SRCTREE="$WORK" &&
+SRCTREE="$WORK/packages" &&
+mkdir "$SRCTREE" &&
+
+# Copy common infrastructure to target
+
 cp "$MYDIR"/../bootstrap-skeleton/files/* "$WORK" || exit 1
+if [ -e "$MYDIR/mnt" ]
+then
+  cp -a "$MYDIR/mnt/." "$WORK" || exit 1
+fi
+
+# Populate packages directory
 
 echo "=== $IMAGENAME: Download/extract source code"
 
 EXTRACT_ALL=1
 
-"$MYDIR"/download.sh || exit 1
+source "$MYDIR"/download.sh || exit 1
 
 cleanup_oldfiles
 
-if [ -e "$MYDIR/mnt" ]
-then
-  cp -a "$MYDIR/mnt/." "$WORK" || exit 1
-fi
-
 # Create sqaushfs image
 
 if [ "$1" != "/dev/null" ]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/native-builds/bootstrap-skeleton/files/build-one-package.sh	Thu Oct 07 23:50:12 2010 -0500
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+source /mnt/functions.sh || exit 1
+
+# build $1 using manifest file $2
+
+# Is it already installed?
+
+if [ ! -z "$2" ] && [ -z "$FORCE" ] && grep -q "$1" "$2"
+then
+  echo "$1 already installed"
+  exit 0
+fi
+
+set_titlebar "$1"
+
+if [ -d "/mnt/packages/$1" ]
+then
+
+  # Snapshot source
+
+  cd /home &&
+  rm -rf "/home/$1" &&
+  cp -sfR "/mnt/packages/$1" "$1" &&
+  cd "$1" || exit 1
+
+  # Lobotomize config.guess so it won't complain about unknown target types.
+
+  for guess in $(find . -name config.guess)
+  do
+    rm "$guess" &&
+    echo -e "#!/bin/sh\ngcc -dumpmachine" > "$guess" || exit 1
+  done
+  EXT=sh
+else
+  EXT=nosrc
+fi
+
+# Call package build script
+
+if ! time "/mnt/build/${1}.$EXT"
+then
+  echo "$1" died >&2
+  exit 1
+fi
+
+# Add file to manifest, removing previous version (if any).
+
+if [ ! -z "$2" ]
+then
+  sed -i -e "/$1/d" "$2" &&
+  echo "$1" >> "$2" || exit 1
+fi
+
+if [ -d "/mnt/packages/$1" ]
+then
+
+  # Delete copy of source if build succeeded
+
+  cd /home &&
+  rm -rf "$1" &&
+  sync || exit 1
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/native-builds/bootstrap-skeleton/files/functions.sh	Thu Oct 07 23:50:12 2010 -0500
@@ -0,0 +1,40 @@
+#!/bin/echo This file is sourced not run
+
+upload_result()
+{
+  ftpput $FTP_SERVER -P $FTP_PORT "$1-$HOST" "$1"
+}
+
+set_titlebar()
+{
+  echo -en "\033]2;($HOST) $1\007"
+  echo === "$1"
+}
+
+dotprogress()
+{
+  while read i; do echo -n .; done; echo
+}
+
+do_in_chroot()
+{
+  # Copy root filesystem into a new chroot directory and restart in there.
+
+  CHROOT="$1"
+  shift
+
+  set_titlebar "Setup chroot"
+  mkdir "$CHROOT"
+  cp -a /mnt/files/. "$CHROOT"
+  find / -xdev | cpio -m -v -p "$CHROOT" | dotprogress
+  for i in mnt proc sys dev; do mount --bind /$i "$CHROOT"/$i; done
+
+  echo Chroot
+  chroot "$CHROOT" "$@"
+  RC=$?
+
+  echo Chroot cleanup
+  for i in mnt proc sys dev; do umount "$CHROOT"/$i; done
+
+  return $RC
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/native-builds/bootstrap-skeleton/files/init	Thu Oct 07 23:50:12 2010 -0500
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# Start running here, and hand off to run-build-stages.sh in chroot.
+
+. /mnt/functions.sh
+
+[ -z "$NATIVE_BUILD" ] && NATIVE_BUILD=chroot
+
+# Always chroot, because even if root filesystem is writeable it's hard to
+# tell tar to skip /proc and /sys and such without unmounting bits of the
+# host environment.
+
+do_in_chroot /home/"$NATIVE_BUILD" /mnt/run-build-stages.sh
+
+if [ $? -eq 0 ]
+then
+  set_titlebar "upload tarball"
+  tar czvf "$NATIVE_BUILD".tar.gz "$NATIVE_BUILD" | dotprogress &&
+  upload_result "$NATIVE_BUILD".tar.gz
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/native-builds/bootstrap-skeleton/files/run-build-stages.sh	Thu Oct 07 23:50:12 2010 -0500
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# Run each of the individual package build files, in order.
+
+for i in zlib ncurses python bash rsync patch file portage
+do
+  /mnt/build-one-package.sh "$i" || exit 1
+done