r6464 - in trunk/BOOK: . stylesheets

manuel at linuxfromscratch.org manuel at linuxfromscratch.org
Thu Jan 25 11:55:05 PST 2007


Author: manuel
Date: 2007-01-25 12:55:05 -0700 (Thu, 25 Jan 2007)
New Revision: 6464

Modified:
   trunk/BOOK/Makefile
   trunk/BOOK/stylesheets/wget-list.xsl
Log:
Fixed some missing links in wget-list target.
Added test-links target.

Modified: trunk/BOOK/Makefile
===================================================================
--- trunk/BOOK/Makefile	2007-01-24 22:21:51 UTC (rev 6463)
+++ trunk/BOOK/Makefile	2007-01-25 19:55:05 UTC (rev 6464)
@@ -44,9 +44,6 @@
 	  sed -i -e "s at text/html at application/xhtml+xml at g" $$filename; \
 	done;
 
-wget-list:
-	mkdir -p $(BASEDIR)
-	xsltproc --xinclude --nonet stylesheets/wget-list.xsl index.xml > $(BASEDIR)/wget-list
 
 nochunks:
 	@echo "Generating nochunks version of BLFS..."
@@ -109,4 +106,25 @@
 	sort blfs-patches > blfs-patch-list
 	rm blfs-patches
 
-.PHONY : blfs-patch-list
+wget-list:
+	mkdir -p $(BASEDIR)
+	xsltproc --xinclude --nonet stylesheets/wget-list.xsl index.xml > $(BASEDIR)/wget-list
+
+test-links:
+	mkdir -p $(BASEDIR)
+	xsltproc --xinclude --nonet --stringparam list_mode full \
+	    stylesheets/wget-list.xsl index.xml > $(BASEDIR)/test-links
+	for URL in `cat $(BASEDIR)/test-links`; do \
+	    wget --spider --tries=2 --timeout=60 $$URL >>/dev/null 2>&1; \
+	    if test $$? -ne 0 ; then echo $$URL >> $(BASEDIR)/bad_urls ; \
+	    else echo $$URL >> $(BASEDIR)/good_urls 2>&1; \
+	    fi; \
+	done
+	for URL2 in `cat $(BASEDIR)/bad_urls`; do \
+	    wget --spider --tries=2 --timeout=60 $$URL2 >>/dev/null 2>&1; \
+	    if test $$? -ne 0 ; then echo $$URL2 >> $(BASEDIR)/true_bad_urls ; \
+	    else echo $$URL2 >> $(BASEDIR)/good_urls 2>&1; \
+	    fi; \
+	done
+
+.PHONY : blfs-patch-list wget-list test-links

Modified: trunk/BOOK/stylesheets/wget-list.xsl
===================================================================
--- trunk/BOOK/stylesheets/wget-list.xsl	2007-01-24 22:21:51 UTC (rev 6463)
+++ trunk/BOOK/stylesheets/wget-list.xsl	2007-01-25 19:55:05 UTC (rev 6464)
@@ -13,8 +13,21 @@
 
   <xsl:output method="text"/>
 
+  <!-- Define the generated wget file type:
+       ftpmirror - the one used to check FTP mirrors (default)
+       full - the one used to test all download links found in the book
+  -->
+  <xsl:param name="list_mode" select="ftpmirror"/>
+
   <xsl:template match="/">
-    <xsl:apply-templates select="//itemizedlist"/>
+    <xsl:choose>
+      <xsl:when test="$list_mode = 'full'">
+       <xsl:apply-templates select="//ulink" mode="full"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates select="//itemizedlist"/>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:template>
 
   <xsl:template match="itemizedlist">
@@ -40,12 +53,14 @@
   </xsl:template>
 
   <xsl:template match="listitem/para/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 splitted for PDF output -->
-    <xsl:if test="(contains(@url, '.tar.') or contains(@url, '.tgz')
-                  or contains(@url, '.zip') or contains(@url, '.patch')) and
-                  not(ancestor-or-self::*/@condition = 'pdf')">
+      <!-- The next strings need be revised periodically to add missing
+      files or to skip false positives. Skip also possible
+      duplicated URLs that may be splitted for PDF output -->
+    <xsl:if test="(contains(@url, '.gz') or contains(@url, '.bz2')
+                  or contains(@url, '.tgz') or contains(@url, '.tar')
+                  or contains(@url, 'patch.txt') or contains(@url, '.zip')
+                  or contains(@url, '.patch') or contains(@url, '/patch.'))
+                  and not(ancestor-or-self::*/@condition = 'pdf')">
       <xsl:choose>
         <!-- Fix SourceForge links-->
         <xsl:when test="contains(@url,'?download')">
@@ -59,5 +74,26 @@
     </xsl:if>
   </xsl:template>
 
+  <xsl:template match="ulink" mode="full">
+      <!-- The next strings need be revised periodically to add missing
+      files or to skip false positives. Skip also possible
+      duplicated URLs that may be splitted for PDF output -->
+    <xsl:if test="(contains(@url, '.gz') or contains(@url, '.bz2')
+                  or contains(@url, '.tgz') or contains(@url, '.tar')
+                  or contains(@url, '.txt') or contains(@url, 'compressdoc')
+                  or contains(@url, '.zip') or contains(@url, '.patch')
+                  or contains(@url, '/patch.') or contains(@url, 'md5sums')
+                  or contains(@url, 'mozconfig'))
+                  and not(contains(@url, '?url'))
+                  and not(ancestor-or-self::*/@condition = 'pdf')">
+      <!-- To list all URls, included html files, wiki pages, home pages, and
+      mailto: links, comment-out the above xsl:if and uncomment the next one. -->
+    <!--
+    <xsl:if test="not(ancestor-or-self::*/@condition = 'pdf')">
+    -->
+      <xsl:value-of select="@url"/>
+      <xsl:text>&#x0a;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
 </xsl:stylesheet>
-




More information about the blfs-book mailing list