changeset 6705:0cb1ac637dd0

Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
author Laurent Daynes <Laurent.Daynes@oracle.com>
date Mon, 12 Nov 2012 13:04:08 +0100
parents 4d6c13994690
children e9e724ea5097 cce59a7ee92c
files mx/commands.py
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mx/commands.py	Mon Nov 12 13:02:43 2012 +0100
+++ b/mx/commands.py	Mon Nov 12 13:04:08 2012 +0100
@@ -78,6 +78,14 @@
 
 """
 
+def _chmodDir(chmodFlags, dirname, fnames):
+    os.chmod(dirname, chmodFlags)
+    for file in fnames:
+        os.chmod(os.path.join(dirname, file), chmodFlags)
+
+def chmodRecursive(dirname, chmodFlags):
+    os.path.walk(dirname, _chmodDir, chmodFlags)
+
 def clean(args):
     """clean the GraalVM source tree"""
     opts = mx.clean(args, parser=ArgumentParser(prog='mx clean'))
@@ -349,8 +357,7 @@
 
             assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg
             if mx.get_os() != 'windows':
-                os.chmod(_vmLibDirInJdk(jdk), 0755)
-                os.chmod(jvmCfg, 0755)
+                chmodRecursive(jdk, 0755)
             shutil.copytree(join(_vmLibDirInJdk(jdk), defaultVM), join(_vmLibDirInJdk(jdk), defaultVM + '0'))
 
             with open(jvmCfg, 'w') as f:
@@ -465,7 +472,7 @@
         vmDir = join(_vmLibDirInJdk(jdk), vm)
         if not exists(vmDir):
             if mx.get_os() != 'windows':
-                os.chmod(_vmLibDirInJdk(jdk), 0755)
+                chmodRecursive(jdk, 0755)
             mx.log('Creating VM directory in JDK7: ' + vmDir)
             os.makedirs(vmDir)