[Lunar-commits] r19626 - in lunar/trunk/var/lib/lunar: functions plugins

Auke Kok sofar at lunar-linux.org
Sun Apr 9 19:01:33 UTC 2006


Author: sofar
Date: 2006-04-09 19:01:32 +0000 (Sun, 09 Apr 2006)
New Revision: 19626

Modified:
   lunar/trunk/var/lib/lunar/functions/check.lunar
   lunar/trunk/var/lib/lunar/plugins/check-ldd.plugin
Log:
fix ldd-check by making the run_details only used inside run_checks() - all other code can now not be contaminated with polluted vars.


Modified: lunar/trunk/var/lib/lunar/functions/check.lunar
===================================================================
--- lunar/trunk/var/lib/lunar/functions/check.lunar	2006-04-09 05:29:39 UTC (rev 19625)
+++ lunar/trunk/var/lib/lunar/functions/check.lunar	2006-04-09 19:01:32 UTC (rev 19626)
@@ -11,156 +11,153 @@
 
 
 run_checks() {
-  debug_msg "run_checks ($@)"
-  verbose_msg "Running sanity checks for module \"$1\""
-  plugin_call MODULE_CHECK $1
-  if [ $? == 2 ]; then
-    return 0
-  fi
-  return 1
+	debug_msg "run_checks ($@)"
+	verbose_msg "Running sanity checks for module \"$1\""
+	(
+		run_details $1
+		plugin_call MODULE_CHECK $1
+		if [ $? == 2 ]; then
+			return 0
+		fi
+		return 1
+	)
 }
 
 
 # rework_module : check depends database for a module
 rework_module() {
-  local MODULE
-  debug_msg "rework_module ($@)"
-                                                                                
-  # we declare these local to override the systems default ones:
-  optional_depends()  {
-    local DEP
-    debug_msg "  optional_depends ($@)"
-    DEP=$(NEVER_ASK=1 DEPS_ONLY= unalias $1)
-    if module_exiled $DEP ; then
-      echo "$MODULE:$DEP:off:optional:$2:$3"
-    else
-      if module_installed $DEP || module_held $DEP ; then
-        echo "$MODULE:$DEP:on:optional:$2:$3"
-      else
-        echo "$MODULE:$DEP:off:optional:$2:$3"
-      fi
-    fi
-  }
-                                                                                
-  depends()  {
-    local DEP
-    debug_msg "  depends ($@)"
-    DEP=$(NEVER_ASK=1 DEPS_ONLY= unalias $1)
-    if ! module_installed $DEP && ! module_held $DEP ; then
-      if ! is_depends $DEP && module_exiled $DEP ; then
-        return  1
-      else
-        CHANGED_MODULES="$CHANGED_MODULES $DEP"
-      fi
-    fi
+	local MODULE
+	debug_msg "rework_module ($@)"
 
-    echo "$MODULE:$DEP:on:required:$2:$3"
-  }
+	# we declare these local to override the systems default ones:
+	optional_depends()  {
+		local DEP
+		debug_msg "  optional_depends ($@)"
+		DEP=$(NEVER_ASK=1 DEPS_ONLY= unalias $1)
+		if module_exiled $DEP ; then
+			echo "$MODULE:$DEP:off:optional:$2:$3"
+		else
+			if module_installed $DEP || module_held $DEP ; then
+				echo "$MODULE:$DEP:on:optional:$2:$3"
+			else
+				echo "$MODULE:$DEP:off:optional:$2:$3"
+			fi
+		fi
+	}
 
-  run_depends() {
-  debug_msg "  run_depends ($@)"
-   (
-    if run_details $1 &> /dev/null ; then
-      if has_module_file $MODULE DEPENDS ; then
-        run_module_file $MODULE DEPENDS | grep -v '%'
-      fi
-    fi
-   ) 
-  }
-                                                                                
-  # here starts the real work:
-  MODULE=$1
+	depends()  {
+		local DEP
+		debug_msg "  depends ($@)"
+		DEP=$(NEVER_ASK=1 DEPS_ONLY= unalias $1)
+		if ! module_installed $DEP && ! module_held $DEP ; then
+			if ! is_depends $DEP && module_exiled $DEP ; then
+				return  1
+			else
+				CHANGED_MODULES="$CHANGED_MODULES $DEP"
+			fi
+		fi
 
-  # remove whatever depends was residing in the depends state file and
-  # append the new output:
-  lock_file $DEPENDS_STATUS_BACKUP                              &&
-  lock_file $DEPENDS_STATUS                                     &&
-  grep -v "^$MODULE:" $DEPENDS_STATUS_BACKUP > $DEPENDS_STATUS  &&
-  run_depends $MODULE >> $DEPENDS_STATUS
-  cat $DEPENDS_STATUS > $DEPENDS_STATUS_BACKUP
-  unlock_file $DEPENDS_STATUS
-  unlock_file $DEPENDS_STATUS_BACKUP
+		echo "$MODULE:$DEP:on:required:$2:$3"
+	}
+
+	run_depends() {
+	debug_msg "  run_depends ($@)"
+	 (
+		if run_details $1 &> /dev/null ; then
+			if has_module_file $MODULE DEPENDS ; then
+				run_module_file $MODULE DEPENDS | grep -v '%'
+			fi
+		fi
+	 ) 
+	}
+
+	# here starts the real work:
+	MODULE=$1
+
+	# remove whatever depends was residing in the depends state file and
+	# append the new output:
+	lock_file $DEPENDS_STATUS_BACKUP                              &&
+	lock_file $DEPENDS_STATUS                                     &&
+	grep -v "^$MODULE:" $DEPENDS_STATUS_BACKUP > $DEPENDS_STATUS  &&
+	run_depends $MODULE >> $DEPENDS_STATUS
+	cat $DEPENDS_STATUS > $DEPENDS_STATUS_BACKUP
+	unlock_file $DEPENDS_STATUS
+	unlock_file $DEPENDS_STATUS_BACKUP
 }
 
 
 # fix_depends : single pass to fix depends database
 fix_depends () {
-  local LIST
-  debug_msg "fix_depends  ($@)"
-  
-  if [ -n "$1" ] ; then
-    LIST="$@"
-  else
-    LIST=$(grep -v moonbase: $MODULE_STATUS | cut -d: -f1 | sort )
-  fi
+	local LIST
+	debug_msg "fix_depends  ($@)"
 
-  for MODULE in $LIST ; do
-    module_exiled $MODULE || rework_module $MODULE
-  done
+	if [ -n "$1" ] ; then
+		LIST="$@"
+	else
+		LIST=$(grep -v moonbase: $MODULE_STATUS | cut -d: -f1 | sort )
+	fi
+
+	for MODULE in $LIST ; do
+		module_exiled $MODULE || rework_module $MODULE
+	done
 }
