On Mon, Apr 07, 2008 at 10:11:24AM -0600, [EMAIL PROTECTED] wrote:
> Author: bdubbs
> Date: 2008-04-07 10:11:24 -0600 (Mon, 07 Apr 2008)
> New Revision: 7356
> 
> Modified:
>    trunk/BOOK/general.ent
> Log:
> Revert change that broke the nightly render script
> 
> Modified: trunk/BOOK/general.ent
> ===================================================================
> --- trunk/BOOK/general.ent    2008-04-07 12:51:27 UTC (rev 7355)
> +++ trunk/BOOK/general.ent    2008-04-07 16:11:24 UTC (rev 7356)
> @@ -19,7 +19,8 @@
>  <!ENTITY maintainer-firstname "Randy">
>  <!ENTITY maintainer-address   "randy@&lfs-domainname;">
>  
> -<!ENTITY downloads-root       
> "http://www.linuxfromscratch.org/blfs/downloads/&blfs-version;";>
> +<!-- Don't change this line for svn version.  It is needed byt the render 
> script. -->
> +<!ENTITY downloads-root       
> "http://www.linuxfromscratch.org/blfs/downloads/svn";>
>  <!ENTITY downloads-project    "http://downloads.&lfs-domainname;";>
>  <!ENTITY sources-anduin-http  
> "http://anduin.&lfs-domainname;/sources/BLFS/&blfs-version;";>
>  <!ENTITY sources-anduin-ftp   
> "ftp://anduin.&lfs-domainname;/BLFS/&blfs-version;";>

I came up with a cheesy little hack so that you can easily dump out a
select set of entities in the form of shell variables.

$ make entvars
version="svn-20080407"
blfs_version="svn"
downloads_root="http://www.linuxfromscratch.org/blfs/downloads/svn";
sources_anduin_http="http://anduin.linuxfromscratch.org/sources/BLFS/svn";
sources_anduin_ftp="ftp://anduin.linuxfromscratch.org/BLFS/svn";
files_anduin="http://anduin.linuxfromscratch.org/files/BLFS/svn";
patch_root="http://www.linuxfromscratch.org/patches/blfs/svn";
errata="http://www.linuxfromscratch.org/blfs/errata/svn/";
blfs_bootscripts_version="20080326"

Changing general.ent so blfs-version is 6.3:

$ make entvars
version="svn-20080407"
blfs_version="6.3"
downloads_root="http://www.linuxfromscratch.org/blfs/downloads/svn";
sources_anduin_http="http://anduin.linuxfromscratch.org/sources/BLFS/6.3";
sources_anduin_ftp="ftp://anduin.linuxfromscratch.org/BLFS/6.3";
files_anduin="http://anduin.linuxfromscratch.org/files/BLFS/6.3";
patch_root="http://www.linuxfromscratch.org/patches/blfs/6.3";
errata="http://www.linuxfromscratch.org/blfs/errata/6.3/";
blfs_bootscripts_version="20080326"

So, from a script, you'd do:

eval `make entvars`
DEST="/srv/www/${downloads_root#http://}";

or whatever you need to manipulate the variables. The point being that
XSLT will resolve all the entities and you don't need to grep general.ent
to figure out what to do.

Patch below. What do you think?

diff --git a/BOOK/Makefile b/BOOK/Makefile
index b25a286..1ce2014 100644
--- a/BOOK/Makefile
+++ b/BOOK/Makefile
@@ -163,5 +163,8 @@ validate:
        @echo "Validating the book..."
        $(Q)xmllint --noout --nonet --xinclude --postvalid index.xml
 
+entvars: index.xml stylesheets/entvars.xsl
+       $(Q)xsltproc --nonet stylesheets/entvars.xsl index.xml
+
 .PHONY: blfs all world html pdf nochunks tmpdir clean validxml \
-       profile-html wget-list test-links dump-commands validate
+       profile-html wget-list test-links dump-commands validate entvars
diff --git a/BOOK/stylesheets/entvars.xsl b/BOOK/stylesheets/entvars.xsl
new file mode 100644
index 0000000..1e43920
--- /dev/null
+++ b/BOOK/stylesheets/entvars.xsl
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!DOCTYPE xsl:stylesheet [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+    version="1.0">
+
+  <!-- XSLT stylesheet to dump out entities to shell-style variables.
+       The intended use would be to dump the output to a file and then
+       source the file in a shell. Or just run eval on the output. -->
+
+  <xsl:variable name="newline">
+    <xsl:text>&#xA;</xsl:text>
+  </xsl:variable>
+
+  <xsl:output method="text"/>
+
+  <xsl:template match="/">
+    <xsl:text>version="&version;"</xsl:text>
+    <xsl:value-of select="$newline"/>
+    <xsl:text>blfs_version="&blfs-version;"</xsl:text>
+    <xsl:value-of select="$newline"/>
+    <xsl:text>downloads_root="&downloads-root;"</xsl:text>
+    <xsl:value-of select="$newline"/>
+    <xsl:text>sources_anduin_http="&sources-anduin-http;"</xsl:text>
+    <xsl:value-of select="$newline"/>
+    <xsl:text>sources_anduin_ftp="&sources-anduin-ftp;"</xsl:text>
+    <xsl:value-of select="$newline"/>
+    <xsl:text>files_anduin="&files-anduin;"</xsl:text>
+    <xsl:value-of select="$newline"/>
+    <xsl:text>patch_root="&patch-root;"</xsl:text>
+    <xsl:value-of select="$newline"/>
+    <xsl:text>errata="&errata;"</xsl:text>
+    <xsl:value-of select="$newline"/>
+    <xsl:text>blfs_bootscripts_version="&blfs-bootscripts-version;"</xsl:text>
+    <xsl:value-of select="$newline"/>
+  </xsl:template>
+
+</xsl:stylesheet>

-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-book
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to