r2375 - in jhalfs/branches/experimental: . CLFS common

georgeb at linuxfromscratch.org georgeb at linuxfromscratch.org
Mon Mar 20 15:07:54 PST 2006


Author: georgeb
Date: 2006-03-20 16:07:53 -0700 (Mon, 20 Mar 2006)
New Revision: 2375

Added:
   jhalfs/branches/experimental/CLFS/packageslist.xsl
   jhalfs/branches/experimental/CLFS/patcheslist.xsl
Modified:
   jhalfs/branches/experimental/CLFS/config
   jhalfs/branches/experimental/common/common-functions
   jhalfs/branches/experimental/master.sh
Log:
CLFS extract_commands now part of common_func. pushd/popd added to master.sh to deal with multitiple files defined in config param FILES. Added to xsl files to CLFS dir

Modified: jhalfs/branches/experimental/CLFS/config
===================================================================
--- jhalfs/branches/experimental/CLFS/config	2006-03-20 22:26:42 UTC (rev 2374)
+++ jhalfs/branches/experimental/CLFS/config	2006-03-20 23:07:53 UTC (rev 2375)
@@ -54,7 +54,7 @@
 # Don't edit it unless you know what you are doing
 
 #--- Files that will be copied to $JHALFSDIR
-FILES=""
+FILES="patcheslist.xsl  packageslist.xsl"
 
 #--- Default stylesheet
 XSL=clfs.xsl

Added: jhalfs/branches/experimental/CLFS/packageslist.xsl
===================================================================
--- jhalfs/branches/experimental/CLFS/packageslist.xsl	                        (rev 0)
+++ jhalfs/branches/experimental/CLFS/packageslist.xsl	2006-03-20 23:07:53 UTC (rev 2375)
@@ -0,0 +1,34 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!DOCTYPE xsl:stylesheet [
+ <!ENTITY % general-entities SYSTEM "clfs-development/general.ent">
+  %general-entities;
+]>
+
+<!--$Id
+XSLT stylesheet to create wget scripts to download packages and patches.
+Only for Cross-LFS.
+
+Usage example:
+
+xsltproc -xinclude -output x86.wget stylesheets/wget.xsl x86-index.xml
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="1.0">
+
+  <xsl:output method="text"/>
+
+  <xsl:template match="/">
+    <xsl:apply-templates select="//ulink"/>
+  </xsl:template>
+
+  <xsl:template match="ulink">
+      <!-- Packages. If some package don't have the string ".tar." in their
+      name, the next test must be fixed to match it also. -->
+    <xsl:if test="contains(@url, '.tar.')">
+      <xsl:value-of select="@url"/>
+      <xsl:text>&#x0a;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+</xsl:stylesheet>


Property changes on: jhalfs/branches/experimental/CLFS/packageslist.xsl
___________________________________________________________________
Name: svn:keywords
   + Author Date Rev Id

Added: jhalfs/branches/experimental/CLFS/patcheslist.xsl
===================================================================
--- jhalfs/branches/experimental/CLFS/patcheslist.xsl	                        (rev 0)
+++ jhalfs/branches/experimental/CLFS/patcheslist.xsl	2006-03-20 23:07:53 UTC (rev 2375)
@@ -0,0 +1,35 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!DOCTYPE xsl:stylesheet [
+ <!ENTITY % general-entities SYSTEM "clfs-development/general.ent">
+  %general-entities;
+]>
+
+<!--$Id
+XSLT stylesheet to create wget scripts to download packages and patches.
+Only for Cross-LFS.
+
+Usage example:
+
+xsltproc -xinclude -output x86.wget stylesheets/wget.xsl x86-index.xml
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="1.0">
+
+  <xsl:output method="text"/>
+
+  <xsl:template match="/">
+    <xsl:apply-templates select="//ulink"/>
+  </xsl:template>
+
+  <xsl:template match="ulink">
+      <!-- Patches. Match only the patches and skip possible duplicated
+      URLs due that may be splitted for PDF output-->
+    <xsl:if test="contains(@url, '.patch') and contains(@url, '&patches-root;')
+            and not(ancestor-or-self::*/@condition = 'pdf')">
+      <xsl:value-of select="@url"/>
+      <xsl:text>&#x0a;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+</xsl:stylesheet>


