r3567 - in jhalfs/branches/ablfs: . BLFS BLFS/libs BLFS/xsl

pierre at linuxfromscratch.org pierre at linuxfromscratch.org
Wed Feb 22 09:09:51 PST 2012


Author: pierre
Date: 2012-02-22 10:09:47 -0700 (Wed, 22 Feb 2012)
New Revision: 3567

Added:
   jhalfs/branches/ablfs/BLFS/gen-special.sh
   jhalfs/branches/ablfs/BLFS/packdesc.dtd
   jhalfs/branches/ablfs/BLFS/xsl/
   jhalfs/branches/ablfs/BLFS/xsl/bump.xsl
   jhalfs/branches/ablfs/BLFS/xsl/dependencies.xsl
   jhalfs/branches/ablfs/BLFS/xsl/gen_config.xsl
   jhalfs/branches/ablfs/BLFS/xsl/gen_pkg_list.xsl
   jhalfs/branches/ablfs/BLFS/xsl/make_book.xsl
   jhalfs/branches/ablfs/BLFS/xsl/scripts.xsl
Removed:
   jhalfs/branches/ablfs/BLFS/gen_config.sh
   jhalfs/branches/ablfs/BLFS/libs/book.xsl
   jhalfs/branches/ablfs/BLFS/libs/dependencies.xsl
   jhalfs/branches/ablfs/BLFS/libs/func_packages
   jhalfs/branches/ablfs/BLFS/libs/func_parser
   jhalfs/branches/ablfs/BLFS/libs/scripts.xsl
   jhalfs/branches/ablfs/BLFS/update_book.sh
Modified:
   jhalfs/branches/ablfs/BLFS/Makefile
   jhalfs/branches/ablfs/BLFS/envars.conf
   jhalfs/branches/ablfs/BLFS/gen-makefile.sh
   jhalfs/branches/ablfs/BLFS/gen_pkg_book.sh
   jhalfs/branches/ablfs/BLFS/libs/func_dependencies
   jhalfs/branches/ablfs/README.BLFS
   jhalfs/branches/ablfs/README.PACKAGE_MANAGEMENT
   jhalfs/branches/ablfs/jhalfs
Log:
Initial modificaiton of BLFS tools

Modified: jhalfs/branches/ablfs/BLFS/Makefile
===================================================================
--- jhalfs/branches/ablfs/BLFS/Makefile	2012-02-22 16:44:36 UTC (rev 3566)
+++ jhalfs/branches/ablfs/BLFS/Makefile	2012-02-22 17:09:47 UTC (rev 3567)
@@ -1,40 +1,110 @@
 # From the Build Scripts Written By: Jim Gifford <lfs at jg555.com>
 # Modified By: Joe Ciccone <jciccone at linuxfromscratch.org
 # Additional changes: George Boudreau <georgeb at linuxfromscratch.org>
+#                     Pierre Labastie <pierre.labastie at neuf.fr>
 
-# $Id$
+# $Id: Makefile 36 2012-02-22 13:01:46Z labastie $
 
+ifdef V
+  Q =
+else
+  Q = @
+endif
+
 LANG=C
 LC_ALL=C
+TRACKING_DIR = tracking-dir
 TOPDIR=$(shell pwd)
-CONFIG_CONFIG_IN = Config.in
-CONFIG = menu
+BLFS_XML = $(TOPDIR)/blfs-xml
+XSLDIR = $(TOPDIR)/xsl
 
-all: 	menuconfig
+RENDERTMP = $(BLFS_XML)/tmp
+BLFS_FULL = $(RENDERTMP)/blfs-full.xml
+PACK_LIST = $(TOPDIR)/packages.xml
+MENU = $(TOPDIR)/menu
+CONFIG_CONFIG_IN = $(TOPDIR)/Config.in
+CONFIG_OUT = $(TOPDIR)/configuration
+BOOK_XML = $(TOPDIR)/book.xml
+TRACKFILE = $(TRACKING_DIR)/instpkg.xml
 
-$(CONFIG)/conf:
-	$(MAKE) -B -C $(CONFIG) conf
+define INITIAL_TRACK
+<?xml version="1.0" encoding="ISO-8859-1"?>\
+\
+<!DOCTYPE sublist SYSTEM "$(TOPDIR)/packdesc.dtd">\
+<sublist>\
+  <name>Installed</name>\
+</sublist>
+endef
 
-$(CONFIG)/mconf:
-	$(MAKE) -B -C $(CONFIG) ncurses conf mconf
+SVN = svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK
 
-menuconfig: $(CONFIG)/mconf
-	@./update_book.sh none
-	@./gen_config.sh
-	@$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
-	@./gen_pkg_book.sh
+ALLXML := $(filter-out $(RENDERTMP)/%, \
+	$(wildcard $(BLFS_XML)/*.xml $(BLFS_XML)/*/*.xml $(BLFS_XML)/*/*/*.xml $(BLFS_XML)/*/*/*/*.xml $(BLFS_XML)/*/*/*/*/*.xml))
+ALLXSL := $(filter-out $(RENDERTMP)/%, \
+        $(wildcard $(BLFS_XML)/*.xsl $(BLFS_XML)/*/*.xsl $(BLFS_XML)/*/*/*.xsl $(BLFS_XML)/*/*/*/*.xsl $(BLFS_XML)/*/*/*/*/*.xsl))
 
-config: $(CONFIG)/conf
-	@$(CONFIG)/conf $(CONFIG_CONFIG_IN)
+$(BOOK_XML): $(CONFIG_OUT)
+	$(Q)$(TOPDIR)/gen_pkg_book.sh $(TOPDIR) $(BLFS_FULL)
 
+$(CONFIG_OUT): $(CONFIG_CONFIG_IN) $(MENU)/mconf
+	$(Q)$(MENU)/mconf $(CONFIG_CONFIG_IN)
+
+$(MENU)/mconf:
+	$(Q)$(MAKE) -C $(MENU) ncurses conf mconf
+
+$(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl
+	$(Q)xsltproc --nonet -o $@ $(XSLDIR)/gen_config.xsl $(PACK_LIST)
+
+$(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE)
+	$(Q)xsltproc --stringparam installed-packages $(TRACKFILE) \
+	-o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL)
+	$(Q)xmllint --postvalid --format -o $@ $@.tmp
+	$(Q)rm $@.tmp
+
+$(TRACKFILE): $(TRACKING_DIR)
+	$(Q)if ! [ -f $@ ]; then \
+	echo Initializing $(TRACKFILE) && \
+	echo '$(INITIAL_TRACK)' > $@ && \
+	$(MAKE) $(PACK_LIST) && \
+	for track in $(TRACKING_DIR)/*-*; do \
+	pack=$$(echo $$track | sed 's at .*/\(.*\)-[0-9c].*@\1@') && \
+	xsltproc --stringparam packages $(PACK_LIST) \
+	--stringparam package $$pack \
+	-o track.tmp $(XSLDIR)/bump.xsl $@ && \
+	sed -i 's at PACKDESC@$(TOPDIR)/packdesc.dtd@' track.tmp && \
+	xmllint --format --postvalid track.tmp > $@; \
+	done; \
+	rm -f track.tmp; \
+	fi
+
+$(TRACKING_DIR):
+	@echo Creating $(TRACKING_DIR)
+	$(Q)mkdir -p $@
+
+$(XSLDIR)/specialCases.xsl: $(TOPDIR)/gen-special.sh $(BLFS_FULL)
+	$(Q)$(TOPDIR)/gen-special.sh $(BLFS_FULL) $@
+
+$(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL)
+	@echo "Validating the book..."
+	$(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
+	$(Q)xmllint --nonet --noent --xinclude --postvalid \
+	  -o $@ $(BLFS_XML)/index.xml
+
+all: update $(BOOK_XML)
+
+update: $(BLFS_XML)
+	@echo Updating the book sources
+	$(Q)cd $(BLFS_XML) && svn up
+
+$(BLFS_XML):
+	@echo Getting the book sources...
+	$(Q)svn co $(SVN) $@
+
 # Clean up
 
 clean:
-	rm -f configuration configuration.old error
-	- $(MAKE) -C $(CONFIG) clean
+	rm -f $(CONFIG_OUT) $(CONFIG_OUT).old $(TOPDIR)/packages.xml $(XSLDIR)/specialCases.xsl $(CONFIG_CONFIG_IN) book.xml
+	rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts
+	- $(MAKE) -C $(MENU) clean
 
-clean-target:
-	rm -f error
-	- $(MAKE) -C $(CONFIG) clean
-
-.PHONY: all menuconfig config clean clean-target $(CONFIG)/conf $(CONFIG)/mconf
+.PHONY: clean all update $(CONFIG_OUT)

Modified: jhalfs/branches/ablfs/BLFS/envars.conf
===================================================================
--- jhalfs/branches/ablfs/BLFS/envars.conf	2012-02-22 16:44:36 UTC (rev 3566)
+++ jhalfs/branches/ablfs/BLFS/envars.conf	2012-02-22 17:09:47 UTC (rev 3567)
@@ -16,7 +16,7 @@
 #--- The local repository for packages/file
 #    Any missing file will be downloaded and archived here,
 #    if the user has the right priviledges.
-export SRC_ARCHIVE=$SRC_ARCHIVE
+export SRC_ARCHIVE=/sources
 
 #--- Server used if the file isn't found in SRC_ARCHIVE.
 # As a last resort, the file will dowloaded from upstream, if possible.
@@ -25,11 +25,13 @@
 # http://www.linuxfromscratch.org/blfs/download.html
 export FTP_SERVER=ftp://anduin.linuxfromscratch.org/BLFS/
 
+# Use a server close to you for Xorg (see http://wiki.x.org/wiki/Mirrors)
+export FTP_X_SERVER=ftp://mirror.cict.fr/x.org/
 
 #--- The sources directory.
 #    Full path to the top level directory where packages will be stored,
 #    unpacked, and compiled.
-export SRC_DIR=$HOME/sources
+export SRC_DIR=/sources
 
 
 #======== Xorg7 envars ===========
@@ -79,7 +81,7 @@
 #   expected, please rebuild without optimizations before
 #   asking for support.
 
-#export MAKEFLAGS="-j3"
+export MAKEFLAGS="-j5"
 
 #export CFLAGS="-O3 -pipe"
 #export CXXFLAGS=$CFLAGS

Modified: jhalfs/branches/ablfs/BLFS/gen-makefile.sh
===================================================================
--- jhalfs/branches/ablfs/BLFS/gen-makefile.sh	2012-02-22 16:44:36 UTC (rev 3566)
+++ jhalfs/branches/ablfs/BLFS/gen-makefile.sh	2012-02-22 17:09:47 UTC (rev 3567)
@@ -5,10 +5,14 @@
 set -e
 
 # TEMPORARY VARIABLES.. development use only
+declare TOPDIR=$(cd ..; pwd)
 declare MKFILE=Makefile
 declare PREV_PACKAGE=""
-declare BUILD_SCRIPTS=scripts
-declare TRACKING_DIR=tracking-dir
+declare BUILD_SCRIPTS=${TOPDIR}/scripts
+declare TRACKING_FILE=tracking-dir/instpkg.xml
+declare XSLDIR=${TOPDIR}/xsl
+declare PACK_FILE=${TOPDIR}/packages.xml
+declare BUMP=${XSLDIR}/bump.xsl
 
 HEADER="# This file is automatically generated by gen-makefile.sh
 # YOU MAY NEED TO EDIT THIS FILE MANUALLY
@@ -38,7 +42,7 @@
 #----------------------------------#
 (
 cat << EOF
-	@source ../envars.conf && ${BUILD_SCRIPTS}/\$@ >logs/\$@ 2>&1
+	@source ${TOPDIR}/envars.conf && ${BUILD_SCRIPTS}/\$@ >logs/\$@ 2>&1
 EOF
 ) >> $MKFILE.tmp
 }
