Changeset 570c9f3


Ignore:
Timestamp:
09/23/2007 11:06:13 AM (17 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
experimental
Children:
51e3d23
Parents:
8533c26
Message:

Unpacking the tarballs from inside the build scripts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LFS/lfs.xsl

    r8533c26 r570c9f3  
    5555
    5656
    57     <!-- Hock for user envars or extra commands before cd into the sources dir -->
     57    <!-- Hock for user envars or extra commands after unpacking the tarball
     58         but before cd into the sources dir -->
    5859  <xsl:template name="user_pre_commands">
    5960    <xsl:text>&#xA;</xsl:text>
     
    6162
    6263
    63     <!-- Hock for user footer additions -->
     64    <!-- Hock for user footer additions before remove sources dir -->
    6465  <xsl:template name="user_footer">
    6566    <xsl:text>&#xA;</xsl:text>
     
    7273    <xsl:param name="reference" select="foo"/>
    7374    <xsl:param name="order" select="foo"/>
    74       <!-- Add a string to be sure that this scripts are run
     75      <!-- Added a string to be sure that this scripts are run
    7576           before the selected one -->
    7677    <xsl:variable name="insert_order" select="concat($order,'_0')"/>
     
    7980    <xsl:if test="$reference = 'ID_of_selected_sect1'">
    8081        <!-- Add an exsl:document block for each script to be inserted
    81              at this point of the build. This one is only a dummy example.
    82              You must replace "dummy" by the script name and increase "01" -->
     82             at this point of the build. This one is only a dummy example. -->
    8383      <exsl:document href="{$insert_order}01-dummy" method="text">
    8484        <xsl:call-template name="header"/>
     
    8888VERSION=0.0.0
    8989TARBALL=dummy-0.0.0.tar.bz2
    90 
     90      </xsl:text>
     91      <xsl:call-template name="unpack"/>
     92      <xsl:text>
    9193cd $PKGDIR
    9294./configure --prefix=/usr
     
    9597make install
    9698        </xsl:text>
     99        <xsl:call-template name="clean_sources"/>
    97100        <xsl:call-template name="footer"/>
    98101      </exsl:document>
     
    106109    <xsl:param name="reference" select="foo"/>
    107110    <xsl:param name="order" select="foo"/>
    108       <!-- Add a string to be sure that this scripts are run
     111      <!-- Added a string to be sure that this scripts are run
    109112           after the selected one -->
    110113    <xsl:variable name="insert_order" select="concat($order,'_z')"/>
     
    121124VERSION=0.0.0
    122125TARBALL=dummy-0.0.0.tar.bz2
    123 
     126      </xsl:text>
     127      <xsl:call-template name="unpack"/>
     128      <xsl:text>
    124129cd $PKGDIR
    125130./configure --prefix=/usr
     
    128133make install
    129134        </xsl:text>
     135        <xsl:call-template name="clean_sources"/>
    130136        <xsl:call-template name="footer"/>
    131137      </exsl:document>
     
    149155VERSION=0.0.0
    150156TARBALL=dummy-0.0.0.tar.bz2
    151 
     157      </xsl:text>
     158      <xsl:call-template name="unpack"/>
     159      <xsl:text>
    152160cd $PKGDIR
    153161./configure --prefix=/usr
     
    156164make install
    157165      </xsl:text>
     166      <xsl:call-template name="clean_sources"/>
    158167      <xsl:call-template name="footer"/>
    159168    </exsl:document>
     
    208217
    209218
     219    <!-- Enter to the sources dir, clean it, and unpack the tarball -->
     220  <xsl:template name="unpack">
     221    <xsl:choose>
     222      <xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
     223        <xsl:text>cd $SRCDIR</xsl:text>
     224      </xsl:when>
     225      <xsl:otherwise>
     226        <xsl:text>cd /sources</xsl:text>
     227      </xsl:otherwise>
     228    </xsl:choose>
     229    <xsl:text>
     230PKGDIR=`tar -tf $TARBALL | head -n1 | sed -e 's@^./@@;s@/.*@@'`
     231if [ -d $PKGDIR ]; then
     232  rm -rf $PKGDIR
     233fi
     234if [ -d ${PKGDIR%-*}-build ]; then
     235  rm -rf ${PKGDIR%-*}-build
     236fi
     237tar -xf $TARBALL
     238    </xsl:text>
     239  </xsl:template>
     240
     241
    210242    <!-- Extra previous commands needed by the book but not inside screen tags -->
    211243  <xsl:template name="pre_commands">
     
    214246    </xsl:if>
    215247    <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
    216       <xsl:text>tar -xvf ../$TARBALL_1 --strip-components=1&#xA;</xsl:text>
     248      <xsl:text>tar -xf ../$TARBALL_1 --strip-components=1&#xA;</xsl:text>
    217249    </xsl:if>
    218250  </xsl:template>
     
    227259      <xsl:value-of select="substring-after($content,'/usr/lib/locale')"/>
    228260    </xsl:if>
     261  </xsl:template>
     262
     263
     264    <!-- Remove sources and build dirs -->
     265  <xsl:template name="clean_sources">
     266    <xsl:choose>
     267      <xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
     268        <xsl:text>cd $SRCDIR</xsl:text>
     269      </xsl:when>
     270      <xsl:otherwise>
     271        <xsl:text>cd /sources</xsl:text>
     272      </xsl:otherwise>
     273    </xsl:choose>
     274    <xsl:text>
     275rm -rf $PKGDIR
     276rm -rf ${PKGDIR%-*}-build
     277    </xsl:text>
    229278  </xsl:template>
    230279
     
    300349VERSION=0.0.0
    301350TARBALL=dummy-0.0.0.tar.bz2
    302 
     351      </xsl:text>
     352      <xsl:call-template name="unpack"/>
     353      <xsl:text>
    303354cd $PKGDIR
    304355./configure --prefix=/usr
     
    307358make install
    308359      </xsl:text>
     360      <xsl:call-template name="clean_sources"/>
    309361      <xsl:call-template name="footer"/>
    310362    </exsl:document>
     
    402454          <xsl:with-param name="phase" select="$filename"/>
    403455        </xsl:apply-templates>
     456        <xsl:if test="sect2[@role='installation']">
     457          <xsl:call-template name="unpack"/>
     458        </xsl:if>
    404459        <xsl:call-template name="user_pre_commands"/>
    405460        <xsl:call-template name="pre_commands"/>
     
    407462        <xsl:call-template name="post_commands"/>
    408463        <xsl:call-template name="user_footer"/>
     464        <xsl:if test="sect2[@role='installation']">
     465          <xsl:call-template name="clean_sources"/>
     466        </xsl:if>
    409467        <xsl:call-template name="footer"/>
    410468      </exsl:document>
Note: See TracChangeset for help on using the changeset viewer.