Property changes on: jhalfs/branches/experimental/CLFS/patcheslist.xsl
___________________________________________________________________
Name: svn:keywords
   + Author Date Rev Id

Modified: jhalfs/branches/experimental/common/common-functions
===================================================================
--- jhalfs/branches/experimental/common/common-functions	2006-03-20 22:26:42 UTC (rev 2374)
+++ jhalfs/branches/experimental/common/common-functions	2006-03-20 23:07:53 UTC (rev 2375)
@@ -546,23 +546,43 @@
 #----------------------------#
   local saveIFS=$IFS
   local IFS
-  echo -ne "Creating the patch file list "
 
+  rm -f patches
+
   LOC_add_patches_entry() {
     for f in `grep "/$1-" patcheslist_.wget`; do
       basename $f | sed "s|${2}|\&${1}-version;|" >> patches
     done
   }
 
-  xsltproc --nonet \
-           --xinclude \
-           --stringparam model $MODEL \
-           -o patcheslist_.wget \
-           patcheslist.xsl \
-           $BOOK/chapter04/patches.xml
+  case ${PROGNAME} in
+    hlfs)
+         echo -n "Creating the ${L_arrow}${BOLD}HLFS${R_arrow} specific patcheslist_.wget file"
+         xsltproc --nonet \
+                  --xinclude \
+                  --stringparam model $MODEL \
+                  -o patcheslist_.wget \
+                  patcheslist.xsl \
+                  $BOOK/chapter04/patches.xml
+                  #> /dev/null 2>&1
 
-  rm -f patches
+         # .... U G L Y .... what to do with the grsecurity patch to the kernel..
+         for f in `grep "/grsecurity-" patcheslist_.wget`; do
+           basename $f >> patches
+         done
+      ;;
 
+    clfs)  # Pull out a list of arch specific patches
+         echo -n "Creating ${L_arrow}${BOLD}$ARCH${R_arrow} specific patcheslist_.wget file"
+         xsltproc -xinclude  \
+                  -o patcheslist_.wget \
+                  patcheslist.xsl \
+                  $BOOK/${ARCH}-index.xml   
+      ;;
+    *)  return
+  esac
+
+
   IFS=$'\x0A'  # Modify the 'internal field separator' to break on 'LF' only
   for f in `cat packages`; do
     IFS=$saveIFS  # Restore the system defaults
