All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] tools: genboardscfg.py, use default terminal size if undetectable
@ 2014-08-07 10:46 Roger Meier
  2014-08-07 11:37 ` Tom Rini
  2014-08-07 12:47 ` [U-Boot] [PATCH] tools: genboardscfg.py, use default terminal size if undetectable Masahiro Yamada
  0 siblings, 2 replies; 9+ messages in thread
From: Roger Meier @ 2014-08-07 10:46 UTC (permalink / raw)
  To: u-boot

The existing terminalsize detection raised an exception on build
server. Removes the exception and return a default value.

Signed-off-by: Roger Meier <roger@bufferoverflow.ch>
CC: Masahiro Yamada <yamada.m@jp.panasonic.com>
---
 tools/genboardscfg.py |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py
index 734d90b..892c033 100755
--- a/tools/genboardscfg.py
+++ b/tools/genboardscfg.py
@@ -58,11 +58,9 @@ def get_terminal_columns():
         try:
             ret = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, arg)
         except IOError as exception:
-            if exception.errno != errno.ENOTTY:
-                raise
             # If 'Inappropriate ioctl for device' error occurs,
-            # stdout is probably redirected. Return 0.
-            return 0
+            # stdout is probably redirected. Return default size.
+            return (25, 80)
         return struct.unpack('hhhh', ret)[1]
 
 def get_devnull():
@@ -408,7 +406,7 @@ def __gen_boards_cfg(jobs):
       jobs: The number of jobs to run simultaneously
 
     Note:
-      The incomplete boards.cfg is left over when an error (including 
+      The incomplete boards.cfg is left over when an error (including
       the termination by the keyboard interrupt) occurs on the halfway.
     """
     check_top_directory()
-- 
1.7.10.4

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

* [U-Boot] [PATCH] tools: genboardscfg.py, use default terminal size if undetectable
  2014-08-07 10:46 [U-Boot] [PATCH] tools: genboardscfg.py, use default terminal size if undetectable Roger Meier
@ 2014-08-07 11:37 ` Tom Rini
  2014-08-07 12:15   ` Roger Meier
  2014-08-07 12:47 ` [U-Boot] [PATCH] tools: genboardscfg.py, use default terminal size if undetectable Masahiro Yamada
  1 sibling, 1 reply; 9+ messages in thread
From: Tom Rini @ 2014-08-07 11:37 UTC (permalink / raw)
  To: u-boot

On Thu, Aug 07, 2014 at 12:46:53PM +0200, Roger Meier wrote:
> The existing terminalsize detection raised an exception on build
> server. Removes the exception and return a default value.
> 
> Signed-off-by: Roger Meier <roger@bufferoverflow.ch>
> CC: Masahiro Yamada <yamada.m@jp.panasonic.com>
> ---
>  tools/genboardscfg.py |    8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py
> index 734d90b..892c033 100755
> --- a/tools/genboardscfg.py
> +++ b/tools/genboardscfg.py
> @@ -58,11 +58,9 @@ def get_terminal_columns():
>          try:
>              ret = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, arg)
>          except IOError as exception:
> -            if exception.errno != errno.ENOTTY:
> -                raise
>              # If 'Inappropriate ioctl for device' error occurs,
> -            # stdout is probably redirected. Return 0.
> -            return 0
> +            # stdout is probably redirected. Return default size.
> +            return (25, 80)

25 not 24?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140807/83fb75a2/attachment.pgp>

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

* [U-Boot] [PATCH] tools: genboardscfg.py, use default terminal size if  undetectable
  2014-08-07 11:37 ` Tom Rini
@ 2014-08-07 12:15   ` Roger Meier
  2014-08-07 12:47     ` Masahiro Yamada
  0 siblings, 1 reply; 9+ messages in thread
From: Roger Meier @ 2014-08-07 12:15 UTC (permalink / raw)
  To: u-boot

The existing terminalsize detection raised an exception on build
server. Removes the exception and return a default value.

Signed-off-by: Roger Meier <roger@bufferoverflow.ch>
CC: Masahiro Yamada <yamada.m@jp.panasonic.com>
CC: Tom Rini <trini@ti.com>
---
Changes for v2:
   - use 24 instead of 25 lines
---
 tools/genboardscfg.py |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py
index 734d90b..283c989 100755
--- a/tools/genboardscfg.py
+++ b/tools/genboardscfg.py
@@ -58,11 +58,9 @@ def get_terminal_columns():
         try:
             ret = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, arg)
         except IOError as exception:
-            if exception.errno != errno.ENOTTY:
-                raise
             # If 'Inappropriate ioctl for device' error occurs,
-            # stdout is probably redirected. Return 0.
-            return 0
+            # stdout is probably redirected. Return default size.
+            return (24, 80)
         return struct.unpack('hhhh', ret)[1]
 
 def get_devnull():
@@ -408,7 +406,7 @@ def __gen_boards_cfg(jobs):
       jobs: The number of jobs to run simultaneously
 
     Note:
-      The incomplete boards.cfg is left over when an error (including 
+      The incomplete boards.cfg is left over when an error (including
       the termination by the keyboard interrupt) occurs on the halfway.
     """
     check_top_directory()
-- 
1.7.10.4

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

* [U-Boot] [PATCH] tools: genboardscfg.py, use default terminal size if undetectable
  2014-08-07 10:46 [U-Boot] [PATCH] tools: genboardscfg.py, use default terminal size if undetectable Roger Meier
  2014-08-07 11:37 ` Tom Rini
@ 2014-08-07 12:47 ` Masahiro Yamada
  1 sibling, 0 replies; 9+ messages in thread
From: Masahiro Yamada @ 2014-08-07 12:47 UTC (permalink / raw)
  To: u-boot

Hi Roger,


On Thu,  7 Aug 2014 12:46:53 +0200
Roger Meier <roger@bufferoverflow.ch> wrote:

> The existing terminalsize detection raised an exception on build
> server. Removes the exception and return a default value.
> 
> Signed-off-by: Roger Meier <roger@bufferoverflow.ch>
> CC: Masahiro Yamada <yamada.m@jp.panasonic.com>
> ---
>  tools/genboardscfg.py |    8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py
> index 734d90b..892c033 100755
> --- a/tools/genboardscfg.py
> +++ b/tools/genboardscfg.py
> @@ -58,11 +58,9 @@ def get_terminal_columns():
>          try:
>              ret = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, arg)
>          except IOError as exception:
> -            if exception.errno != errno.ENOTTY:
> -                raise
>              # If 'Inappropriate ioctl for device' error occurs,
> -            # stdout is probably redirected. Return 0.
> -            return 0
> +            # stdout is probably redirected. Return default size.
> +            return (25, 80)
>          return struct.unpack('hhhh', ret)[1]


