[rtems-source-builder commit] Fix sb-bootrap to run on Windows using MSYS2.

Chris Johns chrisj at rtems.org
Wed Feb 24 06:37:26 UTC 2016


Module:    rtems-source-builder
Branch:    4.11
Commit:    773ab3fe068c492830245cab7eaa5fd4d843dc3b
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=773ab3fe068c492830245cab7eaa5fd4d843dc3b

Author:    Chris Johns <chrisj at rtems.org>
Date:      Wed Feb 24 14:18:42 2016 +1100

Fix sb-bootrap to run on Windows using MSYS2.

Prepend 'sh' to the command so the autoreconf runs in a shell.

Is the first item in the path is a reference to MSYS2 remove it.

Closes #2613.

---

 source-builder/sb/bootstrap.py | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/source-builder/sb/bootstrap.py b/source-builder/sb/bootstrap.py
index 15bd7f5..42ce4dc 100644
--- a/source-builder/sb/bootstrap.py
+++ b/source-builder/sb/bootstrap.py
@@ -86,13 +86,17 @@ class command:
         self.exit_code = 0
         try:
             try:
-                self.output = subprocess.check_output(self.cmd, cwd = self.cwd)
+                if os.name == 'nt':
+                    cmd = ['sh', '-c'] + self.cmd
+                else:
+                    cmd = self.cmd
+                self.output = subprocess.check_output(cmd, cwd = path.host(self.cwd))
             except subprocess.CalledProcessError, cpe:
                 self.exit_code = cpe.returncode
                 self.output = cpe.output
             except OSError, ose:
                 raise error.general('bootstrap failed: %s in %s: %s' % \
-                                        (' '.join(self.cmd), self.cwd, (str(ose))))
+                                        (' '.join(cmd), path.host(self.cwd), (str(ose))))
             except KeyboardInterrupt:
                 pass
             except:
@@ -240,6 +244,18 @@ def preinstall(topdir, jobs):
 
 def run(args):
     try:
+        #
+        # On Windows MSYS2 prepends a path to itself to the environment
+        # path. This means the RTEMS specific automake is not found and which
+        # breaks the bootstrap. We need to remove the prepended path. Also
+        # remove any ACLOCAL paths from the environment.
+        #
+        if os.name == 'nt':
+            cspath = os.environ['PATH'].split(os.pathsep)
+            if 'msys' in cspath[0] and cspath[0].endswith('bin'):
+                os.environ['PATH'] = os.pathsep.join(cspath[1:])
+            if 'ACLOCAL_PATH' in os.environ:
+                os.environ['ACLOCAL_PATH'].clear()
         optargs = { '--rtems':       'The RTEMS source directory',
                     '--preinstall':  'Preinstall AM generation' }
         log.notice('RTEMS Source Builder - RTEMS Bootstrap, %s' % (version.str()))



More information about the vc mailing list