[Lunar-commits] <lunar> Full sync with theedge: - zlocal folders may be empty and have module names (ignored from now) - lvu submit POST method code - lvu new template code - mirror updates - config_opts code fixes - man page updates

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


commit ead461996c29d8871df78f0bcf52403ca623aff5
Author: Auke Kok <sofar at lunar-linux.org>
Date:   Sat Jun 23 16:55:38 2007 +0000

    Full sync with theedge:
    - zlocal folders may be empty and have module names (ignored from now)
    - lvu submit POST method code
    - lvu new template code
    - mirror updates
    - config_opts code fixes
    - man page updates
---
 bin/lvu                               |  214 ++++++++++++++++++++-------------
 etc/lunar/mirrors/GNOME               |    1 +
 etc/lunar/mirrors/SFORGE              |   39 +++---
 etc/lunar/mirrors/XFREE86             |    1 +
 etc/lunar/mirrors/XORG                |    1 +
 sbin/lin                              |    3 +-
 usr/share/man/man1/lvu.1              |   47 +++++---
 var/lib/lunar/functions/build.lunar   |    6 +-
 var/lib/lunar/functions/depends.lunar |    5 +-
 var/lib/lunar/functions/main.lunar    |    3 +-
 var/lib/lunar/functions/modules.lunar |   11 +-
 11 files changed, 204 insertions(+), 127 deletions(-)

diff --git a/bin/lvu b/bin/lvu
index b931f0c..b29492e 100755
--- a/bin/lvu
+++ b/bin/lvu
@@ -80,6 +80,7 @@ urls        [module]       display all URLs for a module
 maintainer  module         display maintainer for a module
 version     module         display version of module in moonbase
 
+new         module         attempt to create a new module from scratch
 edit        module         copy a module to zlocal for editing
 diff        module         view changes on edited module
 submit      module         attempt to submit a module to the lunar ML
