Mercurial > hg > truffle
comparison mx/mx_graal.py @ 16627:68deb37eed70
mx: fix permissions of copied bootstrap JDK files (don't make everything executable)
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Thu, 31 Jul 2014 12:00:23 +0200 |
parents | addc0564e5b5 |
children | d3fec84757ed |
comparison
equal
deleted
inserted
replaced
16626:7ce626e1952c | 16627:68deb37eed70 |
---|---|
80 | 80 |
81 _make_eclipse_launch = False | 81 _make_eclipse_launch = False |
82 | 82 |
83 _minVersion = mx.VersionSpec('1.8') | 83 _minVersion = mx.VersionSpec('1.8') |
84 | 84 |
85 JDK_UNIX_PERMISSIONS = 0755 | 85 JDK_UNIX_PERMISSIONS_DIR = 0755 |
86 JDK_UNIX_PERMISSIONS_FILE = 0644 | |
86 | 87 |
87 def isVMSupported(vm): | 88 def isVMSupported(vm): |
88 if 'client' in vm and len(platform.mac_ver()[0]) != 0: | 89 if 'client' in vm and len(platform.mac_ver()[0]) != 0: |
89 # Client VM not supported: java launcher on Mac OS X translates '-client' to '-server' | 90 # Client VM not supported: java launcher on Mac OS X translates '-client' to '-server' |
90 return False | 91 return False |
136 def __exit__(self, exc_type, exc_value, traceback): | 137 def __exit__(self, exc_type, exc_value, traceback): |
137 global _vm, _vmbuild | 138 global _vm, _vmbuild |
138 _vm = self.previousVm | 139 _vm = self.previousVm |
139 _vmbuild = self.previousBuild | 140 _vmbuild = self.previousBuild |
140 | 141 |
141 def _chmodDir(chmodFlags, dirname, fnames): | 142 def chmodRecursive(dirname, chmodFlagsDir): |
142 os.chmod(dirname, chmodFlags) | 143 def _chmodDir(chmodFlags, dirname, fnames): |
143 for name in fnames: | 144 os.chmod(dirname, chmodFlagsDir) |
144 os.chmod(os.path.join(dirname, name), chmodFlags) | 145 |
145 | 146 os.path.walk(dirname, _chmodDir, chmodFlagsDir) |
146 def chmodRecursive(dirname, chmodFlags): | |
147 os.path.walk(dirname, _chmodDir, chmodFlags) | |
148 | 147 |
149 def clean(args): | 148 def clean(args): |
150 """clean the GraalVM source tree""" | 149 """clean the GraalVM source tree""" |
151 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean')) | 150 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean')) |
152 | 151 |
414 else: | 413 else: |
415 jvmCfgLines += [line] | 414 jvmCfgLines += [line] |
416 | 415 |
417 assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg | 416 assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg |
418 if mx.get_os() != 'windows': | 417 if mx.get_os() != 'windows': |
419 chmodRecursive(jdk, JDK_UNIX_PERMISSIONS) | 418 chmodRecursive(jdk, JDK_UNIX_PERMISSIONS_DIR) |
420 shutil.move(join(_vmLibDirInJdk(jdk), defaultVM), join(_vmLibDirInJdk(jdk), 'original')) | 419 shutil.move(join(_vmLibDirInJdk(jdk), defaultVM), join(_vmLibDirInJdk(jdk), 'original')) |
421 | 420 |
422 | 421 |
423 with open(jvmCfg, 'w') as fp: | 422 with open(jvmCfg, 'w') as fp: |
424 for line in jvmCfgLines: | 423 for line in jvmCfgLines: |
541 # do a copy and then a move to get atomic updating (on Unix) | 540 # do a copy and then a move to get atomic updating (on Unix) |
542 fd, tmp = tempfile.mkstemp(suffix='', prefix=name, dir=dstDir) | 541 fd, tmp = tempfile.mkstemp(suffix='', prefix=name, dir=dstDir) |
543 shutil.copyfile(srcJar, tmp) | 542 shutil.copyfile(srcJar, tmp) |
544 os.close(fd) | 543 os.close(fd) |
545 shutil.move(tmp, dstJar) | 544 shutil.move(tmp, dstJar) |
546 os.chmod(dstJar, JDK_UNIX_PERMISSIONS) | 545 os.chmod(dstJar, JDK_UNIX_PERMISSIONS_FILE) |
547 | 546 |
548 install(distJar, jreLibDir) | 547 install(distJar, jreLibDir) |
549 if dist.sourcesPath: | 548 if dist.sourcesPath: |
550 install(dist.sourcesPath, join(jdks, e)) | 549 install(dist.sourcesPath, join(jdks, e)) |
551 | 550 |
745 continue | 744 continue |
746 | 745 |
747 vmDir = join(_vmLibDirInJdk(jdk), vm) | 746 vmDir = join(_vmLibDirInJdk(jdk), vm) |
748 if not exists(vmDir): | 747 if not exists(vmDir): |
749 if mx.get_os() != 'windows': | 748 if mx.get_os() != 'windows': |
750 chmodRecursive(jdk, JDK_UNIX_PERMISSIONS) | 749 chmodRecursive(jdk, JDK_UNIX_PERMISSIONS_DIR) |
751 mx.log('Creating VM directory in JDK: ' + vmDir) | 750 mx.log('Creating VM directory in JDK: ' + vmDir) |
752 os.makedirs(vmDir) | 751 os.makedirs(vmDir) |
753 | 752 |
754 def filterXusage(line): | 753 def filterXusage(line): |
755 if not 'Xusage.txt' in line: | 754 if not 'Xusage.txt' in line: |
879 lines.append(line) | 878 lines.append(line) |
880 | 879 |
881 if not found: | 880 if not found: |
882 mx.log('Appending "' + prefix + 'KNOWN" to ' + jvmCfg) | 881 mx.log('Appending "' + prefix + 'KNOWN" to ' + jvmCfg) |
883 if mx.get_os() != 'windows': | 882 if mx.get_os() != 'windows': |
884 os.chmod(jvmCfg, JDK_UNIX_PERMISSIONS) | 883 os.chmod(jvmCfg, JDK_UNIX_PERMISSIONS_FILE) |
885 with open(jvmCfg, 'w') as f: | 884 with open(jvmCfg, 'w') as f: |
886 for line in lines: | 885 for line in lines: |
887 if line.startswith(prefix): | 886 if line.startswith(prefix): |
888 line = vmKnown | 887 line = vmKnown |
889 found = True | 888 found = True |