[Apt-zip-devel] preview of apt-zip 0.16

Giacomo Catenazzi cate at cateee.net
Wed Jun 20 15:54:32 UTC 2007


Hello,

I attach the diff between 0.15 and 0.16.
I've some request:

- could you check that I didn't forgot some patches

- Eddy: check your name on debian/changelog:
   I had some problem with UTF-8 encoding, I
   think I resolved it, but please check

- documentation is still the same as 0.14.
  If the option are stable, I think it is time to
  document.

- eddy: your test suit?

Note: I'm on DebConf7, so without my testing machine.
If you test it, then I can upload from Edimburgh,
else, next week at home I'll test and upload.

ciao
    cate
-------------- next part --------------
diff -urN apt-zip-0.15/apt-zip-inst apt-zip-0.16/apt-zip-inst
--- apt-zip-0.15/apt-zip-inst	2006-04-28 19:04:21.000000000 +0200
+++ apt-zip-0.16/apt-zip-inst	2007-06-19 17:11:53.000000000 +0200
@@ -12,15 +12,7 @@
 check_medium
 az_mount
 
-if [ -r "${MEDIUM}/${APTZIPTARFILE}" ]
-then
-    echo >&2 "Unpacking tarball..."
-    ( cd /var/cache/apt/archive ;  tar xf ${MEDIUM}/${APTZIPTARFILE} )
-    APTZIPINSFILE="${MEDIUM}/${APTZIPINSFILE}"
-else
-    APTGETCACHE="-o dir::cache::archives=${MEDIUM}"
-    APTZIPINSFILE="${MEDIUM}/${APTZIPINSFILE}"
-fi
+APTZIPINSFILE="${MEDIUM}/${APTZIPINSFILE}"
 
 if [ -r "${APTZIPINSFILE}" ] ; then
     . "${APTZIPINSFILE}"
@@ -33,6 +25,35 @@
 [ -z "$APTGETACTION" ] && APTGETACTION=${DEF_APTGETACTION}
 [ -z "$APTGETEXTRAOPTS" ] && APTGETEXTRAOPTS=${DEF_APTGETEXTRAOPTS}
 
+if [ -r "${MEDIUM}/${APTZIPTARFILE}" ]
+then
+    if [ "$APTGETACTION" = "update" ]
+    then
+        EXTRACTDIR=/var/lib/apt/lists
+        echo >&2 "Uncompressing index archives..."
+        (
+            cd $EXTRACTDIR
+            tar xvf ${MEDIUM}/${APTZIPTARFILE} |
+            while read FILE
+            do
+              [ `basename "$FILE" .bz2` != "$FILE" ] && bunzip2 -f "$FILE"
+              [ `basename "$FILE" .gz`  != "$FILE" ] && gunzip  -f "$FILE"
+            done
+            rm -f foo-stamp
+        )
+    else
+        EXTRACTDIR=/var/cache/apt/archive
+        echo >&2 "Unpacking tarball..."
+        ( cd $EXTRACTDIR ; tar xvf ${MEDIUM}/${APTZIPTARFILE} )
+    fi
+else
+    [ "$APTGETACTION" = "update" ] \
+        && echo "Error: the \`tar' option should be set when using" \
+                "\`--aptgetaction update'" \
+        && exit 1
+    APTGETCACHE="-o dir::cache::archives=${MEDIUM}"
+fi
+
 APTGETEXTRAOPTS="${APTGETEXTRAOPTS} ${APTGETCACHE}"
 
 [ -n "$PACKAGES" ] && apt-get ${APTGETEXTRAOPTS} install $PACKAGES
diff -urN apt-zip-0.15/apt-zip-list apt-zip-0.16/apt-zip-list
--- apt-zip-0.15/apt-zip-list	2006-04-28 19:04:21.000000000 +0200
+++ apt-zip-0.16/apt-zip-list	2007-06-19 17:11:53.000000000 +0200
@@ -56,6 +56,7 @@
     echo $_SZ
     }
 )
+[ "$DWLSIZE" -eq "0" ] && DWLSIZE=unknown
 export DWLSIZE
 PACKCOUNT=`cat "$TMP" | wc -l`
 export PACKCOUNT
@@ -70,10 +71,28 @@
 export SLEEPTIME
 export SLEEPCMD=`eval "$SLEEPEVALCMD"`
 export CHECK=`eval "$CHECKEVALCMD"`
+export APTGETACTION
 
 # Write the script
 SCRIPT="${MEDIUM}"/fetch-script-$METHOD-$(uname -n)
 
