All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 1/4] tools: moveconfig: extract helper function for user confirmation
@ 2017-05-02  9:30 Chris Packham
  2017-05-02  9:30 ` [U-Boot] [PATCH v3 2/4] tools: moveconfig: cleanup whitelist entries Chris Packham
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Chris Packham @ 2017-05-02  9:30 UTC (permalink / raw)
  To: u-boot

Avoid repetitive code dealing with asking the user for confirmation.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---

Changes in v3: None
Changes in v2: None

 tools/moveconfig.py | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index dcca0ec..f8d4857 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -435,6 +435,20 @@ def extend_matched_lines(lines, matched, pre_patterns, post_patterns, extend_pre
     matched += extended_matched
     matched.sort()
 
+def confirm(options, prompt):
+    if not options.yes:
+        while True:
+            choice = raw_input('{} [y/n]: '.format(prompt))
+            choice = choice.lower()
+            print choice
+            if choice == 'y' or choice == 'n':
+                break
+
+        if choice == 'n':
+            return False
+
+    return True
+
 def cleanup_one_header(header_path, patterns, options):
     """Clean regex-matched lines away from a file.
 
@@ -502,15 +516,8 @@ def cleanup_headers(configs, options):
       configs: A list of CONFIGs to remove.
       options: option flags.
     """
-    if not options.yes:
-        while True:
-            choice = raw_input('Clean up headers? [y/n]: ').lower()
-            print choice
-            if choice == 'y' or choice == 'n':
-                break
-
-        if choice == 'n':
-            return
+    if not confirm(options, 'Clean up headers?'):
+        return
 
     patterns = []
     for config in configs:
@@ -582,16 +589,8 @@ def cleanup_extra_options(configs, options):
       configs: A list of CONFIGs to remove.
       options: option flags.
     """
-    if not options.yes:
-        while True:
-            choice = (raw_input('Clean up CONFIG_SYS_EXTRA_OPTIONS? [y/n]: ').
-                      lower())
-            print choice
-            if choice == 'y' or choice == 'n':
-                break
-
-        if choice == 'n':
-            return
+    if not confirm(options, 'Clean up CONFIG_SYS_EXTRA_OPTIONS?'):
+        return
 
     configs = [ config[len('CONFIG_'):] for config in configs ]
 
-- 
2.10.1

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

* [U-Boot] [PATCH v3 2/4] tools: moveconfig: cleanup whitelist entries
  2017-05-02  9:30 [U-Boot] [PATCH v3 1/4] tools: moveconfig: extract helper function for user confirmation Chris Packham
@ 2017-05-02  9:30 ` Chris Packham
  2017-05-04 16:50   ` Simon Glass
  2017-05-08 19:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
  2017-05-02  9:30 ` [U-Boot] [PATCH v3 3/4] tools: moveconfig: cleanup README entires Chris Packham
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 12+ messages in thread
From: Chris Packham @ 2017-05-02  9:30 UTC (permalink / raw)
  To: u-boot

After moving to KConfig and removing from all headers options should be
removed from config_whitelist.txt so the build starts complaining if
someone adds them back.

Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
Simon asked for it so here you go. I also thought about cleaning up the
README file references too but that will take a little bit of work to
parse reliably.

Changes in v3:
- Apply on top of cleanup patch

Changes in v2:
- Correct typo
- Collect ack from Masahiro

 tools/moveconfig.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index f8d4857..2361a43 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -600,6 +600,25 @@ def cleanup_extra_options(configs, options):
         cleanup_one_extra_option(os.path.join('configs', defconfig), configs,
                                  options)
 
+def cleanup_whitelist(configs, options):
+    """Delete config whitelist entries
+
+    Arguments:
+      configs: A list of CONFIGs to remove.
+      options: option flags.
+    """
+    if not confirm(options, 'Clean up whitelist entries?'):
+        return
+
+    with open(os.path.join('scripts', 'config_whitelist.txt')) as f:
+        lines = f.readlines()
+
+    lines = [x for x in lines if x.strip() not in configs]
+
+    with open(os.path.join('scripts', 'config_whitelist.txt'), 'w') as f:
+        f.write(''.join(lines))
+
+
 ### classes ###
 class Progress:
 
