Changeset 51e3d23 for LFS


Ignore:
Timestamp:
09/23/2007 01:23:16 PM (17 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
experimental
Children:
3b6adab
Parents:
570c9f3
Message:

Do disk usage meassurament from inside build scripts
plus other fixes to can keep accurate disk usage and SBU reports.
Chroot scripts clean-up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LFS/lfs.xsl

    r570c9f3 r51e3d23  
    8888VERSION=0.0.0
    8989TARBALL=dummy-0.0.0.tar.bz2
    90       </xsl:text>
    91       <xsl:call-template name="unpack"/>
    92       <xsl:text>
     90        </xsl:text>
     91        <xsl:call-template name="disk_usage"/>
     92        <xsl:call-template name="unpack"/>
     93        <xsl:text>
    9394cd $PKGDIR
    9495./configure --prefix=/usr
     
    9798make install
    9899        </xsl:text>
     100        <xsl:call-template name="disk_usage"/>
    99101        <xsl:call-template name="clean_sources"/>
    100102        <xsl:call-template name="footer"/>
     
    124126VERSION=0.0.0
    125127TARBALL=dummy-0.0.0.tar.bz2
    126       </xsl:text>
    127       <xsl:call-template name="unpack"/>
    128       <xsl:text>
     128        </xsl:text>
     129        <xsl:call-template name="disk_usage"/>
     130        <xsl:call-template name="unpack"/>
     131        <xsl:text>
    129132cd $PKGDIR
    130133./configure --prefix=/usr
     
    133136make install
    134137        </xsl:text>
     138        <xsl:call-template name="disk_usage"/>
    135139        <xsl:call-template name="clean_sources"/>
    136140        <xsl:call-template name="footer"/>
     
    156160TARBALL=dummy-0.0.0.tar.bz2
    157161      </xsl:text>
     162      <xsl:call-template name="disk_usage"/>
    158163      <xsl:call-template name="unpack"/>
    159164      <xsl:text>
     
    164169make install
    165170      </xsl:text>
     171      <xsl:call-template name="disk_usage"/>
    166172      <xsl:call-template name="clean_sources"/>
    167173      <xsl:call-template name="footer"/>
     
    195201    <!-- Script header -->
    196202  <xsl:template name="header">
    197       <!-- Set the shabang -->
    198     <xsl:choose>
    199       <xsl:when test="@id='ch-system-creatingdirs' or
    200                       @id='ch-system-createfiles' or
    201                       @id='ch-system-strippingagain'">
    202         <xsl:text>#!/tools/bin/bash&#xA;</xsl:text>
    203       </xsl:when>
    204       <xsl:otherwise>
    205         <xsl:text>#!/bin/bash&#xA;</xsl:text>
    206       </xsl:otherwise>
    207     </xsl:choose>
    208       <!-- Set +h -->
    209     <xsl:text>set +h&#xA;</xsl:text>
    210       <!-- Set -e -->
    211     <xsl:if test="not(@id='ch-tools-stripping') and
    212                   not(@id='ch-system-strippingagain')">
    213       <xsl:text>set -e&#xA;</xsl:text>
    214     </xsl:if>
    215     <xsl:text>&#xA;</xsl:text>
    216   </xsl:template>
    217 
    218 
    219     <!-- Enter to the sources dir, clean it, and unpack the tarball -->
     203    <xsl:if test="not(@id='ch-system-chroot') and
     204                  not(@id='ch-system-revisedchroot')">
     205        <!-- Set the shabang -->
     206      <xsl:choose>
     207        <xsl:when test="@id='ch-system-creatingdirs' or
     208                        @id='ch-system-createfiles' or
     209                        @id='ch-system-strippingagain'">
     210          <xsl:text>#!/tools/bin/bash&#xA;</xsl:text>
     211        </xsl:when>
     212        <xsl:otherwise>
     213          <xsl:text>#!/bin/bash&#xA;</xsl:text>
     214        </xsl:otherwise>
     215      </xsl:choose>
     216        <!-- Set +h -->
     217      <xsl:text>set +h&#xA;</xsl:text>
     218        <!-- Set -e -->
     219      <xsl:if test="not(@id='ch-tools-stripping') and
     220                    not(@id='ch-system-strippingagain')">
     221        <xsl:text>set -e&#xA;</xsl:text>
     222      </xsl:if>
     223        <!-- Dump a time stamp -->
     224      <xsl:text>&#xA;echo -e "\n`date`\n"&#xA;</xsl:text>
     225    </xsl:if>
     226  </xsl:template>
     227
     228
     229    <!-- Dump current disk usage -->
     230  <xsl:template name="disk_usage">
     231    <xsl:if test="not(@id='ch-system-chroot') and
     232                  not(@id='ch-system-revisedchroot')">
     233      <xsl:choose>
     234        <xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
     235          <xsl:text>echo -e "\nKB: `du -skx --exclude=jhalfs --exclude=lost+found $LFS`\n"&#xA;</xsl:text>
     236        </xsl:when>
     237        <xsl:otherwise>
     238          <xsl:text>echo -e "\nKB: `du -skx --exclude=jhalfs --exclude=lost+found /`\n"&#xA;</xsl:text>
     239        </xsl:otherwise>
     240      </xsl:choose>
     241    </xsl:if>
     242  </xsl:template>
     243
     244
     245    <!-- Enter to the sources dir, clean it, unpack the tarball,
     246         and reset the seconds counter -->
    220247  <xsl:template name="unpack">
    221248    <xsl:choose>
     
    236263fi
    237264tar -xf $TARBALL
     265SECONDS=0
    238266    </xsl:text>
    239267  </xsl:template>
     
    262290
    263291
    264     <!-- Remove sources and build dirs -->
     292    <!-- Remove sources and build dirs, skipping it from seconds meassurament -->
    265293  <xsl:template name="clean_sources">
    266294    <xsl:choose>
     
    273301    </xsl:choose>
    274302    <xsl:text>
     303SECS=$SECONDS
    275304rm -rf $PKGDIR
    276305rm -rf ${PKGDIR%-*}-build
     306SECONDS=$SECS
    277307    </xsl:text>
    278308  </xsl:template>
     
    281311    <!-- Script footer -->
    282312  <xsl:template name="footer">
    283       <!-- Dump the build time -->
     313      <!-- Dump the build time and exit -->
    284314    <xsl:if test="not(@id='ch-system-chroot') and
    285315                  not(@id='ch-system-revisedchroot')">
    286       <xsl:text>&#xA;&#xA;echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
    287     </xsl:if>
    288       <!-- Exit -->
    289     <xsl:text>&#xA;exit&#xA;</xsl:text>
     316      <xsl:text>
     317echo -e "\n\nTotalseconds: $SECONDS\n"
     318
     319exit
     320      </xsl:text>
     321    </xsl:if>
    290322  </xsl:template>
    291323
     
    350382TARBALL=dummy-0.0.0.tar.bz2
    351383      </xsl:text>
     384      <xsl:call-template name="disk_usage"/>
    352385      <xsl:call-template name="unpack"/>
    353386      <xsl:text>
     
    358391make install
    359392      </xsl:text>
     393      <xsl:call-template name="disk_usage"/>
    360394      <xsl:call-template name="clean_sources"/>
    361395      <xsl:call-template name="footer"/>
     
    454488          <xsl:with-param name="phase" select="$filename"/>
    455489        </xsl:apply-templates>
     490        <xsl:call-template name="disk_usage"/>
    456491        <xsl:if test="sect2[@role='installation']">
    457492          <xsl:call-template name="unpack"/>
     
    462497        <xsl:call-template name="post_commands"/>
    463498        <xsl:call-template name="user_footer"/>
     499        <xsl:call-template name="disk_usage"/>
    464500        <xsl:if test="sect2[@role='installation']">
    465501          <xsl:call-template name="clean_sources"/>
Note: See TracChangeset for help on using the changeset viewer.