From: Prarit Bhargava <prarit(a)redhat.com>
redhat/configs/process_configs.sh: Parallelize execution
Parallelize the execution of each config processing.
The '+' adds job processing to 'non-make' commands [1].
[1]
https://www.gnu.org/software/make/manual/html_node/Error-Messages.html
Signed-off-by: Prarit Bhargava <prarit(a)redhat.com>
diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -121,11 +121,11 @@ dist-kabi-dw-check: dist-kabi
@rm -rf $(KABIDW)/base/$(CURARCH).tmp
dist-configs-commit: dist-configs-prep
- @cd $(REDHAT)/configs; VERSION=$(KVERSION) ./generate_all_configs.sh
"$(FLAVOR)" 1; \
+ +@cd $(REDHAT)/configs; VERSION=$(KVERSION) ./generate_all_configs.sh
"$(FLAVOR)" 1; \
./process_configs.sh -z $(PACKAGE_NAME) $(KVERSION) "" $(FLAVOR)
dist-configs: dist-configs-prep
- @cd $(REDHAT)/configs; VERSION=$(KVERSION) ./generate_all_configs.sh
"$(FLAVOR)" 1; \
+ +@cd $(REDHAT)/configs; VERSION=$(KVERSION) ./generate_all_configs.sh
"$(FLAVOR)" 1; \
./process_configs.sh $(PROCESS_CONFIGS_OPTS) $(PACKAGE_NAME) $(KVERSION)
dist-fedora-configs: FLAVOR = fedora
@@ -137,7 +137,7 @@ dist-rhel-configs: dist-configs
rh-configs: dist-rhel-configs
dist-configs-check: dist-configs-prep
- cd $(REDHAT)/configs; ./process_configs.sh $(PROCESS_CONFIGS_CHECK_OPTS)
$(PACKAGE_NAME)
+ +cd $(REDHAT)/configs; ./process_configs.sh $(PROCESS_CONFIGS_CHECK_OPTS)
$(PACKAGE_NAME)
dist-configs-prep: dist-clean-configs dist-buildreq-check
cd $(REDHAT)/configs; ./build_configs.sh "partial" "$(ARCH_MACH)"
"snip"
diff --git a/redhat/configs/process_configs.sh b/redhat/configs/process_configs.sh
index blahblah..blahblah 100755
--- a/redhat/configs/process_configs.sh
+++ b/redhat/configs/process_configs.sh
@@ -105,8 +105,6 @@ checkoptions()
! $checkoptions_error && return
sed -i "1s/^/Error: Mismatches found in configuration files for
${variant}\n/" .mismatches${count}
- cat .mismatches${count}
- RETURNCODE=1
[ "$CONTINUEONERROR" ] || exit 1
else
rm -f .mismatches${count}
@@ -255,8 +253,8 @@ function process_config()
grep -E 'CONFIG_' .listnewconfig${count} > .newoptions${count}
if test -n "$NEWOPTIONS" && test -s .newoptions${count}
then
- echo "Found unset config items in ${variant}, please set them to an appropriate
value"
- cat .newoptions${count}
+ echo "Found unset config items in ${variant}, please set them to an appropriate
value" >> .errors${count}
+ cat .newoptions${count} >> .errors${count}
rm .newoptions${count}
RETURNCODE=1
[ "$CONTINUEONERROR" ] || exit 1
@@ -266,10 +264,9 @@ function process_config()
grep -E 'config.*warning' .listnewconfig${count} > .warnings${count}
if test -n "$CHECKWARNINGS" && test -s .warnings${count}
then
- echo "Found misconfigured config items in ${variant}, please set them to an
appropriate value"
- cat .warnings${count}
+ echo "Found misconfigured config items in ${variant}, please set them to an
appropriate value" >> .errors${count}
+ cat .warnings${count} >> .errors${count}
rm .warnings${count}
- RETURNCODE=1
[ "$CONTINUEONERROR" ] || exit 1
fi
rm .warnings${count}
@@ -302,13 +299,30 @@ function process_configs()
count=0
for cfg in "$SCRIPT_DIR/${PACKAGE_NAME}${KVERREL}${SUBARCH}"*.config
do
- process_config "$cfg" "$count"
+ process_config "$cfg" "$count" &
+ waitpids[${count}]=$!
((count++))
done
+ for pid in ${waitpids[*]}; do
+ wait ${pid}
+ done
+
rm "$SCRIPT_DIR"/*.config*.old
+
+ if ls .errors* 1> /dev/null 2>&1; then
+ RETURNCODE=1
+ cat .errors*
+ rm .errors* -f
+ fi
+ if ls .mismatches* 1> /dev/null 2>&1; then
+ RETURNCODE=1
+ cat .mismatches*
+ rm .mismatches* -f
+ fi
+
popd > /dev/null
- echo "Processed config files are in $SCRIPT_DIR"
+ [ $RETURNCODE -eq 0 ] && echo "Processed config files are in
$SCRIPT_DIR"
}
CHECKOPTIONS=""
--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1635