Author: pierre
Date: Sat Aug 17 01:30:36 2019
New Revision: 4118

Log:
Several things:
- refactor again process-install. Allows for better generation of test
  instructions
- only output the instructions of the first sect2 with role="installation".
  this will miss the vaapi intel driver, the installation of help files in
  GIMP, and the second method for which
- always run porg logging in "append" mode
- allows pass1 in sect2 (libva again)

Modified:
   jhalfs/trunk/BLFS/xsl/make_book.xsl
   jhalfs/trunk/BLFS/xsl/process-install.xsl
   jhalfs/trunk/BLFS/xsl/scripts.xsl
   jhalfs/trunk/pkgmngt/packInstall.sh.porg

Modified: jhalfs/trunk/BLFS/xsl/make_book.xsl
==============================================================================
--- jhalfs/trunk/BLFS/xsl/make_book.xsl Wed Aug 14 03:32:59 2019        (r4117)
+++ jhalfs/trunk/BLFS/xsl/make_book.xsl Sat Aug 17 01:30:36 2019        (r4118)
@@ -102,13 +102,16 @@
               </xsl:call-template>
             </xsl:when>
             <xsl:when test="contains(concat($list,' '),'-pass1 ')">
-<!-- Let's do it only for sect1, hopefully -->
+<!-- We need to do it only for sect1 and sect2, because of libva -->
               <xsl:variable
                    name="real-id"
                    select="substring-before(concat($list,' '),'-pass1 ')"/>
               <xsl:if test="id($real-id)[self::sect1]">
                 <xsl:apply-templates select="id($real-id)" mode="pass1"/>
               </xsl:if>
+              <xsl:if test="id($real-id)[self::sect2]">
+                <xsl:apply-templates select="id($real-id)" mode="pass1-sect2"/>
+              </xsl:if>
             </xsl:when>
             <xsl:when test="not(id($list)[self::sect1 or self::sect2 or 
self::para or self::bridgehead])">
               <xsl:apply-templates
@@ -187,6 +190,90 @@
         </xsl:element>
       </xsl:when>
       <xsl:otherwise>
+        <xsl:copy-of select="."/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="*" mode="pass1-sect2">
+    <xsl:choose>
+      <xsl:when test="self::sect2">
+        <xsl:element name="sect1">
+          <xsl:attribute name="id"><xsl:value-of 
select="@id"/>-pass1</xsl:attribute>
+          <xsl:attribute name="xreflabel"><xsl:value-of 
select="@xreflabel"/></xsl:attribute>
+          <xsl:processing-instruction name="dbhtml">filename="<xsl:value-of
+                          
select="@id"/>-pass1.html"</xsl:processing-instruction>
+          <xsl:apply-templates mode="pass1-sect2"/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:when test="self::sect3">
+        <xsl:element name="sect2">
+          <xsl:attribute name="role">
+            <xsl:value-of select="@role"/>
+          </xsl:attribute>
+          <xsl:apply-templates mode="pass1-sect2"/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:when test="self::bridgehead">
+        <xsl:element name="bridgehead">
+          <xsl:attribute name="renderas">
+            <xsl:if test="@renderas='sect4'">sect3</xsl:if>
+            <xsl:if test="@renderas='sect5'">sect4</xsl:if>
+          </xsl:attribute>
+          <xsl:value-of select='.'/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:when test="self::xref">
+        <xsl:choose>
+          <xsl:when test="contains(concat(' ',normalize-space($list),' '),
+                                   concat(' ',@linkend,' '))">
+            <xsl:choose>
+              <xsl:when test="@linkend='x-window-system' or @linkend='xorg7'">
+                <xref linkend="xorg7-server"/>
+              </xsl:when>
+              <xsl:when test="@linkend='server-mail'">
+                <xref linkend="{$MTA}"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:copy-of select="."/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:choose>
+              <xsl:when test="@linkend='bootscripts' or
+                              @linkend='systemd-units'">
+                <xsl:copy-of select="."/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="@linkend"/> (in full book)
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="@id">
+        <xsl:element name="{name()}">
+          <xsl:for-each select="attribute::*">
+            <xsl:attribute name="{name()}">
+              <xsl:value-of select="."/>
+              <xsl:if test="name() = 'id'">-pass1</xsl:if>
+            </xsl:attribute>
+          </xsl:for-each>
+          <xsl:apply-templates mode="pass1-sect2"/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:when test=".//xref | .//@id">
+        <xsl:element name="{name()}">
+          <xsl:for-each select="attribute::*">
+            <xsl:attribute name="{name()}">
+              <xsl:value-of select="."/>
+            </xsl:attribute>
+          </xsl:for-each>
+          <xsl:apply-templates mode="pass1-sect2"/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:otherwise>
         <xsl:copy-of select="."/>
       </xsl:otherwise>
     </xsl:choose>

