kconfig: make syncconfig update .config regardless of sym_change_count
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 20 Jul 2018 07:46:30 +0000 (16:46 +0900)
committerChristian Lamparter <chunkeey@gmail.com>
Sun, 10 Feb 2019 21:21:59 +0000 (22:21 +0100)
syncconfig updates the .config only when sym_change_count > 0, i.e.
any change in config symbols has been detected.

Not only symbols but also comments are contained in the .config file.
If only comments are updated, they are not fed back to the .config,
then the stale comments are left-over.  Of course, this is just a
matter of comments, but why not fix it.

I see some scenarios where this happens.

Scenario A:

 1. You have a source tree that has already been configured.

 2. Linus increments the version number in the top-level Makefile
    (i.e. he commits a new release)

 3. You pull it, and run 'make'

 4. syncconfig is invoked because the environment variable,
    KERNELVERSION is updated, but the .config is not updated since
    no config symbol is changed.

 5. The .config file contains a kernel version in the top line:

    # Automatically generated file; DO NOT EDIT.
    # Linux/arm64 4.18.0-rc2 Kernel Configuration

    ... which points to a previous version.

Scenario B:

 1. You have a source tree that has already been configured.

 2. You upgrade the compiler, but it still has the same version number.
    This may happen if you regularly build the latest compiler from
    the source code.

 3. You run 'make'

 4. syncconfig is invoked because the environment variable,
    CC_VERSION_TEXT is updated, but the .config is not updated since
    no config symbol is changed.

 5. The .config file contains the version string of the compiler:

    #
    # Compiler: aarch64-linux-gcc (GCC) 9.0.0 20180628 (experimental)
    #

    ... which carries the information of the old compiler.

If KCONFIG_NOSILENTUPDATE is set, syncconfig is not allowed to update
the .config file.  Otherwise, it is fine to update it regardless of
sym_change_count.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
config/conf.c

index 130335f371ec1c2ffc61404c8fd2d6812ae9a88b..2f968e25b3c0c8bf40972ccd324815c6cc5d4391 100644 (file)
@@ -483,6 +483,7 @@ int main(int ac, char **av)
        int opt;
        const char *name, *defconfig_file = NULL /* gcc uninit */;
        struct stat tmpstat;
        int opt;
        const char *name, *defconfig_file = NULL /* gcc uninit */;
        struct stat tmpstat;
+       int no_conf_write = 0;
 
        tty_stdio = isatty(0) && isatty(1);
 
 
        tty_stdio = isatty(0) && isatty(1);
 
@@ -651,7 +652,7 @@ int main(int ac, char **av)
                /*
                 * build so we shall update autoconf.
                 */
                /*
                 * build so we shall update autoconf.
                 */
-               if (conf_write(NULL)) {
+               if (!no_conf_write && conf_write(NULL)) {
                        fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
                        exit(1);
                }
                        fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
                        exit(1);
                }