Set $TEST_LOG from inside the build scripts.
There is no need now to use the envars file. Optimize support must be moved to an XSL-based code.
This commit is contained in:
parent
5a4f6a7a9f
commit
f5f857df48
3 changed files with 136 additions and 163 deletions
117
LFS/lfs.xsl
117
LFS/lfs.xsl
|
@ -47,6 +47,7 @@
|
|||
<!-- ####################################################################### -->
|
||||
|
||||
<!-- ########### NAMED USER TEMPLATES TO ALLOW CUSTOMIZATIONS ############## -->
|
||||
<!-- ############ Maybe should be placed on a separate file ################ -->
|
||||
|
||||
<!-- Hock for user header additions -->
|
||||
<xsl:template name="user_header">
|
||||
|
@ -144,7 +145,8 @@ make install
|
|||
|
||||
|
||||
<!-- Hock for creating a custom tools directory containing scripts
|
||||
to be run after the system has been built -->
|
||||
to be run after the system has been built
|
||||
(to be moved to a separate file) -->
|
||||
<xsl:template name="custom-tools">
|
||||
<!-- Fixed directory and ch_order values -->
|
||||
<xsl:variable name="basedir">custom-tools/20_</xsl:variable>
|
||||
|
@ -245,15 +247,11 @@ make install
|
|||
<!-- Enter to the sources dir, clean it, unpack the tarball,
|
||||
and reset the seconds counter -->
|
||||
<xsl:template name="unpack">
|
||||
<xsl:choose>
|
||||
<xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
|
||||
<xsl:text>cd $SRCDIR</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>cd /sources</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>
|
||||
<xsl:text>cd </xsl:text>
|
||||
<xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
|
||||
<xsl:text>$LFS</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>/sources
|
||||
PKGDIR=`tar -tf $TARBALL | head -n1 | sed -e 's@^./@@;s@/.*@@'`
|
||||
if [ -d $PKGDIR ]; then
|
||||
rm -rf $PKGDIR
|
||||
|
@ -291,15 +289,11 @@ SECONDS=0
|
|||
|
||||
<!-- Remove sources and build dirs, skipping it from seconds meassurament -->
|
||||
<xsl:template name="clean_sources">
|
||||
<xsl:choose>
|
||||
<xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
|
||||
<xsl:text>cd $SRCDIR</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>cd /sources</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>
|
||||
<xsl:text>cd </xsl:text>
|
||||
<xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
|
||||
<xsl:text>$LFS</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>/sources
|
||||
SECS=$SECONDS
|
||||
rm -rf $PKGDIR
|
||||
rm -rf ${PKGDIR%-*}-build
|
||||
|
@ -367,7 +361,30 @@ exit
|
|||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Adds blfs-tool support scripts -->
|
||||
<!-- Check if a package testsuite must be run -->
|
||||
<xsl:template name="run_this_test">
|
||||
<xsl:choose>
|
||||
<xsl:when test=".//userinput[@remap='test']">
|
||||
<xsl:choose>
|
||||
<!-- No testsuites run on level 0 -->
|
||||
<xsl:when test="$testsuite = '0'">0</xsl:when>
|
||||
<!-- On level 1, only final system toolchain testsuites are run -->
|
||||
<xsl:when test="$testsuite = '1' and
|
||||
not(@id='ch-system-gcc') and
|
||||
not(@id='ch-system-glibc') and
|
||||
not(@id='ch-system-binutils')">0</xsl:when>
|
||||
<!-- On level 2, temp tools testsuites are not run -->
|
||||
<xsl:when test="$testsuite = '2' and
|
||||
../@id='chapter-temporary-tools'">0</xsl:when>
|
||||
<xsl:otherwise>1</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>0</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Adds blfs-tool support scripts (to be moved to a separate file) -->
|
||||
<xsl:template name="blfs-tool">
|
||||
<!-- Fixed directory and ch_order values -->
|
||||
<xsl:variable name="basedir">blfs-tool-deps/30_</xsl:variable>
|
||||
|
@ -475,6 +492,10 @@ make install
|
|||
</xsl:variable>
|
||||
<!-- Script build order -->
|
||||
<xsl:variable name="order" select="concat($dirname,'/',$ch_order,'_',$sect1_order)"/>
|
||||
<!-- Must the package test suite, if any, be run? -->
|
||||
<xsl:variable name="run_this_test">
|
||||
<xsl:call-template name="run_this_test"/>
|
||||
</xsl:variable>
|
||||
<!-- Hock to insert scripts before the current one -->
|
||||
<xsl:call-template name="insert_script_before">
|
||||
<xsl:with-param name="reference" select="@id"/>
|
||||
|
@ -486,6 +507,8 @@ make install
|
|||
<xsl:call-template name="user_header"/>
|
||||
<xsl:apply-templates select="sect1info[@condition='script']">
|
||||
<xsl:with-param name="phase" select="$filename"/>
|
||||
<xsl:with-param name="run_this_test" select="$run_this_test"/>
|
||||
<xsl:with-param name="testlogfile" select="concat($ch_order,'_',$sect1_order,'-',$filename)"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:call-template name="disk_usage"/>
|
||||
<xsl:if test="sect2[@role='installation']">
|
||||
|
@ -493,7 +516,9 @@ make install
|
|||
</xsl:if>
|
||||
<xsl:call-template name="user_pre_commands"/>
|
||||
<xsl:call-template name="pre_commands"/>
|
||||
<xsl:apply-templates select=".//screen"/>
|
||||
<xsl:apply-templates select=".//screen">
|
||||
<xsl:with-param name="run_this_test" select="$run_this_test"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:call-template name="post_commands"/>
|
||||
<xsl:call-template name="user_footer"/>
|
||||
<xsl:call-template name="disk_usage"/>
|
||||
|
@ -513,6 +538,9 @@ make install
|
|||
|
||||
<!-- sect1info -->
|
||||
<xsl:template match="sect1info">
|
||||
<!-- Used to set and initialize the testuite log file -->
|
||||
<xsl:param name="testlogfile" select="foo"/>
|
||||
<xsl:param name="run_this_test" select="foo"/>
|
||||
<!-- Build phase (base file name) to be used for PM -->
|
||||
<xsl:param name="phase" select="foo"/>
|
||||
<xsl:text>
PKG_PHASE=</xsl:text>
|
||||
|
@ -523,6 +551,15 @@ make install
|
|||
<xsl:apply-templates select="productnumber"/>
|
||||
<!-- Tarball name -->
|
||||
<xsl:apply-templates select="address"/>
|
||||
<xsl:if test="$run_this_test = '1'">
|
||||
<xsl:text>
TEST_LOG=</xsl:text>
|
||||
<xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
|
||||
<xsl:text>$LFS</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>/jhalfs/test-logs/</xsl:text>
|
||||
<xsl:value-of select="$testlogfile"/>
|
||||
<xsl:text>
echo -e "\n`date`\n" > $TEST_LOG</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>