Wrong.
This function is supposed to return an integer.
With your patch, it returns a tuple on the exception.

OK.
We can fix it easily.
  (25, 80)   -->   80


But I still see a problem.

When ENOTTY error happens, tty is not associated.
No reason to display the progress indicator.

Assume this tool is called from an upper level script
and the output is redirected to a log file.

In that case, I get an ugly log file as follows:



^M   1/1177 [>                                                       ]^M   2/1177 [>                                                       ]^M   3/1177 [>                                                       ]^M   4/1177 [>                                                       ]^M   5/1177 [>                                                       ]^M   6/1177 [>                                                       ]^M   7/1177 [>                                                       ]^M   8/1177 [>                                                       ]^M   9/1177 [>                                                       ]^M  10/1177 [>                                                       ]^M  11/1177 [>                                                       ]^M  12/1177 [>                                                       ]^M  13/1177 [>                                                       ]^M  14/1177 [>                                                       ]^M  15/1177 [>                                                       ]^M  16/1177 [>                                                       ]^M  17/1177 [>                                                       ]^M  18/1177 [>                                                       ]^M  19/1177 [>                                                       ]^M  20/1177 [>                                                       ]^M  21/1177 [>                                                       ]^M  22/1177 [=>                                                      ]^M  23/1177 [=>                                                      ]^M  24/1177 [=>                                                      ]^M  25/1177 [=>                                                      ]^M  26/1177 [=>                                                      ]^M  27/1177 [=>                                                      ]^M  28/1177 [=>                                                      ]^M  29/1177 [=>                                                      ]^M  30/117