Modified: jhalfs/trunk/BLFS/xsl/process-install.xsl
==============================================================================
--- jhalfs/trunk/BLFS/xsl/process-install.xsl   Wed Aug 14 03:32:59 2019        
(r4117)
+++ jhalfs/trunk/BLFS/xsl/process-install.xsl   Sat Aug 17 01:30:36 2019        
(r4118)
@@ -17,6 +17,7 @@
     <xsl:variable name="current-instr" select="$instruction-tree[1]"/>
 
     <xsl:choose>
+<!--============================================================-->
 <!-- First, if we have an empty tree, close everything and exit -->
       <xsl:when test="not($current-instr)">
         <xsl:if test="$install-seen">
@@ -35,7 +36,8 @@
             <xsl:with-param name="want-stats" select="$want-stats"/>
           </xsl:call-template>
         </xsl:if>
-      </xsl:when><!-- empty tree -->
+      </xsl:when><!-- end empty tree -->
+<!--============================================================-->
       <xsl:when test="$current-instr[@role='root' and @remap='test']">
         <xsl:if test="$install-seen">
           <xsl:call-template name="end-install"/>
@@ -54,15 +56,15 @@
           </xsl:call-template>
         </xsl:if>
         <xsl:call-template name="begin-root"/>
-        <xsl:choose>
-          <xsl:when test="$want-stats">
-            <xsl:apply-templates select="$current-instr" mode="root"/>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:apply-templates select="$current-instr"
-                                 mode="root-comment-out"/>
-          </xsl:otherwise>
-        </xsl:choose>
+<!-- We first apply mode="root" templates, and save the result in a variable 
-->
+        <xsl:variable name="processed-instr">
+          <xsl:apply-templates select="$current-instr" mode="root"/>
+        </xsl:variable>
+<!-- We then process as a test instruction -->
+        <xsl:call-template name="process-test">
+          <xsl:with-param name="test-instr" select="$processed-instr"/>
+          <xsl:with-param name="want-stats" select="$want-stats"/>
+        </xsl:call-template>
         <xsl:call-template name="process-install">
           <xsl:with-param
              name="instruction-tree"
@@ -73,7 +75,8 @@
           <xsl:with-param name="test-seen" select="boolean(1)"/>
           <xsl:with-param name="doc-seen" select="boolean(0)"/>
         </xsl:call-template>
-      </xsl:when><!-- role="root" and remap="test" -->
+      </xsl:when><!-- end role="root" and remap="test" -->
+<!--============================================================-->
       <xsl:when test="$current-instr[@role='root' and @remap='doc']">
         <xsl:if test="$test-seen">
           <xsl:call-template name="end-test">
@@ -91,8 +94,15 @@
         <xsl:if test="not($install-seen)">
           <xsl:call-template name="begin-install"/>
         </xsl:if>
-        <xsl:apply-templates select="$current-instr"
-                             mode="install-comment-out"/>
+<!-- We first apply mode="install" templates, and save the result in a
+     variable -->
+        <xsl:variable name="processed-instr">
+          <xsl:apply-templates select="$current-instr" mode="install"/>
+        </xsl:variable>
+<!-- Then comment it out -->
+        <xsl:call-template name="output-comment-out">
+          <xsl:with-param name="out-string" select="$processed-instr"/>
+        </xsl:call-template>
 <!-- The above template ends with a commented line, so that if end-install
      adds a closing single quote, it will not be seen. Add a CR to prevent
      that -->
@@ -108,9 +118,14 @@
           <xsl:with-param name="test-seen" select="boolean(0)"/>
           <xsl:with-param name="doc-seen" select="boolean(1)"/>
         </xsl:call-template>
