From b2d84213dae4e199b4e4fa4f70dd6e3fbf5d90c4 Mon Sep 17 00:00:00 2001
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Date: Fri, 13 Oct 2023 11:16:41 +0300
Subject: update/project/trees: Add flags for more kconfig actions

Add an "-s" flag for "make savedefconfig", "-l" for "make olddefconfig"
and "-n" for "make nconfig" to the update script. The first two are
mainly useful for U-Boot, to compare our configs to the upstream
defconfigs and stay in sync with any upstream changes. The latter is
because the ncurses one has a nice "Symbol Search" that can point out
the menu entry for a config symbol we know.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
---
 script/update/project/trees | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

(limited to 'script/update/project')

diff --git a/script/update/project/trees b/script/update/project/trees
index 6a31d8d0..9e6803cf 100755
--- a/script/update/project/trees
+++ b/script/update/project/trees
@@ -1,6 +1,6 @@
 #!/usr/bin/env sh
 # SPDX-License-Identifier: GPL-3.0-or-later
-# SPDX-FileCopyrightText: 2022 Alper Nebi Yasak <alpernebiyasak@gmail.com>
+# SPDX-FileCopyrightText: 2022-2023 Alper Nebi Yasak <alpernebiyasak@gmail.com>
 # SPDX-FileCopyrightText: 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
 # SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org>
 
@@ -21,7 +21,7 @@ tmpclean="$(mktemp -d -t makeclean.XXXXXXXXXX)"
 
 main()
 {
-	while getopts f:b:m:u:c:x: option
+	while getopts f:b:m:u:c:x:s:l:n: option
 	do
 		_f="${1}"
 		case "${1}" in
@@ -31,11 +31,14 @@ main()
 		-c) mode="distclean" ;;
 		-x) mode="crossgcc-clean" ;;
 		-f) mode="fetch" ;;
+		-s) mode="savedefconfig" ;;
+		-l) mode="olddefconfig" ;;
+		-n) mode="nconfig" ;;
 		*) err "Invalid option" ;;
 		esac
 		shift; project="${OPTARG#src/}"; shift
 	done
-	[ -z "${_f}" ] && err "flag not specified (-m, -u, -b, -c or -x)"
+	[ -z "${_f}" ] && err "flag not specified (-m, -u, -b, -c, -x, -f, -s, -l or -n)"
 	[ -z "${project}" ] && err "project name not specified"
 
 	if [ ! -f "config/${project}/build.list" ]; then
@@ -263,8 +266,11 @@ handle_makefile()
 	if [ -e "${codedir}/.git" ] && [ "${project}" = "u-boot" ] && \
 	    [ "${mode}" = "distclean" ]; then
 		x_ git -C "${codedir}" clean -fdx
-	elif [ "${mode}" = "oldconfig" ] || [ "${mode}" = "menuconfig" ]; then
+	elif [ "${mode}" = "oldconfig" ] || [ "${mode}" = "olddefconfig" ] || \
+	    [ "${mode}" = "menuconfig" ] || [ "${mode}" = "nconfig" ]; then
 		x_ cp "${codedir}/.config" "${config}"
+	elif [ "${mode}" = "savedefconfig" ]; then
+		x_ cp "${codedir}/defconfig" "${config}"
 	fi
 }
 
-- 
cgit v1.2.1