[Lunar-commits] r26921 - in lunar/trunk: bin var/lib/lunar/functions

Stefan Wold ratler at lunar-linux.org
Mon Nov 26 08:08:19 CET 2007


Author: ratler
Date: 2007-11-26 08:08:19 +0100 (Mon, 26 Nov 2007)
New Revision: 26921

Modified:
   lunar/trunk/bin/lvu
   lunar/trunk/var/lib/lunar/functions/depends.lunar
Log:
* Added show_conflicts function, display files that conflict between modules
* A small fix in show_depends() that caused no visual bug, but still a bug ;)
* create_depends_cache() fix so that it doesn't parse newlines added by accident
  in optional_depends, which cause dependency sorting to fail


Modified: lunar/trunk/bin/lvu
===================================================================
--- lunar/trunk/bin/lvu	2007-11-26 06:58:15 UTC (rev 26920)
+++ lunar/trunk/bin/lvu	2007-11-26 07:08:19 UTC (rev 26921)
@@ -59,6 +59,7 @@
                                dependencies on them
 orphans                    display installed modules that are missing
                                dependencies
+conflicts                  display conflicting files
 held                       display held modules
 exiled                     display exiled modules
 expired                    display a list of modules which need an update
@@ -427,13 +428,26 @@
   done
 }
 
+show_conflicts()  {
+  TMP_CONFLICTS=$(temp_create "conflicts")
+  for MODULE in $(list_installed); do
+    VERSION=$(installed_version $MODULE)
+    cat $INSTALL_LOGS/$MODULE-$VERSION | grep "/bin/\|/games/\|/include/\|/lib/\|/sbin/" | 
+    grep -v "/doc/\|/etc/\|/fonts/\|/man/\|/var/\|/lib/modules\|/site-packages/\|/lib/perl5" | 
+    while read LINE; do 
+        [ ! -d "$LINE" ] && echo "${MODULE} ${LINE}" >> $TMP_CONFLICTS
+    done
+  done
+  sort -k 2,2 < $TMP_CONFLICTS | uniq -D -f 1
+  trap "rm -f $TMP_CONFLICTS ; exit" INT TERM KILL
+}
 
 show_depends()  {
   if  !  echo  "$DONE"  |  grep  -q  "$1";  then
     DONE="$DONE  $1"
 
-    for  LINE  in  $(grep  ":$1:"  $DEPENDS_STATUS) ; do
-       MODULE=$(echo  $LINE  |  cut  -d :  -f1)
+    grep ":$1:" $DEPENDS_STATUS | while read LINE ; do
+      MODULE=${LINE%%:*}
       STATUS=$(echo  $LINE  |  cut  -d :  -f3)
 
       if    [  "$STATUS"  ==  "on"  ]
@@ -1027,6 +1041,10 @@
       show_orphans
       ;;
 
+    conflicts)
+      show_conflicts
+      ;;
+
     updatelog)
       if [ -e /var/log/lunar/update ]; then
         view_file /var/log/lunar/update

Modified: lunar/trunk/var/lib/lunar/functions/depends.lunar
===================================================================
--- lunar/trunk/var/lib/lunar/functions/depends.lunar	2007-11-26 06:58:15 UTC (rev 26920)
+++ lunar/trunk/var/lib/lunar/functions/depends.lunar	2007-11-26 07:08:19 UTC (rev 26921)
@@ -378,7 +378,9 @@
     }
 
     optional_depends() {
-      echo "$MODULE:$1:optional:$2:$3:$4"
+      # No quotes, this prevent us from parsing newlines
+      # if someone by accident add a newline in optional_depends
+      echo $MODULE:$1:optional:$2:$3:$4
     }
 
     # yeah, this sucks:



More information about the Lunar-commits mailing list