+if [ "$APTGETACTION" = "update" ]
+then
+    [ "$OPTION_TAR" = "0" ]                                     \
+    && echo "Error: the \`tar' option should be set when using" \
+            "\`--aptgetaction update'"                          \
+    && exit 1
+
+    # Remove .bz2 and .gz extension from the `Packages' and
+    # `Sources' index files
+    perl -pn -i.bak                        \
+        -e 's/Packages\.bz2\s/Packages /;' \
+        -e 's/Packages\.gz\s/Packages /;'  \
+        -e 's/Sources\.bz2\s/Sources /;'   \
+        -e 's/Sources\.gz\s/Sources /;'    \
+        $TEMP
+fi
+
 # --print-uris shows: URI filename size-in-bytes md5
 $FILTER < "$TEMP" >"$SCRIPT"
 if [ $? != 0 ]
diff -urN apt-zip-0.15/apt-zip.sgml apt-zip-0.16/apt-zip.sgml
--- apt-zip-0.15/apt-zip.sgml	2006-03-29 00:22:13.000000000 +0200
+++ apt-zip-0.16/apt-zip.sgml	2007-06-20 17:30:28.000000000 +0200
@@ -44,7 +44,7 @@
     <title>DESCRIPTION</title>
 
     <simpara>
-      This manpage should be up-to-date with version 0.14 of the
+      This manpage should be up-to-date with version 0.16 of the
       programs.
     </simpara>
 
diff -urN apt-zip-0.15/common.sh.in apt-zip-0.16/common.sh.in
--- apt-zip-0.15/common.sh.in	2006-06-02 00:24:22.000000000 +0200
+++ apt-zip-0.16/common.sh.in	2007-06-19 17:11:53.000000000 +0200
@@ -1,6 +1,6 @@
 # library file sourced by apt-zip-*
 
-          	   APTZIPVERSION=#will be filled at package build time
+APTZIPVERSION=#will be filled at package build time
 export APTZIPVERSION
 
 CONFFILE=/etc/apt/apt-zip.conf
@@ -8,7 +8,7 @@
 SKIPMOUNT=no
 APTGETEXTRAOPTS=""
 
-KNOWNAPTGETACTIONS=" dselect-upgrade upgrade dist-upgrade "
+KNOWNAPTGETACTIONS=" dselect-upgrade upgrade dist-upgrade update "
 KNOWNOPTIONS="TAR GNUTAR SOLARISTAR RESTART"
 
 DEFAULT_TAR=tar
@@ -46,8 +46,7 @@
  -o, --options=LIST  List of options
  -a, --aptgetaction=ACTION
              Action ACTION done by apt-get
- -p, --packages=LIST
-             List of extra packages to install
+ -p, --packages=LIST List of extra packages to install
  -A, --accept=LIST   List of accepted protocols for download (http,ftp,..)
  -R, --reject=LIST   List of rejected protocols for download (file,cdrom,..)
  -z, --zipopt-file=FILENAME
@@ -80,7 +79,7 @@
     FILTER="${SHAREDIR}/methods/$METHOD"
     if [ ! -x "$FILTER" ]
     then
-    error "No $METHOD method installed."
+        error "No $METHOD method installed."
     fi
 }
 
@@ -309,42 +308,42 @@
 {
     if [ "$SKIPMOUNT" = no ]
     then
-    # Maybe mount removable medium
-    MNTENTRY=$(mount | egrep "^[^ ]+ on $MEDIUM type ")
-    if [ "$MNTENTRY" ]
-    then
-        WAS_MOUNTED=1
-        if mount | grep "${MEDIUM}.*[(,]ro[,)]" >/dev/null
-        then
-            error "$MEDIUM is mounted READ ONLY"
-        fi
-    else
-        WAS_MOUNTED=0
-        echo "Mounting $MEDIUM"
-        local out=$(env LC_ALL=C mount $MEDIUM 2>&1)
-        if [ "$out" != "" ]
+        # Maybe mount removable medium
+        MNTENTRY=$(mount | egrep "^[^ ]+ on $MEDIUM type ")
+        if [ "$MNTENTRY" ]
         then
-        if echo $out | grep "write-protected" >/dev/null
-        then
-            error "$MEDIUM is write-protected"
+            WAS_MOUNTED=1
+            if mount | grep "${MEDIUM}.*[(,]ro[,)]" >/dev/null
+            then
+                error "$MEDIUM is mounted READ ONLY"
+            fi
         else
-            error $out
-        fi
+            WAS_MOUNTED=0
+            echo "Mounting $MEDIUM"
+            local out=$(env LC_ALL=C mount $MEDIUM 2>&1)
+            if [ "$out" != "" ]
+            then
+                if echo $out | grep "write-protected" >/dev/null
+                then
+                    error "$MEDIUM is write-protected"
+                else
+                    error $out
+                fi
+            fi
         fi
     fi
-    fi
 }
 
 az_umount()
 {
     if [ "$SKIPMOUNT" = no ]
     then
-    # Maybe umount removable medium
-    if [ "$WAS_MOUNTED" = 0 ]
-    then
-        echo "UnMounting $MEDIUM"
-        umount "$MEDIUM"
-    fi
+        # Maybe umount removable medium
+        if [ "$WAS_MOUNTED" = 0 ]
+        then
+            echo "UnMounting $MEDIUM"
+            umount "$MEDIUM"
+        fi
     fi
 }
 
