Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master cauldron by Justin Boffemmyer (0bca7b5f96919e7e58aed889a6d03c19ac432036)

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 master cauldron by Justin Boffemmyer (0bca7b5f96919e7e58aed889a6d03c19ac432036)
  • Date: Fri, 28 Nov 2008 18:49:43 -0600

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

API | 5 +++
cauldron | 51 ++++++++++++++++++++++++++++++++-
libcauldron | 92
++++++++++++++++--------------------------------------------
3 files changed, 81 insertions(+), 67 deletions(-)

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

libcauldron: better naming of included files sect.

Renamed the included files sections.

commit 969ffa5300a4c2cf6332263f2c4f30d7d356f7f6
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

libcauldron: update var name to correct var

Accidentally left the global TARGET_SPELLS instead of the local
target_spells. This is now fixed.

commit 72c457e59ab7d2053d9b1e8e621fb701b000b8b0
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

libcauldron: quote vars, cond. rm cache files

Quoted path variables to ensure they won't be broken if there is a space
or some other strange character in the path elements. Also checked the
return code from untarring the cache files, and if it went ok the cache
files are removed from the base of the CAULDRON_BUILD dir (don't pollute
the build directory).

commit 0c679e5dc39219aeca1256039f7d5f68f888af2e
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

libcauldron: make chrooting more stateful

The chrooting is now handled more statefully. This allows for better
fault-checking, as well as cleaner chroot handling in general (only the
chroot init and done calls are needed to set up and destroy the chroot
environments).

commit 5cf9b9e425bc4af0d87bb2f00b1bc10bb7e51230
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

cauldron,libcauldron: refactor iso building

Replaced the "cauldron_build_iso" call in cauldron with the real code
for that function from libcauldron, and removed the code from
libcauldron. The function in libcauldron was just a convenience wrapper
around the other libcauldron functions, and didn't belong in libcauldron
since it was an end-product function. It now resides in its rightful
place in cauldron. This also allows for more flexibility in how the ISOs
will be generated since it is in cauldron.

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

API: additional API description

Mentioned the fact that the Cauldron API is loosely modeled on the
OpenGL API.

diff --git a/API b/API
index 509e748..8c764e2 100644
--- a/API
+++ b/API
@@ -17,6 +17,11 @@ with "cauldron_" for example). If you are contributing to
any part of the
Cauldron codebase, you are asked to adhere to the following guidelines when
naming functions and variables.

+Where it makes sense, I have loosely modeled the Cauldron API after the
OpenGL
+API because I consider the OpenGL API to be an excellent example of a clean
and
+efficient API. Familiarity with the OpenGL API is however not required to
code
+or understand the Cauldron API.
+
In the context of the API, "cauldron" refers to the cauldron suite itself.
Anything pertaining to installers is referred to collectively as "enchant"
(the
enchant suite).
diff --git a/cauldron b/cauldron
index 7dcb8e9..d658b3f 100755
--- a/cauldron
+++ b/cauldron
@@ -36,8 +36,57 @@ EOF
exit 1
}

+#-------------------------------------------------------------------------------
+##
+## The brew command calls the necessary functions to generate a complete ISO
+## using the settings configured for cauldron.
+##
+#-------------------------------------------------------------------------------
function cauldron_brew () {
- cauldron_build_iso
+ # set up basic tool-chain needed for building everything else.
+ cauldron_base_toolchain
+
+ # set up chroot for building inside $CAULDRON_BUILD
+ cauldron_chroot_init
+ # exit with error if chroot not defined
+ [[ -n "$CAULDRON_CHROOT" ]] || exit CERR_CHROOT
+
+ # build the cross-compile tool-chain targeted for the target sys
+ if [ -n $TARGET ]
+ then
+ if [ $TARGET != $HOST ]
+ then
+ ${CAULDRON_CHROOT} cauldron_cross_toolchain
+ fi
+ fi
+
+ # use the cross-compile tool-chain to cast all spells needed for
+ # the iso system
+ ${CAULDRON_CHROOT} cauldron_build_iso_system ${TARGET_SPELLS}
+
+ # configure the iso init system, initrd/initramfs, etc.
+ ${CAULDRON_CHROOT} cauldron_iso_init
+
+ # build/create/copy/whatever installer system/data into the iso
+ for installer in $(cat ${TARGET_SPELLS})
+ do
+ ${CAULDRON_CHROOT} cauldron_add_installer $installer
+ done
+
+ # 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
+ 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_chroot_done
+
+ # create the iso fs from the build dir
+ cauldron_mkisofs
}

