[Lunar-commits] <lunar> Backmerge from theedge: speedups, cleanups, mirror changes.

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


commit e0037f74f75536249f7638a577f1e974c54f0a5b
Author: Auke Kok <sofar at lunar-linux.org>
Date:   Sun Mar 4 19:20:35 2007 +0000

    Backmerge from theedge: speedups, cleanups, mirror changes.
---
 bin/lvu                                       |   14 +++++-----
 etc/lunar/mirrors/XORG                        |    5 ++--
 usr/share/man/man1/lvu.1                      |    1 +
 var/lib/lunar/functions/aliases.lunar         |    4 +--
 var/lib/lunar/functions/config.lunar          |   35 +++++++++++++++----------
 var/lib/lunar/functions/depends.lunar         |    5 ++--
 var/lib/lunar/functions/download.lunar        |    6 ++++-
 var/lib/lunar/functions/modules.lunar         |    7 ++---
 var/lib/lunar/plugins/download-generic.plugin |    3 +++
 9 files changed, 47 insertions(+), 33 deletions(-)

diff --git a/bin/lvu b/bin/lvu
index 3392ace..2ecc69d 100755
--- a/bin/lvu
+++ b/bin/lvu
@@ -338,11 +338,11 @@ older()  {
 
 
 show_module_component()  {
-  COMPONENT=$1
-     MODULE=$2
-    SECTION=$(find_section $MODULE)
-  if [ -e $MOONBASE/$SECTION/$MODULE/$COMPONENT ] ; then
-    cat $MOONBASE/$SECTION/$MODULE/$COMPONENT
+  SCRIPT_DIRECTORY=$MOONBASE/$(find_section $2)/$2
+  if [[ -e "$SCRIPT_DIRECTORY/$1.$PLATFORM" ]]; then
+    cat "$SCRIPT_DIRECTORY/$1.$PLATFORM"
+  elif [[ -e "$SCRIPT_DIRECTORY/$1" ]] ; then
+    cat "$SCRIPT_DIRECTORY/$1"
   fi
 }
 
@@ -1197,8 +1197,8 @@ main()  {
 
     compile)
       run_details $2 ;
-        if [ -f $COMPILE_LOGS/$2-$(lvu version $2).bz2 ] ; then
-          view_file $COMPILE_LOGS/$2-$(lvu version $2).bz2
+        if [ -f $COMPILE_LOGS/$2-$(module_version $2).bz2 ] ; then
+          view_file $COMPILE_LOGS/$2-$(module_version $2).bz2
         else
           VERSION=$(installed_version $2)
           view_file $COMPILE_LOGS/$2-$(installed_version $2).bz2 \
diff --git a/etc/lunar/mirrors/XORG b/etc/lunar/mirrors/XORG
index d5b4dcc..5dce784 100644
--- a/etc/lunar/mirrors/XORG
+++ b/etc/lunar/mirrors/XORG
@@ -6,11 +6,10 @@ 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/
+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		http://ftp.gwdg.de/pub/x11/x.org/
-Germany		ftp://ftp.fu-berlin.de/unix/X11/FTP.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/
diff --git a/usr/share/man/man1/lvu.1 b/usr/share/man/man1/lvu.1
index 0294310..4628222 100644
--- a/usr/share/man/man1/lvu.1
+++ b/usr/share/man/man1/lvu.1
@@ -55,6 +55,7 @@ size [module]
 .PP
 .B lvu
 submit|edit|unedit [module]
+.PP
 .B lvu
 $MODULE_SCRIPT <module>
 .SH "COPYRIGHT"
diff --git a/var/lib/lunar/functions/aliases.lunar b/var/lib/lunar/functions/aliases.lunar
index ef16948..7e31a05 100644
--- a/var/lib/lunar/functions/aliases.lunar
+++ b/var/lib/lunar/functions/aliases.lunar
@@ -12,13 +12,13 @@
 # translate %ALIAS if needed to a module name that is installed
 # and add it to the dependency chain if needed
 unalias() {
-  local TARGET TARGETS TARGETBYNUM N CHOICE CACHED_ALIAS
   # quick exit code
-  if [ "${1:0:1}" != "%" ] ; then
+  if [[ "${1:0:1}" != "%" ]] ; then
     echo $1
     return
   fi
 
+  local TARGET TARGETS TARGETBYNUM N CHOICE CACHED_ALIAS
   # lookup in cache
   CACHED_ALIAS=$(get_local_config `echo LUNAR_ALIAS_${1:1}`)
   if [ -n "$CACHED_ALIAS" ]; then
diff --git a/var/lib/lunar/functions/config.lunar b/var/lib/lunar/functions/config.lunar
index 76ee9b3..91e7e54 100644
--- a/var/lib/lunar/functions/config.lunar
+++ b/var/lib/lunar/functions/config.lunar
@@ -18,12 +18,12 @@
 ############################################################
 
 
-
-set_config() {
+set_config()
+{
   local LINE NEW
   debug_msg "set_config ($@)"
 
-  LINE=$(cat $1 | grep -w "$2=.*")
+	LINE=$(grep -w "$2=.*" $1)
   if [ "$1" == "$LOCAL_CONFIG" ] ; then
     NEW=$(printf "%16s=%s" "$2" "$3")
   else
@@ -48,7 +48,8 @@ set_config() {
 }
 
 
-unset_config() {
+unset_config()
+{
   debug_msg "unset_config ($@)"
   
   # on-demand creation
@@ -65,32 +66,35 @@ unset_config() {
 }
 
 
-get_config() {
-  if [ -f $1 ] ; then
-    cat $1 | grep -w "$2=.*" | cut -d= -f2- | sed -e 's/^"//' -e 's/"$//'
+get_config()
+{
+	if [[ -f $1 ]] ; then
+		grep -w "$2=.*" $1 | cut -d= -f2- | sed -e 's/^"//' -e 's/"$//'
   fi
 }
 
 
-set_local_config() {
+set_local_config()
+{
   debug_msg "set_local_config ($@)"
   set_config "$LOCAL_CONFIG" "$1" "$2"
 }
 
 
-unset_local_config() {
+unset_local_config()
+{
   debug_msg "unset_local_config ($@)"
   unset_config "$LOCAL_CONFIG" "$1"
 }
 
 
 get_local_config() {
-  debug_msg "get_local_config ($@)"
   get_config "$LOCAL_CONFIG" "$1"
 }
 
 
-set_module_config() {
+set_module_config()
+{
   debug_msg "set_module_config ($@)"
   if [ -n "$MODULE" ] ; then
     set_config "$DEPENDS_CONFIG/$MODULE" "$1" "$2"
@@ -98,7 +102,8 @@ set_module_config() {
 }
 
 
-unset_module_config() {
+unset_module_config()
+{
   debug_msg "unset_module_config ($@)"
   if [ -n "$MODULE" ] ; then
     unset_config "$DEPENDS_CONFIG/$MODULE" "$1"
@@ -106,7 +111,8 @@ unset_module_config() {
 }
 
 
-get_module_config() {
+get_module_config()
+{
   debug_msg "get_module_config ($@)"
   if [ -n "$MODULE" ] ; then
     get_config "$DEPENDS_CONFIG/$MODULE" "$1"
@@ -114,7 +120,8 @@ get_module_config() {
 }
 
 
-get_other_module_config() {
+get_other_module_config()
+{
   debug_msg "get_other_module_config ($@)"
   if [ -n "$1" ] ; then
     get_config "$DEPENDS_CONFIG/$1" "$2"
diff --git a/var/lib/lunar/functions/depends.lunar b/var/lib/lunar/functions/depends.lunar
index 304206c..e6f3a25 100644
--- a/var/lib/lunar/functions/depends.lunar
+++ b/var/lib/lunar/functions/depends.lunar
@@ -29,14 +29,13 @@ function find_depends() {
   debug_msg "find_depends ($@)"
 
   find_depends_intern() {
-    local DEP LINE
+    local DEP
     for DEP in $(awk -F: -v mod=$1 '{if ($1==mod){print $2}}' $DEPENDS_CACHE) ; do
       DEP=$(unalias "$DEP")
       # this is our shortcut out:
       if ! grep -qx "$DEP" $TMP_FDEPS ; then
-        debug_msg "$DEP"
         echo "$DEP" >> $TMP_FDEPS
-        if [[ "$(grep "^$1:$DEP:" $DEPENDS_CACHE | cut -d: -f3)" == "required" ]] ; then
+        if grep -q "^$1:$DEP:required:" $DEPENDS_CACHE ; then
           echo "$DEP"
           find_depends_intern "$DEP"
         elif module_installed "$DEP" ; then
diff --git a/var/lib/lunar/functions/download.lunar b/var/lib/lunar/functions/download.lunar
index 7436641..f3c6b19 100644
--- a/var/lib/lunar/functions/download.lunar
+++ b/var/lib/lunar/functions/download.lunar
@@ -41,7 +41,11 @@ download_url() {
 	plugin_call SOURCE_DOWNLOAD $1 $2 $3
 	RETVAL=$?
 	if [ $RETVAL == 2 ]; then
-		message "${PROBLEM_COLOR}Warning:${QUERY_COLOR} I don't know how to download \"$1\"${DEFAULT_COLOR}"
+		# refuse to continue - it's useless to have the user attempt to
+		# download cvs/svn etc snapshots from the cache URLs
+		error_message "${PROBLEM_COLOR}I don't know how to download ${QUERY_COLOR}\"$1\".${DEFAULT_COLOR}"
+		error_message "${MESSAGE_COLOR}Install the package that provides the method and plugin to download it.${DEFAULT_COLOR}"
+		exit 1
 	fi
 	return $RETVAL
 }
diff --git a/var/lib/lunar/functions/modules.lunar b/var/lib/lunar/functions/modules.lunar
index b081bce..30d7c86 100644
--- a/var/lib/lunar/functions/modules.lunar
+++ b/var/lib/lunar/functions/modules.lunar
@@ -287,8 +287,9 @@ run_module_file() {
 # function : module_installed
 # usage    : module_installed $MODULE
 # purpose  : check if $MODULE is installed (or held)
-module_installed() {
-  $(cut -d: -f1,3 $MODULE_STATUS | grep -q -e "^$1:installed" -e "^$1:held")
+module_installed()
+{
+	grep -q "^$1:[[:digit:]]*:installed:\|^$1:[[:digit:]]*:held:" $MODULE_STATUS
 }
 
 
@@ -297,7 +298,7 @@ module_installed() {
 # purpose  : check if $MODULE is held
 module_held() {
   debug_msg "module_held ($@)"
-  $(cut -d: -f1,3 $MODULE_STATUS | grep -q "^$1:held")
+	grep -q "^$1:[[:digit:]]*:held:" $MODULE_STATUS
 }
 
 
diff --git a/var/lib/lunar/plugins/download-generic.plugin b/var/lib/lunar/plugins/download-generic.plugin
index c861f7f..65ff793 100644
--- a/var/lib/lunar/plugins/download-generic.plugin
+++ b/var/lib/lunar/plugins/download-generic.plugin
@@ -70,7 +70,10 @@ plugin_source_download_generic()  {
 	  return 1
     fi
   else
+    # don't report errors against cache misses
+    if [ "$URL" != "$LRESORT_URL/" ]; then
     activity_log "lget" "$MODULE" "$VERSION" "failed" "broken URL: \"$URL$2\""
+    fi
     return 1
   fi
 }


More information about the Lunar-commits mailing list