More metadata in LFS xml

Dan Nicholson dbn.lists at gmail.com
Thu Jul 19 11:28:05 PDT 2007


On 7/19/07, Dan Nicholson <dbn.lists at gmail.com> wrote:
> On 7/19/07, M.Canales.es <macana at macana-es.com> wrote:
> > El Jueves, 19 de Julio de 2007 15:34, Dan Nicholson escribió:
> >
> > > What I can't get right is the $name-$version part. I'm playing with
> > > the dump-commands.xsl stylesheet in the LFS repo since it's simpler
> > > than lfs.xsl in jhalfs. It seems like the place you would want to have
> > > this to work easily with the rest of the stylesheet is to have them be
> > > child elements (or attributes) of <sect1>.
> > >
> > > <sect1>
> > >   <package name="glibc" version="&glibc-version;"/>
> > >   ...
> > > </sect1>
> >
> > A "proper" syntax could be:
> >
> > <sect1>
> >   <sect1info>
> >     <productname>glibc</productname>
> >     <productnumber>&glibc-version;</productnumber>
> >   </sect1info>
> >
> > But I don't like it.
>
> I don't mind that too much and may be necessary to solve a different
> issue below.

I have to say, I like this. Why don't you like using productname and
productnumber? Does this abuse the intended purpose?

diff --git a/BOOK/chapter06/glibc.xml b/BOOK/chapter06/glibc.xml
index 608274f..17425a2 100644
--- a/BOOK/chapter06/glibc.xml
+++ b/BOOK/chapter06/glibc.xml
@@ -8,6 +8,11 @@
 <sect1 id="ch-system-glibc" role="wrap">
   <?dbhtml filename="glibc.html"?>

+  <sect1info>
+    <productname>glibc</productname>
+    <productnumber>&glibc-version;</productnumber>
+  </sect1info>
+
   <title>Glibc-&glibc-version;</title>

   <indexterm zone="ch-system-glibc">
@@ -169,11 +174,11 @@ grep Error glibc-check-log</userinput></screen>
     complain about the absence of <filename>/etc/ld.so.conf</filename>.
     Prevent this warning with:</para>

-<screen><userinput>touch /etc/ld.so.conf</userinput></screen>
+<screen role="install"><userinput>touch /etc/ld.so.conf</userinput></screen>

     <para>Install the package:</para>

-<screen><userinput>make install</userinput></screen>
+<screen role="install"><userinput>make install</userinput></screen>

     <para>The locales that can make the system respond in a different language
     were not installed by the above command. None of the locales are required,
@@ -214,7 +219,7 @@ localedef -i ja_JP -f EUC-JP ja_JP</userinput></screen>
     (it includes every locale listed above and many more) at once with the
     following time-consuming command:</para>

-<screen><userinput>make localedata/install-locales</userinput></screen>
+<screen role="install"><userinput>make
localedata/install-locales</userinput></screen>

     <para>Then use the <command>localedef</command> command to create and
     install locales not listed in the
@@ -244,7 +249,7 @@ localedef -i ja_JP -f EUC-JP ja_JP</userinput></screen>
     <para>Create a new file <filename>/etc/nsswitch.conf</filename> by running
the
     following:</para>

-<screen><userinput>cat > /etc/nsswitch.conf << "EOF"
+<screen role="install"><userinput>cat > /etc/nsswitch.conf << "EOF"
 <literal># Begin /etc/nsswitch.conf

 passwd: files
@@ -278,7 +283,7 @@ EOF</userinput></screen>
     <para>Then create the <filename>/etc/localtime</filename> file by
     running:</para>

-<screen><userinput>cp -v --remove-destination
/usr/share/zoneinfo/<replaceable><xxx></replaceable> \
+<screen role="install"><userinput>cp -v --remove-destination
/usr/share/zoneinfo/<replaceable><xxx></replaceable> \
     /etc/localtime</userinput></screen>

     <para>Replace <replaceable><xxx></replaceable> with the name of the
@@ -326,7 +331,7 @@ EOF</userinput></screen>
     <para>Create a new file <filename>/etc/ld.so.conf</filename> by running the
     following:</para>

-<screen><userinput>cat > /etc/ld.so.conf << "EOF"
+<screen role="install"><userinput>cat > /etc/ld.so.conf << "EOF"
 <literal># Begin /etc/ld.so.conf

 /usr/local/lib
diff --git a/BOOK/stylesheets/dump-commands.xsl
b/BOOK/stylesheets/dump-commands.xsl
index 9e2af96..039ba1d 100644
--- a/BOOK/stylesheets/dump-commands.xsl
+++ b/BOOK/stylesheets/dump-commands.xsl
@@ -43,14 +43,34 @@
     </xsl:variable>
       <!-- Creating dirs and files -->
     <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
+      <xsl:apply-templates select="sect1info"/>
       <xsl:apply-templates select=".//screen"/>
     </exsl:document>
   </xsl:template>

+  <xsl:template match="sect1info">
+    <xsl:if test="productname">
+      <xsl:text># Build script for </xsl:text>
+      <xsl:value-of select="productname"/>
+      <xsl:value-of select="$newline"/>
+      <xsl:text>package=</xsl:text>
+      <xsl:value-of select="productname"/>
+      <xsl:value-of select="$newline"/>
+    </xsl:if>
+    <xsl:if test="productnumber">
+      <xsl:text>version=</xsl:text>
+      <xsl:value-of select="productnumber"/>
+      <xsl:value-of select="$newline"/>
+    </xsl:if>
+    <xsl:if test="productname|productnumber">
+      <xsl:value-of select="$newline"/>
+    </xsl:if>
+  </xsl:template>
+
   <xsl:template match="screen">
     <xsl:if test="child::* = userinput">
       <xsl:choose>
-        <xsl:when test="@role = 'root'">
+        <xsl:when test="@role = 'root' or @role = 'install'">
           <xsl:text># Run this as root</xsl:text>
           <xsl:value-of select="$newline"/>
           <xsl:apply-templates select="userinput"/>



More information about the alfs-discuss mailing list