All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Hershberger <joe.hershberger@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 01/10] moveconfig: Always run savedefconfig on the moved config
Date: Tue, 19 May 2015 10:35:24 -0500	[thread overview]
Message-ID: <CANr=Z=Zxcei9HA0OYE5_c_X=T6eu4+Znj-0onBSp_f4Bunp+Gw@mail.gmail.com> (raw)
In-Reply-To: <CAK7LNATegaKQVKXs2E1Yz5+rhqUx9EX6DJ1rLv8ECshwE63Y8g@mail.gmail.com>

Hi Masahiro-san,

On Mon, May 18, 2015 at 8:58 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> Hi Joe,
>
> 2015-05-16 6:40 GMT+09:00 Joe Hershberger <joe.hershberger@ni.com>:
>> This will ensure that the order of the defconfig entries will always
>> match that of the Kconfig files. After one slightly painful (but
>> still early in the process) pass over all boards, this should keep
>> the defconfigs clean from here on.
>>
>> Users must edit the Kconfig first to add the menu entries and then run
>> moveconfig.py to update the defconfig files and the include configs.
>>
>> As such, moveconfig.py cannot compare against the '.config' contents.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>
>
> This feature expects the defconfigs are all clean.
> Otherwise, savedefconfig would make "git diff" noisier.
>
> It is safer to use "make menuconfig && make savedefconfig"
> for adding new options, but some people still try to
> edit the defconfig directly...
>
> Perhaps, should do the global cleanup periodically?
>
>
>> ---
>> This is based on https://patchwork.ozlabs.org/patch/472591/
>>
>> Changes in v4:
>> -Rebased series on Masahiro's v2
>>
>> Changes in v3: None
>> Changes in v2: None
>>
>>  tools/moveconfig.py | 35 ++++++++++++++++++++++++++---------
>>  1 file changed, 26 insertions(+), 9 deletions(-)
>>
>> diff --git a/tools/moveconfig.py b/tools/moveconfig.py
>> index c39ea95..544f6af 100755
>> --- a/tools/moveconfig.py
>> +++ b/tools/moveconfig.py
>> @@ -46,6 +46,9 @@ should look like this:
>>    CONFIG_CMD_USB bool n
>>    CONFIG_SYS_TEXT_BASE hex 0x00000000
>>
>> +Next you must edit the Kconfig to add the menu entries for the configs
>> +you are moving.
>> +
>>  And then run this tool giving the file name of the recipe
>
> Uh, I was doing in a different work-flow.
> (I edit the Kconfig after I move CONFIGs to defconfigs).
>
> But, the Kconfig must be edited beforehand
> to do savedefconfig.
>
> So, I am OK with this change.
>
>
>
>>    $ tools/moveconfig.py recipe
>> @@ -192,6 +195,7 @@ CROSS_COMPILE = {
>>  STATE_IDLE = 0
>>  STATE_DEFCONFIG = 1
>>  STATE_AUTOCONF = 2
>> +STATE_SAVEDEFCONFIG = 3
>>
>>  ACTION_MOVE = 0
>>  ACTION_DEFAULT_VALUE = 1
>> @@ -390,8 +394,7 @@ class KconfigParser:
>>
>>          return CROSS_COMPILE.get(arch, '')
>>
>> -    def parse_one_config(self, config_attr, defconfig_lines,
>> -                         dotconfig_lines, autoconf_lines):
>> +    def parse_one_config(self, config_attr, defconfig_lines, autoconf_lines):
>>          """Parse .config, defconfig, include/autoconf.mk for one config.
>>
>>          This function looks for the config options in the lines from
>> @@ -402,7 +405,6 @@ class KconfigParser:
>>            config_attr: A dictionary including the name, the type,
>>                         and the default value of the target config.
>>            defconfig_lines: lines from the original defconfig file.
>> -          dotconfig_lines: lines from the .config file.
>>            autoconf_lines: lines from the include/autoconf.mk file.
>>
>>          Returns:
>> @@ -418,7 +420,7 @@ class KconfigParser:
>>          else:
>>              default = config + '=' + config_attr['default']
>>
>> -        for line in defconfig_lines + dotconfig_lines:
>> +        for line in defconfig_lines:
>>              line = line.rstrip()
>>              if line.startswith(config + '=') or line == not_set:
>>                  return (ACTION_ALREADY_EXIST, line)
>> @@ -463,15 +465,12 @@ class KconfigParser:
>>          with open(defconfig_path) as f:
>>              defconfig_lines = f.readlines()
>>
>> -        with open(dotconfig_path) as f:
>> -            dotconfig_lines = f.readlines()
>> -
>>          with open(autoconf_path) as f:
>>              autoconf_lines = f.readlines()
>>
>>          for config_attr in self.config_attrs:
>>              result = self.parse_one_config(config_attr, defconfig_lines,
>> -                                           dotconfig_lines, autoconf_lines)
>> +                                           autoconf_lines)
>>              results.append(result)
>>
>>          log = ''
>
>
> With the change of the work-flow above,
> we need not parse the .config, so this seems OK.
>
>
>
>> @@ -499,7 +498,7 @@ class KconfigParser:
>>          print log,
>>
>>          if not self.options.dry_run:
>> -            with open(defconfig_path, 'a') as f:
>> +            with open(dotconfig_path, 'a') as f:
>>                  for (action, value) in results:
>>                      if action == ACTION_MOVE:
>>                          f.write(value + '\n')
>> @@ -608,6 +607,24 @@ class Slot:
>>
>>          if self.state == STATE_AUTOCONF:
>>              self.parser.update_defconfig(self.defconfig)
>> +
>> +            """Save off the defconfig in a consistent way"""
>> +            cmd = list(self.make_cmd)
>> +            cmd.append('savedefconfig')
>> +            self.ps = subprocess.Popen(cmd, stdout=self.devnull,
>> +                                       stderr=self.devnull)
>> +            self.state = STATE_SAVEDEFCONFIG
>> +            return False
>> +
>> +        if self.state == STATE_SAVEDEFCONFIG:
>> +            defconfig_path = os.path.join(self.build_dir, 'defconfig')
>> +            if not os.path.exists(defconfig_path):
>> +                print >> sys.stderr, log_msg(self.options.color,
>> +                                             COLOR_LIGHT_RED,
>> +                                             self.defconfig,
>> +                                             'The defconfig was not updated')
>
> Is this warning message reachable?
>
> The missing defconfig means "make savedefconfig" failed.
>
> That case has been already caught by 'Failed to process.' above, I think.

OK... dropping that warning.

>> +            shutil.move(defconfig_path,
>> +                        os.path.join('configs', self.defconfig))
>>              self.state = STATE_IDLE
>>              return True
>
>
>
>
>
> --
> Best Regards
> Masahiro Yamada
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

  reply	other threads:[~2015-05-19 15:35 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-19 12:12 [U-Boot] [PATCH] Don't apply: tools: add a tool to move automatically CONFIGs from headers to defconfigs Masahiro Yamada
2015-03-04  0:18 ` Simon Glass
2015-03-11  5:53   ` Masahiro Yamada
2015-05-07 21:22 ` [U-Boot] [PATCH 1/5] moveconfig: Actually build autoconf.mk Joe Hershberger
2015-05-07 21:22   ` [U-Boot] [PATCH 2/5] moveconfig: Add a mapping for the arc cross-compiler Joe Hershberger
2015-05-07 21:22   ` [U-Boot] [PATCH 3/5] moveconfig: Continue moving even if one board fails Joe Hershberger
2015-05-07 21:22   ` [U-Boot] [PATCH 4/5] moveconfig: Error if missing the include/autoconf.mk Joe Hershberger
2015-05-07 21:23   ` [U-Boot] [PATCH 5/5] moveconfig: Always run savedefconfig on the moved config Joe Hershberger
2015-05-11 17:23   ` [U-Boot] [PATCH v2 1/7] moveconfig: Actually build autoconf.mk Joe Hershberger
2015-05-11 17:23     ` [U-Boot] [PATCH v2 2/7] moveconfig: Add a mapping for the arc cross-compiler Joe Hershberger
2015-05-13  2:14       ` Masahiro Yamada
2015-05-13 15:34         ` Joe Hershberger
2015-05-11 17:23     ` [U-Boot] [PATCH v2 3/7] moveconfig: Continue moving even if one board fails Joe Hershberger
2015-05-11 17:23     ` [U-Boot] [PATCH v2 4/7] moveconfig: Error if missing the include/autoconf.mk Joe Hershberger
2015-05-11 17:23     ` [U-Boot] [PATCH v2 5/7] moveconfig: Always run savedefconfig on the moved config Joe Hershberger
2015-05-11 17:23     ` [U-Boot] [PATCH v2 6/7] moveconfig: Add a parameter to accept a list to build Joe Hershberger
2015-05-11 17:23     ` [U-Boot] [PATCH v2 7/7] moveconfig: Add a switch to enable printing errors Joe Hershberger
2015-05-13 22:28     ` [U-Boot] [PATCH v3 01/10] moveconfig: Actually build autoconf.mk Joe Hershberger
2015-05-13 22:28       ` [U-Boot] [PATCH v3 02/10] moveconfig: Continue moving even if one board fails Joe Hershberger
2015-05-14 13:09         ` Masahiro Yamada
2015-05-13 22:28       ` [U-Boot] [PATCH v3 03/10] moveconfig: Error if missing the include/autoconf.mk Joe Hershberger
2015-05-13 22:28       ` [U-Boot] [PATCH v3 04/10] moveconfig: Always run savedefconfig on the moved config Joe Hershberger
2015-05-14 15:15         ` Masahiro Yamada
2015-05-14 17:57           ` Joe Hershberger
2015-05-13 22:28       ` [U-Boot] [PATCH v3 05/10] moveconfig: Add a parameter to accept a list to build Joe Hershberger
2015-05-14 13:06         ` Masahiro Yamada
2015-05-13 22:28       ` [U-Boot] [PATCH v3 06/10] moveconfig: Add a switch to enable printing errors Joe Hershberger
2015-05-13 22:28       ` [U-Boot] [PATCH v3 07/10] moveconfig: Ignore duplicate configs when moving Joe Hershberger
2015-05-14 15:36         ` Masahiro Yamada
2015-05-14 18:02           ` Joe Hershberger
2015-05-15  5:10             ` Masahiro Yamada
2015-05-16  2:57               ` Joe Hershberger
2015-05-13 22:28       ` [U-Boot] [PATCH v3 08/10] moveconfig: Handle moving multiple configs at once Joe Hershberger
2015-05-14 14:37         ` Masahiro Yamada
2015-05-14 18:05           ` Joe Hershberger
2015-05-13 22:28       ` [U-Boot] [PATCH v3 09/10] moveconfig: Print status about the processed defconfigs Joe Hershberger
2015-05-13 22:28       ` [U-Boot] [PATCH v3 10/10] moveconfig: Add a switch to only cleanup headers Joe Hershberger
2015-05-14 14:51         ` Masahiro Yamada
2015-05-14 18:03           ` Joe Hershberger
2015-05-14 13:04       ` [U-Boot] [PATCH v3 01/10] moveconfig: Actually build autoconf.mk Masahiro Yamada
2015-05-15 21:40       ` [U-Boot] [PATCH v4 01/10] moveconfig: Always run savedefconfig on the moved config Joe Hershberger
2015-05-15 21:40         ` [U-Boot] [PATCH v4 02/10] moveconfig: Ignore duplicate configs when moving Joe Hershberger
2015-05-19  4:37           ` Masahiro Yamada
2015-05-15 21:40         ` [U-Boot] [PATCH v4 03/10] moveconfig: Add a parameter to accept a list to build Joe Hershberger
2015-05-19  4:33           ` Masahiro Yamada
2015-05-19 17:58             ` Joe Hershberger
2015-05-20  3:01               ` Masahiro Yamada
2015-05-15 21:40         ` [U-Boot] [PATCH v4 04/10] moveconfig: Add a switch to only cleanup headers Joe Hershberger
2015-05-19  2:03           ` Masahiro Yamada
2015-05-19 15:36             ` Joe Hershberger
2015-05-15 21:40         ` [U-Boot] [PATCH v4 05/10] moveconfig: Cleanup headers in arch and board Joe Hershberger
2015-05-19  1:41           ` Masahiro Yamada
2015-05-19 14:33             ` Joe Hershberger
2015-05-15 21:40         ` [U-Boot] [PATCH v4 06/10] moveconfig: Remove probable debug print Joe Hershberger
2015-05-19  2:10           ` Masahiro Yamada
2015-05-19 15:36             ` Joe Hershberger
2015-05-15 21:40         ` [U-Boot] [PATCH v4 07/10] moveconfig: Output a list of failed boards Joe Hershberger
2015-05-19  3:12           ` Masahiro Yamada
2015-05-19 15:40             ` Joe Hershberger
2015-05-15 21:40         ` [U-Boot] [PATCH v4 08/10] moveconfig: Print a message for missing compiler Joe Hershberger
2015-05-19  3:23           ` Masahiro Yamada
2015-05-19 17:51             ` Joe Hershberger
2015-05-20  3:04               ` Masahiro Yamada
2015-05-15 21:40         ` [U-Boot] [PATCH v4 09/10] moveconfig: Add a switch to enable printing errors Joe Hershberger
2015-05-19  3:25           ` Masahiro Yamada
2015-05-19 17:52             ` Joe Hershberger
2015-05-15 21:40         ` [U-Boot] [PATCH v4 10/10] moveconfig: Print status about the processed defconfigs Joe Hershberger
2015-05-19  4:05           ` Masahiro Yamada
2015-05-19  1:58         ` [U-Boot] [PATCH v4 01/10] moveconfig: Always run savedefconfig on the moved config Masahiro Yamada
2015-05-19 15:35           ` Joe Hershberger [this message]
2015-05-19 18:07           ` Joe Hershberger
2015-05-19 18:21         ` [U-Boot] [PATCH v5 1/9] " Joe Hershberger
2015-05-19 18:21           ` [U-Boot] [PATCH v5 2/9] moveconfig: Ignore duplicate configs when moving Joe Hershberger
2015-05-19 18:21           ` [U-Boot] [PATCH v5 3/9] moveconfig: Add a parameter to accept a list to build Joe Hershberger
2015-05-19 18:21           ` [U-Boot] [PATCH v5 4/9] moveconfig: Add a switch to only cleanup headers Joe Hershberger
2015-05-19 18:21           ` [U-Boot] [PATCH v5 5/9] moveconfig: Cleanup headers in arch and board Joe Hershberger
2015-05-19 18:21           ` [U-Boot] [PATCH v5 6/9] moveconfig: Output a list of failed boards Joe Hershberger
2015-05-19 18:21           ` [U-Boot] [PATCH v5 7/9] moveconfig: Print a message for missing compiler Joe Hershberger
2015-05-19 18:21           ` [U-Boot] [PATCH v5 8/9] moveconfig: Add a switch to enable printing errors Joe Hershberger
2015-05-19 18:21           ` [U-Boot] [PATCH v5 9/9] moveconfig: Print status about the processed defconfigs Joe Hershberger
2015-05-20  4:48           ` [U-Boot] [PATCH v5 1/9] moveconfig: Always run savedefconfig on the moved config Masahiro Yamada
2015-05-26 23:43           ` 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='CANr=Z=Zxcei9HA0OYE5_c_X=T6eu4+Znj-0onBSp_f4Bunp+Gw@mail.gmail.com' \
    --to=joe.hershberger@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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 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.