Date: Wed, 28 Nov 2012 09:52:57 +0100 From: Luca Ferrari <fluca1978@infinito.it> To: freebsd-stable@freebsd.org Subject: Re: simple patch for portsnap to use wget Message-ID: <CAKoxK%2B61KJJLKoE5namZ31G9DNUSaqm%2BtXCL=KF%2B6pnXszP0pw@mail.gmail.com> In-Reply-To: <1354040675.3923.3.camel@mjakubik.localdomain> References: <CAKoxK%2B5iy2R7=cZp38xKZpTbgFd0aZ3H28tVmPnuPR01w=pO4A@mail.gmail.com> <1354040675.3923.3.camel@mjakubik.localdomain>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
> Certainly not with a dependency on wget, which is not part of the base
> system. Use fetch instead.
>
Right, so I'm wondering why not using fetch instead of phttpget by default.
However I've rewritten everything so that now it allows for the
configuration of fetch or not. The only change is that in the case of
fetch the server name must be used with a protocol since fetch expects
a full URL and not a server name.
I vote for using fetch by default instead of phttpget.
Regards,
Luca
[-- Attachment #2 --]
36a37,42
>
> # Enable this option if you want portsnap to use fetch(1)
> # instead of the standard phttpget program to download
> # all the required files.
> FETCH_ENABLE="YES"
>
[-- Attachment #3 --]
195a196,206
> # handling fetch specific extension
> for fetchX in FETCH_ENABLE; do
> eval _=\$${fetchX}
> if [ -z "${_}" ]; then
> eval ${fetchX}=`grep "^${fetchX}=" "${CONFFILE}" |
> cut -f 2- -d '=' | tail -1 | tr '[:lower:]' '[:upper:]'`
> fi
> done
>
>
>
268c279,293
< PHTTPGET=/usr/libexec/phttpget
---
>
> # do we need the usage of fetch(1) instead of the
> # default phttpget?
> if [ "${FETCH_ENABLE}" = "YES" ]
> then
> PHTTPGET=/usr/bin/fetch
> PHTTPGET_OPTS=""
> SERVER_PROTOCOL="http://"
> else
> PHTTPGET=/usr/libexec/phttpget
> SERVER_PROTOCOL=""
> fi
>
> check_downloader
> echo "Will use [$PHTTPGET] as downloader"
687,690c712,717
< tr '|' '-' < patchlist |
< lam -s "tp/" - -s ".gz" |
< xargs ${XARGST} ${PHTTPGET} ${SERVERNAME} \
< 2>${STATSREDIR} | fetch_progress
---
>
> for current_file in `tr '|' '-' < patchlist | lam -s "tp/" - -s ".gz"`
> do
> ${PHTTPGET} ${PHTTPGET_OPTS} ${SERVER_PROTOCOL}${SERVERNAME}/${current_file} > /dev/null 2>${STATSREDIR}
> done
>
721,724c748,754
< echo ${NDEBUG} "metadata files... "
< lam -s "f/" - -s ".gz" < filelist |
< xargs ${XARGST} ${PHTTPGET} ${SERVERNAME} \
< 2>${QUIETREDIR}
---
> echo ${NDEBUG} "metadata files..."
>
> for current_file in `cat filelist`
> do
> ${PHTTPGET} ${PHTTPGET_OPTS} ${SERVER_PROTOCOL}${SERVERNAME}/f/${current_file}.gz > /dev/null 2>${STATSREDIR}
> done
>
763,765c793,797
< tr '|' '-' < patchlist | lam -s "bp/" - |
< xargs ${XARGST} ${PHTTPGET} ${SERVERNAME} \
< 2>${STATSREDIR} | fetch_progress
---
>
> for current_file in `tr '|' '-' < patchlist | lam -s "bp/" - -s ".gz"`
> do
> ${PHTTPGET} ${PHTTPGET_OPTS} ${SERVER_PROTOCOL}${SERVERNAME}/${current_file} > /dev/null 2>${STATSREDIR}
> done
794,796c826,830
< lam -s "f/" - -s ".gz" < filelist |
< xargs ${XARGST} ${PHTTPGET} ${SERVERNAME} \
< 2>${QUIETREDIR}
---
>
> for current_file in `lam -s "f/" - -s ".gz" < filelist`
> do
> ${PHTTPGET} ${PHTTPGET_OPTS} ${SERVER_PROTOCOL}${SERVERNAME}/${current_file} > /dev/null 2>${STATSREDIR}
> done
997a1032,1072
> # check that the downloader program is set into the variable PHTTPGET
> # and that is executable (in the case of fetch(1) it must be available on
> # the system.
> #
> # In the case the downloader program is not usable the program will be aborted
> # with the following exit codes:
> # 99 = PHTTPGET internal variable not set
> # 98 = program does not exist
> # 97 = program is not executable
> #
> #
> check_downloader(){
> should_exit=0
>
> if [ -z "${PHTTPGET}" ]
> then
> echo "The downloader program is not set into the PHTTPGET variable!"
> should_exit=99
> else
> if [ ! -f "${PHTTPGET}" ]
> then
> echo "The downloader program $PHTTPGET does not exists!"
> echo "See here: " `whereis "$PHTTPGET"`
> should_exit=98
> else
> if [ ! -x "${PHTTPGET}" ]
> then
> echo "The downloader program $PHTTPGET is not executable!"
> should_exit=97
> fi
> fi
> fi
>
> if [ $should_exit -gt 0 ]
> then
> echo "portsnap cannot continue, sorry"
> exit $should_exit
> fi
> }
>
>
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAKoxK%2B61KJJLKoE5namZ31G9DNUSaqm%2BtXCL=KF%2B6pnXszP0pw>
