[Lunar-commits] r18958 - lunar/trunk/var/lib/lunar/functions
Auke Kok
sofar at lunar-linux.org
Wed Mar 1 07:13:54 UTC 2006
Author: sofar
Date: 2006-03-01 07:13:50 +0000 (Wed, 01 Mar 2006)
New Revision: 18958
Modified:
lunar/trunk/var/lib/lunar/functions/build.lunar
lunar/trunk/var/lib/lunar/functions/check.lunar
lunar/trunk/var/lib/lunar/functions/depends.lunar
lunar/trunk/var/lib/lunar/functions/modules.lunar
Log:
Adding a 'has_module_file' wrapper before 'run_module_file' - rewriting run_module_file - this way a module can have a BUILD.x86_64 WITHOUT a BUILD. Only thing that is still required is a "DETAILS" file.
Modified: lunar/trunk/var/lib/lunar/functions/build.lunar
===================================================================
--- lunar/trunk/var/lib/lunar/functions/build.lunar 2006-03-01 06:44:15 UTC (rev 18957)
+++ lunar/trunk/var/lib/lunar/functions/build.lunar 2006-03-01 07:13:50 UTC (rev 18958)
@@ -331,7 +331,9 @@
set_module_config OPTS "$OPTS"
fi
plugin_call BUILD_CONFIGURE $MODULE
- run_module_file $MODULE CONFIGURE
+ if has_module_file $MODULE CONFIGURE ; then
+ run_module_file $MODULE CONFIGURE
+ fi
}
@@ -343,7 +345,7 @@
if verify_all_sources $MODULE ; then
plugin_call BUILD_PRE_BUILD $MODULE
- if [ -s $SCRIPT_DIRECTORY/PRE_BUILD ] ; then
+ if has_module_file $MODULE PRE_BUILD ; then
run_module_file $MODULE PRE_BUILD
else
if ! default_pre_build ; then
@@ -370,7 +372,7 @@
if [[ "${USE_WRAPPERS:-yes}" == "yes" ]]; then
export PATH=/var/lib/lunar/compilers:$PATH
fi
- if [[ -s $SCRIPT_DIRECTORY/BUILD ]] ; then
+ if has_module_file $MODULE BUILD ; then
run_module_file $MODULE BUILD
else
default_build
@@ -381,7 +383,7 @@
run_post_build() {
debug_msg "run_post_build ($@)"
- if [ -s $SCRIPT_DIRECTORY/POST_BUILD ] ; then
+ if has_module_file $MODULE POST_BUILD ; then
run_module_file $MODULE POST_BUILD
fi
default_post_build
@@ -391,7 +393,7 @@
run_post_install() {
debug_msg "run_post_install ($@)"
plugin_call BUILD_POST_INSTALL $MODULE
- if [ -s $SCRIPT_DIRECTORY/POST_INSTALL ] ; then
+ if has_module_file $MODULE POST_INSTALL ; then
run_module_file $MODULE POST_INSTALL
fi
}
Modified: lunar/trunk/var/lib/lunar/functions/check.lunar
===================================================================
--- lunar/trunk/var/lib/lunar/functions/check.lunar 2006-03-01 06:44:15 UTC (rev 18957)
+++ lunar/trunk/var/lib/lunar/functions/check.lunar 2006-03-01 07:13:50 UTC (rev 18958)
@@ -61,8 +61,8 @@
debug_msg " run_depends ($@)"
(
if run_details $1 &> /dev/null ; then
- if [ -s "$SCRIPT_DIRECTORY/DEPENDS" ] ; then
- run_module_file $MODULE DEPENDS | grep -v '%'
+ if has_module_file $MODULE DEPENDS ; then
+ run_module_file $MODULE DEPENDS | grep -v '%'
fi
fi
)
Modified: lunar/trunk/var/lib/lunar/functions/depends.lunar
===================================================================
--- lunar/trunk/var/lib/lunar/functions/depends.lunar 2006-03-01 06:44:15 UTC (rev 18957)
+++ lunar/trunk/var/lib/lunar/functions/depends.lunar 2006-03-01 07:13:50 UTC (rev 18958)
@@ -223,7 +223,7 @@
}
grep -q "^"$MODULE"\$" $TEMP_PREPAREDDEPS 2>/dev/null && return 0
- if [ -s "$SCRIPT_DIRECTORY/DEPENDS" ] ; then
+ if has_module_file $MODULE DEPENDS ; then
if [ -n "$SINGLE_MODULE" ] ; then
# we only need to show this once, but we get here twice per module
message "${CHECK_COLOR}Checking dependencies for" \
@@ -318,7 +318,9 @@
run_conflicts() {
debug_msg "run_conflicts ($@)"
- run_module_file $MODULE CONFLICTS
+ if has_module_file $MODULE CONFLICTS ; then
+ run_module_file $MODULE CONFLICTS
+ fi
}
Modified: lunar/trunk/var/lib/lunar/functions/modules.lunar
===================================================================
--- lunar/trunk/var/lib/lunar/functions/modules.lunar 2006-03-01 06:44:15 UTC (rev 18957)
+++ lunar/trunk/var/lib/lunar/functions/modules.lunar 2006-03-01 07:13:50 UTC (rev 18958)
@@ -166,10 +166,10 @@
if [[ "${ZLOCAL_OVERRIDES:=off}" == "on" ]] ; then
if SECTION=$(find "$MOONBASE/zlocal/" -type d -name $1 | sed -e "s|$MOONBASE/||;s|/$1$||" ) ; then
- if [[ -n "$SECTION" ]]; then
- echo $SECTION
+ if [[ -n "$SECTION" ]]; then
+ echo $SECTION
return 0
- fi
+ fi
fi
fi
@@ -212,16 +212,16 @@
"${PROBLEM_COLOR}in ${FILE_COLOR}$MOONBASE${DEFAULT_COLOR}"
return 1
else
- if [[ ! -f "$MOONBASE/$SECTION/$1/DETAILS" ]] ; then
+ SCRIPT_DIRECTORY=$MOONBASE/$SECTION/$1
+ if [[ ! -f $SCRIPT_DIRECTORY/DETAILS ]] ; then
error_message "${PROBLEM_COLOR}Module ${MODULE_COLOR}${1}" \
"${DEFAULT_COLOR}${PROBLEM_COLOR}has no ${FILE_COLOR}DETAILS" \
"${DEFAULT_COLOR}${PROBLEM_COLOR}file!${DEFAULT_COLOR}"
return 1
fi
- SCRIPT_DIRECTORY=$MOONBASE/$SECTION/$1
if [[ -z "$WANT_VERSION" ]] ; then
- run_module_file $1 DETAILS &> /dev/null || return -1
+ . $SCRIPT_DIRECTORY/DETAILS &> /dev/null || return -1
else
TMP_DETAILS=$(temp_create "details.version")
cat $MOONBASE/$SECTION/$1/DETAILS | sed '/^\s*VERSION=/d' > $TMP_DETAILS
@@ -238,25 +238,29 @@
}
+has_module_file()
+{
+ if [[ -e "$SCRIPT_DIRECTORY/$2" ]] || [[ -e "$SCRIPT_DIRECTORY/$2.$PLATFORM" ]]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+
# function : run_module_file
# usage : run_module_file $MODULE $SCRIPTNAME
# purpose : runs the given script for a pre-defined module
run_module_file() {
- debug_msg "run_module_file ($@)"
- if [[ "$1" == "moonbase" ]] ; then
- return 0
- fi
- if [[ -z "$SCRIPT_DIRECTORY" ]] ; then
- if ! run_details $1 > /dev/null ; then
- return 1
- fi
- fi
- CPU_ARCH=$(uname -m | sed 's/i[456]86/i386/')
- if [[ -e "$SCRIPT_DIRECTORY/$2.$CPU_ARCH" ]]; then
- . $SCRIPT_DIRECTORY/$2.$CPU_ARCH
- elif [[ -e "$SCRIPT_DIRECTORY/$2" ]]; then
- . $SCRIPT_DIRECTORY/$2
- fi
+ debug_msg "run_module_file ($@)"
+ if [[ "$1" == "moonbase" ]] ; then
+ return 0
+ fi
+ if [[ -e "$SCRIPT_DIRECTORY/$2.$PLATFORM" ]]; then
+ . $SCRIPT_DIRECTORY/$2.$PLATFORM
+ elif [[ -e "$SCRIPT_DIRECTORY/$2" ]]; then
+ . $SCRIPT_DIRECTORY/$2
+ fi
}
More information about the Lunar-commits
mailing list