[Lunar-commits] CVS: theedge/var/lib/lunar/functions updatelog.lunar, 1.12, 1.13

Jon South striker at lunar-linux.org
Mon Feb 23 22:05:34 GMT 2004


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

Modified Files:
	updatelog.lunar 
Log Message:
- Modified display_moonbase_changes() to show moved modules.
e.g. -
Moved modules:
module: old_cat -> new_cat

[21:35:26]<sofar> nice
[21:35:38]<sofar> exactly what I want ;^)

- Sped up the whole procedure a bit by caching the diff (probably not entirely noticable)


Index: updatelog.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/updatelog.lunar,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- updatelog.lunar	29 Jul 2003 20:49:28 -0000	1.12
+++ updatelog.lunar	23 Feb 2004 22:05:32 -0000	1.13
@@ -64,21 +64,35 @@
 # purpose  : display a list of modules added or removed during this update
 display_moonbase_changes()  {  
   debug_msg "display_moonbase_changes ($@)"
+  MODULE_CHANGES=$(temp_create "module-changes")
+
   if [ -e "$MODULE_INDEX" ] && [ -e "$TMP_MODULE_INDEX" ]; then
-    NEW_MODULES=$(diff -I MOONBASE_MD5 $MODULE_INDEX $TMP_MODULE_INDEX | grep '<' | wc -l)
-    DEL_MODULES=$(diff -I MOONBASE_MD5 $MODULE_INDEX $TMP_MODULE_INDEX | grep '>' | wc -l)
-  
+    diff -yI MOONBASE_MD5 $MODULE_INDEX $TMP_MODULE_INDEX | sort > $MODULE_CHANGES
+
+    NEW_MODULES=$(grep '<' $MODULE_CHANGES | wc -l)
+    DEL_MODULES=$(grep '>' $MODULE_CHANGES | wc -l)
+    MOV_MODULES=$(grep '|' $MODULE_CHANGES | wc -l)
+    message
+
     if [ "$NEW_MODULES" != "0" ]; then
       message "${MESSAGE_COLOR}New modules:${DEFAULT_COLOR}"
-      diff -I "MOONBASE_MD5:" $MODULE_INDEX $TMP_MODULE_INDEX | grep '<' | cut -d \  -f 2 -
+      grep '<' $MODULE_CHANGES | tr -d '<' | sort -t : -k 2
       message
     fi
 
     if [ "$DEL_MODULES" != "0" ]; then
       message "${MESSAGE_COLOR}Removed modules:${DEFAULT_COLOR}"
-      diff -I "MOONBASE_MD5:" $MODULE_INDEX $TMP_MODULE_INDEX | grep '>' | cut -d \  -f 2 -
+      grep '>' $MODULE_CHANGES | tr -d '>\t ' | sort -t : -k 2
+      message
+    fi
+
+    if [ "$MOV_MODULES" != "0" ]; 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
       message
     fi
   fi
+
+  temp_destroy $MODULE_CHANGES
 }
 



More information about the Lunar-commits mailing list