@@ -47,50 +51,17 @@
 __wrt_touch() {                    #
 #----------------------------------#
   local pkg_name=$1
-  local pkg_ver=$2
-  local alsa_ver=$(grep "^alsa[[:space:]]" ../packages | cut -f3)
-  local kde_core_ver=$(grep "^kde-core[[:space:]]" ../packages | cut -f3)
-  local xorg7_ver=$(grep "^xorg7[[:space:]]" ../packages | cut -f3)
 
-  if [[ -n "$pkg_ver" ]] ; then
 (
 cat << EOF
-	@rm -f \$(TRACKING_DIR)/${pkg_name#*-?-}-{0..9}* && \\
-	touch \$(TRACKING_DIR)/${pkg_name#*-?-}-${pkg_ver}
-EOF
-) >> $MKFILE.tmp
-  fi
-
-  case $pkg_name in
-    *-alsa-lib ) #this the unique mandatory package for ALSA support.
-(
-cat << EOF
-	@rm -f \$(TRACKING_DIR)/alsa-{0..9}* && \\
-	touch \$(TRACKING_DIR)/alsa-${alsa_ver}
-EOF
-) >> $MKFILE.tmp
-      ;;
-    *-kdebase )
-(
-cat << EOF
-	@rm -f \$(TRACKING_DIR)/kde-core-{0..9}* && \\
-	touch \$(TRACKING_DIR)/kde-core-${kde_core_ver}
-EOF
-) >> $MKFILE.tmp
-      ;;
-    *-xorg7-driver ) # xtrerm2 and rman are optional
-(
-cat << EOF
-	@rm -f \$(TRACKING_DIR)/xorg7-{0..9}* && \\
-	touch \$(TRACKING_DIR)/xorg7-${xorg7_ver}
-EOF
-) >> $MKFILE.tmp
-      ;;
-  esac
-
-(
-cat << EOF
-	@touch  \$@ && \\
+	@xsltproc --stringparam packages ${PACK_FILE} \\
+	--stringparam package ${pkg_name#*-?-} \\
+	-o track.tmp \\
+	${BUMP} \$(TRACKING_FILE) && \\
+	sed -i 's at PACKDESC@${TOPDIR}/packdesc.dtd@' track.tmp && \\
+	xmllint --format --postvalid track.tmp > \$(TRACKING_FILE) && \\
+        rm track.tmp && \\
+	touch  \$@ && \\
 	sleep .25 && \\
 	echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)
@@ -103,7 +74,6 @@
 __write_entry() {            #
 #----------------------------#
   local script_name=$1
-  local pkg_ver=$2
 
   echo -n "${tab_}${tab_} entry for <$script_name>"
 
@@ -118,7 +88,7 @@
 
   # Include a touch of the target name so make can check
   # if it's already been made.
-  __wrt_touch "${script_name}" "${pkg_ver}"
+  __wrt_touch "${script_name}"
   #
   #--------------------------------------------------------------------#
   #              >>>>>>>> END OF Makefile ENTRY <<<<<<<<               #
@@ -127,50 +97,6 @@
 }
 
 #----------------------------#
-__write_meta_pkg_touch() {   #
-#----------------------------#
-  local meta_pkg=$1
-  local pkg_ver=$(grep "^${meta_pkg}[[:space:]]" ../packages | cut -f3)
-  local gnome_core_ver=$(grep "^gnome-core[[:space:]]" ../packages | cut -f3)
-  local kde_full_ver=$(grep "^kde-full[[:space:]]" ../packages | cut -f3)
-
-(
-cat << EOF
-
-999-z-$meta_pkg:  $PREV_PACKAGE
-	@rm -f \$(TRACKING_DIR)/${meta_pkg}-{0..9}* && \\
-	touch \$(TRACKING_DIR)/${meta_pkg}-${pkg_ver}
-EOF
-) >> $MKFILE.tmp
-
-  case $meta_pkg in
-    gnome-full )
-(
-cat << EOF
-	@rm -f \$(TRACKING_DIR)/gnome-core-{0..9}* && \\
-	touch \$(TRACKING_DIR)/gnome-core-${gnome_core_ver}
-EOF
-) >> $MKFILE.tmp
-      ;;
-    kde-koffice )
-(
-cat << EOF
-	@rm -f \$(TRACKING_DIR)/kde-full-{0..9}* && \\
-	touch \$(TRACKING_DIR)/kde-full-${kde_full_ver}
-EOF
-) >> $MKFILE.tmp
-      ;;
-  esac
-
-(
-cat << EOF
-	@touch  \$@
-EOF
-) >> $MKFILE.tmp
-
-}
-
-#----------------------------#
 generate_Makefile () {       #
 #----------------------------#
 
@@ -182,36 +108,18 @@
   >$MKFILE.tmp
 
 
-  for package_script in scripts/* ; do
+  for package_script in ${BUILD_SCRIPTS}/* ; do
     this_script=`basename $package_script`
-    pkg_ver=$(grep "^${this_script#*-?-}[[:space:]]" ../packages | cut -f3)
     pkg_list="$pkg_list ${this_script}"
-    __write_entry "${this_script}" "${pkg_ver}"
+    __write_entry "${this_script}"
     PREV_PACKAGE=${this_script}
   done
 
-  PACKAGE=$(basename $PWD)
-
-   # alsa, kde-core and xorg7 are also available dependencies, thus handled
-   # in another way.
-  case $PACKAGE in
-    gnome-core | \
-    gnome-full | \
-    kde-full | \
-    kde-koffice )  pkg_list="$pkg_list 999-z-${PACKAGE}"
-                  __write_meta_pkg_touch "${PACKAGE}"
-                  ;;
-  esac
-
-
-  # Add a header, some variables and include the function file
-  # to the top of the real Makefile.
 (
     cat << EOF
 $HEADER
 
-PACKAGE= $PACKAGE
-TRACKING_DIR= $TRACKING_DIR
+TRACKING_FILE= $TRACKING_FILE
 
 BOLD= ""
 RED= ""
@@ -228,7 +136,7 @@
 endef
 
 
-define fin_message
+define end_message
   @echo \$(BOLD)
   @echo --------------------------------------------------------------------------------
   @echo \$(BOLD) Build complete for the package \$(BLUE)\$(PACKAGE)\$(BOLD) and its dependencies
@@ -236,7 +144,7 @@
 endef
 
 all : $pkg_list
-	@\$(call fin_message )
+	@\$(call end_message )
 EOF
 ) > $MKFILE
 
@@ -247,16 +155,11 @@
 
 }
 
-if [[ -e Config.in ]] ; then
-  echo -e "\n\tThis script must be run from inside a target package directory.\n"
+if [[ ! -d ${BUILD_SCRIPTS} ]] ; then
+  echo -e "\n\tThe \'${BUILD_SCRIPTS}\' directory has not been found.\n"
   exit 1
 fi
 
-if [[ ! -d scripts ]] ; then
-  echo -e "\n\tNo ./scripts/ directory has been found.\n"
-  exit 1
-fi
-
 generate_Makefile
 
 cp ../progress_bar.sh .

Added: jhalfs/branches/ablfs/BLFS/gen-special.sh
===================================================================
--- jhalfs/branches/ablfs/BLFS/gen-special.sh	                        (rev 0)
+++ jhalfs/branches/ablfs/BLFS/gen-special.sh	2012-02-22 17:09:47 UTC (rev 3567)
@@ -0,0 +1,132 @@
+#!/bin/bash
+
+# $Id: gen-special.sh 21 2012-02-16 15:06:19Z labastie $
+
+BLFS_XML=$1
+if ! test -f ${BLFS_XML}; then
+  echo ${BLFS_XML} does not exist
+  exit 1
+fi
+SPECIAL_FILE=$2
+if test -z "${SPECIAL_FILE}"; then SPECIAL_FILE=specialCases.xsl;fi
+# Packages whose version does not begin with a number
+EXCEPTIONS=$(grep 'ENTITY.*version[ ]*"[^0-9"&.].*[0-9]' $BLFS_XML |
+             sed 's@^[^"]*"\([^"]*\)".*@\1@')
+# Version for X Window packages without a version in the book
+XVERSION=$(grep 'ENTITY xorg7-release' $BLFS_XML |
+           sed 's@^[^"]*"\([^"]*\)".*@\1@')
+# The case of udev
+# Set PATH to be sure to find udevadm
+SAVPATH=$PATH
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+UDEVVERSION=$(udevadm --version)
+
+cat >$SPECIAL_FILE << EOF
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="1.0">
+
+<xsl:template match='*' mode="special">
+  <xsl:choose>
+    <xsl:when test="@id='udev'">
+      <xsl:text>      </xsl:text>
+      <package><xsl:text>&#xA;        </xsl:text>
+        <xsl:element name="name"><xsl:value-of select="@id"/></xsl:element>
+        <xsl:text>&#xA;        </xsl:text>
+        <xsl:element name="version">$UDEVVERSION</xsl:element>
+        <xsl:if
+            test="document(\$installed-packages)//package[name=current()/@id]">
+          <xsl:text>&#xA;        </xsl:text>
+          <xsl:element name="inst-version">
+            <xsl:value-of
+              select="document(\$installed-packages
+                              )//package[name=current()/@id]/version"/>
+          </xsl:element>
+        </xsl:if>
+<!-- Dependencies -->
+        <xsl:apply-templates select=".//para[@role='required' or
+                                             @role='recommended' or
+                                             @role='optional']"
+                             mode="dependency"/>
+<!-- End dependencies -->
+        <xsl:text>&#xA;      </xsl:text>
+      </package><xsl:text>&#xA;</xsl:text>
+    </xsl:when>
+    <xsl:when test="@id='xorg7'"/>
+    <xsl:when test="../@id='x-window-system' and
+                    not(contains(translate(@xreflabel,
+                                           '123456789',
+                                           '000000000'),
+                                '-0'))">
+      <xsl:text>      </xsl:text>
+      <package><xsl:text>&#xA;        </xsl:text>
+        <xsl:element name="name"><xsl:value-of select="@id"/></xsl:element>
+        <xsl:text>&#xA;        </xsl:text>
+        <xsl:element name="version">$XVERSION</xsl:element>
+        <xsl:if
+            test="document(\$installed-packages)//package[name=current()/@id]">
+          <xsl:text>&#xA;        </xsl:text>
+          <xsl:element name="inst-version">
+            <xsl:value-of
+              select="document(\$installed-packages
+                              )//package[name=current()/@id]/version"/>
+          </xsl:element>
+        </xsl:if>
+<!-- Dependencies -->
+        <xsl:apply-templates select=".//para[@role='required' or
+                                             @role='recommended' or
+                                             @role='optional']"
+                             mode="dependency"/>
+<!-- End dependencies -->
+        <xsl:text>&#xA;      </xsl:text>
+      </package><xsl:text>&#xA;</xsl:text>
+    </xsl:when>
+EOF
+
+for ver_ent in $EXCEPTIONS; do
+  id=$(grep 'xreflabel=".*'$ver_ent $BLFS_XML | sed 's at .*id="\([^"]*\)".*@\1@')
+  [[ -z $id ]] && continue
+  cat >>$SPECIAL_FILE << EOF
+    <xsl:when test="@id='$id'">
+      <xsl:text>      </xsl:text>
+      <package><xsl:text>&#xA;        </xsl:text>
+        <xsl:element name="name">$id</xsl:element>
+        <xsl:text>&#xA;        </xsl:text>
+        <xsl:element name="version">$ver_ent</xsl:element>
+        <xsl:if
+            test="document(\$installed-packages)//package[name=current()/@id]">
+          <xsl:text>&#xA;        </xsl:text>
+          <xsl:element name="inst-version">
+            <xsl:value-of
+              select="document(\$installed-packages
+                              )//package[name=current()/@id]/version"/>
+          </xsl:element>
+        </xsl:if>
+<!-- Dependencies -->
+        <xsl:apply-templates select=".//para[@role='required' or
+                                             @role='recommended' or
+                                             @role='optional']"
+                             mode="dependency"/>
+<!-- End dependencies -->
+        <xsl:text>&#xA;      </xsl:text>
+      </package><xsl:text>&#xA;</xsl:text>
+    </xsl:when>
+EOF
+done
+
+cat >>$SPECIAL_FILE << EOF
+    <xsl:otherwise>
+        <xsl:apply-templates
+           select="self::node()[contains(translate(@xreflabel,
+                                                  '123456789',
+                                                  '000000000'),
+                                         '-0')
+                               ]"
+           mode="normal"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
+EOF


Property changes on: jhalfs/branches/ablfs/BLFS/gen-special.sh
___________________________________________________________________
Added: svn:executable
   + *

Deleted: jhalfs/branches/ablfs/BLFS/gen_config.sh
===================================================================
--- jhalfs/branches/ablfs/BLFS/gen_config.sh	2012-02-22 16:44:36 UTC (rev 3566)
+++ jhalfs/branches/ablfs/BLFS/gen_config.sh	2012-02-22 17:09:47 UTC (rev 3567)
@@ -1,288 +0,0 @@
-#!/bin/bash
-#
-# $Id$
-#
-
-export outFile=Config.in	# file for reading and writing to.
-export inFile=packages		# file for reading and writing to.
-
-declare PKG_NAME
-declare PKG_XML_FILE
-declare PKG_DIR
-declare PKG_VER
-declare INST_VER
-declare INST_STRING
-declare SAVE_IFS=${IFS}
-declare -a DIR_TREE
-declare PREV_DIR1="none"
-declare PREV_DIR2="none"
-declare MENU_SET1="n"
-declare MENU_SET2="n"
-
-> $outFile
-
-#---------------------#
-#         MAIN        #
-#---------------------#
-: <<enddoc
-  This script will create a Config.in file from the contents
-  of the file <packages>.
-  Packages previously installed will not be included.
-enddoc
-
-echo -en "\tGenerating Config.in from package data ..."
-while [ 0 ]
-do
-
-#  read -r || break 1
-  read || break 1
-
-  set -- $REPLY
-  PKG_NAME=$1
-  PKG_XML_FILE=$(basename $2)
-  PKG_DIR=$(dirname $2)
-  PKG_VER=$3
-  INST_VER=$4
-    # These are the META packages.
-  if [ $PKG_DIR = "." ]; then
-    SET_COMMENT=y
-      # Do not include previously installed packages
-    if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" = "x${INST_VER}" ]]; then
-      continue
-    fi
-      # Do not include installed packages newer than the book ones
-    if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" < "x${INST_VER}" ]]; then
-      continue
-    fi
-      # Set installed version for updated meta-packages
-    [ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]"
-
-    META_PKG=$(echo ${PKG_NAME} | tr [a-z] [A-Z])
-(
-cat << EOF
-	config	CONFIG_$META_PKG
-		bool	"$META_PKG $PKG_VER $INST_STRING"
-		default	n
-
-		menu	"$(echo ${PKG_NAME} | tr [a-z] [A-Z]) components"
-			depends	CONFIG_$META_PKG
-
-EOF
-) >> $outFile
-
-    unset INST_STRING
-
-         # Include the dependency data for this meta package
-       while [ 0 ]; do
-         read || break 1
-         PKG_NAME=${REPLY}
-         PKG_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f3)
-         INST_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f4)
-           # Skip installed meta-package components
-         if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" = "x${INST_VER}" ]]; then
-           continue
-         fi
-          # Do not include installed packages newer than the book ones
-         if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" < "x${INST_VER}" ]]; then
-           continue
-         fi
-           # Set installed version for updated meta-packages components
-         [ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]"
-(
-cat << EOF
-	config	DEP_${META_PKG}_${PKG_NAME}
-		bool	"$PKG_NAME ${PKG_VER} ${INST_STRING}"
-		default	y
-
-EOF
-) >> $outFile
-         unset INST_STRING
-       done <./libs/${PKG_NAME}.dep
-     echo -e "endmenu" >> $outFile
-    continue
-  fi
-  [[ "${SET_COMMENT}" = "y" ]] && echo "comment \"\"" >>$outFile; unset SET_COMMENT
-
-    # Deal with targets that are part of a meta-package but that are in the same
-    # directory that non meta-package targets
-  case ${PKG_NAME} in
-     alsa-* | \
-     xorg7-* | \
-     x-config | \
-     x-setup | \
-     libXau | \
-     libxcb | \
-     libXdmcp | \
-     luit | \
-     xbitmaps | \
-     xcb-proto | \
-     xkeyboard-config | \
-     mesalib | \
-     libdrm ) continue ;;
-  esac
-
-    # Skip installed packages
-  if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" = "x${INST_VER}" ]]; then
-    continue
-  fi
-    # Do not include installed packages newer than the book ones
-  if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" < "x${INST_VER}" ]]; then
-    continue
-  fi
-    # Set installed version for updated packages
-  [ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]"
-
-  IFS="/"
-  DIR_TREE=(${PKG_DIR})
-  IFS="$SAVE_IFS"
-
-    # Define a top level menu
-  if [ "$PREV_DIR1" != "${DIR_TREE[1]}" ]; then
-    [[ "${DIR_TREE[1]}" = "kde" ]] && continue
-    [[ "${DIR_TREE[1]}" = "gnome" ]] && continue
-
-    if [ $MENU_SET1 = "y" ]; then
-      # Close out any open secondary menu
-      if [ $MENU_SET2 = "y" ]; then
-        echo -e "\tendmenu" >> $outFile
-        # Reset 'menu open' flag
-        MENU_SET2="n"
-      fi
-      # Close the current top level menu
-      echo -e "endmenu\n" >> $outFile
-    fi
-    # Open a new top level menu
-    echo -e "menu "$(echo ${DIR_TREE[1]:0:1} | tr [a-z] [A-Z])${DIR_TREE[1]:1}"" >> $outFile
-    MENU_SET1="y"
-  fi
-
-    # Define a secondary menu
-  if [ "$PREV_DIR2" != "${DIR_TREE[2]}" ]; then
-      # Close out the previous open menu structure
-    if [ $MENU_SET2 = "y" ]; then
-      echo -e "\tendmenu\n"  >> $outFile
-    fi
-      # Initialize a new 2nd level menu structure.
-    echo -e "\tmenu "$(echo ${DIR_TREE[2]:0:1} | tr [a-z] [A-Z])${DIR_TREE[2]:1}"" >> $outFile
-    MENU_SET2="y"
-  fi
-(
-cat << EOF
-	config CONFIG_$PKG_NAME
-		bool "$PKG_NAME ${PKG_VER} ${INST_STRING}"
-		default n
-EOF
-) >> $outFile
-
-  unset INST_STRING
-
-  PREV_DIR1=${DIR_TREE[1]}
-  PREV_DIR2=${DIR_TREE[2]}
-done <"$inFile"
-
-if [ $MENU_SET2 = "y" ]; then echo -e "\tendmenu" >> $outFile; fi
-if [ $MENU_SET1 = "y" ]; then echo "endmenu" >> $outFile; fi
-
-(
-cat << EOF
-
-comment	""
-
-menu	"Default packages for resolving dependencies"
-
-choice
-	prompt	"Default print server"
-	config	PS_cups
-		bool	"cups"
-	config	PS_LPRng
-		bool	"LPRng"
-endchoice
-config	PRINT_SERVER
-	string
-	default	cups	if PS_cups
-	default	LPRng	if PS_LPRng
-
-choice
-	prompt	"Mail server"
-	config	MS_sendmail
-		bool	"sendmail"
-	config	MS_postfix
-		bool	"postfix"
-	config	MS_exim
-		bool	"exim"
-endchoice
-config	MAIL_SERVER
-	string
-	default	sendmail	if MS_sendmail
-	default	postfix		if MS_postfix
-	default	exim		if MS_exim
-
-choice
-	prompt	"Postscript package"
-	config	GS_espgs
-		bool	"espgs"
-	config	GS_ghostscript
-		bool	"ghostscript"
-endchoice
-config	GHOSTSCRIPT
-	string
-	default	espgs       if GS_espgs
-	default ghostscript if GS_ghostscript
-
-choice
-	prompt	"Kerberos 5"
-	config	KER_mitkrb
-		bool	"mitkrb"
-	config	KER_heimdal
-		bool	"heimdal"
-endchoice
-config	KBR5
-	string
-	default	heimdal	if KER_heimdal
-	default mitkrb	if KER_mitkrb
-
-choice
-	prompt	"Window package"
-	config	WIN_xorg7
-	bool	"Xorg7"
-	config	WIN_xfree86
-	bool	"xfree86"
-endchoice
-config	X11
-	string
-	default	xorg7	if WIN_xorg7
-	default xfree86	if WIN_xfree86
-endmenu
-
-choice
-	prompt	"Dependency level"
-	default DEPLVL_2
-
-	config	DEPLVL_1
-	bool	"Required dependencies only"
-
-	config	DEPLVL_2
-	bool	"Required and recommended dependencies"
-
-	config	DEPLVL_3
-	bool	"Required, recommended and optional dependencies"
-
-endchoice
-config	optDependency
-	int
-	default	1	if DEPLVL_1
-	default	2	if DEPLVL_2
-	default	3	if DEPLVL_3
-
-
-config	SUDO
-	bool "Build as User"
-	default	y
-	help
-		Select if sudo will be used (you want build as a normal user)
-		        otherwise sudo is not needed (you want build as root)
-EOF
-) >> $outFile
-echo "done"
-
-

Modified: jhalfs/branches/ablfs/BLFS/gen_pkg_book.sh
===================================================================
--- jhalfs/branches/ablfs/BLFS/gen_pkg_book.sh	2012-02-22 16:44:36 UTC (rev 3566)
+++ jhalfs/branches/ablfs/BLFS/gen_pkg_book.sh	2012-02-22 17:09:47 UTC (rev 3567)
@@ -6,22 +6,34 @@
 #
 set -e
 
-declare -r ConfigFile="configuration"
-declare TARGET
+TOPDIR=$1
+if test -z "TOPDIR"; then
+  TOPDIR=$(pwd)
+fi
+BLFS_FULL=$2
+if test -z "BLFS_FULL"; then
+  BLFS_FULL=${TOPDIR}/blfs-xml/tmp/blfs-full.xml
+fi
+declare -r ConfigFile="${TOPDIR}/configuration"
+declare DepDir="${TOPDIR}/dependencies"
+declare LibDir="${TOPDIR}/libs"
+declare PackFile="${TOPDIR}/packages.xml"
+declare BookXml="${TOPDIR}/book.xml"
+declare MakeBook="${TOPDIR}/xsl/make_book.xsl"
+declare MakeScripts="${TOPDIR}/xsl/scripts.xsl"
+declare BookHtml="${TOPDIR}/book-html"
+declare BLFS_XML="${TOPDIR}/blfs-xml"
+declare -a TARGET
 declare DEP_LEVEL
 declare SUDO
-declare PKGXML
-declare BLFS_XML
-declare VERBOSITY=1
 
 #--------------------------#
 parse_configuration() {    #
 #--------------------------#
-  local	cntr
-  local	optTARGET
+  local	-i cntr=0
+  local	-a optTARGET
 
-  while [ 0 ]; do
-    read || break 1
+  while read; do
 
     # Garbage collection
     case ${REPLY} in
@@ -29,51 +41,28 @@
     esac
 
     case "${REPLY}" in
-      CONFIG_ALSA=* | \
-      CONFIG_GNOME-CORE=* | \
-      CONFIG_GNOME-FULL=* | \
-      CONFIG_KDE-CORE=* | \
-      CONFIG_KDE-FULL=* | \
-      CONFIG_KDE-KOFFICE=* | \
-      CONFIG_XORG7=* ) REPLY=${REPLY%=*}  # Strip the trailing '=y' test.. unecessary
-                       echo -n "${REPLY}"
-                       if [[ $((++cntr)) > 1 ]]; then
-                         echo "  <<-- ERROR:: SELECT ONLY 1 PACKAGE AT A TIME, META-PACKAGE NOT SELECTED"
-                       else
-                         echo ""
-                         optTARGET=$(echo $REPLY | cut -d "_" -f2 | tr [A-Z] [a-z])
-                       fi
-                       continue ;;
-
       # Create global variables for these parameters.
       optDependency=* | \
       PRINT_SERVER=*  | \
       MAIL_SERVER=*   | \
       GHOSTSCRIPT=*   | \
       KBR5=*  | \
-      X11=*   | \
       SUDO=*  )  eval ${REPLY} # Define/set a global variable..
                       continue ;;
     esac
 
     if [[ "${REPLY}" =~ ^CONFIG_ ]]; then
-      echo -n "$REPLY"
-      if [[ $((++cntr)) > 1 ]]; then
-        echo "  <<-- ERROR SELECT ONLY 1 PACKAGE AT A TIME, WILL NOT BUILD"
-      else
-        echo ""
-        optTARGET=$( echo $REPLY | sed -e 's at CONFIG_@@' -e 's@=y@@' )
-      fi
+      echo "$REPLY"
+      optTARGET[$((cntr++))]=$( echo $REPLY | sed -e 's at CONFIG_@@' -e 's@=y@@' )
     fi
-  done <$ConfigFile
+  done < $ConfigFile
 
-  if [[ $optTARGET = "" ]]; then
-    echo -e "\n>>> NO TARGET SELECTED.. applicaton terminated"
-    echo -e "    Run <make> again and select a package to build\n"
+  if (( $cntr == 0 )); then
+    echo -e "\n>>> NO TARGET SELECTED.. application terminated"
+    echo -e "    Run <make> again and select (a) package(s) to build\n"
     exit 0
   fi
-
-  TARGET=$optTARGET
+  TARGET=(${optTARGET[*]})
   DEP_LEVEL=$optDependency
   SUDO=${SUDO:-n}
 }
@@ -82,43 +71,32 @@
 validate_configuration() { #
 #--------------------------#
   local -r dotSTR=".................."
-  local -r PARAM_LIST="TARGET DEP_LEVEL SUDO PRINT_SERVER MAIL_SERVER GHOSTSCRIPT KBR5 X11"
+  local -r PARAM_LIST="DEP_LEVEL SUDO PRINT_SERVER MAIL_SERVER GHOSTSCRIPT KBR5"
   local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
   local config_param
+  local -i index
 
   for config_param in ${PARAM_LIST}; do
     echo -e "`eval echo $PARAM_VALS`"
   done
+  for (( index=0 ; index < ${#TARGET[*]} ; index ++ )); do
+    echo -e "TARGET${index}${dotSTR:6} ${L_arrow}${BOLD}${TARGET[${index}]}${OFF}${R_arrow}"
+  done
 }
 
 #
-# Regenerate the META-package dependencies from the configuration file
+# Generates the root of the dependency tree
 #
 #--------------------------#
-regenerate_deps() {        #
+generate_deps() {        #
 #--------------------------#
 
-  rm -f libs/*.dep-MOD
-  while [ 0 ]; do
-    read || break 1
-    case ${REPLY} in
-      \#* | '') continue ;;
-    esac
-
-    # Drop the "=y"
-    REPLY=${REPLY%=*}
-    if [[ "${REPLY}" =~ ^DEP_ ]]; then
-      META_PACKAGE=$(echo $REPLY | cut -d "_" -f2 | tr [A-Z] [a-z])
-      DEP_FNAME=$(echo $REPLY | cut -d "_" -f3)
-       echo "${DEP_FNAME}" >>libs/${META_PACKAGE}.dep-MOD
-    fi
-
-  done <$ConfigFile
-  #
-  # Replace to 'old' dependency file with a new one.
-  #
-  for dst in `ls ./libs/*.dep-MOD 2>/dev/null`; do
-    cp -vf $dst ${dst%-MOD}
+  local -i index
+  local DepDir=$1
+  rm -f $DepDir/*.dep
+  echo 1 > $DepDir/root.dep
+  for (( index=0 ; index < ${#TARGET[*]} ; index ++ )); do
+    echo ${TARGET[${index}]} >> $DepDir/root.dep
   done
 }
 
@@ -131,29 +109,23 @@
 clean_configuration() {    #
 #--------------------------#
 
-tail -n 29 configuration > configuration.tmp
-mv configuration.tmp configuration
+tail -n 15 ${ConfigFile} > ${ConfigFile}.tmp
+mv ${ConfigFile}.tmp ${ConfigFile}
 
 }
 
 #---------------------
 # Constants
-source libs/constants.inc
+source ${LibDir}/constants.inc
 [[ $? > 0 ]] && echo -e "\n\tERROR: constants.inc did not load..\n" && exit
 
 #---------------------
 # Dependencies module
-source libs/func_dependencies
+source ${LibDir}/func_dependencies
 [[ $? > 0 ]] && echo -e "\n\tERROR: func_dependencies did not load..\n" && exit
 
-#---------------------
-# parser module
-source libs/func_parser
-[[ $? > 0 ]] && echo -e "\n\tERROR: func_parser did not load..\n" && exit
-
-
 #------- MAIN --------
-if [[ ! -f packages ]] ; then
+if [[ ! -f ${PackFile} ]] ; then
   echo -e "\tNo packages file has been found.\n"
   echo -e "\tExecution aborted.\n"
   exit 1
@@ -170,9 +142,48 @@
   exit 1
 fi
 echo "${nl_}${SD_BORDER}${nl_}"
-regenerate_deps
-generate_dependency_tree
-generate_TARGET_xml
-generate_target_book
-create_build_scripts "${SUDO}"
-clean_configuration
+
+rm -rf $DepDir
+mkdir $DepDir
+generate_deps $DepDir
+pushd $DepDir > /dev/null
+set +e
+generate_dependency_tree root.dep
+echo
+LIST="$(tree_browse root.dep)"
+set -e
+popd > /dev/null
+rm -f ${BookXml}
+echo Making XML book
+xsltproc --stringparam list "$LIST" \
+         -o ${BookXml} \
+         ${MakeBook} \
+         $BLFS_FULL
+echo "making HTML book (may take some time...)"
+xsltproc -o ${BookHtml}/ \
+         -stringparam chunk.quietly 1 \
+         ${BLFS_XML}/stylesheets/blfs-chunked.xsl \
+         ${BookXml}
+if [ ! -d ${BookHtml}/stylesheets ]
+  then mkdir -p ${BookHtml}/stylesheets
+  cp ${BLFS_XML}/stylesheets/lfs-xsl/*.css book-html/stylesheets
+fi
+if [ ! -d ${BookHtml}/images ]
+  then mkdir -p ${BookHtml}/images
+  cp ${BLFS_XML}/images/*.png book-html/images
+fi
+for ht in ${BookHtml}/*.html
+  do sed -i 's at ../stylesheets at stylesheets@' $ht
+  sed -i 's at ../images at images@' $ht
+done
+echo -en "\n\tGenerating the build scripts ..."
+rm -rf scripts
+xsltproc --xinclude --nonet \
+         --stringparam sudo $SUDO \
+         -o ./scripts/ ${MakeScripts} \
+         ${BookXml}
+# Make the scripts executable.
+chmod -R +x scripts
+echo -e "done\n"
+
+#clean_configuration

Deleted: jhalfs/branches/ablfs/BLFS/libs/book.xsl
===================================================================
--- jhalfs/branches/ablfs/BLFS/libs/book.xsl	2012-02-22 16:44:36 UTC (rev 3566)
+++ jhalfs/branches/ablfs/BLFS/libs/book.xsl	2012-02-22 17:09:47 UTC (rev 3567)
@@ -1,105 +0,0 @@
-<?xml version='1.0' encoding='ISO-8859-1'?>
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns="http://www.w3.org/1999/xhtml"
-                version="1.0">
-
-<!-- $Id$ -->
-
-  <!-- NOTE: the base dir (blfs-xml) is set to the proper dir
-  via a sed in ./blfs -->
-  <xsl:import href="../blfs-xml/stylesheets/blfs-chunked.xsl"/>
-
-  <xsl:param name="mail_server" select="sendmail"/>
-
-  <xsl:param name="xwindow" select="xorg7"/>
-
-     <!-- Template from BLFS_XML/stylesheets/xhtml/lfs-xref.xsl.-->
-  <xsl:template match="xref" name="xref">
-
-    <!-- IDs that need be remaped to the proper file -->
-    <xsl:variable name="linkend">
-      <xsl:choose>
-        <xsl:when test="@linkend = 'alsa'">
-          <xsl:text>alsa-lib</xsl:text>
-        </xsl:when>
-        <xsl:when test="@linkend = 'arts'">
-          <xsl:text>aRts</xsl:text>
-        </xsl:when>
-        <xsl:when test="@linkend = 'kde'">
-          <xsl:text>kdelibs</xsl:text>
-        </xsl:when>
-        <xsl:when test="@linkend = 'server-mail'">
-          <xsl:value-of select="$mail_server"/>
-        </xsl:when>
-        <xsl:when test="@linkend = 'x-window-system'">
-          <xsl:value-of select="$xwindow"/>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:value-of select="@linkend"/>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:variable>
-
-    <xsl:variable name="targets" select="key('id',$linkend)"/>
-    <!-- -->
-
-    <xsl:variable name="target" select="$targets[1]"/>
-    <xsl:variable name="refelem" select="local-name($target)"/>
-    <xsl:variable name="role" select="@role"/>
-    <xsl:call-template name="check.id.unique">
-      <xsl:with-param name="linkend" select="$linkend"/>
-    </xsl:call-template>
-    <xsl:call-template name="anchor"/>
-    <xsl:choose>
-
-      <!-- Dead links -->
-      <xsl:when test="count($target) = 0">
-        <b>
-          <xsl:value-of select="@linkend"/>
-        </b>
-        <tt>
-          <xsl:text> (in the full book)</xsl:text>
-        </tt>
-      </xsl:when>
-      <!-- -->
-
-      <xsl:when test="$target/@xreflabel">
-        <a>
-          <xsl:attribute name="href">
-            <xsl:call-template name="href.target">
-              <xsl:with-param name="object" select="$target"/>
-            </xsl:call-template>
-          </xsl:attribute>
-          <xsl:call-template name="xref.xreflabel">
-            <xsl:with-param name="target" select="$target"/>
-          </xsl:call-template>
-        </a>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:variable name="href">
-          <xsl:call-template name="href.target">
-            <xsl:with-param name="object" select="$target"/>
-          </xsl:call-template>
-        </xsl:variable>
-        <xsl:apply-templates select="$target" mode="xref-to-prefix"/>
-        <a href="{$href}">
-          <xsl:if test="$target/title or $target/*/title">
-            <xsl:attribute name="title">
-              <xsl:apply-templates select="$target" mode="xref-title"/>
-            </xsl:attribute>
-          </xsl:if>
-          <xsl:apply-templates select="$target" mode="xref-to">
-            <xsl:with-param name="referrer" select="."/>
-            <xsl:with-param name="role" select="$role"/>
-            <xsl:with-param name="xrefstyle">
-              <xsl:value-of select="@xrefstyle"/>
-            </xsl:with-param>
-          </xsl:apply-templates>
-        </a>
-        <xsl:apply-templates select="$target" mode="xref-to-suffix"/>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
-</xsl:stylesheet>

Deleted: jhalfs/branches/ablfs/BLFS/libs/dependencies.xsl
===================================================================
--- jhalfs/branches/ablfs/BLFS/libs/dependencies.xsl	2012-02-22 16:44:36 UTC (rev 3566)
+++ jhalfs/branches/ablfs/BLFS/libs/dependencies.xsl	2012-02-22 17:09:47 UTC (rev 3567)
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- $Id$ -->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    version="1.0">
-
-  <xsl:output method="text"/>
-
-  <xsl:param name="dependencies" select="2"/>
-
-  <xsl:template match="/">
-    <xsl:apply-templates select="//para[@role='optional']"/>
-    <xsl:apply-templates select="//para[@role='recommended']"/>
-    <xsl:apply-templates select="//para[@role='required']"/>
-  </xsl:template>
-
-  <xsl:template match="//text()"/>
-
-  <xsl:template match="para[@role='required']">
-    <xsl:apply-templates select="xref">
-      <xsl:sort select="position()" data-type="number" order="descending"/>
-    </xsl:apply-templates>
-  </xsl:template>
-
-  <xsl:template match="para[@role='recommended']">
-    <xsl:if test="$dependencies != '1'">
-      <xsl:apply-templates select="xref">
-        <xsl:sort select="position()" data-type="number" order="descending"/>
-      </xsl:apply-templates>
-    </xsl:if>
-  </xsl:template>
-
-  <xsl:template match="para[@role='optional']">
-    <xsl:if test="$dependencies = '3'">
-      <xsl:apply-templates select="xref">
-        <xsl:sort select="position()" data-type="number" order="descending"/>
-      </xsl:apply-templates>
-    </xsl:if>
-  </xsl:template>
-
-  <xsl:template match="xref">
-    <xsl:value-of select="@linkend"/>
-    <xsl:text>&#xA;</xsl:text>
-  </xsl:template>
-
-</xsl:stylesheet>

Modified: jhalfs/branches/ablfs/BLFS/libs/func_dependencies
===================================================================
--- jhalfs/branches/ablfs/BLFS/libs/func_dependencies	2012-02-22 16:44:36 UTC (rev 3566)
+++ jhalfs/branches/ablfs/BLFS/libs/func_dependencies	2012-02-22 17:09:47 UTC (rev 3567)
@@ -2,436 +2,195 @@
 #
 # $Id$
 #
-set -e
 
-declare -i cntr=0
+# A string of spaces for indenting:
 declare -a spaceSTR="                                                                   "
+declare -a exchange_triplet
 
+# In case we find a cirdular dependency, it has the form :
+# parent->dependency_0->...->dependency_n->dependency_0
+# If we want to build dependency_n before dependency_0,
+# no problem: we just prune the tree at dependency_n.
+# If we want to build first dependency_0, we need to
+# put dependency_n as a dependency of parent. The triplet
+# above shall contain (parent dependency_0 dependency_n)
+
 #----------------------------#
 generate_dependency_tree() { #
 #----------------------------#
 : <<inline_doc
-    function:   Create a dependency tree for the TARGET
-    input vars: none
-    externals:  vars: TARGET
-                      PKGXML
+    function:   Create a subtree of the dependency tree
+                (recursive function)
+    input vars: $1 : file with a list of targets
+		     the first line of the file is an array
+                     of links
+    externals:  vars: BLFS_XML
 		      DEP_LEVEL
-                func: do_dependencies
-    modifies:   vars: PKGXML
-                      BLFS_XML
+    modifies:   vars: none
     returns:    nothing
-    output:     files: $TARGET.dep
-                       $TARGET-index.xml.tmp
-                       depure.txt
+    output:     files: for each pkg with dependencies in $1,
+                       a file pkg.dep and its dependencies
     on error:   nothing
     on success: nothing
 inline_doc
 
-  local ENTRY_START
-  local ENTRY_END
+local DepFile=$1
+local -a rootlink
+local -a otherlink
+local -i depth
+local -i count=0
+local id_of_dep
+local parent
+local lines_to_remove=
+local srootlink
+local dep_level
 
-  #---------------------
-  # Create the working directory and cd into it
-  if [[ -d $TARGET ]] ; then
-    echo -e "\tERROR: Looks like $TARGET has been already processed."
-    echo -e "\tPlease delete or rename the $TARGET directory.\n"
-    exit 1
-  else
-    mkdir $TARGET && cd $TARGET
-  fi
+{
+# BEWARE : the order of options matters : read -a -u6 rootlink hangs forever
+# (actually, the doc says -a array -u fd)
+# We use fd number 6 for input from DepFile, because we need 0 for user input
+read -u6 -a rootlink
+depth=${#rootlink[*]}
+dep_level=$DEP_LEVEL
+if (( $DEP_LEVEL > 2 )) && (( $depth > 1 )); then dep_level=2; fi
+srootlink="${rootlink[*]} "
+# start of Depfile
+echo -en "\nNode: $depth${spaceSTR:0:$depth}${RED}$DepFile${OFF}"
 
-  #---------------------
-  # XML file of the target package
-  PKGXML=`grep "^$TARGET[[:space:]]" ../packages | cut -f2`
-
-  #---------------------
-  # The BLFS sources directory.
-  BLFS_XML=`echo $PKGXML | sed -e 's,/.*,,'`
-
-  if [[ ! -d ../$BLFS_XML ]] ; then
-    echo -e "\tThe BLFS book sources directory is missing.\n"
-    echo -e "\tExecution aborted.\n"
-    cd .. && rmdir $TARGET
-    exit 1
+while read -u6 id_of_dep; do
+# count entries in file
+  (( count++ ))
+# Has this entry already been seen?
+  if [ -f ${id_of_dep}.dep ]; then # found ${id_of_dep}.dep already in tree
+    otherlink=($(head -n 1 ${id_of_dep}.dep))
+    if [ -z "${otherlink[*]}" ] 
+      then echo otherlink empty for $id_of_dep.dep
+      echo This should not happen, but happens to happen...
+      exit 1
+    fi
+# Do not use "${rootlink[*]}" =~ "${otherlink[*]}": case rootlink=(1 11)
+# and otherlink=(1 1)
+    if [[ ${srootlink#"${otherlink[*]} "} != ${srootlink} ]]; then # circular dep
+# First look for the other parent of this dependency.
+# The parent has the same link without the last entry.
+# We do not need otherlink anymore so just destroy the last element
+      unset otherlink[${#otherlink[*]}-1]
+      parent=$(grep ^"${otherlink[*]}"\$ -l *)
+      parent=${parent%.dep}
+      echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BLUE}Circular dependency detected:${OFF}"
+      echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BOLD}${id_of_dep}${OFF} is a dependency \
+of ${BOLD}${parent}${OFF}"
+      echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BOLD}${DepFile%.dep}${OFF} is a dependency \
+of ${BOLD}${id_of_dep}${OFF}"
+      echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BOLD}${id_of_dep}${OFF} is a dependency \
+of ${BOLD}${DepFile%.dep}${OFF}"
+# If idofdep is the parent of DepFile, we can exchange them if required
+#      if grep -q ${DepFile%.dep} ${id_of_dep}.dep; then
+# we propose exchange always
+        echo -en "\nCirc: $depth${spaceSTR:0:$depth}Do you want to build ${id_of_dep} first? yes/no (no):"
+        read ANSWER
+        if [ x$ANSWER = "xyes" ] ; then  # exchange:
+# set triplet and return 1
+          exchange_triplet=($parent $id_of_dep ${DepFile%.dep})
+          return 1
+        else # no exchange: prune
+          lines_to_remove="$lines_to_remove $id_of_dep"
+        fi
+#      else
+#        lines_to_remove="$lines_to_remove $id_of_dep"
+#      fi
+    else # not circular: prune
+      lines_to_remove="$lines_to_remove $id_of_dep"
+    fi
+    continue
   fi
+  flag=true
+  while [ $flag = true ]; do
+    flag=false
+    xsltproc --stringparam dependencies ${dep_level} \
+        --stringparam idofdep $id_of_dep \
+        -o ${id_of_dep}.dep \
+        ../xsl/dependencies.xsl ../packages.xml
 
-  #---------------------
-  # XInclude stuff
-  ENTRY_START="<xi:include xmlns:xi=\"http://www.w3.org/2003/XInclude\" href=\"../"
-  ENTRY_END="\"/>"
+    if [[ -f ${id_of_dep}.dep ]]; then
+      sed -i "1i${rootlink[*]} $count" ${id_of_dep}.dep
+      generate_dependency_tree ${id_of_dep}.dep
+# Test return value, in case we exchange dependencies
+      case $? in
+       0) # Normal return
+         ;;
+       1) # We are backing up to parent
+         if [[ ${exchange_triplet} == ${DepFile%.dep} ]]
+           then tree_erase ${id_of_dep}.dep
+# Just doing a sed -i "s@${id_of_dep}@${exchange_triplet[2]}@" $DepFile
+# is not good if $DepFile contains several times the same line
+# so first find the first line and then sed
+           lineno=$(sed -n /${id_of_dep}/= $DepFile | head -n1)
+           sed -i "${lineno}s@${id_of_dep}@${exchange_triplet[2]}@" $DepFile
+           id_of_dep=${exchange_triplet[2]}
+           flag=true
+         else
+# echo backing up to ${exchange_triplet} at ${DepFile%.dep}
+           return 1
+         fi
+         ;;
+      esac
+    else
+      echo "${rootlink[*]} $count" > ${id_of_dep}.dep
+    fi
+  done
+done
+echo -en "\n End: $depth${spaceSTR:0:$depth}${GREEN}$DepFile${OFF}"
+} 6<$DepFile
+# It may happen that a file is created with several times
+# the same line. Normally, all those lines but one
+# would be flagged to be removed (or all of them if
+# the dependency appeared before). a simple sed /$line/d
+# destroys all the lines. We should instead remove
+# only one for each appearance of it in lines_to_remove.
+# so first get the number of first line and then delete
+# that line
+for line in $lines_to_remove
+  do lineno=$(sed -n /^$line\$/= $DepFile | head -n1)
+  sed -i ${lineno}d $DepFile
+done
+return 0
+}
 
-  echo -e "\tGenerating $TARGET dependencies tree ..."
+#---------------#
+tree_browse() { #
+#---------------#
+local file=$1
+local f
 
-  mkdir dependencies
-
-  #---------------------
-  # Create target package dependencies list
-  case $TARGET in
-    # Skip the creation when all dependencies are circular.
-    alsa-lib | cracklib | libexif | unixodbc ) ;;
-
-    # Meta-packages at target level
-    alsa )
-      cp ../libs/alsa.dep dependencies/
-      ;;
-    gnome-core )
-      cp ../libs/gnome-core.dep dependencies/
-      ;;
-    gnome-full )
-      cp ../libs/gnome-{core,full}.dep dependencies/
-      ;;
-    kde-core )
-      cp ../libs/kde-core.dep dependencies/
-      ;;
-    kde-full )
-      cp ../libs/kde-{core,full}.dep dependencies/
-      ;;
-    kde-koffice )
-      cp ../libs/kde-{core,full,koffice}.dep dependencies/
-      ;;
-    xorg7 )
-      cp ../libs/xorg7.dep dependencies/
-      ;;
-    * ) # Default
-      xsltproc --stringparam dependencies $DEP_LEVEL \
-               -o dependencies/$TARGET.dep \
-               ../libs/dependencies.xsl ../$PKGXML
-      ;;
-  esac
-
-  #---------------------
-  # Start with a clean $TARGET-index.xml.tmp file
-  > $TARGET-index.xml.tmp
-
-  #---------------------
-  # Write the XInclude
-  case $TARGET in
-    # If there is no usefull XML page, skip it.
-    alsa | gnome-core | gnome-full | kde-core | kde-full | kde-koffice | xorg7) ;;
-    * )
-      echo -e "    $ENTRY_START$PKGXML$ENTRY_END" >> $TARGET-index.xml.tmp
-      ;;
-  esac
-
-  #---------------------
-  # If have dependencies, write its XInclude and find sub-dependencies
-  if [[ -f dependencies/$TARGET.dep ]]; then
-    mkdir xincludes && do_dependencies $TARGET
+#echo file=$file
+for f in $(grep '[^0-9 ]' $file); do
+#  echo f=$f
+  if grep -q '[^0-9 ]' ${f}.dep ; then
+    tree_browse ${f}.dep
   fi
