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
50
LFS/lfs.xsl
50
LFS/lfs.xsl
|
@ -88,6 +88,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
|
||||||
|
@ -96,6 +97,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>
|
||||||
|
@ -124,6 +126,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
|
||||||
|
@ -132,6 +135,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>
|
||||||
|
@ -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,6 +200,8 @@ make install
|
||||||
|
|
||||||
<!-- Script header -->
|
<!-- Script header -->
|
||||||
<xsl:template name="header">
|
<xsl:template name="header">
|
||||||
|
<xsl:if test="not(@id='ch-system-chroot') and
|
||||||
|
not(@id='ch-system-revisedchroot')">
|
||||||
<!-- Set the shabang -->
|
<!-- Set the shabang -->
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@id='ch-system-creatingdirs' or
|
<xsl:when test="@id='ch-system-creatingdirs' or
|
||||||
|
@ -212,11 +220,30 @@ make install
|
||||||
not(@id='ch-system-strippingagain')">
|
not(@id='ch-system-strippingagain')">
|
||||||
<xsl:text>set -e
</xsl:text>
|
<xsl:text>set -e
</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:text>
</xsl:text>
|
<!-- Dump a time stamp -->
|
||||||
|
<xsl:text>
echo -e "\n`date`\n"
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
</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