diff mbox series

[1/5] utils/genrandconfig: filter empty lines and comments in CSV file

Message ID 20171029171440.8095-2-thomas.petazzoni@free-electrons.com
State Accepted
Headers show
Series test-pkg: by default only test a subset of toolchains | expand

Commit Message

Thomas Petazzoni Oct. 29, 2017, 5:14 p.m. UTC
In preparation for the addition of comments in the CSV file listing
toolchain configurations, we filter out such lines when reading the
CSV file in utils/genrandconfig.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 utils/genrandconfig | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Yann E. MORIN Oct. 29, 2017, 5:26 p.m. UTC | #1
Thomas, All,

On 2017-10-29 18:14 +0100, Thomas Petazzoni spake thusly:
> In preparation for the addition of comments in the CSV file listing
> toolchain configurations, we filter out such lines when reading the
> CSV file in utils/genrandconfig.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Small nit, below...

> ---
>  utils/genrandconfig | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/utils/genrandconfig b/utils/genrandconfig
> index a67d46fad9..e963349d70 100755
> --- a/utils/genrandconfig
> +++ b/utils/genrandconfig
> @@ -126,7 +126,9 @@ def get_toolchain_configs(toolchains_csv, buildrootdir):
>      """
>  
>      with open(toolchains_csv) as r:
> -        toolchains = decode_byte_list(r.readlines())
> +        # filter empty lines and comments
> +        lines = [ t for t in r.readlines() if len(t.strip()) > 0 and t[0] != '#' ]
> +        toolchains = decode_byte_list(lines)
>      configs = []
>  
>      (_, _, _, _, hostarch) = os.uname()
> @@ -164,6 +166,7 @@ def get_toolchain_configs(toolchains_csv, buildrootdir):
>          with open(configfile) as r:
>              config = r.readlines()
>          configs.append(config)
> +

Spurious hunk.

Regards,
Yann E. MORIN.

>      return configs
>  
>  
> -- 
> 2.13.6
>
Thomas Petazzoni Nov. 27, 2017, 10:24 p.m. UTC | #2
Hello,

On Sun, 29 Oct 2017 18:14:36 +0100, Thomas Petazzoni wrote:
> In preparation for the addition of comments in the CSV file listing
> toolchain configurations, we filter out such lines when reading the
> CSV file in utils/genrandconfig.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  utils/genrandconfig | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Applied to next after dropping the spurious change noticed by Yann.

Thomas
diff mbox series

Patch

diff --git a/utils/genrandconfig b/utils/genrandconfig
index a67d46fad9..e963349d70 100755
--- a/utils/genrandconfig
+++ b/utils/genrandconfig
@@ -126,7 +126,9 @@  def get_toolchain_configs(toolchains_csv, buildrootdir):
     """
 
     with open(toolchains_csv) as r:
-        toolchains = decode_byte_list(r.readlines())
+        # filter empty lines and comments
+        lines = [ t for t in r.readlines() if len(t.strip()) > 0 and t[0] != '#' ]
+        toolchains = decode_byte_list(lines)
     configs = []
 
     (_, _, _, _, hostarch) = os.uname()
@@ -164,6 +166,7 @@  def get_toolchain_configs(toolchains_csv, buildrootdir):
         with open(configfile) as r:
             config = r.readlines()
         configs.append(config)
+
     return configs