Changeset df42c7c for LFS/lfs.xsl


Ignore:
Timestamp:
07/21/2016 04:43:35 PM (8 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
new_features
Children:
e234d23
Parents:
33ff403
Message:

Porg style package management:

  • Add new variable WRAP_INSTALL in COnfig.in and jhalfs
  • Generates the install commands inside a wrapper function
  • Add files packInstall.sh.porg and packageManager.xml.porg
  • TODO: update README.PACKAGE...
  • TODO: make new templates in pkgmngt and document them
File:
1 edited

Legend:

Unmodified
Added
Removed
  • LFS/lfs.xsl

    r33ff403 rdf42c7c  
    1515       y = yes, add PKG_DEST to scripts in install commands of chapter06-08
    1616  -->
    17   <xsl:param name="pkgmngt" select="n"/>
     17  <xsl:param name="pkgmngt" select="'n'"/>
     18
     19  <!-- Package management with "porg style" ?
     20       n = no,  same as pkgmngt description above
     21       y = yes, wrap install commands of chapter06-08 into a bash function.
     22                note that pkgmngt must be 'y' in this case
     23  -->
     24  <xsl:param name="wrap-install" select='"n"'/>
    1825 
    1926  <!-- Run test suites?
     
    2936       y = yes, bomb at the first test suite failure to can review the build dir
    3037  -->
    31   <xsl:param name="bomb-testsuite" select="n"/>
     38  <xsl:param name="bomb-testsuite" select="'n'"/>
    3239
    3340  <!-- Install vim-lang package? OBSOLETE should always be 'n'-->
    34   <xsl:param name="vim-lang" select="n"/>
     41  <xsl:param name="vim-lang" select="'n'"/>
    3542 
    3643  <!-- Time zone -->
    37   <xsl:param name="timezone" select="GMT"/>
     44  <xsl:param name="timezone" select="'GMT'"/>
    3845 
    3946  <!-- Page size -->
    40   <xsl:param name="page" select="letter"/>
     47  <xsl:param name="page" select="'letter'"/>
    4148 
    4249  <!-- Locale settings -->
    43   <xsl:param name="lang" select="C"/>
     50  <xsl:param name="lang" select="'C'"/>
    4451
    4552  <!-- Install the whole set of locales -->
    46   <xsl:param name='full-locale' select='n'/>
     53  <xsl:param name='full-locale' select='"n"'/>
    4754 
    4855  <!-- Hostname -->
     
    5158  <!-- Network parameters: interface, ip, gateway, prefix, broadcast, domain
    5259       and nameservers -->
    53   <xsl:param name='interface'   select='eth0'/>
     60  <xsl:param name='interface'   select="'eth0'"/>
    5461  <xsl:param name='ip'          select='"10.0.2.9"'/>
    5562  <xsl:param name='gateway'     select='"10.0.2.2"'/>
     
    181188                                  @role != 'nodump']/userinput[
    182189                                                    @remap='install']">
    183       <xsl:text>mkdir -pv $PKG_DEST/{boot,etc,lib,bin,sbin}
     190      <xsl:choose>
     191        <xsl:when test="$wrap-install='y'">
     192          <xsl:text>wrapInstall '
     193</xsl:text>
     194        </xsl:when>
     195        <xsl:otherwise>
     196          <xsl:text>mkdir -pv $PKG_DEST/{boot,etc,lib,bin,sbin}
    184197mkdir -pv $PKG_DEST/usr/{lib,bin,sbin,include}
    185198mkdir -pv $PKG_DEST/usr/share/{doc,info,man}
     
    190203esac
    191204</xsl:text>
     205        </xsl:otherwise>
     206      </xsl:choose>
    192207    </xsl:if>
    193208    <xsl:if test="../@id = 'ch-system-glibc' and
    194209                  @role='installation' and
    195                   $pkgmngt = 'y'">
     210                  $pkgmngt = 'y' and
     211                  $wrap-install = 'n'">
    196212      <xsl:text>mkdir -pv $PKG_DEST/usr/include/{rpc,rpcsvc}
    197213</xsl:text>
     
    205221                                     @role != 'nodump']/userinput[
    206222                                                       @remap='install']">
    207       <xsl:if test="../@id = 'ch-system-man-pages'">
     223      <xsl:choose>
     224        <xsl:when test="$wrap-install='y'">
     225          <xsl:if test="../@id = 'ch-system-man-pages'">
    208226<!-- these files are provided by the shadow package -->
    209   <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
    210 </xsl:text>
    211       </xsl:if>
     227            <xsl:text>rm -fv /usr/share/man/{man3/getspnam.3,man5/passwd.5}
     228</xsl:text>
     229          </xsl:if>
    212230<!-- Attr man/man2 pages are already installed by man-pages. As of
    213231     March 2013, they are the same pages.
    214232     November 2015: now they are more accurate
    215233     in man-pages, and the man5 section is also in man-pages... -->
    216       <xsl:if test="../@id = 'ch-system-attr'">
    217         <xsl:text>rm -fv $PKG_DEST/usr/share/man/man2/*
     234          <xsl:if test="../@id = 'ch-system-attr'">
     235            <xsl:text>rm -fv /usr/share/man/man2/*
     236rm -fv /usr/share/man/man5/*
     237</xsl:text>
     238          </xsl:if>
     239<!-- nologin is installed by util-linux. remove it from shadow -->
     240          <xsl:if test="../@id = 'ch-system-shadow'">
     241            <xsl:text>rm -fv /usr/share/man/man8/nologin.8
     242rm -fv /sbin/nologin
     243</xsl:text>
     244          </xsl:if>
     245          <xsl:text>'
     246packInstall
     247</xsl:text>
     248        </xsl:when>
     249        <xsl:otherwise>
     250          <xsl:if test="../@id = 'ch-system-man-pages'">
     251<!-- these files are provided by the shadow package -->
     252            <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
     253</xsl:text>
     254          </xsl:if>
     255<!-- Attr man/man2 pages are already installed by man-pages. As of
     256     March 2013, they are the same pages.
     257     November 2015: now they are more accurate
     258     in man-pages, and the man5 section is also in man-pages... -->
     259          <xsl:if test="../@id = 'ch-system-attr'">
     260            <xsl:text>rm -fv $PKG_DEST/usr/share/man/man2/*
    218261rm -fv $PKG_DEST/usr/share/man/man5/*
    219262</xsl:text>
    220       </xsl:if>
     263          </xsl:if>
    221264<!-- nologin is installed by util-linux. remove it from shadow -->
    222       <xsl:if test="../@id = 'ch-system-shadow'">
    223         <xsl:text>rm -fv $PKG_DEST/usr/share/man/man8/nologin.8
     265          <xsl:if test="../@id = 'ch-system-shadow'">
     266            <xsl:text>rm -fv $PKG_DEST/usr/share/man/man8/nologin.8
    224267rm -fv $PKG_DEST/sbin/nologin
    225268</xsl:text>
    226       </xsl:if>
    227       <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64
     269          </xsl:if>
     270          <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64
    228271rm -fv $PKG_DEST/usr/{man,doc,info}
    229272for dir in $PKG_DEST/usr/share/man/man{1..8}; do
     
    242285rm -rf $PKG_DEST
    243286</xsl:text>
     287        </xsl:otherwise>
     288      </xsl:choose>
    244289    </xsl:if>
    245290    <xsl:if test="$testsuite='3' and
     
    310355        <xsl:if test="$dirname = 'chapter06'">
    311356          <xsl:text>packInstall
    312 rm -rf $PKG_DEST
     357rm -rf "$PKG_DEST"
    313358</xsl:text>
    314359        </xsl:if>
     
    453498            </xsl:choose>
    454499          </xsl:when>
    455           <xsl:otherwise><!--pkgmngt = 'y'-->
     500          <xsl:when test="$wrap-install='y'">
     501            <xsl:choose>
     502              <xsl:when test="./literal">
     503                <xsl:call-template name="output-wrap">
     504                  <xsl:with-param name="commands" select="text()[1]"/>
     505                </xsl:call-template>
     506                <xsl:apply-templates select="literal"/>
     507                <xsl:call-template name="output-wrap">
     508                  <xsl:with-param name="commands" select="text()[2]"/>
     509                </xsl:call-template>
     510              </xsl:when>
     511              <xsl:otherwise>
     512                <xsl:call-template name="output-wrap">
     513                  <xsl:with-param name="commands" select="string()"/>
     514                </xsl:call-template>
     515              </xsl:otherwise>
     516            </xsl:choose>
     517            <xsl:text>&#xA;</xsl:text>
     518          </xsl:when>
     519          <xsl:otherwise><!--pkgmngt = 'y' and wrap-install='n'-->
    456520            <xsl:choose>
    457521              <xsl:when test="./literal">
     
    477541      <xsl:when test="contains(string(),'tzdata') and $pkgmngt='y'">
    478542        <xsl:text>
    479 OLD_PKG_DEST=$PKG_DEST
     543OLD_PKG_DEST="$PKG_DEST"
    480544OLD_PKGDIR=$PKGDIR
    481545PKG_DEST=$(dirname $OLD_PKG_DEST)/001-tzdata
     
    486550        <xsl:text>
    487551</xsl:text>
    488         <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
    489         <xsl:text>ZONEINFO=$PKG_DEST</xsl:text>
    490         <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
    491         <xsl:text>
     552        <xsl:choose>
     553          <xsl:when test="$wrap-install='n'">
     554            <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
     555            <xsl:text>ZONEINFO=$PKG_DEST</xsl:text>
     556            <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
     557            <xsl:text>
    492558packInstall
    493559rm -rf $PKG_DEST
     560</xsl:text>
     561          </xsl:when>
     562          <xsl:otherwise><!-- wrap-install='y' -->
     563            <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
     564            <xsl:text>
     565wrapInstall '
     566ZONEINFO=</xsl:text>
     567            <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
     568            <xsl:text>'
     569packInstall
     570</xsl:text>
     571          </xsl:otherwise>
     572        </xsl:choose>
     573        <xsl:text>
    494574PKG_DEST=$OLD_PKG_DEST
    495575unset OLD_PKG_DEST
     
    733813    </xsl:choose>
    734814  </xsl:template>
     815
     816  <xsl:variable name="APOS">'</xsl:variable>
     817  <xsl:template name="output-wrap">
     818    <xsl:param name="commands" select="''"/>
     819    <xsl:choose>
     820      <xsl:when test="contains($commands,string($APOS))">
     821        <xsl:call-template name="output-wrap">
     822          <xsl:with-param name="commands"
     823                          select="substring-before($commands,string($APOS))"/>
     824        </xsl:call-template>
     825        <xsl:text>'\''</xsl:text>
     826        <xsl:call-template name="output-wrap">
     827          <xsl:with-param name="commands"
     828                          select="substring-after($commands,string($APOS))"/>
     829        </xsl:call-template>
     830      </xsl:when>
     831      <xsl:otherwise>
     832        <xsl:value-of select="$commands"/>
     833      </xsl:otherwise>
     834    </xsl:choose>
     835  </xsl:template>
     836
    735837</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.