[Lunar-commits] CVS: theedge/var/lib/lunar/functions download.lunar, 1.51, 1.52 main.lunar, 1.23, 1.24 misc.lunar, 1.7, 1.8 moonbase.lunar, 1.19, 1.20 sources.lunar, 1.27, 1.28

Auke Kok sofar at lunar-linux.org
Fri Mar 18 11:01:33 UTC 2005


Update of /var/cvs/lunar/theedge/var/lib/lunar/functions
In directory espresso.foo-projects.org:/home/sofar/active/theedge/var/lib/lunar/functions

Modified Files:
	download.lunar main.lunar misc.lunar moonbase.lunar 
	sources.lunar 
Log Message:
W00t, the end of FUZZY!!!


Index: download.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/download.lunar,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- download.lunar	11 Jan 2005 21:52:13 -0000	1.51
+++ download.lunar	18 Mar 2005 11:01:31 -0000	1.52
@@ -191,24 +191,8 @@
 }
 
 
-call_wget()  {  
+call_wget()  {
   debug_msg "call_wget ($@)"
-   [ -n "$http_proxy" ] && export http_proxy=$http_proxy
-   [ -n  "$ftp_proxy" ] && export  ftp_proxy=$ftp_proxy
-   [ -n   "$no_proxy" ] && export   no_proxy=$no_proxy
-
-   S_FILE=$(basename $1)
-
-   debug_msg "call_wget: PWD=$PWD"
-   verbose_msg "calling \"wget $WGET_CACHE $WGET_RATE $WGET_FTP_CONNECTION $WGET_RETRIES $WGET_PARTIAL $1 --output-document $S_FILE\""
-   wget $WGET_CACHE $WGET_RATE $WGET_FTP_CONNECTION $WGET_RETRIES $WGET_PARTIAL "$1" --output-document "$S_FILE"
-}
-
-
-# fuzzy_wget is a wrapper that tries to call possible mis-finenamed 
-# source tarballs (ie .tar.gz instead of .tar.bz2)
-fuzzy_wget()  {
-  debug_msg "fuzzy_wget ($@)"
 
   # this is what the download will be stored as initially:
   TMP_FILE=$TMPDIR/$(basename $2)
@@ -218,7 +202,7 @@
   fi
 
   if [ "$CONTINUE" == "off" ] ; then
-    erase $(guess_filename $TMP_FILE) 
+    erase $TMP_FILE
   else
     WGET_PARTIAL="--continue"
   fi
@@ -233,36 +217,26 @@
     WGET_RATE="--limit-rate=${DOWNLOAD_RATE}"
   fi
 
-  WGET_NUM_RETRY=${NUM_RETRY:=5}
-  WGET_RETRIES="--tries=${WGET_NUM_RETRY}"
-  FUZZY=${FUZZY:=off}
+  WGET_RETRIES="--tries=${WGET_NUM_RETRY:=5}"
 
-  S_FILE=$(basename $2 | sed -e "s/\.tar\.gz$//" -e "s/\.tgz$//" -e  "s/\.tar\.bz2$//")
+  [ -n "$http_proxy" ] && export http_proxy=$http_proxy
+  [ -n  "$ftp_proxy" ] && export  ftp_proxy=$ftp_proxy
+  [ -n   "$no_proxy" ] && export   no_proxy=$no_proxy
 
-  if erase $2 && call_wget $1 ; then
-    FILE="$(basename $2)"
-  elif [ "$FUZZY" == "off" ] ; then
-    activity_log  "lget"  "$MODULE"  "$VERSION"  "failed" "broken URL: $1"
-    return 1
-  elif erase $2 && call_wget $(dirname $1)/$S_FILE.tar.bz2 ; then
-    FILE="$S_FILE.tar.bz2"
-  elif erase $2 && call_wget $(dirname $1)/$S_FILE.tar.gz ; then
-    FILE="$S_FILE.tar.gz"
-  elif erase $2 && call_wget $(dirname $1)/$S_FILE.tgz ; then
-    FILE="$S_FILE.tgz"
+  verbose_msg "calling \"wget $WGET_CACHE $WGET_RATE $WGET_FTP_CONNECTION $WGET_RETRIES $WGET_PARTIAL $1 --output-document $TMP_FILE\""
+  if erase $TMP_FILE && wget $WGET_CACHE $WGET_RATE $WGET_FTP_CONNECTION $WGET_RETRIES $WGET_PARTIAL "$1" --output-document "$TMP_FILE" ; then
+    # looks like it worked
+    if testpack $TMP_FILE ; then
+      install -m644 $TMP_FILE $(dirname $2)/$(basename $TMP_FILE)
+      rm $TMP_FILE
+      verbose_msg "download of \"$1\" successful"
+    else
+      rm -f $TMP_FILE
+    fi
   else
     activity_log  "lget"  "$MODULE"  "$VERSION"  "failed" "broken URL: $1"
     return 1
   fi
-
-  TMP_RESULTFILE=$(guess_filename $TMP_FILE)
-  if testpack $TMP_RESULTFILE ; then
-    install -m644 $TMP_RESULTFILE $(dirname $2)/$(basename $TMP_RESULTFILE)
-    rm $(guess_filename $TMP_RESULTFILE)
-    verbose_msg "download of \"$1\" successful"
-  else
-    rm -f $(guess_filename $TMP_RESULTFILE)
-  fi
 }
 
 
@@ -319,26 +293,26 @@
       cp $(echo $1 | sed 's/file:\/\///') $2
 
     else
-      # ordinary URL's handled by fuzzy_wget
+      # ordinary URL's handled by call_wget
       connect &&
       if [ -n "$BASE_URL" ] ; then
         # base url set means we don't touch the other possibilities:
-        fuzzy_wget $BASE_URL/$(basename $2) $2
+        call_wget $BASE_URL/$(basename $2) $2
       else
         if [ -n "$FRESORT_URL" ] ; then
           # try fresort first
-          if ! fuzzy_wget $FRESORT_URL/$(basename $2) $2 ; then
+          if ! call_wget $FRESORT_URL/$(basename $2) $2 ; then
             # normal url second
-            if ! fuzzy_wget $1 $2 ; then
+            if ! call_wget $1 $2 ; then
               # and failover
-              fuzzy_wget $LRESORT_URL/$(basename $2) $2
+              call_wget $LRESORT_URL/$(basename $2) $2
             fi
           fi
-        elif ! fuzzy_wget $1 $2 ; then
+        elif ! call_wget $1 $2 ; then
           # just try the normal url
           if [ -n "$LRESORT_URL" ] ; then
             # and the failover url
-            fuzzy_wget $LRESORT_URL/$(basename $2) $2
+            call_wget $LRESORT_URL/$(basename $2) $2
           fi
         fi
       fi
@@ -402,7 +376,7 @@
     # silly that this exists:
     if [ "$CLEAR_CACHE" == "on" ] ; then
       verbose_msg "clearing source cache copy of \"$SRC\""
-      rm -f `guess_filename  $SOURCE_CACHE/$SRC` 2>/dev/null
+      rm -f $SOURCE_CACHE/$SRC 2>/dev/null
     fi
 
     # add source part if needed
@@ -412,7 +386,7 @@
       fi
 
       # quit if we did get it
-      if [ -f "$(guess_filename $SOURCE_CACHE/$SRC)" ] ; then
+      if [ -f "$SOURCE_CACHE/$SRC)" ] ; then
         if [ "${URL:0:6}" == "cvs://" ] ; then
 	  verbose_msg "trying to download \"$URL\""
 	  get_url $URL $SOURCE_CACHE/$SRC && break
@@ -445,7 +419,11 @@
 
 testpack () {
   debug_msg "testpack ($@)"
-  FILENAME=$(guess_filename $1) || FILENAME=$(guess_filename $SOURCE_CACHE/$1)
+  if [ -f "$1" ]; then
+    FILENAME=$1
+  else
+    FILENAME=$SOURCE_CACHE/$1
+  fi
   if [ -f "$FILENAME" ] ; then
     COMPRESSOR=$(file -b $FILENAME | cut -d ' ' -f1)
     case $COMPRESSOR in

Index: main.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/main.lunar,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- main.lunar	18 Mar 2005 09:58:23 -0000	1.23
+++ main.lunar	18 Mar 2005 11:01:31 -0000	1.24
@@ -235,7 +235,7 @@
     return 1
   fi
 
-  # resurrect if we can, but not if -c was issued
+  # resurrect if we can, but not is -c was issued
   if [ "$AUTORESURRECT" == "on" -a -z "$COMPILE" ] ; then
     # we also do not resurrect if $MODULE is currently installed!
     if ! module_installed $MODULE ; then

Index: misc.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/misc.lunar,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- misc.lunar	3 Mar 2004 21:51:07 -0000	1.7
+++ misc.lunar	18 Mar 2005 11:01:31 -0000	1.8
@@ -89,36 +89,6 @@
 }
 
 
-# function : guess_filename
-# usage    : guess_filename <filename>
-# purpose  : fuzzy check for the existance of the filename
-guess_filename()  {
-  debug_msg "guess_filename ($@)"
-  FILENAME=$1
-  BASENAME=${FILENAME/.tar.gz/}
-  BASENAME=${BASENAME/.tar.bz2/}
-  BASENAME=${BASENAME/.tgz/}
-
-  if [ -f "$FILENAME" ] ; then
-    debug_msg "guess_filename: $FILENAME"
-    echo $FILENAME
-  elif [ "$FUZZY" == "off" ] ; then
-    return 1
-  elif [ -f "$BASENAME.tar.gz" ] ; then
-    debug_msg "guess_filename: $BASENAME.tar.gz"
-    echo $BASENAME.tar.gz
-  elif [ -f "$BASENAME.tar.bz2" ] ; then
-    debug_msg "guess_filename: $BASENAME.tar.bz2"
-    echo $BASENAME.tar.bz2
-  elif [ -f "$BASENAME.tgz" ] ; then
-    debug_msg "guess_filename: $BASENAME.tgz"
-    echo $BASENAME.tgz
-  else
-    return 1
-  fi
-}
-
-
 # function : filter
 # usage    : filter $FILE
 # purpose  : filter stdin with files/dirs/symlinks provided in file $1.

Index: moonbase.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/moonbase.lunar,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- moonbase.lunar	10 Dec 2004 10:46:33 -0000	1.19
+++ moonbase.lunar	18 Mar 2005 11:01:31 -0000	1.20
@@ -26,7 +26,6 @@
        VERSION=`date -u +%Y%m%d.%H`
         SOURCE=$(basename $MOONBASE_URL)
     SOURCE_URL=${MOONBASE_URL[@]}
-         FUZZY=off
        PARTIAL=off
    CLEAR_CACHE=on
   }

