[lfs] branch trunk updated: Make wget-list.xsl and md5sums.xsl more robust

git Owner ([email protected] via lfs-book Mailing List) <[email protected]> Thu, 16 Jul 2026 06:06:09 +0000
Newsgroups gmane.linux.lfs.book
Message-ID <178418196911.3792227.4537515504464589141@rivendell.linuxfromscratch.org>
This is a multi-part message in MIME format...

------------=_1784181973-1024790-4414
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch trunk
in repository lfs.

The following commit(s) were added to refs/heads/trunk by this push:
     new e86e9c4f2 Make wget-list.xsl and md5sums.xsl more robust
e86e9c4f2 is described below

commit e86e9c4f234da49334a16ea6a93da0f1d519a688
Author: Pierre Labastie <[email protected]>
AuthorDate: Wed Jul 15 23:45:46 2026 +0200

    Make wget-list.xsl and md5sums.xsl more robust
    
    Those stylesheets selected download urls by seeking some pattern
    in their content. Those patterns may need to be adjusted if a new
    type of file is downloaded.
    
    We prefer to seek urls inside <para> containing "Download",
    which is the norm in chapter 3. The condition is also that those
    <para> are in a <listitem>.
---
 stylesheets/md5sum.xsl    | 8 ++------
 stylesheets/wget-list.xsl | 8 ++------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/stylesheets/md5sum.xsl b/stylesheets/md5sum.xsl
index 1e428262b..4f2e8e22f 100644
--- a/stylesheets/md5sum.xsl
+++ b/stylesheets/md5sum.xsl
@@ -8,18 +8,14 @@
   <xsl:output method="text"/>
 
   <xsl:template match="/">
-    <xsl:apply-templates select="//ulink"/>
+    <xsl:apply-templates select="//listitem/para[contains(string(),'Download')]/ulink"/>
   </xsl:template>
 
   <xsl:template match="ulink">
       <!-- If some package don't have the predefined strings in their
       name, the next test must be fixed to match it also. Skip possible
       duplicated URLs that may be split for PDF output -->
-    <xsl:if test="( (contains( @url, '.tar.' ) and not( ancestor::note ) ) or
-                    contains( @url, '.zip'   )                             or
-                    contains( @url, '.patch' ) 
-                  ) and 
-                    not( ancestor-or-self::*/@condition = 'pdf' )" >
+    <xsl:if test="not( ancestor-or-self::*/@condition = 'pdf' )" >
       <!-- Get the md5sum -->
       <xsl:value-of select="../../para/literal"/>
 
diff --git a/stylesheets/wget-list.xsl b/stylesheets/wget-list.xsl
index f9f17b08b..272b66df1 100644
--- a/stylesheets/wget-list.xsl
+++ b/stylesheets/wget-list.xsl
@@ -9,18 +9,14 @@
   <xsl:output method="text"/>
 
   <xsl:template match="/">
-    <xsl:apply-templates select="//ulink"/>
+    <xsl:apply-templates select="//listitem/para[contains(string(),'Download')]/ulink"/>
   </xsl:template>
 
   <xsl:template match="ulink">
       <!-- If some package don't have the predefined strings in their
       name, the next test must be fixed to match it also. Skip possible
       duplicated URLs due that may be split for PDF output -->
-    <xsl:if test="( (contains(@url, '.tar.') and not( ancestor::note ) ) or
-                    contains(@url, '.zip'  )                             or
-                    contains(@url, '.patch')
-                  ) and
-                    not(ancestor-or-self::*/@condition = 'pdf')">
+    <xsl:if test="not(ancestor-or-self::*/@condition = 'pdf')">
       <xsl:choose>
         <xsl:when test="contains(@url,'?download')">
           <xsl:value-of select="substring-before(@url,'?download')"/>

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

------------=_1784181973-1024790-4414
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0

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

------------=_1784181973-1024790-4414--