* [PATCH] catch asciidoc failures
@ 2007-06-01 6:23 Scott Lamb
2007-06-01 8:36 ` Martin Waitz
0 siblings, 1 reply; 7+ messages in thread
From: Scott Lamb @ 2007-06-01 6:23 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Scott Lamb
If pipefail is available (GNU bash >= 3.00), fail when asciidoc returns
error rather than possibly later during XSLT.
Signed-off-by: Scott Lamb <slamb@slamb.org>
---
This is my first git patch, so please let me know if I got the procedure
wrong.
Documentation/Makefile | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 3f92783..48c245c 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -111,6 +111,7 @@ clean:
%.html : %.txt
rm -f $@+ $@
+ set -o pipefail 2>/dev/null; \
$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
$(ASCIIDOC_EXTRA) -o - $< | \
sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' >$@+
@@ -121,6 +122,7 @@ clean:
%.xml : %.txt
rm -f $@+ $@
+ set -o pipefail 2>/dev/null; \
$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
$(ASCIIDOC_EXTRA) -o - $< | \
sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' >$@+
--
1.5.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] catch asciidoc failures
2007-06-01 6:23 [PATCH] catch asciidoc failures Scott Lamb
@ 2007-06-01 8:36 ` Martin Waitz
2007-06-01 8:55 ` Jonas Fonseca
2007-06-01 9:10 ` Jeff King
0 siblings, 2 replies; 7+ messages in thread
From: Martin Waitz @ 2007-06-01 8:36 UTC (permalink / raw)
To: Scott Lamb; +Cc: Junio C Hamano, git
[-- Attachment #1: Type: text/plain, Size: 846 bytes --]
hoi :)
On Thu, May 31, 2007 at 11:23:57PM -0700, Scott Lamb wrote:
> If pipefail is available (GNU bash >= 3.00), fail when asciidoc returns
> error rather than possibly later during XSLT.
perhaps we should simply change the pipe ordering to get asciidoc
to the end of the pipeline so that all shells respect its exit code?
> --- a/Documentation/Makefile
> +++ b/Documentation/Makefile
> @@ -111,6 +111,7 @@ clean:
>
> %.html : %.txt
> rm -f $@+ $@
> + set -o pipefail 2>/dev/null; \
> $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
> $(ASCIIDOC_EXTRA) -o - $< | \
> sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' >$@+
something like (untested):
sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' $< |
$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
$(ASCIIDOC_EXTRA) -o $@+ -
--
Martin Waitz
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] catch asciidoc failures
2007-06-01 8:36 ` Martin Waitz
@ 2007-06-01 8:55 ` Jonas Fonseca
2007-06-01 9:10 ` Jeff King
1 sibling, 0 replies; 7+ messages in thread
From: Jonas Fonseca @ 2007-06-01 8:55 UTC (permalink / raw)
To: Martin Waitz; +Cc: Scott Lamb, Junio C Hamano, git
On 6/1/07, Martin Waitz <tali@admingilde.org> wrote:
> On Thu, May 31, 2007 at 11:23:57PM -0700, Scott Lamb wrote:
> > If pipefail is available (GNU bash >= 3.00), fail when asciidoc returns
> > error rather than possibly later during XSLT.
>
> perhaps we should simply change the pipe ordering to get asciidoc
> to the end of the pipeline so that all shells respect its exit code?
For tig I also adopted the nice man page headers git has. However, I have
used asciidoc attributes provided on the command line avoid having to
use sed. I can make a patch later if nobody beats me. The required changes
are outlined below.
> > --- a/Documentation/Makefile
> > +++ b/Documentation/Makefile
> > @@ -111,6 +111,7 @@ clean:
> >
> > %.html : %.txt
> > rm -f $@+ $@
> > + set -o pipefail 2>/dev/null; \
> > $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
> > $(ASCIIDOC_EXTRA) -o - $< | \
> > sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' >$@+
>
> something like (untested):
> sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' $< |
> $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
> $(ASCIIDOC_EXTRA) -o $@+ -
More untested stuff. Use -a to define git_version attribute:
$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@ $<
Then change the @@GIT_VERSION@@ symbol in asciidoc.conf to {git_version}.
--
Jonas Fonseca
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] catch asciidoc failures
2007-06-01 8:36 ` Martin Waitz
2007-06-01 8:55 ` Jonas Fonseca
@ 2007-06-01 9:10 ` Jeff King
2007-06-01 9:39 ` Martin Waitz
2007-06-01 9:46 ` Scott Lamb
1 sibling, 2 replies; 7+ messages in thread
From: Jeff King @ 2007-06-01 9:10 UTC (permalink / raw)
To: Martin Waitz; +Cc: Scott Lamb, Junio C Hamano, git, jonas.fonseca
On Fri, Jun 01, 2007 at 10:36:21AM +0200, Martin Waitz wrote:
> perhaps we should simply change the pipe ordering to get asciidoc
> to the end of the pipeline so that all shells respect its exit code?
> [...]
> something like (untested):
> sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' $< |
> $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
> $(ASCIIDOC_EXTRA) -o $@+ -
That won't work. The text @@GIT_VERSION@@ is pulled in from the
asciidoc.conf file, so it's not even in the source file; it's only in
the built product.
As Jonas suggested, making it an asciidoc attribute is much more
elegant (patch even tested!):
-- >8 --
Documentation: robustify asciidoc GIT_VERSION replacement
Instead of using sed on the resulting file, we now have a
git_version asciidoc attribute. This means that we don't
pipe the output of asciidoc, which means we can detect build
failures.
Problem reported by Scott Lamb, solution suggested by Jonas Fonseca.
Signed-off-by: Jeff King <peff@peff.net>
---
Documentation/Makefile | 6 ++----
Documentation/asciidoc.conf | 2 +-
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 3f92783..4064b38 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -112,8 +112,7 @@ clean:
%.html : %.txt
rm -f $@+ $@
$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
- $(ASCIIDOC_EXTRA) -o - $< | \
- sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' >$@+
+ $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
mv $@+ $@
%.1 %.5 %.7 : %.xml
@@ -122,8 +121,7 @@ clean:
%.xml : %.txt
rm -f $@+ $@
$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
- $(ASCIIDOC_EXTRA) -o - $< | \
- sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' >$@+
+ $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
mv $@+ $@
user-manual.xml: user-manual.txt user-manual.conf
diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf
index fa7dc94..60e15ba 100644
--- a/Documentation/asciidoc.conf
+++ b/Documentation/asciidoc.conf
@@ -40,7 +40,7 @@ template::[header-declarations]
<refentrytitle>{mantitle}</refentrytitle>
<manvolnum>{manvolnum}</manvolnum>
<refmiscinfo class="source">Git</refmiscinfo>
-<refmiscinfo class="version">@@GIT_VERSION@@</refmiscinfo>
+<refmiscinfo class="version">{git_version}</refmiscinfo>
<refmiscinfo class="manual">Git Manual</refmiscinfo>
</refmeta>
<refnamediv>
--
1.5.2.871.g0ff23
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] catch asciidoc failures
2007-06-01 9:10 ` Jeff King
@ 2007-06-01 9:39 ` Martin Waitz
2007-06-01 9:43 ` Jeff King
2007-06-01 9:46 ` Scott Lamb
1 sibling, 1 reply; 7+ messages in thread
From: Martin Waitz @ 2007-06-01 9:39 UTC (permalink / raw)
To: Jeff King; +Cc: Scott Lamb, Junio C Hamano, git, jonas.fonseca
[-- Attachment #1: Type: text/plain, Size: 252 bytes --]
hoi :)
On Fri, Jun 01, 2007 at 05:10:30AM -0400, Jeff King wrote:
> As Jonas suggested, making it an asciidoc attribute is much more
> elegant (patch even tested!):
very nice!
Does that need any special asciidoc version?
--
Martin Waitz
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] catch asciidoc failures
2007-06-01 9:10 ` Jeff King
2007-06-01 9:39 ` Martin Waitz
@ 2007-06-01 9:46 ` Scott Lamb
1 sibling, 0 replies; 7+ messages in thread
From: Scott Lamb @ 2007-06-01 9:46 UTC (permalink / raw)
To: Jeff King; +Cc: Martin Waitz, Junio C Hamano, git, jonas.fonseca
On Jun 1, 2007, at 2:10 AM, Jeff King wrote:
> %.html : %.txt
> rm -f $@+ $@
> $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
> - $(ASCIIDOC_EXTRA) -o - $< | \
> - sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' >$@+
> + $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
> mv $@+ $@
Hmm, now the $@+ intermediary shouldn't be necessary anymore - with "-
o" it's asciidoc's responsibility to handle the output file correctly.
I think there's a lightbulb joke here somewhere. ;)
--
Scott Lamb <http://www.slamb.org/>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-06-01 9:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-01 6:23 [PATCH] catch asciidoc failures Scott Lamb
2007-06-01 8:36 ` Martin Waitz
2007-06-01 8:55 ` Jonas Fonseca
2007-06-01 9:10 ` Jeff King
2007-06-01 9:39 ` Martin Waitz
2007-06-01 9:43 ` Jeff King
2007-06-01 9:46 ` Scott Lamb
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox