mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
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 in7fc306cd41
that nullglob was only enabled for one part, and that it already caused other problems, which were fixed in7ff5a917fd
. 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>
This commit is contained in:
parent
692ea72822
commit
9bc799ec7b
@ -36,10 +36,6 @@ export TEXTDOMAINDIR='@localedir@'
|
|||||||
# file -i does not work on Mac OSX unless legacy mode is set
|
# file -i does not work on Mac OSX unless legacy mode is set
|
||||||
export COMMAND_MODE='legacy'
|
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@'
|
myver='@PACKAGE_VERSION@'
|
||||||
confdir='@sysconfdir@'
|
confdir='@sysconfdir@'
|
||||||
startdir="$PWD"
|
startdir="$PWD"
|
||||||
@ -256,7 +252,7 @@ in_array() {
|
|||||||
get_downloadclient() {
|
get_downloadclient() {
|
||||||
# $1 = url with valid protocol prefix
|
# $1 = url with valid protocol prefix
|
||||||
local url=$1
|
local url=$1
|
||||||
local proto=$(echo $netfile | sed 's|://.*||')
|
local proto=$(echo "$url" | sed 's|://.*||')
|
||||||
|
|
||||||
# loop through DOWNLOAD_AGENTS variable looking for protocol
|
# loop through DOWNLOAD_AGENTS variable looking for protocol
|
||||||
local i
|
local i
|
||||||
@ -287,18 +283,19 @@ get_downloadclient() {
|
|||||||
echo "$agent"
|
echo "$agent"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_downloadcmd() {
|
download_file() {
|
||||||
local dlagent=$1
|
local dlcmd=$1
|
||||||
local netfile=$2
|
local netfile=$2
|
||||||
local file=$3
|
local file=$3
|
||||||
|
|
||||||
if echo "$dlagent" | grep -q "%u" ; then
|
if echo "$dlcmd" | grep -q "%u" ; then
|
||||||
local dlcmd=$(echo "$dlagent" | sed "s|%o|$file.part|" | sed "s|%u|$netfile|")
|
dlcmd=${dlcmd//%o/$file.part}
|
||||||
|
dlcmd=${dlcmd//%u/$netfile}
|
||||||
else
|
else
|
||||||
local dlcmd="$dlagent $netfile"
|
dlcmd="$dlcmd $netfile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$dlcmd"
|
$dlcmd
|
||||||
}
|
}
|
||||||
|
|
||||||
check_deps() {
|
check_deps() {
|
||||||
@ -443,7 +440,7 @@ download_sources() {
|
|||||||
msg2 "$(gettext "Downloading %s...")" "$file"
|
msg2 "$(gettext "Downloading %s...")" "$file"
|
||||||
# fix flyspray bug #3289
|
# fix flyspray bug #3289
|
||||||
local ret=0
|
local ret=0
|
||||||
$(get_downloadcmd "$dlclient" "$netfile" "$file") || ret=$?
|
download_file "$dlclient" "$netfile" "$file" || ret=$?
|
||||||
if [ $ret -gt 0 ]; then
|
if [ $ret -gt 0 ]; then
|
||||||
error "$(gettext "Failure while downloading %s")" "$file"
|
error "$(gettext "Failure while downloading %s")" "$file"
|
||||||
plain "$(gettext "Aborting...")"
|
plain "$(gettext "Aborting...")"
|
||||||
@ -848,10 +845,15 @@ create_package() {
|
|||||||
|
|
||||||
local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
|
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
|
if ! bsdtar -czf "$pkg_file" $comp_files *; then
|
||||||
error "$(gettext "Failed to create package file.")"
|
error "$(gettext "Failed to create package file.")"
|
||||||
exit 1 # TODO: error code
|
exit 1 # TODO: error code
|
||||||
fi
|
fi
|
||||||
|
shopt -u nullglob
|
||||||
}
|
}
|
||||||
|
|
||||||
create_xdelta() {
|
create_xdelta() {
|
||||||
|
Loading…
Reference in New Issue
Block a user