From 3c43655ec646c94ab3da44b72e856bc890468f25 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Wed, 15 Nov 2023 18:10:07 +0100 Subject: [PATCH] Only replace $(nproc) in scriptlets There is no more $(nproc || echo 1). Note that we may replace it with $(nproc) if using all cores, so don't replace it in the comment-test template (otherwise we have infinite recursion). --- LFS/lfs.xsl | 16 ++-------------- common/libs/func_book_parser | 14 ++++++-------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/LFS/lfs.xsl b/LFS/lfs.xsl index 3b575ec..49fbdf2 100644 --- a/LFS/lfs.xsl +++ b/LFS/lfs.xsl @@ -29,8 +29,7 @@ - - + @@ -621,11 +620,8 @@ unset OLD_PKGDIR - - - - + **EDITME @@ -1092,14 +1088,6 @@ LOGLEVEL=" - - - - - - /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 + if [ "$ALL_CORES" = "y" ]; then + JOBS="\$(nproc)" + else + JOBS="$N_PARALLEL" + fi # First profile the book, for revision and arch. Note that # MULTIBLIB is set to "default" if pure 64 bit book. In this case, # profiling on arch is useless, but does not hurt either. @@ -109,8 +108,7 @@ extract_commands() { # --stringparam local "$LOCAL" \ --stringparam log-level "$LOG_LEVEL" \ --stringparam script-root "$SCRIPT_ROOT" \ - --stringparam jobs_1 "$JOBS_1" \ - --stringparam jobs_2 "$JOBS_2" \ + --stringparam jobs "$JOBS" \ --output "./${COMMANDS}/" \ $XSL \ prbook.xml >> $LOGDIR/$LOG 2>&1