@@ -749,20 +750,23 @@ diff_module() {
     message "diff requires a single module name"
     exit 1
   fi
-  if ! run_details "$1" ; then
-      message "diff requires an existing module"
+  if ! run_details $1 ; then
+    message "diff requires an existing zlocal module"
       exit 1
-  else
-    if echo $SECTION | grep -q '^zlocal' ; then
-      ZLOCAL_OVERRIDES=off NZSECTION=$(find_section $1)
-      if echo $NZSECTION | grep -q '^zlocal' ; then
-        unset SECTION
       fi
-    else
-      message "no local copy of \"$MODULE\" exists"
+  if ! echo $SECTION | grep -q zlocal ; then
+    message "$1 is not a zlocal module, cannot diff"
       exit 1
     fi
-    ZSECTION=$(echo "$SECTION/" | sed 's/^zlocal\///g;s/\/$//')
+  NZSECTION=$(ZLOCAL_OVERRIDES=off find_section $1)
+  if [ "$SECTION" == "$NZSECTION" ] ; then
+    # new module
+    SECTION=zbeta
+    echo diff /dev/null b/zbeta/$MODULE
+    diff -Nur /var/empty $MOONBASE/zlocal/$ZSECTION/$MODULE --exclude ".svn" --exclude "CVS" | \
+    grep -v ^diff | sed "s:/var/empty/:a/zbeta/$MODULE/:g;s:$MOONBASE/zlocal/$ZSECTION/:b/zbeta/:g"
+  else
+    # modified module
     echo diff a/$NZSECTION/$MODULE b/$NZSECTION/$MODULE
     diff -Nur $MOONBASE/$NZSECTION/$MODULE $MOONBASE/zlocal/$ZSECTION/$MODULE --exclude ".svn" --exclude "CVS" | \
     grep -v ^diff | sed "s:$MOONBASE/$NZSECTION/:a/$NZSECTION/:g;s:$MOONBASE/zlocal/$ZSECTION/:b/$NZSECTION/:g"
@@ -782,8 +786,12 @@ submit_module() {
     message "submit requires a single module name."
     exit 1
   fi
-  if [ ! -x /usr/sbin/sendmail ]; then
-    message "submit requires /usr/sbin/sendmail from (postfix, exim, sendmail)"
+  if [ ! -x /usr/bin/curl ]; then
+    message "submit requires curl, please \`lin curl\`"
+    exit 1
+  fi
+  if [ -z "$ADMIN" -o "$ADMIN" == "$USER" ]; 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
@@ -802,78 +810,32 @@ submit_module() {
 	  exit 1
     fi
     TMP_MSG=$(temp_create "submission")
-	BOUNDARY="===============$(date -u +%s)=="
     (
-      echo '# MODULE SUBMISSION TEMPLATE'
-      echo '# --------------------------'
-      echo '# '
-      echo '# (all lines starting with # will be deleted before sending)'
-      echo '# Please fill in the fields as complete as possible to help'
-      echo '# developers track the status of your module'
-      echo '# '
-      echo '# PLEASE DO NOT CHANGE THE FOLLOWING FIELDS:'
-      echo 'To: lunar at lunar-linux.org'
-      echo 'Date:' $(date -u -R)
-      echo 'Subject: Module submission -' $MODULE
-	  echo 'MIME-Version: 1.0'
-	  echo "Content-Type: multipart/mixed; boundary=\"$BOUNDARY\""
-      echo '# '
-      echo '# YOUR E_MAIL ADDRESS MUST BE VALID:'
-      echo 'From: '
-      echo '#Reply-To:'
-      echo '#Cc: '
-	  echo ''
-	  echo "--$BOUNDARY"
-	  echo 'Content-Type: text/plain; charset="us-ascii"'
-	  echo 'MIME-Version: 1.0'
-	  echo 'Content-Transfer-Encoding: 7bit'
-	  echo ''
-      echo '# PLEASE DO NOT CHANGE WHITESPACE ABOVE THIS LINE'
-      echo ''
-      echo '# '
-      echo '# Please fill in some of the following information if applicable:'
-      echo '# '
-      echo 'module name       :' $MODULE
-      echo 'suggested section :' $SECTION
-      echo 'update (y/n)      : n'
-      echo 'bugfix (y/n)      : n'
-      echo 'security (y/n)    : n'
-      echo ''
-      echo '# '
-      echo '# Add additional information, hints, comments below here,'
-      echo '# if you entered "y" in one of the fields above, please explain!'
-      echo '# '
-      echo ''
-      echo '# YOUR NAME HERE'
-	  echo "$USER"
-	  echo ''
-      echo '# '
-      echo '# Below is your module. Please do not change the format'
-      echo '# '
-	  echo ''
-	  echo "--$BOUNDARY"
-	  echo "Content-Type: text/plain; name=\"$1.patch\""
-	  echo 'MIME-Version: 1.0'
-	  echo ''
-	  if [ -n "$SECTION" ]; then
-	    diff -Nurb $MOONBASE/$SECTION/$MODULE $MOONBASE/zlocal/$MODULE --exclude ".svn" --exclude "CVS" | sed "s|^\([+-][+-][+-] \)$MOONBASE/[^/]*/|\1|g" | grep -v "^diff "
-	  else
-	    diff -Nurb $MOONBASE/zlocal/.nonexistant $MOONBASE/zlocal/$MODULE --exclude ".svn" --exclude "CVS" | sed "s|^\([+-][+-][+-] \)$MOONBASE/[^/]*/|\1|g" | sed "s|\.nonexistant|$MODULE|g" | grep -v "^diff "
-	  fi
-	  echo -e "\n--$BOUNDARY"
-	  echo 'Content-Type: text/plain; charset="us-ascii"'
-	  echo 'MIME-Version: 1.0'
-	  echo 'Content-Transfer-Encoding: 7bit'
-	  echo ''
-	  echo "lvu submit $1 $(cat /bin/lvu | md5sum)"
-	  echo "$(uname -r) $(if [ -f /usr/include/linux/version.h ]; then grep UTS_RELEASE /usr/include/linux/version.h | cut -d '"' -f2 ; else echo "unknown" ; fi) gcc-$(installed_version gcc) glibc-$(installed_version glibc)"
-	  echo ''
+      echo ""
+      echo "# type a changelog message here"
+      echo "# all lines starting with '#' will be removed"
     ) > $TMP_MSG
     edit_file $TMP_MSG
-    cat $TMP_MSG | grep -v '^#'
+    sed -i '/^#/d' $TMP_MSG
+    (
+      echo ''
+      echo '---'
+      echo 'from:' $ADMIN
+      echo 'module:' $1
+      echo "id: $UNIQID"
+      echo "lvu submit: $1"
+      echo "lvu: $(cat /bin/lvu | md5sum)"
+      echo "uname -r: $(uname -r)"
+      echo "kernel headers: $(if [ -f /usr/include/linux/version.h ]; then grep UTS_RELEASE /usr/include/linux/version.h | cut -d '"' -f2 ; else echo "unknown" ; fi)"
+      echo "gcc: $(installed_version gcc)"
+      echo "glibc: $(installed_version glibc)"
+      echo ''
+      echo '---'
+      lvu diff $1
+    ) >> $TMP_MSG
+    cat $TMP_MSG
     if query "Submit this module now?" y; then
-      RECIPIENT=$(grep -m 1 '^To: ' $TMP_MSG | sed 's/^To: //')
-      cat $TMP_MSG | grep -v '^#' | sendmail $RECIPIENT
+      curl -F file=@$TMP_MSG -F module=$1 -F id=$UNIQID "http://lunar-linux.org/submit.php"
       temp_destroy $TMP_MSG
     else
       message "Submission aborted. your submission was saved as $TMP_MSG"
@@ -921,6 +883,93 @@ unedit_module()
 }
 
 
+new_module()
+{
+	if [ -z "$1" ]; then
+		echo "You have to give it a name - use \`lvu new $name\`"
+		exit 1
+	elif run_details $1 > /dev/null 2>&1 ; then
+		echo "Module \"$1\" already exists, use \`lvu edit $1\` instead"
+		exit 1
+	fi
+
+	MODULE=$1
+
+	message "Paste the principal download URL for your application:"
+	read URL
+	echo
+
+	message "Write a 1-line summary of the module. do NOT write something"
+	message "like \"foo is a...\". Write something that describes it best:"
+	read SHORT
+	echo
+
+	message "Paste the main website URL:"
+	read WEB_SITE
+	echo
+
+	LONG=$(temp_create "lvu.new.$1")
+	message "Paste 1 or 2 paragraphs of text that give a good description for $1:"
+	message "Press CONTROL-D on an empty line when finished"
+	cat - > $LONG
+
+	ENTERED=$(date +%Y%m%d)
+	UPDATED=$(date +%Y%m%d)
+
+	SOURCE_URL="$(dirname $URL)/"		# get url
+	SOURCE=$(basename $URL)			# get base
+
+	if [ ! -f $SOURCE_CACHE/$SOURCE ] ; then
+		if ! download_url $SOURCE_URL $SOURCE $SOURCE_CACHE ; then
+			echo "Unable to download $URL"
+			exit 1
+		fi
+	fi
+
+	SHA1=$(sha1sum $SOURCE_CACHE/$SOURCE | cut -c1-40)
+
+	VERSION=$(echo $SOURCE | sed "s/$MODULE//")
+	VERSION=$(echo $VERSION | sed 's/^[-]//;s/^_//')
+	VERSION=${VERSION/^_}
+	VERSION=${VERSION/.tar}
+	VERSION=${VERSION/.tgz}
+	VERSION=${VERSION/.bz2}
+	VERSION=${VERSION/.gz}
+
+	SOURCE=$(echo $SOURCE | sed "s/$MODULE/\${MODULE}/")
+	SOURCE=$(echo $SOURCE | sed "s/$VERSION/\${VERSION}/")
+
+	if ! mkdir $MOONBASE/zlocal/$1 ; then
+		message "Unable to create module folder in zlocal section"
+		exit 1
+	fi
+	(
+		cat <<EOFDETA
+          MODULE=$MODULE
+         VERSION=$VERSION
+          SOURCE=$SOURCE
+      SOURCE_URL=$SOURCE_URL
+EOFDETA
+		if [ "$(tar tf $SOURCE_CACHE/$(basename $URL) | head -n 1)" != "$MODULE-$VERSION/" ]; then
+			echo "SOURCE_DIRECTORY=\$BUILD_DIRECTORY/\$MODULE-\$VERSION"
+		fi
+		cat <<EOFDETB
+      SOURCE_VFY=sha1:$SHA1
+        WEB_SITE="$WEB_SITE"
+         ENTERED=$ENTERED
+         UPDATED=$UPDATED
+           SHORT="$SHORT"
+cat <<EOF
+EOFDETB
+		cat $LONG | fmt -72
+		echo "EOF"
+	) > $MOONBASE/zlocal/$1/DETAILS
+
+	message "Module \"$1\" created best-effort. You might have to \`lvu edit $1\" to make it work"
+	message "Don't forget to create a DEPENDS file! (hint: use \`lvu links $1\`)"
+	message "Don't forget to \`lvu submit $1\` if you think this module is useful to others!"
+}
+
 main()  {
   case $1 in
     html)
@@ -1309,6 +1358,9 @@ main()  {
    unedit)
      unedit_module $2
 	 ;;
+   new)
+     new_module $2
+     ;;
 
    *)
      help
