[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: |
Thu, 21 Jan 2010 19:34:46 +0100 |
Jim Meyering wrote:
> Here are a pair of maint.mk patches.
> The first is from Jiri Denemark and makes VC_LIST-using
> rules like "make syntax-check" also work when run from
> a non-srcdir build.
>
> The second tweaks things so that the pre-filter works robustly
> even when $(srcdir) contains a '.'.
>
> I'll push these as soon as I add a ChangeLog entry for Jiri's change.
Here's what I've pushed:
>From 7046425244088fe5754a51bb494ea6b453f5fa74 Mon Sep 17 00:00:00 2001
From: Jiri Denemark <address@hidden>
Date: Thu, 21 Jan 2010 14:23:17 +0100
Subject: [PATCH 1/2] maint.mk: fix VC_LIST_EXCEPT for srcdir != builddir
* top/maint.mk (VC_LIST_EXCEPT): Preprocess the output of
$(VC_LIST) to remove a prefix of '$(srcdir)/', so that it works
from a non-srcdir build.
---
ChangeLog | 7 +++++++
top/maint.mk | 8 +++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a92aec0..681b56a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-01-21 Jiri Denemark <address@hidden>
+
+ maint.mk: fix VC_LIST_EXCEPT for srcdir != builddir
+ * top/maint.mk (VC_LIST_EXCEPT): Preprocess the output of
+ $(VC_LIST) to remove a prefix of '$(srcdir)/', so that it works
+ from a non-srcdir build.
+
2010-01-20 Eric Blake <address@hidden>
warn-on-use: use instead of link-warning
diff --git a/top/maint.mk b/top/maint.mk
index 366d12a..bbf8a91 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -41,9 +41,11 @@ VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
VC_LIST_ALWAYS_EXCLUDE_REGEX ?= ^$$
VC_LIST_EXCEPT = \
- $(VC_LIST) | 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)'
+ $(VC_LIST) | sed 's|^$(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)/|'
ifeq ($(origin prev_version_file), undefined)
prev_version_file = $(srcdir)/.prev-version
--
1.6.6.1.491.g5a5547
>From a6da6c45e5bf69491c83d8244081e6245eae6658 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 21 Jan 2010 16:47:34 +0100
Subject: [PATCH 2/2] maint.mk: make VC_LIST_EXCEPT robustly handle a srcdir
containing "."
* top/maint.mk (_dot_escaped_srcdir): Define.
(VC_LIST_EXCEPT): Use it in LHS of preprocessing sed substitution.
---
ChangeLog | 6 ++++++
top/maint.mk | 7 ++++++-
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 681b56a..e294c72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-21 Jim Meyering <address@hidden>
+
+ maint.mk: handle source file names containing "." robustly
+ * top/maint.mk (_dot_escaped_srcdir): Define.
+ (VC_LIST): Use it in LHS of sed substitution.
+
2010-01-21 Jiri Denemark <address@hidden>
maint.mk: fix VC_LIST_EXCEPT for srcdir != builddir
diff --git a/top/maint.mk b/top/maint.mk
index bbf8a91..1ef28d3 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -40,8 +40,13 @@ VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
# matching files to ignore.
VC_LIST_ALWAYS_EXCLUDE_REGEX ?= ^$$
+# This is to preprocess robustly the output of $(VC_LIST), so that even
+# when $(srcdir) is a pathological name like "....", the leading sed command
+# removes only the intended prefix.
+_dot_escaped_srcdir = $(subst .,\\.,$(srcdir))
+
VC_LIST_EXCEPT = \
- $(VC_LIST) | sed 's|^$(srcdir)/||' \
+ $(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)' \
--
1.6.6.1.491.g5a5547