Replace $(nproc || echo 1) and $(nproc)
This commit is contained in:
parent
4ba94ad556
commit
1b02a9acff
3 changed files with 38 additions and 1 deletions
18
LFS/lfs.xsl
18
LFS/lfs.xsl
|
@ -28,6 +28,10 @@
|
||||||
-->
|
-->
|
||||||
<xsl:param name="testsuite" select="1"/>
|
<xsl:param name="testsuite" select="1"/>
|
||||||
|
|
||||||
|
<!-- Parallelism (LFS >= 12.1) -->
|
||||||
|
<xsl:param name="jobs_1" select="1"/>
|
||||||
|
<xsl:param name="jobs_2" select="1"/>
|
||||||
|
|
||||||
<!-- Install non wide character ncurses 5? -->
|
<!-- Install non wide character ncurses 5? -->
|
||||||
<xsl:param name="ncurses5" select="'n'"/>
|
<xsl:param name="ncurses5" select="'n'"/>
|
||||||
|
|
||||||
|
@ -615,6 +619,12 @@ unset OLD_PKGDIR
|
||||||
<xsl:when test="contains(string(.),'<lfs>')">
|
<xsl:when test="contains(string(.),'<lfs>')">
|
||||||
<xsl:value-of select="$hostname"/>
|
<xsl:value-of select="$hostname"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
<xsl:when test="contains(string(.),'$(nproc || echo 1)')">
|
||||||
|
<xsl:value-of select="$jobs_1"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="contains(string(.),'$(nproc)')">
|
||||||
|
<xsl:value-of select="$jobs_2"/>
|
||||||
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:text>**EDITME</xsl:text>
|
<xsl:text>**EDITME</xsl:text>
|
||||||
<xsl:apply-templates/>
|
<xsl:apply-templates/>
|
||||||
|
@ -1080,6 +1090,14 @@ LOGLEVEL="</xsl:text>
|
||||||
<xsl:param name="instructions" select="''"/>
|
<xsl:param name="instructions" select="''"/>
|
||||||
<xsl:param name="eof-seen" select="false()"/>
|
<xsl:param name="eof-seen" select="false()"/>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
|
<xsl:when test="contains($instructions, '$(nproc)')">
|
||||||
|
<xsl:call-template name="comment-test">
|
||||||
|
<xsl:with-param
|
||||||
|
name="instructions"
|
||||||
|
select="concat(substring-before($instructions, '$(nproc)'), $jobs_2, substring-after($instructions, '$(nproc)'))"/>
|
||||||
|
<xsl:with-param name="eof-seen" select="$eof-seen"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:when>
|
||||||
<xsl:when test="contains($instructions,'
')">
|
<xsl:when test="contains($instructions,'
')">
|
||||||
<xsl:call-template name="comment-test">
|
<xsl:call-template name="comment-test">
|
||||||
<xsl:with-param name="instructions"
|
<xsl:with-param name="instructions"
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
extension-element-prefixes="exsl"
|
extension-element-prefixes="exsl"
|
||||||
version="1.0">
|
version="1.0">
|
||||||
|
|
||||||
|
<xsl:param name="jobs_2" select="1"/>
|
||||||
|
|
||||||
<xsl:template match="/">
|
<xsl:template match="/">
|
||||||
<xsl:apply-templates select="//sect1"/>
|
<xsl:apply-templates select="//sect1"/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
@ -55,6 +57,13 @@
|
||||||
<xsl:template name="extract-chroot">
|
<xsl:template name="extract-chroot">
|
||||||
<xsl:param name="instructions" select="''"/>
|
<xsl:param name="instructions" select="''"/>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
|
<xsl:when test="contains($instructions, '$(nproc || echo 1)')">
|
||||||
|
<xsl:call-template name="extract-chroot">
|
||||||
|
<xsl:with-param
|
||||||
|
name="instructions"
|
||||||
|
select="concat(substring-before($instructions, '$(nproc || echo 1)'), $jobs_2, substring-after($instructions, '$(nproc || echo 1)'))"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:when>
|
||||||
<xsl:when test="not(starts-with($instructions,'
chroot')) and
|
<xsl:when test="not(starts-with($instructions,'
chroot')) and
|
||||||
contains($instructions, '
chroot')">
|
contains($instructions, '
chroot')">
|
||||||
<xsl:call-template name="extract-chroot">
|
<xsl:call-template name="extract-chroot">
|
||||||
|
|
|
@ -63,6 +63,13 @@ extract_commands() { #
|
||||||
fi
|
fi
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|
||||||
|
JOBS_1=1
|
||||||
|
JOBS_2=1
|
||||||
|
case "$OPTIMIZE" in
|
||||||
|
"1") JOBS_2="$N_PARALLEL";;
|
||||||
|
"2") JOBS_1="$N_PARALLEL"; JOBS_2="$N_PARALLEL";;
|
||||||
|
esac
|
||||||
|
|
||||||
# First profile the book, for revision and arch. Note that
|
# First profile the book, for revision and arch. Note that
|
||||||
# MULTIBLIB is set to "default" if pure 64 bit book. In this case,
|
# MULTIBLIB is set to "default" if pure 64 bit book. In this case,
|
||||||
# profiling on arch is useless, but does not hurt either.
|
# profiling on arch is useless, but does not hurt either.
|
||||||
|
@ -102,6 +109,8 @@ extract_commands() { #
|
||||||
--stringparam local "$LOCAL" \
|
--stringparam local "$LOCAL" \
|
||||||
--stringparam log-level "$LOG_LEVEL" \
|
--stringparam log-level "$LOG_LEVEL" \
|
||||||
--stringparam script-root "$SCRIPT_ROOT" \
|
--stringparam script-root "$SCRIPT_ROOT" \
|
||||||
|
--stringparam jobs_1 "$JOBS_1" \
|
||||||
|
--stringparam jobs_2 "$JOBS_2" \
|
||||||
--output "./${COMMANDS}/" \
|
--output "./${COMMANDS}/" \
|
||||||
$XSL \
|
$XSL \
|
||||||
prbook.xml >> $LOGDIR/$LOG 2>&1
|
prbook.xml >> $LOGDIR/$LOG 2>&1
|
||||||
|
@ -141,7 +150,8 @@ create_chroot_scripts() { #
|
||||||
if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
|
if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
|
||||||
echo -n "... "
|
echo -n "... "
|
||||||
xsltproc --nonet --xinclude \
|
xsltproc --nonet --xinclude \
|
||||||
-o chroot-scripts/ chroot.xsl \
|
--stringparam jobs_2 "$JOBS_2" \
|
||||||
|
-o chroot-scripts/ chroot.xsl \
|
||||||
$BOOK/chapter0?/*chroot*.xml >> $LOGDIR/$LOG 2>&1
|
$BOOK/chapter0?/*chroot*.xml >> $LOGDIR/$LOG 2>&1
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
|
|
Reference in a new issue