summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-02-24 14:18:42 +1100
committerChris Johns <chrisj@rtems.org>2016-02-24 17:34:54 +1100
commit773ab3fe068c492830245cab7eaa5fd4d843dc3b (patch)
tree76b5505f5c4483001a9fc29e3dd0ba7110aae71a
parentFix pkgconfig for MSYS to allow QEMU to build. (diff)
downloadrtems-source-builder-773ab3fe068c492830245cab7eaa5fd4d843dc3b.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.py20
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()))