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

Auke Kok sofar at lunar-linux.org
Fri Mar 25 15:54:19 UTC 2005


Update of /var/cvs/lunar/theedge/var/lib/lunar/functions
In directory espresso.foo-projects.org:/tmp/cvs-serv18677/var/lib/lunar/functions

Modified Files:
	depends.lunar 
Log Message:
Optimize performance of depends code a bit more


Index: depends.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/depends.lunar,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- depends.lunar	24 Mar 2005 16:38:59 -0000	1.49
+++ depends.lunar	25 Mar 2005 15:54:17 -0000	1.50
@@ -92,14 +92,6 @@
 }
 
 
-# dont use until agreed on dev mailinglist
-#is_depended()  {
-#  debug_msg "is_depended ($@)"
-#  # Is $1 a previously selected dependency of any module.
-#  return $(grep -q "^$1:$2:on:" $DEPENDS_STATUS)
-#}
-                                                                                
-                                                                                
 in_depends()  {
   debug_msg "in_depends ($@)"
   # Was $2 presented as a depenency for module $1
@@ -126,26 +118,26 @@
 
   cp $DEPENDS_STATUS $DEPENDS_STATUS_BACKUP
                                                                                 
-  unlock_file $DEPENDS_STATUS_BACKUP &&
-  unlock_file $DEPENDS_STATUS
+  unlock_file $DEPENDS_STATUS &&
+  unlock_file $DEPENDS_STATUS_BACKUP
 }
                                                                                 
 
 add_depends() {
   debug_msg "add_depends ($@)"
   if ! grep -q "^$1:$2:$3:$4:$5:$6$" $DEPENDS_STATUS ; then
-    if grep -q "^$1:$2:" $DEPENDS_STATUS ; then
-      remove_depends "$1" "$2"
-    fi
-                                                                                
-    verbose_msg "adding \"$4\" depends for \"$1\" on \"$2\" ($3)"
-                                                                                
     lock_file $DEPENDS_STATUS_BACKUP                       &&
     lock_file $DEPENDS_STATUS                              &&
-    echo  "$1:$2:$3:$4:$5:$6"  >>  $DEPENDS_STATUS         &&
-    cat  $DEPENDS_STATUS        >  $DEPENDS_STATUS_BACKUP  &&
-    unlock_file $DEPENDS_STATUS_BACKUP                     &&
-    unlock_file $DEPENDS_STATUS
+    if grep -q "^$1:$2:" $DEPENDS_STATUS ; then
+      grep -v "^$1:$2:" $DEPENDS_STATUS_BACKUP > $DEPENDS_STATUS
+	else
+      verbose_msg "adding \"$4\" depends for \"$1\" on \"$2\" ($3)"
+	fi
+                                                                                
+    echo "$1:$2:$3:$4:$5:$6" >> $DEPENDS_STATUS            &&
+    cat $DEPENDS_STATUS > $DEPENDS_STATUS_BACKUP           &&
+    unlock_file $DEPENDS_STATUS                            &&
+    unlock_file $DEPENDS_STATUS_BACKUP
   fi
 }
                                                                                 



More information about the Lunar-commits mailing list