Re: [U-Boot] [PATCH v3 04/10] moveconfig: Always run savedefconfig on the moved config

2015-05-14 Thread Joe Hershberger
Hi Masahiro-san.

On Thu, May 14, 2015 at 10:15 AM, Masahiro Yamada
yamada.masah...@socionext.com wrote:
 2015-05-14 7:28 GMT+09:00 Joe Hershberger joe.hershber...@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.

 Signed-off-by: Joe Hershberger joe.hershber...@ni.com


 I a bit hesitate to always enable this feature
 because savedefconfig might make git-diff  noisier.

That should never be the case. Its consistent use should always lead
to the least noisy diff.

 Is it possible to make it optional?
 -s, --savedefconfig  or --no-savedefconfig?

It is possible, but I recommend against it. Its inconsistent use would
lead to noisy diffs.

Cheers,
-Joe
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 04/10] moveconfig: Always run savedefconfig on the moved config

2015-05-14 Thread Masahiro Yamada
2015-05-14 7:28 GMT+09:00 Joe Hershberger joe.hershber...@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.

 Signed-off-by: Joe Hershberger joe.hershber...@ni.com


I a bit hesitate to always enable this feature
because savedefconfig might make git-diff  noisier.

Is it possible to make it optional?
-s, --savedefconfig  or --no-savedefconfig?



-- 
Best Regards
Masahiro Yamada
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 04/10] moveconfig: Always run savedefconfig on the moved config

2015-05-13 Thread Joe Hershberger
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.

Signed-off-by: Joe Hershberger joe.hershber...@ni.com
---

Changes in v3: None
Changes in v2: None

 tools/moveconfig.py | 24 +---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index b4ee0e3..f2651a9 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -45,6 +45,7 @@ CROSS_COMPILE = {
 STATE_IDLE = 0
 STATE_DEFCONFIG = 1
 STATE_SILENTOLDCONFIG = 2
+STATE_SAVEDEFCONFIG = 3
 
 ### helper functions ###
 def get_devnull():
@@ -149,8 +150,8 @@ class KconfigParser:
 
 arch = ''
 cpu = ''
-dotconfig = os.path.join(self.build_dir, '.config')
-for line in open(dotconfig):
+self.dotconfig = os.path.join(self.build_dir, '.config')
+for line in open(self.dotconfig):
 m = self.re_arch.match(line)
 if m:
 arch = m.group(1)
@@ -224,7 +225,7 @@ class KconfigParser:
 
 print output.strip()
 
-with open(os.path.join('configs', defconfig), 'a') as f:
+with open(os.path.join(self.dotconfig), 'a') as f:
 for line in output_lines:
 if prefixes[line] != '+':
 line = prefixes[line] + ':' + line
@@ -312,6 +313,23 @@ class Slot:
 if self.state == STATE_SILENTOLDCONFIG:
 if self.parser.update_defconfig(self.defconfig):
 self.defconfig_error('ERROR - autoconf.mk not found')
+self.state = STATE_IDLE
+return True
+
+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):
+self.defconfig_error('ERROR - defconfig not updated')
+shutil.move(defconfig_path,
+os.path.join('configs', self.defconfig))
 self.state = STATE_IDLE
 return True
 
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot