fetchgit: add 'deepClone' argument to disable shallow fetching

This patch resolves https://github.com/NixOS/nixpkgs/issues/6395. Deep
cloning is useful in combination with 'leaveDotGit' for builds that want
to run "git describe" to obtain a proper version string, etc., like the
'haskellngPackages.cabal2nix' package does.
This commit is contained in:
Peter Simons 2015-03-10 12:40:19 +01:00
parent 8196130a1d
commit 5d02f0e854
2 changed files with 5 additions and 4 deletions

View File

@ -8,6 +8,7 @@ header "exporting $url (rev $rev) into $out"
$fetcher --builder --url "$url" --out "$out" --rev "$rev" \ $fetcher --builder --url "$url" --out "$out" --rev "$rev" \
${leaveDotGit:+--leave-dotGit} \ ${leaveDotGit:+--leave-dotGit} \
${deepClone:+--deepClone} \
${fetchSubmodules:+--fetch-submodules} ${fetchSubmodules:+--fetch-submodules}
stopNest stopNest

View File

@ -11,8 +11,8 @@
else ""; else "";
in "${if matched == null then base else builtins.head matched}${appendShort}"; in "${if matched == null then base else builtins.head matched}${appendShort}";
in in
{ url, rev ? "HEAD", md5 ? "", sha256 ? "", leaveDotGit ? false { url, rev ? "HEAD", md5 ? "", sha256 ? "", leaveDotGit ? deepClone
, fetchSubmodules ? true , fetchSubmodules ? true, deepClone ? false
, name ? urlToName url rev , name ? urlToName url rev
}: }:
@ -39,6 +39,7 @@ in
*/ */
assert md5 != "" || sha256 != ""; assert md5 != "" || sha256 != "";
assert deepClone -> leaveDotGit;
stdenv.mkDerivation { stdenv.mkDerivation {
inherit name; inherit name;
@ -50,7 +51,7 @@ stdenv.mkDerivation {
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHash = if sha256 == "" then md5 else sha256; outputHash = if sha256 == "" then md5 else sha256;
inherit url rev leaveDotGit fetchSubmodules; inherit url rev leaveDotGit fetchSubmodules deepClone;
GIT_SSL_CAINFO = "${cacert}/etc/ca-bundle.crt"; GIT_SSL_CAINFO = "${cacert}/etc/ca-bundle.crt";
@ -64,4 +65,3 @@ stdenv.mkDerivation {
preferLocalBuild = true; preferLocalBuild = true;
} }