[Lunar-commits] r19127 - in lunar/branches/stable: bin etc/lunar/mirrors sbin usr/share/man/man8 var/lib/lunar/functions

Auke Kok sofar at lunar-linux.org
Sun Mar 5 21:05:23 UTC 2006


Author: sofar
Date: 2006-03-05 21:05:08 +0000 (Sun, 05 Mar 2006)
New Revision: 19127

Modified:
   lunar/branches/stable/bin/lvu
   lunar/branches/stable/etc/lunar/mirrors/LRESORT
   lunar/branches/stable/sbin/lin
   lunar/branches/stable/usr/share/man/man8/lin.8
   lunar/branches/stable/var/lib/lunar/functions/aliases.lunar
   lunar/branches/stable/var/lib/lunar/functions/depends.lunar
   lunar/branches/stable/var/lib/lunar/functions/download.lunar
   lunar/branches/stable/var/lib/lunar/functions/main.lunar
   lunar/branches/stable/var/lib/lunar/functions/misc.lunar
   lunar/branches/stable/var/lib/lunar/functions/modules.lunar
   lunar/branches/stable/var/lib/lunar/functions/tracking.lunar
   lunar/branches/stable/var/lib/lunar/functions/updatelog.lunar
Log:
Backmerge from theedge: bugfixes and older additions only
- lvu info shows compile time if possible
- structure update in lin (cosmetic/internal)
- add auto-manpage compression for /usr/share/man
- speedups for dependency and core module functions
- minor bugfix in alias code
- update to man lin(8)
- bugfix to LRESORT mirror file
- some prelim updates to updatelog display


Modified: lunar/branches/stable/bin/lvu
===================================================================
--- lunar/branches/stable/bin/lvu	2006-03-05 20:05:58 UTC (rev 19126)
+++ lunar/branches/stable/bin/lvu	2006-03-05 21:05:08 UTC (rev 19127)
@@ -700,15 +700,24 @@
     echo ""
     echo "Installation Info"
     if module_installed $1 ; then
-      echo -n "  Installed Version: $(installed_version $1)"
+      IVERSION=$(installed_version $1)
+      echo -n "  Installed Version: $IVERSION"
       if module_is_expired $1 ; then
-        echo "  (updated module available!)"
+        echo "  (updated module available: $VERSION!)"
       else
         echo ""
       fi
