Patch to enable local dependencies in zlocal

Gb majinai at warpmail.net
Sat Jan 5 21:54:20 CET 2008


Happy New Year!

Ref:
http://foo-projects.org/pipermail/lunar/2007-December/007888.html
http://bugs.lunar-linux.org/view.php?id=314
http://bugs.lunar-linux.org/view.php?id=310

The patch at the bottom of this email is for the file:
/var/lib/lunar/functions/depends.lunar

Basically, after applying the patch,
the function create_depends_cache will merge
the moonbase and zlocal DEPENDS
so that the zlocal ones (if any) will override
the corresponding  DEPENDS in the moonbase.

I have tested my new depends.lunar .
To trigger the update of the dependency cache,
a simple "lin moonbase" seems sufficient.

My test:
I have issued "lvu edit xorg-server"
and replaced the files in the zlocal copy
with symlinks to the moonbase xorg-server,
apart from the BUILD and DEPENDS files.

My BUILD file includes the configure flag to disable hal,
and I removed the hal dependency from DEPENDS.

Afterwards, I removed hal with "lrm hal",
then "lin moonbase", then "lin -rc xorg-server".

Dependencies were checked and hal wasn't asked for.
Now xorg server runs without hal on my machine,
and the fail-safe xorg-server on the moonbase
is still there (unchanged), just in case.

When the "official" xorg-server on the moonbase will be updated,
I don't expect too many problems (thanks to the symlinks).

Of course, the point is not hal, but the patch below.
It could be very useful to many users,
letting them customize their system even further.

You might consider including a patched depends.lunar
in the next version of the lunar tools.
Feel free to improve my patch!

Gb

P.S.:
Further testing could be useful. In particular,
it should be tested when no DEPENDS file are in zlocal
(that is, when no module is in development).
-------

The patch (better use the one in the attachment,
my email program will fold the one below to fit into the page):


--- OLD/depends.lunar   2008-01-05 20:48:50.000000000 +0100
+++ NEW/depends.lunar   2008-01-05 20:48:55.000000000 +0100
@@ -361,7 +361,7 @@

  create_depends_cache()
  {(
-  local TMP_DEP_CACHE DEPFILES DEPFILE MODULE
+  local TMP_DEP_CACHE DEPFILES DEPFILE MODULE LOCAL_DEPENDS 
MOONBASE_DEPENDS PRUNED_MOONBASE_DEPENDS
    debug_msg "create_depends_cache($@)"

    if [ ! -w $DEPENDS_CACHE -a -e $DEPENDS_CACHE ] ; then
@@ -390,11 +390,13 @@

      # speedups for system moonbases:
      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)"
+    DEPFILES="$(find $MOONBASE/zlocal -type f -name DEPENDS)"
+    LOCAL_DEPENDS=$(echo "$DEPFILES" | cut -d / -f 7 | awk '{ print 
"/"$0"/" }' -)
+    MOONBASE_DEPENDS=$(grep "/DEPENDS$" 
$INSTALL_LOGS/moonbase-$(installed_version moonbase))
+    PRUNED_MOONBASE_DEPENDS=$(echo "$MOONBASE_DEPENDS" | grep -v 
"$LOCAL_DEPENDS" -)
+    DEPFILES=$(echo -e "$DEPFILES\n$PRUNED_MOONBASE_DEPENDS")
      else
-      DEPFILES=$(find $MOONBASE -type f -name DEPENDS)
+    DEPFILES=$(find $MOONBASE -type f -name DEPENDS)
      fi

      # fast method for re-creating the depends.cache, might take long though
-------------- next part --------------
--- OLD/depends.lunar	2008-01-05 20:48:50.000000000 +0100
+++ NEW/depends.lunar	2008-01-05 20:48:55.000000000 +0100
@@ -361,7 +361,7 @@
 
 create_depends_cache()
 {(
-  local TMP_DEP_CACHE DEPFILES DEPFILE MODULE
+  local TMP_DEP_CACHE DEPFILES DEPFILE MODULE LOCAL_DEPENDS MOONBASE_DEPENDS PRUNED_MOONBASE_DEPENDS
   debug_msg "create_depends_cache($@)"
 
   if [ ! -w $DEPENDS_CACHE -a -e $DEPENDS_CACHE ] ; then
@@ -390,11 +390,13 @@
 
     # speedups for system moonbases:
     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)"
+    DEPFILES="$(find $MOONBASE/zlocal -type f -name DEPENDS)"
+    LOCAL_DEPENDS=$(echo "$DEPFILES" | cut -d / -f 7 | awk '{ print "/"$0"/" }' -)
+    MOONBASE_DEPENDS=$(grep "/DEPENDS$" $INSTALL_LOGS/moonbase-$(installed_version moonbase))
+    PRUNED_MOONBASE_DEPENDS=$(echo "$MOONBASE_DEPENDS" | grep -v "$LOCAL_DEPENDS" -)
+    DEPFILES=$(echo -e "$DEPFILES\n$PRUNED_MOONBASE_DEPENDS")
     else
-      DEPFILES=$(find $MOONBASE -type f -name DEPENDS)
+    DEPFILES=$(find $MOONBASE -type f -name DEPENDS)
     fi
 
     # fast method for re-creating the depends.cache, might take long though


More information about the Lunar mailing list