Skip to Content.
Sympa Menu

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

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 (7da581b2db970bced549011b93820fd1dc08d3c0)
  • Date: Thu, 30 Jun 2011 17:13:31 -0500

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

cauldron/lib/errorcodes | 6 ++
cauldron/lib/lib.chroot | 95
+++++++++++++++++++++--------------------
enchantment/lib/libenchantment | 0
3 files changed, 55 insertions(+), 46 deletions(-)

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

cauldron: fix the logic in lib.chroot

Although lib.chroot now tracks the number of users/dependees of each
chroot, the logic for detecting if the necessary chroot was already
loaded, and what to do if it needed to be loaded, was still based on the
old functionality of only having a single chroot with a single
user/dependee at a time. Additionally, it's wasteful to perform the load
operations on a chroot that is already loaded, so it should only be done
for the first user. Thus, this commit also optimizes the algorithms a
bit.

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

cauldron: add error codes for new baseroot funcs

Add error codes for the baseroot testing functions (the general test
function and the more specific compiler test function).

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

library permissions should be a-x

Remove execute permissions for the library files. They are never
executed directly, and must be sourced to be used.

diff --git a/cauldron/lib/errorcodes b/cauldron/lib/errorcodes
index 9a131f3..2589b3f 100644
--- a/cauldron/lib/errorcodes
+++ b/cauldron/lib/errorcodes
@@ -116,8 +116,12 @@ liberror_add_error ERR_TOOLCHAIN_SORCERY \
"sorcery not found in toolchain root"
liberror_add_error ERR_TOOLCHAIN_RESURRECT \
"could not resurrect spell using sorcery"
+liberror_add_error ERR_TOOLCHAIN_COMPILER_TEST \
+ "could not compile a functioning binary using the chroot compiler"
+liberror_add_error ERR_TOOLCHAIN_BASEROOT_TEST \
+ "the basesystem chroot failed the validity test"
liberror_add_error ERR_TOOLCHAIN_BASEROOT \
- "could not acquire and unpack a valid basesystem chroot"
+ "could not acquire and set up a valid basesystem chroot"