-      echo "  Approx. Size:      $(main size $1)"
+      echo -n "  Last compile time: "
+      if module_installed "TimeDate" ; then
+        CTIME=$(main compile $1 | grep 'Mark Compile ' | cut -d \" -f6 | perl -e 'use Date::Parse; my $start = <> ; my $stop = <> ; print str2time($stop) - str2time($start) . "\n";')
+        echo "$((CTIME / 60))m$((CTIME % 60))s"
+      else
+        echo "(unable to calculate without \"TimeDate\" installed)"
+      fi
+      echo -n "  Approx. Size:      "
+      main size $1
       echo -n "  Files Installed:   "
-      echo "`echo "$(main install $1)" | wc -l`"
+      main install $1 | wc -l
     else
       echo "  Module not installed."
     fi

Modified: lunar/branches/stable/etc/lunar/mirrors/LRESORT
===================================================================
--- lunar/branches/stable/etc/lunar/mirrors/LRESORT	2006-03-05 20:05:58 UTC (rev 19126)
+++ lunar/branches/stable/etc/lunar/mirrors/LRESORT	2006-03-05 21:05:08 UTC (rev 19127)
@@ -1,8 +1,9 @@
-Custom      			Custom
+Custom				Custom
 Mirror site - TX-US		http://tx-us.lunar-linux.org/lunar/cache/
-Mirror site - SE                http://jkp-se.lunar-linux.org/lunar/cache/
-Mirror site - SE                http://vxj-se.lunar-linux.org/lunar/cache/
-Mirror site - SE                http://su-se.lunar-linux.org/lunar/cache/
+Mirror site - SE		http://jkp-se.lunar-linux.org/lunar/cache/
+Mirror site - SE		http://vxj-se.lunar-linux.org/lunar/cache/
+Mirror site - SE		http://su-se.lunar-linux.org/lunar/cache/
+Mirror site - BE		http://be.lunar-linux.org/lunar/cache/
 Mirror site - DE		http://de.lunar-linux.org/lunar/cache/
-Mirror site - DE		http://k-de.lunar-linux.org/lunar/cache/
+Mirror site - DE		http://fr-de.lunar-linux.org/lunar/cache/
 Master site - NL		http://lunar-linux.org/lunar/cache/

Modified: lunar/branches/stable/sbin/lin
===================================================================
--- lunar/branches/stable/sbin/lin	2006-03-05 20:05:58 UTC (rev 19126)
+++ lunar/branches/stable/sbin/lin	2006-03-05 21:05:08 UTC (rev 19127)
@@ -125,7 +125,21 @@
       # no strange stuff should happen here anymore
       for MODULE in $MODULES ; do
         if ! module_installed $MODULE || [ ! -n "$PROBE" ] || ( [ -n "$PROBE" ] && [ "$PROBE_EXPIRED" == "on" ] && module_is_expired $MODULE ) ; then
-          if ! module_held $MODULE && ! module_exiled $MODULE && module_license_accepted $MODULE ; then
+	  # 3 more conditions to stop processing this module:
+          if module_held $MODULE ; then
+	    error_message "${LRM_COLOR}Notice:${DEFAULT_COLOR}${MESSAGE_COLOR} Skipping compile and install for held module ${MODULE_COLOR}$MODULE${DEFAULT_COLOR}"
+            continue
+	  elif module_exiled $MODULE ; then
+            error_message "${LRM_COLOR}Notice:${DEFAULT_COLOR}${MESSAGE_COLOR} Skipping compile and install for exiled module ${MODULE_COLOR}$MODULE${DEFAULT_COLOR}"
+            continue
+	  elif ! module_license_accepted $MODULE ; then
+	    error_message "${LRM_COLOR}Notice:${DEFAULT_COLOR}${MESSAGE_COLOR} The license of module ${MODULE_COLOR}$MODULE${DEFAULT_COLOR}${MESSAGE_COLOR} is incompatible with the list of"
+            error_message "allowed and/or rejected licenses. Please adjust the ACCEPTED_LICENSES or"
+            error_message "REJECTED_LICENSES variables to include or not include the specific"
+            error_message "license of this module.${DEFAULT_COLOR}"
+            continue
+	  else
+            # we're good now, start installing
             linING="/var/lock/installing.$MODULE"
             verbose_msg "starting lin \"$MODULE\""
             if ! ( SINGLE_MODULE=1 main $MODULE ) ; then
@@ -138,18 +152,6 @@
                 echo "$MODULE" >> $TMP_LIN_SUCCESS
               fi
             fi
-          else
-            # split up error messages
-            if module_held $MODULE; then
-              verbose_msg "Skipping compile and install for held module \"$MODULE\""
-            elif module_exiled $MODULE; then
-              verbose_msg "Skipping compile and install for exiled module \"$MODULE\""
-            else
-              message "${MESSAGE_COLOR}The license of this module is incompatible with the list of"
-              message "allowed and/or rejected licenses. Please adjust the ACCEPTED_LICENSES or"
-              message "REJECTED_LICENSES variables to include or not include the specific"
-              message "license of this module.${DEFAULT_COLOR}"
-            fi
           fi
         fi
       done

Modified: lunar/branches/stable/usr/share/man/man8/lin.8
===================================================================
--- lunar/branches/stable/usr/share/man/man8/lin.8	2006-03-05 20:05:58 UTC (rev 19126)
+++ lunar/branches/stable/usr/share/man/man8/lin.8	2006-03-05 21:05:08 UTC (rev 19127)
@@ -41,9 +41,15 @@
 .B "\-r, \-\-reconfigure"
 Select new configuration and dependencies for modules.
 .TP 
+.B "\-\-opts (configure flags)"
+Add arbitrary options to the configure stage of the module. The options are saved for future upgrades but will be erased by using "-r".
+.TP
 .B "\-R, \-\-resurrect"
 Reinstalls a module which has been removed but still has the compiled version available.
 .TP
+.B "\-w, \-\-want (version number)"
+Try to install a different version than the current one in moonbase. Integrity checking is turned off. Success not guaranteed.
+.TP
 .B "\-s, \-\-silent"
 Decreases the level of message output.
 .TP
@@ -84,8 +90,6 @@
 .I /etc/lunar/local/config 
 It is easier, faster and less error prone to edit them with
 .B lunar.
-.IP AUTODEPENDS
-If set to yes this turns on autodepends, that is lin automatically resolves and installs dependencies.
 .IP GNU_URL
 The GNU Mirror (default: ftp.gnu.org).
 .IP KERNEL_URL
@@ -99,13 +103,11 @@
 .IP SFORGE_URL
 The Sourceforge mirror. (default: none).
 .IP PATCH_URL
-The default patch mirror. (default: www.lunar\-linux.org/lunar/patches).
+The default patch mirror. (default: download.lunar\-linux.org/lunar/patches).
 .IP LRESORT_URL
-The default lunar mirror. If all else fails go here! (default: www.lunar\-linux.org/lunar/cache)
+The default lunar mirror. If all else fails go here! (default: download.lunar\-linux.org/lunar/cache)
 .IP MOONBASE_URL
-The lunar moonbase mirrors. (default: www.lunar\-linux.org/lunar/).
-.IP optimise
-The optimise setting. Used to configure what optimisations are used while compiling. These are the available options i586, pentium, i686, pentiumpro, k6, athlon, speedy, risky and nostrip.
+The lunar moonbase mirrors. (default: download.lunar\-linux.org/lunar/).
 .IP color
 If set to yes lin outputs nice colour. Green for messages, gray for compiling, yellow for questions, and red for errors.
 .IP PROMPT_DELAY
@@ -142,27 +144,6 @@
 .B \-\-from
 /root/spool/lunar
 emacs
-.SH "NOTES"
-Do not include 
-.SM section
-name when specifying a package. 
-.B Lin
-normally installs the
-.B default version
-of the package in the 
-.B moonbase.
-Alternate versions of a module may be specified
-either as 
-.B package/version 
-or
-.B --Version version
-(where a /version exists in the moonbase). Package versions are required to begin with
-a numeral ([0-9]). 
-To get complete listing of software packages type
-.I lvu moonbase
-.TP 
-If module fails during a lin, try reinstalling it with \-r \-c to reconfigure and recompile.
-.SH "COMMENTS"
 Unless the
 .B \-from
 option is specified lin will always check the

Modified: lunar/branches/stable/var/lib/lunar/functions/aliases.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/aliases.lunar	2006-03-05 20:05:58 UTC (rev 19126)
+++ lunar/branches/stable/var/lib/lunar/functions/aliases.lunar	2006-03-05 21:05:08 UTC (rev 19127)
@@ -13,88 +13,92 @@
 # and add it to the dependency chain if needed
 unalias() {
   local TARGET TARGETS TARGETBYNUM N CHOICE
+  # quick exit code
+  if [ "${1:0:1}" != "%" ] ; then
+    echo $1
+    return
+  fi
+
+  debug_msg "unalias($@)"
   # try to figure out where the aliases file is:
-  if [ -z "$ALIASES" -o ! -f "$ALIASES" ]; then
+  if [[ -z "$ALIASES" ]] || [[ ! -f "$ALIASES" ]]; then
     if [ -f "$MOONBASE/aliases" ] ; then
-	  ALIASES="$MOONBASE/aliases"
-	else
-	  ALIASES="/var/lib/lunar/aliases"
-	fi
+      ALIASES="$MOONBASE/aliases"
+    else
+      ALIASES="/var/lib/lunar/aliases"
+    fi
   fi
-  if [ "${1:0:1}" == "%" ] ; then
-    debug_msg "unalias($@)"
-    TARGETS=$(grep "^$1:" $ALIASES | cut -d: -f2-)
-    # dumb algorithm: pick the first installed one
+  
+  TARGETS=$(awk -F: -v mod=$1 '{if ($1==mod){print $2}}' $ALIASES)
+  # dumb algorithm: pick the first installed one
+  for TARGET in $TARGETS ; do
+    if module_installed $TARGET ; then
+      debug_msg "unaliased \"$1\"->\"$TARGET\""
+      echo $TARGET
+      return
+    fi
+  done
+  # shortcut out: in the satisfy_depends stage we should NOT ask this again
+  if [[ -z "$DEPS_ONLY" ]] ; then
+    # first we check if this dependency is already existant in the exact
+    # way: does this MODULE depends on TARGET already ?
     for TARGET in $TARGETS ; do
-      if $(module_installed $TARGET) ; then
+      if in_depends $MODULE $TARGET ; then
         debug_msg "unaliased \"$1\"->\"$TARGET\""
         echo $TARGET
-	return
+        return
       fi
     done
-    # shortcut out: in the satisfy_depends stage we should NOT ask this again
-    if [ -z "$DEPS_ONLY" ] ; then
-      # first we check if this dependency is already existant in the exact
-      # way: does this MODULE depends on TARGET already ?
-      for TARGET in $TARGETS ; do
-        if in_depends $MODULE $TARGET ; then
-          debug_msg "unaliased \"$1\"->\"$TARGET\""
-          echo $TARGET
-          return
-        fi
-      done
-      # not so... other possibility is that something else already depends
-      # on TARGET?
-      for TARGET in $TARGETS ; do
-        if is_depends $TARGET ; then
-          debug_msg "unaliased \"$1\"->\"$TARGET\""
-          echo $TARGET
-          return
-        fi
-      done
-      # also not so. our last attempt is for a DISABLED dependency, but
-      # we can only use this method for OPTIONAL dependencies
-      for TARGET in $TARGETS ; do
-        # there's no function for this yet
-        if grep -q ":$TARGET:off:" $DEPENDS_STATUS ; then
-          debug_msg "unaliased \"$1\"->\"$TARGET\""
-          echo $TARGET
-          return
-        fi
-      done
-    fi
-
-    # shortcut out when explicitly instructed so
-    if [ -n "$NEVER_ASK" ] ; then
-      echo $1
-      return
-    fi
-
-    # propose one and let the user pick it from a list:
-    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}"
-      ((N=0))
-      for TARGET in $TARGETS ; do
-        ((N++))
-	TARGETBYNUM[$N]=$TARGET
-        error_message "  ${QUERY_COLOR}$N${MESSAGE_COLOR} - ${DEFAULT_COLOR}${MODULE_COLOR}$TARGET${DEFAULT_COLOR}"
-      done
-      read CHOICE
-      # test directly first
-      if $(echo $TARGETS | grep -qw "$CHOICE") ; then
+    # not so... other possibility is that something else already depends
+    # on TARGET?
+    for TARGET in $TARGETS ; do
+      if is_depends $TARGET ; then
+        debug_msg "unaliased \"$1\"->\"$TARGET\""
         echo $TARGET
-	return
-      # then the number
-      elif [ -n "$CHOICE" -a -n "${TARGETBYNUM[$CHOICE]}" ] ; then
-        echo ${TARGETBYNUM[$CHOICE]}
         return
       fi
-      error_message "${MESSAGE_COLOR}Sorry, I can't do anything with \"${DEFAULT_COLOR}${QUERY_COLOR}$CHOICE${DEFAULT_COLOR}${MESSAGE_COLOR}\", please try again${DEFAULT_COLOR}"
     done
-  else
+    # also not so. our last attempt is for a DISABLED dependency, but
+    # we can only use this method for OPTIONAL dependencies
+    for TARGET in $TARGETS ; do
+      # there's no function for this yet
+      if grep -q ":$TARGET:off:" $DEPENDS_STATUS ; then
+        debug_msg "unaliased \"$1\"->\"$TARGET\""
+        echo $TARGET
+        return
+      fi
+    done
+  fi
+
+  # shortcut out when explicitly instructed so
+  if [[ -n "$NEVER_ASK" ]] ; then
     echo $1
     return
   fi
+
+  # propose one and let the user pick it from a list:
+  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}"
+    ((N=0))
+    for TARGET in $TARGETS ; do
+      ((N++))
+      TARGETBYNUM[$N]=$TARGET
+      error_message "  ${QUERY_COLOR}$N${MESSAGE_COLOR} - ${DEFAULT_COLOR}${MODULE_COLOR}$TARGET${DEFAULT_COLOR}"
+    done
+    read CHOICE
+    # test directly first
+    if echo $TARGETS | grep -qw "$CHOICE" ; then
+      echo $TARGET
+      return
+    # then the number
+    elif [[ -n "$CHOICE" ]] && [[ -n "${TARGETBYNUM[$CHOICE]}" ]] ; then
+      echo ${TARGETBYNUM[$CHOICE]}
+      return
+    fi
+    error_message "${MESSAGE_COLOR}Sorry, I can't do anything with \"${DEFAULT_COLOR}${QUERY_COLOR}$CHOICE${DEFAULT_COLOR}${MESSAGE_COLOR}\", please try again${DEFAULT_COLOR}"
+  done
 }
