All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] waf.bbclass: cd to ${S} before checking version
@ 2018-01-31 17:02 Joshua Watt
  2018-01-31 17:18 ` Burton, Ross
  2018-01-31 19:49 ` [PATCH v2] " Joshua Watt
  0 siblings, 2 replies; 5+ messages in thread
From: Joshua Watt @ 2018-01-31 17:02 UTC (permalink / raw)
  To: openembedded-core; +Cc: stefan.agner, jslater

waf requires that the current working directory be the project root (in
this case ${S} when it is invoked. The check to get the waf version was
being executed as a prefunc for do_configure, which meant it was
executed before the current working directory was switched to ${S}, and
thus would fail with some recipes. Fix this by changing to ${S} before
executing "waf --version"

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/waf.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes/waf.bbclass b/meta/classes/waf.bbclass
index c3e744e5de..f72ddb7814 100644
--- a/meta/classes/waf.bbclass
+++ b/meta/classes/waf.bbclass
@@ -29,7 +29,8 @@ python waf_preconfigure() {
     from distutils.version import StrictVersion
     srcsubdir = d.getVar('S')
     wafbin = os.path.join(srcsubdir, 'waf')
-    status, result = oe.utils.getstatusoutput(wafbin + " --version")
+    cmd = "cd '%s'; %s --version" % (srcsubdir, wafbin)
+    status, result = oe.utils.getstatusoutput(cmd)
     if status != 0:
         bb.warn("Unable to execute waf --version, exit code %d. Assuming waf version without bindir/libdir support." % status)
         return
-- 
2.14.3



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

* Re: [PATCH] waf.bbclass: cd to ${S} before checking version
  2018-01-31 17:02 [PATCH] waf.bbclass: cd to ${S} before checking version Joshua Watt
@ 2018-01-31 17:18 ` Burton, Ross
  2018-01-31 19:49 ` [PATCH v2] " Joshua Watt
  1 sibling, 0 replies; 5+ messages in thread
From: Burton, Ross @ 2018-01-31 17:18 UTC (permalink / raw)
  To: Joshua Watt; +Cc: Joe Slater, Stefan Agner, OE-core

[-- Attachment #1: Type: text/plain, Size: 1369 bytes --]

On 31 January 2018 at 17:02, Joshua Watt <jpewhacker@gmail.com> wrote:

> waf requires that the current working directory be the project root (in
> this case ${S} when it is invoked. The check to get the waf version was
> being executed as a prefunc for do_configure, which meant it was
> executed before the current working directory was switched to ${S}, and
> thus would fail with some recipes. Fix this by changing to ${S} before
> executing "waf --version"
>
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>  meta/classes/waf.bbclass | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/waf.bbclass b/meta/classes/waf.bbclass
> index c3e744e5de..f72ddb7814 100644
> --- a/meta/classes/waf.bbclass
> +++ b/meta/classes/waf.bbclass
> @@ -29,7 +29,8 @@ python waf_preconfigure() {
>      from distutils.version import StrictVersion
>      srcsubdir = d.getVar('S')
>      wafbin = os.path.join(srcsubdir, 'waf')
> -    status, result = oe.utils.getstatusoutput(wafbin + " --version")
> +    cmd = "cd '%s'; %s --version" % (srcsubdir, wafbin)
> +    status, result = oe.utils.getstatusoutput(cmd)
>

I'm being really picky but getstatusoutput is horrible.  How about:

subprocess.check_output(['waf', '--version', cwd=srcsubdir)

Less faffing with the shell, and more modern code.

Ross

[-- Attachment #2: Type: text/html, Size: 1932 bytes --]

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

* [PATCH v2] waf.bbclass: cd to ${S} before checking version
  2018-01-31 17:02 [PATCH] waf.bbclass: cd to ${S} before checking version Joshua Watt
  2018-01-31 17:18 ` Burton, Ross
@ 2018-01-31 19:49 ` Joshua Watt
  2018-02-11  8:35   ` Robert Yang
  1 sibling, 1 reply; 5+ messages in thread
From: Joshua Watt @ 2018-01-31 19:49 UTC (permalink / raw)
  To: openembedded-core; +Cc: stefan.agner, jslater

waf requires that the current working directory be the project root (in
this case ${S} when it is invoked. The check to get the waf version was
being executed as a prefunc for do_configure, which meant it was
executed before the current working directory was switched to ${S}, and
thus would fail with some recipes. Fix this by changing to ${S} before
executing "waf --version"

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/waf.bbclass | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/meta/classes/waf.bbclass b/meta/classes/waf.bbclass
index c3e744e5dec..bdbdc56767c 100644
--- a/meta/classes/waf.bbclass
+++ b/meta/classes/waf.bbclass
@@ -26,16 +26,17 @@ def get_waf_parallel_make(d):
     return ""
 
 python waf_preconfigure() {
+    import subprocess
     from distutils.version import StrictVersion
-    srcsubdir = d.getVar('S')
-    wafbin = os.path.join(srcsubdir, 'waf')
-    status, result = oe.utils.getstatusoutput(wafbin + " --version")
-    if status != 0:
-        bb.warn("Unable to execute waf --version, exit code %d. Assuming waf version without bindir/libdir support." % status)
-        return
-    version = result.split()[1]
-    if StrictVersion(version) >= StrictVersion("1.8.7"):
-        d.setVar("WAF_EXTRA_CONF", "--bindir=${bindir} --libdir=${libdir}")
+    subsrcdir = d.getVar('S')
+    wafbin = os.path.join(subsrcdir, 'waf')
+    try:
+        result = subprocess.check_output([wafbin, '--version'], cwd=subsrcdir, stderr=subprocess.STDOUT)
+        version = result.decode('utf-8').split()[1]
+        if StrictVersion(version) >= StrictVersion("1.8.7"):
+            d.setVar("WAF_EXTRA_CONF", "--bindir=${bindir} --libdir=${libdir}")
+    except subprocess.CalledProcessError as e:
+        bb.warn("Unable to execute waf --version, exit code %d. Assuming waf version without bindir/libdir support." % e.returncode)
 }
 
 do_configure[prefuncs] += "waf_preconfigure"
-- 
2.14.3



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

* Re: [PATCH v2] waf.bbclass: cd to ${S} before checking version
  2018-01-31 19:49 ` [PATCH v2] " Joshua Watt
@ 2018-02-11  8:35   ` Robert Yang
  2018-02-11 18:31     ` Joshua Watt
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Yang @ 2018-02-11  8:35 UTC (permalink / raw)
  To: Joshua Watt, openembedded-core; +Cc: jslater, stefan.agner

Hi Joshua,

This one causes the following 2 recipes failed to build:

meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc_2.1.10.bb:do_configure
meta-openembedded/meta-networking/recipes-support/libtdb/libtdb_1.3.15.bb:do_configure

The error messages are similar:

File: '/usr/lib/python3.4/subprocess.py', lineno: 1457, function: _execute_child
      1453:                                # The error must be from chdir(cwd).
      1454:                                err_msg += ': ' + repr(cwd)
      1455:                            else:
      1456:                                err_msg += ': ' + repr(orig_executable)
  *** 1457:                    raise child_exception_type(errno_num, err_msg)
      1458:                raise child_exception_type(err_msg)
      1459:
      1460:
      1461:        def _handle_exitstatus(self, sts, _WIFSIGNALED=os.WIFSIGNALED,
Exception: FileNotFoundError: [Errno 2] No such file or directory: 
'/path/to/tmp-glibc/work/i586-wrs-linux/libtdb/1.3.15-r0/tdb-1.3.15/waf'

// Robert

On 02/01/2018 03:49 AM, Joshua Watt wrote:
> waf requires that the current working directory be the project root (in
> this case ${S} when it is invoked. The check to get the waf version was
> being executed as a prefunc for do_configure, which meant it was
> executed before the current working directory was switched to ${S}, and
> thus would fail with some recipes. Fix this by changing to ${S} before
> executing "waf --version"
> 
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>   meta/classes/waf.bbclass | 19 ++++++++++---------
>   1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/meta/classes/waf.bbclass b/meta/classes/waf.bbclass
> index c3e744e5dec..bdbdc56767c 100644
> --- a/meta/classes/waf.bbclass
> +++ b/meta/classes/waf.bbclass
> @@ -26,16 +26,17 @@ def get_waf_parallel_make(d):
>       return ""
>   
>   python waf_preconfigure() {
> +    import subprocess
>       from distutils.version import StrictVersion
> -    srcsubdir = d.getVar('S')
> -    wafbin = os.path.join(srcsubdir, 'waf')
> -    status, result = oe.utils.getstatusoutput(wafbin + " --version")
> -    if status != 0:
> -        bb.warn("Unable to execute waf --version, exit code %d. Assuming waf version without bindir/libdir support." % status)
> -        return
> -    version = result.split()[1]
> -    if StrictVersion(version) >= StrictVersion("1.8.7"):
> -        d.setVar("WAF_EXTRA_CONF", "--bindir=${bindir} --libdir=${libdir}")
> +    subsrcdir = d.getVar('S')
> +    wafbin = os.path.join(subsrcdir, 'waf')
> +    try:
> +        result = subprocess.check_output([wafbin, '--version'], cwd=subsrcdir, stderr=subprocess.STDOUT)
> +        version = result.decode('utf-8').split()[1]
> +        if StrictVersion(version) >= StrictVersion("1.8.7"):
> +            d.setVar("WAF_EXTRA_CONF", "--bindir=${bindir} --libdir=${libdir}")
> +    except subprocess.CalledProcessError as e:
> +        bb.warn("Unable to execute waf --version, exit code %d. Assuming waf version without bindir/libdir support." % e.returncode)
>   }
>   
>   do_configure[prefuncs] += "waf_preconfigure"
> 


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

* Re: [PATCH v2] waf.bbclass: cd to ${S} before checking version
  2018-02-11  8:35   ` Robert Yang
@ 2018-02-11 18:31     ` Joshua Watt
  0 siblings, 0 replies; 5+ messages in thread
From: Joshua Watt @ 2018-02-11 18:31 UTC (permalink / raw)
  To: Robert Yang; +Cc: jslater, Stefan Agner, OE-core

[-- Attachment #1: Type: text/plain, Size: 3406 bytes --]

On Feb 11, 2018 02:34, "Robert Yang" <liezhi.yang@windriver.com> wrote:

Hi Joshua,

This one causes the following 2 recipes failed to build:

meta-openembedded/meta-networking/recipes-support/libtalloc/
libtalloc_2.1.10.bb:do_configure
meta-openembedded/meta-networking/recipes-support/libtdb/libtdb_1.3.15.bb:
do_configure

The error messages are similar:

File: '/usr/lib/python3.4/subprocess.py', lineno: 1457, function:
_execute_child
     1453:                                # The error must be from
chdir(cwd).
     1454:                                err_msg += ': ' + repr(cwd)
     1455:                            else:
     1456:                                err_msg += ': ' +
repr(orig_executable)
 *** 1457:                    raise child_exception_type(errno_num, err_msg)
     1458:                raise child_exception_type(err_msg)
     1459:
     1460:
     1461:        def _handle_exitstatus(self, sts,
_WIFSIGNALED=os.WIFSIGNALED,
Exception: FileNotFoundError: [Errno 2] No such file or directory:
'/path/to/tmp-glibc/work/i586-wrs-linux/libtdb/1.3.15-r0/tdb-1.3.15/waf'

// Robert


Forgot to reply all.

I will look into this shortly, I think I know want needs to be done.



On 02/01/2018 03:49 AM, Joshua Watt wrote:

> waf requires that the current working directory be the project root (in
> this case ${S} when it is invoked. The check to get the waf version was
> being executed as a prefunc for do_configure, which meant it was
> executed before the current working directory was switched to ${S}, and
> thus would fail with some recipes. Fix this by changing to ${S} before
> executing "waf --version"
>
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>   meta/classes/waf.bbclass | 19 ++++++++++---------
>   1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/meta/classes/waf.bbclass b/meta/classes/waf.bbclass
> index c3e744e5dec..bdbdc56767c 100644
> --- a/meta/classes/waf.bbclass
> +++ b/meta/classes/waf.bbclass
> @@ -26,16 +26,17 @@ def get_waf_parallel_make(d):
>       return ""
>     python waf_preconfigure() {
> +    import subprocess
>       from distutils.version import StrictVersion
> -    srcsubdir = d.getVar('S')
> -    wafbin = os.path.join(srcsubdir, 'waf')
> -    status, result = oe.utils.getstatusoutput(wafbin + " --version")
> -    if status != 0:
> -        bb.warn("Unable to execute waf --version, exit code %d. Assuming
> waf version without bindir/libdir support." % status)
> -        return
> -    version = result.split()[1]
> -    if StrictVersion(version) >= StrictVersion("1.8.7"):
> -        d.setVar("WAF_EXTRA_CONF", "--bindir=${bindir}
> --libdir=${libdir}")
> +    subsrcdir = d.getVar('S')
> +    wafbin = os.path.join(subsrcdir, 'waf')
> +    try:
> +        result = subprocess.check_output([wafbin, '--version'],
> cwd=subsrcdir, stderr=subprocess.STDOUT)
> +        version = result.decode('utf-8').split()[1]
> +        if StrictVersion(version) >= StrictVersion("1.8.7"):
> +            d.setVar("WAF_EXTRA_CONF", "--bindir=${bindir}
> --libdir=${libdir}")
> +    except subprocess.CalledProcessError as e:
> +        bb.warn("Unable to execute waf --version, exit code %d. Assuming
> waf version without bindir/libdir support." % e.returncode)
>   }
>     do_configure[prefuncs] += "waf_preconfigure"
>
>

[-- Attachment #2: Type: text/html, Size: 4905 bytes --]

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

end of thread, other threads:[~2018-02-11 18:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-31 17:02 [PATCH] waf.bbclass: cd to ${S} before checking version Joshua Watt
2018-01-31 17:18 ` Burton, Ross
2018-01-31 19:49 ` [PATCH v2] " Joshua Watt
2018-02-11  8:35   ` Robert Yang
2018-02-11 18:31     ` Joshua Watt

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.