-      </xsl:when><!--role="root" and remap="doc" -->
+      </xsl:when><!-- end role="root" and remap="doc" -->
+<!--============================================================-->
       <xsl:when test="$current-instr[@role='root']">
+<!-- We have two cases, depending on the content: either a config instruction,
+     that we do not recorrd with porg (first case belaow), or a true install
+     instruction (otherwise below) -->
         <xsl:choose>
+<!--____________________________________________________________ -->
           <xsl:when test="contains(string($current-instr),'useradd') or
                           contains(string($current-instr),'groupadd') or
                           contains(string($current-instr),'usermod') or
@@ -148,6 +163,7 @@
               <xsl:with-param name="doc-seen" select="boolean(0)"/>
             </xsl:call-template>
           </xsl:when><!-- end config as root -->
+<!--____________________________________________________________ -->
           <xsl:otherwise><!-- we have a true install instruction -->
             <xsl:if test="$test-seen">
               <xsl:call-template name="end-test">
@@ -195,8 +211,10 @@
               <xsl:with-param name="doc-seen" select="boolean(0)"/>
             </xsl:call-template>
           </xsl:otherwise><!-- end true install instruction -->
+<!--____________________________________________________________ -->
         </xsl:choose>
       </xsl:when><!-- role="root" and no remap -->
+<!--============================================================-->
       <xsl:when test="$current-instr[@remap='test'] or
                       $current-instr/self::command">
         <xsl:if test="$install-seen">
@@ -220,14 +238,15 @@
             <xsl:with-param name="want-stats" select="$want-stats"/>
           </xsl:call-template>
         </xsl:if>
-        <xsl:choose>
-          <xsl:when test="$want-stats">
-            <xsl:apply-templates select="$current-instr"/>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:apply-templates select="$current-instr" mode="comment-out"/>
-          </xsl:otherwise>
-        </xsl:choose>
+<!-- We first apply normal templates, and save the result in a variable -->
+        <xsl:variable name="processed-instr">
+          <xsl:apply-templates select="$current-instr"/>
+        </xsl:variable>
+<!-- We then process as a test instruction -->
+        <xsl:call-template name="process-test">
+          <xsl:with-param name="test-instr" select="$processed-instr"/>
+          <xsl:with-param name="want-stats" select="$want-stats"/>
+        </xsl:call-template>
         <xsl:call-template name="process-install">
           <xsl:with-param
              name="instruction-tree"
@@ -238,7 +257,8 @@
           <xsl:with-param name="test-seen" select="boolean(1)"/>
           <xsl:with-param name="doc-seen" select="boolean(0)"/>
         </xsl:call-template>
-      </xsl:when><!-- no role, remap=test -->
+      </xsl:when><!-- end no role, remap=test -->
+<!--============================================================-->
       <xsl:when test="$current-instr[@remap='doc']">
         <xsl:if test="$install-seen">
           <xsl:call-template name="end-install"/>
@@ -261,14 +281,15 @@
             <xsl:with-param name="want-stats" select="$want-stats"/>
           </xsl:call-template>
         </xsl:if>
-        <xsl:choose>
-          <xsl:when test="$want-stats">
-            <xsl:apply-templates select="$current-instr"/>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:apply-templates select="$current-instr" mode="comment-out"/>
-          </xsl:otherwise>
-        </xsl:choose>
+<!-- We first apply normal templates, and save the result in a variable -->
+        <xsl:variable name="processed-instr">
+          <xsl:apply-templates select="$current-instr"/>
+        </xsl:variable>
+<!-- We then process as a doc instruction -->
+        <xsl:call-template name="process-doc">
+          <xsl:with-param name="doc-instr" select="$processed-instr"/>
+          <xsl:with-param name="want-stats" select="$want-stats"/>
+        </xsl:call-template>
         <xsl:call-template name="process-install">
           <xsl:with-param
              name="instruction-tree"
@@ -280,6 +301,7 @@
           <xsl:with-param name="doc-seen" select="boolean(1)"/>
         </xsl:call-template>
       </xsl:when><!-- no role, remap="doc" -->
+<!--============================================================-->
       <xsl:otherwise><!-- no role no remap -->
         <xsl:if test="$install-seen">
           <xsl:call-template name="end-install"/>
@@ -309,114 +331,116 @@
           <xsl:with-param name="doc-seen" select="boolean(0)"/>
         </xsl:call-template>
       </xsl:otherwise><!-- no role, no remap -->