+
+

Modified: lunar/branches/stable/var/lib/lunar/functions/depends.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/depends.lunar	2006-03-05 20:05:58 UTC (rev 19126)
+++ lunar/branches/stable/var/lib/lunar/functions/depends.lunar	2006-03-05 21:05:08 UTC (rev 19127)
@@ -30,15 +30,13 @@
 
   find_depends_intern() {
     local DEP STATE LINE
-    grep "^$1:" $DEPENDS_CACHE | while read LINE ; do
-      DEP=$(echo $LINE | cut -d: -f2)
+    awk -F: -v mod=$1 '{if ($1==mod){print $2,$3}}' $DEPENDS_CACHE | while read DEP STATE ; do
       DEP=$(unalias $DEP)
       # this is our shortcut out:
       if ! grep -qx "$DEP" $TMP_FDEPS ; then
-      debug_msg "$DEP"
+        debug_msg "$DEP"
         echo "$DEP" >> $TMP_FDEPS
-        STATE=$(echo $LINE | cut -d: -f3)
-        if [ "$STATE" == "required" ] ; then
+        if [[ "$STATE" == "required" ]] ; then
           echo $DEP
           find_depends_intern $DEP
         elif module_installed $DEP ; then
@@ -71,7 +69,7 @@
 
   # tsort the existing dep relations in all of moonbase
   TMP_TSRT=$(temp_create "dependency.sort")
-  cat $DEPENDS_CACHE | cut -d: -f1,2 --output-delimiter=" " | while read A B ; do
+  awk -F: '{print $1,$2}' $DEPENDS_CACHE | while read A B ; do
     B=$(MODULE=$A NEVER_ASK=1 DEPS_ONLY= unalias $B)
     echo "$A $B" >> $TMP_TSRT
   done
@@ -145,7 +143,7 @@
 	fi
                                                                                 
     echo "$1:$2:$3:$4:$5:$6" >> $DEPENDS_STATUS            &&
-    cat $DEPENDS_STATUS > $DEPENDS_STATUS_BACKUP           &&
+    cp $DEPENDS_STATUS $DEPENDS_STATUS_BACKUP              &&
     unlock_file $DEPENDS_STATUS                            &&
     unlock_file $DEPENDS_STATUS_BACKUP
   fi

Modified: lunar/branches/stable/var/lib/lunar/functions/download.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/download.lunar	2006-03-05 20:05:58 UTC (rev 19126)
+++ lunar/branches/stable/var/lib/lunar/functions/download.lunar	2006-03-05 21:05:08 UTC (rev 19127)
@@ -36,7 +36,7 @@
 download_url() {
     local RETVAL
 	debug_msg "download_url($@)"
-	verbose_msg "trying to download \"$1\""
+	verbose_msg "trying to download \"$1/$2\""
 	connect &&
 	plugin_call SOURCE_DOWNLOAD $1 $2 $3
 	RETVAL=$?

Modified: lunar/branches/stable/var/lib/lunar/functions/main.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/main.lunar	2006-03-05 20:05:58 UTC (rev 19126)
+++ lunar/branches/stable/var/lib/lunar/functions/main.lunar	2006-03-05 21:05:08 UTC (rev 19127)
@@ -40,7 +40,7 @@
     prune
   fi
 
-  display_update_log
+  display_update_log renew
 
   temp_destroy $TMP_LIN_SUCCESS
   temp_destroy $TMP_LIN_FAIL
@@ -110,8 +110,15 @@
   temp_destroy $TMP_QUEUE
 
   if [ -n "$QUEUE" ] ; then
+    export TMP_LIN_SUCCESS=$(temp_create "successful")
+    export TMP_LIN_FAIL=$(temp_create "failed")
+  
     message "${MESSAGE_COLOR}Starting rebuild of modules${DEFAULT_COLOR}"
     lin -c $QUEUE
+
+    display_update_log rebuild
+    temp_destroy $TMP_LIN_SUCCESS
+    temp_destroy $TMP_LIN_FAIL
   fi
 }
 

Modified: lunar/branches/stable/var/lib/lunar/functions/misc.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/misc.lunar	2006-03-05 20:05:58 UTC (rev 19126)
+++ lunar/branches/stable/var/lib/lunar/functions/misc.lunar	2006-03-05 21:05:08 UTC (rev 19127)
@@ -116,9 +116,10 @@
 
 unmap_device()
 {
-    local DEVICE
+    local DEVICE REAL
+	REAL=$(readlink -f $1)
     for DEVICE in $(ls -1d /dev/[hs]d* 2> /dev/null); do
-        if [ "$(readlink -f $DEVICE)" == "$(readlink -f $1)" ]; then
+        if [[ "$(readlink -f $DEVICE)" == "$REAL" ]]; then
             echo $DEVICE
             return 0
         fi
@@ -142,3 +143,25 @@
 }
 
 
+custom_filters()
+{
+	local FILE
+	if [[ "${COMPRESS_MANPAGES:=on}" == "on" ]]; then
+		while read FILE; do
+			if [[ -f "$FILE" ]] ; then
+				if echo "$FILE" | grep '^/usr/share/man/man' | grep -q -v '\.gz$'; then
+					gzip -9 < "$FILE" > "$FILE.gz"
+					debug_msg "Compressing man page \"$FILE\""
+					rm -f "$FILE"
+					echo "$FILE.gz"
+				else
+					echo "$FILE"
+				fi
+			else
+				echo "$FILE"
+			fi
+		done
+	else
+		cat -
+	fi
+}

Modified: lunar/branches/stable/var/lib/lunar/functions/modules.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/modules.lunar	2006-03-05 20:05:58 UTC (rev 19126)
+++ lunar/branches/stable/var/lib/lunar/functions/modules.lunar	2006-03-05 21:05:08 UTC (rev 19127)
@@ -40,7 +40,7 @@
 # purpose  : list the modules in a section, filter out the specific files
 list_modules() {
   debug_msg "list_modules ($@)"
-  if [ -z "$1" ] ; then
+  if [[ -z "$1" ]] ; then
     error_message "${PROBLEM_COLOR}list_modules(): no SECTION defined!${DEFAULT_COLOR}"
     exit 1
   fi
@@ -84,14 +84,14 @@
   debug_msg "create_module_index ($@)"
   # make sure it exists before trying to see it's writeable
   # this also assures that depends.cache gets remade
-  if [ ! -f $MODULE_INDEX ] ; then
+  if [[ ! -f $MODULE_INDEX ]] ; then
     touch $MODULE_INDEX &> /dev/null
   fi
   
   # silently fail if we cannot write to $MODULE_INDEX, it is okay
   # for this to fail in case we are a mere user using lvu's search
   # functionality
-  if [ ! -w "$MODULE_INDEX" ] ; then
+  if [[ ! -w "$MODULE_INDEX" ]] ; then
     return 0
   fi
  
@@ -101,7 +101,7 @@
   TMP_INDEX=$(temp_create "module.index")
 
   # here we have two options: system moonbase or custom:
-  if [ "$MOONBASE" == "/var/lib/lunar/moonbase" -a -f $INSTALL_LOGS/moonbase-$(installed_version moonbase) ] ; then
+  if [[ "$MOONBASE" == "/var/lib/lunar/moonbase" ]] && [[ -f $INSTALL_LOGS/moonbase-$(installed_version moonbase) ]] ; then
     # short way out:
     debug_msg "Quick generating \$MODULE_INDEX..."
     grep "/DETAILS$" $INSTALL_LOGS/moonbase-$(installed_version moonbase) | \
@@ -136,13 +136,22 @@
 function check_module_index() {
 (
   debug_msg "check_module_index ($@)"
-  if [ ! -e $MODULE_INDEX -o ! -e $DEPENDS_CACHE -o -n "$(find $MOONBASE -type f -name "DETAILS" -cnewer $MODULE_INDEX)" ] ; then
+  local RESULT=1
+  if [[ ! -e $MODULE_INDEX ]] || [[ ! -e $DEPENDS_CACHE ]]; then
     create_module_index
     create_depends_cache
-    return 0
+    RESULT=0
   else
-    return 1
+    if [[ -n "$(find $MOONBASE -type f -name "DEPENDS" -cnewer $DEPENDS_CACHE)" ]]; then
+      create_depends_cache
+      RESULT=0
+    fi
+    if [[ -n "$(find $MOONBASE -type f -name "DETAILS" -cnewer $MODULE_INDEX)" ]]; then
+      create_module_index
+      RESULT=0
+    fi
   fi
+  return $RESULT
 )
 }
 
@@ -155,48 +164,32 @@
   local SECTION SECTIONS
   debug_msg "find_section ($@)"
 
-  ZLOCAL_OVERRIDES=${ZLOCAL_OVERRIDES:=off}
-  if [ "$ZLOCAL_OVERRIDES" == "on" ] ; then
-    if SECTION=$(find "$MOONBASE/zlocal/" -type d -name $1 | sed -e "s|$MOONBASE/||" -e "s|/$1$||" ) ; then
-	  if [ -n "$SECTION" ]; then
-	    echo $SECTION
+  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
   fi
 
-  SECTION=$(grep ^$1: $MODULE_INDEX 2>/dev/null | head -n 1 | cut -d: -f2)
-  if [ -n "$SECTION" ] ; then
-    if [ -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
 
   if ! check_module_index ; then
     # shave some time off not trying the rest of the code below since that
-	# is useless
-	return 1
+    # is useless
+    return 1
   fi
 
-  SECTION=$(grep ^$1: $MODULE_INDEX 2>/dev/null | head -n 1 | cut -d: -f2)
-  if [ -n "$SECTION" ] ; then
-    if [ -d "$MOONBASE/$SECTION/$1" ] ; then
-      echo "$SECTION"
-      return 0
-    fi
-  fi
-
-  if ! SECTIONS=$(list_sections) ; then
+  SECTION=$(awk -F: "(\$1==\"$1\"){print \$2;exit 0}" $MODULE_INDEX)
+  if [[ -n "$SECTION" ]] && [[ -d "$MOONBASE/$SECTION/$1" ]] ; then
+    echo "$SECTION"
     return 0
   fi
-           
-  for SECTION in $SECTIONS ; do
-    if [ -n "$(list_modules $SECTION | grep ^$MODULE$ )" ] ; then
-      echo "$SECTION"
-      return 0
-    fi
-  done
 
   return 1
 }
@@ -214,24 +207,24 @@
   # if this is a problem or not... -sofar
 
   SECTION=$(find_section $1)
-  if [ -z "$SECTION" ] ; then
+  if [[ -z "$SECTION" ]] ; then
     error_message  "${PROBLEM_COLOR}Unable to find module ${MODULE_COLOR}${1}${DEFAULT_COLOR}"  \
              "${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
+    if [[ -z "$WANT_VERSION" ]] ; then
+      . $SCRIPT_DIRECTORY/DETAILS &> /dev/null || return -1
     else
       TMP_DETAILS=$(temp_create "details.version")
-      cat $MOONBASE/$SECTION/$1/DETAILS | sed '/^[ ]*VERSION=/d' > $TMP_DETAILS
+      cat $MOONBASE/$SECTION/$1/DETAILS | sed '/^\s*VERSION=/d' > $TMP_DETAILS
       VERSION="$WANT_VERSION"
       . $TMP_DETAILS &> /dev/null || return -1
       temp_destroy $TMP_DETAILS
@@ -271,7 +264,7 @@
 # usage    : module_installed $MODULE
 # purpose  : check if $MODULE is installed (or held)
 module_installed() {
-  $(cat $MODULE_STATUS | cut -d: -f1,3 | grep -q -e "^$1:installed" -e "^$1:held")
+  $(cut -d: -f1,3 $MODULE_STATUS | grep -q -e "^$1:installed" -e "^$1:held")
 }
 
 
@@ -280,7 +273,7 @@
 # purpose  : check if $MODULE is held
 module_held() {
   debug_msg "module_held ($@)"
-  $(cat $MODULE_STATUS | cut -d: -f1,3 | grep -q "^$1:held")
+  $(cut -d: -f1,3 $MODULE_STATUS | grep -q "^$1:held")
 }
 
 
@@ -313,9 +306,9 @@
   # REJECTED_LICESES is set, must _NOT_ be listed
   # * accept "osi" will accept all osi licenses
   # * accept "all" will accept anything
-  if [ -n "$ACCEPTED_LICENSES" ]; then
+  if [[ -n "$ACCEPTED_LICENSES" ]]; then
     for L in $ACCEPTED_LICENSES; do
-      if [ "$L" == "osi" -a "$IS_OSI" == "yes" ] || [ "$L" == "all" ] || [ "$LICENSE" == "$L" ] ; then
+      if [[ "$L" == "osi" ]] && "$IS_OSI" == "yes" ]] || [ "$L" == "all" ] || [ "$LICENSE" == "$L" ] ; then
         # explicitly accepted license!
 	debug_msg "module_license_accepted: \"$LICENSE\" is explicitly accepted"
         return 0
