[jhalfs] 01/02: blfs-tools: process all role="installation" sect2

"Git Owner" ([email protected] via alfs-discuss Mailing List) <[email protected]> Sat, 22 Mar 2025 13:24:32 +0000
Newsgroups gmane.linux.lfs.automated
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch trunk
in repository jhalfs.

commit 581da28961558fc31b8825a64181e94814989f83
Author: Pierre Labastie <[email protected]>
AuthorDate: Sat Mar 22 14:02:22 2025 +0100

    blfs-tools: process all role="installation" sect2
    
    Previously, in scripts.xsl, we had a case for role="installation"
    and not preceding-siblings::sect2[@role="installation"]. But
    no case when there was a preceding sect2 with role="installation".
    We remove the condition that there is such a preceding sect2, and
    replace with a "if" that allows the first such sect2 to call a
    template that generates the unpack code.
    When logging size/time information, log also the title of the
    sect2.
---
 BLFS/xsl/scripts.xsl | 109 ++++++++++++++++++++++++++++-----------------------
 1 file changed, 61 insertions(+), 48 deletions(-)

diff --git a/BLFS/xsl/scripts.xsl b/BLFS/xsl/scripts.xsl
index f923a1a..77a1814 100644
--- a/BLFS/xsl/scripts.xsl
+++ b/BLFS/xsl/scripts.xsl
@@ -321,59 +321,19 @@ cd $SRC_DIR</xsl:text>
         <xsl:apply-templates select=".//screen[./userinput]"/>
       </xsl:when>
 
-      <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>
-        <xsl:if test="$sudo='y'">
-          <xsl:text>sudo </xsl:text>
-        </xsl:if>
-        <xsl:text>rm -rf
-</xsl:text>
-        <!-- If stats are requested, insert the start size -->
-        <xsl:if test="$want-stats">
-          <xsl:text>
-echo Start Size: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG
-</xsl:text>
+      <xsl:when test="@role = 'installation'">
+        <xsl:if test="not(preceding-sibling::sect2[@role = 'installation'])">
+          <xsl:call-template name="unpack">
+            <xsl:with-param name="want-stats" select="$want-stats"/>
+          </xsl:call-template>
         </xsl:if>
 
-        <xsl:text>
-case $PACKAGE in
-  *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
-     tar -xvf $SRC_DIR/$PACKAGE &gt; unpacked
-     JH_UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
-     ;;
-  *.tar.lz)
-     bsdtar -xvf $SRC_DIR/$PACKAGE 2&gt; unpacked
-     JH_UNPACKDIR=`head -n1 unpacked | cut  -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
-     ;;
-  *.zip)
-     bsdtar --list -f $SRC_DIR/$PACKAGE &gt; unpacked
-     JH_UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
-     if test $(wc -w &lt;&lt;&lt; $JH_UNPACKDIR) -eq 1; then
-       unzip $SRC_DIR/$PACKAGE
-     else
-       JH_UNPACKDIR=${PACKAGE%.zip}
-       unzip -d $JH_UNPACKDIR $SRC_DIR/$PACKAGE
-     fi
-     ;;
-  *)
-     JH_UNPACKDIR=$JH_PKG_DIR-build
-     mkdir $JH_UNPACKDIR
-     cp $SRC_DIR/$PACKAGE $JH_UNPACKDIR
-     ADDITIONAL="$(find . -mindepth 1 -maxdepth 1 -type l)"
-     if [ -n "$ADDITIONAL" ]; then
-         cp $ADDITIONAL $JH_UNPACKDIR
-     fi
-     ;;
-esac
-export JH_UNPACKDIR
-cd $JH_UNPACKDIR
-</xsl:text>
         <!-- If stats are requested, insert the start time -->
         <xsl:if test="$want-stats">
           <xsl:text>
+echo Starting \"</xsl:text>
+	  <xsl:value-of select="./title"/>
+	  <xsl:text>\" >> $INFOLOG
 echo Start Time: ${SECONDS} >> $INFOLOG
 </xsl:text>
         </xsl:if>
@@ -1155,4 +1115,57 @@ pip3 install -I --root $PKG_DEST</xsl:text>
     </xsl:choose>
   </xsl:template>
 
+  <xsl:template name="unpack">
+    <xsl:param name="want-stats" select="false"/>
+    <xsl:text>
+cd $BUILD_DIR
+find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
+    <xsl:if test="$sudo='y'">
+      <xsl:text>sudo </xsl:text>
+    </xsl:if>
+    <xsl:text>rm -rf
+</xsl:text>
+        <!-- If stats are requested, insert the start size -->
+    <xsl:if test="$want-stats">
+      <xsl:text>
+echo Start Size: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG
+</xsl:text>
+    </xsl:if>
+
+    <xsl:text>
+case $PACKAGE in
+  *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
+     tar -xvf $SRC_DIR/$PACKAGE &gt; unpacked
+     JH_UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
+     ;;
+  *.tar.lz)
+     bsdtar -xvf $SRC_DIR/$PACKAGE 2&gt; unpacked
+     JH_UNPACKDIR=`head -n1 unpacked | cut  -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
+     ;;
+  *.zip)
+     bsdtar --list -f $SRC_DIR/$PACKAGE &gt; unpacked
+     JH_UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
+     if test $(wc -w &lt;&lt;&lt; $JH_UNPACKDIR) -eq 1; then
+       unzip $SRC_DIR/$PACKAGE
+     else
+       JH_UNPACKDIR=${PACKAGE%.zip}
+       unzip -d $JH_UNPACKDIR $SRC_DIR/$PACKAGE
+     fi
+     ;;
+  *)
+     JH_UNPACKDIR=$JH_PKG_DIR-build
+     mkdir $JH_UNPACKDIR
+     cp $SRC_DIR/$PACKAGE $JH_UNPACKDIR
+     ADDITIONAL="$(find . -mindepth 1 -maxdepth 1 -type l)"
+     if [ -n "$ADDITIONAL" ]; then
+         cp $ADDITIONAL $JH_UNPACKDIR
+     fi
+     ;;
+esac
+export JH_UNPACKDIR
+cd $JH_UNPACKDIR
+</xsl:text>
+
+  </xsl:template>
+
 </xsl:stylesheet>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

-- 
http://lists.linuxfromscratch.org/sympa/info/alfs-discuss
Unsubscribe: See the above information page