aboutsummaryrefslogtreecommitdiff
path: root/kiss
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-16 21:45:12 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-16 21:45:12 +0000
commit84df2dc3bbc213fb2fffe94c9e5c025d54106a15 (patch)
treed25163767786c39c1634bc37563ec818e411f678 /kiss
parent722009bd11acc6e68bd711719777ec08cdaa5cdd (diff)
downloadcpt-84df2dc3bbc213fb2fffe94c9e5c025d54106a15.tar.gz
kiss: Git support
FossilOrigin-Name: 6b696291374b7edcdc31dd874daab6174ab68106163a66f5fe8aab744944eaf3
Diffstat (limited to 'kiss')
-rwxr-xr-xkiss31
1 files 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"