@@ -324,9 +317,9 @@
     # it was not explicitly accepted
     error_message "${MODULE_COLOR}$1${DEFAULT_COLOR}: ${PROBLEM_COLOR}License \"$LICENSE\" is not explicitly accepted${DEFAULT_COLOR}"
     return 1
-  elif [ -n "$REJECTED_LICENSES" ]; then
+  elif [[ -n "$REJECTED_LICENSES" ]]; then
     for L in $REJECTED_LICENSES; do
-      if [ "$LICENSE" == "$L" ]; then
+      if [[ "$LICENSE" == "$L" ]]; then
         # explicitly rejected license!
 	error_message "${MODULE_COLOR}$1${DEFAULT_COLOR}: ${PROBLEM_COLOR}License \"$LICENSE\" is explicitly rejected${DEFAULT_COLOR}"
 	return 1
@@ -337,7 +330,7 @@
     return 0
   else ## if [ -z "${ACCEPTED_LICENSES}${REJECTED_LICESES}" ]; then
     # so now we have a problem - the user didn't set their prefs
-    if [ "$IS_OSI" != "yes" ] ; then
+    if [[ "$IS_OSI" != "yes" ]]; then
       error_message "${MODULE_COLOR}$1${DEFAULT_COLOR}: ${PROBLEM_COLOR}License \"$LICENSE\" cannot be accepted by default${DEFAULT_COLOR}"
       return 1
     fi