@@ -1346,5 +1398,3 @@ else
   main $@
 fi
 
-
-
diff --git a/etc/lunar/mirrors/GNOME b/etc/lunar/mirrors/GNOME
index 8435232..008468b 100644
--- a/etc/lunar/mirrors/GNOME
+++ b/etc/lunar/mirrors/GNOME
@@ -8,6 +8,7 @@ France			ftp://fr.rpmfind.net/linux/gnome.org/
 France			ftp://fr2.rpmfind.net/linux/gnome.org/
 Italy			http://ftp.unina.it/pub/linux/GNOME/
 Norway			ftp://ftp.no.gnome.org/pub/GNOME/
+Poland			ftp://sunsite.icm.edu.pl/pub/Linux/GNOME/
 Spain			ftp://ftp.dit.upm.es/pub/GNOME/
 Sweden			ftp://ftp.dataplus.se/pub/GNOME/
 Sweden			ftp://ftp.acc.umu.se/pub/GNOME/
diff --git a/etc/lunar/mirrors/SFORGE b/etc/lunar/mirrors/SFORGE
index d325bf5..1d2a9bb 100644
--- a/etc/lunar/mirrors/SFORGE
+++ b/etc/lunar/mirrors/SFORGE
@@ -1,23 +1,30 @@
-easynews (US)	http://easynews.dl.sourceforge.net/sourceforge
-OSDN (US)		http://osdn.dl.sourceforge.net/sourceforge
-voxel (US)		http://voxel.dl.sourceforge.net/sourceforge
-jaist (JP)		http://jaist.dl.sourceforge.net/sourceforge
-optusnet (AU)	http://optusnet.dl.sourceforge.net/sourceforge
-heanet (IE)		http://heanet.dl.sourceforge.net/sourceforge
-puzzle (CH)		http://puzzle.dl.sourceforge.net/sourceforge
-ovh (FR)		http://ovh.dl.sourceforge.net/sourceforge
-nchc (TW)		http://nvhv.dl.sourceforge.net/sourceforge
-kent (UK)		http://kent.dl.sourceforge.net/sourceforge
-cogent (US)		http://cogent.dl.sourceforge.net/sourceforge
-citkit (RU)		http://citkit.dl.sourceforge.net/sourceforge
-mesh (DE)		http://mesh.dl.sourceforge.net/sourceforge
-switch (CH)		http://switch.dl.sourceforge.net/sourceforge
-belnet (BE)		http://belnet.dl.sourceforge.net/sourceforge
+Sydney (AU)		http://optusnet.dl.sourceforge.net/sourceforge
 flow (AU)		http://flow.dl.sourceforge.net/sourceforge
