diff --git a/build-community.sh b/build-community.sh index 77436538bbbd4027e2c4175b833b9600bb48d6fb..b2b73b5abd901da2aeef9b4cbb05e43af5a6dea6 100755 --- a/build-community.sh +++ b/build-community.sh @@ -20,6 +20,10 @@ repo_log="$LOGS_DIR/repo-$(date +%Y%m%d).log" +# Determine the number of parallel jobs to use for repo sync +nproc_value=$(nproc --all) +JOBS=$(( nproc_value > 10 ? 10 : nproc_value )) + # cd to working directory cd "$SRC_DIR" @@ -66,7 +70,7 @@ if [ "$LOCAL_MIRROR" = true ]; then fi echo ">> [$(date)] Syncing mirror repository" | tee -a "$repo_log" - repo sync -j$(nproc --all) --force-sync --no-clone-bundle &>>"$repo_log" + repo sync -j"$JOBS" --force-sync --no-clone-bundle &>>"$repo_log" if [ $? != 0 ]; then sync_successful=false @@ -160,7 +164,7 @@ for branch in ${BRANCH_NAME//,/ }; do echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log" builddate=$(date +%Y%m%d) - repo sync -c -j$(nproc --all) --force-sync &>>"$repo_log" + repo sync -c -j"$JOBS" --force-sync &>>"$repo_log" if [ $? != 0 ]; then sync_successful=false @@ -245,7 +249,7 @@ for branch in ${BRANCH_NAME//,/ }; do if [ "$LOCAL_MIRROR" = true ]; then echo ">> [$(date)] Syncing mirror repository" | tee -a "$repo_log" cd "$MIRROR_DIR" - repo sync -j$(nproc --all) --force-sync --no-clone-bundle &>>"$repo_log" + repo sync -j"$JOBS" --force-sync --no-clone-bundle &>>"$repo_log" if [ $? != 0 ]; then sync_successful=false