r38 - in trunk: . debian methods

Eddy Petrisor eddyp-guest at costa.debian.org
Tue Mar 28 22:22:14 UTC 2006


Author: eddyp-guest
Date: 2006-03-28 22:22:13 +0000 (Tue, 28 Mar 2006)
New Revision: 38

Modified:
   trunk/TODO
   trunk/apt-zip-list
   trunk/apt-zip.sgml
   trunk/common.sh
   trunk/debian/changelog
   trunk/methods/wget
Log:
bugfix: feature: readdded the md5sum checking as optional
misc: set internal version to 0.14
todo: test the md5sum code


Modified: trunk/TODO
===================================================================
--- trunk/TODO	2006-03-28 21:24:45 UTC (rev 37)
+++ trunk/TODO	2006-03-28 22:22:13 UTC (rev 38)
@@ -4,5 +4,6 @@
 - use a consistent indenting schema (take care that method scripts are
   dealt differently and should have mixed indenting in order to have nicely
   indeneted generated scripts)
+- test the md5sum code checking, it was blindly added
 
 * -- File last reviewed: 2006/03/29

Modified: trunk/apt-zip-list
===================================================================
--- trunk/apt-zip-list	2006-03-28 21:24:45 UTC (rev 37)
+++ trunk/apt-zip-list	2006-03-28 22:22:13 UTC (rev 38)
@@ -69,6 +69,7 @@
 #export the sleep command so it is visible in the method script
 export SLEEPTIME
 export SLEEPCMD=`eval "$SLEEPEVALCMD"`
+export CHECK=`eval "$CHECKEVALCMD"`
 
 # Write the script
 SCRIPT="${MEDIUM}"/fetch-script-$METHOD-$(uname -n)

Modified: trunk/apt-zip.sgml
===================================================================
--- trunk/apt-zip.sgml	2006-03-28 21:24:45 UTC (rev 37)
+++ trunk/apt-zip.sgml	2006-03-28 22:22:13 UTC (rev 38)
@@ -184,7 +184,19 @@
             </simpara>
           </listitem>
         </varlistentry>
-      </variablelist>
+
+        <varlistentry>
+          <term>--no-md5, -5</term>
+          <listitem>
+            <simpara>This option will command to apt-zip-list to create a
+              script which does not make any md5sum checks.
+              Note that if this option is not given at script generation
+              time, the md5sum command will be called only after it has 
+              been found in the system.
+            </simpara>
+          </listitem>
+        </varlistentry>
+       </variablelist>
     </refsect2>
 
     <refsect2>

Modified: trunk/common.sh
===================================================================
--- trunk/common.sh	2006-03-28 21:24:45 UTC (rev 37)
+++ trunk/common.sh	2006-03-28 22:22:13 UTC (rev 38)
@@ -1,6 +1,6 @@
 # library file sourced by apt-zip-*
 
-APTZIPVERSION=0.13.7
+APTZIPVERSION=0.14
 export APTZIPVERSION
 
 CONFFILE=/etc/apt/apt-zip.conf
@@ -55,6 +55,10 @@
  -f, --fix-broken    Call apt-get with this flag
  -s, --skip-mount    Do not mount a device on the dir specified by --medium 
  -S, --use-sleep=SEC Wait SEC seconds after each download
+ -5, --no-md5        Do not make md5 sum checks; Note that if this option is
+                     not given at script generation time, the md5sum command
+                     will be called only after it has been found in the
+                     system.
 EOF
 }
 
@@ -113,6 +117,7 @@
     # make sure that we will have a valid command for sleep
     SLEEPTIME=0
     SLEEPEVALCMD='true'
+    CHECKEVALCMD='echo "check"'
     [ -r $CONFFILE ] && . $CONFFILE
     METHOD=${METHOD-wget}
     MEDIUM=${MEDIUM-/ZIP}
@@ -164,6 +169,10 @@
 	    shift
 	    shift
 	    ;;
