diff options
author | Chris Johns <chrisj@rtems.org> | 2016-02-24 14:18:42 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2016-02-24 17:33:08 +1100 |
commit | d897e93e49aba81d26989c2d8a58ac2e0c407cf5 (patch) | |
tree | ebc1c58db283d2c7d33a3213b5af2d1b6e2b7bf2 | |
parent | Fix pkgconfig for MSYS to allow QEMU to build. (diff) | |
download | rtems-source-builder-d897e93e49aba81d26989c2d8a58ac2e0c407cf5.tar.bz2 |
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.
-rw-r--r-- | source-builder/sb/bootstrap.py | 20 |
1 files 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())) |