[v2] build: use cat if found

Message ID 20190401153836.30807-1-alialnu@mellanox.com (mailing list archive)
State Accepted, archived
Headers
Series [v2] build: use cat if found |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Ali Alnubani April 1, 2019, 3:38 p.m. UTC
  This is to fix a build error with meson in GNU/Linux that is caused
by using the 'more' command to read the VERSION file. The error:

    config/meson.build:10:10: ERROR:  String
    '::::::::::::::\n<RTE_SDK_PATH>VERSION\n::::::::::::::\n19' cannot be
    converted to int

The command 'more' prints the file name before the actual
contents of the file when it's being run without a controlling terminal.
This could happen in CI environments.

Please refer to:
https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/text-utils/more.c

Fixes: c04172b5f031 ("build: add single source of DPDK version number")
Fixes: d320fe56bd51 ("build: use version number from config file")

Signed-off-by: Ali Alnubani <alialnu@mellanox.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes in v2:
	- Use find_program to fallback to 'more'.
	- Update patch title.

 meson.build | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Bruce Richardson April 1, 2019, 3:48 p.m. UTC | #1
On Mon, Apr 01, 2019 at 03:38:59PM +0000, Ali Alnubani wrote:
> This is to fix a build error with meson in GNU/Linux that is caused
> by using the 'more' command to read the VERSION file. The error:
> 
>     config/meson.build:10:10: ERROR:  String
>     '::::::::::::::\n<RTE_SDK_PATH>VERSION\n::::::::::::::\n19' cannot be
>     converted to int
> 
> The command 'more' prints the file name before the actual
> contents of the file when it's being run without a controlling terminal.
> This could happen in CI environments.
> 
> Please refer to:
> https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/text-utils/more.c
> 
> Fixes: c04172b5f031 ("build: add single source of DPDK version number")
> Fixes: d320fe56bd51 ("build: use version number from config file")
> 
> Signed-off-by: Ali Alnubani <alialnu@mellanox.com>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> Changes in v2:
> 	- Use find_program to fallback to 'more'.
> 	- Update patch title.
> 
>  meson.build | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
Thanks for the V2, code change looks good now. For the title, I think this
is really a bug-fix so I'd suggest something like:

build: fix meson build in CI environments

as more helpful. [Thomas, can you correct on apply, or do you want a v3?]

/Bruce
  
Thomas Monjalon April 1, 2019, 4:59 p.m. UTC | #2
01/04/2019 17:48, Bruce Richardson:
> On Mon, Apr 01, 2019 at 03:38:59PM +0000, Ali Alnubani wrote:
> > This is to fix a build error with meson in GNU/Linux that is caused
> > by using the 'more' command to read the VERSION file. The error:
> > 
> >     config/meson.build:10:10: ERROR:  String
> >     '::::::::::::::\n<RTE_SDK_PATH>VERSION\n::::::::::::::\n19' cannot be
> >     converted to int
> > 
> > The command 'more' prints the file name before the actual
> > contents of the file when it's being run without a controlling terminal.
> > This could happen in CI environments.
> > 
> > Please refer to:
> > https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/text-utils/more.c
> > 
> > Fixes: c04172b5f031 ("build: add single source of DPDK version number")
> > Fixes: d320fe56bd51 ("build: use version number from config file")
> > 
> > Signed-off-by: Ali Alnubani <alialnu@mellanox.com>
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> > Changes in v2:
> > 	- Use find_program to fallback to 'more'.
> > 	- Update patch title.
> > 
> >  meson.build | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> Thanks for the V2, code change looks good now. For the title, I think this
> is really a bug-fix so I'd suggest something like:
> 
> build: fix meson build in CI environments
> 
> as more helpful. [Thomas, can you correct on apply, or do you want a v3?]

Applied with title changed, thanks
  

Patch

diff --git a/meson.build b/meson.build
index fa6bf3d07..6061c4b1e 100644
--- a/meson.build
+++ b/meson.build
@@ -3,8 +3,9 @@ 
 
 project('DPDK', 'C',
 	# Get version number from file.
-	# Use "more" rather than "cat" for windows compatibility.
-	version: run_command('more', files('VERSION')).stdout().strip(),
+	# Fallback to "more" for Windows compatibility.
+	version: run_command(find_program('cat', 'more'),
+		files('VERSION')).stdout().strip(),
 	license: 'BSD',
 	default_options: ['buildtype=release', 'default_library=static'],
 	meson_version: '>= 0.47.1'