ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject ant git commit: user setpermissions rather than chmod
Date Sun, 17 Apr 2016 16:05:44 GMT
Repository: ant
Updated Branches:
  refs/heads/master cee2935c7 -> c7d9b17b0


user setpermissions rather than chmod


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/c7d9b17b
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/c7d9b17b
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/c7d9b17b

Branch: refs/heads/master
Commit: c7d9b17b080fc5250fc05144322ecc3eef8a6e87
Parents: cee2935
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Sun Apr 17 18:05:22 2016 +0200
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Sun Apr 17 18:05:22 2016 +0200

----------------------------------------------------------------------
 build.xml                                       | 50 +++++++++++---------
 src/tests/antunit/taskdefs/copy-test.xml        | 22 +++------
 src/tests/antunit/taskdefs/move-test.xml        | 11 ++---
 .../resources/selectors/readwrite-test.xml      | 11 ++---
 .../antunit/types/selectors/executable-test.xml | 11 ++---
 .../antunit/types/selectors/readwrite-test.xml  | 11 ++---
 6 files changed, 51 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/c7d9b17b/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index d99016f..477a0be 100644
--- a/build.xml
+++ b/build.xml
@@ -100,8 +100,7 @@
        ===================================================================
   -->
   <property name="debug" value="true"/>
-  <property name="chmod.fail" value="true"/>
-  <property name="chmod.maxparallel" value="250"/>
+  <property name="setpermissions.fail" value="true"/>
   <property name="deprecation" value="false"/>
   <property name="optimize" value="true"/>
   <property name="javac.target" value="1.8"/>
@@ -914,18 +913,20 @@
       <include name="*.pl"/>
     </fixcrlf>
 
-    <chmod perm="ugo+rx" dir="${dist.dir}" type="dir" includes="**"
-      failonerror="${chmod.fail}"/>
-    <chmod perm="ugo+r" dir="${dist.dir}" type="file" includes="**"
-      failonerror="${chmod.fail}" maxparallel="${chmod.maxparallel}"/>
-    <chmod perm="ugo+x" type="file" failonerror="${chmod.fail}">
+    <setpermissions mode="755" failonerror="${setpermissions.fail}">
+      <dirset dir="${dist.dir}"/>
+    </setpermissions>
+    <setpermissions mode="644" failonerror="${setpermissions.fail}">
+      <fileset dir="${dist.dir}"/>
+    </setpermissions>
+    <setpermissions mode="755" failonerror="${setpermissions.fail}">
       <fileset dir="${dist.bin}">
         <include name="**/ant"/>
         <include name="**/antRun"/>
         <include name="**/*.pl"/>
         <include name="**/*.py"/>
       </fileset>
-    </chmod>
+    </setpermissions>
 
   </target>
 
@@ -1026,18 +1027,20 @@
       </fileset>
     </copy>
 
-    <chmod perm="ugo+rx" dir="${dist.dir}" type="dir" includes="**"
-      failonerror="${chmod.fail}"/>
-    <chmod perm="ugo+r" dir="${dist.dir}" type="file" includes="**"
-      failonerror="${chmod.fail}" maxparallel="${chmod.maxparallel}"/>
-    <chmod perm="ugo+x" type="file" failonerror="${chmod.fail}">
+    <setpermissions mode="755" failonerror="${setpermissions.fail}">
+      <dirset dir="${dist.dir}"/>
+    </setpermissions>
+    <setpermissions mode="644" failonerror="${setpermissions.fail}">
+      <fileset dir="${dist.dir}"/>
+    </setpermissions>
+    <setpermissions mode="755" failonerror="${setpermissions.fail}">
       <fileset dir="${dist.bin}">
         <include name="**/ant"/>
         <include name="**/antRun"/>
         <include name="**/*.pl"/>
         <include name="**/*.py"/>
       </fileset>
-    </chmod>
+    </setpermissions>
 
     <!-- publish some useful stylesheets -->
     <copy todir="${dist.etc}">
