kiss: unify pkg_source_

This commit is contained in:
Dylan Araps 2021-08-25 19:02:25 +03:00
parent 47a4b2b769
commit 29c57a0115
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C

17
kiss
View File

@ -358,7 +358,7 @@ pkg_source_resolve() {
# Git repository. # Git repository.
if null "${2##git+*}"; then if null "${2##git+*}"; then
_res=$2 _res=$2
_des=$src_dir/$1/${3:+"$3/"}${2##*/} _des=$src_dir/$1/${3:+"$3/"}${2##*/}/
_des=${_des%[@#]*} _des=${_des%[@#]*}
# Remote source (cached). # Remote source (cached).
@ -414,16 +414,9 @@ pkg_source() {
# '$2' is set when this function is called from 'kiss c' and it is used # '$2' is set when this function is called from 'kiss c' and it is used
# here to skip calling the Git code. # here to skip calling the Git code.
case $2$_res in case $2$_res in "$2url+"*|git+*)
"$2url+"*) mkcd "${_des%/*}"
mkcd "${_des%/*}" "pkg_source_${_res%%+*}" "$_des" "${_res##"${_res%%+*}+"}"
pkg_source_get "$_des" "${_res##url+}"
;;
git+*)
mkcd "$_des"
pkg_source_git "${_res##git+}"
;;
esac esac
# arg1: post-source # arg1: post-source
@ -434,7 +427,7 @@ pkg_source() {
done < "$repo_dir/sources" done < "$repo_dir/sources"
} }
pkg_source_get() { pkg_source_url() {
log "$repo_name" "Downloading $2" log "$repo_name" "Downloading $2"
# Set the arguments based on found download utility. # Set the arguments based on found download utility.