diff mbox series

[U-Boot,035/126] binman: Allow verbose output with all commands

Message ID 20190925145750.200592-36-sjg@chromium.org
State Accepted
Delegated to: Bin Meng
Headers show
Series x86: Add initial support for apollolake | expand

Commit Message

Simon Glass Sept. 25, 2019, 2:56 p.m. UTC
At present the verbose flag only works for the 'build' command. This is
not intended, nor is it useful. Update the code to support the verbose
flag and make use of a command exception handler.

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

 tools/binman/control.py | 36 +++++++++++++++---------------------
 1 file changed, 15 insertions(+), 21 deletions(-)

Comments

Bin Meng Oct. 5, 2019, 1:12 p.m. UTC | #1
On Wed, Sep 25, 2019 at 10:58 PM Simon Glass <sjg@chromium.org> wrote:
>
> At present the verbose flag only works for the 'build' command. This is
> not intended, nor is it useful. Update the code to support the verbose
> flag and make use of a command exception handler.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  tools/binman/control.py | 36 +++++++++++++++---------------------
>  1 file changed, 15 insertions(+), 21 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Bin Meng Oct. 6, 2019, 11:19 a.m. UTC | #2
On Sat, Oct 5, 2019 at 9:12 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Wed, Sep 25, 2019 at 10:58 PM Simon Glass <sjg@chromium.org> wrote:
> >
> > At present the verbose flag only works for the 'build' command. This is
> > not intended, nor is it useful. Update the code to support the verbose
> > flag and make use of a command exception handler.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  tools/binman/control.py | 36 +++++++++++++++---------------------
> >  1 file changed, 15 insertions(+), 21 deletions(-)
> >
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Rebased the patch against u-boot-x86/next to get it applied cleanly, and

applied to u-boot-x86/next, thanks!
diff mbox series

Patch

diff --git a/tools/binman/control.py b/tools/binman/control.py
index d1ca798cfb9..1d05bbb87ac 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -475,29 +475,23 @@  def Binman(args):
     from image import Image
     import state
 
-    if args.cmd == 'ls':
+    if args.cmd in ['ls', 'extract', 'replace']:
         try:
+            tout.Init(args.verbosity)
             tools.PrepareOutputDir(None)
-            ListEntries(args.image, args.paths)
-        finally:
-            tools.FinaliseOutputDir()
-        return 0
-
-    if args.cmd == 'extract':
-        try:
-            tools.PrepareOutputDir(None)
-            ExtractEntries(args.image, args.filename, args.outdir, args.paths,
-                           not args.uncompressed)
-        finally:
-            tools.FinaliseOutputDir()
-        return 0
-
-    if args.cmd == 'replace':
-        try:
-            tools.PrepareOutputDir(None)
-            ReplaceEntries(args.image, args.filename, args.indir, args.paths,
-                           do_compress=not args.compressed,
-                           allow_resize=not args.fix_size, write_map=args.map)
+            if args.cmd == 'ls':
+                ListEntries(args.image, args.paths)
+
+            if args.cmd == 'extract':
+                ExtractEntries(args.image, args.filename, args.outdir, args.paths,
+                               not args.uncompressed)
+
+            if args.cmd == 'replace':
+                ReplaceEntries(args.image, args.filename, args.indir, args.paths,
+                               do_compress=not args.compressed,
+                               allow_resize=not args.fix_size, write_map=args.map)
+        except:
+            raise
         finally:
             tools.FinaliseOutputDir()
         return 0