You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "Bruce A. Mah" <bm...@packetdesign.com> on 2003/05/06 17:57:44 UTC

doc/book request

Would it be possible to include an $Id$ or other tag somewhere near the
front of the book (like on the title page)?  This would help those of us
making dead-tree printout versions remember how current they are.

I notice that the renderings on svnbook.red-bean.com have some sort of 
revision number on them but I'm not sure where it came from.

Thanks!

Bruce.



Re: doc/book request

Posted by "Bruce A. Mah" <bm...@packetdesign.com>.
If memory serves me right, Matt Kraai wrote:
> On Thu, May 08, 2003 at 11:21:51AM -0700, Bruce A. Mah wrote:
> > @@ -53,7 +55,7 @@
> >      </editor>
> >  
> >      <pagenums>350 pages (est.)</pagenums>
> > -    <pubdate>(TBA)</pubdate>
> > +    <pubdate>Revision: &svn.version;</pubdate>
> 
> Use the revnumber, not pubdate, tag.

OK.

Bruce.

Re: doc/book request

Posted by Matt Kraai <kr...@alumni.cmu.edu>.
On Thu, May 08, 2003 at 11:21:51AM -0700, Bruce A. Mah wrote:
> @@ -53,7 +55,7 @@
>      </editor>
>  
>      <pagenums>350 pages (est.)</pagenums>
> -    <pubdate>(TBA)</pubdate>
> +    <pubdate>Revision: &svn.version;</pubdate>

Use the revnumber, not pubdate, tag.
-- 
Matt Kraai <kr...@alumni.cmu.edu>
Debian GNU/Linux Peon

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: doc/book request

Posted by "Bruce A. Mah" <bm...@packetdesign.com>.
If memory serves me right, Greg Stein wrote:
> On Thu, May 08, 2003 at 11:21:51AM -0700, Bruce A. Mah wrote:
> >...
> > +++ doc/book/Makefile	(working copy)
> > @@ -3,7 +3,9 @@
> >  INSTALL = install
> >  
> >  ## You shouldn't normally need to edit anything below here.
> > +PRINTF = printf
> 
> I don't think this is portable, so...

Like I said, I wasn't sure.  The only systems I could check easily are
FreeBSD and Linux.

> > +$(BOOK_VERSION_SOURCE):
> > +	$(PRINTF) '<!ENTITY svn.version "%s">' `$(SVNVERSION) .` > $(BOOK_VERSION_SOURCE)
> 
> echo '<!ENTITY svn.version "VERSION">' | sed "s/VERSION/`$(SVNVERSION) .`/" > $(BOOK_VERSION_SOURCE)
> 
> 
> That would be a lot easier if it wasn't for the darned exclamation point :-)

No kidding.  :-)

I actually thought of doing it with an awk script but sed works
perfectly well for this.

Thanks,

Bruce.

Re: Is svnversion misbehaving (there is newline at the end)? (WAS; Re: doc/book request)

Posted by Philip Martin <ph...@codematters.co.uk>.
Matt Kraai <kr...@alumni.cmu.edu> writes:

> On Fri, May 09, 2003 at 12:21:31AM +0300, Jani Averbach wrote:
> > Yes, but in general, is it better to print newline or not to print?
> 
> I say print it.

Make it optional?  'svnversion --no-newline'

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is svnversion misbehaving (there is newline at the end)? (WAS; Re: doc/book request)

Posted by Matt Kraai <kr...@alumni.cmu.edu>.
On Fri, May 09, 2003 at 12:21:31AM +0300, Jani Averbach wrote:
> Yes, but in general, is it better to print newline or not to print?

I say print it.

> I would be against newline at the end, because I think that svnversion
> is mainly for build scripts.
> But do you have any case in mind, when there is some advance of it?

I don't know of a case, but to omit the newline would be
inconsistent with most shell utilities.
-- 
Matt Kraai <kr...@alumni.cmu.edu>
Debian GNU/Linux Peon

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is svnversion misbehaving (there is newline at the end)? (WAS; Re: doc/book request)

