forked from kiss-community/kiss
kiss: Git support
This commit is contained in:
parent
86f0a723b1
commit
66e981f81a
31
kiss
31
kiss
@ -140,11 +140,23 @@ pkg_sources() {
|
|||||||
|
|
||||||
repo_dir=$(pkg_find "$1")
|
repo_dir=$(pkg_find "$1")
|
||||||
|
|
||||||
while read -r src _ || [ "$src" ]; do
|
while read -r src dest || [ "$src" ]; do
|
||||||
# Remote source (cached).
|
# Remote source (cached).
|
||||||
if [ -f "${src##*/}" ]; then
|
if [ -f "${src##*/}" ]; then
|
||||||
log "$1" "Found cached source '${src##*/}'"
|
log "$1" "Found cached source '${src##*/}'"
|
||||||
|
|
||||||
|
# Remote git repository.
|
||||||
|
elif [ -z "${src##git+*}" ]; then
|
||||||
|
# This is a checksums check, skip it.
|
||||||
|
[ "$2" ] && continue
|
||||||
|
|
||||||
|
repo_src=${src##git+}
|
||||||
|
|
||||||
|
mkdir -p "$mak_dir/$1/$dest"
|
||||||
|
|
||||||
|
(cd "$mak_dir/$1/$dest" && git clone "${repo_src%#*}" .) ||
|
||||||
|
die "$1" "Failed to clone $src"
|
||||||
|
|
||||||
# Remote source.
|
# Remote source.
|
||||||
elif [ -z "${src##*://*}" ]; then
|
elif [ -z "${src##*://*}" ]; then
|
||||||
curl "$src" -fLo "${src##*/}" || {
|
curl "$src" -fLo "${src##*/}" || {
|
||||||
@ -173,6 +185,17 @@ pkg_extract() {
|
|||||||
mkdir -p "$mak_dir/$1/$dest" && cd "$mak_dir/$1/$dest"
|
mkdir -p "$mak_dir/$1/$dest" && cd "$mak_dir/$1/$dest"
|
||||||
|
|
||||||
case $src in
|
case $src in
|
||||||
|
# Git repository with supplied commit hash.
|
||||||
|
git+*\#*)
|
||||||
|
git reset --hard "${src##*#}" ||
|
||||||
|
die "Commit hash ${src##*#} doesn't exist"
|
||||||
|
;;
|
||||||
|
|
||||||
|
# Git repository.
|
||||||
|
git+*)
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
|
||||||
# Only 'tar' archives are currently supported for extraction.
|
# Only 'tar' archives are currently supported for extraction.
|
||||||
# Any other file-types are simply copied to '$mak_dir' which
|
# Any other file-types are simply copied to '$mak_dir' which
|
||||||
# allows for manual extraction.
|
# allows for manual extraction.
|
||||||
@ -566,6 +589,10 @@ pkg_checksums() {
|
|||||||
elif [ -f "$src_dir/$1/${src##*/}" ]; then
|
elif [ -f "$src_dir/$1/${src##*/}" ]; then
|
||||||
src_path=$src_dir/$1
|
src_path=$src_dir/$1
|
||||||
|
|
||||||
|
# File is a git repository, skip checksums.
|
||||||
|
elif [ -z "${src##git+*}" ]; then
|
||||||
|
continue
|
||||||
|
|
||||||
# Die here if source for some reason, doesn't exist.
|
# Die here if source for some reason, doesn't exist.
|
||||||
else
|
else
|
||||||
die "$1" "Couldn't find source '$src'"
|
die "$1" "Couldn't find source '$src'"
|
||||||
@ -997,7 +1024,7 @@ args() {
|
|||||||
|
|
||||||
c|checksum)
|
c|checksum)
|
||||||
for pkg; do pkg_lint "$pkg"; done
|
for pkg; do pkg_lint "$pkg"; done
|
||||||
for pkg; do pkg_sources "$pkg"; done
|
for pkg; do pkg_sources "$pkg" c; done
|
||||||
for pkg; do
|
for pkg; do
|
||||||
pkg_checksums "$pkg" > "$(pkg_find "$pkg")/checksums"
|
pkg_checksums "$pkg" > "$(pkg_find "$pkg")/checksums"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user