[Lunar-commits] CVS: theedge/var/lib/lunar/functions config.lunar,
1.13, 1.14 modules.lunar, 1.43, 1.44
Auke Kok
sofar at lunar-linux.org
Tue Oct 12 10:09:19 UTC 2004
Update of /var/cvs/lunar/theedge/var/lib/lunar/functions
In directory espresso.foo-projects.org:/tmp/cvs-serv25215/var/lib/lunar/functions
Modified Files:
config.lunar modules.lunar
Log Message:
Bugfix for the 'unexpected error' message. Added 'lunar unset' and generic unset_config/unset_module_config code.
Index: config.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/config.lunar,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- config.lunar 21 May 2004 10:27:13 -0000 1.13
+++ config.lunar 12 Oct 2004 10:09:17 -0000 1.14
@@ -7,9 +7,9 @@
############################################################
# #
# $FUNCTIONS/config #
-# set_config, get_config #
-# set_local_config, get_local_config #
-# set_module_config, get_module_config #
+# set_config, get_config, unset_config #
+# set_local_config, get_local_config, unset_local_config #
+# set_module_config, get_module_config, unset_module_config#
# #
############################################################
# #
@@ -30,7 +30,7 @@
fi
# on-demand creation
- if [ -f $1 ] ; then
+ if [ ! -f $1 ] ; then
touch $1
fi
@@ -47,6 +47,23 @@
}
+unset_config() {
+ debug_msg "unset_config ($@)"
+
+ # on-demand creation
+ if [ ! -f $1 ] ; then
+ touch $1
+ fi
+
+ lock_file $1 &&
+ if [ -n "$2" ] ; then
+ # make sure we escape those ':' characters:
+ sedit "/^[ ]*$2=/d" $1
+ fi
+ unlock_file $1
+}
+
+
get_config() {
if [ -f $1 ] ; then
cat $1 | grep -w "$2=.*" | cut -d= -f2- | sed -e 's/^"//' -e 's/"$//'
@@ -60,6 +77,12 @@
}
+unset_local_config() {
+ debug_msg "unset_local_config ($@)"
+ unset_config "$LOCAL_CONFIG" "$1"
+}
+
+
get_local_config() {
debug_msg "get_local_config ($@)"
get_config "$LOCAL_CONFIG" "$1"
@@ -74,6 +97,14 @@
}
+unset_module_config() {
+ debug_msg "unset_module_config ($@)"
+ if [ -n "$MODULE" ] ; then
+ unset_config "$DEPENDS_CONFIG/$MODULE" "$1"
+ fi
+}
+
+
get_module_config() {
debug_msg "get_module_config ($@)"
if [ -n "$MODULE" ] ; then
@@ -90,4 +121,3 @@
}
-
Index: modules.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/modules.lunar,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- modules.lunar 6 Oct 2004 12:43:05 -0000 1.43
+++ modules.lunar 12 Oct 2004 10:09:17 -0000 1.44
@@ -131,8 +131,8 @@
# purpose : checks if the index is up-to-date regarding to moonbase
function check_module_index() {
debug_msg "check_module_index ($@)"
- if [ -w $MODULE_INDEX ] ; then
- if [ -n "$(find $MOONBASE -type f -name "DETAILS" -cnewer $MODULE_INDEX)" ] ; then
+ if [ -w $MODULE_INDEX -a -w $DEPENDS_CACHE ] ; then
+ if [ ! -e $MODULE_INDEX -o ! -e $DEPENDS_CACHE -o -n "$(find $MOONBASE -type f -name "DETAILS" -cnewer $MODULE_INDEX)" ] ; then
create_module_index
create_depends_cache
return 0
@@ -201,7 +201,8 @@
# (return 1), which means that the calling code needs to decide
# if this is a problem or not... -sofar
- if ! SECTION=$(find_section $1) ; then
+ SECTION=$(find_section $1)
+ if [ -z "$SECTION" ] ; then
error_message "${PROBLEM_COLOR}Unable to find module ${MODULE_COLOR}${1}${DEFAULT_COLOR}" \
"${PROBLEM_COLOR}in ${FILE_COLOR}$MOONBASE${DEFAULT_COLOR}"
return 1
@@ -239,7 +240,7 @@
run_module_file() {
debug_msg "run_module_file ($@)"
if [ -z "$SCRIPT_DIRECTORY" ] ; then
- if ! run_details $1 &> /dev/null ; then
+ if ! run_details $1 > /dev/null ; then
return 1
fi
fi
More information about the Lunar-commits
mailing list