Posted by Jani Averbach <ja...@cc.jyu.fi>.
On Thu, 8 May 2003, Matt Kraai wrote:
> On Thu, May 08, 2003 at 11:54:25PM +0300, Jani Averbach wrote:
> > Oh well, paint it blue!
> >
> > echo -n '<!ENTITY svn.version "' >  $(BOOK_VERSION_SOURCE)
> > $(SVNVERSION) .                  >> $(BOOK_VERSION_SOURCE)
> > echo '">'                        >> $(BOOK_VERSION_SOURCE)
> >
> > Which will print:
> > <!ENTITY svn.version "5843
> > ">
> >
> > Hmm, should svnversion _not_ to print last \n? What do you think?
>
> The other solutions consume the newline (since they use
> backticks).

Yes, but in general, is it better to print newline or not to print?
I would be against newline at the end, because I think that svnversion
is mainly for build scripts.
But do you have any case in mind, when there is some advance of it?


> While we're on a roll, for sheer perversity,
>
>  echo '<!ENTITY svn.version "'"$$($(SVNVERSION) .)"'">' > $(BOOK_VERSION_SOURCE)
>
> That's right, "'"$$($( baby!

1-0, you win.

BR, Jani

-- 
Jani Averbach



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is svnversion misbehaving (there is newline at the end)? (WAS; Re: doc/book request)

Posted by Matt Kraai <kr...@alumni.cmu.edu>.
On Thu, May 08, 2003 at 11:54:25PM +0300, Jani Averbach wrote:
> Oh well, paint it blue!
> 
> echo -n '<!ENTITY svn.version "' >  $(BOOK_VERSION_SOURCE)
> $(SVNVERSION) .                  >> $(BOOK_VERSION_SOURCE)
> echo '">'                        >> $(BOOK_VERSION_SOURCE)
> 
> Which will print:
> <!ENTITY svn.version "5843
> ">
> 
> Hmm, should svnversion _not_ to print last \n? What do you think?

The other solutions consume the newline (since they use
backticks).  While we're on a roll, for sheer perversity,

 echo '<!ENTITY svn.version "'"$$($(SVNVERSION) .)"'">' > $(BOOK_VERSION_SOURCE)

That's right, "'"$$($( baby!
-- 
Matt Kraai <kr...@alumni.cmu.edu>
Debian GNU/Linux Peon

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

[PATCH] svnbook revision number, take #2 (was Re: doc/book request)

Posted by "Bruce A. Mah" <bm...@packetdesign.com>.
This time with a proper (I think?) log message, incorporating feedback
from other list members.  Tested with HTML, partially tested with
PostScript.

Bruce.

-----

Log:

Automatically include a version number in renditions of the book,
as reported by svnversion.

* doc/book/Makefile
  ($(BOOK_VERSION_SOURCE)):  Generate a version.xml 
  file that defines the output of svnversion as an XML entity.
  ($(BOOK_HTML_TARGET), book-html-chunk, $(BOOK_PDF_TARGET), 
  $(BOOK_PS_TARGET)):  Depend on the generated version.xml file.
  book-clean:  Remove the generated version.xml file.

* doc/book/book/book.xml:  Include the generated version.xml file
  and insert its svn.version entity in an appropriate place in the
  bookinfo element.

