summaryrefslogtreecommitdiffstats
path: root/process_configs.sh
diff options
context:
space:
mode:
authorJustin M. Forbes <jforbes@fedoraproject.org>2022-03-04 12:55:47 -0600
committerJustin M. Forbes <jforbes@fedoraproject.org>2022-03-04 12:55:47 -0600
commit9f1c3bb900eb4e4bac059cea50a2780deba79ed5 (patch)
tree78da41c8fd3154ee94998e8189b651acad9029dc /process_configs.sh
parente06dc60dd077479b5bdc49033b48f713253557a9 (diff)
downloadkernel-9f1c3bb900eb4e4bac059cea50a2780deba79ed5.tar.gz
kernel-9f1c3bb900eb4e4bac059cea50a2780deba79ed5.tar.xz
kernel-9f1c3bb900eb4e4bac059cea50a2780deba79ed5.zip
kernel-5.17-0.rc6.38f80f42147f.113
* Fri Mar 04 2022 Fedora Kernel Team <kernel-team@fedoraproject.org> [5.17-0.rc6.38f80f42147f.113] - redhat/configs/build_configs.sh: Parallelize execution (Prarit Bhargava) - redhat/configs/build_configs.sh: Provide better messages (Prarit Bhargava) - redhat/configs/build_configs.sh: Create unique output files (Prarit Bhargava) - redhat/configs/build_configs.sh: Add local variables (Prarit Bhargava) - redhat/configs/process_configs.sh: Parallelize execution (Prarit Bhargava) - redhat/configs/process_configs.sh: Provide better messages (Prarit Bhargava) - redhat/configs/process_configs.sh: Create unique output files (Prarit Bhargava) - redhat/configs/process_configs.sh: Add processing config function (Prarit Bhargava) - mm/sparsemem: Fix 'mem_section' will never be NULL gcc 12 warning (Waiman Long) Resolves: rhbz# Signed-off-by: Justin M. Forbes <jforbes@fedoraproject.org>
Diffstat (limited to 'process_configs.sh')
-rwxr-xr-xprocess_configs.sh160
1 files changed, 100 insertions, 60 deletions
diff --git a/process_configs.sh b/process_configs.sh
index 312449fe1..b620040cc 100755
--- a/process_configs.sh
+++ b/process_configs.sh
@@ -60,6 +60,9 @@ switch_to_toplevel()
checkoptions()
{
+ count=$3
+ variant=$4
+
/usr/bin/awk '
/is not set/ {
@@ -82,10 +85,10 @@ checkoptions()
print "Found "a[1]"="a[2]" after generation, had " a[1]"="configs[a[1]]" in Source tree";
}
}
- ' "$1" "$2" > .mismatches
+ ' "$1" "$2" > .mismatches${count}
checkoptions_error=false
- if test -s .mismatches
+ if test -s .mismatches${count}
then
while read -r LINE
do
@@ -97,14 +100,14 @@ checkoptions()
checkoptions_error=true
break
fi
- done < .mismatches
+ done < .mismatches${count}
! $checkoptions_error && return
- echo "Error: Mismatches found in configuration files"
- cat .mismatches
- RETURNCODE=1
+ sed -i "1s/^/Error: Mismatches found in configuration files for ${variant}\n/" .mismatches${count}
[ "$CONTINUEONERROR" ] || exit 1
+ else
+ rm -f .mismatches${count}
fi
}
@@ -218,73 +221,109 @@ function commit_new_configs()
git commit -m "[redhat] AUTOMATIC: New configs"
}
-function process_configs()
+function process_config()
{
- # assume we are in $source_tree/configs, need to get to top level
- pushd "$(switch_to_toplevel)" &>/dev/null
+ local cfg
+ local arch
+ local cfgtmp
+ local cfgorig
+ local count
+ local variant
- for cfg in "$SCRIPT_DIR/${PACKAGE_NAME}${KVERREL}${SUBARCH}"*.config
- do
- arch=$(head -1 "$cfg" | cut -b 3-)
+ cfg=$1
+ count=$2
- if [ "$arch" = "EMPTY" ]
- then
- # This arch is intentionally left blank
- continue
- fi
+ arch=$(head -1 "$cfg" | cut -b 3-)
- cfgtmp="${cfg}.tmp"
- cfgorig="${cfg}.orig"
- cat "$cfg" > "$cfgorig"
+ if [ "$arch" = "EMPTY" ]
+ then
+ # This arch is intentionally left blank
+ return
+ fi
- echo -n "Processing $cfg ... "
+ variant=$(basename "$cfg" | cut -d"-" -f3- | cut -d"." -f1)
- make ${MAKEOPTS} ARCH="$arch" CROSS_COMPILE=$(get_cross_compile $arch) KCONFIG_CONFIG="$cfgorig" listnewconfig >& .listnewconfig
- grep -E 'CONFIG_' .listnewconfig > .newoptions
- if test -n "$NEWOPTIONS" && test -s .newoptions
- then
- echo "Found unset config items, please set them to an appropriate value"
- cat .newoptions
- rm .newoptions
- RETURNCODE=1
- [ "$CONTINUEONERROR" ] || exit 1
- fi
- rm .newoptions
+ cfgtmp="${cfg}.tmp"
+ cfgorig="${cfg}.orig"
+ cat "$cfg" > "$cfgorig"
- grep -E 'config.*warning' .listnewconfig > .warnings
- if test -n "$CHECKWARNINGS" && test -s .warnings
- then
- echo "Found misconfigured config items, please set them to an appropriate value"
- cat .warnings
- rm .warnings
- RETURNCODE=1
- [ "$CONTINUEONERROR" ] || exit 1
- fi
- rm .warnings
+ echo "Processing $cfg ... "
- rm .listnewconfig
+ make ${MAKEOPTS} ARCH="$arch" CROSS_COMPILE=$(get_cross_compile $arch) KCONFIG_CONFIG="$cfgorig" listnewconfig >& .listnewconfig${count}
+ 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" >> .errors${count}
+ cat .newoptions${count} >> .errors${count}
+ rm .newoptions${count}
+ RETURNCODE=1
+ [ "$CONTINUEONERROR" ] || exit 1
+ fi
+ rm .newoptions${count}
- make ${MAKEOPTS} ARCH="$arch" CROSS_COMPILE=$(get_cross_compile $arch) KCONFIG_CONFIG="$cfgorig" olddefconfig > /dev/null || exit 1
- echo "# $arch" > "$cfgtmp"
- cat "$cfgorig" >> "$cfgtmp"
- if test -n "$CHECKOPTIONS"
- then
- checkoptions "$cfg" "$cfgtmp"
- fi
- # if test run, don't overwrite original
- if test -n "$TESTRUN"
- then
- rm -f "$cfgtmp"
- else
- mv "$cfgtmp" "$cfg"
- fi
- rm -f "$cfgorig"
- echo "done"
+ 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" >> .errors${count}
+ cat .warnings${count} >> .errors${count}
+ rm .warnings${count}
+ [ "$CONTINUEONERROR" ] || exit 1
+ fi
+ rm .warnings${count}
+
+ rm .listnewconfig${count}
+
+ make ${MAKEOPTS} ARCH="$arch" CROSS_COMPILE=$(get_cross_compile $arch) KCONFIG_CONFIG="$cfgorig" olddefconfig > /dev/null || exit 1
+ echo "# $arch" > "$cfgtmp"
+ cat "$cfgorig" >> "$cfgtmp"
+ if test -n "$CHECKOPTIONS"
+ then
+ checkoptions "$cfg" "$cfgtmp" "$count" "$variant"
+ fi
+ # if test run, don't overwrite original
+ if test -n "$TESTRUN"
+ then
+ rm -f "$cfgtmp"
+ else
+ mv "$cfgtmp" "$cfg"
+ fi
+ rm -f "$cfgorig"
+ echo "Processing $cfg complete"
+}
+
+function process_configs()
+{
+ # assume we are in $source_tree/configs, need to get to top level
+ pushd "$(switch_to_toplevel)" &>/dev/null
+
+ count=0
+ for cfg in "$SCRIPT_DIR/${PACKAGE_NAME}${KVERREL}${SUBARCH}"*.config
+ do
+ process_config "$cfg" "$count" &
+ waitpids[${count}]=$!
+ ((count++))
+ while [ "$(jobs | grep Running | wc -l)" -ge $RHJOBS ]; do :; done
+ 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=""
@@ -345,6 +384,7 @@ PACKAGE_NAME="${1:-kernel}" # defines the package name used
KVERREL="$(test -n "$2" && echo "-$2" || echo "")"
SUBARCH="$(test -n "$3" && echo "-$3" || echo "")"
FLAVOR="$(test -n "$4" && echo "-$4" || echo "-common")"
+RHJOBS="$(test -n "$5" && echo "$5" || nproc --all)"
SCRIPT=$(readlink -f "$0")
SCRIPT_DIR=$(dirname "$SCRIPT")