aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoreply@github.com <noreply@github.com>2020-01-18 09:04:34 +0000
committernoreply@github.com <noreply@github.com>2020-01-18 09:04:34 +0000
commita48ee3c309f33c351747d57f8cb36196fdbde4aa (patch)
tree4f7434cdfde2780ded87fd037b43d4c2629b66b4
parent722009bd11acc6e68bd711719777ec08cdaa5cdd (diff)
parentc998fbfe12996006528c5c7102cdaf413161b5b9 (diff)
downloadcpt-a48ee3c309f33c351747d57f8cb36196fdbde4aa.tar.gz
Merge pull request #85 from kisslinux/git
Git support FossilOrigin-Name: 173359221af067083d54cf05d3baebf8a013d89180495d2aadb8a73e408ca4dc
-rwxr-xr-xkiss40
1 files changed, 38 insertions, 2 deletions
diff --git a/kiss b/kiss
index 287c48e..956293a 100755
--- a/kiss
+++ b/kiss
@@ -140,11 +140,29 @@ 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
+
+ mkdir -p "$mak_dir/$1/$dest"
+
+ # 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
curl "$src" -fLo "${src##*/}" || {
@@ -173,6 +191,19 @@ pkg_extract() {
mkdir -p "$mak_dir/$1/$dest" && cd "$mak_dir/$1/$dest"
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"
+ ;;
+
+ # 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 +597,11 @@ pkg_checksums() {
elif [ -f "$src_dir/$1/${src##*/}" ]; then
src_path=$src_dir/$1
+ # 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.
else
die "$1" "Couldn't find source '$src'"
@@ -997,7 +1033,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"