Bruce Dubbs wrote:

> Yes, its possible.  The easiest way to do the xslt is to modify the xml. 
>   For instance, if we have:
> 
> <ulink url="&kdeaddons-download-http;"/>
> 
> We could change it to read:
> 
> <ulink role='download' revision='&kdeaddons-md5sum;' 
> url="&kdeaddons-download-http;"/>
> 
> we could extract to a file that has lines like:
> 
> kdeaddons-3.5.9.tar.bz2 eaa3832a25b483d1a9613f75991c3d7b
> 
> from there it would relatively easy to write a bash script to search for 
> the file on anduin and check the md5sum if found.  Then errors could be 
> sent to blfs-book.
> 
> It would be a fair amount of work to add the attributes to every place 
> that would need it, but if we had several editors working it, we could 
> do it fairly quickly.

Following up to my own post.  :)

If the above change was made, we can us a relatively simple xsl script:
------------
<?xml version='1.0' encoding='ISO-8859-1'?>

<!-- Create a list of upstream URLs of packages. -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
     version="1.0">

   <xsl:output method="text"/>

   <xsl:template match="/">
     <xsl:apply-templates select="//ulink"/>
   </xsl:template>

   <xsl:template match="ulink">
     <xsl:if test="contains(@role, 'download')">
        <xsl:value-of select="@url"/>
        <xsl:text> </xsl:text>
        <xsl:value-of select="@revision"/>
        <xsl:text>&#x0a;</xsl:text>
     </xsl:if>
   </xsl:template>

</xsl:stylesheet>
-----------

This can be invoked with:

xsltproc --xinclude --nonet --output ./test-list \
    downloads.xsl index.xml

and produces the file test-list with the contents like:

http://mirrors.isc.org/pub/kde/stable/3.5.9/src/kdeaddons-3.5.9.tar.bz2 
eaa3832a25b483d1a9613f75991c3d7b

(all on line line).

Then a simple bash routine similar to the following can be used:

  while read url md5; do
    echo `basename $url`
    echo $md5
  done < test-list 


to produce the filenames and md5sums.  These can in turn be used to 
check for the presence of the file on anduin and create the appropriate 
error message when files are not present or wrong.

The question is whether we want to go to the effort of changing all the 
ulink structures specified for download in all the packages.

Feedback welcome.

   -- Bruce
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to