diff -urN apt-zip-0.15/debian/changelog apt-zip-0.16/debian/changelog
--- apt-zip-0.15/debian/changelog	2006-06-05 21:43:46.000000000 +0200
+++ apt-zip-0.16/debian/changelog	2007-06-20 17:44:19.000000000 +0200
@@ -1,3 +1,17 @@
+apt-zip (0.16) unstable; urgency=low
+
+  [Eddy Petrișor ]
+  * more indenting improvement in common.sh.in file
+
+  [François Févotte]
+  * add possibility to run update, too, thanks to François Févotte for the
+    patch (Closes: #43622, #133117, #223372)
+
+  [Giacomo Catenazzi]
+  * correct docbook dependencies, update doc version
+
+ -- Giacomo Catenazzi <cate at debian.org>  Wed, 20 Jun 2007 17:42:19 +0200
+
 apt-zip (0.15) unstable; urgency=low
 
   [ Eddy Petrișor ]
diff -urN apt-zip-0.15/debian/control apt-zip-0.16/debian/control
--- apt-zip-0.15/debian/control	2006-06-05 20:42:20.000000000 +0200
+++ apt-zip-0.16/debian/control	2007-06-20 17:28:03.000000000 +0200
@@ -2,10 +2,10 @@
 Section: admin
 Priority: extra
 Build-Depends-Indep: docbook-utils
-Build-Depends: debhelper (>= 5)
+Build-Depends: debhelper (>= 5), docbook-to-man
 Maintainer: Giacomo Catenazzi <cate at debian.org>
-Uploaders: Eddy Petrișor <eddy.petrisor at gmail.com>
-Standards-Version: 3.7.2
+Uploaders: Eddy Petrișor <eddy.petrisor at gmail.com>, François Févotte <francois.fevotte at ensta.org>
+Standards-Version: 3.7.2.2
 
 Package: apt-zip
 Architecture: all
diff -urN apt-zip-0.15/methods/wget apt-zip-0.16/methods/wget
--- apt-zip-0.15/methods/wget	2006-04-28 19:04:21.000000000 +0200
+++ apt-zip-0.16/methods/wget	2007-06-19 17:11:53.000000000 +0200
@@ -31,6 +31,8 @@
 [ ! "${USEMD5SUMS}" = 'no' ] && cat <<-EOF
 	check(){
 	    [ ! -r "\$1" ] && return 1
+	    [ "\$2" = "0" ] && return \$3
+	    [ "\$2" = "" ] && return \$3
 	    [ "\`type md5sum\`" ] &&
 	        if [ "\`md5sum \$1 | cut -d' ' -f1\`" = \$2 ]
 	        then return 0
@@ -125,6 +127,7 @@
 	fi
 fi
 
+
 ###############
 # Stuff dependant on TAR option
 #
@@ -144,9 +147,34 @@
 	cat <<-EOF
 
 	getfile(){
-	    do_wget \$1 \$2 \$3 \$4 &&
-	    $TAR $TARADD $APTZIPTARFILE \$2 &&
-	    rm \$2
+EOF
+
+	#################
+	# Stuff dependent on the update action
+	#
+
+	if [ "$APTGETACTION" = "update" ] ; then
+	    cat <<-EOF
+	    FILE=""
+	    for EXT in ".bz2" ".gz" ""
+	    do
+	      do_wget \$1\$EXT \$2\$EXT \$3 \$4 &&
+	      FILE=\$2\$EXT &&
+	      break
+	      rm -f \$2\$EXT
+	    done
+	    [ "\$FILE" = "" ] && return 1
+EOF
+	else
+	    cat <<-EOF
+	    do_wget \$1 \$2 \$3 \$4 || return 1
+	    FILE=\$2
+EOF
+	fi
+
+	cat <<-EOF
+	    $TAR $TARADD $APTZIPTARFILE \$FILE &&
+	    rm \$FILE
 	}
 
 	touch foo-stamp && "$OPTION_TAR" cf "$APTZIPTARFILE" foo-stamp && rm foo-stamp


More information about the apt-zip-devel mailing list