@@ -350,7 +343,7 @@
 # purpose  : check if $MODULE is exiled
 module_exiled() {
   debug_msg "module_exiled ($@)"
-  $(cat $MODULE_STATUS | cut -d: -f1,3 | grep -q "^$1:exiled")
+  $(cut -d: -f1,3 $MODULE_STATUS | grep -q "^$1:exiled")
 }
 
 
@@ -382,12 +375,11 @@
 hold_modules() {
   local MODULE
   debug_msg "hold_modules ($@)"
-  if [ -n "$1" ] ; then
+  if [[ -n "$1" ]] ; then
     lock_file $MODULE_STATUS_BACKUP &&
     lock_file $MODULE_STATUS &&
     for MODULE in "$@" ; do
-      grep -v "^$MODULE:" $MODULE_STATUS > $MODULE_STATUS_BACKUP
-      grep "^$MODULE:" $MODULE_STATUS | sed "s:installed:held:" >> $MODULE_STATUS_BACKUP
+      awk -F: -v mod=$MODULE '{if ($1==mod && $3 == "installed") {print $1":"$2":held:"$4":"$5}  else print;}' $MODULE_STATUS > $MODULE_STATUS_BACKUP
       cp $MODULE_STATUS_BACKUP $MODULE_STATUS
     done
     unlock_file $MODULE_STATUS
@@ -401,13 +393,12 @@
 # purpose  : put modules on hold back to normal
 unhold_modules () {
   local MODULE
-  debug_msg "unhold_modules  ($@)"
-  if [ -n "$1" ] ; then
+  debug_msg "unhold_modules ($@)"
+  if [[ -n "$1" ]] ; then
     lock_file $MODULE_STATUS_BACKUP &&
     lock_file $MODULE_STATUS &&
     for MODULE in "$@" ; do
-      grep -v "^$MODULE:" $MODULE_STATUS > $MODULE_STATUS_BACKUP
-      grep "^$MODULE:" $MODULE_STATUS | sed "s:held:installed:" >> $MODULE_STATUS_BACKUP
+      awk -F: -v mod=$MODULE '{if ($1==mod && $3 == "held") {print $1":"$2":installed:"$4":"$5}  else print;}' $MODULE_STATUS > $MODULE_STATUS_BACKUP
       cp $MODULE_STATUS_BACKUP $MODULE_STATUS
     done
     unlock_file $MODULE_STATUS
@@ -422,17 +413,16 @@
 exile_modules() {
   local MODULE
   debug_msg "exile_modules ($@)"
-  if [ -n "$1" ] ; then
+  if [[ -n "$1" ]] ; then
     lock_file $MODULE_STATUS_BACKUP &&
     lock_file $MODULE_STATUS &&
     for MODULE in "$@" ; do
-      if $(module_installed $MODULE) ; then
-        grep -v "^$MODULE:" $MODULE_STATUS > $MODULE_STATUS_BACKUP
-        grep "^$MODULE:" $MODULE_STATUS | sed "s:installed:exiled:" >> $MODULE_STATUS_BACKUP
+      if $(module_installed $MODULE); then
+        error_message "${PROBLEM_COLOR}Cannot exile installed module ${MODULE_COLOR}$MODULE${DEFAULT_COLOR}"
       else
-        echo "$MODULE::exiled:0.0" >> $MODULE_STATUS_BACKUP
+        echo "$MODULE::exiled::" >> $MODULE_STATUS_BACKUP
+        cp $MODULE_STATUS_BACKUP $MODULE_STATUS
       fi
-      cp $MODULE_STATUS_BACKUP $MODULE_STATUS
     done
     unlock_file $MODULE_STATUS
     unlock_file $MODULE_STATUS_BACKUP
@@ -451,7 +441,6 @@
     lock_file $MODULE_STATUS &&
     for MODULE in "$@" ; do
       grep -v "^$MODULE:" $MODULE_STATUS > $MODULE_STATUS_BACKUP
-      grep "^$MODULE:" $MODULE_STATUS | sed "s:exiled:installed:" >> $MODULE_STATUS_BACKUP
       cp $MODULE_STATUS_BACKUP $MODULE_STATUS
     done
     unlock_file $MODULE_STATUS
@@ -474,20 +463,10 @@
   verbose_msg "updating lunar state files after module removal"
   lock_file $MODULE_STATUS_BACKUP                              &&
   lock_file $MODULE_STATUS                                     && 
-  grep  -v  "^$1:" $MODULE_STATUS_BACKUP  >  $MODULE_STATUS 2>/dev/null
-  cat $MODULE_STATUS >  $MODULE_STATUS_BACKUP               2>/dev/null
+  grep -v "^$1:" $MODULE_STATUS > $MODULE_STATUS_BACKUP
+  cp $MODULE_STATUS_BACKUP $MODULE_STATUS
   unlock_file $MODULE_STATUS
   unlock_file $MODULE_STATUS_BACKUP
-
-  if [ -n "$EXILE" ] ; then
-     exile_modules "$1"                                  &&
-     lock_file $DEPENDS_STATUS_BACKUP                    &&
-     lock_file $DEPENDS_STATUS                           &&
-     grep  -v  ":$1:" $DEPENDS_STATUS_BACKUP  >   $DEPENDS_STATUS  &&
-     cat $DEPENDS_STATUS >  $DEPENDS_STATUS_BACKUP
-     unlock_file $DEPENDS_STATUS
-     unlock_file $DEPENDS_STATUS_BACKUP
-  fi
 }
 
 
@@ -545,10 +524,10 @@
     LINE=$(grep "^$MODULE:" $MODULE_STATUS | grep -v "^moonbase" | awk -F: '{print "IDATE="$2" STATUS="$3" IVERSION="$4}')
     eval $LINE
     if run_details $MODULE &> /dev/null ; then
-      if [ "$STATUS" == "installed" ] ; then
-        if [ "$VERSION" != "$IVERSION" ] || [ -z "$IDATE" ] ||
+      if [[ "$STATUS" == "installed" ]] ; then
+        if [[ "$VERSION" != "$IVERSION" ]] || [[ -z "$IDATE" ]] ||
 	  (( "$UPDATED" > "$IDATE" )) ; then
-	  if [ "$MODULE" != "lunar" ] && [ "$MODULE" != "theedge" ] ; then
+	  if [[ "$MODULE" != "lunar" ]] && [[ "$MODULE" != "theedge" ]] ; then
 	    return 0
 	  fi
 	fi
@@ -617,32 +596,11 @@
 
 check_blacklist() {
   debug_msg "check_blacklist ($@)"
-  # Copyrighted Jason Johnston  2002 under GPLv2
-
-  # This checks the /var/state/lunar/gcc.<platform>
-  # file to see if it exists.  If it does exist then
-  # we grep it to see the names of the modules that
-  # DO NOT compile with gcc 3x.  If the module is
-  # on the list, we set the path so that gcc 3x is
-  # NOT used.
-
-  # If you find a module that does not compile with
-  # gcc 3x please email your findings to
-  # maintainer at lunar-linux.org.
-
-  if [ -z "$PLATFORM" ] ; then
-    eval $(grep PLATFORM= /etc/lunar/local/optimizations)
-  fi
-
-  # Usage check_checklist $MODULES
-  PLATFORM=${PLATFORM:-x86}
   if [ -f /var/state/lunar/blacklist.$PLATFORM ] ; then
     if grep "^$MODULE$" /var/state/lunar/blacklist.$PLATFORM ; then
-      message "${PROBLEM_COLOR}! Module ${DEFAULT_COLOR}${MODULE_COLOR}$MODULE${DEFAULT_COLOR}${PROBLEM_COLOR} is blacklisted and will not be installed${DEFAULT_COLOR}"
+      error_message "${PROBLEM_COLOR}ERROR:${DEFAULT_COLOR}${MESSAGE_COLOR} Module ${DEFAULT_COLOR}${MODULE_COLOR}$MODULE${DEFAULT_COLOR}${MESSAGE_COLOR} is blacklisted and will not be installed!${DEFAULT_COLOR}"
       exit 0
     fi
-  else
-    touch /var/state/lunar/blacklist.$PLATFORM
   fi
 }
 

Modified: lunar/branches/stable/var/lib/lunar/functions/tracking.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/tracking.lunar	2006-03-05 20:05:58 UTC (rev 19126)
+++ lunar/branches/stable/var/lib/lunar/functions/tracking.lunar	2006-03-05 21:05:08 UTC (rev 19127)
@@ -73,7 +73,7 @@
 
   export IFS="$TAB_ENTER_IFS"
 
-  parse_iw | sort | uniq | filter  "$LOCAL_EXCLUDED" | exists > $TMP_INST_LOG
+  parse_iw | sort | uniq | filter "$LOCAL_EXCLUDED" | custom_filters | exists > $TMP_INST_LOG
   echo "$INSTALL_LOGS/$MODULE-$VERSION"                 >> $TMP_INST_LOG
   echo "$COMPILE_LOGS/$MODULE-$VERSION.bz2"             >> $TMP_INST_LOG
   echo "$MD5SUM_LOGS/$MODULE-$VERSION"                  >> $TMP_INST_LOG

Modified: lunar/branches/stable/var/lib/lunar/functions/updatelog.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/updatelog.lunar	2006-03-05 20:05:58 UTC (rev 19126)
+++ lunar/branches/stable/var/lib/lunar/functions/updatelog.lunar	2006-03-05 21:05:08 UTC (rev 19127)
@@ -24,7 +24,7 @@
   rm -f /var/log/lunar/update 
   { 
     if [ -e "$TMP_LIN_SUCCESS" -a -e "$TMP_LIN_FAIL" ] ; then 
-      display_success_info
+      display_success_info $1
     fi
   } | tee /var/log/lunar/update 
 }
@@ -41,7 +41,7 @@
   NUMFAILURES=$(cat $TMP_LIN_FAIL | wc -l)
 
   message
-  message  "${MESSAGE_COLOR}Lunar renew completed at `date`${DEFAULT_COLOR}"
+  message  "${MESSAGE_COLOR}Lunar $1 completed at `date`${DEFAULT_COLOR}"
   message  "Successful  : " $NUMSUCCESS
   message  "Failed      : " $NUMFAILURES  
   message  



More information about the Lunar-commits mailing list