Bug 1269517 - Fix various environment variables that may contain posix-style paths when invoking the js subconfigure. r=glandium draft
authorChris Manchester <cmanchester@mozilla.com>
Fri, 22 Jul 2016 10:39:36 -0700
changeset 391393 833ebe8a00fd407077184b9d8003f9cc7247da85
parent 391305 e0bc88708ffed39aaab1fbc0ac461d93561195de
child 391394 dc35e9900926d7557f8b62b87c50b0c2d24add68
push id23897
push usercmanchester@mozilla.com
push dateFri, 22 Jul 2016 17:39:54 +0000
reviewersglandium
bugs1269517
milestone50.0a1
Bug 1269517 - Fix various environment variables that may contain posix-style paths when invoking the js subconfigure. r=glandium MozReview-Commit-ID: IuxdjO2P9aQ
build/subconfigure.py
--- a/build/subconfigure.py
+++ b/build/subconfigure.py
@@ -201,26 +201,29 @@ def prepare(srcdir, objdir, shell, args)
     if os.path.exists(data_file):
         with open(data_file, 'rb') as f:
             data = pickle.load(f)
             previous_args = data['args']
 
     # Msys likes to break environment variables and command line arguments,
     # so read those from stdin, as they are passed from the configure script
     # when necessary (on windows).
-    # However, for some reason, $PATH is not handled like other environment
-    # variables, and msys remangles it even when giving it is already a msys
-    # $PATH. Fortunately, the mangling/demangling is just find for $PATH, so
-    # we can just take the value from the environment. Msys will convert it
-    # back properly when calling subconfigure.
     input = sys.stdin.read()
     if input:
         data = {a: b for [a, b] in eval(input)}
         environ = {a: b for a, b in data['env']}
-        environ['PATH'] = os.environ['PATH']
+        # These environment variables as passed from old-configure may contain
+        # posix-style paths, which will not be meaningful to the js
+        # subconfigure, which runs as a native python process, so use their
+        # values from the environment. In the case of autoconf implemented
+        # subconfigures, Msys will re-convert them properly.
+        for var in ('HOME', 'TERM', 'PATH', 'TMPDIR', 'TMP',
+                    'TEMP', 'INCLUDE'):
+            if var in environ and var in os.environ:
+                environ[var] = os.environ[var]
         args = data['args']
     else:
         environ = os.environ
 
     args, others = parser.parse_known_args(args)
 
     data = {
         'target': args.target,