summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorNicolas Pierron <nicolas.b.pierron@gmail.com>2011-09-07 10:02:14 +0000
committerNicolas Pierron <nicolas.b.pierron@gmail.com>2011-09-07 10:02:14 +0000
commit0608f1a9b53f5cab2d7ff897fb6e0c94aa4df4e9 (patch)
treeebee9c5001b3229db97aceefd6af847a03bb44db /pkgs/build-support
parent5f5a47fc769c30b986d32736e894d91aaa9a0b8a (diff)
downloadnixpkgs-0608f1a9b53f5cab2d7ff897fb6e0c94aa4df4e9.tar
nixpkgs-0608f1a9b53f5cab2d7ff897fb6e0c94aa4df4e9.tar.gz
nixpkgs-0608f1a9b53f5cab2d7ff897fb6e0c94aa4df4e9.tar.bz2
nixpkgs-0608f1a9b53f5cab2d7ff897fb6e0c94aa4df4e9.tar.lz
nixpkgs-0608f1a9b53f5cab2d7ff897fb6e0c94aa4df4e9.tar.xz
nixpkgs-0608f1a9b53f5cab2d7ff897fb6e0c94aa4df4e9.tar.zst
nixpkgs-0608f1a9b53f5cab2d7ff897fb6e0c94aa4df4e9.zip
nix-prefetch-git: Display usage message if missing builder arguments are
missing.

svn path=/nixpkgs/trunk/; revision=29076
Diffstat (limited to 'pkgs/build-support')
-rwxr-xr-xpkgs/build-support/fetchgit/nix-prefetch-git24
1 files changed, 20 insertions, 4 deletions
diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git
index bc82794102f..7b05adab08c 100755
--- a/pkgs/build-support/fetchgit/nix-prefetch-git
+++ b/pkgs/build-support/fetchgit/nix-prefetch-git
@@ -55,9 +55,24 @@ for arg; do
   fi
 done
 
-if test -z "$url"; then
-    echo "syntax: nix-prefetch-git URL [REVISION [EXPECTED-HASH]]" >&2
+usage(){
+    echo  >&2 "syntax: nix-prefetch-git [options] [URL [REVISION [EXPECTED-HASH]]]
+
+Options:
+      --out path      Path where the output would be stored.
+      --url url       Any url understand by 'git clone'.
+      --rev ref       Any sha1 or references (such as refs/heads/master)
+      --hash h        Expected hash.
+      --deepClone     Clone submodules recursively.
+      --no-deepClone  Do not clone submodules.
+      --leave-dotGit  Keep the .git directories.
+      --builder       Clone as fetchgit does, but url, rev, and out option are mandatory.
+"
     exit 1
+}
+
+if test -z "$url"; then
+  usage
 fi
 
 
@@ -200,8 +215,9 @@ clone_user_rev() {
 }
 
 if test -n "$builder"; then
-    mkdir $out
-    clone_user_rev "$out" "$url" "$rev"
+  test -n "$out" -a -n "$url" -a -n "$rev" || usage
+  mkdir $out
+  clone_user_rev "$out" "$url" "$rev"
 else
   if test -z "$hashType"; then
       hashType=sha256