@@ -1296,6 +1315,7 @@ def main():
     if configs:
         cleanup_headers(configs, options)
         cleanup_extra_options(configs, options)
+        cleanup_whitelist(configs, options)
 
     if options.commit:
         subprocess.call(['git', 'add', '-u'])
-- 
2.10.1

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

* [U-Boot] [PATCH v3 3/4] tools: moveconfig: cleanup README entires
  2017-05-02  9:30 [U-Boot] [PATCH v3 1/4] tools: moveconfig: extract helper function for user confirmation Chris Packham
  2017-05-02  9:30 ` [U-Boot] [PATCH v3 2/4] tools: moveconfig: cleanup whitelist entries Chris Packham
@ 2017-05-02  9:30 ` Chris Packham
  2017-05-04 16:50   ` Simon Glass
  2017-05-08 19:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
  2017-05-02  9:30 ` [U-Boot] [PATCH v3 4/4] README: remove CONFIG_CMD_DATE Chris Packham
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 12+ messages in thread
From: Chris Packham @ 2017-05-02  9:30 UTC (permalink / raw)
  To: u-boot

The Kconfig description replaces the description in the README file so
as options are migrated they can be removed from the README.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---

Changes in v3: None
Changes in v2: None

 tools/moveconfig.py | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index 2361a43..95ef352 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -618,6 +618,46 @@ def cleanup_whitelist(configs, options):
     with open(os.path.join('scripts', 'config_whitelist.txt'), 'w') as f:
         f.write(''.join(lines))
 
+def find_matching(patterns, line):
+    for pat in patterns:
+        if pat.search(line):
+            return True
+    return False
+
+def cleanup_readme(configs, options):
+    """Delete config description in README
+
+    Arguments:
+      configs: A list of CONFIGs to remove.
+      options: option flags.
+    """
+    if not confirm(options, 'Clean up README?'):
+        return
+
+    patterns = []
+    for config in configs:
+        patterns.append(re.compile(r'^\s+%s' % config))
+
+    with open('README') as f:
+        lines = f.readlines()
+
+    found = False
+    newlines = []
+    for line in lines:
+        if not found:
+            found = find_matching(patterns, line)
+            if found:
+                continue
+
+        if found and re.search(r'^\s+CONFIG', line):
+            found = False
+
+        if not found:
+            newlines.append(line)
+
+    with open('README', 'w') as f:
+        f.write(''.join(newlines))
+
 
 ### classes ###
 class Progress:
@@ -1316,6 +1356,7 @@ def main():
         cleanup_headers(configs, options)
         cleanup_extra_options(configs, options)
         cleanup_whitelist(configs, options)
+        cleanup_readme(configs, options)
 
     if options.commit:
         subprocess.call(['git', 'add', '-u'])
-- 
2.10.1

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

* [U-Boot] [PATCH v3 4/4] README: remove CONFIG_CMD_DATE
  2017-05-02  9:30 [U-Boot] [PATCH v3 1/4] tools: moveconfig: extract helper function for user confirmation Chris Packham
  2017-05-02  9:30 ` [U-Boot] [PATCH v3 2/4] tools: moveconfig: cleanup whitelist entries Chris Packham
  2017-05-02  9:30 ` [U-Boot] [PATCH v3 3/4] tools: moveconfig: cleanup README entires Chris Packham