-
-  echo -e "\n\t... done"
+  echo $f
+done
 }
 
+#--------------#
+tree_erase() { #
+#--------------#
+local file=$1
+local f
+local -a rootlink
+local -a rootlink2
 
-
-#-----------------------#
-do_dependencies()  {    #  Loop to find sub-dependencies  :::WARNING::: THIS IS A RECURVISE FUNCTION
-#-----------------------#
-: <<inline_doc
-    function:   Loop through all the packages and create a sub-dependency tree
-    input vars: $1, package name
-    externals:  vars:  $DEP_LEVEL
-                       $TARGET
-                       $PRINT_SERVER
-                       $KBR5
-                       $GHOSTSCRIPT
-                       $MAILSERVER
-                file:  depure.txt
-                       $TARGET-index.xml.tmp
-                       $PKG.dep
-                       $PKG.inc
-    modifies:   files
-    returns:    nothing
-    output:     file:  $PKG-xinc.tmp
-                       depure.txt
-                       $TARGET-index.xml.tmp
-    on error:   exit
-    on success:
-inline_doc
-
-  set -e
-  local PKG=$1
-  local saveIFS=$IFS
-  local DEP_LV=$DEP_LEVEL
-  local line line2 DEP pkg_ver inst_ver
-
-  #------------------
-  #  If a premade xinclude file exists, use it. If not, create one
-  if [[ -f xincludes/$PKG.xinc ]] ; then
-    IFS=$'\x0A'
-    for line in `cat xincludes/$PKG.xinc` ; do
-      IFS=$saveIFS
-      # Remove the Xinclude entry if found. We want the most newer one.
-      # Using double quotes to let bash expand variables.
-      # Remove also the empty line created. Can not be done in one step
-      # due that d requires the pattner between /, but we have a lot of /
-      # inside the pattner.
-      sed -e "s,^[[:space:]]*$line,," -e '/./!d' -i $TARGET-index.xml.tmp
-      # Write the XInclude
-      echo -e "$line" >> $TARGET-index.xml.tmp
-    done
-    return
-  fi
-
-  #------------------
-  # Start with a clean $PKG.xinc.tmp file
-  > xincludes/$PKG.xinc.tmp
-  for DEP in `cat dependencies/$PKG.dep`; do
-
-    # Special packages that need be remaped
-    case $DEP in
-
-      db ) continue ;; # The proper version of DB is installed in LFS
-
-        # Don't have their own XML file
-      hal-requirements | hal-runtime-dependencies ) continue ;;
-      perl-* | tk-perl )         DEP=perl-modules ;;
-      dbus-* )                   DEP=dbus-bindings ;;
-      pyxml | pycairo | pygobject | pygtk | pyorbit | \
-      gnome-python | gnome-python-desktop ) DEP=python-modules ;;
-
-        # Orphan links (proper link must be created when generating the book)
-      arts )                     DEP=aRts ;;
-      kde )                      DEP=kde-core ;;
-
-        # Set values for alternative packages
-      LPRng | cups )             DEP=$PRINT_SERVER ;;
-      mitkrb | heimdal )         DEP=$KBR5 ;;
-      gs | espgs )               DEP=$GHOSTSCRIPT ;;
-      server-mail )              DEP=$MAIL_SERVER ;;
-      x-window-system )
-        case $X11 in
-          xorg7 ) DEP=xorg7 ;;
-              * )
-                  pkg_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f3)
-                  inst_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f4)
-                  [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" = "x${inst_ver}" ]] && continue
-                  [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" < "x${inst_ver}" ]] && continue
-                  ;;
-        esac
-        ;;
-    esac
-
-    # If DEP has been previouly installed, skip it
-    pkg_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f3)
-    inst_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f4)
-    [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" = "x${inst_ver}" ]] && continue
-    [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" < "x${inst_ver}" ]] && continue
-
-    #------------------
-    # Prevent circular dependencies
-    # If all dependencies are circular, the creation of the *.dep file
-    # must be skipped, not placed here, to avoid that the script will bomb
-    # due empty *.xinc files
-    case $DEP in
-      akode )
-        # Both are in the same page
-        [[ "$PKG" = "kdemultimedia" ]] && continue
-        ;;
-      aRts )
-        # esound-->aRts-->esound
-        [[ "$PKG" = "esound" ]] && continue
-        ;;
-      dbus-bindings )
-        # True circular dependecy
-        [[ "$PKG" = "dbus-bindings" ]] && continue
-        ;;
-      DocBook )
-        # Used to rebuild the documentation
-        [[ "$PKG" = "linux-pam" ]] && continue
-        ;;
-      docbook-xsl )
-        # Used to rebuild the documentation
-        [[ "$PKG" = "linux-pam" ]] && continue
-        ;;
-      doxygen )
-        # Used to rebuild the documentation
-        [[ "$PKG" = "dbus" ]] && continue
-        [[ "$PKG" = "libdvdcss" ]] && continue
-        [[ "$PKG" = "libusb" ]] && continue
-        [[ "$PKG" = "libxcb" ]] && continue
-        ;;
-      espgs )
-        # Used to rebuild the documentation
-        [[ "$PKG" = "$MAIL_SERVER" ]] && continue
-        ;;
-      ffmpeg )
-        # alsa-plugins-->ffmpeg-->several-->alsa-plugins
-        [[ "$PKG" = "alsa-plugins" ]] && continue
-        ;;
-      fop )
-        # Used to rebuild the documentation
-        [[ "$PKG" = "linux-pam" ]] && continue
-        ;;
-      graphviz )
-        # Used to build the API documentation
-        [[ "$PKG" = "libusb" ]] && continue
-        ;;
-      GTK )
-        # deprecated GTK version
-        [[ "$PKG" = "alsa-tools" ]] && continue
-        ;;
-      gtk2 )
-        # Testsuite only
-        [[ "$PKG" = "cairo" ]] && continue
-        ;;
-      jadetex )
-        # Runtime only
-        [[ "$PKG" = "docbook-utils" ]] && continue
-        ;;
-      $KBR5 )
-        # cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl
-        [[ "$PKG" = "cyrus-sasl" ]] && continue
-        ;;
-      librsvg )
-        # Testsuite only
-        [[ "$PKG" = "cairo" ]] && continue
-        ;;
-      libxslt )
-        # libxml2-->libxslt-->libxml2
-        [[ "$PKG" = "libxml2" ]] && continue
-        ;;
-      Links )
-        # Runtime only
-        [[ "$PKG" = "docbook-utils" ]] && continue
-        ;;
-      lynx )
-        # Runtime only
-        [[ "$PKG" = "docbook-utils" ]] && continue
-        ;;
-      openldap )
-        # cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl
-        [[ "$PKG" = "cyrus-sasl" ]] && continue
-        ;;
-      poppler )
-        # Testsuite only
-        [[ "$PKG" = "cairo" ]] && continue
-        ;;
-      postgresql )
-        # cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl
-        [[ "$PKG" = "cyrus-sasl" ]] && continue
-        ;;
-      python-modules )
-        # True circular dependecy
-        [[ "$PKG" = "python-modules" ]] && continue
-        # libgsf-->python-modules-->several combinations-->libgsf
-        [[ "$PKG" = "libgsf" ]] && continue
-        # gimp-->python-modules-->several combinations-->gimp
-        [[ "$PKG" = "gimp" ]] && continue
-        # Used to rebuild the documentation
-        [[ "$PKG" = "gstreamer" ]] && continue
-        [[ "$PKG" = "gst-plugins-base" ]] && continue
-        [[ "$PKG" = "gst-plugins-good" ]] && continue
-        ;;
-      tk )
-        # python-->tk-->xorg7-->several combinations-->libxslt-->python
-        [[ "$PKG" = "python" ]] && continue
-        ;;
-      w3m )
-        # Runtime only
-        [[ "$PKG" = "docbook-utils" ]] && continue
-        # Used to rebuild the documentation
-        [[ "$PKG" = "linux-pam" ]] && continue
-        ;;
-    esac
-
-    #------------------
-    # XML file of dependency package
-    DEP_XML=`grep "^$DEP[[:space:]]" ../packages | cut -f2`
-    case $DEP in
-      x-window-system | alsa ) ;; # No page for that (proper link must be created when generating the book)
-      xorg7 ) ;; # This page will be dump in the xorg7.xinc file
-      gnome-core | kde-core | kde-full ) ;; # Invented packages
-      * )
-        # Remove the Xinclude entry if found
-        sed -e "s,^[[:space:]]*$ENTRY_START$DEP_XML$ENTRY_END,," \
-            -e '/./!d' -i xincludes/$PKG.xinc.tmp
-        # Write the XInclude
-        echo -e "    $ENTRY_START$DEP_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp
-        ;;
-    esac
-
-    #------------------
-    # If not already created, create its dependencies list
-    if [[ ! -f dependencies/$DEP.dep ]] ; then
-      case $DEP in
-        # Skip the creation when all dependencies are circular.
-        alsa-lib | cracklib | libexif | unixodbc ) ;;
-        # Meta-packages at dependency level
-        alsa )
-          cp ../libs/alsa.dep dependencies/
-          ;;
-        kde-core )
-          cp ../libs/kde-core.dep dependencies/
-          ;;
-        x-window-system ) # When X11 is not Xorg7
-          echo -e "x-config\nx-setup\n$X11" > dependencies/x-window-system.dep
-          ;;
-        xorg7 )
-          cp ../libs/xorg7.dep dependencies/
-          ;;
-        * ) xsltproc --stringparam dependencies $DEP_LV \
-               -o dependencies/$DEP.dep ../libs/dependencies.xsl ../$DEP_XML
-          ;;
-      esac
+#echo file=$file
+rootlink=($(head -n1 $file))
+for f in $(grep '[^0-9 ]' $file); do
+#  echo "    f"=$f
+  if [ -f ${f}.dep ]; then
+    rootlink2=($(head -n1 ${f}.dep))
+    if [[ "${rootlink2[*]}" =~ "${rootlink[*]}" ]] ; then
+      tree_erase ${f}.dep
     fi