@@ -1144,18 +1147,21 @@
       <exclude name="${tests.etc.dir}/taskdefs/fixcrlf/input/Junk?.java"/>
     </fixcrlf>
 
-    <chmod perm="ugo+x" dir="${src.dist.dir}" type="dir"
-      failonerror="${chmod.fail}"/>
-    <chmod perm="ugo+r" dir="${src.dist.dir}" failonerror="${chmod.fail}"/>
-    <chmod perm="ugo+x" failonerror="${chmod.fail}">
+    <setpermissions mode="755" failonerror="${setpermissions.fail}">
+      <dirset dir="${src.dist.dir}"/>
+    </setpermissions>
+    <setpermissions mode="644" failonerror="${setpermissions.fail}">
+      <fileset dir="${src.dist.dir}"/>
+    </setpermissions>
+    <setpermissions mode="755" failonerror="${setpermissions.fail}">
       <fileset dir="${src.dist.dir}">
-        <include name="**/.sh"/>
-        <include name="**/.pl"/>
-        <include name="**/.py"/>
+        <include name="**/*.sh"/>
+        <include name="**/*.pl"/>
+        <include name="**/*.py"/>
         <include name="**/ant"/>
         <include name="**/antRun"/>
       </fileset>
-    </chmod>
+    </setpermissions>
 
   </target>
 

