[Lunar-commits] r14733 - lunar/trunk/var/lib/lunar/functions

Auke Kok sofar at lunar-linux.org
Sun May 15 18:05:37 UTC 2005


Author: sofar
Date: 2005-05-15 18:05:36 +0000 (Sun, 15 May 2005)
New Revision: 14733

Modified:
   lunar/trunk/var/lib/lunar/functions/depends.lunar
   lunar/trunk/var/lib/lunar/functions/updatelog.lunar
Log:
Fix moonbase display changes. Note create_depends_cache ()'-ed


Modified: lunar/trunk/var/lib/lunar/functions/depends.lunar
===================================================================
--- lunar/trunk/var/lib/lunar/functions/depends.lunar	2005-05-15 15:59:27 UTC (rev 14732)
+++ lunar/trunk/var/lib/lunar/functions/depends.lunar	2005-05-15 18:05:36 UTC (rev 14733)
@@ -354,7 +354,8 @@
 }
 
 
-create_depends_cache() {
+create_depends_cache()
+{(
   debug_msg "create_depends_cache($@)"
 
   if [ ! -w $DEPENDS_CACHE -a -e $DEPENDS_CACHE ] ; then
@@ -398,7 +399,7 @@
   else
     verbose_msg "Skipping depends cache regeneration"
   fi
-}
+)}
 
 
 # list all installed modules depending on $1
@@ -411,3 +412,5 @@
     fi
   done
 }
+
+

Modified: lunar/trunk/var/lib/lunar/functions/updatelog.lunar
===================================================================
--- lunar/trunk/var/lib/lunar/functions/updatelog.lunar	2005-05-15 15:59:27 UTC (rev 14732)
+++ lunar/trunk/var/lib/lunar/functions/updatelog.lunar	2005-05-15 18:05:36 UTC (rev 14733)
@@ -62,37 +62,55 @@
 # function : display_moonbase_changes
 # usage    : display_moonbase_changes
 # purpose  : display a list of modules added or removed during this update
-display_moonbase_changes()  {  
+display_moonbase_changes()  {
   debug_msg "display_moonbase_changes ($@)"
-  MODULE_CHANGES=$(temp_create "module-changes")
 
   if [ -e "$MODULE_INDEX" ] && [ -e "$TMP_MODULE_INDEX" ]; then
-    diff -y $MODULE_INDEX $TMP_MODULE_INDEX | sort > $MODULE_CHANGES
+    MODULE_CHANGES=$(temp_create "module-changes")
+    diff -U0 $TMP_MODULE_INDEX $MODULE_INDEX | grep -v -e '^@@' -e '^---' -e '^+++' > $MODULE_CHANGES
 
-    NEW_MODULES=$(grep '<' $MODULE_CHANGES | wc -l)
-    DEL_MODULES=$(grep '>' $MODULE_CHANGES | wc -l)
-    MOV_MODULES=$(grep '|' $MODULE_CHANGES | wc -l)
-    message
+    MODULES=$(cat $MODULE_CHANGES | cut -d: -f1 | sed 's:^[+-]::' | sort -t : | uniq)
+	for M in $MODULES; do
+	  IN=$(grep "^-$M:" $MODULE_CHANGES)
+	  OUT=$(grep "^+$M:" $MODULE_CHANGES)
+	  if [ -z "$IN" -a -n "$OUT" ] ; then
+	    # new module:
+		NEW_MODULES="$NEW_MODULES $M"
+	  elif [ -n "$IN" -a -z "$OUT" ] ; then
+	    # removed module:
+		DEL_MODULES="$DEL_MODULES $M"
+	  else
+	    # moved module
+		MOV_MODULES="$MOV_MODULES $M"
+	  fi
+	done
 
-    if [ "$NEW_MODULES" != "0" ]; then
+    if [ -n "$NEW_MODULES" ]; then
       message "${MESSAGE_COLOR}New modules:${DEFAULT_COLOR}"
-      grep '<' $MODULE_CHANGES | tr -d '<' | sort -t : -k 2
+	  for M in $NEW_MODULES; do
+	   message "  $M"
+	  done
       message
     fi
 
-    if [ "$DEL_MODULES" != "0" ]; then
+    if [ -n "$DEL_MODULES" ]; then
       message "${MESSAGE_COLOR}Removed modules:${DEFAULT_COLOR}"
-      grep '>' $MODULE_CHANGES | tr -d '>\t ' | sort -t : -k 2
+	  for M in $DEL_MODULES; do
+	    message "  $M"
+	  done
       message
     fi
 
-    if [ "$MOV_MODULES" != "0" ]; then
+    if [ -n "$MOV_MODULES" ]; then
       message "${MESSAGE_COLOR}Moved modules:${DEFAULT_COLOR}"
-      grep '|' $MODULE_CHANGES | tr -d '>\t ' | sed -e 's#\(.*\):\(.*\)|\(.*\):\(.*\)#\1: \2 -> \4#g' | sort -t - -k 2
+	  for M in $MOV_MODULES; do
+	    INS=$(grep "^[-]$M:" $MODULE_CHANGES | cut -d: -f2)
+		OUTS=$(grep "^[+]$M:" $MODULE_CHANGES | cut -d: -f2)
+		message "  $M: $INS -> $OUTS"
+	  done
       message
     fi
+  temp_destroy $MODULE_CHANGES
   fi
-
-  temp_destroy $MODULE_CHANGES
 }
 



More information about the Lunar-commits mailing list