-
-    #------------------
-    # If needed, process its dependencies
-    if [[ -f dependencies/$DEP.dep ]] ; then
-      # If a premade xinclude file esist, include it
-      if [[ -f xincludes/$DEP.xinc ]] ; then
-        IFS=$'\x0A'
-        for line2 in `cat xincludes/$DEP.xinc` ; do
-          IFS=$saveIFS
-          # Remove the Xinclude entry if found
-          sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp
-          # Write the XInclude
-          echo -e "$line2" >> xincludes/$PKG.xinc.tmp
-        done
-      #------------------
-      # Create the xinclude file
-      else
-	#
-	# >>>>>> THIS IS A RECURSIVE FUNCTION CALL.. BEWARE OF GREMLINS. <<<<<<
-	#
-	# If the recursion depth is not too great this is an acceptable methodology for a script language
-	# However, uncontrolled recursion will cause a seg-fault due to stack issues with local variables.
-	#
-        set +e
-         [[ "${VERBOSITY}" > 0 ]] && echo -ne "\ncall: $((++cntr))${spaceSTR:0:$cntr}${RED}$DEP${OFF}"
-            do_dependencies $DEP
-         [[ "${VERBOSITY}" > 0 ]] && echo -ne "\n ret: $cntr${spaceSTR:0:$((cntr--))}${GREEN}$DEP${OFF}  Using $DEP Xinc to solve $PKG"
-        set -e
-
-        # Include it when done
-        IFS=$'\x0A'
-        for line2 in `cat xincludes/$DEP.xinc` ; do
-          IFS=$saveIFS
-          # Remove the Xinclude entry if found
-          sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp
-          # Write the XInclude
-          echo -e "$line2" >> xincludes/$PKG.xinc.tmp
-        done
-      fi
-    fi
-  done
-
-  #------------------
-  if [[ "$PKG" = "xorg7" ]] ; then
-    # Add their XInclude
-    PKG_XML=${BLFS_XML}/x/installing/xorg7.xml
-    echo -e "    $ENTRY_START$PKG_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp
   fi
-
-  #------------------
-  mv xincludes/$PKG.xinc.tmp xincludes/$PKG.xinc
-  IFS=$'\x0A'
-  for line in `cat xincludes/$PKG.xinc` ; do
-    IFS=$saveIFS
-    # Remove the Xinclude entry if found.
-    sed -e "s,^[[:space:]]*$line,," -e '/./!d' -i $TARGET-index.xml.tmp
-    # Write the XInclude
-    echo -e "$line" >> $TARGET-index.xml.tmp
-  done
+done
+rm -f $file
 }

Deleted: jhalfs/branches/ablfs/BLFS/libs/func_packages
===================================================================
--- jhalfs/branches/ablfs/BLFS/libs/func_packages	2012-02-22 16:44:36 UTC (rev 3566)
+++ jhalfs/branches/ablfs/BLFS/libs/func_packages	2012-02-22 17:09:47 UTC (rev 3567)
@@ -1,231 +0,0 @@
-#!/bin/bash
-#
-# $Id$
-#
-set -e
-
-#-----------------------#
-get_pkg_ver() {         # Find package version for a given package ID
-#-----------------------#
-  local pkg_id=$1
-
-  case ${pkg_id} in
-                  # ALSA packages version
-            alsa* ) pkg_id=alsa ;;
-
-                  # KDE packages version
-          kdevelop ) : ;;
-        kde*config ) : ;;
-              kde* ) pkg_id=kde ;;
-
-                  # Xorg7 packages version
-      xorg7-server ) pkg_id=xorg-server ;;
-            xterm2 ) pkg_id=xterm ;;
-            xorg7* ) pkg_id=xorg7 ;;
-
-                   # Others (ID value don't match entity name)
-    wireless_tools ) pkg_id=wireless-tools ;;
-        bind-utils ) pkg_id=bind ;;
-         html-tidy ) pkg_id=tidy ;;
-          reiserfs ) pkg_id=reiser ;;
-               xfs ) pkg_id=xfsprogs ;;
-  esac
-
-  xmllint --noent ./${BLFS_XML}/book/bookinfo.xml 2>/dev/null | \
-  grep -i " ${pkg_id}-version " | cut -d "\"" -f2 | sed "s/ /_/g"
-
-}
-
-#-----------------------#
-get_installed_ver() {   # Find installed package version for a given package ID
-#-----------------------#
-  local pkg_id=$1
-
-
-  case ${pkg_id} in
-    html-tidy )
-      find $TRACKING_DIR -name "${pkg_id}-cvs_[[:digit:]]*" | sed "s/.*${pkg_id}-//"
-      ;;
-    cdparanoia )
-      find $TRACKING_DIR -name "${pkg_id}-III-[[:digit:]]*" | sed "s/.*${pkg_id}-//"
-      ;;
-    ffmpeg )
-      find $TRACKING_DIR -name "${pkg_id}-svn_[[:digit:]]*" | sed "s/.*${pkg_id}-//"
-      ;;
-    psutils )
-      find $TRACKING_DIR -name "${pkg_id}-p[[:digit:]]*" | sed "s/.*${pkg_id}-//"
-      ;;
-    * )
-      find $TRACKING_DIR -name "${pkg_id}-[[:digit:]]*" | sed "s/.*${pkg_id}-//" | sed "s/ /_/g"
-      ;;
-  esac
-
-}
-
-#-----------------------#
-generate_packages()  {  # Master packages file
-#-----------------------#
-  local pkg_id file pkg_ver
-  local ALSA_VER GNOME_VER GNOME_MINOR_VER KDE_VER KDE_KOFFICE_VER XORG7_VER
-
-  > packages.tmp
-
-  # Extract Id and path for sect1 files
-  for file in `find $BLFS_XML -name "*.xml"` ; do
-    pkg_id=$(grep "sect1 id" $file | sed -e 's/<sect1 id="//;s/".*//')
-    case ${pkg_id} in
-      dbus-bindings | \
-      perl-modules | \
-      python-modules ) pkg_ver=0.no_version ;;
-                   * ) pkg_ver=$(get_pkg_ver $pkg_id) ;;
-    esac
-    installed_ver=$(get_installed_ver $pkg_id)
-    [[ ! -z "$pkg_id" ]] && echo -e "$pkg_id\t$file\t$pkg_ver\t$installed_ver" >> packages.tmp
-  done
-
-  # IDs clean-up (unuseful pages or commented-out packages, could be more)
-  sed -i '/template/d;/ntroduction/d;/preface/d;/alsa.xml/d;/xorg.xml/d' packages.tmp
-  sed -i '/obsolete/d;/ispell\t/d;/postlfs-/d;/-client.xml/d;/xorg7.xml/d' packages.tmp
-  sed -i '/courier.xml/d;/-other\t/d;/others-/d;/other-/d;/^ash\t/d' packages.tmp
-  sed -i '/fw-firewall\t/d;/gcc2\t/d;/cvsserver\t/d;/svnserver\t/d' packages.tmp
-  sed -i '/fam\t/d;/libungif\t/d;/ncpfs\t/d;/slrn\t/d;/konq\t/d;/arts\t/d' packages.tmp
-  sed -i '/gst-plugins\t/d;/gimp-print\t/d;/openquicktime\t/d;/compressdoc\t/d' packages.tmp
-  sed -i '/errata\t/d;/foreword\t/d;/organization\t/d;/whoread\t/d' packages.tmp
-
-  # Meta-packages version
-  ALSA_VER=$(get_pkg_ver alsa)
-  GNOME_VER=$(get_pkg_ver gnome)
-  GNOME_MINOR_VER=$(get_pkg_ver gnome-minor)
-  KDE_VER=$(get_pkg_ver kde)
-  KDE_INST_VER=$(get_installed_ver kde)
-  KDE_KOFFICE_VER=$(get_pkg_ver koffice)
-  XORG7_VER=$(get_pkg_ver xorg7)
-
-  # Meta-packages installed version
-  ALSA_INST_VER=$(get_installed_ver alsa)
-  GNOME_CORE_INST_VER=$(get_installed_ver gnome-core)
-  GNOME_FULL_INST_VER=$(get_installed_ver gnome-full)
-  KDE_CORE_INST_VER=$(get_installed_ver kde-core)
-  KDE_FULL_INST_VER=$(get_installed_ver kde-full)
-  KDE_KOFFICE_INST_VER=$(get_installed_ver kde-koffice)
-  XORG7_INST_VER=$(get_installed_ver xorg7)
-
-  # Add header with meta-packages pseudo Id
-{
-  cat << EOF
-alsa	$BLFS_XML	$ALSA_VER	$ALSA_INST_VER
-gnome-core	$BLFS_XML	$GNOME_VER$GNOME_MINOR_VER	$GNOME_CORE_INST_VER
-gnome-full	$BLFS_XML	$GNOME_VER$GNOME_MINOR_VER	$GNOME_FULL_INST_VER
-kde-core	$BLFS_XML	$KDE_VER	$KDE_CORE_INST_VER
-kde-full	$BLFS_XML	$KDE_VER	$KDE_FULL_INST_VER
-kde-koffice	$BLFS_XML	$KDE_KOFFICE_VER	$KDE_KOFFICE_INST_VER
-xorg7	$BLFS_XML	$XORG7_VER	$XORG7_INST_VER
-EOF
-} >> packages.tmp
-
-  # Dump packages list
-  sort packages.tmp -b --key=2 --field-separator=/ --output=packages
-
-  # Clean up
-  rm packages.tmp
-}
-
-# Pre-made *.dep files for meta-packages
-
-#--------------------------#
-generate_gnome_core()  {   # GNOME core
-#--------------------------#
-  local line base_xml package
-
-  > gnome-core.dep.tmp
-
-  for line in `grep "xi:include" $BLFS_XML/gnome/core/core.xml` ; do
-    base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
-    package=`grep "gnome/core/$base_xml" packages | cut -f1`
-    [[ -n "$package" ]] && echo $package >> gnome-core.dep.tmp
-  done
-
-  # Replace dummy packages with the proper ones
-  sed -i 's/GNOME-//g' gnome-core.dep.tmp
-
-  tac gnome-core.dep.tmp > libs/gnome-core.dep
-  rm gnome-core.dep.tmp
-}
-
-#--------------------------#
-generate_gnome_full()  {   # GNOME full
-#--------------------------#
-  local line base_xml package
-
-  echo "gnome-core" > gnome-full.dep.tmp
-
-  for line in `grep "xi:include" $BLFS_XML/gnome/add/add.xml` ; do
-    base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
-    package=`grep "gnome/add/$base_xml" packages | cut -f1`
-    [[ -n "$package" ]] && echo $package >> gnome-full.dep.tmp
-  done
-
-  tac gnome-full.dep.tmp > libs/gnome-full.dep
-  rm gnome-full.dep.tmp
-}
-
-#--------------------------#
-generate_kde_core()  {     # KDE core
-#--------------------------#
-  local line base_xml package
-
-  > kde-core.dep.tmp
-
-  for line in `grep "xi:include" $BLFS_XML/kde/core/core.xml` ; do
-    base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
-    package=`grep "kde/core/$base_xml" packages | cut -f1`
-    [[ -n "$package" ]] && echo $package >> kde-core.dep.tmp
-  done
-
-  tac kde-core.dep.tmp > libs/kde-core.dep
-  rm kde-core.dep.tmp
-}
-
-#--------------------------#
-generate_kde_full()  {     # KDE full
-#--------------------------#
-  local line base_xml package
-
-  echo "kde-core" > kde-full.dep.tmp
-
-  for line in `grep "xi:include" $BLFS_XML/kde/add/add.xml` ; do
-    base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
-    package=`grep "kde/add/$base_xml" packages | cut -f1`
-    [[ -n "$package" ]] && echo $package >> kde-full.dep.tmp
-  done
-
-  for line in `grep "xi:include" $BLFS_XML/kde/devel/devel.xml` ; do
-    base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
-    package=`grep "kde/devel/$base_xml" packages | cut -f1`
-    [[ -n "$package" ]] && echo $package >> kde-full.dep.tmp
-  done
-
-  tac kde-full.dep.tmp > libs/kde-full.dep
-  rm kde-full.dep.tmp
-}
-
-#--------------------------#
-generate_kde_koffice()  {  # KDE full + Koffice
-#--------------------------#
-  echo -e "koffice\nkde-full\nkde-core" > libs/kde-koffice.dep
-}
-
-#--------------------------#
-generate_alsa()  {         # ALSA packages
-#--------------------------#
-  echo -e "alsa-oss\nalsa-firmware\nalsa-tools\nalsa-utils\n\
-alsa-plugins\nalsa-lib" > libs/alsa.dep
-}
-
-#--------------------------#
-generate_xorg7()  {        # Xorg7 packages
-#--------------------------#
-  echo -e "x-config\nx-setup\nrman\nxterm2\nxorg7-driver\nxorg7-server\nluit\n\
-xkeyboard-config\nxorg7-font\nxorg7-data\nxorg7-app\nmesalib\nlibdrm\nxbitmaps\n\
-xorg7-lib\nlibxcb\nxcb-proto\nlibXdmcp\nlibXau\nxorg7-util\nxorg7-proto" > libs/xorg7.dep
-}

