diff options
author | Michael Raskin <7c6f434c@mail.ru> | 2014-11-12 16:57:48 +0300 |
---|---|---|
committer | Michael Raskin <7c6f434c@mail.ru> | 2014-11-12 16:58:22 +0300 |
commit | 084426a8eded77127134b1cc359a89f9bfd69e4c (patch) | |
tree | 01b9566fe45a0725d2e28b8b3e2543d05a475491 /pkgs/development/lisp-modules/from-quicklisp | |
parent | ce8f37430f2ccb3687a97eb9718c5bf971207467 (diff) | |
download | nixlib-084426a8eded77127134b1cc359a89f9bfd69e4c.tar nixlib-084426a8eded77127134b1cc359a89f9bfd69e4c.tar.gz nixlib-084426a8eded77127134b1cc359a89f9bfd69e4c.tar.bz2 nixlib-084426a8eded77127134b1cc359a89f9bfd69e4c.tar.lz nixlib-084426a8eded77127134b1cc359a89f9bfd69e4c.tar.xz nixlib-084426a8eded77127134b1cc359a89f9bfd69e4c.tar.zst nixlib-084426a8eded77127134b1cc359a89f9bfd69e4c.zip |
Support more quicklisp upstream source types
Diffstat (limited to 'pkgs/development/lisp-modules/from-quicklisp')
-rwxr-xr-x | pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh | 75 |
1 files changed, 67 insertions, 8 deletions
diff --git a/pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh b/pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh index 61c00eb92ae8..a9e443b66354 100755 --- a/pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh +++ b/pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh @@ -2,10 +2,12 @@ name="$1" +[ -z "$NIX_LISP_PACKAGES_DEFINED_LIST" ] && export NIX_LISP_PACKAGES_DEFINED_LIST="$(mktemp)" + nix-instantiate "$(dirname "$0")"/../../../../ -A "lispPackages.$name" > /dev/null && exit -[ "$NIX_LISP_PACKAGES_DEFINED" != "${NIX_LISP_PACKAGES_DEFINED/$name/@@}" ] && exit +grep "^$name\$" "$NIX_LISP_PACKAGES_DEFINED_LIST" > /dev/null && exit -NIX_LISP_PACKAGES_DEFINED="$NIX_LISP_PACKAGES_DEFINED $1 " +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 |