[Apt-zip-devel] Re: apt-zip

François Févotte francois.fevotte at ensta.org
Wed Apr 11 08:45:15 UTC 2007


Hello,

thanks for having taken the time to examine my patch. Below are my
answers to your comments.

On 4/11/07, Giacomo A. Catenazzi <cate at debian.org> wrote:
> > +if [ -r "${MEDIUM}/${APTZIPTARFILE}" ]
> > +then
> > +    EXTRACTDIR=/var/cache/apt/archive
> > +    [ "$APTGETACTION" = "update" ] && EXTRACTDIR=/var/lib/apt/lists
> > +
> > +    echo >&2 "Unpacking tarball..."
> > +    ( cd $EXTRACTDIR ; tar xf ${MEDIUM}/${APTZIPTARFILE} )
>
> I don't like it ;-) To write fewer line, you complicate the scripts.
> I think that you should mode the "EXTRACTDIR=/var/lib/apt/lists"
> in after the next "if" statment, change the option of tar in
> the if statment with "xvf" ( I don't know if "xtf" works),
> and put this unpacking in a new "if action not update".

I am not sure I understand what you propose. Would you like it better this way:

+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



> > +              [ `basename $FILE .bz2` != "$FILE" ] && bunzip2 -f $FILE
> > +              [ `basename $FILE .gz`  != "$FILE" ] && gunzip -f $FILE
>
> I don't understand this.

basename removes the given suffix from the filename. If the result of
basename is different from the filename, it means that the given
suffix was present at the end of the filename.

> if $FILE ends with ".gz", the first condition is true and it will try
> to extract as bzip2 the .gz file.

No, if $FILE ends with ".gz", then basename can't remove a ".bz2"
suffix, so that `basename $FILE .bz2` is equal to $FILE.

> I think you should do:
>         [ `basename $FILE .bz2`.bz2 = "$FILE" ] && bunzip2 -f $FILE
> or probably a grep is simpler:
>         echo "$FILE" | grep -sqe '.bz2$' -  &&  bunzip2 -f "$FILE"
> BTW I will quote the "$FILE".

You're right. Maybe grep is simpler... And quoting the arguments never hurts! :)



> > +            rm -f foo-stamp
> ? who created this file?

It is the first file inserted into the archive to create it in `methods/wget':
     touch foo-stamp && "$OPTION_TAR" cf "$APTZIPTARFILE" foo-stamp &&
rm foo-stamp



> Now that etch is released, we can upload a new testing version!

That would be a good thing in my opinion.



> perl? ;-)

Didn't I tell you I like perl? ;)

> I prefer sed:
> sed -nre "s/\.(bz2|gz)$/ /pg" -

Can sed do the modifications in place (like with "perl -i" does)? Or
do we have to use yet another temporary file to put the result of sed?

> but ok if you like perl. But maybe you should add "$" at the end
> of match expression.

No, because the ".(bz2|.gz)" occurs at the end of a word, but not at
the end of a line.

Attached is a new patch taking into account your first comment on
apt-zip-inst. I also added a list of Closed bugs in the
debian/changelog file, in case you would release this version.

Please don't hesitate to ask me other modifications to the code
(although I will be away from April 13th to April 22nd, so that I
won't be able to answer you before the week after the next).

Thanks,
   François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: apt-zip_update.diff
Type: text/x-patch
Size: 6371 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/apt-zip-devel/attachments/20070411/8acde821/apt-zip_update.bin


More information about the apt-zip-devel mailing list