Index: doc/book/book/book.xml
===================================================================
--- doc/book/book/book.xml	(revision 5924)
+++ doc/book/book/book.xml	(working copy)
@@ -1,6 +1,8 @@
 <?xml version="1.0"?>
 <!DOCTYPE book SYSTEM "../tools/dtd/dblite.dtd"
 [
+<!ENTITY % vers   SYSTEM "version.xml">
+%vers;
 <!ENTITY ch00     SYSTEM "ch00.xml">
 <!ENTITY ch01     SYSTEM "ch01.xml">
 <!ENTITY ch02     SYSTEM "ch02.xml">
@@ -53,8 +55,11 @@
     </editor>
 
     <pagenums>350 pages (est.)</pagenums>
-    <pubdate>(TBA)</pubdate>
 
+    <!-- Using revnumber would be more appropriate, but our stylesheets -->
+    <!-- don't seem to render it. -->
+    <pubdate>Draft Revision &svn.version;</pubdate>
+
   </bookinfo>
 
   <!-- External entity refs -->
Index: doc/book/Makefile
===================================================================
--- doc/book/Makefile	(revision 5924)
+++ doc/book/Makefile	(working copy)
@@ -4,6 +4,7 @@
 
 ## You shouldn't normally need to edit anything below here.
 SHELL = /bin/sh
+SVNVERSION = svnversion
 
 BOOK_TOP = .
 BOOK_HTML_CHUNK_DIR = $(BOOK_DIR)/html-chunk
@@ -13,6 +14,7 @@
 BOOK_PS_TARGET = $(BOOK_DIR)/book.ps
 BOOK_FO_TARGET = $(BOOK_DIR)/book.fo
 BOOK_XML_SOURCE = $(BOOK_DIR)/book.xml
+BOOK_VERSION_SOURCE =  $(BOOK_DIR)/version.xml
 BOOK_ALL_SOURCE = $(BOOK_DIR)/*.xml
 BOOK_INSTALL_DIR = $(INSTALL_DIR)/book
 
@@ -61,15 +63,17 @@
 
 clean: book-clean misc-docs-clean
 
+$(BOOK_VERSION_SOURCE):
+	echo '<!ENTITY svn.version "'`$(SVNVERSION) .`'">' > $(BOOK_VERSION_SOURCE)
 
 book-html: $(BOOK_HTML_TARGET)
 
-$(BOOK_HTML_TARGET): $(BOOK_ALL_SOURCE)
+$(BOOK_HTML_TARGET): $(BOOK_ALL_SOURCE) $(BOOK_VERSION_SOURCE)
 	$(XSLTPROC) $(BOOK_HTML_XSLTPROC_OPTS) \
            --output $(BOOK_HTML_TARGET) $(XSL_HTML) $(BOOK_XML_SOURCE)
 
 ## This trailing slash is essential that xsltproc will output pages to the dir
-book-html-chunk: $(BOOK_ALL_SOURCE)
+book-html-chunk: $(BOOK_ALL_SOURCE) $(BOOK_VERSION_SOURCE)
 	mkdir -p $(BOOK_HTML_CHUNK_DIR)
 	$(XSLTPROC) $(BOOK_HTML_XSLTPROC_OPTS) \
            --output $(BOOK_HTML_CHUNK_DIR)/ \
@@ -81,12 +85,12 @@
 
 book-ps: $(BOOK_PS_TARGET)
 
-$(BOOK_PDF_TARGET): $(BOOK_ALL_SOURCE)
+$(BOOK_PDF_TARGET): $(BOOK_ALL_SOURCE) $(BOOK_VERSION_SOURCE)
 	$(XSLTPROC) $(BOOK_PDF_XSLTPROC_OPTS) \
 	   --output $(BOOK_FO_TARGET) $(XSL_FO) $(BOOK_XML_SOURCE)
 	$(RUN_FOP) $(BOOK_TOP) -fo $(BOOK_FO_TARGET) -pdf $(BOOK_PDF_TARGET)
 
-$(BOOK_PS_TARGET): $(BOOK_ALL_SOURCE)
+$(BOOK_PS_TARGET): $(BOOK_ALL_SOURCE) $(BOOK_VERSION_SOURCE)
 	$(XSLTPROC) $(BOOK_PS_XSLTPROC_OPTS) \
 	   --output $(BOOK_FO_TARGET) $(XSL_FO) $(BOOK_XML_SOURCE)
 	$(RUN_FOP) $(BOOK_TOP) -fo $(BOOK_FO_TARGET) -ps $(BOOK_PS_TARGET)
@@ -114,6 +118,7 @@
 	$(INSTALL) $(BOOK_PS_TARGET) $(BOOK_INSTALL_DIR)
 
 book-clean:
+	rm -f $(BOOK_VERSION_SOURCE)
 	rm -f $(BOOK_HTML_TARGET) $(BOOK_FO_TARGET)
 	rm -rf $(BOOK_HTML_CHUNK_DIR)
 	rm -f $(BOOK_PDF_TARGET) $(BOOK_PS_TARGET) 

Is svnversion misbehaving (there is newline at the end)? (WAS; Re: doc/book request)

Posted by Jani Averbach <ja...@cc.jyu.fi>.
On Thu, 8 May 2003, Bruce A. Mah wrote:

> > Would
> >
> >  echo '<!ENTITY svn.version "'`$(SVNVERSION) .`'">' > $(BOOK_VERSION_SOURCE)
> >
> > work?
>
> I didn't think so at first, which is why I did the printf thing.
> But it does!  It also has the distinction of using all three shell
> quoting characters adjacent to each other (twice).

Oh well, paint it blue!

echo -n '<!ENTITY svn.version "' >  $(BOOK_VERSION_SOURCE)
$(SVNVERSION) .                  >> $(BOOK_VERSION_SOURCE)
echo '">'                        >> $(BOOK_VERSION_SOURCE)

Which will print:
<!ENTITY svn.version "5843
">

Hmm, should svnversion _not_ to print last \n? What do you think?

BR, Jani

-- 
Jani Averbach


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: doc/book request

Posted by "Bruce A. Mah" <bm...@packetdesign.com>.
If memory serves me right, Matt Kraai wrote:

> Would
> 
>  echo '<!ENTITY svn.version "'`$(SVNVERSION) .`'">' > $(BOOK_VERSION_SOURCE)
> 
> work?

I didn't think so at first, which is why I did the printf thing.
But it does!  It also has the distinction of using all three shell
quoting characters adjacent to each other (twice).

Bruce.

Re: doc/book request

Posted by Matt Kraai <kr...@alumni.cmu.edu>.
On Thu, May 08, 2003 at 12:34:32PM -0700, Greg Stein wrote:
> On Thu, May 08, 2003 at 11:21:51AM -0700, Bruce A. Mah wrote:
> >...
> > +++ doc/book/Makefile	(working copy)
> > @@ -3,7 +3,9 @@
> >  INSTALL = install
> >  
> >  ## You shouldn't normally need to edit anything below here.
> > +PRINTF = printf
> 
> I don't think this is portable, so...
> 
> >...
> > +$(BOOK_VERSION_SOURCE):
> > +	$(PRINTF) '<!ENTITY svn.version "%s">' `$(SVNVERSION) .` > $(BOOK_VERSION_SOURCE)
> 
> echo '<!ENTITY svn.version "VERSION">' | sed "s/VERSION/`$(SVNVERSION) .`/" > $(BOOK_VERSION_SOURCE)

Would

 echo '<!ENTITY svn.version "'`$(SVNVERSION) .`'">' > $(BOOK_VERSION_SOURCE)

work?
-- 
Matt Kraai <kr...@alumni.cmu.edu>
Debian GNU/Linux Peon

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: doc/book request

Posted by Greg Stein <gs...@lyra.org>.
On Thu, May 08, 2003 at 11:21:51AM -0700, Bruce A. Mah wrote:
>...
> +++ doc/book/Makefile	(working copy)
> @@ -3,7 +3,9 @@
>  INSTALL = install
>  
>  ## You shouldn't normally need to edit anything below here.
> +PRINTF = printf

I don't think this is portable, so...

>...
> +$(BOOK_VERSION_SOURCE):
> +	$(PRINTF) '<!ENTITY svn.version "%s">' `$(SVNVERSION) .` > $(BOOK_VERSION_SOURCE)

echo '<!ENTITY svn.version "VERSION">' | sed "s/VERSION/`$(SVNVERSION) .`/" > $(BOOK_VERSION_SOURCE)


That would be a lot easier if it wasn't for the darned exclamation point :-)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: doc/book request

Posted by "Bruce A. Mah" <bm...@packetdesign.com>.
If memory serves me right, B. W. Fitzpatrick wrote:
> - Tweak the Makefile to scrub through your working copy (ala
>   svnversion) and generate a revision number which it would inject
>   into book.xml before making the pdf, html, or whatever.

[snip]

> If you want to take on the former and submit a patch, I would be more
> than willing to review and incorporate it.

OK, how's this?

Caveats:  Most of what I know about XML comes from SGML.  I only
tested HTML generation because I don't have FOP setup anywhere.  I'm
not sure how portable my use of printf(1) is.

Bruce.