http://git-wip-us.apache.org/repos/asf/ant/blob/c7d9b17b/src/tests/antunit/taskdefs/copy-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/taskdefs/copy-test.xml b/src/tests/antunit/taskdefs/copy-test.xml
index 51c6277..05e947c 100644
--- a/src/tests/antunit/taskdefs/copy-test.xml
+++ b/src/tests/antunit/taskdefs/copy-test.xml
@@ -312,13 +312,10 @@ public class NullByteStreamResource extends Resource {
     <mkdir dir="${input}"/>
     <touch file="${output}/${file}"/>
   </target>
-  <target name="makeFileUnwritable"
-          depends="createTestdir,makeFileUnwritable-Unix,makeFileUnwritable-Windows"/>
-  <target name="makeFileUnwritable-Unix" id="unix">
-    <chmod file="${output}/${file}" perm="444"/>
-  </target>
-  <target name="makeFileUnwritable-Windows" unless="unix">
-    <attrib file="${output}/${file}" readonly="true"/>
+  <target name="makeFileUnwritable" depends="createTestdir">
+    <setpermissions mode="444">
+      <file file="${output}/${file}"/>
+    </setpermissions>
   </target>
 
   <target name="testCopyOverReadOnlyFile" depends="makeFileUnwritable">
@@ -453,14 +450,9 @@ public class NullByteStreamResource extends Resource {
     <mkdir dir="${output}"/>
     <touch file="${input}/somefile"/>
     <touch file="${output}/somefile"/>
-    <exec executable="chmod" osfamily="unix">
-      <arg value="-w"/>
-      <arg file="${output}/somefile"/>
-    </exec>
-    <exec executable="attrib" osfamily="dos">
-      <arg value="+r"/>
-      <arg file="${output}/somefile"/>
-    </exec>
+    <setpermissions mode="444">
+      <file file="${output}/somefile"/>
+    </setpermissions>
     <au:expectfailure>
       <copy todir="${output}" file="${input}/somefile"
             overwrite="true"/>

http://git-wip-us.apache.org/repos/asf/ant/blob/c7d9b17b/src/tests/antunit/taskdefs/move-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/taskdefs/move-test.xml b/src/tests/antunit/taskdefs/move-test.xml
index 9acac74..bc29aa4 100644
--- a/src/tests/antunit/taskdefs/move-test.xml
+++ b/src/tests/antunit/taskdefs/move-test.xml
@@ -134,13 +134,10 @@
     <mkdir dir="${input}"/>
     <touch file="${output}/${file}"/>
   </target>
-  <target name="makeFileUnwritable"
-          depends="createTestdir,makeFileUnwritable-Unix,makeFileUnwritable-Windows"/>
-  <target name="makeFileUnwritable-Unix" id="unix">
-    <chmod file="${output}/${file}" perm="444"/>
-  </target>
-  <target name="makeFileUnwritable-Windows" unless="unix">
-    <attrib file="${output}/${file}" readonly="true"/>
+  <target name="makeFileUnwritable" depends="createTestdir">
+    <setpermissions mode="444">
+      <file file="${output}/${file}"/>
+    </setpermissions>
   </target>
 
   <target name="testMoveOverReadOnlyFile" depends="makeFileUnwritable">

http://git-wip-us.apache.org/repos/asf/ant/blob/c7d9b17b/src/tests/antunit/types/resources/selectors/readwrite-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/types/resources/selectors/readwrite-test.xml b/src/tests/antunit/types/resources/selectors/readwrite-test.xml
index 6a0301b..dfe2d70 100644
--- a/src/tests/antunit/types/resources/selectors/readwrite-test.xml
+++ b/src/tests/antunit/types/resources/selectors/readwrite-test.xml
@@ -70,13 +70,10 @@
     </au:assertTrue>
   </target>
 
-  <target name="makeFileUnwritable"
-          depends="createTestdir,makeFileUnwritable-Unix,makeFileUnwritable-Windows"/>
-  <target name="makeFileUnwritable-Unix" id="unix">
-    <chmod file="${output}/${file}" perm="444"/>
-  </target>
-  <target name="makeFileUnwritable-Windows" unless="unix">
-    <attrib file="${output}/${file}" readonly="true"/>
+  <target name="makeFileUnwritable" depends="createTestdir">
+    <setpermissions mode="444">
+      <file file="${output}/${file}"/>
+    </setpermissions>
   </target>
 
   <target name="testUnwritable" depends="makeFileUnwritable">

http://git-wip-us.apache.org/repos/asf/ant/blob/c7d9b17b/src/tests/antunit/types/selectors/executable-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/types/selectors/executable-test.xml b/src/tests/antunit/types/selectors/executable-test.xml
index c78b5b1..4eb8785 100644
--- a/src/tests/antunit/types/selectors/executable-test.xml
+++ b/src/tests/antunit/types/selectors/executable-test.xml
@@ -47,13 +47,10 @@
     </au:assertTrue>
   </target>
 
-  <target name="makeFileExecutable"
-          depends="createTestdir,makeFileExecutable-Unix,makeFileExecutable-Windows"/>
-  <target name="makeFileExecutable-Unix" if="unix">
-    <chmod file="${output}/${file}" perm="755"/>
-  </target>
-  <target name="makeFileExecutable-Windows" unless="unix">
-    <!-- no idea how to do this -->
+  <target name="makeFileExecutable" depends="createTestdir">
+    <setpermissions mode="755">
+      <file file="${output}/${file}"/>
+    </setpermissions>
   </target>
 
   <target name="testNotexecutable" depends="createTestdir" if="unix">

http://git-wip-us.apache.org/repos/asf/ant/blob/c7d9b17b/src/tests/antunit/types/selectors/readwrite-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/types/selectors/readwrite-test.xml b/src/tests/antunit/types/selectors/readwrite-test.xml
index ac27519..f81518a 100644
--- a/src/tests/antunit/types/selectors/readwrite-test.xml
+++ b/src/tests/antunit/types/selectors/readwrite-test.xml
@@ -64,13 +64,10 @@
     </au:assertTrue>
   </target>
 
-  <target name="makeFileUnwritable"
-          depends="createTestdir,makeFileUnwritable-Unix,makeFileUnwritable-Windows"/>
-  <target name="makeFileUnwritable-Unix" if="unix">
-    <chmod file="${output}/${file}" perm="444"/>
-  </target>
-  <target name="makeFileUnwritable-Windows" unless="unix">
-    <attrib file="${output}/${file}" readonly="true"/>
+  <target name="makeFileUnwritable" depends="createTestdir">
+    <setpermissions mode="444">
+      <file file="${output}/${file}"/>
+    </setpermissions>
   </target>
 
   <target name="testUnwritable" depends="makeFileUnwritable">


Mime
View raw message