summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile19
-rw-r--r--docs/examples-to-end.xsl13
-rw-r--r--docs/rabbitmq.conf.5.xml12
-rw-r--r--docs/rabbitmqctl.1.xml4
-rw-r--r--docs/usage.xsl10
-rw-r--r--src/rabbit_control.erl3
-rw-r--r--src/rabbit_multi.erl3
-rw-r--r--src/worker_pool.erl8
-rw-r--r--src/worker_pool_worker.erl2
9 files changed, 49 insertions, 25 deletions
diff --git a/Makefile b/Makefile
index fcc62fd707..590da6f344 100644
--- a/Makefile
+++ b/Makefile
@@ -202,14 +202,20 @@ distclean: clean
# xmlto can not read from standard input, so we mess with a tmp file.
%.gz: %.xml $(DOCS_DIR)/examples-to-end.xsl
xsltproc $(DOCS_DIR)/examples-to-end.xsl $< > $<.tmp && \
- xmlto man -o $(DOCS_DIR) $<.tmp && \
+ xmlto man -o $(DOCS_DIR) --stringparam man.indent.verbatims=0 $<.tmp && \
gzip -f $(DOCS_DIR)/`basename $< .xml`
rm -f $<.tmp
+# Use tmp files rather than a pipeline so that we get meaningful errors
+# Do not fold the cp into previous line, it's there to stop the file being
+# generated but empty if we fail
$(SOURCE_DIR)/%_usage.erl:
xsltproc --stringparam modulename "`basename $@ .erl`" \
- $(DOCS_DIR)/usage.xsl $< | sed -e s/\\\"/\\\\\\\"/g | sed -e s/%QUOTE%/\\\"/g | \
- fold -s > $@
+ $(DOCS_DIR)/usage.xsl $< > $@.tmp && \
+ sed -e s/\\\"/\\\\\\\"/g -e s/%QUOTE%/\\\"/g $@.tmp > $@.tmp2 && \
+ fold -s $@.tmp2 > $@.tmp3 && \
+ cp $@.tmp3 $@ && \
+ rm $@.tmp $@.tmp2 $@.tmp3
# We rename the file before xmlto sees it since xmlto will use the name of
# the file to make internal links.
@@ -265,6 +271,11 @@ else
TESTABLEGOALS:=$(MAKECMDGOALS)
endif
+ifneq "$(strip $(TESTABLEGOALS))" "$(DEPS_FILE)"
ifneq "$(strip $(patsubst clean%,,$(patsubst %clean,,$(TESTABLEGOALS))))" ""
--include $(DEPS_FILE)
+ifeq "$(strip $(wildcard $(DEPS_FILE)))" ""
+$(info $(shell $(MAKE) $(DEPS_FILE)))
+endif
+include $(DEPS_FILE)
+endif
endif
diff --git a/docs/examples-to-end.xsl b/docs/examples-to-end.xsl
index b63ffcb3c9..496fcc1c34 100644
--- a/docs/examples-to-end.xsl
+++ b/docs/examples-to-end.xsl
@@ -8,7 +8,7 @@
<xsl:output doctype-public="-//OASIS//DTD DocBook XML V4.5//EN" doctype-system="http://www.docbook.org/xml/4.5/docbookx.dtd" />
-<!-- Don't copy exmaples through in place -->
+<!-- Don't copy examples through in place -->
<xsl:template match="*[@role='example-prefix']"/>
<xsl:template match="*[@role='example']"/>
@@ -25,6 +25,7 @@
</xsl:for-each>
<refsect1>
<title>Examples</title>
+<xsl:if test="//screen[@role='example']">
<variablelist>
<xsl:for-each select="//screen[@role='example']">
<varlistentry>
@@ -35,6 +36,16 @@
</varlistentry>
</xsl:for-each>
</variablelist>
+</xsl:if>
+<!--
+We need to handle multiline examples separately, since not using a
+variablelist leads to slightly less nice formatting (the explanation doesn't get
+indented)
+-->
+<xsl:for-each select="//screen[@role='example-multiline']">
+<screen><emphasis role="bold"><xsl:copy-of select="text()"/></emphasis></screen>
+<xsl:copy-of select="following-sibling::para[@role='example']"/>
+</xsl:for-each>
</refsect1>
</refentry>
</xsl:template>
diff --git a/docs/rabbitmq.conf.5.xml b/docs/rabbitmq.conf.5.xml
index dcb1e49c68..34f20f9226 100644
--- a/docs/rabbitmq.conf.5.xml
+++ b/docs/rabbitmq.conf.5.xml
@@ -9,7 +9,7 @@
</refentryinfo>
<refmeta>
- <refentrytitle>/etc/rabbitmq/rabbitmq.conf</refentrytitle>
+ <refentrytitle>rabbitmq.conf</refentrytitle>
<manvolnum>5</manvolnum>
<refmiscinfo class="manual">RabbitMQ Server</refmiscinfo>
</refmeta>
@@ -59,11 +59,11 @@ environment variable names, with the <envar>RABBITMQ_</envar> prefix removed:
<filename>/etc/rabbitmq/rabbitmq.conf</filename> file, etc.
</para>
<para role="example-prefix">For example:</para>
- <screen role="example">
- # I am a complete /etc/rabbitmq/rabbitmq.conf file.
- # Comment lines start with a hash character.
- # This is a /bin/sh script file - use ordinary envt var syntax
- NODENAME=hare
+ <screen role="example-multiline">
+# I am a complete /etc/rabbitmq/rabbitmq.conf file.
+# Comment lines start with a hash character.
+# This is a /bin/sh script file - use ordinary envt var syntax
+NODENAME=hare
</screen>
<para role="example">
This is an example of a complete
diff --git a/docs/rabbitmqctl.1.xml b/docs/rabbitmqctl.1.xml
index e7fc45e4ba..7634b2d247 100644
--- a/docs/rabbitmqctl.1.xml
+++ b/docs/rabbitmqctl.1.xml
@@ -65,7 +65,7 @@
<title>Options</title>
<variablelist>
<varlistentry>
- <term><option>-n</option> <replaceable>node</replaceable></term>
+ <term><cmdsynopsis><arg choice="opt">-n <replaceable>node</replaceable></arg></cmdsynopsis></term>
<listitem>
<para role="usage">
Default node is "rabbit@server", where server is the local host. On
@@ -79,7 +79,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><option>-q</option></term>
+ <term><cmdsynopsis><arg choice="opt">-q</arg></cmdsynopsis></term>
<listitem>
<para role="usage">
Quiet output mode is selected with the "-q" flag. Informational
diff --git a/docs/usage.xsl b/docs/usage.xsl
index 841b2a8461..72f8880ab1 100644
--- a/docs/usage.xsl
+++ b/docs/usage.xsl
@@ -12,19 +12,17 @@
encoding="UTF-8"
indent="no"/>
<xsl:strip-space elements="*"/>
-<xsl:preserve-space elements="term" />
+<xsl:preserve-space elements="cmdsynopsis arg" />
<xsl:template match="/">
<!-- Pull out cmdsynopsis to show the command usage line. -->%% Generated, do not edit!
-module(<xsl:value-of select="$modulename" />).
-export([usage/0]).
-usage() -> io:format(%QUOTE%Usage:
+usage() -> %QUOTE%Usage:
<xsl:value-of select="refentry/refsynopsisdiv/cmdsynopsis/command"/>
<xsl:text> </xsl:text>
<xsl:for-each select="refentry/refsynopsisdiv/cmdsynopsis/arg">
- <xsl:if test="@choice='opt'">[</xsl:if>
<xsl:apply-templates select="." />
- <xsl:if test="@choice='opt'">]</xsl:if>
<xsl:text> </xsl:text>
</xsl:for-each>
@@ -60,7 +58,7 @@ usage() -> io:format(%QUOTE%Usage:
</xsl:for-each>
<xsl:apply-templates select=".//*[title='Commands']/refsect2" mode="command-usage" />
-%QUOTE%), halt(1).
+%QUOTE%.
</xsl:template>
<!-- Option lists in command usage -->
@@ -74,7 +72,7 @@ usage() -> io:format(%QUOTE%Usage:
<!-- Don't show anything else in command usage -->
<xsl:template match="text()" mode="command-usage"/>
-<xsl:template match="option">[<xsl:apply-templates/>]</xsl:template>
+<xsl:template match="arg[@choice='opt']">[<xsl:apply-templates/>]</xsl:template>
<xsl:template match="replaceable">&lt;<xsl:value-of select="."/>&gt;</xsl:template>
</xsl:stylesheet>
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl
index f2f291692a..d1834b3b73 100644
--- a/src/rabbit_control.erl
+++ b/src/rabbit_control.erl
@@ -131,7 +131,8 @@ stop() ->
ok.
usage() ->
- rabbit_ctl_usage:usage().
+ io:format("~s", [rabbit_ctl_usage:usage()]),
+ halt(1).
action(stop, Node, [], Inform) ->
Inform("Stopping and halting node ~p", [Node]),
diff --git a/src/rabbit_multi.erl b/src/rabbit_multi.erl
index 9ff2c5cb11..336f74bf9a 100644
--- a/src/rabbit_multi.erl
+++ b/src/rabbit_multi.erl
@@ -87,7 +87,8 @@ stop() ->
ok.
usage() ->
- rabbit_multi_usage:usage().
+ io:format("~s", [rabbit_multi_usage:usage()]),
+ halt(1).
action(start_all, [NodeCount], RpcTimeout) ->
io:format("Starting all nodes...~n", []),
diff --git a/src/worker_pool.erl b/src/worker_pool.erl
index b883d4f0cb..1ee958afb6 100644
--- a/src/worker_pool.erl
+++ b/src/worker_pool.erl
@@ -93,9 +93,11 @@ handle_call(next_free, From, State = #state { available = Avail,
pending = Pending }) ->
case queue:out(Avail) of
{empty, _Avail} ->
- {noreply, State #state { pending = queue:in(From, Pending) }};
+ {noreply, State #state { pending = queue:in(From, Pending) },
+ hibernate};
{{value, WId}, Avail1} ->
- {reply, get_worker_pid(WId), State #state { available = Avail1 }}
+ {reply, get_worker_pid(WId), State #state { available = Avail1 },
+ hibernate}
end;
handle_call(Msg, _From, State) ->
@@ -109,7 +111,7 @@ handle_cast({idle, WId}, State = #state { available = Avail,
{{value, From}, Pending1} ->
gen_server2:reply(From, get_worker_pid(WId)),
State #state { pending = Pending1 }
- end};
+ end, hibernate};
handle_cast(Msg, State) ->
{stop, {unexpected_cast, Msg}, State}.
diff --git a/src/worker_pool_worker.erl b/src/worker_pool_worker.erl
index fc3ce3714f..3bfcc2d9ff 100644
--- a/src/worker_pool_worker.erl
+++ b/src/worker_pool_worker.erl
@@ -69,7 +69,7 @@ init([WId]) ->
handle_call({submit, Fun}, From, WId) ->
gen_server2:reply(From, run(Fun)),
ok = worker_pool:idle(WId),
- {noreply, WId};
+ {noreply, WId, hibernate};
handle_call(Msg, _From, State) ->
{stop, {unexpected_call, Msg}, State}.