function cauldron_modify_local_config() {
diff --git a/libcauldron b/libcauldron
index 61de9fc..1fcfafa 100755
--- a/libcauldron
+++ b/libcauldron
@@ -15,26 +15,22 @@
##

#-------------------------------------------------------------------------------

-# Source the liberror file for error handling
+#-------------------------------------------------------------------------------
+# Cauldron includes
+#-------------------------------------------------------------------------------
. ${CAULDRON_LIBS}/libinit
. ${CAULDRON_LIBS}/liberror


#-------------------------------------------------------------------------------
-# Source needed sorcery library files
+# Sorcery includes

#-------------------------------------------------------------------------------
# Needed for modifying config files
. ${SORCERY_LIBS}/libstate
. ${SORCERY_LIBS}/libtrack


#-------------------------------------------------------------------------------
-# Local global variables
-#-------------------------------------------------------------------------------
-local CAULDRON_CHROOTINIT=0
-local CAULDRON_CHROOT="chroot $CAULDRON_BUILD"
-
-#-------------------------------------------------------------------------------
##
-## Prepares a chroot environment
+## Prepares a chroot environment and exports necessary variables
##

#-------------------------------------------------------------------------------
function cauldron_chroot_init() {
@@ -43,7 +39,8 @@ function cauldron_chroot_init() {
mount --bind ${HOSTPATH}/dev ${CAULDRON_BUILD}/dev
mount --bind ${HOSTPATH}/dev/pts ${CAULDRON_BUILD}/dev/pts
mount --bind ${HOSTPATH}/proc ${CAULDRON_BUILD}/proc
- CAULDRON_CHROOTINIT=1
+ export CAULDRON_CHROOTINIT=1
+ export CAULDRON_CHROOT="chroot \"$CAULDRON_BUILD\""
fi
}

@@ -58,7 +55,8 @@ function cauldron_chroot_done() {
umount ${CAULDRON_BUILD}/proc
umount ${CAULDRON_BUILD}/dev/pts
umount ${CAULDRON_BUILD}/dev
- CAULDRON_CHROOTINIT=0
+ unset CAULDRON_CHROOTINIT
+ unset CAULDRON_CHROOT
fi
}

@@ -111,6 +109,9 @@ function cauldron_base_toolchain() {
local SPELL_CACHE
local HOST_TRIPLE

+ # exit with error if chroot not defined
+ [[ -n "$CAULDRON_CHROOT" ]] || exit CERR_CHROOT
+
# set the value for HOST_TRIPLE
HOST_TRIPLE=$(cauldron_get_host_triple)

@@ -131,10 +132,10 @@ function cauldron_base_toolchain() {
# this check could be based on spell-{names,versions} reported by
# gaze/sorcery/dispel. Mirroring code in dispel might be the best bet,
# since that has to find the version currently installed anyway.
- if [[ -f ${HOST_SORCERY_SPOOL}/${SPELL_CACHE} ]]
+ if [[ -f "${HOST_SORCERY_SPOOL}/${SPELL_CACHE}" ]]
then
# found a cache file, copy it to the BUILD dir
- cp ${HOST_SORCERY_SPOOL}/${SPELL_CACHE} ${CAULDRON_BUILD}
+ cp "${HOST_SORCERY_SPOOL}/${SPELL_CACHE}" "${CAULDRON_BUILD}"
else
# couldn't find a cache file, so we'll need to build one
cauldron_build_cache_file ${SPELL}
@@ -143,7 +144,8 @@ function cauldron_base_toolchain() {
# the spell into the BUILD dir
# the unpacking is done against the BUILD dir as the root dir, so
# this should not touch the HOST filesystem at all
- tar xjf ${CAULDRON_BUILD}/${SPELL_CACHE} -C ${CAULDRON_BUILD}/
+ tar xjf "${CAULDRON_BUILD}/${SPELL_CACHE}" -C "${CAULDRON_BUILD}"/
+ [[ $? -eq 0 ]] && rm "${CAULDRON_BUILD}/${SPELL_CACHE}"
else
# the spell is not present on the HOST system, so it must be cast
# inside a chroot
@@ -244,6 +246,9 @@ function cauldron_configure_toolchain() {
##

#-------------------------------------------------------------------------------
function cauldron_cross_toolchain() {
+ # exit with error if chroot not defined
+ [[ -n "$CAULDRON_CHROOT" ]] || exit CERR_CHROOT
+
# build the stage 1 tools
cauldron_configure_toolchain 1
cauldron_chroot_init
@@ -284,13 +289,16 @@ function cauldron_build_iso_system() {
local target_spells=$1
local spell

+ # exit with error if chroot not defined
+ [[ -n "$CAULDRON_CHROOT" ]] || exit CERR_CHROOT
+
# 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
+ for spell in $target_spells
do
# Cheap cop-out to get the cache generated - cast the spell to generate
the
# cache, and then dispel it from the system so that it isn't wasting
space
@@ -373,57 +381,6 @@ function cauldron_add_installer() {


#-------------------------------------------------------------------------------
##
-## Wrapper function that calls all the functions necessary to generate the
-## final ISO file in the correct order
-##
-#-------------------------------------------------------------------------------
-function cauldron_build_iso() {
- # set up basic tool-chain in order to cross-compile for target later
- cauldron_base_toolchain
-
- # set up chroot for building inside $CAULDRON_BUILD
- cauldron_chroot_init
-
- # build the cross-compile tool-chain targeted for the target sys
- if [ -n $TARGET ]
- then
- if [ $TARGET != $HOST ]
- then
- ${CAULDRON_CHROOT} cauldron_cross_toolchain
- fi
- fi
-
- # use the cross-compile tool-chain to cast all spells needed for
- # the iso system
- ${CAULDRON_CHROOT} cauldron_build_iso_system ${TARGET_SPELLS}
-
- # configure the iso init system, initrd/initramfs, etc.
- ${CAULDRON_CHROOT} cauldron_iso_init
-
- # build/create/copy/whatever installer system/data into the iso
- for installer in $(cat ${TARGET_SPELLS})
- do
- ${CAULDRON_CHROOT} cauldron_add_installer $installer
- done
-
- # 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
- 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_chroot_done
-
- # create the iso fs from the build dir
- cauldron_mkisofs
-}
-
-#-------------------------------------------------------------------------------
-##
## This creates the CAULDRON_BUILD directory, and copies sorcery and
## cauldron files into it. It also configures the CAULDRON_BUILD
## sorcery as necessary (i.e. ensures that CLEAN_SOURCE="off") for
@@ -431,6 +388,9 @@ function cauldron_build_iso() {
##

#-------------------------------------------------------------------------------
function cauldron_prepare() {
+ # exit with error if chroot not defined
+ [[ -n "$CAULDRON_CHROOT" ]] || exit CERR_CHROOT
+
# first, ensure that the build dir exists
mkdir -p ${CAULDRON_BUILD}




  • [SM-Commit] GIT changes to master cauldron by Justin Boffemmyer (0bca7b5f96919e7e58aed889a6d03c19ac432036), Justin Boffemmyer, 11/28/2008

Archive powered by MHonArc 2.6.24.

Top of Page