Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (1d1538ce90449e3360763c6b60a8942688c8123b)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Jaka Kranjc <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (1d1538ce90449e3360763c6b60a8942688c8123b)
  • Date: Tue, 5 Feb 2008 10:19:50 -0600

GIT changes to master sorcery by Jaka Kranjc <lynxlynxlynx AT sourcemage.org>:

ChangeLog | 9 ++++
usr/sbin/cast | 2 -
usr/sbin/confmeld | 62
++++++++-----------------------
var/lib/sorcery/modules/build_api/common | 9 ++--
var/lib/sorcery/modules/libstage | 28 ++++++++++++++
5 files changed, 58 insertions(+), 52 deletions(-)

New commits:
commit 1d1538ce90449e3360763c6b60a8942688c8123b
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

fixed passing of more than one argument

commit 540c53ccc9c4cf9d8cff035c572f0fb5fc33380f
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libstage, confmeld, common: added locking calls

commit e4d983f453d514196f9f6a19dc30a97a440fb9ad
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

* libstage: added a staged config removal routine, mostly for
leftover dirs
* confmeld, common: made use of that routine
* confmeld: simplified removal code, now things get deleted right
after use

commit 5c38a31984401589f480d03593a7689b9c275fcb
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

cast: made the confmeld message more explicit

diff --git a/ChangeLog b/ChangeLog
index 567677d..41e8ffc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-02-05 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * cast: made the confmeld message more explicit
+ * libstage: added a staged config removal routine, mostly for
leftover dirs
+ then made it accept another argument for convenience
+ * confmeld, common: made use of that routine
+ * confmeld: simplified removal code, now things get deleted right
after use
+ fixed passing of more than one argument
+ * libstage, confmeld, common: added locking calls
+
2008-02-04 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* confmeld: added options to just list all spells, configs or both
don't output anything when listing and there is nothing to show;
diff --git a/usr/sbin/cast b/usr/sbin/cast
index 398c131..d800c57 100755
--- a/usr/sbin/cast
+++ b/usr/sbin/cast
@@ -721,7 +721,7 @@ function pass_five() {
done < $SUCCESS_LIST
if [[ $deferred_list ]]; then
message "${MESSAGE_COLOR}Cast deferred installing some configuration
files."
- message "The following spells have pending updates: "
+ message "The following spells have new pending updates: "
message "---------------------------------$SPELL_COLOR"
message "$deferred_list" | column
message "${MESSAGE_COLOR}Please run confmeld to merge them into your
system."
diff --git a/usr/sbin/confmeld b/usr/sbin/confmeld
index 88dc445..8deb56e 100755
--- a/usr/sbin/confmeld
+++ b/usr/sbin/confmeld
@@ -180,6 +180,15 @@ function override_changed_config_menu()
}

#--------------------------------------------------------------------
+## Final check for removing empty spell directories, so the stage dir
+## is left clean
+#--------------------------------------------------------------------
+function final_cleanup()
+{
+ find $CONFIG_STAGE_DIRECTORY -mindepth 1 -maxdepth 2 -type d -empty -delete
+}
+
+#--------------------------------------------------------------------
## merge only the passed file
##
## @param config
@@ -196,30 +205,7 @@ function merge_single_file()
message "to be merged with $FILE_COLOR/$target${DEFAULT_COLOR}\n"
tablet_set_spell $spell &&
install_config_file $file $INSTALL_ROOT/$target
- #
- # since we use find we need to remove empty directories
- # so if the spell or the date changes then we remove the directory so
- # CONFIG_STAGE_DIRECTORY should always be empty after you complete the
- # call to confmeld
- #
- # find does a preorder traversal of the directory tree keeping the path
- # (esentially a stack) of where its been in the tree. If a particular
date
- # or spell name changes at the same level in the tree we can safely
assume
- # the previous date or spell has been walked and all files have been delt
- # with accordingly so we can safely remove them.
- #
- if [[ $last_sdate && $last_sdate != $sdate ]]
- then
- message "${MESSAGE_COLOR}Removing stale dirs and files in the config
stage area.${DEFAULT_COLOR}"
- rm_source_dir $CONFIG_STAGE_DIRECTORY/$last_spell/$last_sdate
- fi
- if [[ $last_spell && $last_spell != $spell ]]
- then
- message "${MESSAGE_COLOR}Removing stale dirs and files in the config
stage area.${DEFAULT_COLOR}"
- rm_source_dir $CONFIG_STAGE_DIRECTORY/$last_spell
- fi
- last_sdate="$sdate"
- last_spell="$spell"
+ recursive_config_stage_cleanup $file $spell
echo -e "\n"
fi
}
@@ -251,16 +237,8 @@ function confmeld_partial()
merge_single_file "$config"
done
done
- #
- # final check for removing spell directories this is mainly a check so that
- # empty directories will get removed
- #
- if [[ $last_spell ]]
- then
- message "${MESSAGE_COLOR}Removing any remaining stale dirs and files in
the config stage area.${DEFAULT_COLOR}"
- rm_source_dir $CONFIG_STAGE_DIRECTORY/$last_spell
- fi
- find $CONFIG_STAGE_DIRECTORY -mindepth 1 -maxdepth 2 -type d -empty -delete
+ final_cleanup
+
exit $rc
}