</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
|
@ -567,15 +604,27 @@ make install
|
|||
|
||||
<!-- screen -->
|
||||
<xsl:template match="screen">
|
||||
<xsl:param name="run_this_test" select="foo"/>
|
||||
<xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
||||
<xsl:call-template name="top_screen_build_fixes"/>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="run_this_test" select="$run_this_test"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:call-template name="bottom_screen_build_fixes"/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- userinput @remap='test' -->
|
||||
<xsl:template match="userinput[@remap='test']">
|
||||
<xsl:param name="run_this_test" select="foo"/>
|
||||
<xsl:apply-templates select="." mode="test">
|
||||
<xsl:with-param name="run_this_test" select="$run_this_test"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- userinput @remap='pre' -->
|
||||
<xsl:template match="userinput[@remap='pre']">
|
||||
<xsl:apply-templates select="." mode="pre"/>
|
||||
|
@ -594,12 +643,6 @@ make install
|
|||
</xsl:template>
|
||||
|
||||
|
||||
<!-- userinput @remap='test' -->
|
||||
<xsl:template match="userinput[@remap='test']">
|
||||
<xsl:apply-templates select="." mode="test"/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- userinput @remap='install' -->
|
||||
<xsl:template match="userinput[@remap='install']">
|
||||
<xsl:apply-templates select="." mode="install"/>
|
||||
|
@ -669,19 +712,8 @@ make install
|
|||
|
||||
<!-- mode test -->
|
||||
<xsl:template match="userinput" mode="test">
|
||||
<xsl:choose>
|
||||
<!-- No testsuites run on level 0 -->
|
||||
<xsl:when test="$testsuite = '0'"/>
|
||||
<!-- On level 1, only final system toolchain testsuites are run -->
|
||||
<xsl:when test="$testsuite = '1' and
|
||||
not(ancestor::sect1[@id='ch-system-gcc']) and
|
||||
not(ancestor::sect1[@id='ch-system-glibc']) and
|
||||
not(ancestor::sect1[@id='ch-system-binutils'])"/>
|
||||
<!-- On level 2, temp tools testsuites are not run -->
|
||||
<xsl:when test="$testsuite = '2' and
|
||||
ancestor::chapter[@id='chapter-temporary-tools']"/>
|
||||
<!-- Start testsuites command fixes -->
|
||||
<xsl:otherwise>
|
||||
<xsl:param name="run_this_test" select="foo"/>
|
||||
<xsl:if test="$run_this_test = '1'">
|
||||
<xsl:choose>
|
||||
<!-- Final system Glibc -->
|
||||
<xsl:when test="contains(string(),'glibc-check-log')">
|
||||
|
@ -734,8 +766,7 @@ make install
|
|||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
|
|
@ -51,14 +51,11 @@ chapter4_Makefiles() { #
|
|||
@echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "LFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "SRCDIR=\$(MOUNT_PT)/sources" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "PATH=/tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export LFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
|
||||
touch envars && \\
|
||||
chown \$(LUSER) envars
|
||||
chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc
|
||||
@\$(call housekeeping)
|
||||
EOF
|
||||
) > $MKFILE.tmp
|
||||
|
@ -95,9 +92,6 @@ chapter5_Makefiles() {
|
|||
*) chapter5="$chapter5 ${this_script}" ;;
|
||||
esac
|
||||
|
||||
# Grab the package name, if the script is building a package
|
||||
name=`grep "^PACKAGE=" ${file} | sed -e 's@PACKAGE=@@'`
|
||||
|
||||
# Set the dependency for the first target.
|
||||
if [ -z $PREV ] ; then PREV=04_04-settingenvironment ; fi
|
||||
|
||||
|
@ -109,14 +103,6 @@ chapter5_Makefiles() {
|
|||
# as a dependency. Also call the echo_message function.
|
||||
LUSER_wrt_target "${this_script}" "$PREV"
|
||||
|
||||
# If $name isn't empty, we've got a package...
|
||||
if [ "$name" != "" ] ; then
|
||||
# If the testsuites must be run, initialize the log file
|
||||
[[ "$TEST" = "3" ]] && LUSER_wrt_test_log "${this_script}"
|
||||
# If using optimizations, write the instructions
|
||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
fi
|
||||
|
||||
# Run the script.
|
||||
# The changingowner script must be run as root.
|
||||
case "${this_script}" in
|
||||
|
@ -175,7 +161,7 @@ chapter6_Makefiles() {
|
|||
*linux-headers*) [[ -n "$N" ]] && continue ;;
|
||||
esac
|
||||
|
||||
# Grab the name of the target.
|
||||
# Grab the name of the package, if any.
|
||||
name=`grep "^PACKAGE=" ${file} | sed -e 's@PACKAGE=@@'`
|
||||
|
||||
# Skip scripts not needed for iterations rebuilds
|
||||
|
@ -207,25 +193,11 @@ chapter6_Makefiles() {
|
|||
*) CHROOT_wrt_target "${this_script}" "$PREV" ;;
|
||||
esac
|
||||
|
||||
# If $name isn't empty, we've got a package...
|
||||
if [ "$name" != "" ] ; then
|
||||
# Touch timestamp file if installed files logs will be created.
|
||||
# But only for the firt build when running iterative builds.
|
||||
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
|
||||
if [ "$name" != "" ] && [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
|
||||
CHROOT_wrt_TouchTimestamp
|
||||
fi
|
||||
# If the testsuites must be run, initialize the log file
|
||||
case $name in
|
||||
binutils | gcc | glibc )
|
||||
[[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}"
|
||||
;;
|
||||
* )
|
||||
[[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && CHROOT_wrt_test_log "${this_script}"
|
||||
;;
|
||||
esac
|
||||
# If using optimizations, write the instructions
|
||||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
fi
|
||||
|
||||
# In the mount of kernel filesystems we need to set LFS
|
||||
# and not to use chroot.
|
||||
|
@ -362,6 +334,7 @@ build_Makefile() { #
|
|||
chroot=`cat $file | tr -d '\n' | \
|
||||
sed -e "s@chroot@$CHROOT_LOC@" \
|
||||
-e 's@ \\\@ @g' \
|
||||
-e 's/ */ /g' \
|
||||
-e 's|\\$|&&|g' \
|
||||
-e 's|"$$LFS"|$(MOUNT_PT)|' \
|
||||
-e 's|$| -c|'`
|
||||
|
|
|
@ -58,7 +58,7 @@ EOF
|
|||
#==== TARGET HEADER ====
|
||||
|
||||
#----------------------------------#
|
||||
LUSER_wrt_target() { # Create target and initialize envars file
|
||||
LUSER_wrt_target() { # Create target
|
||||
#----------------------------------#
|
||||
local i=$1
|
||||
local PREV=$2
|
||||
|
@ -68,7 +68,6 @@ cat << EOF
|
|||
$i: $PREV
|
||||
@\$(call echo_message, Building)
|
||||
@export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
|
||||
@rm -f envars && touch envars
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
@ -84,36 +83,6 @@ cat << EOF
|
|||
$i: $PREV
|
||||
@\$(call echo_message, Building)
|
||||
@export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
|
||||
@rm -f envars && touch envars
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
||||
#=======================
|
||||
|
||||
|
||||
#===== TESTS LOGS ======
|
||||
|
||||
#----------------------------------#
|
||||
LUSER_wrt_test_log() { # Initialize testsuite log file
|
||||
#----------------------------------#
|
||||
local TESTLOGFILE=$1
|
||||
(
|
||||
cat << EOF
|
||||
@echo "export TEST_LOG=\$(TESTLOGDIR)/$TESTLOGFILE" >> envars && \\
|
||||
echo "\$(nl_)\`date\`\$(nl_)" > \$(TESTLOGDIR)/\$@
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
||||
#----------------------------------#
|
||||
CHROOT_wrt_test_log() { #
|
||||
#----------------------------------#
|
||||
local TESTLOGFILE=$1
|
||||
(
|
||||
cat << EOF
|
||||
@echo "export TEST_LOG=\$(crTESTLOGDIR)/$TESTLOGFILE" >> envars && \\
|
||||
echo "\$(nl_)\`date\`\$(nl_)" > test-logs/\$@
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
@ -152,7 +121,7 @@ LUSER_wrt_RunAsUser() { #
|
|||
|
||||
(
|
||||
cat << EOF
|
||||
@source ~/.bashrc && \$(CMDSDIR)/`dirname $file`/\$@ > logs/\$@ 2>&1
|
||||
@\$(CMDSDIR)/`dirname $file`/\$@ > logs/\$@ 2>&1
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
@ -163,7 +132,7 @@ CHROOT_wrt_RunAsRoot() { #
|
|||
local file=$1
|
||||
(
|
||||
cat << EOF
|
||||
@source envars && \$(crCMDSDIR)/`dirname $file`/\$@ > logs/\$@ 2>&1
|
||||
@\$(crCMDSDIR)/`dirname $file`/\$@ > logs/\$@ 2>&1
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
|
||||
|
|
Reference in a new issue