[SM-Commit] GIT changes to master cauldron by Justin Boffemmyer (ca4ef55dd74e7de23f0e012817317a6dcb84d28c)

Justin Boffemmyer scm at sourcemage.org
Mon Dec 8 11:32:56 EST 2008


GIT changes to master cauldron by Justin Boffemmyer <flux at sourcemage.org>:

 libcauldron |   71 ++++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 43 insertions(+), 28 deletions(-)

New commits:
commit ca4ef55dd74e7de23f0e012817317a6dcb84d28c
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    libcauldron: source sorcery via chroot init
    
    A function was added to source the internal cauldron sorcery configs,
    and this function is called by cauldron_chroot_init (only!). This
    enables parsing of the $CAULDRON_BUILD sorcery configuration by
    cauldron, so that we can ensure a proper sorcery environment
    (ARCHIVE="on", for example).

commit d27cd7a920b0904df11566d08f67b11e4bf28888
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    libcauldron: fixed quoting of variables
    
    Variables that express paths are now quoted. Also, extraneous uses of
    curly braces for variable expressions have been removed.

commit 375d2eafe0e04d201118d6a28d43bda2078ac32b
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    libcauldron: renamed iso_system to target_system
    
    Renamed the function cauldron_build_iso_system to
    cauldron_build_target_system. This is a much clearer name, since the
    function is used to generate the system to be installed onto the target
    rather than anything used on the ISO itself (i.e., it generates
    the caches to be installed onto the target system).

diff --git a/libcauldron b/libcauldron
index 632ddc3..3d0551e 100755
--- a/libcauldron
+++ b/libcauldron
@@ -30,6 +30,20 @@
 
 #-------------------------------------------------------------------------------
 ##
+## Sources the sorcery config files. Should only be called by
+## cauldron_chroot_init.
+##
+#-------------------------------------------------------------------------------
+function cauldron_source_sorcery() {
+  local target=$1
+
+  source "$target/etc/sorcery/config"
+  [[ -e "$target/etc/sorcery/local/config" ]] &&
+  source "$target/etc/sorcery/local/config"
+}
+
+#-------------------------------------------------------------------------------
+##
 ## Prepares a chroot environment and exports necessary variables
 ##
 #-------------------------------------------------------------------------------
