From be25ce8f5837eed6ada3c0da815b6fa189798c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benno=20F=C3=BCnfst=C3=BCck?= Date: Wed, 11 Jun 2014 14:09:58 +0200 Subject: [PATCH 1/2] nix-prefetch-git: fix printing of revision If the user explictly gives a ref such as "refs/heads/master", `git rev-parse` failed because we only checked out the `fetchgit` branch. Now, we also try `git rev-parse fetchgit` if the first call fails, which fixes the issue. --- pkgs/build-support/fetchgit/nix-prefetch-git | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git index d4819574acb..3574f3b7539 100755 --- a/pkgs/build-support/fetchgit/nix-prefetch-git +++ b/pkgs/build-support/fetchgit/nix-prefetch-git @@ -217,7 +217,7 @@ clone_user_rev() { fi;; esac - echo "git revision is $(cd $dir && git rev-parse $rev)" + echo "git revision is $(cd $dir && (git rev-parse $rev 2> /dev/null || git rev-parse refs/heads/fetchgit) | tail -n1)" # Allow doing additional processing before .git removal eval "$NIX_PREFETCH_GIT_CHECKOUT_HOOK" From 063efadd69ba56392be1bdd31872bed27becc92d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benno=20F=C3=BCnfst=C3=BCck?= Date: Wed, 11 Jun 2014 14:42:39 +0200 Subject: [PATCH 2/2] nix-prefetch-{bzr,hg,svn}: print fetched revision --- pkgs/build-support/fetchbzr/nix-prefetch-bzr | 2 ++ pkgs/build-support/fetchhg/nix-prefetch-hg | 1 + pkgs/build-support/fetchsvn/nix-prefetch-svn | 1 + 3 files changed, 4 insertions(+) diff --git a/pkgs/build-support/fetchbzr/nix-prefetch-bzr b/pkgs/build-support/fetchbzr/nix-prefetch-bzr index 9ff86c20ae3..2f46819323f 100755 --- a/pkgs/build-support/fetchbzr/nix-prefetch-bzr +++ b/pkgs/build-support/fetchbzr/nix-prefetch-bzr @@ -52,6 +52,8 @@ if test -z "$finalPath"; then # Perform the checkout. bzr -Ossl.cert_reqs=none export $revarg --format=dir "$tmpFile" "$url" + echo "bzr revision is $(bzr revno $revarg "$url")" + # Compute the hash. hash=$(nix-hash --type $hashType $hashFormat $tmpFile) if ! test -n "$QUIET"; then echo "hash is $hash" >&2; fi diff --git a/pkgs/build-support/fetchhg/nix-prefetch-hg b/pkgs/build-support/fetchhg/nix-prefetch-hg index f1f648f4aeb..075dbc9c367 100755 --- a/pkgs/build-support/fetchhg/nix-prefetch-hg +++ b/pkgs/build-support/fetchhg/nix-prefetch-hg @@ -51,6 +51,7 @@ if test -z "$finalPath"; then hg archive -q -y -r "$rev" --cwd $tmpClone $tmpArchive rm -f $tmpArchive/.hg_archival.txt + echo "hg revision is $(cd $tmpClone; hg id -r "$rev" -i)" # Compute the hash. hash=$(nix-hash --type $hashType $hashFormat $tmpArchive) diff --git a/pkgs/build-support/fetchsvn/nix-prefetch-svn b/pkgs/build-support/fetchsvn/nix-prefetch-svn index 2858a0b01ab..a2ee3ac6052 100755 --- a/pkgs/build-support/fetchsvn/nix-prefetch-svn +++ b/pkgs/build-support/fetchsvn/nix-prefetch-svn @@ -56,6 +56,7 @@ if test -z "$finalPath"; then fi echo p | svn "$command" --quiet -r "$rev" "$url" "$tmpFile" >&2 + echo "svn revision is $(svn info -r "$rev" "$url" | grep "Revision: " | cut -d' ' -f2)" # Compute the hash. hash=$(nix-hash --type $hashType $hashFormat $tmpFile)