[Lunar-commits] <lunar> Sync with theedge bugfixes:

Auke Kok sofar at lunar-linux.org
Mon Jul 2 04:43:12 CEST 2012


commit 5ca7271c3dfee731695f37665481aab0268a55d7
Author: Auke Kok <sofar at lunar-linux.org>
Date:   Mon Jul 24 16:07:38 2006 +0000

    Sync with theedge bugfixes:
    
    * fix download display
    * fix /zlocal/ modules not being found
    * fix gather_docs unsetting LD_PRELOAD
    * fix list_sections not showing zlocal sections
    * add LUNAR_RESTART_SERVICE global switch (on|off, default on)
---
 bin/lvu                                        |    6 +-
 var/lib/lunar/functions/download.lunar         |    6 +-
 var/lib/lunar/functions/modules.lunar          |  118 ++++++++++++++----------
 var/lib/lunar/plugins/initd.plugin             |    6 +-
 var/lib/lunar/plugins/postbuild-generic.plugin |   12 +--
 5 files changed, 84 insertions(+), 64 deletions(-)

diff --git a/bin/lvu b/bin/lvu
index ffe5c6e..a4b8cc8 100755
--- a/bin/lvu
+++ b/bin/lvu
@@ -456,7 +456,7 @@ function show_tree() {
       error_message "${PROBLEM_COLOR}Unable to find module ${MODULE_COLOR}${1}${PROBLEM_COLOR} in ${FILE_COLOR}${MOONBASE}${DEFAULT_COLOR}"
     return 1
   fi
-  
+
   # create dependency tracking file if needed
   if [ -z "$TMP_SEEN" ] ; then
     export TMP_SEEN=$(temp_create "seen")
@@ -477,7 +477,7 @@ function show_tree() {
       DEP=$(NEVER_ASK=1 unalias $1)
       echo "-$DEP"
     }
-    
+
     debug_msg "run_depends ($@)"
     SECTION=$(find_section $1)
     SCRIPT_DIRECTORY=$MOONBASE/$SECTION/$1
@@ -486,7 +486,7 @@ function show_tree() {
       run_module_file $1 DEPENDS
     fi
   }
- 
+
   if [ -z "$1" ] ; then
     help
     exit 1
diff --git a/var/lib/lunar/functions/download.lunar b/var/lib/lunar/functions/download.lunar
index 1032c62..7436641 100644
--- a/var/lib/lunar/functions/download.lunar
+++ b/var/lib/lunar/functions/download.lunar
@@ -36,7 +36,7 @@ lget_unlock() {
 download_url() {
 	local RETVAL
 	debug_msg "download_url($@)"
-	verbose_msg "trying to download \"$1/$2\""
+	verbose_msg "trying to download \"${2}\" from \"${1}\""
 	connect &&
 	plugin_call SOURCE_DOWNLOAD $1 $2 $3
 	RETVAL=$?
@@ -47,7 +47,6 @@ download_url() {
 }
 
 
-
 download_module() {
 (
 	local MAX_SOURCES SRC ALL_URLS URLS URL MLIST ALT REST HIT
@@ -91,8 +90,7 @@ download_module() {
 		add_url() {
 			if [ -n "$1" ]; then
 				if ! echo " $ALL_URLS " | grep -q " $1 "; then
-					# make sure the URL has ONE "/" at the end
-					ALL_URLS="$ALL_URLS $(echo "$1/" | sed "s:[/]*$:/:g")"
+					ALL_URLS="$ALL_URLS $1"
 				fi
 			fi
 		}
diff --git a/var/lib/lunar/functions/modules.lunar b/var/lib/lunar/functions/modules.lunar
index 586ca45..9fdc477 100644
--- a/var/lib/lunar/functions/modules.lunar
+++ b/var/lib/lunar/functions/modules.lunar
@@ -28,10 +28,11 @@
 # usage    : list_sections
 # purpose  : list the moonbase sections, filter out the specific files
 list_sections() {
-  debug_msg "list_sections ($@)"
-  check_module_index
-  cut -d: -f2 < $MODULE_INDEX | sort | uniq
-  return 0
+	debug_msg "list_sections ($@)"
+	check_module_index
+	cut -d: -f2 < $MODULE_INDEX | sort | uniq
+	find $MOONBASE/zlocal -name DETAILS | sed "s:^$MOONBASE\/::g;s:\/[^\/]*\/DETAILS$::g" | sort | uniq
+	return 0
 }
 
 
@@ -39,19 +40,26 @@ list_sections() {
 # usage    : list_modules $SECTION
 # purpose  : list the modules in a section, filter out the specific files
 list_modules() {
-  debug_msg "list_modules ($@)"
-  if [[ -z "$1" ]] ; then
-    error_message "${PROBLEM_COLOR}list_modules(): no SECTION defined!${DEFAULT_COLOR}"
-    exit 1
-  fi
+	debug_msg "list_modules ($@)"
+	if [[ -z "$1" ]] ; then
+		error_message "${PROBLEM_COLOR}list_modules(): no SECTION defined!${DEFAULT_COLOR}"
+		exit 1
+	fi
 
-  if ! grep -q ":$1$" $MODULE_INDEX ; then
-    error_message "${PROBLEM_COLOR}list_modules(): no such section \"$1\"!${DEFAULT_COLOR}"
-    exit 1
-  fi
+	if [[ ! -d $MOONBASE/$1 ]] ; then
+		error_message "${PROBLEM_COLOR}list_modules(): no such section \"$1\"!${DEFAULT_COLOR}"
+		exit 1
+	fi
 
-  grep ":$1$" $MODULE_INDEX | cut -d: -f1
-  return 0
+	if grep -q ":$1$" $MODULE_INDEX; then
+		grep ":$1$" $MODULE_INDEX | cut -d: -f1
+		return 0
+	else
+	 (
+		 cd $MOONBASE/$1
+		 find . -maxdepth 2 -name DETAILS -type f | sed 's/\.\///g;s/\/DETAILS$//g'
+	 )
+	fi
 }
 
 
@@ -59,11 +67,11 @@ list_modules() {
 # usage    : list_moonbase
 # purpose  : returns the names of all modules in moonbase
 list_moonbase() {
-  local SECTION
-  debug_msg "list_moonbase ($@)"
-  for SECTION in $(list_sections) ; do
-    list_modules $SECTION
-  done				
+	local SECTION
+	debug_msg "list_moonbase ($@)"
+	for SECTION in $(list_sections) ; do
+		list_modules $SECTION
+	done
 }
 
 
@@ -71,8 +79,8 @@ list_moonbase() {
 # usage    : list_installed
 # purpose  : return a list of installed (or held) modules
 list_installed() {
-  debug_msg "list_installed ($@)"
-  grep -e ":installed:" -e ":held:" $MODULE_STATUS | cut -d: -f1 | sort
+	debug_msg "list_installed ($@)"
+	grep -e ":installed:" -e ":held:" $MODULE_STATUS | cut -d: -f1 | sort
 }
 
 
@@ -156,37 +164,51 @@ function check_module_index() {
 # purpose  : finds the section of a given module as parameter
 # returns  : (0) on success, (1) on failure, errors on stdout
 find_section() {
-  local SECTION SECTIONS
-  debug_msg "find_section ($@)"
+	local SECTION SECTIONS
+	debug_msg "find_section ($@)"
+
+	# if using ZLOCAL, we must search there first
+	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
+				return 0
+			fi
+		fi
+	fi
 
-  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
-        return 0
-      fi
-    fi
-  fi
+	# otherwise check for ordinary modules named that way
+	SECTION=$(awk -F: "(\$1==\"$1\"){print \$2;exit 0}" $MODULE_INDEX)
+	if [[ -n "$SECTION" ]] && [[ -d "$MOONBASE/$SECTION/$1" ]] ; then
+		echo "$SECTION"
+		return 0
+	fi
 
-  SECTION=$(awk -F: "(\$1==\"$1\"){print \$2;exit 0}" $MODULE_INDEX)
-  if [[ -n "$SECTION" ]] && [[ -d "$MOONBASE/$SECTION/$1" ]] ; then
-    echo "$SECTION"
-    return 0
-  fi
+	# assuming we're not using ZLOCAL, we haven't looked there yet!
+	# perhaps it's a zlocal module ? search zlocal for it now
+	if SECTION=$(find "$MOONBASE/zlocal/" -type d -name $1 | sed -e "s|$MOONBASE/||;s|/$1$||" ) ; then
+		if [[ -n "$SECTION" ]]; then
+			echo $SECTION
+			return 0
+		fi
+	fi
 
-  if ! check_module_index ; then
-    # shave some time off not trying the rest of the code below since that
-    # is useless
-    return 1
-  fi
+	# still not found? refresh module index... this may take a while
+	if ! check_module_index ; then
+		# shave some time off not trying the rest of the code below since that
+		# is useless
+		return 1
+	fi
 
-  SECTION=$(awk -F: "(\$1==\"$1\"){print \$2;exit 0}" $MODULE_INDEX)
-  if [[ -n "$SECTION" ]] && [[ -d "$MOONBASE/$SECTION/$1" ]] ; then
-    echo "$SECTION"
-    return 0
-  fi
+	# and search again, this should be quick now
+	SECTION=$(awk -F: "(\$1==\"$1\"){print \$2;exit 0}" $MODULE_INDEX)
+	if [[ -n "$SECTION" ]] && [[ -d "$MOONBASE/$SECTION/$1" ]] ; then
+		echo "$SECTION"
+		return 0
+	fi
 
-  return 1
+	# bummer, not found
+	return 1
 }
 
 
diff --git a/var/lib/lunar/plugins/initd.plugin b/var/lib/lunar/plugins/initd.plugin
index 8e972df..0364213 100644
--- a/var/lib/lunar/plugins/initd.plugin
+++ b/var/lib/lunar/plugins/initd.plugin
@@ -73,8 +73,10 @@ plugin_initd_post_build()
     CHKCONFIG=`grep '^# chkconfig:' /etc/init.d/$INITDSCRIPT | cut -d : -f 2-2`
     if `echo $CHKCONFIG | grep -q $(/sbin/runlevel | cut -d ' ' -f 2-2) -`
     then
-      ( cd / && /etc/init.d/$INITDSCRIPT stop )
-      ( cd / && /etc/init.d/$INITDSCRIPT start )
+      if [ "${LUNAR_RESTART_SERVICES:=on}" == "on" ]; then
+        ( cd / && /etc/init.d/$INITDSCRIPT stop )
+        ( cd / && /etc/init.d/$INITDSCRIPT start )
+      fi
     fi
 
   done
diff --git a/var/lib/lunar/plugins/postbuild-generic.plugin b/var/lib/lunar/plugins/postbuild-generic.plugin
index 468b4a7..390c4c4 100644
--- a/var/lib/lunar/plugins/postbuild-generic.plugin
+++ b/var/lib/lunar/plugins/postbuild-generic.plugin
@@ -38,7 +38,6 @@ gather_docs()
   DOC_DIR=${DOCUMENT_DIRECTORY}/${MODULE}
   if [ -d "$SOURCE_DIRECTORY" ] ; then
     cd $SOURCE_DIRECTORY
-    invoke_installwatch
     mkdir -p $DOC_DIR
     # For each parameter that is an existing file
     for FILE in ${@}; do
@@ -48,14 +47,13 @@ gather_docs()
         install -D -m 644 ${FILE} ${DOC_DIR}/${FILE}
       elif [ -d ${FILE} ] ; then
         # copy the directory to the docdir
-	verbose_msg "Installing extra documentation to: ${DOC_DIR}/${FILE}"
-	cp -a ${FILE} ${DOC_DIR}/
+        verbose_msg "Installing extra documentation to: ${DOC_DIR}/${FILE}"
+        cp -a ${FILE} ${DOC_DIR}/
       fi
     done
-    devoke_installwatch
-	# do not return 2 here: this function is called directly and
-	# must return true (0) here
-	return 0
+        # do not return 2 here: this function is called directly and
+        # must return true (0) here
+        return 0
   fi
   return 2
 }


More information about the Lunar-commits mailing list