[OE-core] [PATCH] waf.bbclass: cd to ${S} before checking version

Burton, Ross ross.burton at intel.com
Wed Jan 31 17:18:09 UTC 2018


On 31 January 2018 at 17:02, Joshua Watt <jpewhacker at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20180131/fa61157a/attachment-0002.html>


More information about the Openembedded-core mailing list