git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #7235 from risicle/fetchhgsubrepo

fetchhg: add option to fetch hg subrepos

commit655eed7a9309d909914d32867cecf6bada1dc3db authorEdward Tjörnhammar <ed@cflags.cc> dateMon 4 May 2015, 18:20 (12 years ago) parentf9e3161366da9e
3 files changed+11−3
pkgs/build-support/fetchhg/builder.sh+1−1 pkgs/build-support/fetchhg/default.nix+3−1 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+3−1
@@ -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 {
@@ -13,6 +13,8 @@ stdenv.mkDerivation {
1313 # Nix <= 0.7 compatibility.
1414 id = md5;
1515
16+ subrepoClause = if fetchSubrepos then "S" else "";
17+
1618 outputHashAlgo = if md5 != null then "md5" else "sha256";
1719 outputHashMode = "recursive";
1820 outputHash = if md5 != null then md5 else sha256;
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)"