@@ -38,9 +52,10 @@ function cauldron_chroot_init() {
 
   if [[ "$CAULDRON_CHROOTINIT" -ne 1 ]]
   then
-    mount --bind ${HOSTPATH}/dev ${TARGET}/dev
-    mount --bind ${HOSTPATH}/dev/pts ${TARGET}/dev/pts
-    mount --bind ${HOSTPATH}/proc ${TARGET}/proc
+    mount --bind "$HOSTPATH"/dev "$TARGET"/dev
+    mount --bind "$HOSTPATH"/dev/pts "$TARGET"/dev/pts
+    mount --bind "$HOSTPATH"/proc "$TARGET"/proc
+    cauldron_source_sorcery "$TARGET"
     export CAULDRON_CHROOTINIT=1
     export CAULDRON_CHROOT="chroot \"$TARGET\""
   fi
@@ -56,9 +71,9 @@ function cauldron_chroot_done() {
 
   if [[ "$CAULDRON_CHROOTINIT" -eq 1 ]]
   then
-    umount ${TARGET}/proc
-    umount ${TARGET}/dev/pts
-    umount ${TARGET}/dev
+    umount "TARGET"/proc
+    umount "TARGET"/dev/pts
+    umount "TARGET"/dev
     unset CAULDRON_CHROOTINIT
     unset CAULDRON_CHROOT
   fi
@@ -314,7 +329,7 @@ function cauldron_cross_toolchain() {
 ## into the target system from the iso.
 ##
 #-------------------------------------------------------------------------------
-function cauldron_build_iso_system() {
+function cauldron_build_target_system() {
   local target_spells=$1
   local spell
 
@@ -325,8 +340,8 @@ function cauldron_build_iso_system() {
   # tarball, for each spell we only need to make sure that the cache file is
   # available. This will require that the ISO sorcery has caching enabled. The
   # caching should really be turned on from the very beginning though...
-  [[ "$ARCHIVE" == "off" ]] && return $CERR_ARCHIVE
   cauldron_chroot_init
+  [[ "$ARCHIVE" == "off" ]] && return $CERR_ARCHIVE
   for spell in $target_spells
   do
     # Cheap cop-out to get the cache generated - cast the spell to generate the
@@ -403,9 +418,9 @@ function cauldron_mkisofs() {
 function cauldron_add_installer() {
   local MODULE=$1
 
-  cp -r ${CAULDRON_LIBS}/${MODULE} ${CAULDRON_BUILD}/${ENCHANT_DATA}/
-  ln -sf ${CAULDRON_BUILD}/${ENCHANT_DATA}/${MODULE}/bin/* \
-          ${CAULDRON_BUILD}/usr/sbin/
+  cp -r "$CAULDRON_LIBS/$MODULE" "$CAULDRON_BUILD/$ENCHANT_DATA/"
+  ln -sf "$CAULDRON_BUILD/$ENCHANT_DATA/$MODULE"/bin/* \
+          "$CAULDRON_BUILD"/usr/sbin/
 }
 
 #-------------------------------------------------------------------------------
@@ -421,19 +436,19 @@ function cauldron_prepare() {
   [[ -n "$CAULDRON_CHROOT" ]] || exit $CERR_CHROOT
 
   # first, ensure that the build dir exists
-  mkdir -p ${CAULDRON_BUILD}
+  mkdir -p "$CAULDRON_BUILD"
 
   # copy the host's resolv.conf in order to dl packages from net
-  cp -L /etc/resolv.conf ${CAULDRON_BUILD}/etc/resolv.conf
+  cp -L /etc/resolv.conf "$CAULDRON_BUILD"/etc/resolv.conf
 
-  cauldron_sorcery_install ${CAULDRON_BUILD}
-  mkdir -p ${CAULDRON_BUILD}/var/spool/sorcery
-  cp -f ${HOSTPATH}/var/spool/sorcery/sorcery-${SORCERY_BRANCH}.tar${EXTENSION}
+  cauldron_sorcery_install "$CAULDRON_BUILD"
+  mkdir -p "$CAULDRON_BUILD"/var/spool/sorcery
+  cp -f "$HOSTPATH"/var/spool/sorcery/sorcery-${SORCERY_BRANCH}.tar${EXTENSION}
 
   # cauldron is a spell
   # there is a spoon
   cauldron_chroot_init
-  ${CAULDRON_CHROOT} ${CAULDRON_CAST} cauldron
+  "$CAULDRON_CHROOT" "$CAULDRON_CAST" cauldron
   cauldron_chroot_done
 }
 
@@ -453,7 +468,7 @@ function cauldron_download_sorcery() {
   # run in a subshell as an easy way of not messing with the working directory
   (
     cd ${SPOOL}
-    wget http://download.sourcemage.org/sorcery/${SORCERY}
+    wget http://download.sourcemage.org/sorcery/$SORCERY
   )
 }
 
@@ -472,28 +487,28 @@ function cauldron_download_sorcery() {
 #-------------------------------------------------------------------------------
 function cauldron_sorcery_install() {
   local force_download=$1
-  local BRANCH=$ISO_SORCERY_BRANCH
-  local SPOOL=${CAULDRON_BUILD}/var/spool/sorcery
+  local BRANCH="$ISO_SORCERY_BRANCH"
+  local SPOOL="$CAULDRON_BUILD/var/spool/sorcery"
 
   # first, check to see if we will copy or download the sorcery source tarball
   # and get the source tarball and place it in CAULDRON_BUILD
-  if [[ -e ${HOST_SORCERY_SPOOL}/sorcery-${BRANCH}.tar.bz2 ]]
+  if [[ -e "$HOST_SORCERY_SPOOL"/sorcery-${BRANCH}.tar.bz2 ]]
   then
     if [[ "$force_download" == "yes" ]]
     then
-      cauldron_download_sorcery ${BRANCH} ${SPOOL}
+      cauldron_download_sorcery $BRANCH "$SPOOL"
     else
-      cp ${HOST_SORCERY_SPOOL}/sorcery-${BRANCH}.tar.bz2 ${SPOOL}
+      cp "$HOST_SORCERY_SPOOL"/sorcery-${BRANCH}.tar.bz2 "$SPOOL"
     fi
   else
-    cauldron_download_sorcery ${BRANCH} ${SPOOL}
+    cauldron_download_sorcery ${BRANCH} "$SPOOL"
   fi
 
   # unpack the source tarball
-  tar -C ${CAULDRON_BUILD}/usr/src -jxf ${SPOOL}/sorcery-${BRANCH}.tar.bz2
+  tar -C "$CAULDRON_BUILD"/usr/src -jxf "$SPOOL"/sorcery-${BRANCH}.tar.bz2
 
   # install the source tarball, relative to CAULDRON_BUILD
-  ${CAULDRON_BUILD}/usr/src/sorcery/install ${CAULDRON_BUILD}
+  "$CAULDRON_BUILD"/usr/src/sorcery/install "$CAULDRON_BUILD"
 }
 
 #-------------------------------------------------------------------------------
@@ -502,8 +517,8 @@ function cauldron_sorcery_install() {
 ##
 #-------------------------------------------------------------------------------
 function cauldron_cleanup() {
-  [[ ${CAULDRON_CLEAN} == "yes" ]] && rm -fr ${CAULDRON_BUILD}
-  rm -fr ${CAULDRON_TMP}
+  [[ ${CAULDRON_CLEAN} == "yes" ]] && rm -fr "$CAULDRON_BUILD"
+  rm -fr "$CAULDRON_TMP"
 }
 
 #-------------------------------------------------------------------------------



More information about the SM-Commit mailing list