On 12/13/2010 01:54 PM, Graham Gower wrote:
> From 255e7ecc17fa28b7eeb1e102dc42ca4747f8ab68 Mon Sep 17 00:00:00 2001
> From: Graham Gower <[email protected]>
> Date: Mon, 13 Dec 2010 13:51:26 +1030
> Subject: [PATCH] build: Change working directory for shell functions.
> 
> This was broken by 53740977521bc81ffa37adfa7bbeb8f2a80ea165.
> 
> Signed-off-by: Graham Gower <[email protected]>
> ---
>  lib/bb/build.py |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/lib/bb/build.py b/lib/bb/build.py
> index 2a0c2b6..b44ebf0 100644
> --- a/lib/bb/build.py
> +++ b/lib/bb/build.py
> @@ -240,6 +240,8 @@ def exec_func_shell(function, d, runfile, logfile, 
> cwd=None, fakeroot=False):
>              script.write("set -x\n")
>          data.emit_env(script, d)
>  
> +        if cwd:
> +            script.write("cd %s\n" % cwd);
>          script.write("%s\n" % function)
>          os.fchmod(script.fileno(), 0775)
>  

The problem I'm seeing is visible when building mtdutils or pcmciautils.
Both of these programs use $PWD in their Makefiles. subprocess.Popen() calls
os.chdir() to change the directory which does not set PWD, so PWD was
inherited from the current path bitbake is invoked from. Previously, PWD
was updated when the shell called 'cd foo'.

Perhaps the below diff is more palatable?


diff --git a/lib/bb/build.py b/lib/bb/build.py
index 2a0c2b6..8e245cf 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -234,6 +234,9 @@ def exec_func_shell(function, d, runfile, logfile, 
cwd=None, fakeroot=False):
     item in the list is where we will chdir/cd to.
     """
 
+    if cwd:
+        data.setVar("PWD", cwd, d)
+
     with open(runfile, 'w') as script:
         script.write('#!/bin/sh -e\n')
         if logger.getEffectiveLevel() <= logging.DEBUG:

_______________________________________________
Bitbake-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bitbake-dev

Reply via email to