@ 2017-05-02  9:30 ` Chris Packham
  2017-05-04 16:50   ` Simon Glass
  2017-05-08 19:44   ` [U-Boot] [U-Boot,v3,4/4] " Tom Rini
  2017-05-04 16:50 ` [U-Boot] [PATCH v3 1/4] tools: moveconfig: extract helper function for user confirmation Simon Glass
  2017-05-08 19:43 ` [U-Boot] [U-Boot, v3, " Tom Rini
  4 siblings, 2 replies; 12+ messages in thread
From: Chris Packham @ 2017-05-02  9:30 UTC (permalink / raw)
  To: u-boot

CONFIG_CMD_DATE was recently moved to Kconfig. Remove the now duplicate
description of the option.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---

Changes in v3: None
Changes in v2: None

 README | 1 -
 1 file changed, 1 deletion(-)

diff --git a/README b/README
index 0ac0136..78173e2 100644
--- a/README
+++ b/README
@@ -828,7 +828,6 @@ The following options need to be configured:
 		CONFIG_CMD_CACHE	* icache, dcache
 		CONFIG_CMD_CONSOLE	  coninfo
 		CONFIG_CMD_CRC32	* crc32
-		CONFIG_CMD_DATE		* support for RTC, date/time...
 		CONFIG_CMD_DHCP		* DHCP support
 		CONFIG_CMD_DIAG		* Diagnostics
 		CONFIG_CMD_DS4510	* ds4510 I2C gpio commands
-- 
2.10.1

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

* [U-Boot] [PATCH v3 1/4] tools: moveconfig: extract helper function for user confirmation
  2017-05-02  9:30 [U-Boot] [PATCH v3 1/4] tools: moveconfig: extract helper function for user confirmation Chris Packham
                   ` (2 preceding siblings ...)
  2017-05-02  9:30 ` [U-Boot] [PATCH v3 4/4] README: remove CONFIG_CMD_DATE Chris Packham
@ 2017-05-04 16:50 ` Simon Glass
  2017-05-08 19:43 ` [U-Boot] [U-Boot, v3, " Tom Rini
  4 siblings, 0 replies; 12+ messages in thread
From: Simon Glass @ 2017-05-04 16:50 UTC (permalink / raw)
  To: u-boot

On 2 May 2017 at 03:30, Chris Packham <judge.packham@gmail.com> wrote:
> Avoid repetitive code dealing with asking the user for confirmation.
>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  tools/moveconfig.py | 37 ++++++++++++++++++-------------------
>  1 file changed, 18 insertions(+), 19 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH v3 2/4] tools: moveconfig: cleanup whitelist entries
  2017-05-02  9:30 ` [U-Boot] [PATCH v3 2/4] tools: moveconfig: cleanup whitelist entries Chris Packham
@ 2017-05-04 16:50   ` Simon Glass
  2017-05-08 19:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
  1 sibling, 0 replies; 12+ messages in thread
From: Simon Glass @ 2017-05-04 16:50 UTC (permalink / raw)
  To: u-boot

On 2 May 2017 at 03:30, Chris Packham <judge.packham@gmail.com> wrote:
> After moving to KConfig and removing from all headers options should be
> removed from config_whitelist.txt so the build starts complaining if
> someone adds them back.
>
> Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
> Simon asked for it so here you go. I also thought about cleaning up the
> README file references too but that will take a little bit of work to
> parse reliably.
>
> Changes in v3:
> - Apply on top of cleanup patch
>
> Changes in v2:
> - Correct typo
> - Collect ack from Masahiro
>
>  tools/moveconfig.py | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)

Thank you Chris.

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH v3 3/4] tools: moveconfig: cleanup README entires
  2017-05-02  9:30 ` [U-Boot] [PATCH v3 3/4] tools: moveconfig: cleanup README entires Chris Packham
@ 2017-05-04 16:50   ` Simon Glass
  2017-05-08 19:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
  1 sibling, 0 replies; 12+ messages in thread
From: Simon Glass @ 2017-05-04 16:50 UTC (permalink / raw)
  To: u-boot

On 2 May 2017 at 03:30, Chris Packham <judge.packham@gmail.com> wrote:
> The Kconfig description replaces the description in the README file so
> as options are migrated they can be removed from the README.
>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  tools/moveconfig.py | 41 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH v3 4/4] README: remove CONFIG_CMD_DATE
  2017-05-02  9:30 ` [U-Boot] [PATCH v3 4/4] README: remove CONFIG_CMD_DATE Chris Packham
@ 2017-05-04 16:50   ` Simon Glass
  2017-05-08 19:44   ` [U-Boot] [U-Boot,v3,4/4] " Tom Rini
  1 sibling, 0 replies; 12+ messages in thread
From: Simon Glass @ 2017-05-04 16:50 UTC (permalink / raw)
  To: u-boot

On 2 May 2017 at 03:30, Chris Packham <judge.packham@gmail.com> wrote:
> CONFIG_CMD_DATE was recently moved to Kconfig. Remove the now duplicate
> description of the option.
>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  README | 1 -
>  1 file changed, 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [U-Boot, v3, 1/4] tools: moveconfig: extract helper function for user confirmation
  2017-05-02  9:30 [U-Boot] [PATCH v3 1/4] tools: moveconfig: extract helper function for user confirmation Chris Packham
                   ` (3 preceding siblings ...)
  2017-05-04 16:50 ` [U-Boot] [PATCH v3 1/4] tools: moveconfig: extract helper function for user confirmation Simon Glass
