All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] kconfig: Add "m or y" and "y or m" answers for oldconfig
@ 2018-07-12 12:50 Ville Syrjala
  2018-07-25  0:28 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Ville Syrjala @ 2018-07-12 12:50 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel, Ville Syrjälä

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Make it possible to answer "m or y" or "y or m" to
oldconfig so that scripted kernel builds can easily
enable new features not present in the existing .config.

The particular use case I have in mind is continuous integration
where you probably want to test build any new features. Currently
you would have to either blindly try both 'y' and 'm' answers
or parse the output to know which one will be accepted.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 scripts/kconfig/conf.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 671ff5364497..8038f9a6b9f4 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -201,15 +201,33 @@ static int conf_sym(struct menu *menu)
 			continue;
 		case 'm':
 		case 'M':
-			newval = mod;
-			if (!line[1])
+			if (!strcmp(line, "m or y") ||
+			    !strcmp(line, "M or Y")) {
+				if (sym_tristate_within_range(sym, mod))
+					newval = mod;
+				else
+					newval = yes;
 				break;
+			} else {
+				newval = mod;
+				if (!line[1])
+					break;
+			}
 			continue;
 		case 'y':
 		case 'Y':
-			newval = yes;
-			if (!line[1] || !strcmp(&line[1], "es"))
+			if (!strcmp(line, "y or m") ||
+			    !strcmp(line, "Y or M")) {
+				if (sym_tristate_within_range(sym, yes))
+					newval = yes;
+				else
+					newval = mod;
 				break;
+			} else {
+				newval = yes;
+				if (!line[1] || !strcmp(&line[1], "es"))
+					break;
+			}
 			continue;
 		case 0:
 			newval = oldval;
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC][PATCH] kconfig: Add "m or y" and "y or m" answers for oldconfig
  2018-07-12 12:50 [RFC][PATCH] kconfig: Add "m or y" and "y or m" answers for oldconfig Ville Syrjala
@ 2018-07-25  0:28 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2018-07-25  0:28 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: Linux Kbuild mailing list, Linux Kernel Mailing List

2018-07-12 21:50 GMT+09:00 Ville Syrjala <ville.syrjala@linux.intel.com>:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Make it possible to answer "m or y" or "y or m" to
> oldconfig so that scripted kernel builds can easily
> enable new features not present in the existing .config.
>
> The particular use case I have in mind is continuous integration
> where you probably want to test build any new features. Currently
> you would have to either blindly try both 'y' and 'm' answers
> or parse the output to know which one will be accepted.
>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: linux-kbuild@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  scripts/kconfig/conf.c | 26 ++++++++++++++++++++++----
>  1 file changed, 22 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
> index 671ff5364497..8038f9a6b9f4 100644
> --- a/scripts/kconfig/conf.c
> +++ b/scripts/kconfig/conf.c
> @@ -201,15 +201,33 @@ static int conf_sym(struct menu *menu)
>                         continue;
>                 case 'm':
>                 case 'M':
> -                       newval = mod;
> -                       if (!line[1])
> +                       if (!strcmp(line, "m or y") ||
> +                           !strcmp(line, "M or Y")) {
> +                               if (sym_tristate_within_range(sym, mod))
> +                                       newval = mod;
> +                               else
> +                                       newval = yes;
>                                 break;
> +                       } else {
> +                               newval = mod;
> +                               if (!line[1])
> +                                       break;
> +                       }
>                         continue;
>                 case 'y':
>                 case 'Y':
> -                       newval = yes;
> -                       if (!line[1] || !strcmp(&line[1], "es"))
> +                       if (!strcmp(line, "y or m") ||
> +                           !strcmp(line, "Y or M")) {
> +                               if (sym_tristate_within_range(sym, yes))
> +                                       newval = yes;
> +                               else
> +                                       newval = mod;
>                                 break;
> +                       } else {
> +                               newval = yes;
> +                               if (!line[1] || !strcmp(&line[1], "es"))
> +                                       break;
> +                       }
>                         continue;
>                 case 0:
>                         newval = oldval;




Hmm.

Instead of hard-coding specific patterns,
can you implement this in a more generic way?


For example, how about this?

Use '/' as a delimiter
so that user input will be "m/y", "y/m", "m/n", etc.

Split the input string into tokens by strtok() or something.
Iterate over the tokens until sym_set_tristate_value() succeeds.


Thanks.




> --
> 2.16.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-25  0:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12 12:50 [RFC][PATCH] kconfig: Add "m or y" and "y or m" answers for oldconfig Ville Syrjala
2018-07-25  0:28 ` Masahiro Yamada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.