[Lunar-commits] r22845 - in lunar/branches/stable: bin var/lib/lunar/functions

Auke Kok sofar at lunar-linux.org
Sat Jan 6 03:10:19 CET 2007


Author: sofar
Date: 2007-01-06 03:10:19 +0100 (Sat, 06 Jan 2007)
New Revision: 22845

Modified:
   lunar/branches/stable/bin/lvu
   lunar/branches/stable/var/lib/lunar/functions/aliases.lunar
   lunar/branches/stable/var/lib/lunar/functions/check.lunar
   lunar/branches/stable/var/lib/lunar/functions/depends.lunar
   lunar/branches/stable/var/lib/lunar/functions/modules.lunar
Log:
Merge sync with theedge.


Modified: lunar/branches/stable/bin/lvu
===================================================================
--- lunar/branches/stable/bin/lvu	2007-01-06 02:09:51 UTC (rev 22844)
+++ lunar/branches/stable/bin/lvu	2007-01-06 02:10:19 UTC (rev 22845)
@@ -131,7 +131,7 @@
     ( mk_source_dir $SOURCE_DIRECTORY )
     tar xj -C $SOURCE_DIRECTORY -f $SNAPSHOT 2> /dev/null
     cd $SOURCE_DIRECTORY
-    
+
 	message "${MESSAGE_COLOR}Restoring lunar configuration${DEFAULT_COLOR}"
     cp -a etc/lunar /etc
 
@@ -147,7 +147,7 @@
       echo $MOD >>$TMP_QUEUE
       echo $MOD
     done
-    
+
     if query "Do you wish to edit the install queue ? " n ; then
       edit_file $TMP_QUEUE
     fi