+<!--============================================================-->
     </xsl:choose>
   </xsl:template>
 
-  <xsl:template match="userinput" mode="install-comment-out">
+  <xsl:template match="userinput" mode="install">
     <xsl:text>
 </xsl:text>
-    <xsl:call-template name="output-comment-out">
+    <xsl:call-template name="output-install">
       <xsl:with-param name="out-string" select="string()"/>
-      <xsl:with-param name="process" select="'install'"/>
     </xsl:call-template>
   </xsl:template>
 
-  <xsl:template match="userinput|command" mode="root-comment-out">
-    <xsl:text>
-</xsl:text>
-    <xsl:call-template name="output-comment-out">
-      <xsl:with-param name="out-string" select="string()"/>
-      <xsl:with-param name="process" select="'root'"/>
-    </xsl:call-template>
-  </xsl:template>
+<!-- userinput templates for mode="root" and normal are in scripts.xsl -->
 
-  <xsl:template match="userinput|command" mode="comment-out">
-    <xsl:text>
+  <xsl:template name="process-test">
+    <xsl:param name="test-instr"/>
+    <xsl:param name="want-stats"/>
+    <xsl:choose>
+      <!-- the string may begin with a linefeed -->
+      <xsl:when test="substring($test-instr,1,1)='&#xA;'">
+        <xsl:text>
 </xsl:text>
-    <xsl:call-template name="output-comment-out">
-      <xsl:with-param name="out-string" select="string()"/>
-      <xsl:with-param name="process" select="'none'"/>
-    </xsl:call-template>
+        <xsl:call-template name="process-test">
+          <xsl:with-param name="test-instr"
+                          select="substring-after($test-instr,'&#xA;')"/>
+          <xsl:with-param name="want-stats" select="$want-stats"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($test-instr,'&#xA;')">
+        <xsl:call-template name="process-test">
+          <xsl:with-param name="test-instr"
+                          select="substring-before($test-instr,'&#xA;')"/>
+          <xsl:with-param name="want-stats" select="$want-stats"/>
+        </xsl:call-template>
+        <xsl:text>
+</xsl:text>
+        <xsl:call-template name="process-test">
+          <xsl:with-param name="test-instr"
+                          select="substring-after($test-instr,'&#xA;')"/>
+          <xsl:with-param name="want-stats" select="$want-stats"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:if test="not($want-stats)">
+          <xsl:text>#</xsl:text>
+        </xsl:if>
+        <xsl:choose>
+          <xsl:when test="contains($test-instr,'make')
+                  and not(contains($test-instr,'make -k'))">
+            <xsl:copy-of select="substring-before($test-instr,'make')"/>
+            <xsl:text>make -k</xsl:text>
+            <xsl:copy-of select="substring-after($test-instr,'make')"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:copy-of select="$test-instr"/>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:if test="substring($test-instr,
+                                string-length($test-instr),
+                                1)!='\'">
+          <xsl:if test="$want-stats">
+            <xsl:text> &gt;&gt; $TESTLOG 2>&amp;1</xsl:text>
+          </xsl:if>
+          <xsl:text> || true</xsl:text>
+        </xsl:if>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:template>
 
-  <xsl:template match="userinput" mode="install">
-    <xsl:text>
-</xsl:text>
-    <xsl:call-template name="output-install">
-      <xsl:with-param name="out-string" select="string()"/>
-    </xsl:call-template>
+  <xsl:template name="process-doc">
+    <xsl:param name="doc-instr"/>
+    <xsl:param name="want-stats"/>
+    <xsl:choose>
+      <xsl:when test="$want-stats">
+        <xsl:copy-of select="$doc-instr"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="output-comment-out">
+          <xsl:with-param name="out-string" select="$doc-instr"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:template>
 
   <xsl:template name="output-comment-out">
