Index: BLFS/libs/func_dependencies
===================================================================
--- BLFS/libs/func_dependencies	(revision 9b95f2a750ef12c02a82712fa31bc96106df01e5)
+++ BLFS/libs/func_dependencies	(revision 9c9775f7c4ddcf151de34dc43d4404e9277da41c)
@@ -187,4 +187,7 @@
       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)
@@ -203,5 +206,6 @@
                   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
+                  [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" < "x${inst_ver}" ]] && continue
                   ;;
         esac
@@ -212,5 +216,6 @@
     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
+    [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" < "x${inst_ver}" ]] && continue
 
     #------------------
@@ -220,7 +225,66 @@
     # due empty *.xinc files
     case $DEP in
-      jadetex | perl-* | lynx | Links | w3m )
-        # Optional dependencies are runtime only
+      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 )
@@ -228,27 +292,45 @@
         [[ "$PKG" = "libxml2" ]] && continue
         ;;
-      openldap | postgresql | $KBR5 )
-        # cyrus-sasl-->several-->cyrus-sasl
+      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
         ;;
-      espgs )
-        # sendmail-->espgs-->cups-->php-->sendmail
-        [[ "$PKG" = "$MAIL_SERVER" ]] && continue
-        ;;
-      aRts )
-        # esound-->aRts-->esound
-        [[ "$PKG" = "esound" ]] && continue
-        ;;
-      gimp | sane )
-        # imagemagick-->{sane}-->gimp-->imagemagick
-        [[ "$PKG" = "imagemagick" ]] && continue
-        ;;
-      ffmpeg )
-        # alsa-plugins-->ffmpeg-->several-->alsa-plugins
-        [[ "$PKG" = "alsa-plugins" ]] && continue
-        ;;
-      akode )
-        # Both are in the same page
-        [[ "$PKG" = "kdemultimedia" ]] && 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
Index: BLFS/libs/func_packages
===================================================================
--- BLFS/libs/func_packages	(revision 9b95f2a750ef12c02a82712fa31bc96106df01e5)
+++ BLFS/libs/func_packages	(revision 9c9775f7c4ddcf151de34dc43d4404e9277da41c)
@@ -28,5 +28,4 @@
         bind-utils ) pkg_id=bind ;;
          html-tidy ) pkg_id=tidy ;;
-               jdk ) pkg_id=jdk-src ;;
           reiserfs ) pkg_id=reiser ;;
                xfs ) pkg_id=xfsprogs ;;
@@ -34,5 +33,5 @@
 
   xmllint --noent ./${BLFS_XML}/book/bookinfo.xml 2>/dev/null | \
-  grep -i " ${pkg_id}-version " | cut -d "\"" -f2
+  grep -i " ${pkg_id}-version " | cut -d "\"" -f2 | sed "s/ /_/g"
 
 }
@@ -43,5 +42,22 @@
   local pkg_id=$1
 
-  find $TRACKING_DIR -name "${pkg_id}-[[:digit:]]*" | sed "s/.*${pkg_id}-//"
+
+  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
 
 }
@@ -58,5 +74,10 @@
   for file in `find $BLFS_XML -name "*.xml"` ; do
     pkg_id=$(grep "sect1 id" $file | sed -e 's/<sect1 id="//;s/".*//')
-    pkg_ver=$(get_pkg_ver $pkg_id)
+    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
@@ -64,10 +85,11 @@
 
   # IDs clean-up (unuseful pages or commented-out packages, could be more)
-  sed -i '/template/d;/ntroduction/d;/preface/d;/alsa.xml/d' packages.tmp
-  sed -i '/obsolete/d;/postlfs-/d;/-client.xml/d;/xorg7.xml/d' packages.tmp
-  sed -i '/courier.xml/d;/-other\t/d;/others-/d;/other-/d' packages.tmp
+  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' packages.tmp
-  sed -i '/gst-plugins\t/d;/openquicktime\t/d;/compressdoc\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
@@ -205,5 +227,5 @@
 #--------------------------#
   echo -e "x-config\nx-setup\nrman\nxterm2\nxorg7-driver\nxorg7-server\nluit\n\
-xorg7-font\nxorg7-data\nxorg7-app\nxbitmaps\nmesalib\nlibdrm\n\
-xorg7-lib\nxorg7-util\nxorg7-proto" > libs/xorg7.dep
-}
+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
+}
Index: BLFS/libs/func_parser
===================================================================
--- BLFS/libs/func_parser	(revision 9b95f2a750ef12c02a82712fa31bc96106df01e5)
+++ BLFS/libs/func_parser	(revision 9c9775f7c4ddcf151de34dc43d4404e9277da41c)
@@ -30,6 +30,6 @@
 cat << EOF
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
-  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" >
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" >
 
 <book>
@@ -107,5 +107,5 @@
            $TARGET-index.xml > xsltproc.log 2>&1
   mkdir HTML/{stylesheets,images}
