Do disk usage meassurament from inside build scripts
plus other fixes to can keep accurate disk usage and SBU reports. Chroot scripts clean-up.
This commit is contained in:
parent
570c9f3863
commit
51e3d23660
1 changed files with 66 additions and 30 deletions
96
LFS/lfs.xsl
96
LFS/lfs.xsl
|
@ -87,15 +87,17 @@ PKG_PHASE=dummy
|
||||||
PACKAGE=dummy
|
PACKAGE=dummy
|
||||||
VERSION=0.0.0
|
VERSION=0.0.0
|
||||||
TARBALL=dummy-0.0.0.tar.bz2
|
TARBALL=dummy-0.0.0.tar.bz2
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
<xsl:call-template name="unpack"/>
|
<xsl:call-template name="disk_usage"/>
|
||||||
<xsl:text>
|
<xsl:call-template name="unpack"/>
|
||||||
|
<xsl:text>
|
||||||
cd $PKGDIR
|
cd $PKGDIR
|
||||||
./configure --prefix=/usr
|
./configure --prefix=/usr
|
||||||
make
|
make
|
||||||
make check
|
make check
|
||||||
make install
|
make install
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
|
<xsl:call-template name="disk_usage"/>
|
||||||
<xsl:call-template name="clean_sources"/>
|
<xsl:call-template name="clean_sources"/>
|
||||||
<xsl:call-template name="footer"/>
|
<xsl:call-template name="footer"/>
|
||||||
</exsl:document>
|
</exsl:document>
|
||||||
|
@ -123,15 +125,17 @@ PKG_PHASE=dummy
|
||||||
PACKAGE=dummy
|
PACKAGE=dummy
|
||||||
VERSION=0.0.0
|
VERSION=0.0.0
|
||||||
TARBALL=dummy-0.0.0.tar.bz2
|
TARBALL=dummy-0.0.0.tar.bz2
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
<xsl:call-template name="unpack"/>
|
<xsl:call-template name="disk_usage"/>
|
||||||
<xsl:text>
|
<xsl:call-template name="unpack"/>
|
||||||
|
<xsl:text>
|
||||||
cd $PKGDIR
|
cd $PKGDIR
|
||||||
./configure --prefix=/usr
|
./configure --prefix=/usr
|
||||||
make
|
make
|
||||||
make check
|
make check
|
||||||
make install
|
make install
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
|
<xsl:call-template name="disk_usage"/>
|
||||||
<xsl:call-template name="clean_sources"/>
|
<xsl:call-template name="clean_sources"/>
|
||||||
<xsl:call-template name="footer"/>
|
<xsl:call-template name="footer"/>
|
||||||
</exsl:document>
|
</exsl:document>
|
||||||
|
@ -155,6 +159,7 @@ PACKAGE=dummy
|
||||||
VERSION=0.0.0
|
VERSION=0.0.0
|
||||||
TARBALL=dummy-0.0.0.tar.bz2
|
TARBALL=dummy-0.0.0.tar.bz2
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
|
<xsl:call-template name="disk_usage"/>
|
||||||
<xsl:call-template name="unpack"/>
|
<xsl:call-template name="unpack"/>
|
||||||
<xsl:text>
|
<xsl:text>
|
||||||
cd $PKGDIR
|
cd $PKGDIR
|
||||||
|
@ -163,6 +168,7 @@ make
|
||||||
make check
|
make check
|
||||||
make install
|
make install
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
|
<xsl:call-template name="disk_usage"/>
|
||||||
<xsl:call-template name="clean_sources"/>
|
<xsl:call-template name="clean_sources"/>
|
||||||
<xsl:call-template name="footer"/>
|
<xsl:call-template name="footer"/>
|
||||||
</exsl:document>
|
</exsl:document>
|
||||||
|
@ -194,29 +200,50 @@ make install
|
||||||
|
|
||||||
<!-- Script header -->
|
<!-- Script header -->
|
||||||
<xsl:template name="header">
|
<xsl:template name="header">
|
||||||
<!-- Set the shabang -->
|
<xsl:if test="not(@id='ch-system-chroot') and
|
||||||
<xsl:choose>
|
not(@id='ch-system-revisedchroot')">
|
||||||
<xsl:when test="@id='ch-system-creatingdirs' or
|
<!-- Set the shabang -->
|
||||||
@id='ch-system-createfiles' or
|
<xsl:choose>
|
||||||
@id='ch-system-strippingagain'">
|
<xsl:when test="@id='ch-system-creatingdirs' or
|
||||||
<xsl:text>#!/tools/bin/bash
</xsl:text>
|
@id='ch-system-createfiles' or
|
||||||
</xsl:when>
|
@id='ch-system-strippingagain'">
|
||||||
<xsl:otherwise>
|
<xsl:text>#!/tools/bin/bash
</xsl:text>
|
||||||
<xsl:text>#!/bin/bash
</xsl:text>
|
</xsl:when>
|
||||||
</xsl:otherwise>
|
<xsl:otherwise>
|
||||||
</xsl:choose>
|
<xsl:text>#!/bin/bash
</xsl:text>
|
||||||
<!-- Set +h -->
|
</xsl:otherwise>
|
||||||
<xsl:text>set +h
</xsl:text>
|
</xsl:choose>
|
||||||
<!-- Set -e -->
|
<!-- Set +h -->
|
||||||
<xsl:if test="not(@id='ch-tools-stripping') and
|
<xsl:text>set +h
</xsl:text>
|
||||||
not(@id='ch-system-strippingagain')">
|
<!-- Set -e -->
|
||||||
<xsl:text>set -e
</xsl:text>
|
<xsl:if test="not(@id='ch-tools-stripping') and
|
||||||
|
not(@id='ch-system-strippingagain')">
|
||||||
|
<xsl:text>set -e
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<!-- Dump a time stamp -->
|
||||||
|
<xsl:text>
echo -e "\n`date`\n"
</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:text>
</xsl:text>
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
<!-- Enter to the sources dir, clean it, and unpack the tarball -->
|
<!-- Dump current disk usage -->
|
||||||
|
<xsl:template name="disk_usage">
|
||||||
|
<xsl:if test="not(@id='ch-system-chroot') and
|
||||||
|
not(@id='ch-system-revisedchroot')">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
|
||||||
|
<xsl:text>echo -e "\nKB: `du -skx --exclude=jhalfs --exclude=lost+found $LFS`\n"
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>echo -e "\nKB: `du -skx --exclude=jhalfs --exclude=lost+found /`\n"
</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Enter to the sources dir, clean it, unpack the tarball,
|
||||||
|
and reset the seconds counter -->
|
||||||
<xsl:template name="unpack">
|
<xsl:template name="unpack">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
|
<xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
|
||||||
|
@ -235,6 +262,7 @@ if [ -d ${PKGDIR%-*}-build ]; then
|
||||||
rm -rf ${PKGDIR%-*}-build
|
rm -rf ${PKGDIR%-*}-build
|
||||||
fi
|
fi
|
||||||
tar -xf $TARBALL
|
tar -xf $TARBALL
|
||||||
|
SECONDS=0
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
@ -261,7 +289,7 @@ tar -xf $TARBALL
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
<!-- Remove sources and build dirs -->
|
<!-- Remove sources and build dirs, skipping it from seconds meassurament -->
|
||||||
<xsl:template name="clean_sources">
|
<xsl:template name="clean_sources">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
|
<xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
|
||||||
|
@ -272,21 +300,25 @@ tar -xf $TARBALL
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
<xsl:text>
|
<xsl:text>
|
||||||
|
SECS=$SECONDS
|
||||||
rm -rf $PKGDIR
|
rm -rf $PKGDIR
|
||||||
rm -rf ${PKGDIR%-*}-build
|
rm -rf ${PKGDIR%-*}-build
|
||||||
|
SECONDS=$SECS
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
<!-- Script footer -->
|
<!-- Script footer -->
|
||||||
<xsl:template name="footer">
|
<xsl:template name="footer">
|
||||||
<!-- Dump the build time -->
|
<!-- Dump the build time and exit -->
|
||||||
<xsl:if test="not(@id='ch-system-chroot') and
|
<xsl:if test="not(@id='ch-system-chroot') and
|
||||||
not(@id='ch-system-revisedchroot')">
|
not(@id='ch-system-revisedchroot')">
|
||||||
<xsl:text>

