On (13/08/15 14:47), Nikolai Kondrashov wrote:
On 08/11/2015 07:13 PM, Nikolai Kondrashov wrote:
>Hi Pavel,
>
>On 08/11/2015 03:44 PM, Pavel Reichl wrote:
>>On 08/11/2015 02:11 PM, Lukas Slebodnik wrote:
>>>On (11/08/15 15:04), Nikolai Kondrashov wrote:
>>>>Hi Pavel,
>>>>
>>>>It's a good idea to have such a test, thank you! Please see my
comments
>>>>regarding the script (as you requested) below.
>>>>
>>>>BTW, shouldn't we take care to not use git, or to not run this test in
case
>>>>we're running outside git tree, e.g. from unpacked tarball?
>>>>
>>>+1
>>>
>>>LS
>>
>>Nick, thank you for the comments.
>>
>>Would you take over this patch? I understand that you already have a better
>>solution and I think there's no need to update mine in that case. Would you
>>send a patch with proposed solution? There's no time pressure on this effort
>>so you would not have to hurry.
>
>Sure, no problem. I'll send an update this week.
Alright, here are the updated patches. Changes from the last version by Pavel
include:
* Reworked and renamed the whitespace test, fixing a number of issues.
* Made the whitespace test run only if the source is in a Git worktree
(checkout).
* Added another patch making Git worktree (checkout) detection work in a
complete out-of-tree dir and at the same time don't trigger erroneously from
a subdir of (possibly unrelated) worktree. This is also needed to have the
whitespace test not run during "make distcheck", but run in CI.
CI results:
http://sssd-ci.duckdns.org/logs/job/21/40/summary.html
Nick
From c22d9d9103f443c8fd134cd57f0eb7b6d65fd7b9 Mon Sep 17 00:00:00
2001
From: Nikolai Kondrashov <Nikolai.Kondrashov(a)redhat.com>
Date: Wed, 12 Aug 2015 13:27:07 +0300
Subject: [PATCH 2/3] BUILD: Check for Git worktree at srcdir exactly
Check for Git worktree (checkout) presence at $srcdir exactly, instead
of any directory at or above $builddir. Use that directory and the
associated repo for all Git invocations during build and tests.
This allows Git invocations to work completely out-of-tree (not just in
a sub-directory), when configured from a Git worktree. This also
prevents erroneous detection of a Git worktree with an $srcdir located
deeper, such as a distcheck build, or a tarball build under an unrelated
worktree.
---
Makefile.am | 5 +++++
configure.ac | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 8b64317..8016591 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -84,6 +84,11 @@ INSTALL = @INSTALL@
SSSD_USER = @SSSD_USER@
+if GIT_CHECKOUT
+export GIT_DIR=$(abs_top_srcdir)/.git
+export GIT_WORK_TREE=$(abs_top_srcdir)
+endif
It's not good idea to export such in general code.
you might greak something. I didn't try but you might break
something in fedpkg + local build.
Better solution would to to export make variable abs_top_srcdir
as ABS_TOP_SRCDIR in TESTS_ENVIRONMENT
and print warnig/error from test if this variable is not defined.
LS