[jhalfs] 09/09: Generate a test in the scriptlets

"Git Owner" ([email protected] via alfs-discuss Mailing List) <[email protected]> Fri, 31 Jan 2025 10:13:18 +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 plabs/check-version
in repository jhalfs.

commit 3006751e09e1fee0df185bc1d414a981a0b98415
Author: Pierre Labastie <[email protected]>
AuthorDate: Tue Jan 28 15:56:51 2025 +0100

    Generate a test in the scriptlets
    
    This is for checking a version mismatch between book and directory name.
    The preceding commits allow to do this check when downloading packages,
    but if "Retrieve source files" is not ticked, this is not done. In this
    case we do it in scriptlets. But we have to pass a parameter to the
    xsl stylesheet to tell to generate this test in scriptlet.
    
    This commit adds the parameter test-mismatch to the xsl stylesheet, and
    some code to generate the test in the scriptlet if test-mismatch is 'y'.
    
    Fixes #1740
---
 LFS/lfs.xsl | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/LFS/lfs.xsl b/LFS/lfs.xsl
index d99794d..0452aa4 100644
--- a/LFS/lfs.xsl
+++ b/LFS/lfs.xsl
@@ -84,6 +84,9 @@
   <!-- The scripts root is needed for printing disk usage -->
   <xsl:param name='script-root' select="'jhalfs'"/>
 
+  <!-- whether we should test for version vs directory name mismatch -->
+  <xsl:param name='test-mismatch' select="'n'"/>
+
 <!-- End parameters -->
 
 <!-- bashdir is used at the beginning of chapter 6, for the #! line.
@@ -1262,7 +1265,16 @@ if [ -d "$PKGDIR" ]; then rm -rf $PKGDIR; fi
 if [ -d "$PKG_DEST" ]; then rm -rf $PKG_DEST; fi
 if [ -d "${PKGDIR%-*}-build" ]; then  rm -rf ${PKGDIR%-*}-build; fi
 </xsl:text>
+      <xsl:if test="$test-mismatch='y'">
+        <xsl:text>
+if [ "${PKGDIR%$VERSION}" = "$PKGDIR" ]; then
+    echo Mismatch between version and directory name ! Exiting...
+    exit 2
+fi
+</xsl:text>
+      </xsl:if>
     </xsl:if>
+
     <xsl:text>
 echo "KB: $(du -skx --exclude=lost+found --exclude=var/lib --exclude=$SCRIPT_ROOT $ROOT)"
 </xsl:text>

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