echo -e "\n\nTotalseconds: $SECONDS\n"
</xsl:text>
|
<xsl:text>
|
||||||
|
echo -e "\n\nTotalseconds: $SECONDS\n"
|
||||||
|
|
||||||
|
exit
|
||||||
|
</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<!-- Exit -->
|
|
||||||
<xsl:text>
exit
</xsl:text>
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
@ -349,6 +381,7 @@ PACKAGE=dummy
|
||||||
VERSION=0.0.0
|
VERSION=0.0.0
|
||||||
TARBALL=dummy-0.0.0.tar.bz2
|
TARBALL=dummy-0.0.0.tar.bz2
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
|
<xsl:call-template name="disk_usage"/>
|
||||||
<xsl:call-template name="unpack"/>
|
<xsl:call-template name="unpack"/>
|
||||||
<xsl:text>
|
<xsl:text>
|
||||||
cd $PKGDIR
|
cd $PKGDIR
|
||||||
|
@ -357,6 +390,7 @@ make
|
||||||
make check
|
make check
|
||||||
make install
|
make install
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
|
<xsl:call-template name="disk_usage"/>
|
||||||
<xsl:call-template name="clean_sources"/>
|
<xsl:call-template name="clean_sources"/>
|
||||||
<xsl:call-template name="footer"/>
|
<xsl:call-template name="footer"/>
|
||||||
</exsl:document>
|
</exsl:document>
|
||||||
|
@ -453,6 +487,7 @@ make install
|
||||||
<xsl:apply-templates select="sect1info[@condition='script']">
|
<xsl:apply-templates select="sect1info[@condition='script']">
|
||||||
<xsl:with-param name="phase" select="$filename"/>
|
<xsl:with-param name="phase" select="$filename"/>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
|
<xsl:call-template name="disk_usage"/>
|
||||||
<xsl:if test="sect2[@role='installation']">
|
<xsl:if test="sect2[@role='installation']">
|
||||||
<xsl:call-template name="unpack"/>
|
<xsl:call-template name="unpack"/>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
@ -461,6 +496,7 @@ make install
|
||||||
<xsl:apply-templates select=".//screen"/>
|
<xsl:apply-templates select=".//screen"/>
|
||||||
<xsl:call-template name="post_commands"/>
|
<xsl:call-template name="post_commands"/>
|
||||||
<xsl:call-template name="user_footer"/>
|
<xsl:call-template name="user_footer"/>
|
||||||
|
<xsl:call-template name="disk_usage"/>
|
||||||
<xsl:if test="sect2[@role='installation']">
|
<xsl:if test="sect2[@role='installation']">
|
||||||
<xsl:call-template name="clean_sources"/>
|
<xsl:call-template name="clean_sources"/>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
Reference in a new issue