[Clfs-dev] [PATCH] md5sum checksum improvement
Cheng Renquan
crquan at gmail.com
Wed Jul 15 20:38:43 PDT 2009
The md5sums of every packages and patches are already recorded in the BOOK,
but they have few opportunies to be checked,
Here is a new stylesheet md5sum.xsl, to parse md5sum values of every packages
and patches from the BOOK and output a md5sum recognizable file, so after we
downloaded all packages and patches, we can just check them.
This is a very preliminary idea, and need more work to integrate into the
BOOK Makefile, and here is the usage to produce a mips64.md5sum:
$ xsltproc --xinclude --nonet --output mips64.md5sum \
stylesheets/md5sum.xsl materials/mips64-chapter.xml
Using this, I found the error in the previous eglibc-ports-md5sum fix patch.
Signed-off-by: Cheng Renquan <crquan at gmail.com>
---
diff --git a/BOOK/stylesheets/md5sum.xsl b/BOOK/stylesheets/md5sum.xsl
new file mode 100644
index 0000000..b9d69a0
--- /dev/null
+++ b/BOOK/stylesheets/md5sum.xsl
@@ -0,0 +1,67 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!DOCTYPE xsl:stylesheet [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<!--
+XSLT stylesheet to create md5sum file for packages and patches to check integrity.
+Only for Cross-LFS.
+
+Usage example:
+
+xsltproc -xinclude -nonet -output mips64.md5sum stylesheets/md5sum.xsl materials/mips64-chapter.xml
+-->
+
+<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 name="filename-basename">
+ <!-- We assume all filenames are really URIs and use "/" -->
+ <xsl:param name="filename"></xsl:param>
+ <xsl:param name="recurse" select="false()"/>
+
+ <xsl:choose>
+ <xsl:when test="contains($filename, '/')">
+ <xsl:call-template name="filename-basename">
+ <xsl:with-param name="filename"
+ select="substring-after($filename, '/')"/>
+ <xsl:with-param name="recurse" select="true()"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="contains($filename, '?')">
+ <xsl:value-of select="substring-before($filename,'?')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$filename"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="ulink">
+ <!-- Packages. If some package don't have the string ".tar." in their
+ name, the next test must be fixed to match it also. -->
+ <xsl:if test="contains(@url, '.tar.') or contains(@url, '.tgz')
+ or contains(@url, '.patch') and contains(@url, '&patches-root;')
+ and not(ancestor-or-self::*/@condition = 'pdf')">
+ <xsl:value-of select="../following-sibling::para/literal"/>
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="filename-basename">
+ <xsl:with-param name="filename" select="@url"/>
+ <xsl:with-param name="recurse" select="true()"/>
+ </xsl:call-template>
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
--
Cheng Renquan, Shenzhen, China
More information about the Clfs-dev
mailing list