Deleted: jhalfs/branches/ablfs/BLFS/libs/func_parser
===================================================================
--- jhalfs/branches/ablfs/BLFS/libs/func_parser	2012-02-22 16:44:36 UTC (rev 3566)
+++ jhalfs/branches/ablfs/BLFS/libs/func_parser	2012-02-22 17:09:47 UTC (rev 3567)
@@ -1,151 +0,0 @@
-#!/bin/bash
-#####
-#
-# Parse the XML documents to create a 'package' book
-#
-# $Id$
-#####
-
-
-#----------------------------#
-generate_TARGET_xml()  {     #
-#----------------------------#
-: <<inline_doc
-    function:   Generate the XML document for the TARGET package
-    input vars: nothing
-    externals:  vars: TARGET
-    modifies:   nothing
-    returns:    nothing
-    output:     file: $TARGET-index.xml
-    on error:   nothing
-    on success: nothing
-inline_doc
-
-  local
-  echo -en "\n\tGenerating $TARGET-index.xml ..."
-
-  #---------------------
-  # Header to $TARGET-index.xml
-{
-cat << EOF
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" >
-
-<book>
-
-  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/book/bookinfo.xml"/>
-
-  <preface>
-    <?dbhtml filename="preface.html" dir="preface"?>
-
-    <title>Preface</title>
-
-    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/introduction/important/locale-issues.xml"/>
-    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/introduction/important/bootscripts.xml"/>
-
-  </preface>
-
-  <chapter>
-    <?dbhtml filename="chapter.html" dir="installing"?>
-
-    <title>Installing $TARGET in Dependencies Build Order</title>
-
-EOF
-} > $TARGET-index.xml
-
-  #---------------------
-  # Dump $TARGET-index.xml.tmp in reverse order.
-  tac $TARGET-index.xml.tmp >> $TARGET-index.xml
-  rm $TARGET-index.xml.tmp
-
-  #---------------------
-  # Footer of $TARGET-index.xml
-{
-cat << EOF
-
-  </chapter>
-
-  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/appendices/creat-comm.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/appendices/ac-free-lic.xml"/>
-
-  <index/>
-
-</book>
-
-EOF
-} >> $TARGET-index.xml
-
-  echo "done"
-}
-
-
-#-------------------------#
-generate_target_book() {  #
-#-------------------------#
-: <<inline_doc
-    function:   Create an HTML document of the requested TARGET.
-    input vars: nothing
-    externals:  vars: TARGET
-                      BLFS_XML
-                      MAIL_SERVER
-                      X11
-    modifies:   nothing
-    returns:    nothing
-    output:     file: NUMEROUS FILES
-    on error:   nothing
-    on success: nothing
-inline_doc
-
-  local filename # output filename
-  echo -en  "\n\tGenerating <$TARGET> HTML book from <$BLFS_XML> xml files ..."
-  xsltproc --xinclude --nonet \
-           --stringparam mail_server $MAIL_SERVER \
-           --stringparam xwindow $X11 \
-           --stringparam base.dir HTML/ \
-           ../libs/book.xsl \
-           $TARGET-index.xml > xsltproc.log 2>&1
-  mkdir HTML/{stylesheets,images}
-  cp ../$BLFS_XML/stylesheets/lfs-xsl/*.css HTML/stylesheets
-  cp ../$BLFS_XML/images/*.png HTML/images
-  cd HTML
-  sed -i -e "s at ../stylesheets at stylesheets@g" *.html
-  sed -i -e "s at ../images at images@g" *.html
-  for filename in `find . -name "*.html"` ; do
-    tidy -config ../../$BLFS_XML/tidy.conf $filename || true
-    sh ../../$BLFS_XML/obfuscate.sh $filename
-    sed -i -e "s at text/html at application/xhtml+xml at g" $filename
-  done
-  cd ..
-  echo "done"
-}
-
-
-#-------------------------#
-create_build_scripts() {  #
-#-------------------------#
-: <<inline_doc
-    function:   Create shell scripts of the requested TARGET.
-    input vars: $1 use sudo n/y
-    externals:  TARGET
-    modifies:   nothing
-    returns:    nothing
-    output:     file: NUMEROUS FILES
-    on error:   nothing
-    on success: nothing
-inline_doc
-
-  # Log separator
-  echo -e "\n\tScripts generation depuration and errors:\n" >> xsltproc.log
-
-  echo -en "\n\tGenerating the build scripts ..."
-  xsltproc --xinclude --nonet \
-           --stringparam sudo $SUDO \
-           -o ./scripts/ ../libs/scripts.xsl \
-           $TARGET-index.xml >> xsltproc.log 2>&1
-    # Make the scripts executable.
-  chmod -R +x scripts
-  cd ..
-  echo -e "done\n"
-
-}

Deleted: jhalfs/branches/ablfs/BLFS/libs/scripts.xsl
===================================================================
--- jhalfs/branches/ablfs/BLFS/libs/scripts.xsl	2012-02-22 16:44:36 UTC (rev 3566)
+++ jhalfs/branches/ablfs/BLFS/libs/scripts.xsl	2012-02-22 17:09:47 UTC (rev 3567)
@@ -1,496 +0,0 @@
-<?xml version="1.0"?>
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns:exsl="http://exslt.org/common"
-    extension-element-prefixes="exsl"
-    version="1.0">
-
-<!-- $Id$ -->
-
-<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
-
-  <!-- Build as user (y) or as root (n)? -->
-  <xsl:param name="sudo" select="y"/>
-
-  <xsl:template match="/">
-    <xsl:apply-templates select="//sect1"/>
-  </xsl:template>
-
-<!--=================== Master chunks code ======================-->
-
-  <xsl:template match="sect1">
-    <xsl:if test="(count(descendant::screen/userinput) > 0 and
-                  count(descendant::screen/userinput) >
-                  count(descendant::screen[@role='nodump'])) and
-                  @id != 'locale-issues' and @id != 'xorg7' and
-                  @id != 'x-setup'">
-
-        <!-- The file names -->
-      <xsl:variable name="filename" select="@id"/>
-
-        <!-- Package name (use "Download FTP" by default. If empty, use "Download HTTP" -->
-      <xsl:variable name="package">
-        <xsl:choose>
-          <xsl:when
-            test="string-length(sect2[@role='package']/itemizedlist/listitem[2]/para/ulink/@url)
-            > '10'">
-            <xsl:call-template name="package_name">
-              <xsl:with-param name="url"
-                select="sect2[@role='package']/itemizedlist/listitem[2]/para/ulink/@url"/>
-            </xsl:call-template>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:call-template name="package_name">
-              <xsl:with-param name="url"
-                select="sect2[@role='package']/itemizedlist/listitem[1]/para/ulink/@url"/>
-            </xsl:call-template>
-          </xsl:otherwise>
-        </xsl:choose>
-      </xsl:variable>
-
-        <!-- FTP dir name -->
-      <xsl:variable name="ftpdir">
-        <xsl:call-template name="ftp_dir">
-          <xsl:with-param name="package" select="$package"/>
-        </xsl:call-template>
-      </xsl:variable>
-
-        <!-- The build order -->
-      <xsl:variable name="position" select="position()"/>
-      <xsl:variable name="order">
-        <xsl:choose>
-          <xsl:when test="string-length($position) = 1">
-            <xsl:text>00</xsl:text>
-            <xsl:value-of select="$position"/>
-          </xsl:when>
-          <xsl:when test="string-length($position) = 2">
-            <xsl:text>0</xsl:text>
-            <xsl:value-of select="$position"/>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:value-of select="$position"/>
-          </xsl:otherwise>
-        </xsl:choose>
-      </xsl:variable>
-
-      <!-- Depuration code -->
-      <xsl:message>
-        <xsl:text>SCRIPT is </xsl:text>
-        <xsl:value-of select="concat($order,'-',$filename)"/>
-        <xsl:text>&#xA;   PACKAGE is </xsl:text>
-        <xsl:value-of select="$package"/>
-        <xsl:text>&#xA;    FTPDIR is </xsl:text>
-        <xsl:value-of select="$ftpdir"/>
-        <xsl:text>&#xA;&#xA;</xsl:text>
-      </xsl:message>
-
-        <!-- Creating the scripts -->
-      <exsl:document href="{$order}-z-{$filename}" method="text">
-        <xsl:text>#!/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
-        <xsl:choose>
-          <!-- Package page -->
-          <xsl:when test="sect2[@role='package'] and not(@id = 'xorg7-app' or
-                          @id = 'xorg7-data' or @id = 'xorg7-driver' or
-                          @id = 'xorg7-font' or @id = 'xorg7-lib' or
-                          @id = 'xorg7-proto' or @id = 'xorg7-util')">
-            <!-- Variables -->
-            <xsl:text>SRC_ARCHIVE=$SRC_ARCHIVE&#xA;</xsl:text>
-            <xsl:text>FTP_SERVER=$FTP_SERVER&#xA;&#xA;PACKAGE=</xsl:text>
-            <xsl:value-of select="$package"/>
-            <xsl:text>&#xA;PKG_DIR=</xsl:text>
-            <xsl:value-of select="$ftpdir"/>
-            <xsl:text>&#xA;SRC_DIR=$SRC_DIR&#xA;&#xA;</xsl:text>
-            <!-- Download code and build commands -->
-            <xsl:apply-templates select="sect2">
-              <xsl:with-param name="package" select="$package"/>
-              <xsl:with-param name="ftpdir" select="$ftpdir"/>
-            </xsl:apply-templates>
-            <!-- Clean-up -->
-            <xsl:if test="not(@id='mesalib')">
-              <xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
-              <xsl:text>rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
-            </xsl:if>
-            <xsl:if test="@id='xorg7-server'">
-              <xsl:text>cd $SRC_DIR/MesaLib
-UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
-rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
-            </xsl:if>
-          </xsl:when>
-          <!-- Xorg7 pseudo-packages -->
-          <xsl:when test="contains(@id,'xorg7') and not(@id = 'xorg7-server')">
-            <xsl:text>SRC_DIR=$SRC_DIR
-
-cd $SRC_DIR
-mkdir -p xc
-cd xc&#xA;</xsl:text>
-            <xsl:apply-templates select="sect2" mode="xorg7"/>
-          </xsl:when>
-          <!-- Non-package page -->
-          <xsl:otherwise>
-            <xsl:apply-templates select=".//screen"/>
-          </xsl:otherwise>
-        </xsl:choose>
-        <xsl:text>exit</xsl:text>
-      </exsl:document>
-
-    </xsl:if>
-  </xsl:template>
-
-<!--======================= Sub-sections code =======================-->
-
-  <xsl:template match="sect2">
-    <xsl:param name="package" select="foo"/>
-    <xsl:param name="ftpdir" select="foo"/>
-    <xsl:choose>
-      <xsl:when test="@role = 'package'">
-        <xsl:text>mkdir -p $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
-        <xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
-        <xsl:apply-templates select="itemizedlist/listitem/para">
-          <xsl:with-param name="package" select="$package"/>
-          <xsl:with-param name="ftpdir" select="$ftpdir"/>
-        </xsl:apply-templates>
-        <xsl:text>&#xA;</xsl:text>
-      </xsl:when>
-      <xsl:when test="@role = 'installation'">
-        <xsl:text>
-if [[ -e unpacked ]] ; then
-  UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
-  [[ -n $UNPACKDIR ]] && [[ -d $UNPACKDIR ]] && rm -rf $UNPACKDIR
-fi
-tar -xvf $PACKAGE > unpacked
-UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
-cd $UNPACKDIR&#xA;</xsl:text>
-        <xsl:apply-templates select=".//screen | .//para/command"/>
-        <xsl:if test="$sudo = 'y'">
-          <xsl:text>sudo /sbin/</xsl:text>
-        </xsl:if>
-        <xsl:text>ldconfig&#xA;&#xA;</xsl:text>
-      </xsl:when>
-      <xsl:when test="@role = 'configuration'">
-        <xsl:apply-templates select=".//screen"/>
-        <xsl:text>&#xA;</xsl:text>
-      </xsl:when>
-    </xsl:choose>
-  </xsl:template>
-
-  <xsl:template match="sect2" mode="xorg7">
-    <xsl:choose>
-      <xsl:when test="@role = 'package'">
-        <xsl:apply-templates select="itemizedlist/listitem/para" mode="xorg7"/>
-      </xsl:when>
-      <xsl:when test="not(@role)">
-        <xsl:text>SRC_ARCHIVE=$SRC_ARCHIVE
-FTP_SERVER=$FTP_SERVER&#xA;</xsl:text>
-        <xsl:apply-templates select=".//screen" mode="sect-ver"/>
-        <xsl:text>mkdir -p ${section}&#xA;cd ${section}&#xA;</xsl:text>
-        <xsl:apply-templates select="../sect2[@role='package']/itemizedlist/listitem/para" mode="xorg7-patch"/>
-        <xsl:text>for line in $(grep -v '^#' ../${sect_ver}.wget) ; do
-  if [[ ! -f ${line} ]] ; then
-    if [[ -f $SRC_ARCHIVE/Xorg/${section}/${line} ]] ; then
-      cp $SRC_ARCHIVE/Xorg/${section}/${line} ${line}
-    elif [[ -f $SRC_ARCHIVE/Xorg/${line} ]] ; then
-      cp $SRC_ARCHIVE/Xorg/${line} ${line}
-    elif [[ -f $SRC_ARCHIVE/${section}/${line} ]] ; then
-      cp $SRC_ARCHIVE/${section}/${line} ${line}
-    elif [[ -f $SRC_ARCHIVE/${line} ]] ; then
-      cp $SRC_ARCHIVE/${line} ${line}
-    else
-      wget ${FTP_SERVER}conglomeration/Xorg/${line} || \
-      wget http://xorg.freedesktop.org/releases/individual/${section}/${line}
-    fi
-  fi
-done
-md5sum -c ../${sect_ver}.md5
-cp ../${sect_ver}.wget ../${sect_ver}.wget.orig
-cp ../${sect_ver}.md5 ../${sect_ver}.md5.orig&#xA;</xsl:text>
-      </xsl:when>
-      <xsl:when test="@role = 'installation'">
-        <xsl:text>for package in $(grep -v '^#' ../${sect_ver}.wget) ; do
-  packagedir=$(echo $package | sed 's/.tar.bz2//')
-  tar -xf ${package}
-  cd ${packagedir}&#xA;</xsl:text>
-        <xsl:apply-templates select=".//screen | .//para/command"/>
-        <xsl:text>  cd ..
-  rm -rf ${packagedir}
-  sed -i "/${package}/d" ../${sect_ver}.wget
-  sed -i "/${package}/d" ../${sect_ver}.md5
-done
-mv ../${sect_ver}.wget.orig ../${sect_ver}.wget
-mv ../${sect_ver}.md5.orig ../${sect_ver}.md5&#xA;</xsl:text>
-        <xsl:if test="$sudo = 'y'">
-          <xsl:text>sudo /sbin/</xsl:text>
-        </xsl:if>
-        <xsl:text>ldconfig&#xA;&#xA;</xsl:text>
-      </xsl:when>
-      <xsl:when test="@role = 'configuration'">
-        <xsl:apply-templates select=".//screen"/>
-        <xsl:text>&#xA;</xsl:text>
-      </xsl:when>
-    </xsl:choose>
-  </xsl:template>
-
-<!--==================== Download code =======================-->
-
-  <xsl:template name="package_name">
-    <xsl:param name="url" select="foo"/>
-    <xsl:param name="sub-url" select="substring-after($url,'/')"/>
-    <xsl:choose>
-      <xsl:when test="contains($sub-url,'/')">
-        <xsl:call-template name="package_name">
-          <xsl:with-param name="url" select="$sub-url"/>
-        </xsl:call-template>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:choose>
-          <xsl:when test="contains($sub-url,'?')">
-            <xsl:value-of select="substring-before($sub-url,'?')"/>
-          </xsl:when>
-          <xsl:when test="contains($sub-url,'.patch')"/>
-          <xsl:otherwise>
-            <xsl:value-of select="$sub-url"/>
-          </xsl:otherwise>
-        </xsl:choose>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
-  <xsl:template name="ftp_dir">
-    <xsl:param name="package" select="foo"/>
-    <!-- A lot of hardcoded dir names. Not full revised yet. -->
-    <xsl:choose>
-        <!-- cdparanoia -->
-      <xsl:when test="contains($package, '-III')">
-        <xsl:text>cdparanoia</xsl:text>
-      </xsl:when>
-        <!-- DobBook 3.1 -->
-      <xsl:when test="contains($package, 'docbk31')">
-        <xsl:text>docbk</xsl:text>
-      </xsl:when>
-        <!-- gc -->
-      <xsl:when test="contains($package, 'gc6')">
-        <xsl:text>gc</xsl:text>
-      </xsl:when>
-        <!-- ISO-codes -->
-      <xsl:when test="contains($package, 'iso-codes')">
-        <xsl:text>iso-codes</xsl:text>
-      </xsl:when>
-        <!-- JPEG -->
-      <xsl:when test="contains($package, 'jpegsrc')">
-        <xsl:text>jpeg</xsl:text>
-      </xsl:when>
-        <!-- lynx -->
-      <xsl:when test="contains($package, 'lynx')">
-        <xsl:text>lynx</xsl:text>
-      </xsl:when>
-        <!-- ntp -->
-      <xsl:when test="contains($package, 'ntp')">
-        <xsl:text>ntp</xsl:text>
-      </xsl:when>
-        <!-- OpenLDAP -->
-      <xsl:when test="contains($package, 'openldap')">
-        <xsl:text>openldap</xsl:text>
-      </xsl:when>
-        <!-- Open Office -->
-      <xsl:when test="contains($package, 'OOo')">
-        <xsl:text>OOo</xsl:text>
-      </xsl:when>
-        <!-- pine -->
-      <xsl:when test="contains($package, 'pine')">
-        <xsl:text>pine</xsl:text>
-      </xsl:when>
-        <!-- portmap -->
-      <xsl:when test="contains($package, 'portmap')">
-        <xsl:text>portmap</xsl:text>
-      </xsl:when>
-        <!-- psutils -->
-      <xsl:when test="contains($package, 'psutils')">
-        <xsl:text>psutils</xsl:text>
-      </xsl:when>
-        <!-- qpopper -->
-      <xsl:when test="contains($package, 'qpopper')">
-        <xsl:text>qpopper</xsl:text>
-      </xsl:when>
-        <!-- QT -->
-      <xsl:when test="contains($package, 'qt-x')">
-        <xsl:text>qt-x11-free</xsl:text>
-      </xsl:when>
-        <!-- sendmail -->
-      <xsl:when test="contains($package, 'sendmail')">
-        <xsl:text>sendmail</xsl:text>
-      </xsl:when>
-        <!-- Slib -->
-      <xsl:when test="contains($package, 'slib')">
-        <xsl:text>slib</xsl:text>
-      </xsl:when>
-        <!-- TCL -->
-      <xsl:when test="contains($package, 'tcl')">
-        <xsl:text>tcl</xsl:text>
-      </xsl:when>
-        <!-- tcpwrappers -->
-      <xsl:when test="contains($package, 'tcp_wrappers')">
-        <xsl:text>tcp_wrappers</xsl:text>
-      </xsl:when>
-        <!-- TeTeX -->
-      <xsl:when test="contains($package, 'tetex')">
-        <xsl:text>tetex</xsl:text>
-      </xsl:when>
-        <!-- Tidy -->
-      <xsl:when test="contains($package, 'tidy')">
-        <xsl:text>tidy</xsl:text>
-      </xsl:when>
-        <!-- Tk -->
-      <xsl:when test="contains($package, 'tk8')">
-        <xsl:text>tk</xsl:text>
-      </xsl:when>
-        <!-- unzip -->
-      <xsl:when test="contains($package, 'unzip')">
-        <xsl:text>unzip</xsl:text>
-      </xsl:when>
-        <!-- wireless_tools -->
-      <xsl:when test="contains($package, 'wireless_tools')">
-        <xsl:text>wireless_tools</xsl:text>
-      </xsl:when>
-        <!-- whois -->
-      <xsl:when test="contains($package, 'whois')">
-        <xsl:text>whois</xsl:text>
-      </xsl:when>
-        <!-- XOrg -->
-      <xsl:when test="contains($package, 'X11R6')">
-        <xsl:text>Xorg</xsl:text>
-      </xsl:when>
-        <!-- zip -->
-      <xsl:when test="contains($package, 'zip2')">
-        <xsl:text>zip</xsl:text>
-      </xsl:when>
-        <!-- General rule -->
-      <xsl:otherwise>
-        <xsl:variable name="cut"
-          select="translate(substring-after($package, '-'), '0123456789', '0000000000')"/>
-        <xsl:variable name="package2">
-          <xsl:value-of select="substring-before($package, '-')"/>
-          <xsl:text>-</xsl:text>
-          <xsl:value-of select="$cut"/>
-        </xsl:variable>
-        <xsl:value-of select="substring-before($package2, '-0')"/>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
-  <xsl:template match="itemizedlist/listitem/para">
-    <xsl:param name="package" select="foo"/>
-    <xsl:param name="ftpdir" select="foo"/>
-    <xsl:choose>
-      <!-- This depend on all package pages having both "Download HTTP" and "Download FTP" lines -->
-      <xsl:when test="contains(string(),'HTTP')">
-        <xsl:text>if [[ ! -f $PACKAGE ]] ; then&#xA;</xsl:text>
-        <!-- SRC_ARCHIVE may have subdirectories or not -->
-        <xsl:text>  if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE ]] ; then&#xA;</xsl:text>
-        <xsl:text>    cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE $PACKAGE&#xA;</xsl:text>
-        <xsl:text>  elif [[ -f $SRC_ARCHIVE/$PACKAGE ]] ; then&#xA;</xsl:text>
-        <xsl:text>    cp $SRC_ARCHIVE/$PACKAGE $PACKAGE&#xA;  else&#xA;</xsl:text>
-        <!-- The FTP_SERVER mirror -->
-        <xsl:text>    wget ${FTP_SERVER}conglomeration/$PKG_DIR/$PACKAGE</xsl:text>
-        <!-- Upstream HTTP URL -->
-        <xsl:if test="string-length(ulink/@url) > '10'">
-          <xsl:text> || \&#xA;    wget </xsl:text>
-          <xsl:choose>
-            <xsl:when test="contains(ulink/@url,'?')">
-              <xsl:value-of select="substring-before(ulink/@url,'?')"/>
-            </xsl:when>
-            <xsl:otherwise>
-              <xsl:value-of select="ulink/@url"/>
-            </xsl:otherwise>
-          </xsl:choose>
-        </xsl:if>
-      </xsl:when>
-      <xsl:when test="contains(string(),'FTP')">
-        <!-- Upstream FTP URL -->
-        <xsl:if test="string-length(ulink/@url) > '10'">
-          <xsl:text> || \&#xA;    wget </xsl:text>
-          <xsl:value-of select="ulink/@url"/>
-        </xsl:if>
-        <xsl:text>&#xA;  fi&#xA;fi&#xA;</xsl:text>
-      </xsl:when>
-      <xsl:when test="contains(string(),'MD5')">
-        <xsl:text>echo "</xsl:text>
-        <xsl:value-of select="substring-after(string(),'sum: ')"/>
-        <xsl:text>&#x20;&#x20;$PACKAGE" | md5sum -c -&#xA;</xsl:text>
-      </xsl:when>
-      <!-- Patches -->
-      <xsl:when test="contains(string(ulink/@url),'.patch')">
-        <xsl:text>wget </xsl:text>
-        <xsl:value-of select="ulink/@url"/>
-        <xsl:text>&#xA;</xsl:text>
-      </xsl:when>
-    </xsl:choose>
-  </xsl:template>
-
-  <xsl:template match="itemizedlist/listitem/para" mode="xorg7">
-    <xsl:if test="contains(string(ulink/@url),'.md5') or
-                  contains(string(ulink/@url),'.wget')">
-      <xsl:text>wget </xsl:text>
-      <xsl:value-of select="ulink/@url"/>
-      <xsl:text>&#xA;</xsl:text>
-    </xsl:if>
-  </xsl:template>
-
-  <xsl:template match="itemizedlist/listitem/para" mode="xorg7-patch">
-    <xsl:if test="contains(string(ulink/@url),'.patch')">
-      <xsl:text>wget </xsl:text>
-      <xsl:value-of select="ulink/@url"/>
-      <xsl:text>&#xA;</xsl:text>
-    </xsl:if>
-  </xsl:template>
-
-<!--======================== Commands code ==========================-->
-
-  <xsl:template match="screen">
-    <xsl:if test="child::* = userinput and not(@role = 'nodump')">
-      <xsl:if test="@role = 'root' and $sudo = 'y'">
-        <xsl:text>sudo sh -c '</xsl:text>
-      </xsl:if>
-      <xsl:apply-templates select="userinput"/>
-      <xsl:if test="@role = 'root' and $sudo = 'y'">
-        <xsl:text>'</xsl:text>
-      </xsl:if>
-      <xsl:text>&#xA;</xsl:text>
-    </xsl:if>
-  </xsl:template>
-
-  <xsl:template match="screen" mode="sect-ver">
-    <xsl:text>section=</xsl:text>
-    <xsl:value-of select="substring-before(substring-after(string(),'mkdir '),' &')"/>
-    <xsl:text>&#xA;sect_ver=</xsl:text>
-    <xsl:value-of select="substring-before(substring-after(string(),'-c ../'),'.md5')"/>
-    <xsl:text>&#xA;</xsl:text>
-  </xsl:template>
-
-  <xsl:template match="para/command">
-    <xsl:if test="(contains(string(),'test') or
-            contains(string(),'check'))">
-      <xsl:text>#</xsl:text>
-      <xsl:value-of select="substring-before(string(),'make')"/>
-      <xsl:text>make -k</xsl:text>
-      <xsl:value-of select="substring-after(string(),'make')"/>
-      <xsl:text> || true&#xA;</xsl:text>
-    </xsl:if>
-  </xsl:template>
-
-  <xsl:template match="userinput">
-    <xsl:apply-templates/>
-  </xsl:template>
-
-  <xsl:template match="replaceable">
-    <xsl:choose>
-      <xsl:when test="ancestor::sect1[@id='xorg7-server']">
-        <xsl:text>$SRC_DIR/MesaLib</xsl:text>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:text>**EDITME</xsl:text>
-        <xsl:apply-templates/>
-        <xsl:text>EDITME**</xsl:text>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
-</xsl:stylesheet>

Added: jhalfs/branches/ablfs/BLFS/packdesc.dtd
===================================================================
--- jhalfs/branches/ablfs/BLFS/packdesc.dtd	                        (rev 0)
+++ jhalfs/branches/ablfs/BLFS/packdesc.dtd	2012-02-22 17:09:47 UTC (rev 3567)
@@ -0,0 +1,22 @@
+<!-- Top level element -->
+<!ELEMENT princList (list+)>
+<!-- list corresponds to parts of the book -->
+<!ELEMENT list (name,sublist+)>
+<!ATTLIST list id ID #IMPLIED>
+<!-- sublist corresponds to chapters of the book -->
+<!ELEMENT sublist (name,package*)>
+<!ATTLIST sublist id ID #IMPLIED>
+<!-- information on package -->
+<!ELEMENT package (name,((version,inst-version?,dependency*)|module+))>
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT version (#PCDATA)>
+<!ELEMENT inst-version (#PCDATA)>
+<!-- Modules -->
+<!ELEMENT module (name,version,inst-version?,dependency*)>
+<!-- dependencies -->
+<!ELEMENT dependency (dependency*)>
+<!-- subdependencies of a dependency are defined for example in Perl
+     modules -->
+<!ATTLIST dependency status (required|recommended|optional) "recommended"
+                     name CDATA #REQUIRED
+                     type (ref|link) "ref">

Deleted: jhalfs/branches/ablfs/BLFS/update_book.sh
===================================================================
--- jhalfs/branches/ablfs/BLFS/update_book.sh	2012-02-22 16:44:36 UTC (rev 3566)
+++ jhalfs/branches/ablfs/BLFS/update_book.sh	2012-02-22 17:09:47 UTC (rev 3567)
@@ -1,108 +0,0 @@
-#!/bin/bash
-#
-# $Id$
-#
-set -e
-
-declare -r SVN="svn://svn.linuxfromscratch.org"
-
-DOC_MODE=$1  # Action to take, update, get or none
-BLFS_XML=$2  # Book directory
-TREE=$3      # SVN tree for the BLFS book version
-
-[[ -z $BLFS_XML ]] && BLFS_XML=blfs-xml
-[[ -z $DOC_MODE ]] && DOC_MODE=update
-[[ -z $TREE ]] && TREE=trunk/BOOK
-
-TRACKING_DIR=tracking-dir
-
-#---------------------
-# packages module
-source libs/func_packages
-[[ $? > 0 ]] && echo -e "\n\tERROR: func_packages did not load..\n" && exit
-
-#----------------------------#
-BOOK_Source() {              #
-#----------------------------#
-: <<inline_doc
-    function:   Retrieve or upate a copy of the BLFS book
-    input vars: $1 BLFS_XML book sources directory
-                $2 DOC_MODE action get/update
-                $3 TREE     SVN tree when $2=get
-    externals:  none
-    modifies:   $BLFS_XML directory tree
-    returns:    nothing
-    output:
-    on error:   exit
-    on success: text messages
-inline_doc
-
-  case $DOC_MODE in
-    update )
-      if [[ ! -d $BLFS_XML ]] ; then
-        echo -e "\n\t$BLFS_XML is not a directory\n"
-        exit 1
-      fi
-      if [[ ! -f $BLFS_XML/x/x.xml ]] ; then
-        echo -e "\n\tLooks like $BLFS_XML is not a BLFS book sources directory\n"
-        exit 1
-      fi
-
-      if [[ -d $BLFS_XML/.svn ]] ; then
-        echo -e "\n\tUpdating the $BLFS_XML book sources ...\n"
-        pushd $BLFS_XML 1> /dev/null
-          svn up
-        popd 1> /dev/null
-        echo -e "\n\tBook sources updated."
-      else
-        echo -e "\n\tLooks like $BLFS_XML is not a svn working copy."
-        echo -e "\tSkipping BLFS sources update.\n"
-      fi
-      ;;
-
-    get )
-      [[ ! -d $BLFS_XML ]] && mkdir -pv $BLFS_XML
-      svn co $SVN/BLFS/$TREE $BLFS_XML 2>&1
-      ;;
-    * )
-        echo -e "\n\tUnknown option ${DOC_MODE} ignored.\n"
-    ;;
-  esac
-}
-
-[ "${DOC_MODE}" != "none" ] && BOOK_Source
-
-if [ "${DOC_MODE}" = "none" ] ; then
-  echo -en "\n\tGenerating packages database file ..."
-  generate_packages
-  echo "done."
-
-  echo -en "\tGenerating alsa dependencies list ..."
-  generate_alsa
-  echo "done."
-
-  echo -en "\tGenerating gnome-core dependencies list ..."
-  generate_gnome_core
-  echo "done."
-
-  echo -en "\tGenerating gnome-full dependencies list ..."
-  generate_gnome_full
-  echo "done."
-
-  echo -en "\tGenerating kde-core dependencies list ..."
-  generate_kde_core
-  echo "done."
-
-  echo -en "\tGenerating kde-full dependencies list ..."
-  generate_kde_full
-  echo -e "done."
-
-  echo -en "\tGenerating kde-koffice dependencies list ..."
-  generate_kde_koffice
-  echo -e "done."
-
-  echo -en "\tGenerating xorg7 dependencies list ..."
-  generate_xorg7
-  echo "done."
-fi
-

Added: jhalfs/branches/ablfs/BLFS/xsl/bump.xsl
===================================================================
--- jhalfs/branches/ablfs/BLFS/xsl/bump.xsl	                        (rev 0)
+++ jhalfs/branches/ablfs/BLFS/xsl/bump.xsl	2012-02-22 17:09:47 UTC (rev 3567)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!-- $Id: bump.xsl 21 2012-02-16 15:06:19Z labastie $ -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+  <xsl:param name="packages" select="'packages.xml'"/>
+  <xsl:param name="package" select="''"/>
+
+  <xsl:output
+    method="xml"
+    encoding="ISO-8859-1"
+    doctype-system="PACKDESC"/>
+
+  <xsl:template match="/">
+    <sublist>
+      <xsl:copy-of select="./sublist/name"/>
+      <xsl:apply-templates select=".//package"/>
+      <xsl:if test="not(.//package[string(name)=$package])">
+        <package>
+          <name><xsl:value-of select="$package"/></name>
+          <version><xsl:value-of select=
+            "document($packages)//package[string(name)=$package]/version"/>
+          </version>
+        </package>
+      </xsl:if>
+    </sublist>
+  </xsl:template>
+
+  <xsl:template match="package">
+    <xsl:choose>
+      <xsl:when test="string(name)=$package">
+        <package>
+          <name><xsl:value-of select="name"/></name>
+          <version><xsl:value-of select=
+            "document($packages)//package[string(name)=$package]/version"/>
+          </version>
+        </package>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select='.'/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="dirname">
+    <xsl:param name="filename" select="$packages"/>
+    <xsl:param name="dir" select="''"/>
+    <xsl:choose>
+      <xsl:when test="contains($filename,'/')">
+        <xsl:call-template name="dirname">
+          <xsl:with-param
+            name="filename"
+            select="substring-after($filename,'/')"/>
+          <xsl:with-param
+            name="dir"
+            select="concat(substring-before($filename,'/'),'/')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="not(contains($dir,'/'))">
+        <xsl:message>`packages' must be an absolute path</xsl:message>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$dir"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+</xsl:stylesheet>

Added: jhalfs/branches/ablfs/BLFS/xsl/dependencies.xsl
===================================================================
--- jhalfs/branches/ablfs/BLFS/xsl/dependencies.xsl	                        (rev 0)
+++ jhalfs/branches/ablfs/BLFS/xsl/dependencies.xsl	2012-02-22 17:09:47 UTC (rev 3567)
@@ -0,0 +1,154 @@
+<?xml version="1.0"?>
+
+<!-- $Id: dependencies.xsl 24 2012-02-16 15:26:15Z labastie $ -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="1.0">
+
+  <xsl:output method="text"/>
+
+  <xsl:param name="MTA" select="'sendmail'"/>
+  <xsl:param name="dependencies" select="2"/>
+  <xsl:param name="idofdep" select="'dbus'"/>
+
+  <xsl:key name="depnode"
+           match="package|module"
+           use="name"/>
+
+  <xsl:template match="/">
+    <xsl:apply-templates select="key('depnode',$idofdep)"/>
+  </xsl:template>
+
+  <xsl:template match="package">
+    <xsl:apply-templates select="./dependency[@status='required']"/>
+    <xsl:if test="$dependencies > '1'">
+      <xsl:apply-templates select="./dependency[@status='recommended']"/>
+      <xsl:if test="$dependencies = '3'">
+        <xsl:apply-templates select="./dependency[@status='optional']"/>
+      </xsl:if>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="module">
+    <xsl:apply-templates select="./dependency[@status='required']"/>
+    <xsl:if test="$dependencies > '1'">
+      <xsl:apply-templates select="./dependency[@status='recommended']"/>
+      <xsl:if test="$dependencies = '3'">
+        <xsl:apply-templates select="./dependency[@status='optional']"/>
+      </xsl:if>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="dependency">
+    <xsl:variable name="depname">
+      <xsl:choose>
+        <xsl:when test="@name='x-window-system'">xorg7-server</xsl:when>
+        <xsl:when test="@name='xorg7'">xorg7-server</xsl:when>
+        <xsl:when test="@name='server-mail'">
+          <xsl:value-of select="$MTA"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="@name"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="install_it">
+      <xsl:choose>
+        <xsl:when test="@type='link'">
+<!-- No way to track versions: install ! -->
+          1
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="compare-versions">
+            <xsl:with-param name="version" select="key('depnode',$depname)/version"/>
+            <xsl:with-param name="inst-version" select="key('depnode',$depname)/inst-version"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:apply-templates select="dependency"/>
+    <xsl:if test="number($install_it)">
+      <xsl:value-of select="$depname"/>
+      <xsl:text>&#xA;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+<!-- lexicographic Comparison of strings. There is no way to directly
+     compare strings in XPath. So find the position of the character
+     in the following string. On the other hand, for numeric form style
+     xx.yy.zz, we have to compare xx and x'x', which is not always
+     lexicographic: think of 2.2 vs 2.10 -->
+
+  <xsl:variable name="char-table" select="' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
+  <xsl:variable name= "dot-table" select="'.....................................................'"/>
+
+  <xsl:template name="compare-versions">
+<!-- returns non-zero if version is greater than inst-version -->
+    <xsl:param name="version"/>
+    <xsl:param name="inst-version"/>
+<!-- first make all separators (-_) into dots -->
+    <xsl:variable name="mod-ver" select="translate($version,'-_','..')"/>
+    <xsl:variable name="mod-inst-ver" select="translate($inst-version,'-_','..')"/>
+<!-- Then let us find the position of the first chars in char-table (0 if numeric or dot) -->
+    <xsl:variable name="pos-ver" select="string-length(substring-before($char-table,substring($version,1,1)))"/>
+    <xsl:variable name="pos-inst-ver" select="string-length(substring-before($char-table,substring($inst-version,1,1)))"/>
+    <xsl:choose>
+      <xsl:when test="string-length($inst-version)=0">
+        <xsl:value-of select="string-length($version)"/>
+      </xsl:when>
+      <xsl:when test="string-length($version)=0">
+        0
+      </xsl:when>
+      <xsl:when test="$pos-ver != 0">
+        <xsl:choose>
+          <xsl:when test="$pos-ver = $pos-inst-ver">
+            <xsl:call-template name="compare-versions">
+              <xsl:with-param name="version" select="substring($version,2)"/>
+              <xsl:with-param name="inst-version" select="substring($inst-version,2)"/>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:copy-of select="number($pos-ver > $pos-inst-ver)"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="substring($mod-ver,1,1)='.'">
+        <xsl:choose>
+          <xsl:when test="substring($mod-inst-ver,1,1)='.'">
+            <xsl:call-template name="compare-versions">
+              <xsl:with-param name="version" select="substring($version,2)"/>
+              <xsl:with-param name="inst-version" select="substring($inst-version,2)"/>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            0
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:choose>
+          <xsl:when test="$pos-inst-ver > 0 or substring($mod-inst-ver,1,1)='.'">
+<!-- do not know what to do: do not install -->
+           0
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:variable name="tok" select="substring-before(concat(translate($mod-ver,$char-table,$dot-table),'.'),'.')"/>
+            <xsl:variable name="inst-tok" select="substring-before(concat(translate($mod-inst-ver,$char-table,$dot-table),'.'),'.')"/>
+             <xsl:choose>
+               <xsl:when test="number($tok)=number($inst-tok)">
+                 <xsl:call-template name="compare-versions">
+                   <xsl:with-param name="version" select="substring($version,string-length($tok)+1)"/>
+                   <xsl:with-param name="inst-version" select="substring($inst-version,string-length($inst-tok)+1)"/>
+                 </xsl:call-template>
+               </xsl:when>
+               <xsl:otherwise>
+                 <xsl:copy-of select="number(number($tok) > number($inst-tok))"/>
+               </xsl:otherwise>
+             </xsl:choose>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: jhalfs/branches/ablfs/BLFS/xsl/gen_config.xsl
===================================================================
--- jhalfs/branches/ablfs/BLFS/xsl/gen_config.xsl	                        (rev 0)
+++ jhalfs/branches/ablfs/BLFS/xsl/gen_config.xsl	2012-02-22 17:09:47 UTC (rev 3567)
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!-- $Id: gen_config.xsl 21 2012-02-16 15:06:19Z labastie $ -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="1.0">
+
+  <xsl:output method="text"
+              encoding='ISO-8859-1'/>
+
+  <xsl:template match="/">
+    <xsl:apply-templates select="//list"/>
+    <xsl:text>comment ""
+
+menu    "Default package for resolving MTA dependency"
+
+choice
+        prompt  "Mail server"
+        config  MS_sendmail
+                bool    "sendmail"
+        config  MS_postfix
+                bool    "postfix"
+        config  MS_exim
+                bool    "exim"
+endchoice
+config  MAIL_SERVER
+        string
+        default sendmail        if MS_sendmail
+        default postfix         if MS_postfix
+        default exim            if MS_exim
+
+endmenu
+
+choice
+        prompt  "Dependency level"
+        default DEPLVL_2
+
+        config  DEPLVL_1
+        bool    "Required dependencies only"
+
+        config  DEPLVL_2
+        bool    "Required and recommended dependencies"
+
+        config  DEPLVL_3
+        bool    "Required, recommended and optional dependencies"
+
+endchoice
+config  optDependency
+        int
+        default 1       if DEPLVL_1
+        default 2       if DEPLVL_2
+        default 3       if DEPLVL_3
+
+
+config  SUDO
+        bool "Build as User"
+        default y
+        help
+                Select if sudo will be used (you build as a normal user)
+                        otherwise sudo is not needed (you build as root)
+</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="list">
+    <xsl:if
+      test=".//package[(version and not(inst-version)) or
+                      string(version) != string(inst-version)]">
+      <xsl:text>config	MENU_</xsl:text>
+      <xsl:value-of select="@id"/>
+      <xsl:text>
+bool	"</xsl:text>
+      <xsl:value-of select="name"/>
+      <xsl:text>"
+default	n
+
+menu "</xsl:text>
+      <xsl:value-of select="name"/>
+      <xsl:text>"
+depends MENU_</xsl:text>
+      <xsl:value-of select="@id"/>
+      <xsl:text>
+
+</xsl:text>
+      <xsl:apply-templates select="sublist"/>
+      <xsl:text>endmenu
+
+</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="sublist">
+    <xsl:if
+      test=".//package[(version and not(inst-version)) or
+                      string(version) != string(inst-version)]">
+      <xsl:text>	config	MENU_</xsl:text>
+      <xsl:value-of select="@id"/>
+      <xsl:text>
+	bool	"</xsl:text>
+      <xsl:value-of select="name"/>
+      <xsl:text>"
+	default	n
+
+	menu "</xsl:text>
+      <xsl:value-of select="name"/>
+      <xsl:text>"
+	depends MENU_</xsl:text>
+      <xsl:value-of select="@id"/>
+      <xsl:text>
+
+</xsl:text>
+      <xsl:apply-templates select="package"/>
+      <xsl:text>	endmenu
+
+</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="package">
+    <xsl:if
+      test="(version and not(inst-version)) or
+                      string(version) != string(inst-version)">
+      <xsl:text>		config	CONFIG_</xsl:text>
+      <xsl:value-of select="name"/>
+      <xsl:text>
+		bool	"</xsl:text>
+      <xsl:value-of select="name"/>
+      <xsl:text> </xsl:text>
+      <xsl:value-of select="version"/>
+      <xsl:if test="inst-version">
+        <xsl:text> [Installed </xsl:text>
+        <xsl:value-of select="inst-version"/>
+        <xsl:text>]</xsl:text>
+      </xsl:if>
+      <xsl:text>"
+		default	y
+
+</xsl:text>
+    </xsl:if>
+    <xsl:if
+      test="not(version) and ./module[not(inst-version) or
+                      string(version) != string(inst-version)]">
+      <xsl:text>		config	MENU_</xsl:text>
+      <xsl:value-of select="translate(name,' ','_')"/>
+      <xsl:text>
+		bool	"</xsl:text>
+      <xsl:value-of select="name"/>
+      <xsl:text>"
+		default	n
+
+		menu "</xsl:text>
+      <xsl:value-of select="name"/>
+      <xsl:text>"
+		depends MENU_</xsl:text>
+      <xsl:value-of select="translate(name,' ','_')"/>
+      <xsl:text>
+
+</xsl:text>
+      <xsl:apply-templates select="module"/>
+      <xsl:text>		endmenu
+
+</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="module">
+    <xsl:if
+      test="not(inst-version) or
+            string(version) != string(inst-version)">
+      <xsl:text>			config	CONFIG_</xsl:text>
+      <xsl:value-of select="name"/>
+      <xsl:text>
+			bool	"</xsl:text>
+      <xsl:value-of select="name"/>
+      <xsl:text> </xsl:text>
+      <xsl:value-of select="version"/>
+      <xsl:if test="inst-version">
+        <xsl:text> [Installed </xsl:text>
+        <xsl:value-of select="inst-version"/>
+        <xsl:text>]</xsl:text>
+      </xsl:if>
+      <xsl:text>"
+			default	y
+
+</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: jhalfs/branches/ablfs/BLFS/xsl/gen_pkg_list.xsl
===================================================================
--- jhalfs/branches/ablfs/BLFS/xsl/gen_pkg_list.xsl	                        (rev 0)
+++ jhalfs/branches/ablfs/BLFS/xsl/gen_pkg_list.xsl	2012-02-22 17:09:47 UTC (rev 3567)
@@ -0,0 +1,316 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!-- $Id: gen_pkg_list.xsl 21 2012-02-16 15:06:19Z labastie $ -->
+<!-- Takes the blfs-full.xml file and extract a list
+     of packages obeying packdesc.dtd + looks for already
+     installed packages in the tracking file (stringparam
+     'installed-packages') -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="1.0">
+
+  <xsl:param name="installed-packages" select="'../lib/instpkg.xml'"/>
+
+  <xsl:output method="xml"
+              encoding='ISO-8859-1'
+              doctype-system="./packdesc.dtd"/>
+
+<!-- specialCases.xsl is generated by a shell script:
+     allows for cases where version begins with a letter
+     and when there is no version (such as xorg7 packages) -->
+  <xsl:include href="./specialCases.xsl"/>
+
+  <xsl:template match="/">
+    <princList>
+    <xsl:text>&#xA;&#xA;</xsl:text>
+<!-- How to have blfs-bootscripts versionned? Do not know, so
+     avoid it (TODO ?) -->
+      <xsl:apply-templates select="//part[not(@id='introduction')]"/>
+    </princList>
+  </xsl:template>
+
+  <xsl:template match="part">
+    <xsl:if test="count(.//*[contains(translate(@xreflabel,
+                                               '123456789',
+                                               '000000000'),
+                                      '-0')
+                            ]) > 0">
+      <xsl:text>  </xsl:text>
+      <list>
+        <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+        <xsl:text>&#xA;    </xsl:text>
+        <xsl:element name="name">
+           <xsl:value-of select="title"/>
+        </xsl:element>
+        <xsl:text>&#xA;&#xA;</xsl:text>
+        <xsl:apply-templates select="chapter"/>
+        <xsl:text>  </xsl:text>
+      </list>
+      <xsl:text>&#xA;&#xA;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="chapter">
+    <xsl:if test="count(.//*[contains(translate(@xreflabel,
+                                               '123456789',
+                                               '000000000'),
+                                      '-0')
+                            ]) > 0">
+      <xsl:text>    </xsl:text>
+      <sublist>
+        <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+        <xsl:text>&#xA;      </xsl:text>
+        <xsl:element name="name">
+          <xsl:value-of select="title"/>
+        </xsl:element>
+        <xsl:text>&#xA;</xsl:text>
+        <xsl:apply-templates select=".//sect1[@xreflabel]">
+          <xsl:sort select="@id"/>
+        </xsl:apply-templates>
+      <xsl:text>    </xsl:text>
+      </sublist><xsl:text>&#xA;&#xA;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="sect1">
+    <xsl:choose>
+<!-- This test is to find sections containing modules (PERL, Python
+      DBus,...) -->
+      <xsl:when
+        test="not(contains(translate(@xreflabel,
+                                     '123456789',
+                                     '000000000'),
+                           '-0')) and
+              count(descendant::node()[contains(translate(@xreflabel,
+                                                         '123456789',
+                                                         '000000000'),
+                                                '-0')
+                                      ]) > 0">
+        <xsl:text>      </xsl:text>
+        <package><xsl:text>&#xA;        </xsl:text>
+          <xsl:element name="name">
+            <xsl:value-of select="title"/>
+            </xsl:element>
+          <xsl:text>&#xA;</xsl:text>
+<!-- Do not use .//*, which would include self.
+     Calls the template of specialCases.xsl,
+     which calls the "normal" template when the
+     case is normal. -->
+          <xsl:apply-templates
+            select="descendant::node()[contains(translate(@xreflabel,
+                                                         '123456789',
+                                                         '000000000'),
+                                                '-0')    
+                                      ]"
+            mode="special">
+            <xsl:sort select="@id"/>
+          </xsl:apply-templates>
+          <xsl:text>      </xsl:text>
+        </package><xsl:text>&#xA;&#xA;</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+<!-- Calls the template of specialCases.xsl,
+     which calls the "normal" template when the
+     case is normal. -->
+        <xsl:apply-templates select='.' mode="special">
+          <xsl:sort select="@id"/>
+        </xsl:apply-templates>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="*" mode="normal">
+    <xsl:variable name="version">
+      <xsl:call-template name="version">
+        <xsl:with-param name="label" select="./@xreflabel"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:choose>
+<!-- If there is a "sect1" ancestor, this means that
+     we have a module -->
+      <xsl:when test="ancestor::sect1">
+        <xsl:text>        </xsl:text>
+        <module><xsl:text>&#xA;          </xsl:text>
+          <xsl:element name="name">
+            <xsl:value-of select="./@id"/>
+          </xsl:element>
+          <xsl:text>&#xA;          </xsl:text>
+          <xsl:element name="version">
+            <xsl:value-of select="$version"/>
+          </xsl:element>
+          <xsl:if
+              test="document($installed-packages)//package[name=current()/@id]">
+            <xsl:text>&#xA;          </xsl:text>
+            <xsl:element name="inst-version">
+              <xsl:value-of
+                select="document(
+                         $installed-packages
+                                )//package[name=current()/@id]/version"/>
+            </xsl:element>
+          </xsl:if>
+<!-- Dependencies -->
+<!-- First the case of python modules or d-bus bindings -->
+          <xsl:if test="self::sect2">
+<!-- Python modules have a building order which we have to indicate
+     as dependencies. The preceding module has to be the first
+     dependency. -->
+            <xsl:if test="ancestor::sect1[@id='python-modules']">
+              <xsl:apply-templates
+                  select="preceding-sibling::sect2[@role='package']
+                           //listitem[para/xref/@linkend=current()/@id]"
+                  mode="prec-dep"/>
+            </xsl:if>
+<!-- The other dependencies (for Python modules) or dependencies (for DBus) -->
+            <xsl:apply-templates select=".//para[@role='required' or
+                                                 @role='recommended' or
+                                                 @role='optional']"
+                                 mode="dependency"/>
+          </xsl:if>
+<!-- Now the case of perl modules: let us test our XSLT abilities.
+     Well, "use the sibling, Luke" -->
+          <xsl:if test="self::bridgehead">
+            <xsl:apply-templates select="following-sibling::itemizedlist[1]
+                                        /listitem/itemizedlist/listitem"
+                                 mode="perlmod-dep">
+               <xsl:sort select="position()"
+                         data-type="number"
+                         order="descending"/>
+            </xsl:apply-templates>
+          </xsl:if>
+<!-- End dependencies -->
+          <xsl:text>&#xA;        </xsl:text>
+        </module><xsl:text>&#xA;</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+         <xsl:text>      </xsl:text>
+        <package><xsl:text>&#xA;        </xsl:text>
+          <xsl:element name="name">
+            <xsl:value-of select="./@id"/>
+          </xsl:element>
+          <xsl:text>&#xA;        </xsl:text>
+          <xsl:element name="version">
+            <xsl:value-of select="$version"/>
+          </xsl:element>
+          <xsl:if
+              test="document($installed-packages)//package[name=current()/@id]">
+            <xsl:text>&#xA;        </xsl:text>
+            <xsl:element name="inst-version">
+              <xsl:value-of
+                select="document(
+                         $installed-packages
+                                )//package[name=current()/@id]/version"/>
+            </xsl:element>
+          </xsl:if>
+<!-- Dependencies -->
+          <xsl:apply-templates select=".//para[@role='required' or
+                                               @role='recommended' or
+                                               @role='optional']"
+                               mode="dependency"/>
+<!-- End dependencies -->
+          <xsl:text>&#xA;      </xsl:text>
+        </package><xsl:text>&#xA;</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="version">
+    <xsl:param name="label" select="abc-2"/>
+    <xsl:variable name="start" select="string-length(substring-before(translate($label,'123456789','000000000'),'-0'))+2"/>
+    <xsl:variable name="prelim-ver" select="substring($label,$start)"/>
+    <xsl:choose>
+      <xsl:when test="contains($prelim-ver,'onfiguration')"/>
+      <xsl:when test="contains($prelim-ver,'escription')"/>
+      <xsl:when test="contains($prelim-ver,'EggDBus')">
+        <xsl:value-of select="substring-before($prelim-ver,' (EggDBus)')"/>
+      </xsl:when>
+      <xsl:when test="contains($label,'JDK')">
+        <xsl:value-of select="translate($prelim-ver,' ','_')"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$prelim-ver"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="para" mode="dependency">
+    <xsl:variable name="status" select="./@role"/>
+<!-- No ulink for now (see special case for Perl modules) -->
+    <xsl:for-each select="./xref">
+      <xsl:text>
+            </xsl:text>
+      <xsl:element name="dependency">
+        <xsl:attribute name="status">
+          <xsl:value-of select="$status"/>
+        </xsl:attribute>
+        <xsl:attribute name="name">
+          <xsl:value-of select="@linkend"/>
+        </xsl:attribute>
+        <xsl:attribute name="type">ref</xsl:attribute>
+      </xsl:element>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template match="listitem" mode="prec-dep">
+    <xsl:if test="preceding-sibling::listitem">
+      <xsl:text>
+            </xsl:text>
+      <xsl:element name="dependency">
+        <xsl:attribute name="status">required</xsl:attribute>
+        <xsl:attribute name="name">
+          <xsl:value-of select="preceding-sibling::listitem[1]//@linkend"/>
+        </xsl:attribute>
+        <xsl:attribute name="type">ref</xsl:attribute>
+      </xsl:element>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="listitem" mode="perlmod-dep">
+    <xsl:param name="glue" select="'&#xA;            '"/>
+    <xsl:choose>
+     <xsl:when test="para/xref|para[@id]/ulink">
+      <xsl:value-of select="$glue"/>
+      <xsl:element name="dependency">
+        <xsl:attribute name="status">
+          <xsl:choose>
+            <xsl:when
+              test="count(./para/text()[contains(string(),
+                                             'ptional')
+                                   ]
+                         )>0">optional</xsl:when>
+            <xsl:otherwise>required</xsl:otherwise>
+          </xsl:choose>
+        </xsl:attribute>
+        <xsl:attribute name="name">
+          <xsl:if test="para/xref">
+            <xsl:value-of select="para/xref/@linkend"/>
+          </xsl:if>
+          <xsl:if test="para/ulink">
+            <xsl:value-of select="para/@id"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="type">
+          <xsl:if test="para/xref">ref</xsl:if>
+          <xsl:if test="para/ulink">link</xsl:if>
+        </xsl:attribute>
+        <xsl:apply-templates select="itemizedlist/listitem"
+                             mode="perlmod-dep">
+           <xsl:sort select="position()"
+                     data-type="number"
+                     order="descending"/>
+          <xsl:with-param name="glue" select="concat($glue,'  ')"/>
+        </xsl:apply-templates>
+      </xsl:element>
+     </xsl:when>
+     <xsl:otherwise>
+       <xsl:apply-templates select="itemizedlist/listitem"
+                            mode="perlmod-dep">
+         <xsl:sort select="position()"
+                   data-type="number"
+                   order="descending"/>
+         <xsl:with-param name="glue" select="$glue"/>
+       </xsl:apply-templates>
+     </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: jhalfs/branches/ablfs/BLFS/xsl/make_book.xsl
===================================================================
--- jhalfs/branches/ablfs/BLFS/xsl/make_book.xsl	                        (rev 0)
+++ jhalfs/branches/ablfs/BLFS/xsl/make_book.xsl	2012-02-22 17:09:47 UTC (rev 3567)
@@ -0,0 +1,268 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!-- $Id: make_book.xsl 31 2012-02-19 08:25:04Z labastie $ -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+  <xsl:param name="list" select="''"/>
+  <xsl:param name="MTA" select="'sendmail'"/>
+
+  <xsl:output
+    method="xml"
+    encoding="ISO-8859-1"
+    doctype-system="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"/>
+
+  <xsl:template match="/">
+    <book>
+      <xsl:copy-of select="/book/bookinfo"/>
+      <preface>
+        <?dbhtml filename="preface.html"?>
+        <title>Preface</title>
+        <xsl:copy-of select="id('bootscripts')"/>
+      </preface>
+      <chapter>
+        <?dbhtml filename="chapter.html"?>
+        <title>Installing packages in dependency build order</title>
+        <xsl:call-template name="apply-list">
+          <xsl:with-param name="list" select="normalize-space($list)"/>
+        </xsl:call-template>
+      </chapter>
+      <xsl:copy-of select="id('CC')"/>
+      <xsl:copy-of select="id('MIT')"/>
+      <index/>
+    </book>
+  </xsl:template>
+
+<!-- apply-templates for each id in the list.
+     Those nodes can be sect1 (normal case),
+     sect2 (python modules or DBus bindings)
+     bridgehead (perl modules)
+     para (dependency of perl modules).
+     The templates after this one treat each of those cases-->
+  <xsl:template name="apply-list">
+    <xsl:param name="list" select="''"/>
+    <xsl:if test="string-length($list) > 0">
+      <xsl:choose>
+        <xsl:when test="contains($list,' ')">
+          <xsl:apply-templates select="id(substring-before($list,' '))"/>
+          <xsl:call-template name="apply-list">
+            <xsl:with-param name="list"
+                            select="substring-after($list,' ')"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates select="id($list)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:template>
+
+<!-- The normal case : just copy to the book. Exceptions are if there
+     is a xref, so use a special "mode" template -->
+  <xsl:template match="sect1">
+    <xsl:apply-templates select="." mode="sect1"/>
+  </xsl:template>
+
+  <xsl:template match="processing-instruction()" mode="sect1">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+<!-- Any node which has no xref descendant is copied verbatim. If there
+     is an xref descendant, output the node and recurse. -->
+  <xsl:template match="*" mode="sect1">
+    <xsl:choose>
+      <xsl:when test="self::xref">
+        <xsl:choose>
+          <xsl:when test="contains(concat(' ',normalize-space($list),' '),
+                                   concat(' ', at linkend,' '))">
+            <xsl:choose>
+              <xsl:when test="@linkend='x-window-system' or @linkend='xorg7'">
+                <xref linkend="xorg7-server"/>
+              </xsl:when>
+              <xsl:when test="@linkend='server-mail'">
+                <xref linkend="{$MTA}"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:copy-of select="."/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:choose>
+              <xsl:when test="@linkend='bootscripts'"> 
+                <xsl:copy-of select="."/>
+              </xsl:when> 
+              <xsl:otherwise>
+                <xsl:value-of select="@linkend"/> (in full book)
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test=".//xref">
+        <xsl:element name="{name()}">
+          <xsl:for-each select="attribute::*">
+            <xsl:attribute name="{name()}">
+              <xsl:value-of select="."/>
+            </xsl:attribute>
+          </xsl:for-each>
+          <xsl:apply-templates mode="sect1"/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="."/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- Python modules and DBus bindings -->
+  <xsl:template match="sect2">
+    <xsl:apply-templates select='.' mode="sect2"/>
+  </xsl:template>
+
+  <xsl:template match="*" mode="sect2">
+    <xsl:choose>
+      <xsl:when test="self::sect2">
+        <xsl:element name="sect1">
+          <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+          <xsl:attribute name="xreflabel"><xsl:value-of select="@xreflabel"/></xsl:attribute>
+          <xsl:processing-instruction name="dbhtml">filename="<xsl:value-of
+                          select="@id"/>.html"</xsl:processing-instruction>
+          <xsl:apply-templates mode="sect2"/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:when test="self::sect3">
+        <xsl:element name="sect2">
+          <xsl:attribute name="role">
+            <xsl:value-of select="@role"/>
+          </xsl:attribute>
+          <xsl:apply-templates mode="sect2"/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:when test="self::bridgehead">
+        <xsl:element name="bridgehead">
+          <xsl:attribute name="renderas">
+            <xsl:if test="@renderas='sect4'">sect3</xsl:if>
+            <xsl:if test="@renderas='sect5'">sect4</xsl:if>
+          </xsl:attribute>
+          <xsl:value-of select='.'/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:when test="self::xref">
+        <xsl:choose>
+          <xsl:when test="contains(concat(' ',normalize-space($list),' '),
+                                   concat(' ', at linkend,' '))">
+            <xsl:choose>
+              <xsl:when test="@linkend='x-window-system' or @linkend='xorg7'">
+                <xref linkend="xorg7-server"/>
+              </xsl:when>
+              <xsl:when test="@linkend='server-mail'">
+                <xref linkend="{$MTA}"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:copy-of select="."/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="@linkend"/> (in full book)
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test=".//xref">
+        <xsl:element name="{name()}">
+          <xsl:for-each select="attribute::*">
+            <xsl:attribute name="{name()}">
+              <xsl:value-of select="."/>
+            </xsl:attribute>
+          </xsl:for-each>
+          <xsl:apply-templates mode="sect2"/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="."/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- Perl modules : transform them to minimal sect1. Use a template
+     for installation instructions -->
+  <xsl:template match="bridgehead">
+    <xsl:element name="sect1">
+      <xsl:attribute name="id"><xsl:value-of select="./@id"/></xsl:attribute>
+      <xsl:attribute name="xreflabel"><xsl:value-of select="./@xreflabel"/></xsl:attribute>
+      <xsl:processing-instruction name="dbhtml">
+     filename="<xsl:value-of select="@id"/>.html"</xsl:processing-instruction>
+      <title><xsl:value-of select="./@xreflabel"/></title>
+      <sect2 role="package">
+        <title>Introduction to <xsl:value-of select="@id"/></title>
+        <bridgehead renderas="sect3">Package Information</bridgehead>
+        <itemizedlist spacing="compact">
+          <listitem>
+            <para>Download (HTTP): <xsl:copy-of select="./following-sibling::itemizedlist[1]/listitem/para/ulink"/></para>
+          </listitem>
+          <listitem>
+            <para>Download (FTP): <ulink url=" "/></para>
+          </listitem>
+        </itemizedlist>
+      </sect2>
+      <xsl:choose>
+        <xsl:when test="following-sibling::itemizedlist[1]//xref[@linkend='perl-standard-install'] | following-sibling::itemizedlist[1]/preceding-sibling::para//xref[@linkend='perl-standard-install']">
+          <xsl:apply-templates mode="perl-install"  select="id('perl-standard-install')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <sect2 role="installation">
+            <title>Installation of <xsl:value-of select="@xreflabel"/></title>
+            <para>Run the following commands:</para>
+            <for-each select="following-sibling::bridgehead/preceding-sibling::screen[not(@role)]">
+              <xsl:copy-of select="."/>
+            </for-each>
+            <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
+            <for-each select="following-sibling::bridgehead/preceding-sibling::screen[@role='root']">
+              <xsl:copy-of select="."/>
+            </for-each>
+          </sect2>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:element>
+  </xsl:template>
+
+<!-- The case of depdendencies of perl modules. Same treatment
+     as for perl modules. Just easier because always perl standard --> 
+  <xsl:template match="para">
+    <xsl:element name="sect1">
+      <xsl:attribute name="id"><xsl:value-of select="./@id"/></xsl:attribute>
+      <xsl:attribute name="xreflabel"><xsl:value-of select="./@xreflabel"/></xsl:attribute>
+      <xsl:processing-instruction name="dbhtml">filename="<xsl:value-of
+     select="@id"/>.html"</xsl:processing-instruction>
+      <title><xsl:value-of select="./@xreflabel"/></title>
+      <sect2 role="package">
+        <title>Introduction to <xsl:value-of select="@id"/></title>
+        <bridgehead renderas="sect3">Package Information</bridgehead>
+        <itemizedlist spacing="compact">
+          <listitem>
+            <para>Download (HTTP): <xsl:copy-of select="./ulink"/></para>
+          </listitem>
+          <listitem>
+            <para>Download (FTP): <ulink url=" "/></para>
+          </listitem>
+        </itemizedlist>
+      </sect2>
+      <xsl:apply-templates mode="perl-install"  select="id('perl-standard-install')"/>
+    </xsl:element>
+  </xsl:template>
+
+<!-- copy of the perl standard installation instructions:
+     suppress id (otherwise not unique) and note (which we
+     do not want to apply -->
+  <xsl:template match="sect2" mode="perl-install">
+    <sect2 role="installation">
+      <xsl:for-each select="./*">
+        <xsl:if test="not(self::note)">
+          <xsl:copy-of select="."/>
+        </xsl:if>
+      </xsl:for-each>
+    </sect2>
+  </xsl:template>
+</xsl:stylesheet>

Added: jhalfs/branches/ablfs/BLFS/xsl/scripts.xsl
===================================================================
--- jhalfs/branches/ablfs/BLFS/xsl/scripts.xsl	                        (rev 0)
+++ jhalfs/branches/ablfs/BLFS/xsl/scripts.xsl	2012-02-22 17:09:47 UTC (rev 3567)
@@ -0,0 +1,453 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:exsl="http://exslt.org/common"
+    extension-element-prefixes="exsl"
+    version="1.0">
+
+<!-- $Id: scripts.xsl 34 2012-02-21 16:05:09Z labastie $ -->
+
+<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
+
+  <!-- Build as user (y) or as root (n)? -->
+  <xsl:param name="sudo" select="y"/>
+
+  <xsl:template match="/">
+    <xsl:apply-templates select="//sect1"/>
+  </xsl:template>
+
+<!--=================== Master chunks code ======================-->
+
+  <xsl:template match="sect1">
+
+    <xsl:if test="@id != 'bootscripts'">
+        <!-- The file names -->
+      <xsl:variable name="filename" select="@id"/>
+
+        <!-- The build order -->
+      <xsl:variable name="position" select="position()"/>
+      <xsl:variable name="order">
+        <xsl:choose>
+          <xsl:when test="string-length($position) = 1">
+            <xsl:text>00</xsl:text>
+            <xsl:value-of select="$position"/>
+          </xsl:when>
+          <xsl:when test="string-length($position) = 2">
+            <xsl:text>0</xsl:text>
+            <xsl:value-of select="$position"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$position"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+
+      <!-- Depuration code -->
+      <xsl:message>
+        <xsl:text>SCRIPT is </xsl:text>
+        <xsl:value-of select="concat($order,'-z-',$filename)"/>
+        <xsl:text>&#xA;    FTPDIR is </xsl:text>
+        <xsl:value-of select="$filename"/>
+        <xsl:text>&#xA;&#xA;</xsl:text>
+      </xsl:message>
+
+        <!-- Creating the scripts -->
+      <exsl:document href="{$order}-z-{$filename}" method="text">
+        <xsl:text>#!/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
+        <xsl:choose>
+          <!-- Package page -->
+          <xsl:when test="sect2[@role='package'] and not(@id = 'xorg7-app' or
+                          @id = 'xorg7-data' or @id = 'xorg7-driver' or
+                          @id = 'xorg7-font' or @id = 'xorg7-lib' or
+                          @id = 'xorg7-proto' or @id = 'xorg7-util')">
+            <!-- Variables -->
+            <!-- These three lines  could be important if SRC_ARCHIVE,
+                 FTP_SERVER and SRCDIR were not set in the environment.
+                 But they are not tested for length or anything later,
+                 so not needed
+            <xsl:text>SRC_ARCHIVE=$SRC_ARCHIVE&#xA;</xsl:text>
+            <xsl:text>FTP_SERVER=$FTP_SERVER&#xA;</xsl:text>
+            <xsl:text>SRC_DIR=$SRC_DIR&#xA;&#xA;</xsl:text>-->
+            <xsl:text>&#xA;PKG_DIR=</xsl:text>
+            <xsl:value-of select="$filename"/>
+            <xsl:text>&#xA;</xsl:text>
+            <!-- Download code and build commands -->
+            <xsl:apply-templates select="sect2"/>
+            <!-- Clean-up -->
+            <!-- xorg7-server used to require mesalib tree being present.
+                 That is no more true
+            <xsl:if test="not(@id='mesalib')"> -->
+              <xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
+              <xsl:text>rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
+            <!-- Same reason as preceding comment
+            </xsl:if>
+            <xsl:if test="@id='xorg7-server'">
+              <xsl:text>cd $SRC_DIR/MesaLib
+UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
+rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
+            </xsl:if> -->
+          </xsl:when>
+          <!-- Xorg7 pseudo-packages -->
+          <xsl:when test="contains(@id,'xorg7') and not(@id = 'xorg7-server')">
+            <xsl:text># Useless SRC_DIR=$SRC_DIR
+
+cd $SRC_DIR
+mkdir -p xc
+cd xc&#xA;</xsl:text>
+            <xsl:apply-templates select="sect2" mode="xorg7"/>
+          </xsl:when>
+          <!-- Non-package page -->
+          <xsl:otherwise>
+            <xsl:apply-templates select=".//screen"/>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:text>exit</xsl:text>
+      </exsl:document>
+    </xsl:if>
+  </xsl:template>
+
+<!--======================= Sub-sections code =======================-->
+
+  <xsl:template match="sect2">
+    <xsl:choose>
+      <xsl:when test="@role = 'package'">
+        <xsl:text>mkdir -p $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
+        <xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
+        <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
+        <xsl:text>&#xA;</xsl:text>
+      </xsl:when>
+      <xsl:when test="@role = 'installation'">
+        <xsl:text>
+if [[ -e unpacked ]] ; then
+  UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
+  [[ -n $UNPACKDIR ]] && [[ -d $UNPACKDIR ]] && rm -rf $UNPACKDIR
+fi
+tar -xvf $PACKAGE > unpacked
+UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
+cd $UNPACKDIR&#xA;</xsl:text>
+        <xsl:apply-templates select=".//screen | .//para/command"/>
+        <xsl:if test="$sudo = 'y'">
+          <xsl:text>sudo /sbin/</xsl:text>
+        </xsl:if>
+        <xsl:text>ldconfig&#xA;&#xA;</xsl:text>
+      </xsl:when>
+      <xsl:when test="@role = 'configuration'">
+        <xsl:apply-templates select=".//screen" mode="config"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="sect2" mode="xorg7">
+    <xsl:choose>
+      <xsl:when test="@role = 'package'">
+        <xsl:apply-templates select="itemizedlist/listitem/para" mode="xorg7"/>
+      </xsl:when>
+      <xsl:when test="not(@role)">
+<!-- Useless        <xsl:text>SRC_ARCHIVE=$SRC_ARCHIVE
+FTP_SERVER=$FTP_SERVER&#xA;</xsl:text> -->
+        <xsl:apply-templates select=".//screen" mode="sect-ver"/>
+        <xsl:text>mkdir -p ${section}&#xA;cd ${section}&#xA;</xsl:text>
+        <xsl:apply-templates select="../sect2[@role='package']/itemizedlist/listitem/para" mode="xorg7-patch"/>
+        <xsl:text>for line in $(grep -v '^#' ../${sect_ver}.wget) ; do
+  if [[ ! -f ${line} ]] ; then
+    if [[ -f $SRC_ARCHIVE/Xorg/${section}/${line} ]] ; then
+      cp $SRC_ARCHIVE/Xorg/${section}/${line} ${line}
+    elif [[ -f $SRC_ARCHIVE/Xorg/${line} ]] ; then
+      cp $SRC_ARCHIVE/Xorg/${line} ${line}
+    elif [[ -f $SRC_ARCHIVE/${section}/${line} ]] ; then
+      cp $SRC_ARCHIVE/${section}/${line} ${line}
+    elif [[ -f $SRC_ARCHIVE/${line} ]] ; then
+      cp $SRC_ARCHIVE/${line} ${line}
+    else
+      wget -T 30 -t 5 ${FTP_X_SERVER}pub/individual/${section}/${line} || \
+      wget -T 30 -t 5 http://xorg.freedesktop.org/releases/individual/${section}/${line}
+    fi
+  fi
+done
+md5sum -c ../${sect_ver}.md5
+cp ../${sect_ver}.wget ../${sect_ver}.wget.orig
+cp ../${sect_ver}.md5 ../${sect_ver}.md5.orig&#xA;</xsl:text>
+      </xsl:when>
+      <xsl:when test="@role = 'installation'">
+        <xsl:text>for package in $(grep -v '^#' ../${sect_ver}.wget) ; do
+  packagedir=$(echo $package | sed 's/.tar.bz2//')
+  tar -xf ${package}
+  cd ${packagedir}&#xA;</xsl:text>
+        <xsl:apply-templates select=".//screen | .//para/command"/>
+        <xsl:text>  cd ..
+  rm -rf ${packagedir}
+  sed -i "/${package}/d" ../${sect_ver}.wget
+  sed -i "/${package}/d" ../${sect_ver}.md5
+done
+mv ../${sect_ver}.wget.orig ../${sect_ver}.wget
+mv ../${sect_ver}.md5.orig ../${sect_ver}.md5&#xA;</xsl:text>
+        <xsl:if test="$sudo = 'y'">
+          <xsl:text>sudo /sbin/</xsl:text>
+        </xsl:if>
+        <xsl:text>ldconfig&#xA;&#xA;</xsl:text>
+      </xsl:when>
+      <xsl:when test="@role = 'configuration'">
+        <xsl:apply-templates select=".//screen"/>
+        <xsl:text>&#xA;</xsl:text>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+<!--==================== Download code =======================-->
+
+  <xsl:template name="package_name">
+    <xsl:param name="url" select="foo"/>
+    <xsl:param name="sub-url" select="substring-after($url,'/')"/>
+    <xsl:choose>
+      <xsl:when test="contains($sub-url,'/')">
+        <xsl:call-template name="package_name">
+          <xsl:with-param name="url" select="$sub-url"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:choose>
+          <xsl:when test="contains($sub-url,'?')">
+            <xsl:value-of select="substring-before($sub-url,'?')"/>
+          </xsl:when>
+<!-- Should never happen
+          <xsl:when test="contains($sub-url,'.patch')"/> -->
+          <xsl:otherwise>
+            <xsl:value-of select="$sub-url"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="bridgehead">
+    <xsl:choose>
+      <xsl:when test="string()='Package Information'">
+        <xsl:variable name="url">
+          <xsl:choose>
+            <xsl:when
+              test="string-length(
+                following-sibling::itemizedlist[1]/listitem[1]/para/ulink/@url)
+                    > 10">
+              <xsl:value-of select=
+            "following-sibling::itemizedlist[1]/listitem[1]/para/ulink/@url"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select=
+            "following-sibling::itemizedlist[1]/listitem[2]/para/ulink/@url"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="package">
+          <xsl:call-template name="package_name">
+            <xsl:with-param name="url" select="$url"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:variable
+          name="first_letter"
+          select="translate(substring($package,1,1),
+                            'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
+                            'abcdefghijklmnopqrstuvwxyz')"/>
+        <xsl:text>PACKAGE=</xsl:text>
+        <xsl:value-of select="$package"/>
+        <xsl:text>&#xA;if [[ ! -f $PACKAGE ]] ; then&#xA;</xsl:text>
+        <!-- SRC_ARCHIVE may have subdirectories or not -->
+        <xsl:text>  if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE ]] ; then&#xA;</xsl:text>
+        <xsl:text>    cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE $PACKAGE&#xA;</xsl:text>
+        <xsl:text>  elif [[ -f $SRC_ARCHIVE/$PACKAGE ]] ; then&#xA;</xsl:text>
+        <xsl:text>    cp $SRC_ARCHIVE/$PACKAGE $PACKAGE&#xA;  else&#xA;</xsl:text>
+        <!-- The FTP_SERVER mirror -->
+        <xsl:text>    wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
+        <xsl:value-of select="$first_letter"/>
+        <xsl:text>/$PACKAGE</xsl:text>
+        <xsl:apply-templates
+             select="following-sibling::itemizedlist[1]/listitem/para"
+             mode="package"/>
+      </xsl:when>
+      <xsl:when test="string()='Additional Downloads'">
+        <xsl:apply-templates
+             select="following-sibling::itemizedlist[1]/listitem/para"
+             mode="additional"/>
+      </xsl:when>
+      <xsl:otherwise/>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="para" mode="package">
+    <xsl:choose>
+      <xsl:when test="contains(string(),'HTTP')">
+        <!-- Upstream HTTP URL -->
+        <xsl:if test="string-length(ulink/@url) > '10'">
+          <xsl:text> || \&#xA;    wget -T 30 -t 5 </xsl:text>
+          <xsl:choose>
+            <xsl:when test="contains(ulink/@url,'?')">
+              <xsl:value-of select="substring-before(ulink/@url,'?')"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="ulink/@url"/>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:if test="not(contains(string(parent::listitem/following-sibling::listitem[1]/para),'FTP'))">
+            <xsl:text>&#xA;  fi&#xA;fi&#xA;</xsl:text>
+          </xsl:if>
+        </xsl:if>
+      </xsl:when>
+      <xsl:when test="contains(string(),'FTP')">
+        <!-- Upstream FTP URL -->
+        <xsl:if test="string-length(ulink/@url) > '10'">
+          <xsl:text> || \&#xA;    wget -T 30 -t 5 </xsl:text>
+          <xsl:value-of select="ulink/@url"/>
+        </xsl:if>
+        <xsl:text>&#xA;  fi&#xA;fi&#xA;</xsl:text>
+      </xsl:when>
+      <xsl:when test="contains(string(),'MD5')">
+        <xsl:text>echo "</xsl:text>
+        <xsl:value-of select="substring-after(string(),'sum: ')"/>
+        <xsl:text>&#x20;&#x20;$PACKAGE" | md5sum -c -&#xA;</xsl:text>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="para" mode="additional">
+    <xsl:choose>
+      <xsl:when test="contains(string(ulink/@url),'.patch')">
+        <xsl:text>wget -T 30 -t 5 </xsl:text>
+        <xsl:value-of select="ulink/@url"/>
+        <xsl:text>&#xA;</xsl:text>
+      </xsl:when>
+      <xsl:when test="ulink">
+        <xsl:if test="string-length(ulink/@url) > '10'">
+          <xsl:variable name="package">
+            <xsl:call-template name="package_name">
+              <xsl:with-param name="url" select="ulink/@url"/>
+            </xsl:call-template>
+          </xsl:variable> 
+          <xsl:variable
+            name="first_letter"
+            select="translate(substring($package,1,1),
+                              'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
+                              'abcdefghijklmnopqrstuvwxyz')"/>
+          <xsl:text>PACKAGE1=</xsl:text>
+          <xsl:value-of select="$package"/>
+          <xsl:text>&#xA;if [[ ! -f $PACKAGE1 ]] ; then&#xA;</xsl:text>
+          <!-- SRC_ARCHIVE may have subdirectories or not -->
+          <xsl:text>  if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE1 ]] ; then&#xA;</xsl:text>
+          <xsl:text>    cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE1 $PACKAGE1&#xA;</xsl:text>
+          <xsl:text>  elif [[ -f $SRC_ARCHIVE/$PACKAGE1 ]] ; then&#xA;</xsl:text>
+          <xsl:text>    cp $SRC_ARCHIVE/$PACKAGE1 $PACKAGE1&#xA;  else&#xA;</xsl:text>
+          <!-- The FTP_SERVER mirror -->
+          <xsl:text>    wget -T 30 -t 5 ${FTP_SERVER}blfs/svn/</xsl:text>
+          <xsl:value-of select="$first_letter"/>
+          <xsl:text>/$PACKAGE1</xsl:text>
+          <xsl:text> || \&#xA;    wget -T 30 -t 5 </xsl:text>
+          <xsl:value-of select="ulink/@url"/>
+          <xsl:text>&#xA;  fi&#xA;fi&#xA;</xsl:text>
+        </xsl:if>
+      </xsl:when>
+      <xsl:when test="contains(string(),'MD5')">
+        <xsl:text>echo "</xsl:text>
+        <xsl:value-of select="substring-after(string(),'sum: ')"/>
+        <xsl:text>&#x20;&#x20;$PACKAGE1" | md5sum -c -&#xA;</xsl:text>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="itemizedlist/listitem/para" mode="xorg7">
+    <xsl:if test="contains(string(ulink/@url),'.md5') or
+                  contains(string(ulink/@url),'.wget')">
+      <xsl:text>wget -T 30 -t 5 </xsl:text>
+      <xsl:value-of select="ulink/@url"/>
+      <xsl:text>&#xA;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="itemizedlist/listitem/para" mode="xorg7-patch">
+    <xsl:if test="contains(string(ulink/@url),'.patch')">
+      <xsl:text>wget -T 30 -t 5 </xsl:text>
+      <xsl:value-of select="ulink/@url"/>
+      <xsl:text>&#xA;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+<!--======================== Commands code ==========================-->
+
+  <xsl:template match="screen">
+    <xsl:if test="child::* = userinput and not(@role = 'nodump')">
+      <xsl:if test="@role = 'root' and $sudo = 'y'">
+        <xsl:text>sudo sh -c '</xsl:text>
+      </xsl:if>
+      <xsl:apply-templates select="userinput"/>
+      <xsl:if test="@role = 'root' and $sudo = 'y'">
+        <xsl:text>'</xsl:text>
+      </xsl:if>
+      <xsl:text>&#xA;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="screen" mode="config">
+    <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
+      <xsl:text>[[ ! -d $SRC_DIR/blfs-bootscripts ]] && mkdir $SRC_DIR/blfs-bootscripts
+pushd $SRC_DIR/blfs-bootscripts
+URL=</xsl:text>
+      <xsl:value-of select="id('bootscripts')//itemizedlist//ulink/@url"/><xsl:text>
+BOOTPACKG=$(basename $URL)
+[[ ! -f "$BOOTPACKG" ]] && { wget -T 30 -t 5 $URL; rm -f unpacked; }
+if [[ -e unpacked ]] ; then
+  UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
+  if ! [[ -d $UNPACKDIR ]]; then
+    rm unpacked
+    tar -xvf $BOOTPACKG > unpacked
+    UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
+  fi
+else
+  tar -xvf $BOOTPACKG > unpacked
+  UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
+fi
+cd $UNPACKDIR
+</xsl:text>
+    </xsl:if>
+    <xsl:apply-templates select='.'/>
+    <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
+      <xsl:text>
+popd</xsl:text>
+    </xsl:if>
+    <xsl:text>&#xA;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="screen" mode="sect-ver">
+    <xsl:text>section=</xsl:text>
+    <xsl:value-of select="substring-before(substring-after(string(),'mkdir '),' &')"/>
+    <xsl:text>&#xA;sect_ver=</xsl:text>
+    <xsl:value-of select="substring-before(substring-after(string(),'-c ../'),'.md5')"/>
+    <xsl:text>&#xA;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="para/command">
+    <xsl:if test="(contains(string(),'test') or
+            contains(string(),'check'))">
+      <xsl:text>#</xsl:text>
+      <xsl:value-of select="substring-before(string(),'make')"/>
+      <xsl:text>make -k</xsl:text>
+      <xsl:value-of select="substring-after(string(),'make')"/>
+      <xsl:text> || true&#xA;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="userinput">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="replaceable">
+<!-- Not needed anymore
+    <xsl:choose>
+      <xsl:when test="ancestor::sect1[@id='xorg7-server']">
+        <xsl:text>$SRC_DIR/MesaLib</xsl:text>
+      </xsl:when>
+      <xsl:otherwise> -->
+        <xsl:text>**EDITME</xsl:text>
+        <xsl:apply-templates/>
+        <xsl:text>EDITME**</xsl:text>
+<!--      </xsl:otherwise>
+    </xsl:choose> -->
+  </xsl:template>
+
+</xsl:stylesheet>

Modified: jhalfs/branches/ablfs/README.BLFS
===================================================================
--- jhalfs/branches/ablfs/README.BLFS	2012-02-22 16:44:36 UTC (rev 3566)
+++ jhalfs/branches/ablfs/README.BLFS	2012-02-22 17:09:47 UTC (rev 3567)
@@ -2,7 +2,7 @@
 
 1. INTRODUCTION::
 
-     If you want to add blfs-tool support into a xLFS base system build,
+     If you want to add blfs-tool support into an xLFS base system build,
   read the "BLFS_TOOL SUPPORT" section found in the README and be sure
   to follow the after-booting installation intructions.
 
@@ -36,7 +36,7 @@
      Due the complexity of the BLFS book, the scripts and Makefile generation
   is done in several steps:
 
-  3.1  INSTALLED PACKAGES TRACKING SYSTEM
+  3.1  INSTALLED PACKAGES TRACKING SYSTEM::
 
        This tool includes a very simple tracking system to log which packages
     have been installed using the tool. It is used to skip installed packages
@@ -44,52 +44,49 @@
     updated in the BLFS book. Do not rely on this feature as a package
     management tool.
 
-       The directory where tracking files will be stored needs to be created
-    before installing blfs-tool. You can place this directory anywhere, taking
-    care that the user must have read and write privileges on that directory
-    and on all files it contains.
+       The tracking system itself is an XML file: instpkg.xml. It is
+    initialized when make is first run in blfs_root. It resides in a directory
+    which is created when needed during the process of building custom tools
+    or blfs tools, after xLFS. You can specify that directory location in
+    the blfs tools submenu of jhalfs. You may need to update permissions
+    and/or ownership of this directory before using the blfs tool.
 
-       To use the default path set in the installation menu, run as root:
+       The default location of the tracking directory is /var/lib/jhalfs/BLFS
 
-    install -d -m1777 /var/lib/jhalfs/BLFS
-
   3.2  BLFS_TOOL INSTALLATION::
 
-       Run "make" to launch the jhalfs menuconfig interface. Select the BLFS
-    book and version. Then set the installation directory (default
-    $HOME/blfs_root), the BLFS sources directory (default blfs-xml), and
-    the installed packages tracking directory (default /var/lib/jhalfs/BLFS).
+       The tools are installed just after the building of xLFS, if the
+    appropriate options have been selected in the building menu, as per
+    jhalfs README. If you forgot to select the options and xLFS has been
+    built, it is possible to go back to selecting the appropriate
+    BLFS tools options in the jhalfs menu, then tick `Run makefile'
+    and not `Rebuild files'. You obtain a /blfs_root directory in the
+    root directory of the new xLFS system, which contains the followings:
 
-       All required files will be placed in the installation directory and
-    BLFS XML sources will be installed in the named sub-directory.
-
-       Installed files:
-
     blfs-xml/*         SVN tree of the selected BLFS book version
-    lib/*              functions libraries, xsl stylesheets, and auto-generated
-                       meta-packages dependencies tree files
+    lib/*              functions libraries 
     menu/*             lxdialog and menuconfig source code
+    xsl/*              XSL stylesheets used at several stages of the process
     README.BLFS        this file
-    TODO               developers notes
-    update_book.sh     update the XML book sources and regenerates packages
-                       database and meta-packages dependencies tree
-    gen_config.sh      regenerates Config.in
+    TODO               developers notes (well, not often updated)
     gen_pkg_book.sh    resolves dependencies and generates linear BLFS books
                        and build scripts
     gen-makefile.sh    generates the target Makefile
     progress_bar.sh    the target Makefile progress bar
-    Makefile           run gen_config.sh to update Config.in,
-                       then launch the menuconfig interface, and lastly run
+    gen-special.sh     Helper script for generating the package database
+    Makefile           Used by make to update the package database from the SVN
+                       tree, then launch the menuconfig interface, and run
                        gen_pkg_book.sh based on configuration settings
-    Config.in          menuconfig interface input file
-    packages           auto-generated packages database
+    packages.xml       auto-generated packages database
+    packdesc.dtd       a simple DTD describing the format of the package
+                       database
     envars.conf        envars needed when running the target build scripts
 
        From now on, all the work must be done from inside the installation
     root directory.
 
-       When finished the installation, the configuration and target selection
-    menu is launch.
+       You may move that directory to the $HOME of a non root user, or build
+    as root from that directory.
 
   3.3  UPDATING BOOK SOURCES::
 
@@ -97,7 +94,11 @@
     installed packages to the latest version found in that book, you need to
     update the XML sources and packages database.
 
-       To do that run "./update_book.sh"
+       To do that run "make update". It may happen that the subversion
+    version of your building host is older than the version you just
+    built. This may generate weird errors like "'.' omitted". The easiest
+    thing to do in that case, is to completely remove the blfs-xml directory
+    and run "make update".
 
        On the next configuration run, packages already installed but listed
     with a new version in the book will be available for target selection
@@ -106,46 +107,53 @@
   3.4  CONFIGURING AND PARSING THE BOOK::
 
        The next step is to create a book and build scripts in dependency
-    build order for a target package. A target can be a package or a
-    meta-package.
+    build order for one or several packages.
 
-    WARNING:
-           Only one target (meta-package or individual package) must be
-           selected on each configuration run.
-	   There is no way to solve dependencies properly when more
-           than one target are selected.
-
        Run <make> to launch the configuration interface. The main menu contains
-    three blocks: meta-package selection, individual package selection, and
-    build options.
+    two blocks: individual package selection, and build options.
 
-       When a meta-package is selected, it is possible to unselect unwanted
-    components. The unselected components will be skipped if no other components
-    depends on them.
-
        In the build options section, the dependencies level and default packages
-    used to solve alternatives are set. You can also select whether the build will
-    be made as a normal user or as root. That settings are saved to be reused in
-    future configuration runs.
+    used to solve alternatives are set (currently, only for the mTA). You can
+    also select whether the build will be made as a normal user or as root.
+    Those settings are saved to be reused in future configuration runs.
 
-       If, for example, your target selection is Xsoft-->Graphweb-->galeon, a
-    directory named "galeon" will be created. Inside that directory you will
-    find a directory named "HTML" that contains a galeon-based HTML book with
-    its dependencies in build order, and a "scripts" directory with build
-    scripts for that packages.
+       When you are done with the menu, a few checks occur, and the book is
+    generated. When circular dependencies are found, a 3 line message is
+    printed:
+           A is a dependency of B
+           C is a dependency of A
+           A is a dependency of C
+    and a question:
+           Do you want to build A first?
+    This means that the system has found the dependency chain: B->A->C->A.
+    You have therefore to choose whether A is built before C, or
+    C before A: the system cannot make that choice (well, maybe in a few
+    year, with an AI system able to understand the book). if you answer no,
+    C is built first. If you answer yes, C is put in place of A as a dependency
+    of B, then the tree dependency restarts from there, that is with the
+    layout B->C->... You may then hit the case B->C->A->C, for which you
+    should answer no, unless you want to enter an infinite (human driven) loop.
 
-       There are also two other directories ("dependencies" and "xincludes")
-    that contain files generated while resolving dependencies trees.
+       You end up with a book.xml file which contains the linearized book,
+    and a rendered HTML, in the directory book-html, which you can browse with
+    "lynx book-html/index.html" (or with any other browser).
 
+       Furthermore, there is a directory "scripts", which contains the generated
+    scriptlets.
+
+       There is also another directory, "dependencies" that contains files
+    generated while resolving dependencies.
+
   3.5  EDITING BUILD SCRIPTS
 
-       Now it is time to review the generated book and scripts, making any changes
-    to the scripts necessary to fix generation bugs or to suit your needs.
+       Now it is time to review the generated book and scripts, making any
+    changes to the scripts necessary to fix generation bugs or to suit your
+    needs.
 
        Scripts for additional packages (i.e., for non-BLFS packages) can be
     easily inserted. For example, if you want to install the external dependency
     "bar" before "foo" package and the "foo" script is named "064-z-foo", you
-    need to create a "064-y-bar" build script.
+    just need to create a "064-y-bar" build script.
 
       Remember, the package tracking system isn't a package management tool
     and knows nothing about packages not in the BLFS book.
@@ -156,43 +164,39 @@
   3.6  CREATING THE MAKEFILE
 
        When the build scripts are ready to be run, the Makefile can be
-    created. Be sure that you cd into the "package" directory and run
-    ../gen-makefile.sh
+    created. Create an empty directory (for example "mkdir work") and cd
+    to that directory. Then run ../gen-makefile.sh
 
-    Review the Makefile, and, if all looks sane, start the build.
+    Review the Makefile, and, if all looks sane, start the build by running
+    "make".
 
 4. GENERATED BUILD SCRIPTS ISSUES::
 
       In this section, known issues with the generated build scripts are
-   discussed. They are due to build procedures and/or BLFS layout particularities
-   that we can't handle. In several cases, editing the build scripts is mandatory.
+   discussed. They are due to build procedures and/or BLFS layout
+   particularities that we can't handle. In several cases, editing the
+   build scripts is mandatory.
    You may also need to insert some build scripts created by you to resolve
    unhandled dependencies and/or to remove some script installing the affected
    package by hand.
 
    4.1  BLFS BOOTSCRIPTS
 
-        For now, bootscripts installation will fail. You will need to edit
-     the scripts for packages that install bootscripts and fix their
-     installation command. That could be fixed in the future.
+      Normally, bootscript installation should work. On the other hand, the
+   book does not give instruction for running them, so you might have to
+   manually insert /etc/init.d/<initscript> at some place during the build.
 
    4.2  PACKAGE CONFIGURATION
 
-        For those packages that have a "Configuration" section, you should
-     edit the build script to fit the needs of your system.
+      For those packages that have a "Configuration" section, you should
+   edit the build script to fit the needs of your system. Sometimes, the
+   bash startup files are modified (see for example the instructions for
+   llvm). You might have to insert something like "source /etc/bash_profile"
+   at some point during the build.
 
-   4.4  PDL, Perl modules, and Glib-Bindings.
-
-        The generated scripts for these packages are broken and can not
-     be fixed. You must rename it as the sub-package to be installed and
-     edit it to use the proper commads for that sub-package.
-
-        You may need to create additional scripts for these sub-package
-     dependencies, if any.
-
    4.4  GCC, JDK, Sane, and KDE-multimedia, freetype2, MesaLib and others
 
-        On the pages for these packages, the BLFS book actually has instructions
+        On the pages for those packages, the BLFS book actually has instructions
      to download and install two or more packages. You must edit the scripts to
      fix this.
 
@@ -200,7 +204,7 @@
 
    4.5  XORG7
 
-        The generated scripts for Xorg7 pseudo-packages have $SRC_ARCHIVE
+        The generated scripts for Xorg7 packages have $SRC_ARCHIVE
      support for individual packages, but not for patches nor *.wget and *.md5
      files.
 
@@ -209,7 +213,7 @@
 
        The *.wget and *.md5 files should be downladed always from inside
      the scripts to be sure that the most current individual packages are
-     used. Thus don't reuse previouly existing ones.
+     used. Thus don't reuse previously existing ones.
 
        In the script for xorg7-font, be sure to move the fonts directories
      symlinks creation to after the "for ... done" loop.

Modified: jhalfs/branches/ablfs/README.PACKAGE_MANAGEMENT
===================================================================
--- jhalfs/branches/ablfs/README.PACKAGE_MANAGEMENT	2012-02-22 16:44:36 UTC (rev 3566)
+++ jhalfs/branches/ablfs/README.PACKAGE_MANAGEMENT	2012-02-22 17:09:47 UTC (rev 3567)
@@ -60,4 +60,17 @@
   upgrade. The user has to provide his own function. A template is provided
   in the pkgmngt subdirectory.
 
+3. DETAILED INSTRUCTIONS:
 
+      Before beginning, you should know which package manager you want, where
+  to get the sources, and how to use it for:
+  a) Making a package from a directory tree. Usually, there is some control
+     file containing the version, pacakager, build system (32 or 64 bits at
+     least) or other more or less usefull but mandatory bits of information
+     which you should understand.
+  b) Unpack the package.
+
+      Second, you ought to have a basic knowledge of bash scripting and
+  docbook-xml writing, because you have to write a bash function for packing
+  and unpacking the package, and a set of instructions to install the PM.
+  

Modified: jhalfs/branches/ablfs/jhalfs
===================================================================
--- jhalfs/branches/ablfs/jhalfs	2012-02-22 16:44:36 UTC (rev 3566)
+++ jhalfs/branches/ablfs/jhalfs	2012-02-22 17:09:47 UTC (rev 3567)
@@ -437,11 +437,11 @@
     cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
     # Clean-up
     rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
+    rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn
     rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
     rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
     # Set some harcoded envars to their proper values
-    sed -i 's,blfs-xml,'$BLFS_XML',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,libs/book.xsl}
-    sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,gen-makefile.sh}
+    sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh}
     # Copy the dependencies build scripts
     cp -r $COMMON_DIR/blfs-tool-deps $JHALFSDIR/
     rm -rf $JHALFSDIR/blfs-tool-deps/.svn




More information about the alfs-log mailing list