[jhalfs] 02/03: Add the possibility to keep build dirs in chapter 8

"Git Owner" ([email protected] via alfs-discuss Mailing List) <[email protected]> Sun, 23 Feb 2025 14:44:48 +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 13e77fe52cfa905edc70c4cb2dc6031ce2a50463
Author: Pierre Labastie <[email protected]>
AuthorDate: Sun Feb 23 15:39:43 2025 +0100

    Add the possibility to keep build dirs in chapter 8
    
    Add a new user definable parameter allowing to not remove the
    build idrectory at the end of the script for chapter 8 scriptlets.
    
    Fixes #1746
---
 Config.in                            | 11 +++++++++++
 LFS/lfs.xsl                          | 13 +++++++++++--
 common/libs/func_book_parser         |  1 +
 common/libs/func_validate_configs.sh |  2 +-
 jhalfs                               |  1 +
 5 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/Config.in b/Config.in
index 98cea5a..d68812a 100644
--- a/Config.in
+++ b/Config.in
@@ -570,6 +570,17 @@ depends on !BOOK_BLFS
         default    "2"    if TST_2
     #--- End Test Suites
 
+    #--- Keep dirs in chapter eight
+    config KEEPDIR
+        bool     "Keep build directory in chapter 8"
+        default n
+        help
+            If you check this option, the build directories will not
+            be removed after installation of packages in chapter 8.
+            This is for being able to debug failed tests or other non
+            fatal failures. But mhis lay consume a lot of disk space.
+    #--- End Keep dirs in chapter eight
+
     #--- Package Management
     config  PKGMNGT
         bool    "Package management"
diff --git a/LFS/lfs.xsl b/LFS/lfs.xsl
index a2c389f..4a6b6f4 100644
--- a/LFS/lfs.xsl
+++ b/LFS/lfs.xsl
@@ -34,6 +34,9 @@
   -->
   <xsl:param name="testsuite" select="1"/>
 
+  <!-- Should we keep build directories in chapter 8 ? -->
+  <xsl:param name="keepdir" select="'n'"/>
+
   <!-- Parallelism (LFS >= 12.1) -->
   <xsl:param name="jobs" select="1"/>
 
@@ -192,7 +195,9 @@ otherwise it is in /bin.-->
       </xsl:if>
       <xsl:if test="ancestor::chapter/@id != 'chapter-final-preps'">
         <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
-        <xsl:call-template name="end-script"/>
+        <xsl:call-template name="end-script">
+          <xsl:with-param name="chap-num" select="$chap-num"/>
+        </xsl:call-template>
       </xsl:if>
       <xsl:text>exit&#xA;</xsl:text>
     </exsl:document>
@@ -1313,6 +1318,7 @@ export MAKEFLAGS="-j</xsl:text>
   </xsl:template>
 
   <xsl:template name="end-script">
+    <xsl:param name="chap-num" select="5"/>
     <xsl:text>
 # End of LFS book script
 
@@ -1320,9 +1326,12 @@ echo "KB: $(du -skx --exclude=lost+found --exclude=var/lib --exclude=$SCRIPT_ROO
 </xsl:text>
     <xsl:if test="sect2[@role='installation']">
       <xsl:text>cd $SRC_DIR
-rm -rf $PKGDIR
+</xsl:text>
+      <xsl:if test="$keepdir!='y' or $chap-num!=8">
+        <xsl:text>rm -rf $PKGDIR
 if [ -d "${PKGDIR%-*}-build" ]; then  rm -rf ${PKGDIR%-*}-build; fi
 </xsl:text>
+      </xsl:if>
     </xsl:if>
   </xsl:template>
 
diff --git a/common/libs/func_book_parser b/common/libs/func_book_parser
index 62fd284..26eb88f 100644
--- a/common/libs/func_book_parser
+++ b/common/libs/func_book_parser
@@ -85,6 +85,7 @@ extract_commands() {         #
   xsltproc --nonet                                      \
            --stringparam luser-lgroup   "$LUSER:$LGROUP"\
            --stringparam testsuite      "$TEST"         \
+           --stringparam keepdir        "$KEEPDIR"      \
            --stringparam ncurses5       "$NCURSES5"     \
            --stringparam strip          "$STRIP"        \
            --stringparam del-la-files   "$DEL_LA_FILES" \
diff --git a/common/libs/func_validate_configs.sh b/common/libs/func_validate_configs.sh
index 0a57cfc..741f6f4 100644
--- a/common/libs/func_validate_configs.sh
+++ b/common/libs/func_validate_configs.sh
@@ -29,7 +29,7 @@ inline_doc
   local -r   LFS_book="$BOOK_common INITSYS BLFS_TOOL"
 
   # Build Settings by book
-  local -r   LFS_build="$BUILD_chroot NCURSES5 $BUILD_common PKGMNGT FULL_LOCALE WRAP_INSTALL"
+  local -r   LFS_build="$BUILD_chroot NCURSES5 $BUILD_common KEEPDIR PKGMNGT FULL_LOCALE WRAP_INSTALL"
 
   # System Settings by book
   local -r LFS_system="HOSTNAME INTERFACE IP_ADDR GATEWAY PREFIX BROADCAST DOMAIN DNS1 DNS2 FONT KEYMAP LOCAL LOG_LEVEL"
diff --git a/jhalfs b/jhalfs
index 662ff9b..b27e2cf 100755
--- a/jhalfs
+++ b/jhalfs
@@ -154,6 +154,7 @@ RUNMAKE=${RUNMAKE:-n}
 GETPKG=${GETPKG:-n}
 COMPARE=${COMPARE:-n}
 RUN_ICA=${RUN_ICA:-n}
+KEEPDIR=${KEEPDIR:-n}
 PKGMNGT=${PKGMNGT:-n}
 WRAP_INSTALL=${WRAP_INSTALL:-n}
 STRIP=${STRIP:=n}

-- 
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