[OS-BUILD PATCHv3 1/8] redhat/configs/process_configs.sh: Add processing config function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

redhat/configs/process_configs.sh: Add processing config function

Move the code to process a config into its own function.  This will make
future changes easier.

Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>

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
@@ -218,68 +218,79 @@ 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
 
-	for cfg in "$SCRIPT_DIR/${PACKAGE_NAME}${KVERREL}${SUBARCH}"*.config
-	do
-		arch=$(head -1 "$cfg" | cut -b 3-)
+	cfg=$1
+	arch=$(head -1 "$cfg" | cut -b 3-)
 
-		if [ "$arch" = "EMPTY" ]
-		then
-			# This arch is intentionally left blank
-			continue
-		fi
+	if [ "$arch" = "EMPTY" ]
+	then
+		# This arch is intentionally left blank
+		return
+	fi
 
-		cfgtmp="${cfg}.tmp"
-		cfgorig="${cfg}.orig"
-		cat "$cfg" > "$cfgorig"
+	cfgtmp="${cfg}.tmp"
+	cfgorig="${cfg}.orig"
+	cat "$cfg" > "$cfgorig"
 
-		echo -n "Processing $cfg ... "
+	echo -n "Processing $cfg ... "
 
-		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
+	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
 
-		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
+	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
 
-		rm .listnewconfig
+	rm .listnewconfig
 
-		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"
+	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"
+}
+
+function process_configs()
+{
+	# assume we are in $source_tree/configs, need to get to top level
+	pushd "$(switch_to_toplevel)" &>/dev/null
+
+	for cfg in "$SCRIPT_DIR/${PACKAGE_NAME}${KVERREL}${SUBARCH}"*.config
+	do
+		process_config "$cfg"
 	done
 	rm "$SCRIPT_DIR"/*.config*.old
 	popd > /dev/null

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1635
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux