[gnome-continuous] Ensure we pass the correct environment to ninja



commit b28c5a50eed6904026e3539579241237e429ddde
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Nov 29 20:04:53 2017 +0000

    Ensure we pass the correct environment to ninja
    
    When using make, we pass variables as arguments; for ninja, we need to
    put those variables into the environment.

 src/ostree-build-compile-one |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/ostree-build-compile-one b/src/ostree-build-compile-one
index e572d4e..e4aa865 100755
--- a/src/ostree-build-compile-one
+++ b/src/ostree-build-compile-one
@@ -233,10 +233,20 @@ def main(args):
     if buildfile_path is None:
         fatal("No build rules file found")
 
-    if use_ninja:
-        args = list(ninjaargs)
-    else:
+    if use_make:
         args = list(makeargs)
+        env = os.environ.copy()
+    else:
+        # While make supports passing variables using something like
+        # `make CC=foo`, ninja uses environment variables; this means
+        # we need to move make variables into the environment before
+        # calling ninja
+        args = list(ninjaargs)
+        env = os.environ.copy()
+        if 'CC' in makeargs:
+            env['CC'] = makeargs['CC']
+        if 'CXX' in makeargs:
+            env['CXX'] = makeargs['CXX']
 
     user_specified_jobs = False
     for arg in args:
@@ -254,7 +264,7 @@ def main(args):
             log("Didn't find NOTPARALLEL, using parallel make by default")
             args.extend(default_buildapi_jobs)
 
-    run_sync(args, cwd=builddir)
+    run_sync(args, cwd=builddir, env=env)
 
     if use_make:
         args = ['make', 'install', 'DESTDIR=' + ostbuild_resultdir]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]