You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2002/11/18 16:47:45 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Tar.java
bodewig 2002/11/18 07:47:45
Modified: . WHATSNEW
docs/manual/CoreTasks tar.html
src/main/org/apache/tools/ant/taskdefs Tar.java
Log:
Add drimode attribute for the permissions od directories to <tarfileset>.
PR: 12289
Revision Changes Path
1.323 +3 -0 jakarta-ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
retrieving revision 1.322
retrieving revision 1.323
diff -u -r1.322 -r1.323
--- WHATSNEW 18 Nov 2002 15:22:51 -0000 1.322
+++ WHATSNEW 18 Nov 2002 15:47:45 -0000 1.323
@@ -118,6 +118,9 @@
* <style> has a new attribute reuseloadedstylesheet to work around a
bug in widespread Xalan versions.
+* <tarfileset> has a new dirmode attribute to specify the permissions
+ for directories.
+
Changes from Ant 1.5.1Beta1 to 1.5.1
====================================
1.19 +10 -2 jakarta-ant/docs/manual/CoreTasks/tar.html
Index: tar.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/tar.html,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- tar.html 22 Jun 2002 23:38:27 -0000 1.18
+++ tar.html 18 Nov 2002 15:47:45 -0000 1.19
@@ -121,8 +121,16 @@
</tr>
<tr>
<td valign="top">mode</td>
- <td valign="top">A 3 digit octal string, specify the user, group and other modes in
- the standard Unix fashion</td>
+ <td valign="top">A 3 digit octal string, specify the user, group
+ and other modes in the standard Unix fashion. Only applies to
+ plain files. Default is 644.</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">dirmode</td>
+ <td valign="top">A 3 digit octal string, specify the user, group
+ and other modes in the standard Unix fashion. Only applies to
+ directories. Default is 755. <em>since Ant 1.6</em>.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
1.37 +27 -5 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Tar.java
Index: Tar.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Tar.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- Tar.java 25 Jul 2002 15:21:05 -0000 1.36
+++ Tar.java 18 Nov 2002 15:47:45 -0000 1.37
@@ -74,8 +74,7 @@
import org.apache.tools.tar.TarConstants;
import org.apache.tools.tar.TarEntry;
import org.apache.tools.tar.TarOutputStream;
-
-
+import org.apache.tools.zip.UnixStat;
/**
* Creates a tar archive.
@@ -403,6 +402,8 @@
if (!file.isDirectory()) {
te.setSize(file.length());
te.setMode(tarFileSet.getMode());
+ } else {
+ te.setMode(tarFileSet.getDirMode());
}
te.setUserName(tarFileSet.getUserName());
te.setGroupName(tarFileSet.getGroup());
@@ -441,7 +442,8 @@
public static class TarFileSet extends FileSet {
private String[] files = null;
- private int mode = 0100644;
+ private int fileMode = UnixStat.FILE_FLAG | UnixStat.DEFAULT_FILE_PERM;
+ private int dirMode = UnixStat.DIR_FLAG | UnixStat.DEFAULT_DIR_PERM;
private String userName = "";
private String groupName = "";
@@ -482,11 +484,31 @@
* optional, default=0644
*/
public void setMode(String octalString) {
- this.mode = 0100000 | Integer.parseInt(octalString, 8);
+ this.fileMode =
+ UnixStat.FILE_FLAG | Integer.parseInt(octalString, 8);
}
public int getMode() {
- return mode;
+ return fileMode;
+ }
+
+ /**
+ * A 3 digit octal string, specify the user, group and
+ * other modes in the standard Unix fashion;
+ * optional, default=0755
+ *
+ * @since Ant 1.6
+ */
+ public void setDirMode(String octalString) {
+ this.dirMode =
+ UnixStat.DIR_FLAG | Integer.parseInt(octalString, 8);
+ }
+
+ /**
+ * @since Ant 1.6
+ */
+ public int getDirMode() {
+ return dirMode;
}
/**
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>