* [RFC PATCH] configure: Create sh.config based on Makefile.config data
@ 2014-05-11 10:06 Tomi Ollila
2014-05-25 8:22 ` Jani Nikula
0 siblings, 1 reply; 8+ messages in thread
From: Tomi Ollila @ 2014-05-11 10:06 UTC (permalink / raw)
To: notmuch; +Cc: tomi.ollila
Read Makefile.config and when line matches var = val assignment
create _var='val' from it. var must match [a-zA-Z_][a-zA-Z0-9_]*
and val [^'\]* ('\' usually meaning multiline assignments).
Write these lines to sh.config.
sh.config can then be used e.g. in test scripts.
---
configure | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/configure b/configure
index 9bde2eb72b0e..feb0e480f86a 100755
--- a/configure
+++ b/configure
@@ -935,3 +935,8 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS)
EOF
+
+# Create sh.config based on Makefile.config values.
+# Output will be _var='val', val not containing ' nor \ (skipping multiline).
+sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\) *= *\([^\\'\'']*\)$/_\1='\''\2'\''/p' \
+ Makefile.config > sh.config
--
1.8.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [RFC PATCH] configure: Create sh.config based on Makefile.config data
2014-05-11 10:06 [RFC PATCH] configure: Create sh.config based on Makefile.config data Tomi Ollila
@ 2014-05-25 8:22 ` Jani Nikula
2014-05-25 15:54 ` Tomi Ollila
0 siblings, 1 reply; 8+ messages in thread
From: Jani Nikula @ 2014-05-25 8:22 UTC (permalink / raw)
To: Tomi Ollila, notmuch; +Cc: tomi.ollila
On Sun, 11 May 2014, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> Read Makefile.config and when line matches var = val assignment
> create _var='val' from it. var must match [a-zA-Z_][a-zA-Z0-9_]*
> and val [^'\]* ('\' usually meaning multiline assignments).
>
> Write these lines to sh.config.
>
> sh.config can then be used e.g. in test scripts.
I like the general idea here much better than [1] or the symlinks that
we have now. However I'm wary of the sed magic and the various ways it
might trip over. The resulting file has way more info than we need, but
then it also misses the multiline settings (which we luckily don't
need).
At the risk of duplicating stuff, I'd go with manually generated config
for shell with minimal amount of information. For now, we'd only need
this for HAVE_XAPIAN_COMPACT and HAVE_MAN (the latter of which could
also be dropped from Makefile.config).
BR,
Jani.
[1] id:1399737224-79348-1-git-send-email-cceleri@cs.stanford.edu
> ---
> configure | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/configure b/configure
> index 9bde2eb72b0e..feb0e480f86a 100755
> --- a/configure
> +++ b/configure
> @@ -935,3 +935,8 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
>
> CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS)
> EOF
> +
> +# Create sh.config based on Makefile.config values.
> +# Output will be _var='val', val not containing ' nor \ (skipping multiline).
> +sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\) *= *\([^\\'\'']*\)$/_\1='\''\2'\''/p' \
> + Makefile.config > sh.config
> --
> 1.8.0
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC PATCH] configure: Create sh.config based on Makefile.config data
2014-05-25 8:22 ` Jani Nikula
@ 2014-05-25 15:54 ` Tomi Ollila
2014-05-30 7:43 ` [PATCH 1/2] build: generate sh.config for feeding configure results to shell scripts Jani Nikula
0 siblings, 1 reply; 8+ messages in thread
From: Tomi Ollila @ 2014-05-25 15:54 UTC (permalink / raw)
To: Jani Nikula, Charles Celerier, notmuch
On Sun, May 25 2014, Jani Nikula <jani@nikula.org> wrote:
> On Sun, 11 May 2014, Tomi Ollila <tomi.ollila@iki.fi> wrote:
>> Read Makefile.config and when line matches var = val assignment
>> create _var='val' from it. var must match [a-zA-Z_][a-zA-Z0-9_]*
>> and val [^'\]* ('\' usually meaning multiline assignments).
>>
>> Write these lines to sh.config.
>>
>> sh.config can then be used e.g. in test scripts.
>
> I like the general idea here much better than [1] or the symlinks that
> we have now. However I'm wary of the sed magic and the various ways it
> might trip over. The resulting file has way more info than we need, but
> then it also misses the multiline settings (which we luckily don't
> need).
>
> At the risk of duplicating stuff, I'd go with manually generated config
> for shell with minimal amount of information. For now, we'd only need
> this for HAVE_XAPIAN_COMPACT and HAVE_MAN (the latter of which could
> also be dropped from Makefile.config).
I agree with this. It looks simpler and cleaner to an outside observer.
I don't think the duplication of (one variable now) stuff is of any issue
here (now or in foreseeable future).
>
> BR,
> Jani.
>
>
> [1] id:1399737224-79348-1-git-send-email-cceleri@cs.stanford.edu
In any case, this sh.config to be useful sourcing of it needs to be
added to test/test-lib.sh and then used in the followup patch of
the above...
Tomi
>> ---
>> configure | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/configure b/configure
>> index 9bde2eb72b0e..feb0e480f86a 100755
>> --- a/configure
>> +++ b/configure
>> @@ -935,3 +935,8 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
>>
>> CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS)
>> EOF
>> +
>> +# Create sh.config based on Makefile.config values.
>> +# Output will be _var='val', val not containing ' nor \ (skipping multiline).
>> +sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\) *= *\([^\\'\'']*\)$/_\1='\''\2'\''/p' \
>> + Makefile.config > sh.config
>> --
>> 1.8.0
>>
>> _______________________________________________
>> notmuch mailing list
>> notmuch@notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] build: generate sh.config for feeding configure results to shell scripts
2014-05-25 15:54 ` Tomi Ollila
@ 2014-05-30 7:43 ` Jani Nikula
2014-05-30 7:43 ` [PATCH 2/2] test: use sh.config for configuration Jani Nikula
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Jani Nikula @ 2014-05-30 7:43 UTC (permalink / raw)
To: notmuch; +Cc: Tomi Ollila
Only include the relevant information.
---
Makefile.local | 2 +-
configure | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/Makefile.local b/Makefile.local
index 3377d55e1d49..31e524070849 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -338,7 +338,7 @@ SRCS := $(SRCS) $(notmuch_client_srcs)
CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules)
CLEAN := $(CLEAN) version.stamp notmuch-*.tar.gz.tmp
-DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config
+DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config sh.config
DEPS := $(SRCS:%.c=.deps/%.d)
DEPS := $(DEPS:%.cc=.deps/%.d)
diff --git a/configure b/configure
index 9bde2eb72b0e..4e3d2c4ac0b2 100755
--- a/configure
+++ b/configure
@@ -935,3 +935,16 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS)
EOF
+
+# construct the sh.config
+cat > sh.config <<EOF
+# This sh.config was automatically generated by the ./configure
+# script of notmuch.
+
+# Whether the Xapian version in use supports compaction
+_HAVE_XAPIAN_COMPACT=${have_xapian_compact}
+
+# Whether there's either sphinx or rst2man available for building
+# documentation
+_HAVE_MAN=$((have_sphinx || have_rst2man))
+EOF
--
2.0.0.rc2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] test: use sh.config for configuration
2014-05-30 7:43 ` [PATCH 1/2] build: generate sh.config for feeding configure results to shell scripts Jani Nikula
@ 2014-05-30 7:43 ` Jani Nikula
2014-05-30 11:50 ` [PATCH 1/2] build: generate sh.config for feeding configure results to shell scripts Tomi Ollila
2014-05-30 15:42 ` W. Trevor King
2 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2014-05-30 7:43 UTC (permalink / raw)
To: notmuch; +Cc: Tomi Ollila
---
test/.gitignore | 2 --
test/Makefile.local | 16 ----------------
test/T010-help-test.sh | 2 +-
test/T020-compact.sh | 2 +-
test/test-lib-common.sh | 4 ++++
5 files changed, 6 insertions(+), 20 deletions(-)
diff --git a/test/.gitignore b/test/.gitignore
index 4081cee6da18..b3b706d85188 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,7 +1,5 @@
arg-test
corpus.mail
-have-compact
-have-man
hex-xcode
parse-time
random-corpus
diff --git a/test/Makefile.local b/test/Makefile.local
index d622eafee786..1c85b18adc41 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -35,25 +35,9 @@ $(dir)/symbol-test: $(dir)/symbol-test.o lib/$(LINKER_NAME)
$(dir)/parse-time: $(dir)/parse-time.o parse-time-string/parse-time-string.o
$(call quiet,CC) $^ -o $@
-$(dir)/have-compact: Makefile.config
-ifeq ($(HAVE_XAPIAN_COMPACT),1)
- ln -sf /bin/true $@
-else
- ln -sf /bin/false $@
-endif
-
-$(dir)/have-man: Makefile.config
-ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00)
- ln -sf /bin/false $@
-else
- ln -sf /bin/true $@
-endif
-
.PHONY: test check
TEST_BINARIES=$(dir)/arg-test \
- $(dir)/have-compact \
- $(dir)/have-man \
$(dir)/hex-xcode \
$(dir)/random-corpus \
$(dir)/parse-time \
diff --git a/test/T010-help-test.sh b/test/T010-help-test.sh
index 77410bc54e66..f0ca4549dc8b 100755
--- a/test/T010-help-test.sh
+++ b/test/T010-help-test.sh
@@ -7,7 +7,7 @@ test_expect_success 'notmuch --help' 'notmuch --help'
test_expect_success 'notmuch help' 'notmuch help'
test_expect_success 'notmuch --version' 'notmuch --version'
-if ${TEST_DIRECTORY}/have-man; then
+if [ $_HAVE_MAN -eq 1 ]; then
test_expect_success 'notmuch --help tag' 'notmuch --help tag'
test_expect_success 'notmuch help tag' 'notmuch help tag'
else
diff --git a/test/T020-compact.sh b/test/T020-compact.sh
index 77bb9632cb11..19d81c5fc77d 100755
--- a/test/T020-compact.sh
+++ b/test/T020-compact.sh
@@ -10,7 +10,7 @@ notmuch tag +tag1 \*
notmuch tag +tag2 subject:Two
notmuch tag -tag1 +tag3 subject:Three
-if ! ${TEST_DIRECTORY}/have-compact; then
+if [ $_HAVE_XAPIAN_COMPACT -eq 0 ]; then
test_begin_subtest "Compact unsupported: error message"
output=$(notmuch compact --quiet 2>&1)
test_expect_equal "$output" "notmuch was compiled against a xapian version lacking compaction support.
diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
index 892991e2bd03..4903038dd9ce 100644
--- a/test/test-lib-common.sh
+++ b/test/test-lib-common.sh
@@ -38,6 +38,10 @@ find_notmuch_path ()
# test/ subdirectory and are run in 'trash directory' subdirectory.
TEST_DIRECTORY=$(pwd)
notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`
+
+# configure output
+. $notmuch_path/sh.config
+
if test -n "$valgrind"
then
make_symlink () {
--
2.0.0.rc2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] build: generate sh.config for feeding configure results to shell scripts
2014-05-30 7:43 ` [PATCH 1/2] build: generate sh.config for feeding configure results to shell scripts Jani Nikula
2014-05-30 7:43 ` [PATCH 2/2] test: use sh.config for configuration Jani Nikula
@ 2014-05-30 11:50 ` Tomi Ollila
2014-05-30 15:42 ` W. Trevor King
2 siblings, 0 replies; 8+ messages in thread
From: Tomi Ollila @ 2014-05-30 11:50 UTC (permalink / raw)
To: Jani Nikula, notmuch
On Fri, May 30 2014, Jani Nikula <jani@nikula.org> wrote:
> Only include the relevant information.
> ---
Series LGTM. Tests pass.
Tomi
> Makefile.local | 2 +-
> configure | 13 +++++++++++++
> 2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile.local b/Makefile.local
> index 3377d55e1d49..31e524070849 100644
> --- a/Makefile.local
> +++ b/Makefile.local
> @@ -338,7 +338,7 @@ SRCS := $(SRCS) $(notmuch_client_srcs)
> CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules)
> CLEAN := $(CLEAN) version.stamp notmuch-*.tar.gz.tmp
>
> -DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config
> +DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config sh.config
>
> DEPS := $(SRCS:%.c=.deps/%.d)
> DEPS := $(DEPS:%.cc=.deps/%.d)
> diff --git a/configure b/configure
> index 9bde2eb72b0e..4e3d2c4ac0b2 100755
> --- a/configure
> +++ b/configure
> @@ -935,3 +935,16 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
>
> CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS)
> EOF
> +
> +# construct the sh.config
> +cat > sh.config <<EOF
> +# This sh.config was automatically generated by the ./configure
> +# script of notmuch.
> +
> +# Whether the Xapian version in use supports compaction
> +_HAVE_XAPIAN_COMPACT=${have_xapian_compact}
> +
> +# Whether there's either sphinx or rst2man available for building
> +# documentation
> +_HAVE_MAN=$((have_sphinx || have_rst2man))
> +EOF
> --
> 2.0.0.rc2
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] build: generate sh.config for feeding configure results to shell scripts
2014-05-30 7:43 ` [PATCH 1/2] build: generate sh.config for feeding configure results to shell scripts Jani Nikula
2014-05-30 7:43 ` [PATCH 2/2] test: use sh.config for configuration Jani Nikula
2014-05-30 11:50 ` [PATCH 1/2] build: generate sh.config for feeding configure results to shell scripts Tomi Ollila
@ 2014-05-30 15:42 ` W. Trevor King
2014-07-13 15:25 ` David Bremner
2 siblings, 1 reply; 8+ messages in thread
From: W. Trevor King @ 2014-05-30 15:42 UTC (permalink / raw)
To: Jani Nikula; +Cc: Tomi Ollila, notmuch
[-- Attachment #1: Type: text/plain, Size: 671 bytes --]
On Fri, May 30, 2014 at 10:43:04AM +0300, Jani Nikula wrote:
> Only include the relevant information.
I prefer this approach too.
> +# Whether the Xapian version in use supports compaction
> +_HAVE_XAPIAN_COMPACT=${have_xapian_compact}
Why the leading underscore? Are we worried about colliding with
existing HAVE_XAPIAN_COMPACT variables? Python conventionally uses
the leading underscore for private variables, but these are certainly
meant to be used by the sourcing script.
Cheers,
Trevor
--
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] build: generate sh.config for feeding configure results to shell scripts
2014-05-30 15:42 ` W. Trevor King
@ 2014-07-13 15:25 ` David Bremner
0 siblings, 0 replies; 8+ messages in thread
From: David Bremner @ 2014-07-13 15:25 UTC (permalink / raw)
To: W. Trevor King, Jani Nikula; +Cc: Tomi Ollila, notmuch
"W. Trevor King" <wking@tremily.us> writes:
> On Fri, May 30, 2014 at 10:43:04AM +0300, Jani Nikula wrote:
>> Only include the relevant information.
>
> I prefer this approach too.
>
>> +# Whether the Xapian version in use supports compaction
>> +_HAVE_XAPIAN_COMPACT=${have_xapian_compact}
I pushed these with the prefix changed to NOTMUCH_
d
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-07-13 15:25 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-11 10:06 [RFC PATCH] configure: Create sh.config based on Makefile.config data Tomi Ollila
2014-05-25 8:22 ` Jani Nikula
2014-05-25 15:54 ` Tomi Ollila
2014-05-30 7:43 ` [PATCH 1/2] build: generate sh.config for feeding configure results to shell scripts Jani Nikula
2014-05-30 7:43 ` [PATCH 2/2] test: use sh.config for configuration Jani Nikula
2014-05-30 11:50 ` [PATCH 1/2] build: generate sh.config for feeding configure results to shell scripts Tomi Ollila
2014-05-30 15:42 ` W. Trevor King
2014-07-13 15:25 ` David Bremner
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).