Update source updater to support fetchgit; add aufs2 using that method. Unfortunately, AUFS2 seems to require some strict conditions on kernel options and version..

svn path=/nixpkgs/trunk/; revision=16983
This commit is contained in:
Michael Raskin
2009-09-08 09:35:21 +00:00
parent 9121ae7fb8
commit edd56d707a
8 changed files with 132 additions and 39 deletions
@@ -12,6 +12,7 @@ Attributes:
src-info-for-file.nix:
downloadPage
rev (for repos)
baseName (default = unnamed-package)
sourceRegexp (default = '.*[.]tar[.].*')
choiceCommand (default = 'head -1')
@@ -26,55 +26,80 @@ getAttr () {
echo "$data"
}
if [ -z "$forcedUrl" ] ; then
freshUrl="$("$own_dir"/urls-from-page.sh "$(getAttr downloadPage)" |
eval "egrep \"$(getAttr sourceRegexp '.*[.]tar[.].*')\"" |
eval "$(getAttr choiceCommand 'head -1')")"
if ! egrep ':' freshUrl ; then
freshUrl="$(dirname "$(getAttr downloadPage).")/$freshUrl"
fi
echo "Found download link: $freshUrl" >&2
else
freshUrl="$forcedUrl"
fi
if [ x"$freshUrl" = x"$(cat "$src_defs_dir"/advertisedUrl)" ]; then
echo "Source link not changed" >&2
exit
fi
version="$(echo "$freshUrl" |
eval "sed -re \"$(getAttr versionExtractorSedScript \
's/.*-([0-9.]+)[.].*/\1/')\"")"
mirrorUrl="$(echo "$freshUrl" |
eval "sed -r -e \"$(getAttr versionReferenceCreator \
's/-([0-9.]+)[.]/-${version}./')\"" |
eval "sed -r -e \"$(getAttr mirrorSedScript)\"")"
hash=$(nix-prefetch-url "$freshUrl")
method="$(getAttr method fetchurl)"
baseName="$(getAttr baseName 'unnamed-package')"
name="$baseName-$version"
commonPrefetchVars=" version name hash"
advertisedUrl="$freshUrl"
url="$mirrorUrl"
prefetchClause=""
[ fetchurl = "$method" ] && {
if [ -z "$forcedUrl" ] ; then
freshUrl="$("$own_dir"/urls-from-page.sh "$(getAttr downloadPage)" |
eval "egrep \"$(getAttr sourceRegexp '.*[.]tar[.].*')\"" |
eval "$(getAttr choiceCommand 'head -1')")"
if ! egrep ':' freshUrl ; then
freshUrl="$(dirname "$(getAttr downloadPage).")/$freshUrl"
fi
echo "Found download link: $freshUrl" >&2
else
freshUrl="$forcedUrl"
fi
version="$(echo "$freshUrl" |
eval "sed -re \"$(getAttr versionExtractorSedScript \
's/.*-([0-9.]+)[.].*/\1/')\"")"
mirrorUrl="$(echo "$freshUrl" |
eval "sed -r -e \"$(getAttr versionReferenceCreator \
's/-([0-9.]+)[.]/-${version}./')\"" |
eval "sed -r -e \"$(getAttr mirrorSedScript)\"")"
name="$baseName-$version"
advertisedUrl="$freshUrl"
url="$mirrorUrl"
if [ x"$freshUrl" = x"$(cat "$src_defs_dir"/advertisedUrl)" ]; then
echo "Source link not changed" >&2
exit
fi
hash=$(nix-prefetch-url "$freshUrl")
prefetchVars="url advertisedUrl";
}
[ "fetchgit" = "$method" ] && {
repoUrl="$(getAttr repoUrl)"
export NIX_PREFETCH_GIT_CHECKOUT_HOOK="
cat .git/HEAD
"
export NIX_HASH_ALGO=sha256
rev="$(getAttr rev '')";
rev_and_hash="$("$own_dir"/../fetchgit/nix-prefetch-git "$repoUrl" "$rev" | tail -2)"
rev="$(echo "$rev_and_hash" | head -1)"
url="$repoUrl";
hash="$(echo "$rev_and_hash" | tail -1)"
version="$rev"
name="$baseName-$version"
prefetchVars="rev url";
}
prefetchAssignments="";
for i in $commonPrefetchVars $prefetchVars; do
prefetchAssignments="$prefetchAssignments $i=\"$(eval echo \"\$$i\")\";$(echo -e '\n ')"
done;
extraAssignments=""
for i in $(getAttr extraVars ''); do
eval "$(getAttr "eval_$i" 'i=""')"
extraAssignments="$extraAssignments $i=\"$(eval echo \"\$$i\")\";"
extraAssignments="$extraAssignments $i=\"$(eval echo \"\$$i\")\";$(echo -e '\n ')"
done
cat << EOF > "$new_src_file"
rec {
advertisedUrl="$advertisedUrl";
version = "$version";
url="$url";
hash = "$hash";
name = "$name";
$prefetchAssignments
$extraAssignments
}
EOF