[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] top/maint.mk: Fix VC_LIST_EXCEPT for srcdir != builddir
From: |
Jim Meyering |
Subject: |
Re: [PATCH 1/2] top/maint.mk: Fix VC_LIST_EXCEPT for srcdir != builddir |
Date: |
Sun, 24 Jan 2010 12:59:44 +0100 |
Jim Meyering wrote:
> Eric Blake wrote:
>> According to Jim Meyering on 1/23/2010 11:28 AM:
>>>> location of '../' got turned into '../../'.
>>>
>>> Thanks!
>>> Looks like I introduced that.
>>> This seems to fix the original problem without breaking anything.
>>> I'll push it after a little more testing:
>>
>> It works for me at any rate. Thanks for the quick fix.
>
> [actually, it was not right, since the sed lacked the 'g' modifier]
> Here's an even better way.
> Just pushed.
>
>>From a3d5e7d237ce6fb927e00ee916892716eb69b997 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <address@hidden>
> Date: Sat, 23 Jan 2010 22:08:55 +0100
> Subject: [PATCH] maint.mk: fix syntax-check in a non-srcdir build directory
>
> * top/maint.mk (_dot_escaped_srcdir): Remove erroneous backslash,
> introduced in my 2010-01-21 commit, a6da6c45. Reported by Eric Blake.
Sheesh. I've just noticed that the above broke srcdir "make
syntax-check". I'd tested only non-srcdir. The problem is that
in the $(srcdir) case, it would erroneously re-append "./" to all
names, and that made at least the sc_po_check fail.
I'll push something like this later.
As a bonus, it suppresses the final "sed",
when it's not needed (in the srcdir case):
We obviously need a test for this test.
diff --git a/top/maint.mk b/top/maint.mk
index 314abc1..a046e44 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -44,13 +44,21 @@ VC_LIST_ALWAYS_EXCLUDE_REGEX ?= ^$$
# when $(srcdir) is a pathological name like "....", the leading sed command
# removes only the intended prefix.
_dot_escaped_srcdir = $(subst .,\.,$(srcdir))
+ifeq ($(srcdir),.)
+_prepend_srcdir_prefix =
+else
+_prepend_srcdir_prefix = | sed 's|^|$(srcdir)/|'
+endif
+# In order to be able to consistently filter "."-relative names,
+# (i.e., with no $(srcdir) prefix), this definition is careful to
+# remove any $(srcdir) prefix, and to restore what it removes.
VC_LIST_EXCEPT = \
$(VC_LIST) | sed 's|^$(_dot_escaped_srcdir)/||' \
| if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; \
else grep -Ev -e "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi \
| grep -Ev -e '$(VC_LIST_ALWAYS_EXCLUDE_REGEX)' \
- | sed 's|^|$(srcdir)/|'
+ $(_prepend_srcdir_prefix)
ifeq ($(origin prev_version_file), undefined)
prev_version_file = $(srcdir)/.prev-version