git.iko.soy/typeable/nixpkgs
on master help sign in
fetchhg: add option to fetch hg subrepos
commit366da9e70f46bd42a62bdcd9a0aa7b891c54760d authorRobert Scott <code@humanleg.org.uk> dateWed 1 Apr 2015, 15:02 (12 years ago) parent066d614
3 files changed+12−4
pkgs/build-support/fetchhg/builder.sh+1−1 pkgs/build-support/fetchhg/default.nix+4−2 pkgs/build-support/fetchhg/nix-prefetch-hg+7−1
pkgs/build-support/fetchhg/builder.sh+1−1
@@ -3,7 +3,7 @@ header "getting $url${rev:+ ($rev)} into $out"
33
44hg clone --insecure "$url" hg-clone
55
6−hg archive -q -y ${rev:+-r "$rev"} --cwd hg-clone $out
6+hg archive -q$subrepoClause -y ${rev:+-r "$rev"} --cwd hg-clone $out
77rm -f $out/.hg_archival.txt
88
99stopNest
pkgs/build-support/fetchhg/default.nix+4−2
@@ -1,4 +1,4 @@
1−{stdenv, mercurial, nix}: {name ? null, url, rev ? null, md5 ? null, sha256 ? null}:
1+{stdenv, mercurial, nix}: {name ? null, url, rev ? null, md5 ? null, sha256 ? null, fetchSubrepos ? false}:
22
33# TODO: statically check if mercurial as the https support if the url starts woth https.
44stdenv.mkDerivation {
@@ -9,10 +9,12 @@ stdenv.mkDerivation {
99 # Nix <= 0.7 compatibility.
1010 id = md5;
1111
12+ subrepoClause = if fetchSubrepos then "S" else "";
13+
1214 outputHashAlgo = if md5 != null then "md5" else "sha256";
1315 outputHashMode = "recursive";
1416 outputHash = if md5 != null then md5 else sha256;
15−
17+
1618 inherit url rev;
1719 preferLocalBuild = true;
1820}
pkgs/build-support/fetchhg/nix-prefetch-hg+7−1
@@ -17,6 +17,12 @@ if test -z "$url"; then
1717 exit 1
1818fi
1919
20+if test "$fetchSubrepos" == 1; then
21+ subrepoClause=S
22+else
23+ subrepoClause=
24+fi
25+
2026test -n "$rev" || rev="tip"
2127
2228
@@ -47,7 +53,7 @@ if test -z "$finalPath"; then
4753 else
4854 tmpClone=$url
4955 fi
50− hg archive -q -y -r "$rev" --cwd $tmpClone $tmpArchive
56+ hg archive -q$subrepoClause -y -r "$rev" --cwd $tmpClone $tmpArchive
5157 rm -f $tmpArchive/.hg_archival.txt
5258
5359 echo "hg revision is $(cd $tmpClone; hg id -r "$rev" -i)"