[pacman-dev] [PATCH] makepkg: Support for resuming source downloads

Roman Kyrylych roman.kyrylych at gmail.com
Tue Feb 12 04:35:53 EST 2008


2008/2/12, Dan McGee <dpmcgee at gmail.com>:
> > index d808270..e8ac6a1 100644
> > --- a/etc/makepkg.conf.in
> > +++ b/etc/makepkg.conf.in
> > @@ -8,11 +8,11 @@
> >  #
> >  #-- The download utilities that makepkg should use to acquire sources
> >  #  Format: 'protocol::agent'
> > -DLAGENTS=('ftp::/usr/bin/wget -c --passive-ftp -t 3 --waitretry=3'
> > -          'http::/usr/bin/wget -c -t 3 --waitretry=3'
> > -          'https::/usr/bin/wget -c -t 3 --waitretry=3 --no-check-certificate'
> > -          'rsync::/usr/bin/rsync -z'
> > -          'scp::/usr/bin/scp -C')
> > +DLAGENTS=('ftp::/usr/bin/wget -c --passive-ftp -t 3 --waitretry=3 -O %o %u'
> > +          'http::/usr/bin/wget -c -t 3 --waitretry=3 -O %o %u'
> > +          'https::/usr/bin/wget -c -t 3 --waitretry=3 --no-check-certificate -O %o %u'
> > +          'rsync::/usr/bin/rsync -z %u %o'
> > +          'scp::/usr/bin/scp -C %u %o')
> Damn, I just wish we could leave what works alone, but that is too hard. :P
>
> Is there anyway we can slightly rework the below so that if neither %o
> or %u are found in the DLAGENT, we basically do the former behavior?
> Not sure if this is completely feasible, but it would be nice to have
> the simple option still available (and especially if someone is using
> a download client that doesn't need all this complexity).
>

Yeah, I thought about that. Will try to do something in the next version.

> > diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> > index cecda1d..27bf7fa 100644
> > --- a/scripts/makepkg.sh.in
> > +++ b/scripts/makepkg.sh.in
> > @@ -299,6 +299,16 @@ get_downloadclient() {
> >         echo "$agent"
> >  }
> >
> > +get_downloadcmd() {
> > +       local dlagent=$1
> > +       local netfile=$2
> > +       local file=$3
> > +
> > +       local dlcmd=$(echo $dlagent | sed "s|%o|\"$file.part\"|" | sed
> > "s|%u|\"$netfile\"|")
> > +
> > +       echo "$dlcmd"
> > +}
> > +
> >  check_deps() {
> >         [ $# -gt 0 ] || return
> >
> > @@ -476,12 +486,13 @@ download_sources() {
> >                 msg2 "$(gettext "Downloading %s...")" "$file"
> >                 # fix flyspray bug #3289
> >                 local ret=0
> > -               $dlclient "$netfile" || ret=$?
> > +               $(get_downloadcmd "$dlclient" "$netfile" "$file") || ret=$?
> >                 if [ $ret -gt 0 ]; then
> >                         error "$(gettext "Failure while downloading %s")" "$file"
> >                         plain "$(gettext "Aborting...")"
> >                         exit 1
> >                 fi
> > +               mv -f "$SRCDEST/$file.part" "$SRCDEST/$file"
> >                 cp -s --remove-destination "$SRCDEST/$file" "$srcdir/"
> >         done
> >
> > --
> > 1.5.3.7
>
> Someone doesn't run testing!

I did test the first version (without \" added to dlcmd= and it worked
flawlessly.
The addition of \" in the second patch broke it :-)
So please use the version attached in my first message to test that it
works. ;-)

-- 
Roman Kyrylych (Роман Кирилич)


More information about the pacman-dev mailing list