@ 2017-05-08 19:43 ` Tom Rini
  4 siblings, 0 replies; 12+ messages in thread
From: Tom Rini @ 2017-05-08 19:43 UTC (permalink / raw)
  To: u-boot

On Tue, May 02, 2017 at 09:30:46PM +1200, Chris Packham wrote:

> Avoid repetitive code dealing with asking the user for confirmation.
> 
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170508/6746bf40/attachment.sig>

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

* [U-Boot] [U-Boot, v3, 2/4] tools: moveconfig: cleanup whitelist entries
  2017-05-02  9:30 ` [U-Boot] [PATCH v3 2/4] tools: moveconfig: cleanup whitelist entries Chris Packham
  2017-05-04 16:50   ` Simon Glass
@ 2017-05-08 19:44   ` Tom Rini
  1 sibling, 0 replies; 12+ messages in thread
From: Tom Rini @ 2017-05-08 19:44 UTC (permalink / raw)
  To: u-boot

On Tue, May 02, 2017 at 09:30:47PM +1200, Chris Packham wrote:

> After moving to KConfig and removing from all headers options should be
> removed from config_whitelist.txt so the build starts complaining if
> someone adds them back.
> 
> Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170508/3bffb22d/attachment.sig>

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

* [U-Boot] [U-Boot, v3, 3/4] tools: moveconfig: cleanup README entires
  2017-05-02  9:30 ` [U-Boot] [PATCH v3 3/4] tools: moveconfig: cleanup README entires Chris Packham
  2017-05-04 16:50   ` Simon Glass
@ 2017-05-08 19:44   ` Tom Rini
  1 sibling, 0 replies; 12+ messages in thread
From: Tom Rini @ 2017-05-08 19:44 UTC (permalink / raw)
  To: u-boot

On Tue, May 02, 2017 at 09:30:48PM +1200, Chris Packham wrote:

> The Kconfig description replaces the description in the README file so
> as options are migrated they can be removed from the README.
> 
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170508/7efe2a11/attachment.sig>

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

* [U-Boot] [U-Boot,v3,4/4] README: remove CONFIG_CMD_DATE
  2017-05-02  9:30 ` [U-Boot] [PATCH v3 4/4] README: remove CONFIG_CMD_DATE Chris Packham
  2017-05-04 16:50   ` Simon Glass
@ 2017-05-08 19:44   ` Tom Rini
  1 sibling, 0 replies; 12+ messages in thread
From: Tom Rini @ 2017-05-08 19:44 UTC (permalink / raw)
  To: u-boot

On Tue, May 02, 2017 at 09:30:49PM +1200, Chris Packham wrote:

> CONFIG_CMD_DATE was recently moved to Kconfig. Remove the now duplicate
> description of the option.
> 
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170508/e07f548a/attachment.sig>

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

end of thread, other threads:[~2017-05-08 19:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-02  9:30 [U-Boot] [PATCH v3 1/4] tools: moveconfig: extract helper function for user confirmation Chris Packham
2017-05-02  9:30 ` [U-Boot] [PATCH v3 2/4] tools: moveconfig: cleanup whitelist entries Chris Packham
2017-05-04 16:50   ` Simon Glass
2017-05-08 19:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
2017-05-02  9:30 ` [U-Boot] [PATCH v3 3/4] tools: moveconfig: cleanup README entires Chris Packham
2017-05-04 16:50   ` Simon Glass
2017-05-08 19:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
2017-05-02  9:30 ` [U-Boot] [PATCH v3 4/4] README: remove CONFIG_CMD_DATE Chris Packham
2017-05-04 16:50   ` Simon Glass
2017-05-08 19:44   ` [U-Boot] [U-Boot,v3,4/4] " Tom Rini
2017-05-04 16:50 ` [U-Boot] [PATCH v3 1/4] tools: moveconfig: extract helper function for user confirmation Simon Glass
2017-05-08 19:43 ` [U-Boot] [U-Boot, v3, " Tom Rini

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.