Index: sources.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/sources.lunar,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- sources.lunar	14 Dec 2004 15:05:06 -0000	1.27
+++ sources.lunar	18 Mar 2005 11:01:31 -0000	1.28
@@ -23,7 +23,7 @@
   debug_msg "verify_source ($@)"
   VERIFIED="true"
   for SOURCE_FILE in $@ ; do
-    if ! guess_filename $SOURCE_CACHE/$1 >/dev/null ; then
+    if [ ! -f $SOURCE_CACHE/$1 ] ; then
       message "${PROBLEM_COLOR}Missing ${FILE_COLOR}${1}${DEFAULT_COLOR}"
       message "${PROBLEM_COLOR}Lunar Install aborting.${DEFAULT_COLOR}"
       activity_log "lin" "$MODULE" "$VERSION" "failed" "because it was missing source:  $1"
@@ -108,8 +108,8 @@
 erase()  {
   debug_msg "erase ($@)"
   if [ "$PARTIAL" == "off" ]; then
-    debug_msg "erase: deleting \"$(guess_filename $1)\""
-    rm -f $(guess_filename $1)
+    debug_msg "erase: deleting \"$1\""
+    rm -f $1
   fi
 }
 
@@ -117,7 +117,7 @@
 unpack() {
   debug_msg "unpack ($@)"
 
-  FILENAME=$(guess_filename $SOURCE_CACHE/$1)
+  FILENAME=$SOURCE_CACHE/$1
   verbose_msg "Unpacking \"$FILENAME\" in \"$(pwd)\""
 
   case $(file -b $FILENAME | cut -d' ' -f1) in



More information about the Lunar-commits mailing list