diff options
author | Xavier Chantry <shiningxc@gmail.com> | 2008-08-01 08:29:46 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-08-04 20:11:18 +0200 |
commit | 9bc799ec7b1718e6d90ceedd5e08672068e26e10 (patch) | |
tree | dbaed0570f2c871f3eea0b5d7e70867afc0bd846 | |
parent | 692ea72822e6cf11930fc8f85afd23c1b65f1e8e (diff) | |
download | pacman-9bc799ec7b1718e6d90ceedd5e08672068e26e10.tar.gz pacman-9bc799ec7b1718e6d90ceedd5e08672068e26e10.tar.xz |
makepkg: fix download functions with weird urls.
This fixes FS#11076.
1) quote the url in get_downloadclient
2) only enable nullglob where it is needed
You can see in 7fc306cd41 that nullglob was only enabled for one part, and
that it already caused other problems, which were fixed in 7ff5a917fd0.
Thanks to Henning Garus for pointing out that nullglob was problematic with
urls containing expansion char like '?'.
3) change get_downloadcmd which displayed the download command line to
download_file which actually executes the download. It seems nicer that way.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | scripts/makepkg.sh.in | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 22af7fd4..3604d104 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -36,10 +36,6 @@ export TEXTDOMAINDIR='@localedir@' # file -i does not work on Mac OSX unless legacy mode is set export COMMAND_MODE='legacy' -# when fileglobbing, we want * in an empty directory to expand to the null -# string rather than itself -shopt -s nullglob - myver='@PACKAGE_VERSION@' confdir='@sysconfdir@' startdir="$PWD" @@ -256,7 +252,7 @@ in_array() { get_downloadclient() { # $1 = url with valid protocol prefix local url=$1 - local proto=$(echo $netfile | sed 's|://.*||') + local proto=$(echo "$url" | sed 's|://.*||') # loop through DOWNLOAD_AGENTS variable looking for protocol local i @@ -287,18 +283,19 @@ get_downloadclient() { echo "$agent" } -get_downloadcmd() { - local dlagent=$1 +download_file() { + local dlcmd=$1 local netfile=$2 local file=$3 - if echo "$dlagent" | grep -q "%u" ; then - local dlcmd=$(echo "$dlagent" | sed "s|%o|$file.part|" | sed "s|%u|$netfile|") + if echo "$dlcmd" | grep -q "%u" ; then + dlcmd=${dlcmd//%o/$file.part} + dlcmd=${dlcmd//%u/$netfile} else - local dlcmd="$dlagent $netfile" + dlcmd="$dlcmd $netfile" fi - echo "$dlcmd" + $dlcmd } check_deps() { @@ -443,7 +440,7 @@ download_sources() { msg2 "$(gettext "Downloading %s...")" "$file" # fix flyspray bug #3289 local ret=0 - $(get_downloadcmd "$dlclient" "$netfile" "$file") || ret=$? + download_file "$dlclient" "$netfile" "$file" || ret=$? if [ $ret -gt 0 ]; then error "$(gettext "Failure while downloading %s")" "$file" plain "$(gettext "Aborting...")" @@ -848,10 +845,15 @@ create_package() { local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" + # when fileglobbing, we want * in an empty directory to expand to + # the null string rather than itself + shopt -s nullglob + if ! bsdtar -czf "$pkg_file" $comp_files *; then error "$(gettext "Failed to create package file.")" exit 1 # TODO: error code fi + shopt -u nullglob } create_xdelta() { |