@@ -184,17 +184,18 @@
 
 
 alien() {
-  message "In a few minutes I will print files found on this disk that were not"
-  message "installed by lunar. This is not a security feature! Files could still"
-  message "be lurking undetected on this box."
+  message "In a few minutes I will print files found on this disk that were not" 1>&2
+  message "installed by lunar. This is not a security feature! Files could still" 1>&2
+  message "be lurking undetected on this box." 1>&2
 
   TMP_FOUND=$(temp_create "lvu.found")
   TMP_KNOWN=$(temp_create "lvu.known")
 
-  message  "Discovering ambient files..."
+  message  "Discovering ambient files..." 1>&2
   find $TRACKED | files | grep -v -f "$EXCLUDED" | grep -v -f "$PROTECTED" | sort | uniq > $TMP_FOUND
-  message  "Discovering installed files..."
-  cat $INSTALL_LOGS/* | files | sort | uniq > $TMP_KNOWN
+  message  "Discovering installed files..." 1>&2
+  ( cat $INSTALL_LOGS/* ; ls $INSTALL_CACHE/* ; ls $SOURCE_CACHE/*
+  )| files | sort | uniq > $TMP_KNOWN
 
   diff -B -a -d $TMP_FOUND $TMP_KNOWN | grep -e "^< " | cut -c 3-
 
@@ -210,9 +211,9 @@
   ((  COUNT=0  ))
 
   for  SECTION  in  $(list_sections);  do
-    echo 
+    echo
     echo  "-------------------------------------------------"
-    echo  "SECTION:  $SECTION"  
+    echo  "SECTION:  $SECTION"
     echo  "-------------------------------------------------"
     for  MODULE  in  $(list_modules $SECTION);  do
       echo  $MODULE
@@ -584,7 +585,7 @@
     error_message "${PROBLEM_COLOR}Unable to find module ${MODULE_COLOR}${1}${PROBLEM_COLOR} in ${FILE_COLOR}${MOONBASE}${DEFAULT_COLOR}"
     return 1
   fi
-		        
+
   if [ -n "$SHORTTREE" ] ; then
     DEPENDS=$DEPENDS_STATUS
   else
@@ -600,7 +601,7 @@
     else
       STR="${INDENT}^----${PROBLEM_COLOR}$1${DEFAULT_COLOR}: "
     fi
-    
+
     for DEP in $RDEPS ; do
       REL=$(grep "^$DEP:$1:" $DEPENDS)
       CUR=$(echo $REL | cut -d: -f1)
@@ -641,7 +642,7 @@
   plugin_call() { return 0 ; }
   download_url() { echo $1$2 ; return 1 ; }
   connect() { return 0 ; }
- 
+
   LRESORT_URL=
   FRESORT_URL=
   EXHAUSTIVE=on
@@ -654,7 +655,7 @@
   else
     MODULES=$1
   fi
-  
+
   for MODULE in $MODULES ; do
     download_module $MODULE | uniq
   done
@@ -683,7 +684,7 @@
     if grep -qw $1 $SOLO ; then
       echo -n "solo "
     fi
-    echo 
+    echo
     if [ -e $MOONBASE/$SECTION/$MODULE/services ] ; then
       LINES="`wc -l $MOONBASE/$SECTION/$MODULE/services | cut -d' ' -f1`"
       echo -n "  Provides Service"
@@ -720,10 +721,10 @@
     else
       echo "  Module not installed."
     fi
- 
+
     echo ""
 	ACTIVITY=$(view_file $ACTIVITY_LOG | awk "(\$3 == \"$1\")")
-   
+
     if [ `echo "$ACTIVITY" | wc -l` -gt 10 ]; then
       ACTIVITY="`echo "$ACTIVITY" | tail -n10`"
       echo "Module Activity History (last 10)"
@@ -923,15 +924,15 @@
     html)
       lvu_catalog_html
       ;;
-      
+
     export)
       export_snapshot
       ;;
-      
+
     import)
       import_snapshot $2
       ;;
-      
+
     section)
       if [ -n "$2" ] ; then
         list_modules $2
@@ -939,7 +940,7 @@
 	list_sections
       fi
       ;;
-      
+
     alien)
       alien
       ;;
@@ -954,15 +955,15 @@
         fi
       done
       ;;
-      
+
     newer)
       newer $2
       ;;
-      
+
     older)
       older $2
       ;;
-      
+
     moonbase)
       lvu_catalog | view_file
       ;;
@@ -970,11 +971,11 @@
     leafs)
       show_leafs | sort | uniq
       ;;
-      
+
     orphans)
       show_orphans
       ;;
-      
+
     updatelog)
       if [ -e /var/log/lunar/update ]; then
         view_file /var/log/lunar/update
@@ -1027,7 +1028,7 @@
 	fi
       fi
       ;;
-	  
+
     md5sum)
       if [ -n "$2" ] ; then
         if ! md5sum_files "$INSTALL_LOGS/$2-$(installed_version $2)" ; then
@@ -1044,7 +1045,7 @@
     pam)
       find_pam_aware
       ;;
-     
+
     sources)
       sources $2
       ;;
@@ -1055,58 +1056,58 @@
 
     maintainer)
       if run_details $2 ; then
-        if [ -n "$MAINTAINER" ] ; then  
+        if [ -n "$MAINTAINER" ] ; then
           echo $MAINTAINER
         else
           echo maintainer at lunar-linux.org
         fi
       fi
       ;;
-      
+
     DETAILS)
       show_module_component $1 $2
       ;;
-      
+
     DEPENDS)
       show_module_component $1 $2
       ;;
-      
+
     CONFIGURE)
       show_module_component $1 $2
       ;;
-      
+
     CONFLICTS)
       show_module_component $1 $2
       ;;
-      
+
     PRE_BUILD)
       show_module_component $1 $2
       ;;
-      
+
     BUILD)
       show_module_component $1 $2
       ;;
-      
+
     POST_BUILD)
       show_module_component $1 $2
       ;;
-      
+
     POST_INSTALL)
       show_module_component $1 $2
       ;;
-      
+
     PRE_REMOVE)
       show_module_component $1 $2
       ;;
-      
+
     POST_REMOVE)
       show_module_component $1 $2
       ;;
-      
+
     search)
       grep -irle $2 "$MOONBASE" | grep DETAILS | sed "s;${MOONBASE}/\(.*\)/DETAILS;\1;"
       ;;
-      
+
     service)
       cat $MODULE_INDEX | while read ENTRY ; do
         MOD=$(echo $ENTRY | cut -d: -f1)
@@ -1116,11 +1117,11 @@
 	fi
       done | xargs egrep -l -i "$2" | sed "s;${MOONBASE}/\(.*\)/services;\1;"
       ;;
-      
+
     depends)
       show_depends "$2" | sort | uniq
       ;;
-      
+
     website)
       if [ -z "$2" ] ; then
         return 1
@@ -1134,7 +1135,7 @@
         fi
       fi
       ;;
-      
+
     version)
       if [ -n "$2" ] ; then
         if run_details $2 ; then
@@ -1175,7 +1176,7 @@
         fi
       fi
       ;;
-      
+
     tree)
       show_tree "$2"
       ;;
@@ -1184,7 +1185,7 @@
       SHORTTREE=1
       show_tree "$2"
       ;;
-      
+
     eert)
       SHORTTREE=1
       show_eert "$2"
@@ -1195,7 +1196,7 @@
       ;;
 
     compile)
-      run_details $2 ; 
+      run_details $2 ;
         if [ -f $COMPILE_LOGS/$2-$(lvu version $2).bz2 ] ; then
           view_file $COMPILE_LOGS/$2-$(lvu version $2).bz2
         else
@@ -1205,7 +1206,7 @@
         fi
       #fi
       ;;
-	      
+
    install)
      if run_details $2 ; then
        view_file $INSTALL_LOGS/$2-$(installed_version $2) \
@@ -1216,15 +1217,15 @@
    compiler)
      if [ ! -z "$2" ] ; then
        if run_details $2 ; then
-         if [ ! -e $INSTALL_LOGS/$2-$(installed_version $2) ] ; then 
-           echo "Install log for $2 does not exist" 
+         if [ ! -e $INSTALL_LOGS/$2-$(installed_version $2) ] ; then
+           echo "Install log for $2 does not exist"
            return 1
          else
            cat $INSTALL_LOGS/$2-$(installed_version $2) | while read LINE ; do
              if file $LINE | grep -q "ELF " ; then
                echo -n "$LINE "
                strings -a $LINE | grep GCC: | sort -r | head -n 1
-             fi  
+             fi
            done
          fi
        fi
@@ -1249,7 +1250,7 @@
      egrep -l "$REGEX" *
      popd >/dev/null
      ;;
-     
+
    what)
      if [ ! -z "$2" ] ; then
        if run_details $2 ; then
@@ -1265,7 +1266,7 @@
        fi
      fi
      ;;
-	   
+
    where)
      if [ ! -z "$2" ] ; then
        if run_details $2 ; then
@@ -1312,7 +1313,7 @@
      ;;
 
    esac
- 
+
 }
 
 
@@ -1327,9 +1328,9 @@
 else
   eval set -- $GETOPT_ARGS
   export IFS="$STANDARD_IFS"
-  
+
   set_priority
-  
+
   while true ; do
     case "$1" in
       -d|--debug       ) (( LUNAR_DEBUG++ )) ; export LUNAR_DEBUG ; shift   ;;

Modified: lunar/branches/stable/var/lib/lunar/functions/aliases.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/aliases.lunar	2007-01-06 02:09:51 UTC (rev 22844)
+++ lunar/branches/stable/var/lib/lunar/functions/aliases.lunar	2007-01-06 02:10:19 UTC (rev 22845)
@@ -48,7 +48,8 @@
   debug_msg "unalias: starting selection loop"
   error_message "${MODULE_COLOR}$MODULE${DEFAULT_COLOR}${MESSAGE_COLOR} depends on ${DEFAULT_COLOR}${QUERY_COLOR}\"${1:1}\"${DEFAULT_COLOR}${MESSAGE_COLOR} which is an alias${DEFAULT_COLOR}"
   while true ; do
-    error_message "${MESSAGE_COLOR}Please select a substitute ! Enter the number or the name of the module${DEFAULT_COLOR}"
+    error_message "${MESSAGE_COLOR}Please select a substitute ! Enter the number or the name of the module"
+    error_message "Press [ENTER] to select choice #1 (the recommended choice).${DEFAULT_COLOR}"
     ((N=0))
     for TARGET in $TARGETS ; do
       ((N++))
@@ -62,8 +63,8 @@
       set_local_config `echo LUNAR_ALIAS_${1:1}` $TARGET
       echo $TARGET
       return
-    # then the number
-    elif [[ -n "$CHOICE" ]] && [[ -n "${TARGETBYNUM[$CHOICE]}" ]] ; then
+    # then the number, resolving the default
+    elif [[ -n "${TARGETBYNUM[${CHOICE:=1}]}" ]] ; then
       verbose_msg "Stored alias mapping $1 -> ${TARGETBYNUM[$CHOICE]}"
       set_local_config `echo LUNAR_ALIAS_${1:1}` ${TARGETBYNUM[$CHOICE]}
       echo ${TARGETBYNUM[$CHOICE]}

Modified: lunar/branches/stable/var/lib/lunar/functions/check.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/check.lunar	2007-01-06 02:09:51 UTC (rev 22844)
+++ lunar/branches/stable/var/lib/lunar/functions/check.lunar	2007-01-06 02:10:19 UTC (rev 22845)
@@ -119,12 +119,18 @@
 		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 and note them if we plan on fixing them
+	if [[ ! -n "$NOFIX" ]] ; then
+		for MODULE in $MODULES ; do
+			if ! run_checks $MODULE ; then
+				 BROKEN_MODULES=( ${BROKEN_MODULES[@]} $MODULE )
+			fi
+		done
+	else
+		for MODULE in $MODULES ; do
+			run_checks $MODULE
+		done
+	fi
 
 	# if we were called with --fixdepends then we may skip the rest
 	if [ -n "$FIXDEPENDS" ] ; then
@@ -134,30 +140,32 @@
 	export TMP_LIN_SUCCESS=$(temp_create "successful")
 	export TMP_LIN_FAIL=$(temp_create "failed")
 
-	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 &&
+        if [[ ! -n "$NOFIX" ]] ; then
+		for MODULE in $(sort_by_dependency ${BROKEN_MODULES[@]}) ; do
+			if module_installed $MODULE && ! module_held $MODULE ; then
+				if ! run_checks $MODULE ; then
+					NEVER_ASK=1 DEPS_ONLY= satisfy_depends      &&
+					NEVER_ASK=1 DEPS_ONLY= FIX= satisfy_depends &&
 
-				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
+					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
-		fi
-	done
+		done
+		
+		display_update_log fix
+	else
+		display_update_log nofix
+	fi
 
-	display_update_log fix
 	temp_destroy $TMP_LIN_SUCCESS
 	temp_destroy $TMP_LIN_FAIL
 }

Modified: lunar/branches/stable/var/lib/lunar/functions/depends.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/depends.lunar	2007-01-06 02:09:51 UTC (rev 22844)
+++ lunar/branches/stable/var/lib/lunar/functions/depends.lunar	2007-01-06 02:10:19 UTC (rev 22845)
@@ -138,9 +138,9 @@
     lock_file $DEPENDS_STATUS                              &&
     if grep -q "^$1:$2:" $DEPENDS_STATUS ; then
       grep -v "^$1:$2:" $DEPENDS_STATUS_BACKUP > $DEPENDS_STATUS
-	else
+    else
       verbose_msg "adding \"$4\" depends for \"$1\" on \"$2\" ($3)"
-	fi
+    fi
 
     echo "$1:$2:$3:$4:$5:$6" >> $DEPENDS_STATUS            &&
     cp $DEPENDS_STATUS $DEPENDS_STATUS_BACKUP              &&
@@ -169,9 +169,9 @@
         message "${MODULE_COLOR}${MODULE}:${PROBLEM_COLOR} ! Error: required dependency ${MODULE_COLOR}$DEP${DEFAULT_COLOR}${PROBLEM_COLOR} is exiled and cannot be installed${DEFAULT_COLOR}"
         return 1
       else
-        message "${MODULE_COLOR}${MODULE}: ${DEFAULT_COLOR}" \
-                "Adding required dependency${FILE_COLOR}"   \
-                "$DEP ${DEFAULT_COLOR}"
+        message "${MODULE_COLOR}${MODULE}:${DEFAULT_COLOR}" \
+                "${MESSAGE_COLOR}Adding required dependency${DEFAULT_COLOR}" \
+                "${MODULE_COLOR}$DEP${DEFAULT_COLOR}"
         add_depends "$MODULE" "$DEP" "on" "required" "$2" "$3"
         lin --deps $DEP
         echo "$DEP" >> $TEMP_PREPAREDDEPS

Modified: lunar/branches/stable/var/lib/lunar/functions/modules.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/modules.lunar	2007-01-06 02:09:51 UTC (rev 22844)
+++ lunar/branches/stable/var/lib/lunar/functions/modules.lunar	2007-01-06 02:10:19 UTC (rev 22845)
@@ -230,15 +230,15 @@
     return 1
   else
     SCRIPT_DIRECTORY=$MOONBASE/$SECTION/$1
-    if [[ ! -f $SCRIPT_DIRECTORY/DETAILS ]] ; then
+    if ! has_module_file $1 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
-   
+
     if [[ -z "$WANT_VERSION" ]] ; then
-      . $SCRIPT_DIRECTORY/DETAILS &> /dev/null || return -1
+      run_module_file $1 DETAILS &> /dev/null || return -1
     else
       TMP_DETAILS=$(temp_create "details.version")
       cat $MOONBASE/$SECTION/$1/DETAILS | sed '/^\s*VERSION=/d' > $TMP_DETAILS



More information about the Lunar-commits mailing list