-  cp ../$BLFS_XML/stylesheets/*.css HTML/stylesheets
+  cp ../$BLFS_XML/stylesheets/lfs-xsl/*.css HTML/stylesheets
   cp ../$BLFS_XML/images/*.png HTML/images
   cd HTML
Index: BLFS/libs/scripts.xsl
===================================================================
--- BLFS/libs/scripts.xsl	(revision 9b95f2a750ef12c02a82712fa31bc96106df01e5)
+++ BLFS/libs/scripts.xsl	(revision 9c9775f7c4ddcf151de34dc43d4404e9277da41c)
@@ -30,5 +30,5 @@
 
         <!-- Package name (use "Download FTP" by default. If empty, use "Download HTTP" -->
-      <xsl:param name="package">
+      <xsl:variable name="package">
         <xsl:choose>
           <xsl:when
@@ -47,12 +47,12 @@
           </xsl:otherwise>
         </xsl:choose>
-      </xsl:param>
+      </xsl:variable>
 
         <!-- FTP dir name -->
-      <xsl:param name="ftpdir">
+      <xsl:variable name="ftpdir">
         <xsl:call-template name="ftp_dir">
           <xsl:with-param name="package" select="$package"/>
         </xsl:call-template>
-      </xsl:param>
+      </xsl:variable>
 
         <!-- The build order -->
@@ -87,5 +87,5 @@
         <!-- Creating the scripts -->
       <exsl:document href="{$order}-z-{$filename}" method="text">
-        <xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text>
+        <xsl:text>#!/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
         <xsl:choose>
           <!-- Package page -->
@@ -107,6 +107,13 @@
             </xsl:apply-templates>
             <!-- Clean-up -->
-            <xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
-            <xsl:text>rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
+            <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 -->
@@ -149,5 +156,5 @@
 if [[ -e unpacked ]] ; then
   UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
-  rm -rf $UNPACKDIR
+  [[ -n $UNPACKDIR ]] &amp;&amp; [[ -d $UNPACKDIR ]] &amp;&amp; rm -rf $UNPACKDIR
 fi
 tar -xvf $PACKAGE > unpacked
@@ -156,5 +163,5 @@
         <xsl:apply-templates select=".//screen | .//para/command"/>
         <xsl:if test="$sudo = 'y'">
-          <xsl:text>sudo </xsl:text>
+          <xsl:text>sudo /sbin/</xsl:text>
         </xsl:if>
         <xsl:text>ldconfig&#xA;&#xA;</xsl:text>
@@ -169,26 +176,54 @@
   <xsl:template match="sect2" mode="xorg7">
     <xsl:choose>
-      <xsl:when test="@role = 'package'"/>
+      <xsl:when test="@role = 'package'">
+        <xsl:apply-templates select="itemizedlist/listitem/para" mode="xorg7"/>
+      </xsl:when>
       <xsl:when test="not(@role)">
-        <xsl:apply-templates select=".//screen"/>
-        <xsl:apply-templates select="../sect2[@role='package']/itemizedlist/listitem/para"
-                             mode="xorg7"/>
-        <xsl:text>WGET_LST=</xsl:text>
-        <xsl:apply-templates select=".//screen" mode="wget_lst"/>
-        <xsl:text>&#xA;</xsl:text>
+        <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 $(cat $WGET_LST) ; do
+        <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>
+  tar -xf ${package}
+  cd ${packagedir}&#xA;</xsl:text>
         <xsl:apply-templates select=".//screen | .//para/command"/>
         <xsl:text>  cd ..
-  rm -rf $packagedir
-done&#xA;</xsl:text>
+  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 </xsl:text>
+          <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>
@@ -357,8 +392,14 @@
         <xsl:text>    wget ${FTP_SERVER}conglomeration/$PKG_DIR/$PACKAGE</xsl:text>
         <!-- Upstream HTTP URL -->
-        <xsl:if test="string-length(ulink/@url) &gt; '10' and
-                      not(contains(string(ulink/@url),'sourceforge'))">
+        <xsl:if test="string-length(ulink/@url) &gt; '10'">
           <xsl:text> || \&#xA;    wget </xsl:text>
-          <xsl:value-of select="ulink/@url"/>
+          <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>
@@ -386,4 +427,13 @@
 
   <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>
@@ -398,9 +448,9 @@
     <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: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:text>'</xsl:text>
       </xsl:if>
       <xsl:text>&#xA;</xsl:text>
@@ -408,6 +458,10 @@
   </xsl:template>
 
-  <xsl:template match="screen" mode="wget_lst">
-    <xsl:value-of select="substring-after(string(),' -i ')"/>
+  <xsl:template match="screen" mode="sect-ver">
+    <xsl:text>section=</xsl:text>
+    <xsl:value-of select="substring-before(substring-after(string(),'mkdir '),' &amp;')"/>
+    <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>
 
@@ -428,7 +482,14 @@
 
   <xsl:template match="replaceable">
-    <xsl:text>**EDITME</xsl:text>
-    <xsl:apply-templates/>
-    <xsl:text>EDITME**</xsl:text>
+    <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>
 
