Author: chaoflow
Date: Wed Jun 22 19:34:27 2011
New Revision: 27521
URL: https://svn.nixos.org/websvn/nix/?rev=27521&sc=1
Log:
fetchgit builder to handle broken remotes without a HEAD
Modified:
nixpkgs/trunk/pkgs/build-support/fetchgit/builder.sh
Modified: nixpkgs/trunk/pkgs/build-support/fetchgit/builder.sh
==============================================================================
--- nixpkgs/trunk/pkgs/build-support/fetchgit/builder.sh Wed Jun 22
19:01:14 2011 (r27520)
+++ nixpkgs/trunk/pkgs/build-support/fetchgit/builder.sh Wed Jun 22
19:34:27 2011 (r27521)
@@ -1,3 +1,6 @@
+# tested so far with:
+# - no revision specified and remote has a HEAD which is used
+# - revision specified and remote has a HEAD
source $stdenv/setup
header "exporting $url (rev $rev) into $out"
@@ -6,10 +9,8 @@
cd $out
git remote add origin "$url"
git fetch origin
-git remote set-head origin -a
-
-# If no revision was specified, the remote HEAD will be used
-git checkout -b __nixos_build__ origin/HEAD
+git remote set-head origin -a || (
+ test -n $rev && echo "that's ok, we want $rev" || exit 1)
if test -n "$rev"; then
echo "Trying to checkout: $rev"
@@ -18,6 +19,9 @@
git rev-parse --verify origin/"$rev" 2>/dev/null
)
git reset --hard $parsed_rev
+ git checkout -b __nixos_build__
+else
+ git checkout -b __nixos_build__ origin/HEAD
fi
if test -z "$leaveDotGit"; then
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits