2013-10-29 07:56:33 +01:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
name="$1"
|
|
|
|
|
2014-11-12 14:57:48 +01:00
|
|
|
[ -z "$NIX_LISP_PACKAGES_DEFINED_LIST" ] && export NIX_LISP_PACKAGES_DEFINED_LIST="$(mktemp)"
|
|
|
|
|
2014-11-13 07:08:53 +01:00
|
|
|
if [ -n "$NIX_LISP_UPDATE_PACKAGE" ] || [ -n "$NIX_LISP_UPDATE_PACKAGES" ]; then
|
|
|
|
export NIX_LISP_UPDATE_PACKAGE=
|
|
|
|
else
|
|
|
|
nix-instantiate "$(dirname "$0")"/../../../../ -A "lispPackages.$name" > /dev/null && exit
|
|
|
|
fi
|
2014-11-12 14:57:48 +01:00
|
|
|
grep "^$name\$" "$NIX_LISP_PACKAGES_DEFINED_LIST" > /dev/null && exit
|
2013-10-29 07:56:33 +01:00
|
|
|
|
2014-11-12 14:57:48 +01:00
|
|
|
echo "$name" >> "$NIX_LISP_PACKAGES_DEFINED_LIST"
|
2013-10-29 07:56:33 +01:00
|
|
|
|
|
|
|
[ -z "$NIX_QUICKLISP_DIR" ] && {
|
|
|
|
export NIX_QUICKLISP_DIR="$(mktemp -d --tmpdir nix-quicklisp.XXXXXX)"
|
|
|
|
}
|
|
|
|
|
|
|
|
[ -f "$NIX_QUICKLISP_DIR/setup.lisp" ] || {
|
|
|
|
"$(dirname "$0")/quicklisp-beta-env.sh" "$NIX_QUICKLISP_DIR" &> /dev/null < /dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
description="$("$(dirname "$0")/asdf-description.sh" "$name")"
|
|
|
|
[ -z "$description" ] && {
|
|
|
|
description="$(curl -L https://github.com/quicklisp/quicklisp-projects/raw/master/"$name"/description.txt)"
|
|
|
|
[ "$(echo "$description" | wc -l)" -gt 10 ] && description=""
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies="$("$(dirname "$0")/quicklisp-dependencies.sh" "$name" | xargs)"
|
|
|
|
ql_src="$(curl -L https://github.com/quicklisp/quicklisp-projects/raw/master/"$name"/source.txt)"
|
|
|
|
ql_src_type="${ql_src%% *}"
|
|
|
|
url="${ql_src##* }"
|
|
|
|
|
2014-11-12 14:57:48 +01:00
|
|
|
[ "$ql_src_type" = "kmr-git" ] && {
|
|
|
|
ql_src_type=git
|
2014-11-13 07:08:53 +01:00
|
|
|
url="http://git.b9.com/$url.git"
|
2014-11-12 14:57:48 +01:00
|
|
|
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";
|
|
|
|
}
|
|
|
|
|
2013-10-29 07:56:33 +01:00
|
|
|
[ "$ql_src_type" = git ] && {
|
|
|
|
fetcher="pkgs.fetchgit"
|
2014-11-12 14:57:48 +01:00
|
|
|
( [ "${url#git://github.com/}" != "$url" ] ||
|
|
|
|
[ "${url#https://github.com/}" != "$url" ]
|
|
|
|
) && {
|
2013-10-29 07:56:33 +01:00
|
|
|
url="${url/git:/https:}"
|
|
|
|
url="${url%.git}"
|
2014-11-12 14:57:48 +01:00
|
|
|
[ -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)";
|
2013-10-29 07:56:33 +01:00
|
|
|
}
|
|
|
|
[ "${url#git://common-lisp.net/}" != "$url" ] && {
|
|
|
|
http_repo_url="$url"
|
|
|
|
http_repo_url="${http_repo_url/git:/http:}"
|
|
|
|
http_repo_url="${http_repo_url/\/projects\// /r/projects/}"
|
|
|
|
http_repo_head="$http_repo_url/refs/heads/master"
|
|
|
|
echo "$http_repo_head" >&2
|
2014-11-12 14:57:48 +01:00
|
|
|
[ -z "$rev" ] && rev=$(curl -L "$http_repo_head");
|
2013-10-29 07:56:33 +01:00
|
|
|
hash=$("$(dirname "$0")/../../../build-support/fetchgit/nix-prefetch-git" "$url" "$rev")
|
2014-11-12 14:57:48 +01:00
|
|
|
[ -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)
|
2013-10-29 07:56:33 +01:00
|
|
|
version="git-$(date +%Y%m%d)";
|
|
|
|
}
|
2014-11-13 08:45:20 +01:00
|
|
|
[ "${url#http://common-lisp.net/}" != "$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)";
|
|
|
|
}
|
2013-10-29 07:56:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
[ "$ql_src_type" = cvs ] && {
|
|
|
|
fetcher="pkgs.fetchcvs"
|
|
|
|
date="$(date -d yesterday +%Y-%m-%d)"
|
|
|
|
version="cvs-$date"
|
|
|
|
module="${module:-$name}"
|
|
|
|
hash=$(USE_DATE=1 "$(dirname "$0")/../../../build-support/fetchcvs/nix-prefetch-cvs" "$url" "$module" "$date")
|
|
|
|
cvsRoot="$url"
|
|
|
|
unset url
|
|
|
|
}
|
|
|
|
|
2014-11-13 07:08:53 +01:00
|
|
|
[ "$ql_src_type" = clnet-darcs ] && {
|
|
|
|
ql_src_type=darcs
|
|
|
|
url="http://common-lisp.net/project/$url/darcs/$url/"
|
|
|
|
}
|
|
|
|
|
|
|
|
[ "$ql_src_type" = darcs ] && {
|
|
|
|
fetcher="pkgs.fetchdarcs"
|
|
|
|
[ -z "$version" ] &&
|
|
|
|
version="$(curl "$url/_darcs/inventory" | grep '\[TAG ' | tail -n 1 | sed -e 's/.* //')"
|
|
|
|
[ -z "$version" ] &&
|
|
|
|
version="$(curl "$url/_darcs/hashed_inventory" | grep '\[TAG ' | tail -n 1 | sed -e 's/.* //')"
|
|
|
|
rev="$version";
|
|
|
|
hash=$(echo "
|
|
|
|
with (import <nixpkgs> {});
|
|
|
|
fetchdarcs {
|
|
|
|
url=''$url'';
|
|
|
|
rev=''$version'';
|
|
|
|
sha256=''0000000000000000000000000000000000000000000000000000000000000000'';
|
|
|
|
}" | nix-instantiate - | tail -n 1 |
|
|
|
|
xargs nix-store -r 2>&1 | tee /dev/stderr | grep 'instead has' | tail -n 1 |
|
|
|
|
sed -e 's/.* instead has .//;s/[^0-9a-z].*//')
|
|
|
|
}
|
|
|
|
|
2014-11-12 14:57:48 +01:00
|
|
|
[ "$ql_src_type" = froydware-http ] && {
|
2014-11-16 17:38:12 +01:00
|
|
|
dirurl="http://method-combination.net/lisp/files/";
|
|
|
|
url="$("$(dirname "$0")/../../../build-support/upstream-updater/urls-from-page.sh" "$dirurl" |
|
|
|
|
grep "/${url}_" | grep -v "[.]asc\$" | tail -n 1)"
|
2014-11-12 14:57:48 +01:00
|
|
|
ql_src_type=http
|
|
|
|
}
|
|
|
|
|
|
|
|
[ "$ql_src_type" = http ] && {
|
|
|
|
fetcher="pkgs.fetchurl";
|
2014-11-16 17:38:12 +01:00
|
|
|
version="$(echo "$url" | sed -re 's@.*[-_]([0-9.]+)[-._].*@\1@')"
|
2014-11-12 14:57:48 +01:00
|
|
|
hash="$(nix-prefetch-url "$url" | grep . | tail -n 1)"
|
|
|
|
}
|
|
|
|
|
|
|
|
[ "$ql_src_type" = https ] && {
|
|
|
|
fetcher="pkgs.fetchurl";
|
2014-11-16 17:38:12 +01:00
|
|
|
version="$(echo "$url" | sed -re 's@.*[-_]([0-9.]+)[-._].*@\1@')"
|
2014-11-12 14:57:48 +01:00
|
|
|
hash="$(nix-prefetch-url "$url" | grep . | tail -n 1)"
|
|
|
|
}
|
|
|
|
|
2014-11-13 07:08:53 +01:00
|
|
|
if [ "$ql_src" = '{"error":"Not Found"}' ]; then
|
2014-11-12 14:57:48 +01:00
|
|
|
echo "# $name: not found"
|
|
|
|
else
|
|
|
|
cat << EOF | grep -Ev '^[ ]+$'
|
2013-10-29 07:56:33 +01:00
|
|
|
|
|
|
|
$name = buildLispPackage rec {
|
|
|
|
baseName = "$name";
|
|
|
|
version = "${version:-\${Set me //}";
|
|
|
|
description = "$description";
|
|
|
|
deps = [$dependencies];
|
2014-11-12 14:57:48 +01:00
|
|
|
# Source type: $ql_src_type
|
2013-10-29 07:56:33 +01:00
|
|
|
src = ${fetcher:-pkgs.fetchurl} {
|
|
|
|
${url:+url = ''$url'';}
|
|
|
|
sha256 = "${hash:-0000000000000000000000000000000000000000000000000000000000000000}";
|
|
|
|
${rev:+rev = ''$rev'';}
|
|
|
|
${date:+date = ''$date'';}
|
|
|
|
${module:+module = ''$module'';}
|
|
|
|
${cvsRoot:+cvsRoot = ''$cvsRoot'';}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
EOF
|
2014-11-12 14:57:48 +01:00
|
|
|
fi
|
2013-10-29 07:56:33 +01:00
|
|
|
|
|
|
|
for i in $dependencies; do "$0" "$i"; done
|