@@ -275,16 +253,8 @@ function confmeld_all()
do
merge_single_file "$file"
done
- #
- # final check for removing spell directories this is mainly a check so that
- # empty directories will get removed
- #
- if [[ $last_spell ]]
- then
- message "${MESSAGE_COLOR}Removing any remaining stale dirs and files in
the config stage area.${DEFAULT_COLOR}"
- rm_source_dir $CONFIG_STAGE_DIRECTORY/$last_spell
- fi
- find $CONFIG_STAGE_DIRECTORY -mindepth 1 -maxdepth 2 -type d -empty -delete
+
+ final_cleanup
}

function process_parameters()
@@ -309,13 +279,13 @@ function process_parameters()
done
$subroutine

- [[ $arguments ]] && confmeld_partial "${arguments% }"
+ [[ $arguments ]] && confmeld_partial $arguments
}

#--------------------------------------------------------------------
## Main
##
-## No real arguments get all the config files and start installing
+## If there's no arguments get all the config files and start installing
## them to the system using install_config_file
#--------------------------------------------------------------------
function main()
diff --git a/var/lib/sorcery/modules/build_api/common
b/var/lib/sorcery/modules/build_api/common
index b35d4d2..c8803ee 100755
--- a/var/lib/sorcery/modules/build_api/common
+++ b/var/lib/sorcery/modules/build_api/common
@@ -289,6 +289,7 @@ function run_spell_success() {
tablet_install_spell_files $tablet_dir
local TABLET_SPELL_DIR=$tablet_dir spell_config_stage
spell_config_stage=$CONFIG_STAGE_DIRECTORY/$SPELL
+ lock_file "$spell_config_stage"
if [[ $STAGED_INSTALL != "off" && -d $spell_config_stage/current ]]
then
if ! rmdir $spell_config_stage/current $spell_config_stage
2>/dev/null;
@@ -304,11 +305,8 @@ function run_spell_success() {
-prune -o -type f -wholename "*/$quasi_basename" -print |
while read file; do
if cmp -s $deferred_file $file; then
- rm $deferred_file
- pushd $spell_config_stage
- rmdir -p $(smgl_dirname $deferred_file)
- popd
- continue
+ recursive_config_stage_cleanup $deferred_file $SPELL
+ continue 2
fi &>/dev/null
done
done
@@ -318,6 +316,7 @@ function run_spell_success() {
$spell_config_stage/$(basename $tablet_dir)
fi
fi
+ unlock_file "$spell_config_stage"
# this data is now doubly stale, remove it
rm -f $ABANDONED_PERSIST/$SPELL.p
fi
diff --git a/var/lib/sorcery/modules/libstage
b/var/lib/sorcery/modules/libstage
index a4b40b1..5166068 100755
--- a/var/lib/sorcery/modules/libstage
+++ b/var/lib/sorcery/modules/libstage
@@ -12,8 +12,10 @@
#---------------------------------------------------------------------
function transfer_staged_spell()
{
+ lock_file "$CONFIG_STAGE_DIRECTORY/$SPELL"
mkdir -p "$CONFIG_STAGE_DIRECTORY/$SPELL/current"
stage_install_configs
+ unlock_file "$CONFIG_STAGE_DIRECTORY/$SPELL"
stage_install_rest
}

@@ -231,3 +233,29 @@ function stage_install_list()
message "is some other kind of a file and not a
directory${DEFAULT_COLOR}"
fi
}
+
+#--------------------------------------------------------------------
+## Removes the passed file and possibly its parent directories up
+## to $CONFIG_STAGE_DIRECTORY if they are empty
+##
+## @param file
+## @param spell owner of the file, so we don't need to look that up
+#--------------------------------------------------------------------
+function recursive_config_stage_cleanup()
+{
+ local file=$1 dirname
+ local spell=$2
+
+ smgl_dirname "$file" dirname
+ dirname="${dirname#$CONFIG_STAGE_DIRECTORY/}" #make it a relative path
+
+ # lock_file works on dirs too
+ lock_file "$CONFIG_STAGE_DIRECTORY/$spell"
+ rm "$file"
+ {
+ pushd $CONFIG_STAGE_DIRECTORY
+ rmdir -p "$dirname"
+ popd
+ } &> /dev/null
+ unlock_file "$CONFIG_STAGE_DIRECTORY/$spell"
+}



  • [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (1d1538ce90449e3360763c6b60a8942688c8123b), Jaka Kranjc, 02/05/2008

Archive powered by MHonArc 2.6.24.

Top of Page