-<!-- Output instructions with each line commented out. The "process"
-     parameter is:
-        none: only output commented-out and remove ampersand
-        root: output commented out and remove ampersand,
-              with escaping of \, $, and `
-        install: same + escape ' -->
+<!-- Output instructions with each line commented out. -->
     <xsl:param name="out-string"/>
-    <xsl:param name="process"/>
     <xsl:choose>
+      <!-- the string may begin with a linefeed -->
+      <xsl:when test="substring($out-string,1,1)='&#xA;'">
+        <xsl:text>
+</xsl:text>
+        <xsl:call-template name="output-comment-out">
+          <xsl:with-param name="out-string"
+                          select="substring-after($out-string,'&#xA;')"/>
+        </xsl:call-template>
+      </xsl:when>
       <xsl:when test="contains($out-string,'&#xA;')">
-        <xsl:choose>
-          <xsl:when test="$process='install'">
-            <xsl:call-template name="output-install">
-              <xsl:with-param
-                        name="out-string"
-                        select="concat('# ',
-                                        substring-before($out-string,'&#xA;')
-                                      )"/>
-            </xsl:call-template>
-          </xsl:when>
-          <xsl:when test="$process='root'">
-            <xsl:call-template name="output-root">
-              <xsl:with-param
-                        name="out-string"
-                        select="concat('# ',
-                                        substring-before($out-string,'&#xA;')
-                                      )"/>
-            </xsl:call-template>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:call-template name="remove-ampersand">
-              <xsl:with-param
-                        name="out-string"
-                        select="concat('# ',
-                                        substring-before($out-string,'&#xA;')
-                                      )"/>
-            </xsl:call-template>
-          </xsl:otherwise>
-        </xsl:choose>
+        <xsl:text>#</xsl:text>
+        <xsl:copy-of select="substring-before($out-string,'&#xA;')"/>
         <xsl:text>
 </xsl:text>
         <xsl:call-template name="output-comment-out">
-          <xsl:with-param
-                    name="out-string"
-                    select="substring-after($out-string,'&#xA;')"/>
-          <xsl:with-param name="process" select="$process"/>
+          <xsl:with-param name="out-string"
+                          select="substring-after($out-string,'&#xA;')"/>
         </xsl:call-template>
       </xsl:when>
       <xsl:otherwise>
-        <xsl:choose>
-          <xsl:when test="$process='install'">
-            <xsl:call-template name="output-install">
-              <xsl:with-param name="out-string"
-                              select="concat('# ',$out-string)"/>
-            </xsl:call-template>
-          </xsl:when>
-          <xsl:when test="$process='root'">
-            <xsl:call-template name="output-root">
-              <xsl:with-param name="out-string"
-                              select="concat('# ',$out-string)"/>
-            </xsl:call-template>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:call-template name="remove-ampersand">
-              <xsl:with-param name="out-string"
-                              select="concat('# ',$out-string)"/>
-            </xsl:call-template>
-          </xsl:otherwise>
-        </xsl:choose>
+        <xsl:text>#</xsl:text>
+        <xsl:copy-of select="$out-string"/>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>

Modified: jhalfs/trunk/BLFS/xsl/scripts.xsl
==============================================================================
--- jhalfs/trunk/BLFS/xsl/scripts.xsl   Wed Aug 14 03:32:59 2019        (r4117)
+++ jhalfs/trunk/BLFS/xsl/scripts.xsl   Sat Aug 17 01:30:36 2019        (r4118)
@@ -189,7 +189,8 @@
         <xsl:apply-templates select=".//screen[./userinput]"/>
       </xsl:when>
 
-      <xsl:when test="@role = 'installation'">
+      <xsl:when test="@role = 'installation' and
+                      not(preceding-sibling::sect2[@role = 'installation'])">
         <xsl:text>
 cd $BUILD_DIR
 find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>

Modified: jhalfs/trunk/pkgmngt/packInstall.sh.porg
==============================================================================
--- jhalfs/trunk/pkgmngt/packInstall.sh.porg    Wed Aug 14 03:32:59 2019        
(r4117)
+++ jhalfs/trunk/pkgmngt/packInstall.sh.porg    Sat Aug 17 01:30:36 2019        
(r4118)
@@ -116,7 +116,7 @@
 # name is not normalized, several hacks are necessary (now in function
 # extract_version)...
 VERSION=$(extract_version $PCKGVRS)
-porg -lp ${PACKAGE}-${VERSION} sh << PORG_EOF
+porg -+ -lp ${PACKAGE}-${VERSION} sh << PORG_EOF
 $*
 PORG_EOF
 }
-- 
http://lists.linuxfromscratch.org/listinfo/alfs-log
Unsubscribe: See the above information page

Reply via email to