Author: pierre
Date: Wed Aug  9 06:55:55 2017
New Revision: 3989

Log:
install-blfs-tools.sh:
- Add instructions to retrieve and parse LFS book into packages.xml

Modified:
   jhalfs/trunk/BLFS/Makefile
   jhalfs/trunk/BLFS/xsl/gen_pkg_list.xsl
   jhalfs/trunk/Config.in
   jhalfs/trunk/install-blfs-tools.sh

Modified: jhalfs/trunk/BLFS/Makefile
==============================================================================
--- jhalfs/trunk/BLFS/Makefile  Wed Aug  9 06:51:40 2017        (r3988)
+++ jhalfs/trunk/BLFS/Makefile  Wed Aug  9 06:55:55 2017        (r3989)
@@ -25,6 +25,7 @@
 
 # Those directories and files will be created and populated by make:
 # directory of the book sources:
+LFS_XML          = $(TOPDIR)/lfs-xml
 BLFS_XML         = $(TOPDIR)/blfs-xml
 # contains the REV used in the preceding call:
 REVFILE          = $(TOPDIR)/revision
@@ -37,7 +38,9 @@
 # the linear book:
 BOOK_XML         = $(TOPDIR)/book.xml
 
+LFSTMP           = $(LFS_XML)/tmp
 RENDERTMP        = $(BLFS_XML)/tmp
+LFS_FULL         = $(LFSTMP)/lfs-full.xml
 BLFS_FULL        = $(RENDERTMP)/blfs-full.xml
 
 # The right-hand side is updated by jhalfs:
@@ -57,16 +60,25 @@
 </sublist>
 endef
 
+LFS-SVN = svn://svn.linuxfromscratch.org/LFS/trunk/BOOK
 SVN = svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK
 
 ALLXML := $(filter-out $(RENDERTMP)/%, \
               $(shell if [ -d $(BLFS_XML) ]; then \
                         find $(BLFS_XML) -name \*.xml; \
                       fi))
+ALLXMLLFS:= $(filter-out $(LFSTMP)/%, \
+              $(shell if [ -d $(LFS_XML) ]; then \
+                        find $(LFS_XML) -name \*.xml; \
+                      fi))
 ALLXSL := $(filter-out $(RENDERTMP)/%, \
               $(shell if [ -d $(BLFS_XML) ]; then \
                         find $(BLFS_XML) -name \*.xsl; \
                       fi))
+ALLXSLLFS := $(filter-out $(LFSTMP)/%, \
+              $(shell if [ -d $(LFS_XML) ]; then \
+                        find $(LFS_XML) -name \*.xsl; \
+                      fi))
 
 # Try to set the REV variable according to previous runs, except when
 # set on the command line:
@@ -97,8 +109,9 @@
 $(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)
+$(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl 
$(TRACKFILE) $(LFS_FULL)
        $(Q)xsltproc --stringparam installed-packages $(TRACKFILE) \
+       --stringparam lfs-full $(LFS_FULL) \
        -o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL)
        $(Q)xmllint --postvalid --format -o $@ $@.tmp
        $(Q)rm $@.tmp
@@ -137,28 +150,51 @@
 
 ifneq ($(REV),$(REV1))
 $(BLFS_FULL): FORCE
+$(LFS_FULL): FORCE
 endif
+$(LFS_FULL): $(LFS_XML) $(LFS_XML)/general.ent $(ALLXMLLFS) $(ALLXSLLFS)
+       @echo "Processing LFS bootscripts..."
+       $(Q)cd $(LFS_XML) && bash process-scripts.sh
+       $(Q)[ -d $(LFSTMP) ] || mkdir -p $(LFSTMP)
+       @echo "Adjusting LFS for revision $(REV)..."
+       $(Q)xsltproc --nonet --xinclude                          \
+                    --stringparam profile.revision $(REV)       \
+                    --output $(LFSTMP)/lfs-prof.xml         \
+                    $(LFS_XML)/stylesheets/lfs-xsl/profile.xsl \
+                    $(LFS_XML)/index.xml
+       @echo "Validating the LFS book..."
+       $(Q)xmllint --nonet --noent --postvalid \
+         -o $@ $(LFSTMP)/lfs-prof.xml
+       $(Q)rm -f $(LFS_XML)/appendices/*.script
+       $(Q)cd $(LFS_XML) && ./aux-file-data.sh $@
+       $(Q)echo $(REV) > $(REVFILE)
+
 $(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL)
        $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
-       @echo "Adjusting for revision $(REV)..."
+       @echo "Adjusting BLFS for revision $(REV)..."
        $(Q)xsltproc --nonet --xinclude                          \
                     --stringparam profile.revision $(REV)       \
                     --output $(RENDERTMP)/blfs-prof.xml         \
                     $(BLFS_XML)/stylesheets/lfs-xsl/profile.xsl \
                     $(BLFS_XML)/index.xml
-       @echo "Validating the book..."
+       @echo "Validating the BLFS book..."
        $(Q)xmllint --nonet --noent --postvalid \
          -o $@ $(RENDERTMP)/blfs-prof.xml
        $(Q)echo $(REV) > $(REVFILE)
 
 all: update $(BOOK_XML)
 
-update: $(BLFS_XML)
+update: $(BLFS_XML) $(LFS_XML)
        @echo Updating the book sources
+       $(Q)cd $(LFS_XML) && svn up
        $(Q)cd $(BLFS_XML) && svn up
 
+$(LFS_XML):
+       @echo Getting the LFS book sources...
+       $(Q)svn co $(LFS-SVN) $@
+
 $(BLFS_XML):
-       @echo Getting the book sources...
+       @echo Getting the BLFS book sources...
        $(Q)svn co $(SVN) $@
 
 # Clean up

Modified: jhalfs/trunk/BLFS/xsl/gen_pkg_list.xsl
==============================================================================
--- jhalfs/trunk/BLFS/xsl/gen_pkg_list.xsl      Wed Aug  9 06:51:40 2017        
(r3988)
+++ jhalfs/trunk/BLFS/xsl/gen_pkg_list.xsl      Wed Aug  9 06:55:55 2017        
(r3989)
@@ -5,10 +5,12 @@
      of packages obeying packdesc.dtd + looks for already
      installed packages in the tracking file (stringparam
      'installed-packages') -->
+<!-- Extract also a list of LFS packages from stringparam lfs-full -->
 
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
     version="1.0">
 
+  <xsl:param name="lfs-full" select="'./lfs-xml/lfs-full.xml'"/>
   <xsl:param name="installed-packages" select="'../lib/instpkg.xml'"/>
 
   <xsl:output method="xml"
@@ -22,13 +24,103 @@
 
   <xsl:template match="/">
     <princList>
-    <xsl:text>&#xA;&#xA;</xsl:text>
+      <xsl:text>&#xA;&#xA;  </xsl:text>
+      <list>
+        <xsl:attribute name="id">lfs</xsl:attribute>
+        <xsl:text>&#xA;    </xsl:text>
+        <name>LFS Packages</name>
+        <xsl:text>&#xA;    </xsl:text>
+        <sublist>
+          <xsl:attribute name="id">lfs-6</xsl:attribute>
+          <xsl:text>&#xA;      </xsl:text>
+          <name>LFS Chapter 6</name>
+          <xsl:apply-templates
+               select='document($lfs-full)//
+                            chapter[@id="chapter-building-system"]/
+                                 sect1/sect1info'/>
+          <xsl:text>&#xA;    </xsl:text>
+        </sublist>
+        <sublist>
+          <xsl:attribute name="id">lfs-8</xsl:attribute>
+          <xsl:text>&#xA;      </xsl:text>
+          <name>LFS Chapter 8</name>
+          <xsl:apply-templates 
select='document($lfs-full)//chapter[@id="chapter-bootable"]/sect1/sect1info[./productname="linux"]'/>
+          <xsl:text>&#xA;    </xsl:text>
+        </sublist>
+        <sublist>
+          <xsl:attribute name="id">lfs-9</xsl:attribute>
+          <xsl:text>&#xA;      </xsl:text>
+          <name>LFS Chapter 9</name>
+          <xsl:apply-templates 
select='document($lfs-full)//sect1[@id="ch-finish-theend"]//userinput[starts-with(string(),"echo")]'/>
+          <xsl:text>&#xA;    </xsl:text>
+        </sublist>
+        <xsl:text>&#xA;&#xA;  </xsl:text>
+      </list>
 <!-- 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="userinput">
+<!-- Only used in lFS chapter 9, to retrieve book version -->
+    <package>
+      <name>LFS-Release</name>
+      <xsl:element name="version">
+        <xsl:copy-of select="substring-after(substring-before(string(),' 
&gt;'),'echo ')"/>
+      </xsl:element>
+      <xsl:if
+          test="document($installed-packages)//package[name='LFS-Release']">
+        <xsl:text>&#xA;        </xsl:text>
+        <xsl:element name="inst-version">
+          <xsl:value-of
+            select="document(
+                     $installed-packages
+                            )//package[name='LFS-Release']/version"/>
+        </xsl:element>
+      </xsl:if>
+    </package>
+  </xsl:template>
+
+  <xsl:template match="sect1info">
+    <xsl:text>      </xsl:text>
+    <xsl:choose>
+<!-- Never update linux headers -->
+      <xsl:when test="./productname='linux'
+                      and ancestor::chapter[@id='chapter-building-system']"/>
+<!-- Gcc version is taken from BLFS -->
+      <xsl:when test="./productname='gcc'"/>
+<!-- Shadow version is taken from BLFS -->
+      <xsl:when test="./productname='shadow'"/>
+<!-- Dbus version is taken from BLFS -->
+      <xsl:when test="./productname='dbus'"/>
+<!-- Systemd version is taken from BLFS -->
+      <xsl:when test="./productname='systemd'"/>
+      <xsl:otherwise>
+        <package><xsl:text>&#xA;        </xsl:text>
+          <xsl:element name="name">
+            <xsl:value-of select="./productname"/>
+          </xsl:element>
+          <xsl:text>&#xA;        </xsl:text>
+          <xsl:element name="version">
+            <xsl:value-of select="./productnumber"/>
+          </xsl:element>
+          <xsl:if
+              
test="document($installed-packages)//package[name=current()/productname]">
+            <xsl:text>&#xA;        </xsl:text>
+            <xsl:element name="inst-version">
+              <xsl:value-of
+                select="document(
+                         $installed-packages
+                                
)//package[name=current()/productname]/version"/>
+            </xsl:element>
+          </xsl:if>
+        </package>
+      </xsl:otherwise>
+    </xsl:choose>
+<!-- No deps for now: a former version  is always installed -->
+  </xsl:template>
+
   <xsl:template match="part">
     <xsl:if test="count(.//*[contains(translate(@xreflabel,
                                                '123456789',

Modified: jhalfs/trunk/Config.in
==============================================================================
--- jhalfs/trunk/Config.in      Wed Aug  9 06:51:40 2017        (r3988)
+++ jhalfs/trunk/Config.in      Wed Aug  9 06:55:55 2017        (r3989)
@@ -523,7 +523,7 @@
         default    "**EDIT ME**"
         depends on BLFS_WORKING_COPY
         help
-            Full path to the BLFS book working copy"
+            Full path to the BLFS book working copy
 
         config    BLFS_BRANCH_ID
         string    "BLFS Book Version (mandatory)"
@@ -561,6 +561,42 @@
             The directory name under $BLFS_ROOT where the BLFS
             book sources will be copied or checked out. Do not change that
             unless you know what you are doing...
+
+        choice
+        prompt    "LFS Release"
+        default    LFS_SVN
+        depends    BOOK_BLFS
+
+            config    LFS_relSVN
+            bool     "LFS SVN"
+            help
+                Current development version as in trunk
+
+            config    LFS_WORKING_COPY
+            bool     "LFS working copy"
+            help
+                A local working copy of the LFS book.
+
+            config    LFS_BRANCH
+            bool     "LFS Branch or stable book"
+            help
+                A supported SVN branch or stable book release
+        endchoice
+
+        config    BLFS_LFS_BOOK
+        string    "Location of the local LFS working copy (mandatory)"
+        default    "**EDIT ME**"
+        depends on LFS_WORKING_COPY
+        help
+            Full path to the LFS book working copy"
+
+        config    BLFS_LFS_BRANCH_ID
+        string    "LFS Book Version (mandatory)"
+        default    "**EDIT ME**"
+        depends on LFS_BRANCH
+        help
+            A list of valid branches and stable book IDs is available at
+            http://wiki.linuxfromscratch.org/alfs/wiki/SupportedBooks.
     # End of BLFS parameters
 
     #--- Custom Tools support

Modified: jhalfs/trunk/install-blfs-tools.sh
==============================================================================
--- jhalfs/trunk/install-blfs-tools.sh  Wed Aug  9 06:51:40 2017        (r3988)
+++ jhalfs/trunk/install-blfs-tools.sh  Wed Aug  9 06:55:55 2017        (r3989)
@@ -6,12 +6,14 @@
 Installs a set-up to build BLFS packages.
 You can set these variables:
 TRACKING_DIR  : where the installed package file is kept.
-                 (default /var/lib/jhalfs/BLFS)
+                (default /var/lib/jhalfs/BLFS)
+INITSYS       : which books do you want? 'sysv' or 'systemd' (default sysv)
 BLFS_ROOT     : where the installed tools will be installed, relative to $HOME.
                 Must start with a '/' (default /blfs_root)
 BLFS_BRANCH_ID: development, branch-xxx, xxx (where xxx is a valid tag)
                 (default development)
-INITSYS   : which book do you want? 'sysv' or 'systemd' (default sysv)
+LFS_BRANCH_ID : development, branch-xxx, xxx (where xxx is a valid tag)
+                (default development)
 Examples:
 1 - If you plan to use the tools to build BLFS on top of LFS, but you did not
 use jhalfs, or forgot to include the jhalfs-blfs tools:
@@ -69,9 +71,16 @@
   [[ "$BRANCH" = y ]] && BLFS_BRANCH_ID=$BRANCH_ID
   [[ "$WORKING_COPY" = y ]] && BLFS_BOOK=$BOOK
   [[ "$BRANCH_ID" = "**EDIT ME**" ]] &&
-    echo You have not set the book version or branch && exit 1
+    echo You have not set the BLFS book version or branch && exit 1
   [[ "$BOOK" = "**EDIT ME**" ]] &&
-    echo You have not set the working copy location && exit 1
+    echo You have not set the BLFS working copy location && exit 1
+  [[ "$LFS_relSVN" = y ]] && LFS_BRANCH_ID=development
+  [[ "$LFS_BRANCH" = y ]] && LFS_BRANCH_ID=$BLFS_LFS_BRANCH_ID
+  [[ "$LFS_WORKING_COPY" = y ]] && LFS_BOOK=$BLFS_LFS_BOOK
+  [[ "$LFS_BRANCH_ID" = "**EDIT ME**" ]] &&
+    echo You have not set the LFS book version or branch && exit 1
+  [[ "$LFS_BOOK" = "**EDIT ME**" ]] &&
+    echo You have not set the LFS working copy location && exit 1
 fi
 
 COMMON_DIR="common"
@@ -82,15 +91,22 @@
 TRACKING_DIR="${TRACKING_DIR:=/var/lib/jhalfs/BLFS}"
 INITSYS="${INITSYS:=sysv}"
 BLFS_BRANCH_ID=${BLFS_BRANCH_ID:=development}
+LFS_BRANCH_ID=${LFS_BRANCH_ID:=development}
 BLFS_XML=${BLFS_XML:=blfs-xml}
+LFS_XML=${LFS_XML:=lfs-xml}
 
 # Validate the configuration:
-PARAMS="BLFS_ROOT TRACKING_DIR INITSYS BLFS_XML"
+PARAMS="BLFS_ROOT TRACKING_DIR INITSYS BLFS_XML LFS_XML"
 if [ "$WORKING_COPY" = y ]; then
-  PARAMS="$PARAMS WORKING_COPY BOOK"
+  PARAMS="$PARAMS WORKING_COPY BLFS_BOOK"
 else
   PARAMS="$PARAMS BLFS_BRANCH_ID"
 fi
+if [ "$LFS_WORKING_COPY" = y ]; then
+  PARAMS="$PARAMS LFS_WORKING_COPY LFS_BOOK"
+else
+  PARAMS="$PARAMS LFS_BRANCH_ID"
+fi
 # Format for displaying parameters:
 declare -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} 
${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
 
@@ -120,6 +136,11 @@
      branch-* )  BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-} ;;
             * )  BLFS_TREE=tags/${BLFS_BRANCH_ID} ;;
 esac
+case $LFS_BRANCH_ID in
+  development )  LFS_TREE=trunk/BOOK ;;
+     branch-* )  LFS_TREE=branches/${BLFS_BRANCH_ID#branch-} ;;
+            * )  LFS_TREE=tags/${BLFS_BRANCH_ID} ;;
+esac
 
 # Check for build prerequisites.
 echo
@@ -146,6 +167,7 @@
 rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
 # We do not want to keep an old version of the book:
 rm -rf ${BUILDDIR}${BLFS_ROOT}/$BLFS_XML
+rm -rf ${BUILDDIR}${BLFS_ROOT}/$LFS_XML
 
 # Set some harcoded envars to their proper values
 sed -i s@tracking-dir@$TRACKING_DIR@ \
@@ -159,15 +181,24 @@
 [[ $VERBOSITY > 0 ]] && echo "... OK"
 
 [[ $VERBOSITY > 0 ]] &&
-echo "Retrieving and validating the book (may take some time)"
 
 [[ -z "$BLFS_BOOK" ]] ||
-[[ $BLFS_BOOK = $BUILDDIR$BLFS_ROOT/$BLFS_XML ]] ||
+[[ $BLFS_BOOK = $BUILDDIR$BLFS_ROOT/$BLFS_XML ]] || {
+echo "Retrieving BLFS working copy (may take some time)" &&
 cp -a $BLFS_BOOK $BUILDDIR$BLFS_ROOT/$BLFS_XML
+}
+
+[[ -z "$LFS_BOOK" ]] ||
+[[ $LFS_BOOK = $BUILDDIR$BLFS_ROOT/$LFS_XML ]] || {
+echo "Retrieving the LFS working copy (may take some time)" &&
+cp -a $LFS_BOOK $BUILDDIR$BLFS_ROOT/$LFS_XML
+}
 
 make -j1 -C $BUILDDIR$BLFS_ROOT \
      TRACKING_DIR=$TRACKING_DIR \
      REV=$INITSYS            \
+     LFS_XML=$BUILDDIR$BLFS_ROOT/$LFS_XML      \
+     LFS-SVN=svn://svn.linuxfromscratch.org/LFS/$LFS_TREE \
      BLFS_XML=$BUILDDIR$BLFS_ROOT/$BLFS_XML      \
      SVN=svn://svn.linuxfromscratch.org/BLFS/$BLFS_TREE \
      $BUILDDIR$BLFS_ROOT/packages.xml
-- 
http://lists.linuxfromscratch.org/listinfo/alfs-log
Unsubscribe: See the above information page

Reply via email to