[Lunar-commits] <lunar> Full sync with theedge: - lvu submit update - TMPFS removal - zpatches code - cleanups - config fixes - man page updates - lvu conflicts - mirror formatting fixes

Auke Kok sofar at lunar-linux.org
Mon Jul 2 04:43:16 CEST 2012


commit 87ae1b3a95bf4488e154f678fb3afee7a7666e7f
Author: Auke Kok <sofar at lunar-linux.org>
Date:   Tue Dec 11 21:41:22 2007 +0000

    Full sync with theedge:
    - lvu submit update
    - TMPFS removal
    - zpatches code
    - cleanups
    - config fixes
    - man page updates
    - lvu conflicts
    - mirror formatting fixes
---
 bin/lvu                                            |   91 ++++++++++++++------
 etc/lunar/config                                   |    1 -
 etc/lunar/mirrors/SFORGE                           |   10 +--
 etc/lunar/mirrors/XORG                             |   44 +++++-----
 sbin/lin                                           |   36 ++++----
 sbin/lrm                                           |   12 +--
 sbin/lunar                                         |   44 ++++------
 .../_etc_lunar_local_config.html                   |    7 --
 usr/share/man/man8/lunar.8                         |   16 ++--
 var/lib/lunar/functions/config.lunar               |   30 ++++---
 var/lib/lunar/functions/depends.lunar              |    6 +-
 var/lib/lunar/functions/main.lunar                 |    4 +-
 var/lib/lunar/functions/optimize.lunar             |    8 +-
 var/lib/lunar/functions/sources.lunar              |   25 ++----
 var/lib/lunar/plugins/build-zpatches.plugin        |   80 +++++++++++++++++
 var/lib/lunar/plugins/check-md5sum.plugin          |   13 ++-
 var/lib/lunar/unset.sh                             |    1 -
 17 files changed, 255 insertions(+), 173 deletions(-)

diff --git a/bin/lvu b/bin/lvu
index b29492e..1adb997 100755
--- a/bin/lvu
+++ b/bin/lvu
@@ -59,6 +59,7 @@ leafs                      display installed modules that have no explicit
                                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 @@ show_orphans()  {
   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 EXIT
+}
 
 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"  ]
