Patchwork [08/18] Force somes env variables when use python process run and use DYLD_LIBRARY_PATH for darwin build machine

login
register
mail settings
Submitter Yann Diorcet
Date Oct. 21, 2012, 3:27 p.m.
Message ID <1350833261-8401-8-git-send-email-diorcet.yann@gmail.com>
Download mbox | patch
Permalink /patch/193014/
State Under Review
Delegated to: Esben Haabendal
Headers show

Comments

Yann Diorcet - Oct. 21, 2012, 3:27 p.m.
From: Yann Diorcet <yann.diorcet@belledonne-communications.com>

Force few env variables. On darwin the commands fail if this variables are not set
---
 lib/oelite/fetch/fetch.py |    8 ++++----
 lib/oelite/function.py    |   11 +++++++----
 2 files changed, 11 insertions(+), 8 deletions(-)
Esben Haabendal - Feb. 27, 2013, 1:45 p.m.
Yann Diorcet <diorcet.yann@gmail.com> writes:

> diff --git a/lib/oelite/function.py b/lib/oelite/function.py
> index 10b1e73..a835631 100644
> --- a/lib/oelite/function.py
> +++ b/lib/oelite/function.py
> @@ -172,12 +172,15 @@ class ShellFunction(OEliteFunction):
>          runfile.write("set -x\n")
>          ld_library_path = self.meta.get("LD_LIBRARY_PATH")
>          flags = self.meta.get_flags("LD_LIBRARY_PATH")
> +        ld_library_path_var = "LD_LIBRARY_PATH"
> +        if self.meta.get("BUILD_OS") == "darwin":
> +            ld_library_path_var = "DYLD_LIBRARY_PATH"
>          if self.ld_library_path:
>              # Prepend already existing content of LD_LIBRARY_PATH only if its set
> -            runfile.write("if [ $LD_LIBRARY_PATH ]; then \
> -				export LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH:" + self.ld_library_path + "\" ;\
> +            runfile.write("if [ $" + ld_library_path_var + " ]; then \
> +				export " + ld_library_path_var + "=\"$" + ld_library_path_var + ":" + self.ld_library_path + "\" ;\
>  			   else \
> -				export LD_LIBRARY_PATH=\"" + self.ld_library_path + "\" ;\
> +				export " + ld_library_path_var + "=\"" + self.ld_library_path + "\" ;\
>  			   fi\n")
>          runfile.write("cd %s\n"%(os.getcwd()))
>          runfile.write("%s\n"%(self.name))

As the LD_LIBRARY_PATH handling have changed since your patch, I have
made a new commit on master branch which I believe achives the same.

Let me know if it solves the problem or not.

The rest of the patch (dealing with shell environment variable passing
on darwin is not merged yet).

/Esben

Patch

diff --git a/lib/oelite/fetch/fetch.py b/lib/oelite/fetch/fetch.py
index 31bc037..135de09 100644
--- a/lib/oelite/fetch/fetch.py
+++ b/lib/oelite/fetch/fetch.py
@@ -263,7 +263,7 @@  class OEliteUri:
         finally:
             if cwd:
                 os.chdir(cwd)
-        rc = oe.process.run(cmd)
+        rc = oe.process.run(cmd, None, env = {"PWD": d.get("PWD"), "PATH" : d.get("PATH")})
         return rc == 0
 
     def srcpath(self, d):
@@ -286,8 +286,8 @@  class OEliteUri:
         with open("%s/series"%(d.get("PATCHDIR")), "a") as series:
             series.write("%s -p%s\n"%(
                     self.patchpath(d), self.params["striplevel"]))
-
-        rc = oe.process.run("quilt -v --quiltrc %s push"%(d.get("QUILTRC")))
+        
+        rc = oe.process.run("quilt -v --quiltrc %s push"%(d.get("QUILTRC")), None, env = {"PWD": d.get("PWD"), "PATH" : d.get("PATH")})
         if rc != 0:
             # FIXME: proper error handling
             raise Exception("quilt push failed: %d"%(rc))
@@ -306,7 +306,7 @@  def patch_init(d):
     os.chdir(s)
     if os.path.exists(".pc"):
         while os.path.exists(".pc/applied-patches"):
-            rc = oe.process.run("quilt -v --quiltrc %s pop"%(quiltrc))
+            rc = oe.process.run("quilt -v --quiltrc %s pop"%(quiltrc), None, env = {"PATH" : d.get("PATH")})
             if rc != 0:
                 # FIXME: proper error handling
                 raise Exception("quilt pop failed")
diff --git a/lib/oelite/function.py b/lib/oelite/function.py
index 10b1e73..a835631 100644
--- a/lib/oelite/function.py
+++ b/lib/oelite/function.py
@@ -172,12 +172,15 @@  class ShellFunction(OEliteFunction):
         runfile.write("set -x\n")
         ld_library_path = self.meta.get("LD_LIBRARY_PATH")
         flags = self.meta.get_flags("LD_LIBRARY_PATH")
+        ld_library_path_var = "LD_LIBRARY_PATH"
+        if self.meta.get("BUILD_OS") == "darwin":
+            ld_library_path_var = "DYLD_LIBRARY_PATH"
         if self.ld_library_path:
             # Prepend already existing content of LD_LIBRARY_PATH only if its set
-            runfile.write("if [ $LD_LIBRARY_PATH ]; then \
-				export LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH:" + self.ld_library_path + "\" ;\
+            runfile.write("if [ $" + ld_library_path_var + " ]; then \
+				export " + ld_library_path_var + "=\"$" + ld_library_path_var + ":" + self.ld_library_path + "\" ;\
 			   else \
-				export LD_LIBRARY_PATH=\"" + self.ld_library_path + "\" ;\
+				export " + ld_library_path_var + "=\"" + self.ld_library_path + "\" ;\
 			   fi\n")
         runfile.write("cd %s\n"%(os.getcwd()))
         runfile.write("%s\n"%(self.name))
@@ -187,5 +190,5 @@  class ShellFunction(OEliteFunction):
         if self.meta.get_flag(self.name, "fakeroot"):
             cmd = "%s "%(self.meta.get("FAKEROOT") or "fakeroot") + cmd
         cmd = "LC_ALL=C " + cmd
-        rc = oe.process.run(cmd)
+        rc = oe.process.run(cmd, None, env = {"PWD": self.meta.get("PWD"), "PATH" : self.meta.get("PATH")})
         return rc == 0