public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Bolle <pebolle@tiscali.nl>
To: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org
Subject: Re: [PATCH 2/2] kconfig: Do not print status messages in make -s mode
Date: Thu, 09 Apr 2015 14:47:56 +0200	[thread overview]
Message-ID: <1428583676.14000.50.camel@x220> (raw)
In-Reply-To: <1428493376-20197-2-git-send-email-mmarek@suse.cz>

On Wed, 2015-04-08 at 13:42 +0200, Michal Marek wrote:
> Add an -s option to the conf, mconf, qconf and gconf frontends and pass
> it when make -s is used.

Basically this suppresses everything except warning and errors,
correct? 

I don't actually use nconf. Is it already silent?

>  Also, use $(kecho) instead of @echo in the
> Makefile.

(I had to look up $(kecho). I found:
    ###
    # Easy method for doing a status message
           kecho := :
     quiet_kecho := echo
    silent_kecho := :
    kecho := $($(quiet)kecho)

I'm not fluent in Makefilese. What does it provide beyond @echo?)

> --- a/scripts/kconfig/conf.c
> +++ b/scripts/kconfig/conf.c
> @@ -471,7 +471,7 @@ static struct option long_opts[] = {
>  static void conf_usage(const char *progname)
>  {
>  
> -	printf("Usage: %s [option] <kconfig-file>\n", progname);
> +	printf("Usage: %s [-s] [option] <kconfig-file>\n", progname);
>  	printf("[option] is _one_ of the following:\n");
>  	printf("  --listnewconfig         List new options\n");
>  	printf("  --oldaskconfig          Start a new configuration using a line-oriented program\n");
> @@ -501,7 +501,11 @@ int main(int ac, char **av)
>  
>  	tty_stdio = isatty(0) && isatty(1) && isatty(2);
>  
> -	while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
> +	while ((opt = getopt_long(ac, av, "s", long_opts, NULL)) != -1) {
> +		if (opt == 's') {
> +			conf_set_message_callback(NULL);
> +			continue;
> +		}
>  		input_mode = (enum input_mode)opt;
>  		switch (opt) {
>  		case silentoldconfig:
> diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
> index 344b9e3..26d208b 100644
> --- a/scripts/kconfig/gconf.c
> +++ b/scripts/kconfig/gconf.c
> @@ -1474,9 +1474,12 @@ int main(int ac, char *av[])
>  		case 'a':
>  			//showAll = 1;
>  			break;
> +		case 's':
> +			conf_set_message_callback(NULL);
> +			break;
>  		case 'h':
>  		case '?':
> -			printf("%s <config>\n", av[0]);
> +			printf("%s [-s] <config>\n", av[0]);
>  			exit(0);
>  		}
>  		name = av[2];
> diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
> index 4dd3755..01070f0 100644
> --- a/scripts/kconfig/mconf.c
> +++ b/scripts/kconfig/mconf.c
> @@ -279,6 +279,7 @@ static int child_count;
>  static int single_menu_mode;
>  static int show_all_options;
>  static int save_and_exit;
> +static int silent;
>  
>  static void conf(struct menu *menu, struct menu *active_menu);
>  static void conf_choice(struct menu *menu);
> @@ -777,10 +778,12 @@ static void conf_message_callback(const char *fmt, va_list ap)
>  	char buf[PATH_MAX+1];
>  
>  	vsnprintf(buf, sizeof(buf), fmt, ap);
> -	if (save_and_exit)
> -		printf("%s", buf);
> -	else
> +	if (save_and_exit) {
> +		if (!silent)
> +			printf("%s", buf);
> +	} else {
>  		show_textbox(NULL, buf, 6, 60);
> +	}
>  }
>  
>  static void show_help(struct menu *menu)

The patch adds this :
    conf_set_message_callback(NULL);

for conf, gconf, and qconf. That won't work for mconf?

> @@ -977,16 +980,18 @@ static int handle_exit(void)
>  		}
>  		/* fall through */
>  	case -1:
> -		printf(_("\n\n"
> -			 "*** End of the configuration.\n"
> -			 "*** Execute 'make' to start the build or try 'make help'."
> -			 "\n\n"));
> +		if (!silent)
> +			printf(_("\n\n"
> +				 "*** End of the configuration.\n"
> +				 "*** Execute 'make' to start the build or try 'make help'."
> +				 "\n\n"));
>  		res = 0;
>  		break;
>  	default:
> -		fprintf(stderr, _("\n\n"
> -				  "Your configuration changes were NOT saved."
> -				  "\n\n"));
> +		if (!silent)
> +			fprintf(stderr, _("\n\n"
> +					  "Your configuration changes were NOT saved."
> +					  "\n\n"));
>  		if (res != KEY_ESC)
>  			res = 0;
>  	}
> @@ -1010,6 +1015,10 @@ int main(int ac, char **av)
>  
>  	signal(SIGINT, sig_handler);
>  
> +	if (ac > 1 && strcmp(av[1], "-s") == 0) {
> +		silent = 1;
> +		av++;
> +	}
>  	conf_parse(av[1]);
>  	conf_read(NULL);
>  
> diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
> index 9d3b04b..c3bb7fe 100644
> --- a/scripts/kconfig/qconf.cc
> +++ b/scripts/kconfig/qconf.cc
> @@ -1746,7 +1746,7 @@ static const char *progname;
>  
>  static void usage(void)
>  {
> -	printf(_("%s <config>\n"), progname);
> +	printf(_("%s [-s] <config>\n"), progname);
>  	exit(0);
>  }
>  
> @@ -1762,6 +1762,9 @@ int main(int ac, char** av)
>  	configApp = new QApplication(ac, av);
>  	if (ac > 1 && av[1][0] == '-') {
>  		switch (av[1][1]) {
> +		case 's':
> +			conf_set_message_callback(NULL);
> +			break;
>  		case 'h':
>  		case '?':
>  			usage();


Paul Bolle


  reply	other threads:[~2015-04-09 12:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08 11:42 [PATCH 1/2] kconfig: Simplify Makefile Michal Marek
2015-04-08 11:42 ` [PATCH 2/2] kconfig: Do not print status messages in make -s mode Michal Marek
2015-04-09 12:47   ` Paul Bolle [this message]
2015-04-09 12:58     ` Michal Marek
2015-04-09 14:58       ` Paul Bolle
2015-04-09 15:46         ` Michal Marek
2015-04-09  1:43 ` [PATCH 1/2] kconfig: Simplify Makefile Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1428583676.14000.50.camel@x220 \
    --to=pebolle@tiscali.nl \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox