Thanks for getting back to me so quickly.

On 03/10/2012 08:16 AM, P. Martin wrote:
> 
> On Mar 9, 2012, Stefano Lattarini <stefano.lattar...@gmail.com> wrote: 
>> Do you happen to know how one can
>> reliably determine whether the build system is being run by HomeBrew,
> 
> 
> Forgot to answer your question.  Yes, when Homebrew spawns
> an install, it stages the files in the user's temp dir, which can change,
> but below that you'll always see homebrew-automake.  A pwd e.g.
> 
>   /private/tmp/homebrew-automake-HEAD-Zk5j
>   /private/tmp/homebrew-automake-1.11.3-5hld/automake-1.11.3
>   /some/path/homebrew-automake-1.11.3-E4t5/automake-1.11.3
> 
> It's also the case that this env var will be defined with some path:
> 
>   HOMEBREW_BREW_FILE=/usr/local/bin/brew
> 
> Thanks again.
>
>
I've finally found myself the list of variables expected to be set by
homebrew; see the entry "SHELL SCRIPTS" at:

 <https://github.com/mxcl/homebrew/wiki/External-Commands>

So I've prepared the attached patch; can you confirm it truly solves
the homebrew issue?

Thanks,
  Stefano
>From 026972f5970d7d302bec1de48126c2c4bd1f4876 Mon Sep 17 00:00:00 2001
Message-Id: <026972f5970d7d302bec1de48126c2c4bd1f4876.1331365864.git.stefano.lattar...@gmail.com>
From: Stefano Lattarini <stefano.lattar...@gmail.com>
Date: Sat, 10 Mar 2012 08:49:55 +0100
Subject: [PATCH] tests: avoid spurious failure under homebrew

This change fixes the last bit of automake bug#10866.

* tests/get-sysconf.test: When Homebrew spawns a build, even if
from a project's VCS, it stages the files in a new temporary
directory, instead of building directly from a VCS checkout.
This behaviour was causing a spurious failure in this test, which
expected to find either a ChangeLog file or a .git directory in
the source directory (the former happening when the test was run
from a distribution tarball, the latter when it was run from a
git checkout).  Work around the issue by explicitly recognizing
when we're being run by Homebrew, and being more forgiving in
that case.

Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com>
---
 tests/get-sysconf.test |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tests/get-sysconf.test b/tests/get-sysconf.test
index bad4735..0dbee2e 100755
--- a/tests/get-sysconf.test
+++ b/tests/get-sysconf.test
@@ -33,6 +33,13 @@ st=0
 if test -d "$top_testsrcdir"/.git; then
   # We are running from a git checkout.
   git log -1 || st=1
+elif test -n "$HOMEBREW_CELLAR"; then
+  # We are very likely running under Homebrew.  And when Homebrew spawns
+  # a build, even if from a project's VCS, it stages the files in a new
+  # temporary directory, instead of building directly from a VCS checkout.
+  # In this case, we can't expect to find neither a .git directory nor a
+  # ChangeLog file, so do nothing.
+  warn_ "running under Homebrew, some info won't be available"
 else
   # We are probably running from a distribution tarball, so
   # the ChangeLog file must be present.
-- 
1.7.9

Reply via email to