>  def get_devnull():
> @@ -408,7 +406,7 @@ def __gen_boards_cfg(jobs):
>        jobs: The number of jobs to run simultaneously
>  
>      Note:
> -      The incomplete boards.cfg is left over when an error (including 
> +      The incomplete boards.cfg is left over when an error (including
>        the termination by the keyboard interrupt) occurs on the halfway.
>      """
>      check_top_directory()


This fix is correct.
(Remove a trainling whitespace.)



Best Regards
Masahiro Yamada

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

* [U-Boot] [PATCH] tools: genboardscfg.py, use default terminal size if  undetectable
  2014-08-07 12:15   ` Roger Meier
@ 2014-08-07 12:47     ` Masahiro Yamada
  2014-08-07 14:19       ` [U-Boot] [PATCH v3] tools: genboardscfg.py, no exception if columns undetectable Roger Meier
  0 siblings, 1 reply; 9+ messages in thread
From: Masahiro Yamada @ 2014-08-07 12:47 UTC (permalink / raw)
  To: u-boot

Hi Roger,



On Thu,  7 Aug 2014 14:15:09 +0200
Roger Meier <roger@bufferoverflow.ch> wrote:

> The existing terminalsize detection raised an exception on build
> server. Removes the exception and return a default value.
> 
> Signed-off-by: Roger Meier <roger@bufferoverflow.ch>
> CC: Masahiro Yamada <yamada.m@jp.panasonic.com>
> CC: Tom Rini <trini@ti.com>
> ---
> Changes for v2:
>    - use 24 instead of 25 lines
> ---
>  tools/genboardscfg.py |    8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py
> index 734d90b..283c989 100755
> --- a/tools/genboardscfg.py
> +++ b/tools/genboardscfg.py
> @@ -58,11 +58,9 @@ def get_terminal_columns():
>          try:
>              ret = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, arg)
>          except IOError as exception:
> -            if exception.errno != errno.ENOTTY:
> -                raise
>              # If 'Inappropriate ioctl for device' error occurs,
> -            # stdout is probably redirected. Return 0.
> -            return 0
> +            # stdout is probably redirected. Return default size.
> +            return (24, 80)
>          return struct.unpack('hhhh', ret)[1]
>  
>  def get_devnull():
> @@ -408,7 +406,7 @@ def __gen_boards_cfg(jobs):
>        jobs: The number of jobs to run simultaneously
>  
>      Note:
> -      The incomplete boards.cfg is left over when an error (including 
> +      The incomplete boards.cfg is left over when an error (including
>        the termination by the keyboard interrupt) occurs on the halfway.
>      """
>      check_top_directory()
> -- 
> 1.7.10.4






I assume you fixed  (25, 80) to (24, 80)

But the problem is not in it.

See my comment in v1.


BTW, this is some advice from me.

 - Add "v2" prefix to the patch subject
 - Describe which parts were changes


I recommend you to read
http://www.denx.de/wiki/U-Boot/Patches



Best Regards
Masahiro Yamada

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

* [U-Boot] [PATCH v3] tools: genboardscfg.py, no exception if columns undetectable
  2014-08-07 12:47     ` Masahiro Yamada
@ 2014-08-07 14:19       ` Roger Meier
  2014-08-09  0:37         ` Masahiro YAMADA
  2014-08-23 12:42         ` [U-Boot] [U-Boot, " Tom Rini
  0 siblings, 2 replies; 9+ messages in thread
From: Roger Meier @ 2014-08-07 14:19 UTC (permalink / raw)
  To: u-boot

The existing terminalsize detection raised an exception on build
server. Just removes the exception. This also deactivates the
progress indicator.

Remove a trainling whitespace.

Signed-off-by: Roger Meier <roger@bufferoverflow.ch>
CC: Masahiro Yamada <yamada.m@jp.panasonic.com>
CC: Tom Rini <trini@ti.com>
---
Changes for v2:
   - use 24 instead of 25 lines
Changes for v3:
   - return integer with 0 columns instead of tuple,
     this also deactivates the progress indicator
---
 tools/genboardscfg.py |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py
index 734d90b..cd9e69c 100755
--- a/tools/genboardscfg.py
+++ b/tools/genboardscfg.py
@@ -58,8 +58,6 @@ def get_terminal_columns():
         try:
             ret = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, arg)
         except IOError as exception:
-            if exception.errno != errno.ENOTTY:
-                raise
             # If 'Inappropriate ioctl for device' error occurs,
             # stdout is probably redirected. Return 0.
             return 0
@@ -408,7 +406,7 @@ def __gen_boards_cfg(jobs):
       jobs: The number of jobs to run simultaneously
 
     Note:
-      The incomplete boards.cfg is left over when an error (including 
+      The incomplete boards.cfg is left over when an error (including
       the termination by the keyboard interrupt) occurs on the halfway.
     """
     check_top_directory()
-- 
1.7.10.4

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

* [U-Boot] [PATCH v3] tools: genboardscfg.py, no exception if columns undetectable
  2014-08-07 14:19       ` [U-Boot] [PATCH v3] tools: genboardscfg.py, no exception if columns undetectable Roger Meier
@ 2014-08-09  0:37         ` Masahiro YAMADA
  2014-08-17 16:07           ` Roger Meier
  2014-08-23 12:42         ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 1 reply; 9+ messages in thread
From: Masahiro YAMADA @ 2014-08-09  0:37 UTC (permalink / raw)
  To: u-boot

Hi Roger,
(adding York to cc)


2014-08-07 23:19 GMT+09:00 Roger Meier <roger@bufferoverflow.ch>:
> The existing terminalsize detection raised an exception on build
> server. Just removes the exception. This also deactivates the
> progress indicator.
>
> Remove a trainling whitespace.
>
> Signed-off-by: Roger Meier <roger@bufferoverflow.ch>
> CC: Masahiro Yamada <yamada.m@jp.panasonic.com>
> CC: Tom Rini <trini@ti.com>


 Acked-by: Masahiro Yamada <yamada.m@jp.panasonic.com>


Tom,
This problem seems fatal. Please apply this patch asap.

Thanks!

-- 
Best Regards
Masahiro Yamada

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

* [U-Boot] [PATCH v3] tools: genboardscfg.py, no exception if columns undetectable
  2014-08-09  0:37         ` Masahiro YAMADA
@ 2014-08-17 16:07           ` Roger Meier
  0 siblings, 0 replies; 9+ messages in thread
From: Roger Meier @ 2014-08-17 16:07 UTC (permalink / raw)
  To: u-boot


Quoting Masahiro YAMADA <yamada.m@jp.panasonic.com>:

> Hi Roger,
> (adding York to cc)
>
>
> 2014-08-07 23:19 GMT+09:00 Roger Meier <roger@bufferoverflow.ch>:
>> The existing terminalsize detection raised an exception on build
>> server. Just removes the exception. This also deactivates the
>> progress indicator.
>>
>> Remove a trainling whitespace.
>>
>> Signed-off-by: Roger Meier <roger@bufferoverflow.ch>
>> CC: Masahiro Yamada <yamada.m@jp.panasonic.com>
>> CC: Tom Rini <trini@ti.com>
>
>
>  Acked-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
>
>
> Tom,
> This problem seems fatal. Please apply this patch asap.
>
> Thanks!
>
> --
> Best Regards
> Masahiro Yamada

Yes, building on a build server is still not possible without this patch.
It does not matter if you use buildman or MAKEALL.

best!
-roger

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

* [U-Boot] [U-Boot, v3] tools: genboardscfg.py, no exception if columns undetectable
  2014-08-07 14:19       ` [U-Boot] [PATCH v3] tools: genboardscfg.py, no exception if columns undetectable Roger Meier
  2014-08-09  0:37         ` Masahiro YAMADA
@ 2014-08-23 12:42         ` Tom Rini
  1 sibling, 0 replies; 9+ messages in thread
From: Tom Rini @ 2014-08-23 12:42 UTC (permalink / raw)
  To: u-boot

On Thu, Aug 07, 2014 at 04:19:58PM +0200, Roger Meier wrote:

> The existing terminalsize detection raised an exception on build
> server. Just removes the exception. This also deactivates the
> progress indicator.
> 
> Remove a trainling whitespace.
> 
> Signed-off-by: Roger Meier <roger@bufferoverflow.ch>
> CC: Masahiro Yamada <yamada.m@jp.panasonic.com>
> CC: Tom Rini <trini@ti.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140823/99e16e07/attachment.pgp>

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

end of thread, other threads:[~2014-08-23 12:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-07 10:46 [U-Boot] [PATCH] tools: genboardscfg.py, use default terminal size if undetectable Roger Meier
2014-08-07 11:37 ` Tom Rini
2014-08-07 12:15   ` Roger Meier
2014-08-07 12:47     ` Masahiro Yamada
2014-08-07 14:19       ` [U-Boot] [PATCH v3] tools: genboardscfg.py, no exception if columns undetectable Roger Meier
2014-08-09  0:37         ` Masahiro YAMADA
2014-08-17 16:07           ` Roger Meier
2014-08-23 12:42         ` [U-Boot] [U-Boot, " Tom Rini
2014-08-07 12:47 ` [U-Boot] [PATCH] tools: genboardscfg.py, use default terminal size if undetectable Masahiro Yamada

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.