#-------------------------------------------------------------------------------
##
diff --git a/cauldron/lib/lib.chroot b/cauldron/lib/lib.chroot
index b35b45c..12a35a7 100644
--- a/cauldron/lib/lib.chroot
+++ b/cauldron/lib/lib.chroot
@@ -40,17 +40,15 @@ function cauldron_chroot_init() {
local sconfig="${2:-$target/etc/sorcery/config}"
local slconfig="${3:-$target/etc/sorcery/local/config}"

- if [[ "$CAULDRON_CHROOTINIT" -eq 1 ]]
- then
- CAULDRON_CHROOT_USERS=$((CAULDRON_CHROOT_USERS+1))
- fi
-
# if target is somehow null, return an error
if [[ -z "$target" ]]
then
return $ERR_CHROOT_UNDEF
fi

+ # test if the target path is already loaded as a chroot -- if it is, just
+ # increase the count, but if it isn't do the bind mounts and set up the
+ # counts
if $(echo "${LIBCHROOT_PATHS[@]}" | grep -q "$target")
then
for((path=0; path < num; path++))
@@ -61,14 +59,7 @@ function cauldron_chroot_init() {
fi
done
else
- # increase the total number of entries
- ((num++))
- # add the target path to the list of chrooted paths
- LIBCHROOT_PATHS[num]="$target"
- # set the user count to 1
- LIBCHROOT_USERS[num]=1
-
- # bind the needed mounts
+ # bind the needed mounts in order
for bind in dev dev/pts proc
do
"${CAULDRON_CMD_MOUNT_BIND[@]}" \
@@ -76,20 +67,30 @@ function cauldron_chroot_init() {
"$target/$bind" ||
return $ERR_CHROOT_INIT
done
+
+ # add the target path to the list of chrooted paths
+ LIBCHROOT_PATHS[num]="$target"
+ # set the user count to 1
+ LIBCHROOT_USERS[num]=1
fi

- # make sure the sorcerous library is loaded
- # which provides cauldron_source_sorcery
- if [[ -z cauldron_source_sorcery ]]
+ # test if the target path matches the currently defined chroot command
target
+ # path -- if it doesn't, we need to set the chroot command
+ if [[ "${#CAULDRON_CHROOT[@]}" -eq 0 ||
+ "$target" == "${CAULDRON_CHROOT[${#CAULDRON_CHROOT[*]}-1]}" ]]
then
- cauldron_load_library lib.sorcerous
- fi
- # source the target sorcery, so we have access to its functions
- cauldron_sorcerous_load $sconfig $slconfig || return $ERR_SORCEROUS_TARGET
+ # make sure the sorcerous library is loaded
+ # which provides cauldron_source_sorcery
+ if [[ -z cauldron_source_sorcery ]]
+ then
+ cauldron_load_library lib.sorcerous
+ fi
+ # source the target sorcery, so we have access to its functions
+ cauldron_sorcerous_load $sconfig $slconfig || return
$ERR_SORCEROUS_TARGET

- # everything went OK, so export the chroot definitions
- export CAULDRON_CHROOTINIT=1
- export CAULDRON_CHROOT=( "${CAULDRON_CMD_CHROOT[@]}" "$target" )
+ # everything went OK, so export the chroot definitions
+ CAULDRON_CHROOT=( "${CAULDRON_CMD_CHROOT[@]}" "$target" )
+ fi

return $ERR_OK
}
@@ -102,33 +103,37 @@ function cauldron_chroot_init() {

#-------------------------------------------------------------------------------
function cauldron_chroot_done() {
local target="${1:-$CAULDRON_BUILD}"
+ local index=""

- if [[ "$CAULDRON_CHROOTINIT" -eq 1 ]]
+ # if target is somehow null, return an error
+ if [[ -z "$target" ]]
then
- # if target is somehow null, return an error
- if [[ -z "$target" ]]
- then
- return $ERR_CHROOT_UNDEF
- fi
+ return $ERR_CHROOT_UNDEF
+ fi

- # remove one "lock" for each time cauldron_chroot_done is called until we
- # are down to the last one, and then do the actual cleanup of the chroot
- if [[ "$CAULDRON_CHROOT_USERS" -gt 1 ]]
+ for ((index=0; index < "${#LIBCHROOT_PATHS[@]}"; index++))
+ do
+ if [[ "$target" == "${LIBCHROOT_PATHS[index]}" ]]
then
- CAULDRON_CHROOT_USERS=$((CAULDRON_CHROOT_USERS-1))
- else
- # unmount the bind mounts
- for bind in proc dev/pts dev
- do
- "${CAULDRON_CMD_UNMOUNT[@]}" "$target/$bind" || return
$ERR_CHROOT_DONE
- done
-
- # clear the chroot definitions
- unset CAULDRON_CHROOTINIT
- unset CAULDRON_CHROOT
- unset CAULDRON_CHROOT_USERS
+ # remove one "lock" for each time cauldron_chroot_done is called until
we
+ # are down to the last one, and then do the actual cleanup of the
chroot
+ if [[ "${LIBCHROOT_USERS[index]}" -gt 1 ]]
+ then
+ LIBCHROOT_USERS[index]=$((LIBCHROOT_USERS[index]-1))
+ else
+ # unmount the bind mounts
+ for bind in proc dev/pts dev
+ do
+ "${CAULDRON_CMD_UNMOUNT[@]}" "$target/$bind" || return
$ERR_CHROOT_DONE
+ done
+
+ # clear the chroot definitions
+ unset CAULDRON_CHROOT
+ unset LIBCHROOT_USERS[index]
+ unset LIBCHROOT_PATHS[index]
+ fi
fi
- fi
+ done

return $ERR_OK
}
diff --git a/cauldron/lib/lib.init b/cauldron/lib/lib.init
old mode 100755
new mode 100644
diff --git a/cauldron/lib/libcauldron b/cauldron/lib/libcauldron
old mode 100755
new mode 100644
diff --git a/enchantment/lib/libenchantment b/enchantment/lib/libenchantment
old mode 100755
new mode 100644



  • [SM-Commit] GIT changes to master cauldron by Justin Boffemmyer (7da581b2db970bced549011b93820fd1dc08d3c0), Justin Boffemmyer, 06/30/2011

Archive powered by MHonArc 2.6.24.

Top of Page