@@ -573,20 +593,15 @@
                    -e 's/uclibc/uClibc/'`
   done
 
-  # .... U G L Y .... what to do with the grsecurity patch to the kernel..
-  for f in `grep "/grsecurity-" patcheslist_.wget`; do
-      basename $f >> patches
-  done
-
-  rm -f patcheslist_.wget
-  echo "...OK"
+  echo " ...OK"
 }
 
 
-
 #----------------------------#
 extract_commands() {         #
 #----------------------------#
+  local saveIFS=$IFS
+  
   # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
   test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
   exit 1"
@@ -604,14 +619,14 @@
   # Dump the commands in shell script form from the HLFS book.
   case ${PROGNAME} in
     clfs)
-        echo -n "${tab_} ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
+        echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
         xsltproc --xinclude \
                  --nonet \
                  --output ./${PROGNAME}-commands/ \
                 $BOOK/stylesheets/dump-commands.xsl $BOOK/$ARCH-index.xml
       ;;
     hlfs)
-        echo -n "${tab_} ${L_arrow}${BOLD}$MODEL${R_arrow} HLFS architecture"
+        echo -n " ${L_arrow}${BOLD}$MODEL${R_arrow} HLFS architecture"
         xsltproc --nonet \
                  --xinclude \
                  --stringparam model $MODEL \
@@ -625,7 +640,7 @@
                  -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
       ;;
     lfs)
-        echo -n "${tab_} ${L_arrow}${BOLD}LFS${R_arrow} build"
+        echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build"
         xsltproc --nonet \
                  --xinclude \
                  --stringparam testsuite $TEST \
@@ -636,7 +651,7 @@
                  -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
       ;;
     blfs)
-        echo -n "${tab_} ${L_arrow}${BOLD}BLFS${R_arrow} build"
+        echo -n " ${L_arrow}${BOLD}BLFS${R_arrow} build"
         xsltproc --nonet \
                  --xinclude \
                  --stringparam testsuite $TEST \
@@ -652,22 +667,74 @@
   chmod -R +x $JHALFSDIR/${PROGNAME}-commands
 
   # Grab the patches and package names.
-  cd $JHALFSDIR
-  for i in patches packages ; do rm -f $i ; done
-  grep "\-version" $BOOK/general.ent | sed -e 's@<!ENTITY @@' -e 's@">@"@' \
-  -e '/generic/d' >> packages
+  for i in patches packages ; do 
+    rm -f $i
+  done
+  #
+  case "${PROGNAME}" in
+    clfs)
+      ################################
+      # A LOCAL function
+      # xx_.wget contains arch specific files but in URL format
+      # Build a file with only arch specific files.. small ugly..
+      LOC_add_packages_entry() {
+        local fileMATCH aFILE
+    
+        fileMATCH="/$1"
+        # format.. Filename-Version  or FilenameVersion
+        for aFILE in `grep ${fileMATCH}-*[[:digit:]] packageslist_.wget`; do
+         # The aFILE%\?* is necessary to strip the "?download" appended to sourceforge files
+         echo "$1-version \"$2\"" >> packages
+        done
+      }
+      #################################
+ 
+      # We only want a list arch specific files..
+      # Unfortunately this script produces URL's which must be converted to a std format
+      echo -n "Creating CLFS ${L_arrow}${BOLD}${ARCH}${R_arrow} specific packageslist_.wget file"
+      xsltproc -xinclude  \
+               -o packageslist_.wget \
+               packageslist.xsl \
+               $BOOK/${ARCH}-index.xml   
 
+      # This has the correct format but contains packages from every book  
+      grep "\-version " $BOOK/packages.ent | sed -e 's@<!ENTITY @@' \
+                                                 -e 's@">@"@' \
+                                                 -e '/generic/d' > packages.tmp
+      # This variable is necessary to make sure the `cat $JHALFSDIR/packages`
+      # separates each iteration by lines.
+      # Modify the 'internal field separator' to break on 'LF' only
+      IFS=$'\x0A'
+      for f in `cat packages.tmp`; do
+        IFS=$saveIFS  # Restore the system defaults	
+        LOC_add_packages_entry \
+        `echo $f | sed -e 's/-version//' \
+                       -e 's/-file.*//' \
+                       -e 's/"//g'`
+     done
+     echo " ...OK"
+     ;;
+           
+    *)
+      echo -n "Creating <${PROGNAME}> specific packageslist_.wget file"
+      grep "\-version" $BOOK/general.ent | sed -e 's@<!ENTITY @@' \
+                                               -e 's@">@"@' \
+                                               -e '/generic/d' >> packages
+      ;; 
+  esac
+
   # Download the vim-lang package if it must be installed
   if [ "$VIMLANG" = "1" ] && [ ! "$PROGNAME" = "hlfs" ] ; then
     echo `grep "vim" packages | sed 's at vim@&-lang@'` >> packages
   fi
   echo `grep "udev-config-file" $BOOK/general.ent | sed -e 's@<!ENTITY @@' -e 's@">@"@'` >> packages
 
-  # There is no HLFS patches.ent file so we will create one.
-
+  # There is no useful patches.ent file so we will create one.
   case "${PROGNAME}" in
-    hlfs)  build_patches_file ;;
-    clfs) ;;
+    hlfs)
+      build_patches_file ;;
+    clfs )
+      build_patches_file ;;
     lfs)
       grep "^<\!ENTITY" $BOOK/patches.ent | sed -e 's/.* "//' -e 's/">//' >> patches
       ;;

Modified: jhalfs/branches/experimental/master.sh
===================================================================
--- jhalfs/branches/experimental/master.sh	2006-03-20 22:26:42 UTC (rev 2374)
+++ jhalfs/branches/experimental/master.sh	2006-03-20 23:07:53 UTC (rev 2375)
@@ -313,7 +313,10 @@
 if [[ "$PWD" != "$JHALFSDIR" ]]; then
   cp -v $COMMON_DIR/makefile-functions $JHALFSDIR/
   if [[ -n "$FILES" ]]; then
-    cp -v $PACKAGE_DIR/$FILES $JHALFSDIR/
+    # pushd/popd necessary to deal with mulitiple files
+    pushd $PACKAGE_DIR
+      cp -v $FILES $JHALFSDIR/
+    popd
   fi
   sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
   export XSL=$JHALFSDIR/${XSL}




More information about the alfs-log mailing list