Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to devel-flux cauldron by Justin Boffemmyer (e6aa0e0e099d0d97345344acded80d73af6ba482)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Justin Boffemmyer <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to devel-flux cauldron by Justin Boffemmyer (e6aa0e0e099d0d97345344acded80d73af6ba482)
  • Date: Fri, 4 Apr 2008 21:37:19 -0500

GIT changes to devel-flux cauldron by Justin Boffemmyer <flux AT sourcemage.org>:

src/libcauldron | 75
++++++++++++++++++++++++++++++++++++--------------------
src/liberror | 47 +++++++++++++++++++++++++++++++++++
2 files changed, 96 insertions(+), 26 deletions(-)

New commits:
commit e6aa0e0e099d0d97345344acded80d73af6ba482
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

libcauldron,liberror: new error handling

Added the liberror file to take care of all of the error handling for
cauldron. This currently only has error definitions (variables working
as \#defines or enums), but will later also include error-handling
functions as well. I also updated some of the code in libcauldron to
make use of it.

commit 68e805975d57c800b785e2327afe23f972fc8241
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

libcauldron: defined cauldron_build_iso_system

Added the code for adding the material to transfer to the target
system during install to the iso.

commit 29144cccdf98943fe0858b412d83b807463fcd92
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

libcauldron: chroot call improvements

I renamed the cauldron_*_chroot calls to make them more intuitive
sounding (_chroot_init and _chroot_done). I also improved the code in
cauldron_build_iso to be a little more chroot aware, and to actually
be able to use it.

diff --git a/src/libcauldron b/src/libcauldron
index 2f2ff4e..441efca 100755
--- a/src/libcauldron
+++ b/src/libcauldron
@@ -15,6 +15,10 @@
##
#---------------------------------------------------------------------

+# Source the liberror file for error handling
+. liberror
+
+
#---------------------------------------------------------------------
##
## @param Filename
@@ -85,7 +89,7 @@ function cauldron_modify_config() {
## Prepares a chroot environment
##
#---------------------------------------------------------------------
-function cauldron_enter_chroot() {
+function cauldron_chroot_init() {
mount --bind ${HOST}/dev ${CAULDRON_BUILD}/dev
mount --bind ${HOST}/dev/pts ${CAULDRON_BUILD}/dev/pts
mount --bind ${HOST}/proc ${CAULDRON_BUILD}/proc
@@ -96,7 +100,7 @@ function cauldron_enter_chroot() {
## Cleans up the chroot environment after it is no longer needed
##
#---------------------------------------------------------------------
-function cauldron_exit_chroot() {
+function cauldron_chroot_done() {
umount ${CAULDRON_BUILD}/proc
umount ${CAULDRON_BUILD}/dev/pts
umount ${CAULDRON_BUILD}/dev
@@ -185,9 +189,9 @@ function cauldron_create_base_toolchain() {
else
# the spell is not present on the HOST system, so it must be cast
# inside a chroot
- cauldron_enter_chroot
+ cauldron_chroot_init
chroot ${CAULDRON_BUILD} ${CAULDRON_CAST} ${SPELL}
- cauldron_exit_chroot
+ cauldron_chroot_done
fi
done
}
@@ -233,40 +237,57 @@ function cauldron_configure_toolchain() {
function cauldron_create_target_toolchain() {
# build the stage 1 tools
cauldron_configure_toolchain 1
- cauldron_enter_chroot
+ cauldron_chroot_init
chroot ${CAULDRON_BUILD} ${CAULDRON_CAST} binutils
chroot ${CAULDRON_BUILD} ${CAULDRON_CAST} gcc
- cauldron_exit_chroot
+ cauldron_chroot_done

# build glibc (stage 2)
cauldron_configure_toolchain 2
- cauldron_enter_chroot
+ cauldron_chroot_init
chroot ${CAULDRON_BUILD} ${CAULDRON_CAST} glibc
- cauldron_exit_chroot
+ cauldron_chroot_done

# rebuild gcc (still stage 1, but this time linked against the
# cross-glibc
cauldron_configure_toolchain 1
- cauldron_enter_chroot
+ cauldron_chroot_init
chroot ${CAULDRON_BUILD} ${CAULDRON_CAST} gcc
- cauldron_exit_chroot
+ cauldron_chroot_done

# do a sorcery rebuild inside the BUILD dir to
# generate the cross-compile tool-chain (stage 3)
cauldron_configure_toolchain 3
- cauldron_enter_chroot
+ cauldron_chroot_init
chroot ${CAULDRON_BUILD} ${CAULDRON_REBUILD}
- cauldron_exit_chroot
+ cauldron_chroot_done
}

#---------------------------------------------------------------------
-## @param XXX
+## @param target_spells - a list of spells that will be needed to install
into
+## the target system from the iso.
##
-## Generates the installation system that will be copied from the ISO to the
-## target system as a tarball
+## Performs cast on the list of spells needed for installation to the target
+## system.
##
#---------------------------------------------------------------------
function cauldron_build_iso_system() {
+ local target_spells=$1
+ local spell
+
+ # Since we will be installing from the running ISO system instead of a
giant
+ # 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
+ for spell in $TARGET_SPELLS
+ do
+ cast $spell
+ dispel $spell
+ done
+ cauldron_chroot_done
+ return $CERR_OK
}

#---------------------------------------------------------------------
@@ -305,7 +326,7 @@ function cauldron_add_installer() {
function cauldron_clean_iso_system() {
local CLEANFILE=$1

- [[ -z "$CLEANFILE" ]] && return 1
+ [[ -z "$CLEANFILE" ]] && return $CERR_CLEANFILE

for i in $(sort -r $CLEANFILE)
do
@@ -318,7 +339,7 @@ function cauldron_clean_iso_system() {
rm $i
fi
done
- return 0
+ return $CERR_OK
}

#---------------------------------------------------------------------
@@ -354,36 +375,38 @@ function cauldron_build_iso() {
cauldron_create_toolchain

# copy the host's resolv.conf in order to dl packages from net
- cp -L /etc/resolv.conf ${CAULDRON_BUILD}/
+ cp -L /etc/resolv.conf ${CAULDRON_BUILD}/etc/resolv.conf

# set up chroot for building inside $CAULDRON_BUILD
- cauldron_enter_chroot
+ cauldron_chroot_init

# build the cross-compile tool-chain targeted for the target sys
- cauldron_create_target_toolchain
+ ${CAULDRON_CHROOT} cauldron_create_target_toolchain

# use the cross-compile tool-chain to cast all spells needed for
# the iso system
- cauldron_build_iso_system
+ ${CAULDRON_CHROOT} cauldron_build_iso_system

# configure the iso init system, initrd/initramfs, etc.
- cauldron_iso_init
+ ${CAULDRON_CHROOT} cauldron_iso_init

# build/create/copy/whatever installer system/data into the iso
- cauldron_add_installer
+ ${CAULDRON_CHROOT} cauldron_add_installer

# remove unnecessary files from iso and free up space
# this needs to have error-checking added in later
for cleaner in ${CAULDRON_BASE}/cleaners/* ;
do
- cauldron_clean_iso_system $cleaner
+ cp ${CAULDRON_BASE}/cleaners/${cleaner} ${CAULDRON_BUILD}/
+ ${CAULDRON_CHROOT} cauldron_clean_iso_system /${cleaner}
+ ${CAULDORN_CHROOT} rm /${cleaner}
done

# finished with iso building, clean up from chroot setup
- cauldron_exit_chroot
+ cauldron_chroot_done

# create the iso fs from the build dir
- cauldron_mkisofs
+ cauldron_mkisofs $CAULDRON_KEEPISO
}

#---------------------------------------------------------------------
diff --git a/src/liberror b/src/liberror
new file mode 100755
index 0000000..d418b18
--- /dev/null
+++ b/src/liberror
@@ -0,0 +1,47 @@
+#!/bin/bash
+#---------------------------------------------------------------------
+##
+##=head1 SYNOPSIS
+##
+## liberror is a set of functions and variable definitions used
+## internally by cauldron for error handling and error definitions
+##
+##=head1 COPYRIGHT
+##
+## Copyright 2007 by the Cauldron Team
+##
+##=head1 FUNCTIONS
+##
+##=over 4
+##
+#---------------------------------------------------------------------
+
+#---------------------------------------------------------------------
+##
+## ERROR definitions
+##
+#---------------------------------------------------------------------
+CERR_OK=0
+CERR_ARCHIVE=1
+CERR_CLEANFILE=2
+
+#---------------------------------------------------------------------
+##
+## This software is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this software; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+#---------------------------------------------------------------------
+
+# vim:ai:tw=80:tabstop=2:softtabstop=2:shiftwidth=2:expandtab
+



  • [SM-Commit] GIT changes to devel-flux cauldron by Justin Boffemmyer (e6aa0e0e099d0d97345344acded80d73af6ba482), Justin Boffemmyer, 04/04/2008

Archive powered by MHonArc 2.6.24.

Top of Page