-                                                                                
 
+
 run_fix()  {
-  local MODULES MODULE
-  debug_msg "run_fix ($@)"
-  MODULES=$*
+	local MODULES MODULE
+	debug_msg "run_fix ($@)"
+	MODULES=$*
 
-  if [ -z "$MODULES" ] ; then
-    MODULES=$(list_installed | grep -v moonbase)
-  fi
+	if [ -z "$MODULES" ] ; then
+		MODULES=$(list_installed | grep -v moonbase)
+	fi
 
-  if [[ -n "$FIXDEPENDS" ]] ; then
-    for MODULE in $MODULES ; do
-      fix_depends $MODULE
-    done
-    return
-  fi
+	if [[ -n "$FIXDEPENDS" ]] ; then
+		for MODULE in $MODULES ; do
+			fix_depends $MODULE
+		done
+		return
+	fi
 
-  # discover BROKEN modules
-  for MODULE in $MODULES ; do
-    if ! run_checks $MODULE ; then
-       BROKEN_MODULES=( ${BROKEN_MODULES[@]} $MODULE )
-    fi
-  done
+	# discover BROKEN modules
+	for MODULE in $MODULES ; do
+		if ! run_checks $MODULE ; then
+			 BROKEN_MODULES=( ${BROKEN_MODULES[@]} $MODULE )
+		fi
+	done
 
-  # if we were called with --fixdepends then we may skip the rest
-  if [ -n "$FIXDEPENDS" ] ; then
-    return
-  fi
-  
-  export TMP_LIN_SUCCESS=$(temp_create "successful")
-  export TMP_LIN_FAIL=$(temp_create "failed")
+	# if we were called with --fixdepends then we may skip the rest
+	if [ -n "$FIXDEPENDS" ] ; then
+		return
+	fi
 
-  for MODULE in $(sort_by_dependency ${BROKEN_MODULES[@]}) ; do
-    (
-      run_details $MODULE &&
-      if module_installed $MODULE && ! module_held $MODULE ; then
-        if ! run_checks $MODULE ; then
-          if [[ -n "$NOFIX" ]] ; then
-            continue
-          fi
-          NEVER_ASK=1 DEPS_ONLY= satisfy_depends      &&
-          NEVER_ASK=1 DEPS_ONLY= FIX= satisfy_depends &&
+	export TMP_LIN_SUCCESS=$(temp_create "successful")
+	export TMP_LIN_FAIL=$(temp_create "failed")
 
-          if ! run_checks $MODULE ; then
-		    verbose_msg "Attempting to recompile \"$MODULE\""
-            if ! FIX= lin --compile $MODULE ; then
-		      verbose_msg "Attempt to recompile \"$MODULE\" FAILED"
-              continue
-            elif ! run_checks $MODULE ; then
-		      verbose_msg "Attempt to recompile \"$MODULE\" succeeded but \"$MODULE\" still is broken!"
-			  continue
-            fi
-          fi
-        fi
-      fi
-    )
-  done
+	for MODULE in $(sort_by_dependency ${BROKEN_MODULES[@]}) ; do
+		if module_installed $MODULE && ! module_held $MODULE ; then
+			if ! run_checks $MODULE ; then
+				if [[ -n "$NOFIX" ]] ; then
+					continue
+				fi
+				NEVER_ASK=1 DEPS_ONLY= satisfy_depends      &&
+				NEVER_ASK=1 DEPS_ONLY= FIX= satisfy_depends &&
 
-  display_update_log fix
-  temp_destroy $TMP_LIN_SUCCESS
-  temp_destroy $TMP_LIN_FAIL
+				if ! run_checks $MODULE ; then
+					verbose_msg "Attempting to recompile \"$MODULE\""
+					if ! FIX= lin --compile $MODULE ; then
+						verbose_msg "Attempt to recompile \"$MODULE\" FAILED"
+						continue
+					elif ! run_checks $MODULE ; then
+						verbose_msg "Attempt to recompile \"$MODULE\" succeeded but \"$MODULE\" still is broken!"
+						continue
+					fi
+				fi
+			fi
+		fi
+	done
 
+	display_update_log fix
+	temp_destroy $TMP_LIN_SUCCESS
+	temp_destroy $TMP_LIN_FAIL
 }
-
-

Modified: lunar/trunk/var/lib/lunar/plugins/check-ldd.plugin
===================================================================
--- lunar/trunk/var/lib/lunar/plugins/check-ldd.plugin	2006-04-09 05:29:39 UTC (rev 19625)
+++ lunar/trunk/var/lib/lunar/plugins/check-ldd.plugin	2006-04-09 19:01:32 UTC (rev 19626)
@@ -46,5 +46,3 @@
 
 
 plugin_register MODULE_CHECK plugin_module_check_ldd
-
-



More information about the Lunar-commits mailing list