+	--no-md5|-5)
+	    CHECKEVALCMD='echo "echo"'
+	    shift
+	    ;;
 	--use-sleep=*)
 	    SLEEPTIME="${1#--use-sleep=}"
 	    SLEEPEVALCMD='echo "[ ! -z "\`type sleep\`" ] && sleep ${SLEEPTIME}"'

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2006-03-28 21:24:45 UTC (rev 37)
+++ trunk/debian/changelog	2006-03-28 22:22:13 UTC (rev 38)
@@ -8,6 +8,7 @@
   * corrected type of --skip-mount element in manual (closes: #358678)
   * documented in man page the newly added option: -S/--use-sleep
   * document apt-zip-list being runable by non-root
+  * reinsert the md5 sums as optional (closes: #184354)
 
  -- Eddy Petrișor <eddy.petrisor at gmail.com>  Sat, 11 Mar 2006 02:09:20 +0200
 

Modified: trunk/methods/wget
===================================================================
--- trunk/methods/wget	2006-03-28 21:24:45 UTC (rev 37)
+++ trunk/methods/wget	2006-03-28 22:22:13 UTC (rev 38)
@@ -24,7 +24,29 @@
 	}
 EOF
 
+
 ###############
+# add check code, if is wanted
+#
+[ ! "${USEMD5SUMS}" = 'no' ] && cat <<-EOF
+	check(){
+	    [ ! -r "\$1" ] && return 1
+	    [ "\`type md5sum\`" ] &&
+	        if [ "\`md5sum \$1 | cut -d' ' -f1\`" = \$2 ]
+	        then return 0
+	        else err \$1 "wrong MD5"; return 1
+	        fi
+	    [ "\`type gzip\`" ] &&
+	        if ar p \$1 data.tar.gz | gzip -t
+	        then return 0
+	        else err \$1 "wrong contents"; return 1
+	        fi
+	    return \$3
+	}
+EOF
+
+
+###############
 # Differences between gnutar and solaris
 #
 if [ "$OPTION_SOLARISTAR" != 0 ] ; then
@@ -55,6 +77,7 @@
 
 	do_wget() {
 	    wget -t3 -nv -O \$2 \$1
+	    ${CHECK} \$2 \$4 \$?
 	    ${SLEEPCMD}
 	    return \$?
 	}
@@ -77,9 +100,10 @@
 		    if [ -r "$OLDTARFILE" ] && "$TAR" "$TARTEST" "$OLDTARFILE" \$2 >/dev/null 2>&1
 		    then
 		        "$TAR" "$TAREXTRACT" "$OLDTARFILE" \$2
-		        if [ -r \$2 ] ; then echo "Already got \$2"; return 0; fi
+		        if [ -r \$2 ] && ${CHECK} \$2 \$4 \$? ; then echo "Already got \$2"; return 0; fi
 		    fi
 		    wget -nc -t3 -nv -O \$2 \$1
+		    ${CHECK} \$2 \$4 \$?
 		    ${SLEEPCMD}
 		    return \$?
 		}
@@ -88,8 +112,9 @@
     elif [ "$OPTION_TAR" = 0 ] ; then
     cat <<-EOF
 	do_wget() {
-	    if [ -r ../\$2 ] ; then echo "Already got \$2"; return 1; fi
+	    if [ -r ../\$2 ] && ${CHECK} ../\$2 \$4 \$? ; then echo "Already got \$2"; return 1; fi
 	    wget -t3 -nv -O \$2 \$1
+	    ${CHECK} \$2 \$4 \$?
 	    ${SLEEPCMD}
 	    return \$?
 	}
@@ -109,7 +134,7 @@
     cat <<-EOF
 
 	getfile(){
-	    ( [ -r ../\$2 ]   &&   echo \$2 already downloaded.) ||
+	    ( [ -r ../\$2 ] &&  ${CHECK} ../\$2 \$4 \$?  &&   echo \$2 already downloaded.) ||
 	    (do_wget \$1 \$2 \$3 \$4   &&   mv \$2 ../)
 	}
 




More information about the Pkg-games-devel mailing list