+Brussels (BE)		http://belnet.dl.sourceforge.net/sourceforge
+Curitiba (BR)		http://ufpr.dl.sourceforge.net/sourceforge
+Bern (CH)		http://puzzle.dl.sourceforge.net/sourceforge
+Lausanne (CH)		http://switch.dl.sourceforge.net/sourceforge
 cesnet (CZ)		http://cesnet.dl.sourceforge.net/sourceforge
+Berlin (DE)		http://dfn.dl.sourceforge.net/sourceforge
+Duesseldorf (DE)	http://mesh.dl.sourceforge.net/sourceforge
+Paris (FR)		http://ovh.dl.sourceforge.net/sourceforge
+Dublin (IE)		http://heanet.dl.sourceforge.net/sourceforge
+Ishikawa (JP)		http://jaist.dl.sourceforge.net/sourceforge
+Amsterdam (NL)		http://surfnet.dl.sourceforge.net/sourceforge
+citkit (RU)		http://citkit.dl.sourceforge.net/sourceforge
+Tainan (TW)		http://nchc.dl.sourceforge.net/sourceforge
+nvhv (TW)		http://nvhv.dl.sourceforge.net/sourceforge
+Kent (UK)		http://kent.dl.sourceforge.net/sourceforge
+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://umn.dl.sourceforge.net/sourceforge
+Minneapolis MN (US)	http://umn.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/XFREE86 b/etc/lunar/mirrors/XFREE86
index 9cad545..76ca9a8 100644
--- a/etc/lunar/mirrors/XFREE86
+++ b/etc/lunar/mirrors/XFREE86
@@ -28,6 +28,7 @@ Ireland				ftp://ftp.esat.net/pub/X11/XFree86/
 Netherlands			ftp://ftp.nl.uu.net/pub/XFree86/
 Netherlands			ftp://dl.xs4all.nl/pub2/mirror/XFree/
 Norway				ftp://sunsite.uio.no/pub/XFree86/
