build: fix install from arbitrary directory for meson 0.55

Message ID 20210810230322.230150-1-dmitry.kozliuk@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series build: fix install from arbitrary directory for meson 0.55 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-spell-check-testing warning Testing issues
ci/github-robot-build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Dmitry Kozlyuk Aug. 10, 2021, 11:03 p.m. UTC
  Install command for meson >= 0.55.0 referenced the script by a plain
string, assuming the build directory to be directly under the source
tree root. This resulted in an error when the assumption did not hold:

    c:\python\python.exe: can't open file
    '../buildtools/symlink-drivers-solibs.py':
    [Errno 2] No such file or directory

Use files() to make a valid script path for any build directory.

Fixes: cd27047dbee1 ("build: support drivers symlink on Windows")
Cc: nick.connolly@mayadata.io
Cc: stable@dpdk.org

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
Note: this is not limited to Windows, it just happens that Windows
requires newer meson and the error example is from Windows build.

 config/meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Bruce Richardson Aug. 17, 2021, 2:35 p.m. UTC | #1
On Wed, Aug 11, 2021 at 02:03:22AM +0300, Dmitry Kozlyuk wrote:
> Install command for meson >= 0.55.0 referenced the script by a plain
> string, assuming the build directory to be directly under the source
> tree root. This resulted in an error when the assumption did not hold:
> 
>     c:\python\python.exe: can't open file
>     '../buildtools/symlink-drivers-solibs.py':
>     [Errno 2] No such file or directory
> 
> Use files() to make a valid script path for any build directory.
> 
> Fixes: cd27047dbee1 ("build: support drivers symlink on Windows")
> Cc: nick.connolly@mayadata.io
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> ---
> Note: this is not limited to Windows, it just happens that Windows
> requires newer meson and the error example is from Windows build.
> 
>  config/meson.build | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/config/meson.build b/config/meson.build
> index e80421003b..3b5966ec2f 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -61,7 +61,8 @@ if not is_windows
>              get_option('libdir'), pmd_subdir_opt)
>  elif meson.version().version_compare('>=0.55.0')
>      # 0.55.0 is required to use external program with add_install_script
> -    meson.add_install_script(py3, '../buildtools/symlink-drivers-solibs.py',
> +    meson.add_install_script(py3,
> +            files('../buildtools/symlink-drivers-solibs.py'),
>              get_option('libdir'), pmd_subdir_opt, get_option('bindir'))
>  endif
>  

Rather than using a relative path, we could also use "files()" in the
buildtools directory and store it in a variable to re-use either. Most
other python scripts in the buildtools directory, use that pattern to have
a single (array) variable with the python and script calls together.

Either way as here, or with buildtools change:

Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  
Dmitry Kozlyuk Aug. 18, 2021, 8:55 p.m. UTC | #2
2021-08-17 15:35 (UTC+0100), Bruce Richardson:
> On Wed, Aug 11, 2021 at 02:03:22AM +0300, Dmitry Kozlyuk wrote:
> > Install command for meson >= 0.55.0 referenced the script by a plain
> > string, assuming the build directory to be directly under the source
> > tree root. This resulted in an error when the assumption did not hold:
> > 
> >     c:\python\python.exe: can't open file
> >     '../buildtools/symlink-drivers-solibs.py':
> >     [Errno 2] No such file or directory
> > 
> > Use files() to make a valid script path for any build directory.
> > 
> > Fixes: cd27047dbee1 ("build: support drivers symlink on Windows")
> > Cc: nick.connolly@mayadata.io
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> > ---
> > Note: this is not limited to Windows, it just happens that Windows
> > requires newer meson and the error example is from Windows build.
> > 
> >  config/meson.build | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/config/meson.build b/config/meson.build
> > index e80421003b..3b5966ec2f 100644
> > --- a/config/meson.build
> > +++ b/config/meson.build
> > @@ -61,7 +61,8 @@ if not is_windows
> >              get_option('libdir'), pmd_subdir_opt)
> >  elif meson.version().version_compare('>=0.55.0')
> >      # 0.55.0 is required to use external program with add_install_script
> > -    meson.add_install_script(py3, '../buildtools/symlink-drivers-solibs.py',
> > +    meson.add_install_script(py3,
> > +            files('../buildtools/symlink-drivers-solibs.py'),
> >              get_option('libdir'), pmd_subdir_opt, get_option('bindir'))
> >  endif
> >    
> 
> Rather than using a relative path, we could also use "files()" in the
> buildtools directory and store it in a variable to re-use either. Most
> other python scripts in the buildtools directory, use that pattern to have
> a single (array) variable with the python and script calls together.

Thanks for the hint, but I don't think consistency is worth it.
Now we have some non-trivial logic (otherwise it wouldn't need comments)
in one place. With variable definition affected by the single use case in
another file it will be harder to understand the reason.

> Either way as here, or with buildtools change:
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  
Nick Connolly Aug. 23, 2021, 12:41 p.m. UTC | #3
Good catch - thanks Dmitry.

Ack-by: Nick Connolly <nick.connolly@mayadata.io>
  
Thomas Monjalon Aug. 27, 2021, 7:44 p.m. UTC | #4
17/08/2021 16:35, Bruce Richardson:
> On Wed, Aug 11, 2021 at 02:03:22AM +0300, Dmitry Kozlyuk wrote:
> > Install command for meson >= 0.55.0 referenced the script by a plain
> > string, assuming the build directory to be directly under the source
> > tree root. This resulted in an error when the assumption did not hold:
> > 
> >     c:\python\python.exe: can't open file
> >     '../buildtools/symlink-drivers-solibs.py':
> >     [Errno 2] No such file or directory
> > 
> > Use files() to make a valid script path for any build directory.
> > 
> > Fixes: cd27047dbee1 ("build: support drivers symlink on Windows")
> > Cc: nick.connolly@mayadata.io
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> > ---
> > Note: this is not limited to Windows, it just happens that Windows
> > requires newer meson and the error example is from Windows build.

It is used only for Windows.
Beginning of commit log is adjusted:
"Install command on Windows for Meson >= 0.55.0"

> >      # 0.55.0 is required to use external program with add_install_script
> > -    meson.add_install_script(py3, '../buildtools/symlink-drivers-solibs.py',
> > +    meson.add_install_script(py3,
> > +            files('../buildtools/symlink-drivers-solibs.py'),
> 
> Rather than using a relative path, we could also use "files()" in the
> buildtools directory and store it in a variable to re-use either. Most
> other python scripts in the buildtools directory, use that pattern to have
> a single (array) variable with the python and script calls together.
> 
> Either way as here, or with buildtools change:
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Applied as-is, thanks.
  

Patch

diff --git a/config/meson.build b/config/meson.build
index e80421003b..3b5966ec2f 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -61,7 +61,8 @@  if not is_windows
             get_option('libdir'), pmd_subdir_opt)
 elif meson.version().version_compare('>=0.55.0')
     # 0.55.0 is required to use external program with add_install_script
-    meson.add_install_script(py3, '../buildtools/symlink-drivers-solibs.py',
+    meson.add_install_script(py3,
+            files('../buildtools/symlink-drivers-solibs.py'),
             get_option('libdir'), pmd_subdir_opt, get_option('bindir'))
 endif