[Lunar-commits] <lunar> Run DEPENDS file for modules in zlocal

Peter de Ridder peter at lunar-linux.org
Mon Jul 9 00:57:28 CEST 2012


commit 87e57103daf38748b8f8492945d2e4a0ad426bfb
Author: Peter de Ridder <peter at lunar-linux.org>
Date: Sun, 08 Jul 2012 15:57:28 -0700
URL: https://github.com/lunar-linux/lunar/commit/87e57103daf38748b8f8492945d2e4a0ad426bfb

Run DEPENDS file for modules in zlocal
---
  libs/depends.lunar                                           +38/-4    
  1 files changed, 38 insertions (+), 4 deletions (-)

--- a/libs/depends.lunar
+++ b/libs/depends.lunar
@@ -29,8 +29,36 @@ function find_depends() {
   debug_msg "find_depends ($@)"
 
   find_depends_intern() {
-    local DEP
-    for DEP in $(awk -F: -v mod=$1 '{if ($1==mod){print $2}}' "$DEPENDS_CACHE") ; do
+    local DEP DEPS DEPFILE SECTION
+    SECTION=$(find_section $1)
+    if echo $SECTION | grep -q '^zlocal' ; then
+      # this module lives in zlocal
+      # now we need to run the depends file
+
+      # you guessed it: local decls.
+      depends() {
+	echo "$1"
+      }
+
+      optional_depends() {
+	# No quotes, this prevent us from parsing newlines
+	# if someone by accident add a newline in optional_depends
+	echo $1
+      }
+
+      # yeah, this sucks:
+      message() {
+	:
+      }
+
+      DEPFILE=$MOONBASE/$SECTION/$1/DEPENDS
+      if [ -e $DEPFILE ] ; then
+        DEPS=$(MODULE=$1 . $DEPFILE)
+      fi
+    else
+      DEPS=$(awk -F: -v mod=$1 '{if ($1==mod){print $2}}' "$DEPENDS_CACHE")
+    fi
+    for DEP in $DEPS ; do
       DEP=$(unalias "$DEP")
       # this is our shortcut out:
       if ! grep -qx "$DEP" "$TMP_FDEPS" ; then
@@ -392,9 +420,15 @@ create_depends_cache()
     if [ "$MOONBASE" == "/var/lib/lunar/moonbase" ] ; then
       DEPFILES=$(grep "/DEPENDS$" "$INSTALL_LOGS/moonbase-$(installed_version moonbase)")
       # don't forget zlocal:
-      DEPFILES="$DEPFILES $(find $MOONBASE/zlocal -type f -name DEPENDS)"
+      if [ "$ZLOCAL_OVERRIDES" == "on" ] ; then
+        DEPFILES="$DEPFILES $(find $MOONBASE/zlocal -type f -name DEPENDS)"
+      fi
     else
-      DEPFILES=$(find $MOONBASE -type f -name DEPENDS)
+      if [ "$ZLOCAL_OVERRIDES" != "on" ] ; then
+        DEPFILES=$(find $MOONBASE -type f -name DEPENDS ! -regex "$MOONBASE/zlocal/.*")
+      else
+        DEPFILES=$(find $MOONBASE -type f -name DEPENDS)
+      fi
     fi
 
     # fast method for re-creating the depends.cache, might take long though




More information about the Lunar-commits mailing list