forked from kiss-community/kiss
commit
88b5989da4
37
kiss
37
kiss
@ -358,6 +358,8 @@ 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=${_des%[@#]*}/
|
||||||
|
|
||||||
# Remote source (cached).
|
# Remote source (cached).
|
||||||
elif [ -f "$src_dir/$1/${3:+"$3/"}${2##*/}" ]; then
|
elif [ -f "$src_dir/$1/${3:+"$3/"}${2##*/}" ]; then
|
||||||
@ -410,12 +412,11 @@ pkg_source() {
|
|||||||
# arg4: resolved source
|
# arg4: resolved source
|
||||||
run_hook pre-source "$1" "$src" "$_fnr"
|
run_hook pre-source "$1" "$src" "$_fnr"
|
||||||
|
|
||||||
case $_res in url+*)
|
# '$2' is set when this function is called from 'kiss c' and it is used
|
||||||
# Create directory structure in source cache. This prevents cache
|
# here to skip calling the Git code.
|
||||||
# conflicts between identical sources with differing dests.
|
case $2$_res in "$2url+"*|git+*)
|
||||||
mkcd "${_des%/*}"
|
mkcd "${_des%/*}"
|
||||||
|
"pkg_source_${_res%%+*}" "$_des" "${_res##"${_res%%+*}+"}"
|
||||||
pkg_source_get "$_des" "${_res##url+}"
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# arg1: post-source
|
# arg1: post-source
|
||||||
@ -426,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.
|
||||||
@ -443,19 +444,21 @@ pkg_source_get() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pkg_source_git() {
|
pkg_source_git() {
|
||||||
# This magic will shallow clone branches, commits or the
|
com=${2##*[@#]}
|
||||||
# regular repository. It correctly handles cases where a
|
com=${com#${2%[#@]*}}
|
||||||
# shallow clone is not possible.
|
|
||||||
log "$repo_name" "Cloning $1"
|
|
||||||
|
|
||||||
# Split the source into URL + OBJECT (branch or commit).
|
log "$repo_name" "Checking out ${com:-FETCH_HEAD}"
|
||||||
url=$1
|
|
||||||
com=${url##*[@#]}
|
|
||||||
com=${com#${url%[#@]*}}
|
|
||||||
|
|
||||||
git init
|
[ -d .git ] || git init
|
||||||
git remote add origin "${url%[#@]*}"
|
|
||||||
|
git remote set-url origin "${2%[#@]*}" 2>/dev/null ||
|
||||||
|
git remote add origin "${2%[#@]*}"
|
||||||
|
|
||||||
|
# Only fetch latest changes if not <url>[#]<sha|tag>.
|
||||||
|
case $2 in *"#$com") ;; *)
|
||||||
git fetch -t --filter=tree:0 origin "$com" || git fetch -t
|
git fetch -t --filter=tree:0 origin "$com" || git fetch -t
|
||||||
|
esac
|
||||||
|
|
||||||
git -c advice.detachedHead=0 checkout "${com:-FETCH_HEAD}"
|
git -c advice.detachedHead=0 checkout "${com:-FETCH_HEAD}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,7 +530,7 @@ pkg_extract() {
|
|||||||
|
|
||||||
case $_res in
|
case $_res in
|
||||||
git+*)
|
git+*)
|
||||||
pkg_source_git "${_res##git+}"
|
cp -LRf "$_des/." .
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*.tar|*.tar.??|*.tar.???|*.tar.????|*.t?z)
|
*.tar|*.tar.??|*.tar.???|*.tar.????|*.t?z)
|
||||||
|
Loading…
Reference in New Issue
Block a user