From 84df2dc3bbc213fb2fffe94c9e5c025d54106a15 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Thu, 16 Jan 2020 21:45:12 +0000 Subject: kiss: Git support FossilOrigin-Name: 6b696291374b7edcdc31dd874daab6174ab68106163a66f5fe8aab744944eaf3 --- kiss | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/kiss b/kiss index 287c48e..012603a 100755 --- a/kiss +++ b/kiss @@ -140,11 +140,23 @@ pkg_sources() { repo_dir=$(pkg_find "$1") - while read -r src _ || [ "$src" ]; do + while read -r src dest || [ "$src" ]; do # Remote source (cached). if [ -f "${src##*/}" ]; then 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. elif [ -z "${src##*://*}" ]; then curl "$src" -fLo "${src##*/}" || { @@ -173,6 +185,17 @@ pkg_extract() { mkdir -p "$mak_dir/$1/$dest" && cd "$mak_dir/$1/$dest" 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. # Any other file-types are simply copied to '$mak_dir' which # allows for manual extraction. @@ -566,6 +589,10 @@ pkg_checksums() { elif [ -f "$src_dir/$1/${src##*/}" ]; then 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. else die "$1" "Couldn't find source '$src'" @@ -997,7 +1024,7 @@ args() { c|checksum) 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 pkg_checksums "$pkg" > "$(pkg_find "$pkg")/checksums" -- cgit v1.2.3 From 9286dbd50a2f2645b8c71cb47534ff82c312266f Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Thu, 16 Jan 2020 21:48:19 +0000 Subject: kiss: Add message on checkout FossilOrigin-Name: f7a89f016ce0d158e576c183c45b8eb82123feed3b91fc854b5eba97c7842885 --- kiss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kiss b/kiss index 012603a..47c676f 100755 --- a/kiss +++ b/kiss @@ -187,6 +187,8 @@ pkg_extract() { case $src in # Git repository with supplied commit hash. git+*\#*) + log "Checking out ${src##*#}" + git reset --hard "${src##*#}" || die "Commit hash ${src##*#} doesn't exist" ;; -- cgit v1.2.3 From 754c7b767a3438612570e531c7605ede08e6d358 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Thu, 16 Jan 2020 23:00:25 +0000 Subject: kiss: Do a shallow clone unless checking out a hash FossilOrigin-Name: 31e5c01f0428e3e56d461c81760928ffc5c0f9694cf1ec500901e76f35c42709 --- kiss | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/kiss b/kiss index 47c676f..aa7cfb8 100755 --- a/kiss +++ b/kiss @@ -150,12 +150,18 @@ pkg_sources() { # 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" + # Run in a subshell to keep variables local. + ( + repo_src=${src##git+} + + [ "${src##*#*}" ] && shallow=--depth=1 + + cd "$mak_dir/$1/$dest" && + git clone "${shallow:---}" "${repo_src%#*}" . + + ) || die "$1" "Failed to clone $src" # Remote source. elif [ -z "${src##*://*}" ]; then -- cgit v1.2.3 From c998fbfe12996006528c5c7102cdaf413161b5b9 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Sat, 18 Jan 2020 08:59:39 +0000 Subject: kiss: Fix checksums issues FossilOrigin-Name: d718e9e8ee1ac66943396a37429a0a5155770465c086535c44946d40dd0b0a74 --- kiss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kiss b/kiss index aa7cfb8..956293a 100755 --- a/kiss +++ b/kiss @@ -597,8 +597,9 @@ pkg_checksums() { elif [ -f "$src_dir/$1/${src##*/}" ]; then src_path=$src_dir/$1 - # File is a git repository, skip checksums. + # File is a git repository. elif [ -z "${src##git+*}" ]; then + printf '%-64s %s\n' git "${src##*/}" continue # Die here if source for some reason, doesn't exist. -- cgit v1.2.3