ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r806929 - in /ant/sandbox/antlibs/compress/trunk/src: main/org/apache/ant/compress/taskdefs/ tests/antunit/
Date Sun, 23 Aug 2009 05:43:18 GMT
Author: bodewig
Date: Sun Aug 23 05:43:18 2009
New Revision: 806929

URL: http://svn.apache.org/viewvc?rev=806929&view=rev
Log:
use a consistent default value for permissions

Modified:
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Cpio.java
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Tar.java
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Zip.java
    ant/sandbox/antlibs/compress/trunk/src/tests/antunit/cpio-test.xml

Modified: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java?rev=806929&r1=806928&r2=806929&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java (original)
+++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java Sun
Aug 23 05:43:18 2009
@@ -22,13 +22,12 @@
 import org.apache.commons.compress.archivers.ArchiveEntry;
 import org.apache.commons.compress.archivers.ar.ArArchiveEntry;
 import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.ArchiveFileSet;
 
 /**
  * Creates ar archives.
  */
 public class Ar extends ArchiveBase {
-    /** stolen from ArEntry */
-    private static final int DEFAULT_MODE = 33188;
 
     public Ar() {
         super(new ArStreamFactory(),
@@ -41,7 +40,7 @@
                                                  + " directory entries");
                     }
 
-                    int mode = DEFAULT_MODE;
+                    int mode = ArchiveFileSet.DEFAULT_FILE_MODE;
                     if (r.getResourceFlags().hasModeBeenSet()) {
                         mode = r.getResourceFlags().getMode();
                     } else if (!isDir

Modified: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Cpio.java
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Cpio.java?rev=806929&r1=806928&r2=806929&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Cpio.java
(original)
+++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Cpio.java
Sun Aug 23 05:43:18 2009
@@ -21,7 +21,7 @@
 import org.apache.ant.compress.util.CpioStreamFactory;
 import org.apache.commons.compress.archivers.ArchiveEntry;
 import org.apache.commons.compress.archivers.cpio.CpioArchiveEntry;
-import org.apache.commons.compress.archivers.cpio.CpioConstants;
+import org.apache.tools.ant.types.ArchiveFileSet;
 
 /**
  * Creates cpio archives.
@@ -38,16 +38,17 @@
                                              ? 0 : r.getResource().getSize());
                     ent.setTime(r.getResource().getLastModified() / 1000);
 
-                    int mode =
-                        isDir ? CpioConstants.C_ISDIR : CpioConstants.C_ISREG;
+                    int mode = isDir
+                        ? ArchiveFileSet.DEFAULT_DIR_MODE
+                        : ArchiveFileSet.DEFAULT_FILE_MODE;
                     if (r.getResourceFlags().hasModeBeenSet()) {
-                        ent.setMode(mode | r.getResourceFlags().getMode());
+                        ent.setMode(r.getResourceFlags().getMode());
                     } else if (!isDir
                                && r.getCollectionFlags().hasModeBeenSet()) {
-                        ent.setMode(mode | r.getCollectionFlags().getMode());
+                        ent.setMode(r.getCollectionFlags().getMode());
                     } else if (isDir
                                && r.getCollectionFlags().hasDirModeBeenSet()) {
-                        ent.setMode(mode | r.getCollectionFlags().getDirMode());
+                        ent.setMode(r.getCollectionFlags().getDirMode());
                     } else {
                         ent.setMode(mode);
                     }

Modified: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Tar.java
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Tar.java?rev=806929&r1=806928&r2=806929&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Tar.java
(original)
+++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Tar.java
Sun Aug 23 05:43:18 2009
@@ -22,6 +22,7 @@
 import org.apache.commons.compress.archivers.ArchiveEntry;
 import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
 import org.apache.commons.compress.archivers.tar.TarConstants;
+import org.apache.tools.ant.types.ArchiveFileSet;
 
 /**
  * Creates tar archives.
@@ -47,6 +48,10 @@
                     } else if (isDir
                                && r.getCollectionFlags().hasDirModeBeenSet()) {
                         ent.setMode(r.getCollectionFlags().getDirMode());
+                    } else {
+                        ent.setMode(isDir
+                                    ? ArchiveFileSet.DEFAULT_DIR_MODE
+                                    : ArchiveFileSet.DEFAULT_FILE_MODE);
                     }
 
                     if (r.getResourceFlags().hasUserIdBeenSet()) {

Modified: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Zip.java
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Zip.java?rev=806929&r1=806928&r2=806929&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Zip.java
(original)
+++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Zip.java
Sun Aug 23 05:43:18 2009
@@ -20,8 +20,8 @@
 
 import org.apache.ant.compress.util.ZipStreamFactory;
 import org.apache.commons.compress.archivers.ArchiveEntry;
-import org.apache.commons.compress.archivers.zip.UnixStat;
 import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
+import org.apache.tools.ant.types.ArchiveFileSet;
 
 /**
  * Creates zip archives.
@@ -44,12 +44,10 @@
                     } else if (isDir
                                && r.getCollectionFlags().hasDirModeBeenSet()) {
                         ent.setUnixMode(r.getCollectionFlags().getDirMode());
-                    } else if (isDir) {
-                        ent.setUnixMode(UnixStat.DIR_FLAG
-                                        | UnixStat.DEFAULT_DIR_PERM);
                     } else {
-                        ent.setUnixMode(UnixStat.FILE_FLAG
-                                        | UnixStat.DEFAULT_FILE_PERM);
+                        ent.setUnixMode(isDir
+                                        ? ArchiveFileSet.DEFAULT_DIR_MODE
+                                        : ArchiveFileSet.DEFAULT_FILE_MODE);
                     }
 
                     if (r.getResourceFlags().getZipExtraFields() != null) {

Modified: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/cpio-test.xml
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/tests/antunit/cpio-test.xml?rev=806929&r1=806928&r2=806929&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/tests/antunit/cpio-test.xml (original)
+++ ant/sandbox/antlibs/compress/trunk/src/tests/antunit/cpio-test.xml Sun Aug 23 05:43:18
2009
@@ -31,7 +31,7 @@
       <attribute name="dateTime"/>
       <attribute name="uid" default="0"/>
       <attribute name="gid" default="0"/>
-      <attribute name="mode" default="32768"/>
+      <attribute name="mode" default="33188"/>
       <sequential>
         <au:assertTrue>
           <cond:islastmodified datetime="@{dateTime}"



Mime
View raw message