[Lunar-commits] CVS: theedge/var/lib/lunar/functions depends.lunar, 1.34, 1.35

Auke Kok sofar at lunar-linux.org
Mon Mar 29 22:24:04 GMT 2004


Update of /var/cvs/lunar/theedge/var/lib/lunar/functions
In directory dbguin.lunar-linux.org:/tmp/cvs-serv26610/var/lib/lunar/functions

Modified Files:
	depends.lunar 
Log Message:
This is a bit more experimental patch:
- ask for a confirmation before removing a conflicting module (break if no)
- added opt_dep bypass in case there is no need to ask the user since he
really has no choice anyway.


Index: depends.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/depends.lunar,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- depends.lunar	21 Mar 2004 20:51:44 -0000	1.34
+++ depends.lunar	29 Mar 2004 22:24:02 -0000	1.35
@@ -187,8 +187,14 @@
 	else
 	  DEPMOD_AVAIL="Install & use optional ${PROBLEM_COLOR}(not yet installed) ${MESSAGE_COLOR}module${QUERY_COLOR} $1"
 	fi
-	if query  "$DEPMOD_AVAIL 
-        dependency - purpose: $4? " $DEFAULT ; then
+
+        # this is shortcut case s1) as discussed in lunar-dev ML
+	if module_installed $1 && [ -z "$2" -a -z "$3" ] ; then
+	  verbose_msg "Auto-adding optional dependency \"$1\""
+          add_depends  "$MODULE"  "$1"  "on"   "optional"  "$2"  "$3"
+	  lin --deps $1
+	elif query  "$DEPMOD_AVAIL 
+          dependency - purpose: $4? " $DEFAULT ; then
           add_depends  "$MODULE"  "$1"  "on"   "optional"  "$2"  "$3"
           lin --deps $1
         else
@@ -264,7 +270,13 @@
 conflicts() {
   debug_msg "conflicts ($@)"
   if module_installed $1 ; then
-    lrm $1
+    message "${PROBLEM_COLOR}WARNING: ${DEFAULT_COLOR}${MODULE_COLOR}$1${DEFAULT_COLOR}${PROBLEM_COLOR} conflicts with module ${MODULE_COLOR}$MODULE${DEFAULT_COLOR}"
+    if query "Do you want to remove module ${DEFAULT_COLOR}${MODULE_COLOR}$1${DEFAULT_COLOR}${QUERY_COLOR} ? " n ; then
+      lrm $1
+    else
+      message "${PROBLEM_COLOR}ERROR: Cannot continue installing conflicting modules, exiting!${DEFAULT_COLOR}"
+      return 1
+    fi
   fi
 
   true
@@ -289,10 +301,16 @@
 (
   debug_msg "build_module_depends ($@)"
   if [ -n "$DEPS_ONLY" ] ; then
+    if ! run_conflicts $1 ; then
+      exit 1
+    fi &&
     run_details $1 &&
     run_configure &&
     run_depends
   else
+    if ! run_conflicts $1 ; then
+      exit 1
+    fi &&
     run_details $1 &&
     run_depends &&
     satisfy_depends



More information about the Lunar-commits mailing list