@@ -752,12 +766,12 @@ diff_module() {
   fi
   if ! run_details $1 ; then
     message "diff requires an existing zlocal module"
-      exit 1
-      fi
+    exit 1
+  fi
   if ! echo $SECTION | grep -q zlocal ; then
     message "$1 is not a zlocal module, cannot diff"
-      exit 1
-    fi
+    exit 1
+  fi
   NZSECTION=$(ZLOCAL_OVERRIDES=off find_section $1)
   if [ "$SECTION" == "$NZSECTION" ] ; then
     # new module
@@ -778,9 +792,9 @@ submit_module() {
   # as good as it gets
   if [ "$ZLOCAL_OVERRIDES" != "on" ]; then
     message "You can't submit non-zlocal modules. Turn on ZLOCAL_OVERRIDES"
-	message "and do \`lvu edit \$MODULE; lin moonbase\`"
-	message "so that module changes can be tracked properly!"
-	exit 1
+    message "and do \`lvu edit \$MODULE; lin moonbase\`"
+    message "so that module changes can be tracked properly!"
+    exit 1
   fi
   if [ -z "$1" ]; then
     message "submit requires a single module name."
@@ -790,37 +804,50 @@ submit_module() {
     message "submit requires curl, please \`lin curl\`"
     exit 1
   fi
-  if [ -z "$ADMIN" -o "$ADMIN" == "$USER" ]; then
+  if [ -z "$ADMIN" -o "$ADMIN" == "$USER" -o "$ADMIN" == "root" ]; then
     message "Please set ADMIN to your e-mail address: lunar set ADMIN \"me at my.mail.domain\""
     exit 1
   fi
-  if ! run_details "$1" ; then
-      message "submit requires an existing module"
+  if [ -z "$REALNAME" ]; then
+    REALNAME="getent passwd $USER | cut -d: -f5 | cut -d, -f1"
+    if [ -z "$G_REALNAME" ]; then
+      message "Please set REALNAME to your real name: lunar set REALNAME \"John Notdoe\""
       exit 1
+    fi
+  fi
+  if ! run_details "$1" ; then
+    message "submit requires an existing module"
+    exit 1
   else
     if echo $SECTION | grep -q '^zlocal' ; then
-	  ZLOCAL_OVERRIDES=off SECTION=$(find_section $1)
-	  if echo $SECTION | grep -q '^zlocal' ; then
-	    unset SECTION
-	  fi
-	else
-	  message "Please don't edit modules outside of the 'zlocal' section!"
-	  message "do this first: \`lvu edit \$MODULE ; lin moonbase\`"
-	  message "so that module changes can be tracked properly!"
-	  exit 1
+      ZLOCAL_OVERRIDES=off SECTION=$(find_section $1)
+      if echo $SECTION | grep -q '^zlocal' ; then
+        unset SECTION
+      fi
+    else
+      message "Please don't edit modules outside of the 'zlocal' section!"
+      message "do this first: \`lvu edit \$MODULE ; lin moonbase\`"
+      message "so that module changes can be tracked properly!"
+      exit 1
     fi
     TMP_MSG=$(temp_create "submission")
+    TMP_MSG2=$(temp_create "submission")
     (
+      echo "$1: "
       echo ""
-      echo "# type a changelog message here"
-      echo "# all lines starting with '#' will be removed"
+      echo ""
+      echo "# type a changelog message here. The first line should start with"
+      echo "# the module name and summarize your change. All lines starting with '#'"
+      echo "# will be removed automatically"
     ) > $TMP_MSG
     edit_file $TMP_MSG
     sed -i '/^#/d' $TMP_MSG
     (
+      head -n 1 $TMP_MSG
       echo ''
+      echo "From: $REALNAME <$ADMIN>"
+      tail +2 $TMP_MSG
       echo '---'
-      echo 'from:' $ADMIN
       echo 'module:' $1
       echo "id: $UNIQID"
       echo "lvu submit: $1"
@@ -831,14 +858,18 @@ submit_module() {
       echo "glibc: $(installed_version glibc)"
       echo ''
       echo '---'
+      lvu diff $1 | diffstat -p1
+      echo ''
+      echo '---'
       lvu diff $1
-    ) >> $TMP_MSG
-    cat $TMP_MSG
+    ) >> $TMP_MSG2
+    cat $TMP_MSG2
     if query "Submit this module now?" y; then
-      curl -F file=@$TMP_MSG -F module=$1 -F id=$UNIQID "http://lunar-linux.org/submit.php"
+      curl -F file=@$TMP_MSG2 -F module=$1 -F id=$UNIQID "http://lunar-linux.org/submit.php"
+      temp_destroy $TMP_MSG2
       temp_destroy $TMP_MSG
     else
-      message "Submission aborted. your submission was saved as $TMP_MSG"
+      message "Submission aborted. your submission was saved as $TMP_MSG2"
     fi
   fi
 }
@@ -1027,6 +1058,10 @@ main()  {
       show_orphans
       ;;
 
+    conflicts)
+      show_conflicts
+      ;;
+
     updatelog)
       if [ -e /var/log/lunar/update ]; then
         view_file /var/log/lunar/update
diff --git a/etc/lunar/config b/etc/lunar/config
index e6dc023..985b295 100755
--- a/etc/lunar/config
+++ b/etc/lunar/config
@@ -61,7 +61,6 @@ export        DIALOGRC=/etc/lunar/dialogrc
               GARBAGE=${GARBAGE:-on}
          PROMPT_DELAY=${PROMPT_DELAY:-150}
         PROBE_EXPIRED=${PROBE_EXPIRED:-on}
-                TMPFS=${TMPFS:-off}
        LUNAR_PRIORITY="+10"
 
             LDD_CHECK=${LDD_CHECK:-on}
diff --git a/etc/lunar/mirrors/SFORGE b/etc/lunar/mirrors/SFORGE
index 1d2a9bb..523c2df 100644
--- a/etc/lunar/mirrors/SFORGE
+++ b/etc/lunar/mirrors/SFORGE
@@ -19,12 +19,12 @@ San Jose CA (US)	http://internap.dl.sourceforge.net/sourceforge
 Seattle WA (US)		http://superb-west.dl.sourceforge.net/sourceforge
 McLean VA (US)		http://superb-east.dl.sourceforge.net/sourceforge
 Phoenix AZ (US)		http://easynews.dl.sourceforge.net/sourceforge
-United States	http://aleron.dl.sourceforge.net/sourceforge
-United States	http://telia.dl.sourceforge.net/sourceforge
-United States	http://twtelecom.dl.sourceforge.net/sourceforge
-United States	http://unc.dl.sourceforge.net/sourceforge
+United States		http://aleron.dl.sourceforge.net/sourceforge
+United States		http://telia.dl.sourceforge.net/sourceforge
+United States		http://twtelecom.dl.sourceforge.net/sourceforge
+United States		http://unc.dl.sourceforge.net/sourceforge
 Minneapolis MN (US)	http://umn.dl.sourceforge.net/sourceforge
-United States	http://west.dl.sourceforge.net/sourceforge
+United States		http://west.dl.sourceforge.net/sourceforge
 OSDN (US)		http://osdn.dl.sourceforge.net/sourceforge
 voxel (US)		http://voxel.dl.sourceforge.net/sourceforge
 cogent (US)		http://cogent.dl.sourceforge.net/sourceforge
diff --git a/etc/lunar/mirrors/XORG b/etc/lunar/mirrors/XORG
index ce305bb..5361b05 100644
--- a/etc/lunar/mirrors/XORG
+++ b/etc/lunar/mirrors/XORG
@@ -1,15 +1,15 @@
-"Master Site"			ftp://ftp.x.org/pub/
-"Custom Mirror"			Custom
+"Master Site"		ftp://ftp.x.org/pub/
+"Custom Mirror"		Custom
 Australia		ftp://mirror.isp.net.au/pub/x.org/
-Belgium		ftp://x.mirrors.skynet.be/pub/x.org/
-Belgium		http://x.mirrors.skynet.be/pub/x.org/
+Belgium			ftp://x.mirrors.skynet.be/pub/x.org/
+Belgium			http://x.mirrors.skynet.be/pub/x.org/
 Brazilia		ftp://ftp.unicamp.br/pub/X11/releases/
 France			ftp://mirror.cict.fr/x.org/
 France			http://mirror.cict.fr/x.org/
-Germany		ftp://ftp.gwdg.de/pub/x11/x.org/pub/
-Germany		ftp://ftp.portal-to-web.de/pub/mirrors/x.org/
-Germany		http://www.portal-to-web.de/pub/mirrors/x.org/
-Germany		ftp://ftp.fu-berlin.de/unix/X11/FTP.X.ORG/pub/
+Germany			ftp://ftp.gwdg.de/pub/x11/x.org/pub/
+Germany			ftp://ftp.portal-to-web.de/pub/mirrors/x.org/
+Germany			http://www.portal-to-web.de/pub/mirrors/x.org/
+Germany			ftp://ftp.fu-berlin.de/unix/X11/FTP.X.ORG/pub/
 Greece			ftp://ftp.ntua.gr/pub/X11/
 HongKong		ftp://ftp.cs.cuhk.edu.hk/pub/X11/
 Italy			http://mi.mirror.garr.it/mirrors/x.org/
@@ -21,8 +21,8 @@ Japan			ftp://ftp.u-aizu.ac.jp/pub/x11/x.org/
 Japan			http://ftp.yz.yamagata-u.ac.jp/pub/X11/x.org/
 Japan			ftp://ftp.yz.yamagata-u.ac.jp/pub/X11/x.org/
 Korea			ftp://ftp.kreonet.re.kr/pub/X11/ftp.x.org/
-Netherlands	http://x-org.mirror.intouch.nl/
-Netherlands	ftp://xorg.mirror.intouch.nl/mirrors/xorg/
+Netherlands		http://x-org.mirror.intouch.nl/
+Netherlands		ftp://xorg.mirror.intouch.nl/mirrors/xorg/
 Poland			ftp://sunsite.icm.edu.pl/pub/X11/x.org/
 Poland			ftp://ftp.task.gda.pl/mirror/ftp.x.org/
 Poland			http://ftp.pl.debian.org/mirror/ftp.x.org/pub/
@@ -32,16 +32,16 @@ Russia			http://ftp.chg.ru/pub/X11/x.org/
 Russia			ftp://ftp.chg.ru/pub/X11/x.org/
 Spain			ftp://ftp.cica.es/pub/X/
 Spain			ftp://ftp.sunet.se/pub/X11/
-South Afrika	ftp://ftp.is.co.za/pub/x.org/
-Switzerland	http://xorg.mirror.solnet.ch/
-Switzerland	ftp://ftp.solnet.ch/mirror/x.org/
-Switzerland	ftp://mirror.switch.ch/mirror/X11/
-Switzerland	http://mirror.switch.ch/ftp/mirror/X11/
+South Afrika		ftp://ftp.is.co.za/pub/x.org/
+Switzerland		http://xorg.mirror.solnet.ch/
+Switzerland		ftp://ftp.solnet.ch/mirror/x.org/
+Switzerland		ftp://mirror.switch.ch/mirror/X11/
+Switzerland		http://mirror.switch.ch/ftp/mirror/X11/
 Taiwan			http://x.cs.pu.edu.tw/
-United Kingdom	http://www.mirror.ac.uk/mirror/ftp.x.org/
-United Kingdom	http://www.mirrorservice.org/sites/ftp.x.org/
-United Kingdom	ftp://ftp.mirrorservice.org/sites/ftp.x.org/
-United States	ftp://mirror.sg.depaul.edu/pub/x.org/
-United States	http://mirror.sg.depaul.edu/pub/x.org/
-United States	http://x.paracoda.com/
-United States	http://x.hostingzero.com/
+United Kingdom		http://www.mirror.ac.uk/mirror/ftp.x.org/
+United Kingdom		http://www.mirrorservice.org/sites/ftp.x.org/
+United Kingdom		ftp://ftp.mirrorservice.org/sites/ftp.x.org/
+United States		ftp://mirror.sg.depaul.edu/pub/x.org/
+United States		http://mirror.sg.depaul.edu/pub/x.org/
+United States		http://x.paracoda.com/
+United States		http://x.hostingzero.com/
diff --git a/sbin/lin b/sbin/lin
index dc5373a..a878576 100755
--- a/sbin/lin
+++ b/sbin/lin
@@ -114,32 +114,32 @@ main() {
       done
       (
           for M in $LIST $MODULES; do
-	      SAFE_M=$(echo $M | md5sum | awk '{print $1}')
+              SAFE_M=$(echo $M | md5sum | awk '{print $1}')
               eval THIS_TEMP=\$TEMP_DOWNLOAD_LOG_$SAFE_M
               lget $M > $THIS_TEMP 2>&1 &
               echo "$M:`jobs -p`:$THIS_TEMP" >> $TEMP_DOWNLOAD_PIDS
               wait
           done
-      ) &    
+      ) &
 
       # pass 3 : compile/install
       # no strange stuff should happen here anymore
       for MODULE in $MODULES ; do
         if ! module_installed $MODULE || [ ! -n "$PROBE" ] || ( [ -n "$PROBE" ] && [ "$PROBE_EXPIRED" == "on" ] && module_is_expired $MODULE ) ; then
-	  # 3 more conditions to stop processing this module:
+          # 3 more conditions to stop processing this module:
           if module_held $MODULE ; then
-	    error_message "${LRM_COLOR}Notice:${DEFAULT_COLOR}${MESSAGE_COLOR} Skipping compile and install for held module ${MODULE_COLOR}$MODULE${DEFAULT_COLOR}"
+            error_message "${LRM_COLOR}Notice:${DEFAULT_COLOR}${MESSAGE_COLOR} Skipping compile and install for held module ${MODULE_COLOR}$MODULE${DEFAULT_COLOR}"
             continue
-	  elif module_exiled $MODULE ; then
+          elif module_exiled $MODULE ; then
             error_message "${LRM_COLOR}Notice:${DEFAULT_COLOR}${MESSAGE_COLOR} Skipping compile and install for exiled module ${MODULE_COLOR}$MODULE${DEFAULT_COLOR}"
             continue
-	  elif ! module_license_accepted $MODULE ; then
-	    error_message "${LRM_COLOR}Notice:${DEFAULT_COLOR}${MESSAGE_COLOR} The license of module ${MODULE_COLOR}$MODULE${DEFAULT_COLOR}${MESSAGE_COLOR} is incompatible with the list of"
+          elif ! module_license_accepted $MODULE ; then
+            error_message "${LRM_COLOR}Notice:${DEFAULT_COLOR}${MESSAGE_COLOR} The license of module ${MODULE_COLOR}$MODULE${DEFAULT_COLOR}${MESSAGE_COLOR} is incompatible with the list of"
             error_message "allowed and/or rejected licenses. Please adjust the ACCEPTED_LICENSES or"
             error_message "REJECTED_LICENSES variables to include or not include the specific"
             error_message "license of this module.${DEFAULT_COLOR}"
             continue
-	  else
+          else
             # we're good now, start installing
             linING="/var/lock/installing.$MODULE"
             verbose_msg "starting lin \"$MODULE\""
@@ -147,7 +147,7 @@ main() {
               if [ -e "$TMP_LIN_FAIL" ] ; then
                 echo "$MODULE" >> $TMP_LIN_FAIL
               fi
-              lin_EXIT_STATUS=1;  
+              lin_EXIT_STATUS=1;
             else
               if [ -e "$TMP_LIN_SUCCESS" ] ; then
                 echo "$MODULE" >> $TMP_LIN_SUCCESS
@@ -175,22 +175,22 @@ main() {
     if [ -z "$DEPS_ONLY" ] ; then
       if ! module_held $MODULE ; then
         if [ -n "$PROBE" ] ; then
-	  # --probe install
+          # --probe install
           if ! module_installed $MODULE ; then
             if ! lin_module $MODULE ; then
               temp_destroy $TEMP_PREPAREDDEPS
               exit 1
             fi
-	  elif [ "$PROBE_EXPIRED" == "on" ] && module_is_expired $MODULE ; then
-	    # probe install where module is expired
-	    verbose_msg "module \"$MODULE\" needs to be updated"
-	    if ! SINGLE_MODULE= lin_module $MODULE ; then
-	      temp_destroy $TEMP_PREPAREDDEPS
-	      exit 1
-	    fi	    
+          elif [ "$PROBE_EXPIRED" == "on" ] && module_is_expired $MODULE ; then
+            # probe install where module is expired
+            verbose_msg "module \"$MODULE\" needs to be updated"
+            if ! SINGLE_MODULE= lin_module $MODULE ; then
+              temp_destroy $TEMP_PREPAREDDEPS
+              exit 1
+            fi
           fi
         else
-	  # normal install - not probed
+          # normal install - not probed
           if ! lin_module $MODULE ; then
             temp_destroy $TEMP_PREPAREDDEPS
             exit 1
diff --git a/sbin/lrm b/sbin/lrm
index 6daaa56..95847f0 100755
--- a/sbin/lrm
+++ b/sbin/lrm
@@ -197,12 +197,12 @@ lrm_module() {
     remove_depends $MODULE
     # remove alias if required
     if [ $MODULE != moonbase ] ; then
-    for ALIAS in `cut -d: -f1 $MOONBASE/aliases`; do
-      if [ "$(get_local_config `echo LUNAR_ALIAS_${ALIAS:1}`)" == "$MODULE" ]; then
-        verbose_msg "removing alias mapping from \"$ALIAS\" to \"$MODULE\""
-        unset_local_config `echo LUNAR_ALIAS_${ALIAS:1}`
-      fi
-    done
+      for ALIAS in `cut -d: -f1 $MOONBASE/aliases`; do
+        if [ "$(get_local_config `echo LUNAR_ALIAS_${ALIAS:1}`)" == "$MODULE" ]; then
+          verbose_msg "removing alias mapping from \"$ALIAS\" to \"$MODULE\""
+          unset_local_config `echo LUNAR_ALIAS_${ALIAS:1}`
+        fi
+      done
     fi
     # restart xinetd after xinetd.confs have been removed by lrm...
     if [ -n "$SERVICES" -a -n "$XINETD" ] ; then
diff --git a/sbin/lunar b/sbin/lunar
index 2feebdc..43bac62 100755
--- a/sbin/lunar
+++ b/sbin/lunar
@@ -71,12 +71,11 @@ show_modules()	{
         !  module_held       $MODULE  &&
         !  module_exiled     $MODULE
     then
-      SHORT="Short Description Unavailable"
       (
         run_details $MODULE
-        echo  $MODULE
-        echo  $VERSION
-        echo  $SHORT
+        echo  "$MODULE"
+        echo  "$VERSION"
+        echo  "${SHORT:-Short Description Unavailable}"
       )
     fi
   done
@@ -86,7 +85,7 @@ show_modules()	{
 show_sections()  {
   for SECTION in $(list_sections);  do
     [ -z "$(list_modules $SECTION)" ] || {
-      echo  $SECTION
+      echo  "$SECTION"
       echo  "section"
     }
   done
@@ -108,15 +107,15 @@ select_section() {
 add_pkgs()  { (
   while
     SECTION=`select_section`
-  do            
+  do
     while
-      MODULES=`show_modules $SECTION`  &&
-       MODULE=`$DIALOG  --title "Select module to install please"  \
+    show_modules $SECTION ; read
+      MODULE=`$DIALOG  --title "Select module to install please"  \
                        --item-help                               \
                        --menu                                    \
                        "$SECTION"                                \
                        0 60 10                                   \
-                       $MODULES`
+                       $(show_modules $SECTION)`
     do
       DESCRIPTION=`$MOONBASE/$SECTION/$MODULE/DETAILS`
 
@@ -219,21 +218,19 @@ remove_pkgs()	{
 
 make_checklist()  {
   for  MODULE in `list_modules "$1"`;  do
-    SHORT="Short Description Unavailable"
     (
     run_details $MODULE
-    STATUS="OFF"
 
-    if    module_installed  $MODULE  ||
-          module_held       $MODULE
-    then  STATUS="on"
-    else  STATUS="off"
+    if module_installed $MODULE || module_held $MODULE; then
+      STATUS="on"
+    else
+      STATUS="off"
     fi
 
-    echo  $MODULE
-    echo  $VERSION
-    echo  $STATUS
-    echo  $SHORT
+    echo $MODULE
+    echo $VERSION
+    echo $STATUS
+    echo ${SHORT:-Short Description Unavailable}
     )
   done
 }
@@ -498,7 +495,6 @@ log_menu()  {
 feature_menu()  {
   A_HELP="Create convenient auto-install scripts for common executables?"
   C_HELP="Colorized messages on lin and lrm?"
-  D_HELP="Use tmpfs for module installs?"
   E_HELP="Remove files when lrm?"
   F_HELP="Check for and repair broken programs after updating lunar?"
   G_HELP="Install the garbage documentation? (extras like README, LICENSE etc)"
@@ -532,10 +528,6 @@ feature_menu()  {
          GARBAGE=${GARBAGE:-on}
 	 VERBOSE=${VERBOSE:off}
 
-        if [ -z $TMPFS ]; then
-          TMPFS=on;
-        fi
-
   if  TOGGLES=`$DIALOG  --title "Feature Menu"  \
                         --no-cancel             \
                         --item-help             \
@@ -557,7 +549,6 @@ feature_menu()  {
       "VIEW_REPORTS"     "Toggle"  "$VIEW_REPORTS"  "$R_HELP"   \
       "VOYEUR"           "Toggle"  "$VOYEUR"        "$V_HELP"   \
       "REAP"             "Toggle"  "$REAP"          "$E_HELP"   \
-      "TMPFS"            "Toggle"  "$TMPFS"         "$D_HELP"   \
       "VERBOSE"          "Toggle"  "$VERBOSE"       "$W_HELP"   \
       "ZLOCAL_OVERRIDES" "Toggle"  "$ZLOCAL_OVERRIDES" "$Z_HELP" \
       "PROBE_EXPIRED"    "Toggle"  "$PROBE_EXPIRED" "$X_HELP"`
@@ -578,7 +569,6 @@ feature_menu()  {
           VOYEUR=off
             REAP=off
          GARBAGE=off
-           TMPFS=off
 	 VERBOSE=off
 ZLOCAL_OVERRIDES=off
    PROBE_EXPIRED=off
@@ -599,7 +589,6 @@ ZLOCAL_OVERRIDES=off
               VOYEUR)        VOYEUR=on  ;;
                 REAP)          REAP=on  ;;
              GARBAGE)       GARBAGE=on  ;;
-               TMPFS)         TMPFS=on  ;;
 	     VERBOSE)       VERBOSE=on  ;;
     ZLOCAL_OVERRIDES) ZLOCAL_OVERRIDES=on ;;
        PROBE_EXPIRED)  PROBE_EXPIRED=on ;;
@@ -619,7 +608,6 @@ ZLOCAL_OVERRIDES=off
     set_local_config "VOYEUR" "$VOYEUR"
     set_local_config "REAP" "$REAP"
     set_local_config "GARBAGE" "$GARBAGE"
-    set_local_config "TMPFS" "$TMPFS"
     set_local_config "VERBOSE" "$VERBOSE"
     set_local_config "ZLOCAL_OVERRIDES" "$ZLOCAL_OVERRIDES"
     set_local_config "PROBE_EXPIRED" "$PROBE_EXPIRED"
diff --git a/usr/share/doc/lunar/core-documentation/_etc_lunar_local_config.html b/usr/share/doc/lunar/core-documentation/_etc_lunar_local_config.html
index 9f17169..7285fbb 100644
--- a/usr/share/doc/lunar/core-documentation/_etc_lunar_local_config.html
+++ b/usr/share/doc/lunar/core-documentation/_etc_lunar_local_config.html
@@ -202,13 +202,6 @@ from /sbin/lin. Used by the color() function in
       </td>
     </tr>
     <tr>
-      <td style="vertical-align: top;">TMPFS=off<br>
-      </td>
-      <td style="vertical-align: top;">Turns on (or off) the use of
-tmpfs for compiling. Used by the rm_source_dir() and mk_source_dir()
-functions in /var/lib/lunar/subroutines.</td>
-    </tr>
-    <tr>
       <td style="vertical-align: top;">VERBOSE=on<br>
       </td>
       <td style="vertical-align: top;">Toggles verbose mode for
diff --git a/usr/share/man/man8/lunar.8 b/usr/share/man/man8/lunar.8
index 1578623..6688099 100644
--- a/usr/share/man/man8/lunar.8
+++ b/usr/share/man/man8/lunar.8
@@ -18,7 +18,7 @@ source\-based package management system.
 .SH "OPTIONS"
 .I lunar
 without options will start the menu\-driven package management utility.
-.PP 
+.PP
 .B "-d, --debug"
 enables debug messages, very useful when emailing a bug report
 .TP
@@ -29,24 +29,24 @@ outputs short help
 increases the level of message output
 .TP
 .I prune
-.IP 
+.IP
 Removes all old source code and old backups. Since the number of sources on the system grows steadily on a running system, you will need to clean some of the kept copies of sources and compile caches. The source code from previous versions are kept so that the packages can be rolled back to older versions. This does not delete sources that are up to date,
 but not installed.
 .PP
 .I renew
-.IP 
+.IP
 Update all packages without fetching a fresh moonbase first. Does not run prune or autofix.
-.PP 
+.PP
 .I update
-.IP 
+.IP
 Fetches a new moonbase, updates all packages and runs (optionally) a prune and autofix.
-.PP 
+.PP
 .I rebuild
-.IP 
+.IP
 automatically rebuilds all installed software packages. This option is non\-interactive and does not start up the menu\-driven interface. It is suitable for use in cron jobs and is useful for rebuilding distributed binaries from source.
 .PP
 .I optimize
-.IP 
+.IP
 jump straight into the compiler optimizations menu.
 .PP 
 .I fix
diff --git a/var/lib/lunar/functions/config.lunar b/var/lib/lunar/functions/config.lunar
index 67f59af..bd2dc9f 100644
--- a/var/lib/lunar/functions/config.lunar
+++ b/var/lib/lunar/functions/config.lunar
@@ -20,31 +20,32 @@
 
 set_config()
 {
-	local LINE NEW
+	local LINE NEW FILE VAR
 	debug_msg "set_config ($@)"
 
 	LINE=$(grep -w "$2=.*" $1)
-	if [ "$1" == "$LOCAL_CONFIG" ] ; then
-		NEW=$(printf "%16s=%s" "$2" "$3")
+	FILE=$1
+	VAR=$2
+	shift 2
+	if [ "$FILE" == "$LOCAL_CONFIG" ] ; then
+		NEW="$(printf "%16s" "$VAR")=\"$@\""
 	else
-		NEW="$2=\"$3\""
+		NEW="$VAR=\"$@\""
 	fi
 
 	# on-demand creation
-	if [ ! -f $1 ] ; then
-		touch $1
+	if [ ! -f $FILE ] ; then
+		touch $FILE
 	fi
 
-	lock_file $1 &&
+	lock_file $FILE &&
 	if [ -n "$LINE" ] ; then
 		# make sure we escape those ':' characters:
 		LINE=$(echo $LINE | sed 's/:/\\:/g')
-		NEW=$(echo $NEW | sed 's/:/\\:/g')
-		sedit "s:$LINE:$NEW:" $1
-	else
-		echo "$NEW" >> $1
+		sedit "/[^ ]$VAR=/d" $FILE
 	fi
-	unlock_file $1
+	echo "$NEW" >> $FILE
+	unlock_file $FILE
 }
 
 
@@ -77,7 +78,10 @@ get_config()
 set_local_config()
 {
 	debug_msg "set_local_config ($@)"
-	set_config "$LOCAL_CONFIG" "$1" "$2"
+	local VAR
+	VAR=$1
+	shift
+	set_config "$LOCAL_CONFIG" "$VAR" "$@"
 }
 
 
diff --git a/var/lib/lunar/functions/depends.lunar b/var/lib/lunar/functions/depends.lunar
index fa0b3ca..7205953 100644
--- a/var/lib/lunar/functions/depends.lunar
+++ b/var/lib/lunar/functions/depends.lunar
@@ -163,7 +163,7 @@ run_depends() {
     if module_installed $DEP ; then
       add_depends "$MODULE" "$DEP" "on" "required" "$2" "$3"
       echo "$DEP" >> $TEMP_PREPAREDDEPS
-    elif ! module_installed $DEP && ! module_held $DEP ; then
+    elif ! is_depends $DEP ! module_installed $DEP && ! module_held $DEP ; then
       if module_exiled $DEP ; then
         message "${MODULE_COLOR}${MODULE}:${PROBLEM_COLOR} ! Error: required dependency ${MODULE_COLOR}$DEP${DEFAULT_COLOR}${PROBLEM_COLOR} is exiled and cannot be installed${DEFAULT_COLOR}"
         return 1
@@ -378,7 +378,9 @@ create_depends_cache()
     }
 
     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:
diff --git a/var/lib/lunar/functions/main.lunar b/var/lib/lunar/functions/main.lunar
index 3bf630b..5229c12 100644
--- a/var/lib/lunar/functions/main.lunar
+++ b/var/lib/lunar/functions/main.lunar
@@ -138,7 +138,7 @@ expand_cache_safe() {(
   # the sed trick is advanced: a non-greedy pattern that returns all
   # directory names listed in the input
   for TARGET in $(cat $TMP_TARGETS | sed 's/\/[^\/]*$/\//g' ) ; do
-	if [ ! -d $TARGET ]; then
+    if [ ! -d $TARGET ]; then
       debug_msg "mkdir -p $TARGET"
       mkdir -p $TARGET
     fi
@@ -269,7 +269,7 @@ lin_module()  {
     fi
   fi
   check_blacklist             &&
-  
+
   # here we run CONFLICTS, DEPENDS and CONFIGURE stuff
   run_conflicts               &&
   satisfy_depends             &&
diff --git a/var/lib/lunar/functions/optimize.lunar b/var/lib/lunar/functions/optimize.lunar
index bd85aaa..c8826f6 100644
--- a/var/lib/lunar/functions/optimize.lunar
+++ b/var/lib/lunar/functions/optimize.lunar
@@ -24,10 +24,10 @@ bad_flags()
 		unset LDFLAGS
 	else
 		for BAD_FLAG in "$@" ; do
-			CFLAGS=$(echo $CFLAGS | sed s/$BAD_FLAG//)
-			CXXFLAGS=$(echo $CXXFLAGS | sed s/$BAD_FLAG//)
-			CPPFLAGS=$(echo $CPPFLAGS | sed s/$BAD_FLAG//)
-			LDFLAGS=$(echo $LDFLAGS | sed s/$BAD_FLAG//)
+			CFLAGS=$(echo $CFLAGS | sed "s/$BAD_FLAG//")
+			CXXFLAGS=$(echo $CXXFLAGS | sed "s/$BAD_FLAG//")
+			CPPFLAGS=$(echo $CPPFLAGS | sed "s/$BAD_FLAG//")
+			LDFLAGS=$(echo $LDFLAGS | sed "s/$BAD_FLAG//")
 		done
 	fi
 }
diff --git a/var/lib/lunar/functions/sources.lunar b/var/lib/lunar/functions/sources.lunar
index b8089bc..cd03349 100644
--- a/var/lib/lunar/functions/sources.lunar
+++ b/var/lib/lunar/functions/sources.lunar
@@ -173,12 +173,7 @@ rm_source_dir() {
   DEAD_DIR=${DEAD_DIR:-$SOURCE_DIRECTORY}
 
   verbose_msg "destroying building dir \"$DEAD_DIR\""
-  if [ "$TMPFS" != "off" ] ; then
-    umount $DEAD_DIR 2> /dev/null
-    rmdir $DEAD_DIR 2> /dev/null
-  else
-    rm -rf $DEAD_DIR 2> /dev/null
-  fi
+  rm -rf $DEAD_DIR 2> /dev/null
 }
 
 
@@ -196,21 +191,11 @@ mk_source_dir() {
   NEW_DIR=${NEW_DIR:-$SOURCE_DIRECTORY}
 
   verbose_msg "creating building dir \"$NEW_DIR\""
-  if [ "$TMPFS" != "off" ] ; then 
-    if [ -d "$NEW_DIR" ] ; then
-      verbose_msg "Removing old source directory first!"
-      umount $NEW_DIR 2>/dev/null
-      rmdir $NEW_DIR 2>/dev/null
-    fi
-    mkdir -p $NEW_DIR &&
-    mount -o size=1g,nr_inodes=1m -t tmpfs tmpfs $NEW_DIR
-  else
-    if [ -d $NEW_DIR ] ; then
-      verbose_msg "Removing old source directory first!"
-      rm -rf $NEW_DIR 2>/dev/null
-    fi
-    mkdir -p $NEW_DIR
+  if [ -d $NEW_DIR ] ; then
+    verbose_msg "Removing old source directory first!"
+    rm -rf $NEW_DIR 2>/dev/null
   fi
+  mkdir -p $NEW_DIR
 }
 
 
diff --git a/var/lib/lunar/plugins/build-zpatches.plugin b/var/lib/lunar/plugins/build-zpatches.plugin
new file mode 100644
index 0000000..dc46ac4
--- /dev/null
+++ b/var/lib/lunar/plugins/build-zpatches.plugin
@@ -0,0 +1,80 @@
+#!/bin/bash
+#############################################################
+#                                                           #
+# build-zpatches.plugin -  build handling of custom         #
+#                          patches that need to be applied  #
+#                          to a module without editing      #
+#                          DETAILS/BUILD files              #
+#                                                           #
+#############################################################
+#                                                           #
+# Copyright 2007 by Stefan Wold under GPLv2                 #
+#                                                           #
+#############################################################
+
+
+plugin_zpatches_apply()
+{
+  local PATCHDIRS FPATCH PATCH TARCMD GZCMD TMPFILE1 TMPFILE2
+  if [ -d $MOONBASE/zlocal/_patches/$MODULE ]; then
+    cd $SOURCE_DIRECTORY
+    PATCHDIRS+=" $MOONBASE/zlocal/_patches/$MODULE"
+    # Check for version based patch dir
+    if [ -d $MOONBASE/zlocal/_patches/$MODULE/$VERSION ]; then
+      PATCHDIRS+=" $MOONBASE/zlocal/_patches/$MODULE/$VERSION"
+    fi
+    # Now find all patches and apply them
+    # We also sort them so it possible to apply patch order
+        # by prefixing a patch with 01, 02, 03 etc
+    find $PATCHDIRS -maxdepth 1 -type f | sed 's;[^/]*$;& &;' | sort -t ' ' -k 2 | while read FPATCH PATCH; do
+      verbose_msg "Applying custom patch for $MODULE ($PATCH)"
+
+      if [[ -n `echo $PATCH | grep '\.tar'` ]] ; then
+        TARCMD="tar x -O"
+      else
+        TARCMD="cat"
+      fi
+
+      if [[ -n `echo $PATCH | grep '\.bz2$'` ]] ; then
+        GZCMD="bzcat"
+      elif [[ -n `echo $PATCH | grep '\.gz$'` ]] ; then
+        GZCMD="zcat"
+      else
+        GZCMD="cat"
+      fi
+
+      TMPFILE1=$(temp_create "zpatch_1")
+      TMPFILE2=$(temp_create "zpatch_2")
+
+      if $GZCMD $FPATCH > $TMPFILE1 ; then
+        # uncompress OK
+        if cat $TMPFILE1 | $TARCMD > $TMPFILE2 ; then
+          # untar OK
+          # Trying -p1 first or else we try -p0
+          # An error will be visible if -p1 fail which is normal
+          # Only return error if both -p1 and -p0 fail
+          patch -p1 -t < $TMPFILE2 || patch -p0 -t < $TMPFILE2
+          if [ $? -ne 0 ]; then
+            message "${PROBLEM_COLOR}ERROR: Failed to apply ${PATCH} for ${MODULE}${DEFAULT_COLOR}"
+            temp_destroy $TMPFILE1
+            temp_destroy $TMPFILE2
+            return 1
+          else
+            temp_destroy $TMPFILE1
+            temp_destroy $TMPFILE2
+          fi
+        fi
+      fi
+    done
+    if [ $? != 0 ]; then
+      exit 1
+    else
+      return 2
+    fi
+  else
+    # No patchdir for that module found just continue
+    return 2
+  fi
+}
+
+plugin_register BUILD_BUILD plugin_zpatches_apply
diff --git a/var/lib/lunar/plugins/check-md5sum.plugin b/var/lib/lunar/plugins/check-md5sum.plugin
index 15734e1..3396fb8 100644
--- a/var/lib/lunar/plugins/check-md5sum.plugin
+++ b/var/lib/lunar/plugins/check-md5sum.plugin
@@ -26,20 +26,17 @@ plugin_module_check_md5sum()  {
 
   if [ -e "$MD5_LOG" ]; then
     IFS_OLD="$IFS"
-    export IFS="	
-"
+    export IFS=$'\t\n'
 
     cat $MD5_LOG | grep "/bin/\|/games/\|/include/\|/lib/\|/sbin/" |
             grep -v "/doc/\|/etc/\|/fonts/\|/man/\|/var/" |
             while read LINE ; do
       if ! echo $LINE | md5sum --check --status ; then
+        FILE=$(echo $LINE | awk '{ print $2 }')
         if [ -f "$FILE" ] && [ ! -h "$FILE" ] && file -b "$FILE" |
-		    egrep -q "executable|shared object|current ar archive" ; then
-          MD5SUM=$(md5sum "$FILE")
-          if ! grep -q "$LINE" $MD5SUM_LOGS/*; then
-            message "${FILE_COLOR}$FILE${DEFAULT_COLOR} of ${MODULE_COLOR}$MODULE${PROBLEM_COLOR} has wrong md5sum.${DEFAULT_COLOR}"
-            MD5SUM_STATUS=1
-          fi
+              egrep -q "executable|shared object|current ar archive|ASCII C?? program" ; then
+          message "${FILE_COLOR}$FILE${DEFAULT_COLOR} of ${MODULE_COLOR}$MODULE${PROBLEM_COLOR} has wrong md5sum.${DEFAULT_COLOR}"
+          MD5SUM_STATUS=1
         fi
       fi
     done
diff --git a/var/lib/lunar/unset.sh b/var/lib/lunar/unset.sh
index f1ef2fe..5239487 100644
--- a/var/lib/lunar/unset.sh
+++ b/var/lib/lunar/unset.sh
@@ -87,7 +87,6 @@ unset SUSTAIN
 unset SUSTAINED
 unset SYM_CHECK
 unset SYMLINK_COLOR
-unset TMPFS
 unset TRACKED
 unset UNIQID
 unset USE_CACHE


More information about the Lunar-commits mailing list