Support more quicklisp upstream source types
This commit is contained in:
parent
ce8f37430f
commit
084426a8ed
@ -2,10 +2,12 @@
|
||||
|
||||
name="$1"
|
||||
|
||||
nix-instantiate "$(dirname "$0")"/../../../../ -A "lispPackages.$name" > /dev/null && exit
|
||||
[ "$NIX_LISP_PACKAGES_DEFINED" != "${NIX_LISP_PACKAGES_DEFINED/$name/@@}" ] && exit
|
||||
[ -z "$NIX_LISP_PACKAGES_DEFINED_LIST" ] && export NIX_LISP_PACKAGES_DEFINED_LIST="$(mktemp)"
|
||||
|
||||
NIX_LISP_PACKAGES_DEFINED="$NIX_LISP_PACKAGES_DEFINED $1 "
|
||||
nix-instantiate "$(dirname "$0")"/../../../../ -A "lispPackages.$name" > /dev/null && exit
|
||||
grep "^$name\$" "$NIX_LISP_PACKAGES_DEFINED_LIST" > /dev/null && exit
|
||||
|
||||
echo "$name" >> "$NIX_LISP_PACKAGES_DEFINED_LIST"
|
||||
|
||||
[ -z "$NIX_QUICKLISP_DIR" ] && {
|
||||
export NIX_QUICKLISP_DIR="$(mktemp -d --tmpdir nix-quicklisp.XXXXXX)"
|
||||
@ -26,14 +28,39 @@ ql_src="$(curl -L https://github.com/quicklisp/quicklisp-projects/raw/master/"$n
|
||||
ql_src_type="${ql_src%% *}"
|
||||
url="${ql_src##* }"
|
||||
|
||||
[ "$ql_src_type" = "kmr-git" ] && {
|
||||
ql_src_type=git
|
||||
url="http://git.b9.com/$url.git"
|
||||
export NIX_PREFETCH_GIT_DEEP_CLONE=1
|
||||
}
|
||||
|
||||
[ "$ql_src_type" = ediware-http ] && {
|
||||
ql_src_type=github
|
||||
url="edicl/$url";
|
||||
}
|
||||
|
||||
[ "$ql_src_type" = xach-http ] && {
|
||||
ql_src_type=github
|
||||
url="xach/$url";
|
||||
}
|
||||
|
||||
[ "$ql_src_type" = github ] && {
|
||||
ql_src_type=git
|
||||
url="https://github.com/$url";
|
||||
version="$("$(dirname "$0")/../../../build-support/upstream-updater/urls-from-page.sh" "$url/releases/" | grep /tag/ | head -n 1 | xargs -l1 basename)"
|
||||
rev="refs/tags/$version";
|
||||
}
|
||||
|
||||
[ "$ql_src_type" = git ] && {
|
||||
fetcher="pkgs.fetchgit"
|
||||
[ "${url#git://github.com/}" != "$url" ] && {
|
||||
( [ "${url#git://github.com/}" != "$url" ] ||
|
||||
[ "${url#https://github.com/}" != "$url" ]
|
||||
) && {
|
||||
url="${url/git:/https:}"
|
||||
url="${url%.git}"
|
||||
rev=$("$(dirname "$0")/../../../build-support/upstream-updater/urls-from-page.sh" "$url/commits" | grep /commit/ | head -n 1 | xargs basename)
|
||||
hash=$("$(dirname "$0")/../../../build-support/fetchgit/nix-prefetch-git" "$url" "$rev")
|
||||
version="git-$(date +%Y%m%d)";
|
||||
[ -z "$rev" ] && rev=$("$(dirname "$0")/../../../build-support/upstream-updater/urls-from-page.sh" "$url/commits" | grep /commit/ | head -n 1 | xargs basename)
|
||||
hash=$("$(dirname "$0")/../../../build-support/fetchgit/nix-prefetch-git" "$url" "$rev" | grep . | tail -n 1)
|
||||
[ -z "$version" ] && version="git-$(date +%Y%m%d)";
|
||||
}
|
||||
[ "${url#git://common-lisp.net/}" != "$url" ] && {
|
||||
http_repo_url="$url"
|
||||
@ -41,8 +68,17 @@ url="${ql_src##* }"
|
||||
http_repo_url="${http_repo_url/\/projects\// /r/projects/}"
|
||||
http_repo_head="$http_repo_url/refs/heads/master"
|
||||
echo "$http_repo_head" >&2
|
||||
rev=$(curl -L "$http_repo_head");
|
||||
[ -z "$rev" ] && rev=$(curl -L "$http_repo_head");
|
||||
hash=$("$(dirname "$0")/../../../build-support/fetchgit/nix-prefetch-git" "$url" "$rev")
|
||||
[ -z "$version" ] && version="git-$(date +%Y%m%d)";
|
||||
}
|
||||
[ "${url#http://git.b9.com/}" != "$url" ] && {
|
||||
http_repo_url="$url"
|
||||
http_repo_url="${http_repo_url/git:/http:}"
|
||||
http_repo_head="$http_repo_url/refs/heads/master"
|
||||
echo "$http_repo_head" >&2
|
||||
rev=$(curl -L "$http_repo_head");
|
||||
hash=$("$(dirname "$0")/../../../build-support/fetchgit/nix-prefetch-git" "$url" "$rev" | tail -n 1)
|
||||
version="git-$(date +%Y%m%d)";
|
||||
}
|
||||
}
|
||||
@ -57,13 +93,35 @@ url="${ql_src##* }"
|
||||
unset url
|
||||
}
|
||||
|
||||
cat << EOF
|
||||
[ "$ql_src_type" = froydware-http ] && {
|
||||
dirurl = "http://method-combination.net/lisp/files/";
|
||||
url="$("$(dirname "$0")/../../../build-support/upstream-updater/urls-from-page.sh" "$dirurl" | grep "/$url_" | tail -n 1)"
|
||||
ql_src_type=http
|
||||
}
|
||||
|
||||
[ "$ql_src_type" = http ] && {
|
||||
fetcher="pkgs.fetchurl";
|
||||
version="$(echo "$url" | sed -re 's@.*-([0-9.]+)[-._].*@\1@')"
|
||||
hash="$(nix-prefetch-url "$url" | grep . | tail -n 1)"
|
||||
}
|
||||
|
||||
[ "$ql_src_type" = https ] && {
|
||||
fetcher="pkgs.fetchurl";
|
||||
version="$(echo "$url" | sed -re 's@.*-([0-9.]+)[-._].*@\1@')"
|
||||
hash="$(nix-prefetch-url "$url" | grep . | tail -n 1)"
|
||||
}
|
||||
|
||||
if [ "$ql_src" = '{"error":"Not Found"}' ]; then
|
||||
echo "# $name: not found"
|
||||
else
|
||||
cat << EOF | grep -Ev '^[ ]+$'
|
||||
|
||||
$name = buildLispPackage rec {
|
||||
baseName = "$name";
|
||||
version = "${version:-\${Set me //}";
|
||||
description = "$description";
|
||||
deps = [$dependencies];
|
||||
# Source type: $ql_src_type
|
||||
src = ${fetcher:-pkgs.fetchurl} {
|
||||
${url:+url = ''$url'';}
|
||||
sha256 = "${hash:-0000000000000000000000000000000000000000000000000000000000000000}";
|
||||
@ -74,5 +132,6 @@ cat << EOF
|
||||
};
|
||||
};
|
||||
EOF
|
||||
fi
|
||||
|
||||
for i in $dependencies; do "$0" "$i"; done
|
||||
|
Loading…
Reference in New Issue
Block a user