Commit b6878e36 authored by Vitaly Lipatov's avatar Vitaly Lipatov

rpmgs: add support for url with mask

parent 6a2a176c
...@@ -126,7 +126,7 @@ download_to() ...@@ -126,7 +126,7 @@ download_to()
return $RET return $RET
fi fi
local DF="$(basename "$URL")" local DF="$(basename "$URL")"
download_url "$URL" && repack_tarball "$DF" "$TARGET" download_url "$URL" && DF="$DOWNLOADEDNAME" && repack_tarball "$DF" "$TARGET"
local RET=$? local RET=$?
# TODO: repack need remove origin # TODO: repack need remove origin
#rm -fv "$DF" #rm -fv "$DF"
...@@ -908,7 +908,8 @@ fi ...@@ -908,7 +908,8 @@ fi
echog "Try to load ${GETSOURCEURL} for $spec" echog "Try to load ${GETSOURCEURL} for $spec"
download_to "$GETSOURCEURL" "$FTB" || fatal "Can't download $GETSOURCEURL" download_to "$GETSOURCEURL" "$FTB" || fatal "Can't download $GETSOURCEURL"
will_commit || continue will_commit || continue
CURRENTURL="${GETSOURCEURL}" # hack: override url from download_to
CURRENTURL="${DOWNLOADEDURL}"
if is_gear ; then if is_gear ; then
commit_tarball "$FTB" || fatal commit_tarball "$FTB" || fatal
source_postupdate_hook source_postupdate_hook
......
...@@ -11,9 +11,19 @@ which GET &>/dev/null && GET=GET || GET=false ...@@ -11,9 +11,19 @@ which GET &>/dev/null && GET=GET || GET=false
which rsync &>/dev/null && RSYNC=rsync || GET=false which rsync &>/dev/null && RSYNC=rsync || GET=false
# will DOWNLOADEDNAME with real name
download_url() download_url()
{ {
local NAME="$(basename "$1")" local URL="$1"
# if has_space
if [ "${URL/ //}" != "$URL" ] ; then
URL="$($EPMCMD tool eget --list --latest $URL)"
[ -n "$URL" ] || fatal "Can't find $1 tarball."
fi
local NAME="$(basename "$URL")"
# TODO # TODO
# do not download if already exists... # do not download if already exists...
#[ -r "$NAME" ] && { echo "skipping $1, already exists..."; return; } #[ -r "$NAME" ] && { echo "skipping $1, already exists..."; return; }
...@@ -21,7 +31,7 @@ download_url() ...@@ -21,7 +31,7 @@ download_url()
# NOTE: disable cert checking # NOTE: disable cert checking
# use wget with try=1 and timeout = 30 sec # use wget with try=1 and timeout = 30 sec
docmd epm tool eget -O "$NAME" "$1" && test -r "$NAME" && return docmd $EPMCMD tool eget -O "$NAME" "$URL" && test -r "$NAME" && DOWNLOADEDNAME="$NAME" && DOWNLOADEDURL="$URL" && return
rm -f "$NAME" rm -f "$NAME"
return 1 return 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment