Ignore:
Timestamp:
08/09/2017 01:55:55 PM (7 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
ablfs-more, legacy, trunk
Children:
dd08e14
Parents:
200fbde
Message:

install-blfs-tools.sh:

  • Add instructions to retrieve and parse LFS book into packages.xml
File:
1 edited

Legend:

Unmodified
Added
Removed
  • BLFS/xsl/gen_pkg_list.xsl

    r200fbde r506120ee  
    66     installed packages in the tracking file (stringparam
    77     'installed-packages') -->
     8<!-- Extract also a list of LFS packages from stringparam lfs-full -->
    89
    910<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    1011    version="1.0">
    1112
     13  <xsl:param name="lfs-full" select="'./lfs-xml/lfs-full.xml'"/>
    1214  <xsl:param name="installed-packages" select="'../lib/instpkg.xml'"/>
    1315
     
    2325  <xsl:template match="/">
    2426    <princList>
    25     <xsl:text>&#xA;&#xA;</xsl:text>
     27      <xsl:text>&#xA;&#xA;  </xsl:text>
     28      <list>
     29        <xsl:attribute name="id">lfs</xsl:attribute>
     30        <xsl:text>&#xA;    </xsl:text>
     31        <name>LFS Packages</name>
     32        <xsl:text>&#xA;    </xsl:text>
     33        <sublist>
     34          <xsl:attribute name="id">lfs-6</xsl:attribute>
     35          <xsl:text>&#xA;      </xsl:text>
     36          <name>LFS Chapter 6</name>
     37          <xsl:apply-templates
     38               select='document($lfs-full)//
     39                            chapter[@id="chapter-building-system"]/
     40                                 sect1/sect1info'/>
     41          <xsl:text>&#xA;    </xsl:text>
     42        </sublist>
     43        <sublist>
     44          <xsl:attribute name="id">lfs-8</xsl:attribute>
     45          <xsl:text>&#xA;      </xsl:text>
     46          <name>LFS Chapter 8</name>
     47          <xsl:apply-templates select='document($lfs-full)//chapter[@id="chapter-bootable"]/sect1/sect1info[./productname="linux"]'/>
     48          <xsl:text>&#xA;    </xsl:text>
     49        </sublist>
     50        <sublist>
     51          <xsl:attribute name="id">lfs-9</xsl:attribute>
     52          <xsl:text>&#xA;      </xsl:text>
     53          <name>LFS Chapter 9</name>
     54          <xsl:apply-templates select='document($lfs-full)//sect1[@id="ch-finish-theend"]//userinput[starts-with(string(),"echo")]'/>
     55          <xsl:text>&#xA;    </xsl:text>
     56        </sublist>
     57        <xsl:text>&#xA;&#xA;  </xsl:text>
     58      </list>
    2659<!-- How to have blfs-bootscripts versionned? Do not know, so
    2760     avoid it (TODO ?) -->
    2861      <xsl:apply-templates select="//part[not(@id='introduction')]"/>
    2962    </princList>
     63  </xsl:template>
     64
     65  <xsl:template match="userinput">
     66<!-- Only used in lFS chapter 9, to retrieve book version -->
     67    <package>
     68      <name>LFS-Release</name>
     69      <xsl:element name="version">
     70        <xsl:copy-of select="substring-after(substring-before(string(),' &gt;'),'echo ')"/>
     71      </xsl:element>
     72      <xsl:if
     73          test="document($installed-packages)//package[name='LFS-Release']">
     74        <xsl:text>&#xA;        </xsl:text>
     75        <xsl:element name="inst-version">
     76          <xsl:value-of
     77            select="document(
     78                     $installed-packages
     79                            )//package[name='LFS-Release']/version"/>
     80        </xsl:element>
     81      </xsl:if>
     82    </package>
     83  </xsl:template>
     84
     85  <xsl:template match="sect1info">
     86    <xsl:text>      </xsl:text>
     87    <xsl:choose>
     88<!-- Never update linux headers -->
     89      <xsl:when test="./productname='linux'
     90                      and ancestor::chapter[@id='chapter-building-system']"/>
     91<!-- Gcc version is taken from BLFS -->
     92      <xsl:when test="./productname='gcc'"/>
     93<!-- Shadow version is taken from BLFS -->
     94      <xsl:when test="./productname='shadow'"/>
     95<!-- Dbus version is taken from BLFS -->
     96      <xsl:when test="./productname='dbus'"/>
     97<!-- Systemd version is taken from BLFS -->
     98      <xsl:when test="./productname='systemd'"/>
     99      <xsl:otherwise>
     100        <package><xsl:text>&#xA;        </xsl:text>
     101          <xsl:element name="name">
     102            <xsl:value-of select="./productname"/>
     103          </xsl:element>
     104          <xsl:text>&#xA;        </xsl:text>
     105          <xsl:element name="version">
     106            <xsl:value-of select="./productnumber"/>
     107          </xsl:element>
     108          <xsl:if
     109              test="document($installed-packages)//package[name=current()/productname]">
     110            <xsl:text>&#xA;        </xsl:text>
     111            <xsl:element name="inst-version">
     112              <xsl:value-of
     113                select="document(
     114                         $installed-packages
     115                                )//package[name=current()/productname]/version"/>
     116            </xsl:element>
     117          </xsl:if>
     118        </package>
     119      </xsl:otherwise>
     120    </xsl:choose>
     121<!-- No deps for now: a former version  is always installed -->
    30122  </xsl:template>
    31123
Note: See TracChangeset for help on using the changeset viewer.