+Poland				ftp://sunsite.icm.edu.pl/pub/X11/XFree86/
 Poland				ftp://ftp.task.gda.pl/pub/XFree86/
 Spain				ftp://ftp.cica.es/pub/XFree86/
 Spain				ftp://ftp.cica.es/mirrors/XFree86/
diff --git a/etc/lunar/mirrors/XORG b/etc/lunar/mirrors/XORG
index 5dce784..ce305bb 100644
--- a/etc/lunar/mirrors/XORG
+++ b/etc/lunar/mirrors/XORG
@@ -23,6 +23,7 @@ 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/
+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/
 Russia			ftp://xorg.freshsoft.ru/ftp.x.org/
diff --git a/sbin/lin b/sbin/lin
index 5bde67c..dc5373a 100755
--- a/sbin/lin
+++ b/sbin/lin
@@ -86,6 +86,7 @@ main() {
     if [ -z "$TEMP_DOWNLOAD_PIDS" ] ; then
       export TEMP_DOWNLOAD_PIDS=$(temp_create "download-pids")
       export TEMP_PREPAREDDEPS=$(temp_create "prepared-depends")
+      export TEMP_CONFIGOPTS=$(temp_create "configopts")
     fi
 
     # pass 1 : run full dependency checking
@@ -160,6 +161,7 @@ main() {
     # cleanups that we need to do
     temp_destroy $TEMP_DOWNLOAD_PIDS
     temp_destroy $TEMP_PREPAREDDEPS
+    temp_destroy $TEMP_CONFIGOPTS
 
   else
     # we are only doing one module, drop down to:
@@ -199,7 +201,6 @@ main() {
       fi
     fi
   fi
-  
 }
 
 
diff --git a/usr/share/man/man1/lvu.1 b/usr/share/man/man1/lvu.1
index 4628222..52688e4 100644
--- a/usr/share/man/man1/lvu.1
+++ b/usr/share/man/man1/lvu.1
@@ -54,7 +54,7 @@ eert <module>
 size [module]
 .PP
 .B lvu
-submit|edit|unedit [module]
+new|submit|edit|unedit [module]
 .PP
 .B lvu
 $MODULE_SCRIPT <module>
@@ -83,62 +83,62 @@ displays installed modules that are missing required dependencies
 display modules installed that are pam aware
 .PP 
 .B cd
-module
+<module>
 .IP 
 changes current directory to the given module and execs a new shell
 .PP 
 .B what
-module
+<module>
 .IP 
 view the long package description
 .PP 
 .B where
-module
+<module>
 .IP 
 display the section a module belongs to
 .PP 
 .B website
-module
+<module>
 .IP 
 display the URL for the specified module
 .PP 
 .B sources
-module
+<module>
 .IP 
 list all source files contained in a module
 .PP 
 .B urls
-module
+<module>
 .IP 
 list all URLs for a module
 .PP 
 .B maintainer
-module
+<module>
 .IP 
 display the email address of the person currently responsible for maintaining a specified module
 .PP 
 .B version
-module
+<module>
 .IP 
 display version of module in moonbase
 .PP 
 .B compile
-module
+<module>
 .IP 
 show the compiler output generated when the module was built
 .PP 
 .B compiler
-module
+<module>
 .IP 
 display the version of compiler used for creating the ELF files in modules
 .PP
 .B links
-module
+<module>
 .IP
 display the modules that this module's ELF binary files actually links to
 .PP
 .B install
-module
+<module>
 .IP 
 used to determine what files were installed by a module and where those files are located
 .PP
@@ -166,9 +166,10 @@ print module MD5 message digests (fingerprints). If no module is given it defaul
 .PP 
 .B export
 .IP 
-take a snapshot of all modules currently installed
+take a snapshot of all modules and configuration currently installed
 .PP 
-.B import snapshot 
+.B import
+snapshot 
 .IP 
 restore the snapshot from a previous
 .I lvu export command (see the export option)
@@ -211,13 +212,15 @@ date
 .IP 
 print packages that are older than a specified date. the date must be specified in the 'yyyymmdd' format, where y=year, m=month, and d=day
 .PP 
-.B from <path/>file
+.B from
+<path/><file>
 .IP 
 find out what module has
 .I <path>/file
 installed
 .PP 
-.B installed <module>
+.B installed
+<module>
 .IP 
 view all installed packages and corresponding version numbers or check
 to see whether a particular package is installed and if it is
@@ -228,7 +231,8 @@ installed display its version number
 .IP 
 view a list of all sections in the software catalogue or display a list of packages from a specific section
 .PP 
-.B size <module>
+.B size
+<module>
 .IP 
 display the size of a given module or all your installed modules in KB
 .PP 
@@ -252,6 +256,11 @@ displays a tree of the module's dependencies.
 .IP 
 displays a tree of the module's reverse dependencies.
 .PP 
+.B new
+<module>
+.IP
+Attempt to create a module DETAILS file from scratch using cut-n-paste data from the user. Very dirty method to get a module started by just having 4 pieces of information handy: download url, descriptions and name
+.PP
 .B edit
 <module>
 .IP
@@ -268,7 +277,7 @@ Discards your 'edit'ed zlocal module. Works the same as removing it.
 Submit a module to the lunar module submission list/mail alias. Please only submit tested changes.
 .PP
 .B $MODULE_SCRIPT
-module
+<module>
 .IP 
 replace $MODULE_SCRIPT with any of the following DETAILS | CONFIGURE | CONFLICTS | PRE_BUILD | BUILD | POST_BUILD | POST_INSTALL | POST_REMOVE to show module scripts for the
 .I module
diff --git a/var/lib/lunar/functions/build.lunar b/var/lib/lunar/functions/build.lunar
index 18bf4d5..4efda36 100644
--- a/var/lib/lunar/functions/build.lunar
+++ b/var/lib/lunar/functions/build.lunar
@@ -328,13 +328,15 @@ run_configure() {
 
   # add custom passed OPTS before retrieving them
   if [ -n "$PASS_OPTS" ] ; then
-    OPTS="$(get_module_config OPTS) $PASS_OPTS"
-    set_module_config OPTS "$OPTS"
+    SAVE_OPTS="$(get_module_config OPTS) $PASS_OPTS"
+    set_module_config OPTS "$SAVE_OPTS"
   fi
   plugin_call BUILD_CONFIGURE $MODULE
   if has_module_file $MODULE CONFIGURE ; then
     run_module_file $MODULE CONFIGURE
   fi
+  # store $OPTS for later use
+  echo "$MODULE:$OPTS" >> $TEMP_CONFIGOPTS
 }
 
 
diff --git a/var/lib/lunar/functions/depends.lunar b/var/lib/lunar/functions/depends.lunar
index 692a2a7..fa0b3ca 100644
--- a/var/lib/lunar/functions/depends.lunar
+++ b/var/lib/lunar/functions/depends.lunar
@@ -324,25 +324,24 @@ run_conflicts() {
 
 
 build_module_depends() {
-(
   debug_msg "build_module_depends ($@)"
   if [ -n "$DEPS_ONLY" ] ; then
+   (
     if ! run_conflicts $1 ; then
       exit 1
     fi &&
     run_details $1 &&
     run_configure &&
     RECONFIGURE= run_depends
+   )
   else
     if ! run_conflicts $1 ; then
       exit 1
     fi &&
     run_details $1 &&
-    RECONFIGURE= run_configure &&
     RECONFIGURE= run_depends &&
     RECONFIGURE= satisfy_depends
   fi
-)
 }
 
 
diff --git a/var/lib/lunar/functions/main.lunar b/var/lib/lunar/functions/main.lunar
index f6e84c2..3bf630b 100644
--- a/var/lib/lunar/functions/main.lunar
+++ b/var/lib/lunar/functions/main.lunar
@@ -274,7 +274,8 @@ lin_module()  {
   run_conflicts               &&
   satisfy_depends             &&
   show_downloading            &&
-  RECONFIGURE= run_configure  &&
+
+  OPTS="$OPTS `grep ^$MODULE: $TEMP_CONFIGOPTS | cut -d: -f2`"
 
   # last minute source code presence check:
   (
diff --git a/var/lib/lunar/functions/modules.lunar b/var/lib/lunar/functions/modules.lunar
index 00824b6..80870c9 100644
--- a/var/lib/lunar/functions/modules.lunar
+++ b/var/lib/lunar/functions/modules.lunar
@@ -169,12 +169,12 @@ find_section() {
 
 	# if using ZLOCAL, we must search there first
 	if [[ "${ZLOCAL_OVERRIDES:-off}" == "on" ]] ; then
-		if SECTION=$(find "$MOONBASE/zlocal/" -type d -name $1 | sed -e "s|$MOONBASE/||;s|/$1$||" ) ; then
-			if [[ -n "$SECTION" ]]; then
+		for SECTION in $(find "$MOONBASE/zlocal/" -type d -name $1 | sed -e "s|$MOONBASE/||;s|/$1$||" ) ; do
+			if [[ -f "$MOONBASE/$SECTION/$1/DETAILS" ]]; then
 				echo $SECTION
 				return 0
 			fi
-		fi
+		done
 	fi
 
 	# otherwise check for ordinary modules named that way
@@ -524,6 +524,11 @@ purge_modules() {
   local MODULE
   debug_msg "purge_modules ($@)"
   verbose_msg "Discovering modules that were removed from moonbase"
+  # safetynet: don't wipe everything
+  if [ $(list_moonbase | wc -l) -lt 100 ]; then
+    error_message "${PROBLEM_COLOR}Error: ${DEFAULT_COLOR}${MESSAGE_COLOR} your moonbase seems damaged. Re-lin moonbase to fix.${DEFAULT_COLOR}"
+    exit 1
+  fi
   for MODULE in $(list_installed | grep -v "^moonbase$") ; do
   (
     if ! run_details $MODULE &> /dev/null ; then


More information about the Lunar-commits mailing list