Guys, Before you freeze, these 2 will be handy. I don't know when you're gonna freeze the cvs tree, but I was also working on chrights (which calls chmod, chgrp and chown), but I still have a little trouble calling them... Any tips are appreciated. I could also make chrights so it's works on his own and that we deprecate the chmod in 1.3. I attached the 2, with a little "test" xml file, which shows its functionality. chrights is also in there as a test, with the properties I had in mind.
Mvgr, Martin van den Bemt mvdb.com
Chown.java
Description: Binary data
Chgrp.java
Description: Binary data
<?xml version="1.0"?>
<!-- ============================================================================ -->
<!-- Test buildfile for Chrights,chmod,chgrp and chown -->
<!-- After one of the tests or test combined you should end up with : -->
<!-- the owner set to the value in property test.owner on all .txt files -->
<!-- the group set to the value in property test.group on all .txt files -->
<!-- the permissions set to the value in property test.perm on all .txt files -->
<!-- If this doesn't work there are a couple of possibilities : -->
<!-- * You didn't read the docs on chmod, it's depending on Unix to work -->
<!-- * You didn't read the returned output (it returns the error messages) -->
<!-- * I ([EMAIL PROTECTED]) only tested this on my machines (linux and Windows) and -->
<!-- my machines are not representative for this test... -->
<!-- ============================================================================ -->
<project name="Ant" default="help" basedir=".">
<!-- =================================================================== -->
<!-- Define a global set of patterns that can be referenced by -->
<!-- its id attribute -->
<!-- =================================================================== -->
<patternset id="all.patterns">
<include name="**/*.txt" />
<exclude name="**/*.tmp" />
</patternset>
<property name="test.dir" value="test/"/>
<!-- change this accordingly. The perm should work though, by if you want that?? -->
<!-- most apache users will probably of the group nobody... -->
<property name="test.owner" value="nobody"/>
<property name="test.group" value="nobody"/>
<property name="test.perm" value="777"/>
<!-- =================================================================== -->
<!-- Prepares the test directory -->
<!-- =================================================================== -->
<target name="prepare">
<mkdir dir="${test.dir}"/>
<tstamp />
<touch file="${test.dir}1.txt"/>
<touch file="${test.dir}2.txt"/>
<touch file="${test.dir}3.txt"/>
<touch file="${test.dir}4.txt"/>
<touch file="${test.dir}5.txt"/>
<touch file="${test.dir}1.tmp"/>
<touch file="${test.dir}2.tmp"/>
<touch file="${test.dir}3.tmp"/>
<touch file="${test.dir}4.tmp"/>
<touch file="${test.dir}5.tmp"/>
</target>
<!-- =================================================================== -->
<!-- Supply some help ont these options -->
<!-- =================================================================== -->
<target name="help" description="Nothing to do ;-))">
<echo message="Please use these cmdline options to test :"/>
<echo message="chmod : tests the chmod task"/>
<echo message="chown : tests the chown task"/>
<echo message="chgrp : tests the chgrp task"/>
<echo message="all : test above 3"/>
<echo message="chrights : test all with chrights task"/>
<echo message="See the top of this build file for correct results of the tests"/>
</target>
<!-- =================================================================== -->
<!-- Tests all tasks, except chrights See above for correct results -->
<!-- =================================================================== -->
<target name="all" depends="clean,prepare,chmod,chown,chgrp" description="Tests all tasks, except chrights">
<echo message="Testing all tasks"/>
</target>
<!-- =================================================================== -->
<!-- Test chrights See above for correct results -->
<!-- =================================================================== -->
<target name="chrights" depends="prepare" description="Does a chrights on the testdir">
<chrights owner="" group="" perm="${test.perm}">
<fileset dir="${test.dir}">
<patternset refid="all.patterns"/>
</fileset>
</chrights>
</target>
<!-- =================================================================== -->
<!-- Test chown See above for correct results -->
<!-- =================================================================== -->
<target name="chown" depends="prepare" description="Does a chown on the testdir">
<chown owner="${test.owner}">
<fileset dir="${test.dir}">
<patternset refid="all.patterns"/>
</fileset>
</chown>
</target>
<!-- =================================================================== -->
<!-- Test chgrp See above for correct results -->
<!-- =================================================================== -->
<target name="chgrp" depends="prepare" description="Does a chgrp on the testdir">
<chgrp group="${test.group}">
<fileset dir="${test.dir}">
<patternset refid="all.patterns"/>
</fileset>
</chgrp>
</target>
<!-- =================================================================== -->
<!-- Test chmod See above for correct results -->
<!-- =================================================================== -->
<target name="chmod" depends="prepare" description="Does a chmod on the testdir">
<chmod perm="${test.perm}">
<fileset dir="${test.dir}">
<patternset refid="all.patterns"/>
</fileset>
</chmod>
</target>
<!-- =================================================================== -->
<!-- Removes the testdirectory -->
<!-- =================================================================== -->
<target name="clean" description="remove the test directory">
<delete dir="${test.dir}" quiet="false" />
</target>
</project>
