ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1527275 - in /ant/antlibs/compress/trunk: ./ docs/ src/main/org/apache/ant/compress/ src/main/org/apache/ant/compress/resources/ src/main/org/apache/ant/compress/taskdefs/ src/main/org/apache/ant/compress/util/ src/tests/antunit/
Date Sun, 29 Sep 2013 05:56:07 GMT
Author: bodewig
Date: Sun Sep 29 05:56:07 2013
New Revision: 1527275

URL: http://svn.apache.org/r1527275
Log:
write 7z archives

Added:
    ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/SevenZ.java
      - copied, changed from r1527026, ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java
    ant/antlibs/compress/trunk/src/tests/antunit/sevenz-test.xml
      - copied, changed from r1527026, ant/antlibs/compress/trunk/src/tests/antunit/cpio-test.xml
Modified:
    ant/antlibs/compress/trunk/changes.xml
    ant/antlibs/compress/trunk/docs/archive.html
    ant/antlibs/compress/trunk/docs/index.html
    ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml
    ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/SevenZResource.java
    ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/SevenZStreamFactory.java
    ant/antlibs/compress/trunk/src/tests/antunit/un7z-test.xml

Modified: ant/antlibs/compress/trunk/changes.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/changes.xml?rev=1527275&r1=1527274&r2=1527275&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/changes.xml (original)
+++ ant/antlibs/compress/trunk/changes.xml Sun Sep 29 05:56:07 2013
@@ -57,7 +57,9 @@
         added.
       </action>
       <action type="add">
-        Read-only support for file based 7z archives has been added.
+        Support for file based 7z archives has been added - most
+        compression algorithms used in 7z archives can be read but
+        only uncompressed archives can be written.
       </action>
     </release>
 

Modified: ant/antlibs/compress/trunk/docs/archive.html
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/docs/archive.html?rev=1527275&r1=1527274&r2=1527275&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/docs/archive.html (original)
+++ ant/antlibs/compress/trunk/docs/archive.html Sun Sep 29 05:56:07 2013
@@ -273,6 +273,14 @@
     </tr>
   </table>
 
+  <h3><a name="sevenz">SevenZ</a></h3>
+
+  <p><em>Since Compress Antlib 1.3</em></p>
+
+  <p>An <a href="#archive">archiving task</a> creating archives of the
+    7z format.  As of Commons Compress 1.6 this task only supports
+    writing uncompressed archives.</p>
+
   <h3><a name="tar">Tar</a></h3>
 
   <p>An <a href="#archive">archiving task</a> creating archives of the

Modified: ant/antlibs/compress/trunk/docs/index.html
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/docs/index.html?rev=1527275&r1=1527274&r2=1527275&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/docs/index.html (original)
+++ ant/antlibs/compress/trunk/docs/index.html Sun Sep 29 05:56:07 2013
@@ -53,6 +53,7 @@
       <li><a href="pack.html#gzip">gzip</a></li>
       <li><a href="pack.html#pack200">pack200</a></li>
       <li><a href="pack200normalize.html">pack200normalize</a></li>
+      <li><a href="archive.html#sevenz">sevenz</a></li>
       <li><a href="archive.html#tar">tar</a></li>
       <li><a href="expand.html#un7z">un7z</a></li>
       <li><a href="expand.html#unar">unar</a></li>

Modified: ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml?rev=1527275&r1=1527274&r2=1527275&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml (original)
+++ ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml Sun Sep 29 05:56:07
2013
@@ -97,6 +97,10 @@
      classname="org.apache.ant.compress.taskdefs.Pack200Normalize"
      />
   <taskdef
+     name="sevenz"
+     classname="org.apache.ant.compress.taskdefs.SevenZ"
+     />
+  <taskdef
      name="xz"
      classname="org.apache.ant.compress.taskdefs.XZ"
      />

Modified: ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/SevenZResource.java
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/SevenZResource.java?rev=1527275&r1=1527274&r2=1527275&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/SevenZResource.java
(original)
+++ ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/SevenZResource.java
Sun Sep 29 05:56:07 2013
@@ -162,6 +162,7 @@ public final class SevenZResource extend
                 }
                 ze = z.getNextEntry();
             }
+            setEntry(null);
         } catch (IOException e) {
             log(e.getMessage(), Project.MSG_DEBUG);
             throw new BuildException(e);

Copied: ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/SevenZ.java (from
r1527026, ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java)
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/SevenZ.java?p2=ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/SevenZ.java&p1=ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java&r1=1527026&r2=1527275&rev=1527275&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java (original)
+++ ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/SevenZ.java Sun Sep
29 05:56:07 2013
@@ -18,131 +18,41 @@
 
 package org.apache.ant.compress.taskdefs;
 
-import java.io.IOException;
-import java.io.OutputStream;
-import org.apache.ant.compress.resources.ArFileSet;
-import org.apache.ant.compress.util.ArStreamFactory;
+import java.util.Date;
+
+import org.apache.ant.compress.resources.SevenZFileSet;
+import org.apache.ant.compress.util.SevenZStreamFactory;
 import org.apache.commons.compress.archivers.ArchiveEntry;
-import org.apache.commons.compress.archivers.ArchiveOutputStream;
-import org.apache.commons.compress.archivers.ar.ArArchiveEntry;
-import org.apache.commons.compress.archivers.ar.ArArchiveOutputStream;
-import org.apache.tools.ant.BuildException;
+import org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry;
 import org.apache.tools.ant.types.ArchiveFileSet;
-import org.apache.tools.ant.types.EnumeratedAttribute;
 import org.apache.tools.ant.types.Resource;
 
 /**
- * Creates ar archives.
+ * Creates 7z archives.
  */
-public class Ar extends ArchiveBase {
-
-    private static final String NO_DIRS_MESSAGE = "ar archives cannot store"
-        + " directory entries";
-
-    private Format format = Format.AR;
+public class SevenZ extends ArchiveBase {
 
-    public Ar() {
-        setFactory(new ArStreamFactory() {
-                public ArchiveOutputStream getArchiveStream(OutputStream stream,
-                                                            String encoding)
-                    throws IOException {
-                    ArArchiveOutputStream o =
-                        (ArArchiveOutputStream) super.getArchiveStream(stream,
-                                                                       encoding);
-                    if (format.equals(Format.BSD)) {
-                        o.setLongFileMode(ArArchiveOutputStream.LONGFILE_BSD);
-                    }
-                    return o;
-                }
-            });
+    public SevenZ() {
+        setFactory(new SevenZStreamFactory());
         setEntryBuilder(
               new ArchiveBase.EntryBuilder() {
                 public ArchiveEntry buildEntry(ArchiveBase.ResourceWithFlags r) {
-                    boolean isDir = r.getResource().isDirectory();
-                    if (isDir) {
-                        throw new BuildException(NO_DIRS_MESSAGE);
-                    }
-
-                    int mode = ArchiveFileSet.DEFAULT_FILE_MODE;
-                    if (r.getCollectionFlags().hasModeBeenSet()) {
-                        mode = r.getCollectionFlags().getMode();
-                    } else if (r.getResourceFlags().hasModeBeenSet()) {
-                        mode = r.getResourceFlags().getMode();
-                    }
-
-                    int uid = 0;
-                    if (r.getResourceFlags().hasUserIdBeenSet()) {
-                        uid = r.getResourceFlags().getUserId();
-                    } else if (r.getCollectionFlags().hasUserIdBeenSet()) {
-                        uid = r.getCollectionFlags().getUserId();
-                    }
-
-                    int gid = 0;
-                    if (r.getResourceFlags().hasGroupIdBeenSet()) {
-                        gid = r.getResourceFlags().getGroupId();
-                    } else if (r.getCollectionFlags().hasGroupIdBeenSet()) {
-                        gid = r.getCollectionFlags().getGroupId();
-                    }
-
-                    return new ArArchiveEntry(r.getName(),
-                                              r.getResource().getSize(),
-                                              uid, gid, mode,
-                                              round(r.getResource()
-                                                    .getLastModified(), 1000)
-                                              / 1000);
+                    SevenZArchiveEntry entry = new SevenZArchiveEntry();
+                    entry.setName(r.getName());
+                    entry.setDirectory(r.getResource().isDirectory());
+                    entry.setLastModifiedDate(new Date(r.getResource()
+                                                       .getLastModified()));
+                    entry.setSize(r.getResource().getSize());
+                    return entry;
                 }
             });
         setFileSetBuilder(new ArchiveBase.FileSetBuilder() {
                 public ArchiveFileSet buildFileSet(Resource dest) {
-                    ArchiveFileSet afs = new ArFileSet();
+                    ArchiveFileSet afs = new SevenZFileSet();
                     afs.setSrcResource(dest);
                     return afs;
                 }
             });
     }
 
-    public void setFilesOnly(boolean b) {
-        if (!b) {
-            throw new BuildException(NO_DIRS_MESSAGE);
-        }
-    }
-
-    /**
-     * The format for entries with filenames longer than 16 characters
-     * or containign spaces - any other entry will always use "ar".
-     *
-     * @since Apache Compress Antlib 1.1
-     */
-    public void setFormat(Format f) {
-        format = f;
-    }
-
-    /**
-     * The supported tar formats for entries with long file names.
-     */
-    public final static class Format extends EnumeratedAttribute {
-        private static final String AR_NAME = "ar";
-        private static final String BSD_NAME = "bsd";
-
-        public static final Format AR = new Format(AR_NAME);
-        public static final Format BSD = new Format(BSD_NAME);
-
-        public Format(String v) {
-            setValue(v);
-        }
-
-        public Format() {
-            setValue(AR_NAME);
-        }
-
-        public String[] getValues() {
-            return new String[] {AR_NAME, BSD_NAME};
-        }
-
-        public boolean equals(Object other) {
-            return other instanceof Format
-                && ((Format) other).getValue().equals(getValue());
-        }
-    }
-
-}
\ No newline at end of file
+}

Modified: ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/SevenZStreamFactory.java
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/SevenZStreamFactory.java?rev=1527275&r1=1527274&r2=1527275&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/SevenZStreamFactory.java
(original)
+++ ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/SevenZStreamFactory.java
Sun Sep 29 05:56:07 2013
@@ -26,6 +26,7 @@ import java.io.OutputStream;
 import org.apache.commons.compress.archivers.ArchiveEntry;
 import org.apache.commons.compress.archivers.ArchiveInputStream;
 import org.apache.commons.compress.archivers.ArchiveOutputStream;
+import org.apache.commons.compress.archivers.sevenz.SevenZOutputFile;
 import org.apache.commons.compress.archivers.sevenz.SevenZFile;
 
 /**
@@ -70,7 +71,7 @@ public class SevenZStreamFactory impleme
     public ArchiveOutputStream getArchiveOutputStream(File file,
                                                       String encoding)
         throws IOException {
-        throw new UnsupportedOperationException();
+        return new SevenZArchiveOutputStream(file);
     }
 
     /**
@@ -98,4 +99,43 @@ public class SevenZStreamFactory impleme
         }
     }
 
+    /**
+     * Not really a stream but provides an ArchiveOutputStream
+     * compatible interface over SevenZOutputFile.
+     */
+    private static class SevenZArchiveOutputStream extends ArchiveOutputStream {
+
+        private final SevenZOutputFile zipFile;
+
+        public SevenZArchiveOutputStream(File file) throws IOException {
+            zipFile = new SevenZOutputFile(file);
+        }
+
+        public void close() {
+            zipFile.close();
+        }
+
+        public void putArchiveEntry(ArchiveEntry entry) throws IOException {
+            zipFile.putArchiveEntry(entry);
+        }
+
+        public void closeArchiveEntry() throws IOException {
+            zipFile.closeArchiveEntry();
+        }
+
+        public void finish() throws IOException {
+            zipFile.finish();
+        }
+
+        public ArchiveEntry createArchiveEntry(File inputFile, String entryName) 
+            throws IOException {
+            return zipFile.createArchiveEntry(inputFile, entryName);
+        }
+
+        public void write(byte[] b,int  off, int len) throws IOException {
+            zipFile.write(b, off, len);
+        }
+                
+    }
+
 }

Copied: ant/antlibs/compress/trunk/src/tests/antunit/sevenz-test.xml (from r1527026, ant/antlibs/compress/trunk/src/tests/antunit/cpio-test.xml)
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/src/tests/antunit/sevenz-test.xml?p2=ant/antlibs/compress/trunk/src/tests/antunit/sevenz-test.xml&p1=ant/antlibs/compress/trunk/src/tests/antunit/cpio-test.xml&r1=1527026&r2=1527275&rev=1527275&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/src/tests/antunit/cpio-test.xml (original)
+++ ant/antlibs/compress/trunk/src/tests/antunit/sevenz-test.xml Sun Sep 29 05:56:07 2013
@@ -26,43 +26,19 @@
     <mkdir dir="${output}"/>
     <mkdir dir="${input}/subdir"/>
     <copy todir="${input}/subdir" file="../resources/asf-logo.gif"/>
-    <property name="dest" location="${output}/test.cpio"/>
+    <property name="dest" location="${output}/test.7z"/>
     <macrodef name="checkProperties">
       <attribute name="pattern" default="yyyy-MM-dd-HH:mm:ss Z"/>
       <attribute name="dateTime"/>
-      <attribute name="uid" default="0"/>
-      <attribute name="gid" default="0"/>
-      <attribute name="mode" default="644"/>
       <sequential>
         <au:assertTrue>
           <cond:islastmodified datetime="@{dateTime}"
                                pattern="@{pattern}">
-            <cmp:cpioentry name="asf-logo.gif">
+            <cmp:sevenzentry name="asf-logo.gif">
               <file file="${dest}"/>
-            </cmp:cpioentry>
+            </cmp:sevenzentry>
           </cond:islastmodified>
         </au:assertTrue>
-        <au:assertTrue>
-          <cmp:hasuserid id="@{uid}">
-            <cmp:cpioentry name="asf-logo.gif">
-              <file file="${dest}"/>
-            </cmp:cpioentry>
-          </cmp:hasuserid>
-        </au:assertTrue>
-        <au:assertTrue>
-          <cmp:hasgroupid id="@{gid}">
-            <cmp:cpioentry name="asf-logo.gif">
-              <file file="${dest}"/>
-            </cmp:cpioentry>
-          </cmp:hasgroupid>
-        </au:assertTrue>
-        <au:assertTrue>
-          <cmp:hasmode mode="@{mode}">
-            <cmp:cpioentry name="asf-logo.gif">
-              <file file="${dest}"/>
-            </cmp:cpioentry>
-          </cmp:hasmode>
-        </au:assertTrue>
       </sequential>
     </macrodef>
   </target>
@@ -73,306 +49,206 @@
     <touch datetime="2009-08-19-05:49:21 +0200"
            pattern="yyyy-MM-dd-HH:mm:ss Z"
            file="${input}/asf-logo.gif"/>
-    <cmp:cpio destfile="${dest}">
+    <cmp:sevenz destfile="${dest}">
       <fileset dir="${input}" includes="asf-logo.gif"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <checkProperties dateTime="2009-08-19-05:49:21 +0200"/>
   </target>
 
   <target name="testCoreZipFileSet" depends="setUp">
-    <cmp:cpio destfile="${dest}">
+    <cmp:sevenz destfile="${dest}">
       <zipfileset src="../resources/asf-logo.gif.zip"
                   includes="asf-logo.gif"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <checkProperties dateTime="2001-11-19-15:34:20"
                      pattern="yyyy-MM-dd-HH:mm:ss"
-                     mode="644"/>
+                     />
   </target>
 
   <target name="testAntlibZipFileSet" depends="setUp">
-    <cmp:cpio destfile="${dest}">
+    <cmp:sevenz destfile="${dest}">
       <cmp:zipfileset src="../resources/asf-logo.gif.zip"
                       includes="asf-logo.gif"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <checkProperties dateTime="2001-11-19-15:34:20"
                      pattern="yyyy-MM-dd-HH:mm:ss"
-                     mode="644"/>
-  </target>
-
-  <target name="testCoreTarFileSet" depends="setUp">
-    <cmp:cpio destfile="${dest}">
-      <tarfileset src="../resources/asf-logo.gif.tar"
-                  includes="asf-logo.gif"/>
-    </cmp:cpio>
-    <checkProperties dateTime="2001-11-19-15:34:20 +0100" mode="644"
-                     uid="500" gid="500"/>
+                     />
   </target>
 
-  <target name="testAntlibTarFileSet" depends="setUp">
-    <cmp:cpio destfile="${dest}">
-      <cmp:tarfileset src="../resources/asf-logo.gif.tar"
-                      includes="asf-logo.gif"/>
-    </cmp:cpio>
-    <checkProperties dateTime="2001-11-19-15:34:20 +0100" mode="644"
-                     uid="500" gid="500"/>
-  </target>
-
-  <target name="testArFileSet" depends="setUp">
-    <cmp:cpio destfile="${dest}">
-      <cmp:arfileset src="../resources/asf-logo.gif.ar"
-                     includes="asf-logo.gif"/>
-    </cmp:cpio>
-    <checkProperties dateTime="2009-07-31-20:11:13 +0200" mode="644"
-                     uid="1000" gid="1000"/>
-  </target>
-
-  <target name="testCpioFileSet" depends="setUp">
-    <cmp:cpio destfile="${dest}">
-      <cmp:cpiofileset src="../resources/asf-logo.gif.bin.cpio"
-                       includes="asf-logo.gif"/>
-    </cmp:cpio>
-    <checkProperties dateTime="2009-07-31-20:11:13 +0200" mode="644"
-                     uid="1000" gid="1000"/>
+  <target name="testSevenzFileSet" depends="setUp">
+    <cmp:sevenz destfile="${dest}">
+      <cmp:sevenzfileset src="../resources/asf-logo.gif.7z"
+                         includes="asf-logo.gif"/>
+    </cmp:sevenz>
+    <checkProperties dateTime="2013-09-27-20:54:32 +0200"/>
   </target>
 
   <target name="testNoDirectoriesByDefault" depends="setUp">
-    <cmp:cpio destfile="${dest}">
+    <cmp:sevenz destfile="${dest}">
       <fileset dir="${input}"/>
       <dirset dir="${input}"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <assertResourceExists>
-      <cmp:cpioentry name="subdir/asf-logo.gif">
+      <cmp:sevenzentry name="subdir/asf-logo.gif">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceExists>
     <assertResourceDoesntExist>
-      <cmp:cpioentry name="subdir/">
+      <cmp:sevenzentry name="subdir/">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceDoesntExist>
   </target>
 
   <target name="testWithDirectories" depends="setUp">
-    <cmp:cpio destfile="${dest}" filesonly="false">
+    <cmp:sevenz destfile="${dest}" filesonly="false">
       <dirset dir="${input}" excludes="."/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <assertResourceExists>
-      <cmp:cpioentry name="subdir/">
+      <cmp:sevenzentry name="subdir/">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceExists>
-    <au:assertTrue>
-      <cmp:hasmode mode="755">
-        <cmp:cpioentry name="subdir/">
-          <file file="${dest}"/>
-        </cmp:cpioentry>
-      </cmp:hasmode>
-    </au:assertTrue>
-    <assertResourceDoesntExist>
-      <cmp:cpioentry name="subdir/asf-logo.gif">
-        <file file="${dest}"/>
-      </cmp:cpioentry>
-    </assertResourceDoesntExist>
   </target>
 
   <target name="testWithImplicitDirectories" depends="setUp">
-    <cmp:cpio destfile="${dest}" filesonly="false">
+    <cmp:sevenz destfile="${dest}" filesonly="false">
       <fileset dir="${input}"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <assertResourceExists>
-      <cmp:cpioentry name="subdir/">
+      <cmp:sevenzentry name="subdir/">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceExists>
-    <au:assertTrue>
-      <cmp:hasmode mode="755">
-        <cmp:cpioentry name="subdir/">
-          <file file="${dest}"/>
-        </cmp:cpioentry>
-      </cmp:hasmode>
-    </au:assertTrue>
     <assertResourceExists>
-      <cmp:cpioentry name="subdir/asf-logo.gif">
+      <cmp:sevenzentry name="subdir/asf-logo.gif">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceExists>
   </target>
 
-  <target name="testImplicitDirectoriesUsePermissions" depends="setUp">
-    <cmp:cpio destfile="${dest}" filesonly="false">
-      <zipfileset dir="${input}" dirmode="750"/>
-    </cmp:cpio>
-    <au:assertTrue>
-      <cmp:hasmode mode="750">
-        <cmp:cpioentry name="subdir/">
-          <file file="${dest}"/>
-        </cmp:cpioentry>
-      </cmp:hasmode>
-    </au:assertTrue>
-  </target>
-
-  <target name="testFileSetPermissionsWin" depends="setUp">
-    <cmp:cpio destfile="${dest}">
-      <cmp:arfileset src="../resources/asf-logo.gif.ar"
-                     filemode="600"
-                     includes="asf-logo.gif"/>
-    </cmp:cpio>
-    <checkProperties dateTime="2009-07-31-20:11:13 +0200" mode="600"
-                     uid="1000" gid="1000"/>
-  </target>
-
   <target name="testFullpath" depends="setUp">
-    <cmp:cpio destfile="${dest}">
+    <cmp:sevenz destfile="${dest}">
       <cmp:arfileset src="../resources/asf-logo.gif.ar"
                      fullpath="logo.gif"
                      includes="asf-logo.gif"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <assertResourceExists>
-      <cmp:cpioentry name="logo.gif">
+      <cmp:sevenzentry name="logo.gif">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceExists>
     <assertResourceDoesntExist>
-      <cmp:cpioentry name="asf-logo.gif">
+      <cmp:sevenzentry name="asf-logo.gif">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceDoesntExist>
   </target>
 
   <target name="testPrefixWithSlash" depends="setUp">
-    <cmp:cpio destfile="${dest}">
+    <cmp:sevenz destfile="${dest}">
       <cmp:arfileset src="../resources/asf-logo.gif.ar"
                      prefix="x/"
                      includes="asf-logo.gif"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <assertResourceExists>
-      <cmp:cpioentry name="x/asf-logo.gif">
+      <cmp:sevenzentry name="x/asf-logo.gif">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceExists>
     <assertResourceDoesntExist>
-      <cmp:cpioentry name="asf-logo.gif">
+      <cmp:sevenzentry name="asf-logo.gif">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceDoesntExist>
   </target>
 
   <target name="testPrefixWithBackslash" depends="setUp">
-    <cmp:cpio destfile="${dest}">
+    <cmp:sevenz destfile="${dest}">
       <cmp:arfileset src="../resources/asf-logo.gif.ar"
                      prefix="x\"
                      includes="asf-logo.gif"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <assertResourceExists>
-      <cmp:cpioentry name="x/asf-logo.gif">
+      <cmp:sevenzentry name="x/asf-logo.gif">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceExists>
     <assertResourceDoesntExist>
-      <cmp:cpioentry name="asf-logo.gif">
+      <cmp:sevenzentry name="asf-logo.gif">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceDoesntExist>
   </target>
 
   <target name="testPrefixWithoutSlash" depends="setUp">
-    <cmp:cpio destfile="${dest}">
+    <cmp:sevenz destfile="${dest}">
       <cmp:arfileset src="../resources/asf-logo.gif.ar"
                      prefix="x"
                      includes="asf-logo.gif"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <assertResourceExists>
-      <cmp:cpioentry name="x/asf-logo.gif">
+      <cmp:sevenzentry name="x/asf-logo.gif">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceExists>
     <assertResourceDoesntExist>
-      <cmp:cpioentry name="asf-logo.gif">
+      <cmp:sevenzentry name="asf-logo.gif">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceDoesntExist>
   </target>
 
-  <target name="-setUp0Permissions" depends="setUp">
-    <property name="src" location="${input}/src.ar"/>
-    <cmp:ar destfile="${src}" preserve0permissions="true">
-      <cmp:arfileset src="../resources/asf-logo.gif.ar"
-                     filemode="0"
-                     includes="asf-logo.gif"/>
-    </cmp:ar>
-  </target>
-
-  <target name="test0PermissionsGetReplaced"
-                     depends="-setUp0Permissions">
-    <cmp:cpio destfile="${dest}">
-      <cmp:arfileset src="${src}"
-                     includes="asf-logo.gif"/>
-    </cmp:cpio>
-    <checkProperties dateTime="2009-07-31-20:11:13 +0200" mode="644"
-                     uid="1000" gid="1000"/>
-  </target>
-
-  <target name="testPreserve0Permissions"
-                     depends="-setUp0Permissions">
-    <cmp:cpio destfile="${dest}" preserve0permissions="true">
-      <cmp:arfileset src="${src}"
-                     includes="asf-logo.gif"/>
-    </cmp:cpio>
-    <checkProperties dateTime="2009-07-31-20:11:13 +0200" mode="0"
-                     uid="1000" gid="1000"/>
-  </target>
-
   <target name="testRemoveLeadingSlashes" depends="setUp">
-    <cmp:cpio destfile="${dest}">
+    <cmp:sevenz destfile="${dest}">
       <cmp:arfileset src="../resources/asf-logo.gif.ar"
                      fullpath="/logo.gif"
                      includes="asf-logo.gif"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <assertResourceExists>
-      <cmp:cpioentry name="logo.gif">
+      <cmp:sevenzentry name="logo.gif">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceExists>
     <assertResourceDoesntExist>
-      <cmp:cpioentry name="/logo.gif">
+      <cmp:sevenzentry name="/logo.gif">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceDoesntExist>
   </target>
 
   <target name="testPreserveLeadingSlashes" depends="setUp">
-    <cmp:cpio destfile="${dest}" preserveleadingslashes="true">
+    <cmp:sevenz destfile="${dest}" preserveleadingslashes="true">
       <cmp:arfileset src="../resources/asf-logo.gif.ar"
                      fullpath="/logo.gif"
                      includes="asf-logo.gif"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <assertResourceExists>
-      <cmp:cpioentry name="/logo.gif">
+      <cmp:sevenzentry name="/logo.gif">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceExists>
     <assertResourceDoesntExist>
-      <cmp:cpioentry name="logo.gif">
+      <cmp:sevenzentry name="logo.gif">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceDoesntExist>
   </target>
 
-  <!-- ACC 1.0 CPIO prevents duplicate entries -->
-  <target name="fail-testAddDuplicates" depends="setUp">
-    <cmp:cpio destfile="${dest}" duplicate="add">
+  <target name="testAddDuplicates" depends="setUp">
+    <cmp:sevenz destfile="${dest}" duplicate="add">
       <cmp:arfileset src="../resources/asf-logo.gif.ar"/>
       <cmp:zipfileset src="../resources/asf-logo.gif.zip"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <au:assertLogContains text="duplicate entry asf-logo.gif found, adding."
                           level="verbose"/>
   </target>
 
   <target name="testPreserveDuplicates" depends="setUp">
-    <cmp:cpio destfile="${dest}" duplicate="preserve">
+    <cmp:sevenz destfile="${dest}" duplicate="preserve">
       <cmp:arfileset src="../resources/asf-logo.gif.ar"/>
       <cmp:zipfileset src="../resources/asf-logo.gif.zip"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <au:assertLogContains text="asf-logo.gif already added, skipping."
                           level="verbose"/>
   </target>
@@ -380,56 +256,39 @@
   <target name="testFailDuplicates" depends="setUp">
     <au:expectfailure
        message="Duplicate entry asf-logo.gif was found and the duplicate attribute is 'fail'.">
-      <cmp:cpio destfile="${dest}">
+      <cmp:sevenz destfile="${dest}">
         <cmp:arfileset src="../resources/asf-logo.gif.ar"/>
         <cmp:zipfileset src="../resources/asf-logo.gif.zip"/>
-      </cmp:cpio>
+      </cmp:sevenz>
     </au:expectfailure>
   </target>
 
   <target name="testFailEmpty" depends="setUp">
     <au:expectfailure
        message="No sources, nothing to do.">
-      <cmp:cpio destfile="${dest}">
+      <cmp:sevenz destfile="${dest}">
         <fileset dir="." includes="not-there"/>
-      </cmp:cpio>
+      </cmp:sevenz>
     </au:expectfailure>
   </target>
 
   <target name="testSkipEmpty" depends="setUp">
-    <cmp:cpio destfile="${dest}" whenEmpty="skip">
+    <cmp:sevenz destfile="${dest}" whenEmpty="skip">
       <fileset dir="." includes="not-there"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <au:assertLogContains text="No sources, nothing to do."
                           level="warn"/>
     <au:assertFileDoesntExist file="${dest}"/>
   </target>
 
-  <target name="testNonFileDest" depends="setUp">
-    <cmp:cpio>
-      <fileset dir="." includes="ar-test.xml"/>
-      <dest>
-        <gzipresource>
-          <file file="${dest}.gz"/>
-        </gzipresource>
-      </dest>
-    </cmp:cpio>
-    <au:assertFileExists file="${dest}.gz"/>
-    <au:assertFileDoesntExist file="${dest}"/>
-    <gunzip src="${dest}.gz" dest="${dest}"/>
-    <cmp:uncpio src="${dest}" dest="${output}"/>
-    <au:assertFilesMatch expected="ar-test.xml"
-                         actual="${output}/ar-test.xml"/>
-  </target>
-
   <target name="-prepareArchiveForModeTests" depends="setUp">
     <mkdir dir="${input}"/>
     <copy todir="${input}">
       <fileset dir="." includes="*r-test.xml,zip-test.xml"/>
     </copy>
-    <cmp:cpio dest="${dest}">
+    <cmp:sevenz dest="${dest}">
       <fileset dir="${input}"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <copy tofile="${dest}.bak" file="${dest}"/>
     <property name="timestamp" value="2000-01-01-00:00:00 +0000"/>
     <touch datetime="${timestamp}" file="${input}/zip-test.xml"
@@ -440,135 +299,135 @@
   </target>
 
   <target name="testCreateOfUpToDate" depends="-prepareArchiveForModeTests">
-    <cmp:cpio dest="${dest}" mode="create">
+    <cmp:sevenz dest="${dest}" mode="create">
       <fileset dir="${input}" includes="ar-test.xml,zip-test.xml"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <au:assertLogContains
-       text="test.cpio is up-to-date, nothing to do."/>
+       text="test.7z is up-to-date, nothing to do."/>
     <au:assertDestIsUptodate
        src="${dest}" dest="${dest}.bak"/>
   </target>
 
   <target name="testForceCreateOfUpToDate"
           depends="-prepareArchiveForModeTests">
-    <cmp:cpio dest="${dest}" mode="force-create">
+    <cmp:sevenz dest="${dest}" mode="force-create">
       <fileset dir="${input}" includes="ar-test.xml,zip-test.xml"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <au:assertLogDoesntContain
-       text="test.cpio is up-to-date, nothing to do."/>
+       text="test.7z is up-to-date, nothing to do."/>
     <au:assertDestIsOutofdate
        src="${dest}" dest="${dest}.bak"/>
     <assertResourceDoesntExist>
-      <cmp:cpioentry name="tar-test.xml">
+      <cmp:sevenzentry name="tar-test.xml">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceDoesntExist>
   </target>
 
   <target name="testCreateOfOutOfDate" depends="-prepareArchiveForModeTests">
     <touch file="${input}/ar-test.xml"/>
-    <cmp:cpio dest="${dest}" mode="create">
+    <cmp:sevenz dest="${dest}" mode="create">
       <fileset dir="${input}" includes="ar-test.xml,zip-test.xml"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <au:assertLogDoesntContain
-       text="test.cpio is up-to-date, nothing to do."/>
+       text="test.7z is up-to-date, nothing to do."/>
     <au:assertDestIsOutofdate
        src="${dest}" dest="${dest}.bak"/>
     <assertResourceDoesntExist>
-      <cmp:cpioentry name="tar-test.xml">
+      <cmp:sevenzentry name="tar-test.xml">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceDoesntExist>
   </target>
 
   <target name="testReplaceOfUpToDate" depends="-prepareArchiveForModeTests">
-    <cmp:cpio dest="${dest}" mode="replace">
+    <cmp:sevenz dest="${dest}" mode="replace">
       <fileset dir="${input}" includes="ar-test.xml,zip-test.xml"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <au:assertLogContains
-       text="test.cpio is up-to-date, nothing to do."/>
+       text="test.7z is up-to-date, nothing to do."/>
     <au:assertDestIsUptodate
        src="${dest}" dest="${dest}.bak"/>
   </target>
 
   <target name="testForceReplaceOfUpToDate"
           depends="-prepareArchiveForModeTests">
-    <cmp:cpio dest="${dest}" mode="force-replace">
+    <cmp:sevenz dest="${dest}" mode="force-replace">
       <fileset dir="${input}" includes="ar-test.xml,zip-test.xml"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <au:assertLogDoesntContain
-       text="test.cpio is up-to-date, nothing to do."/>
+       text="test.7z is up-to-date, nothing to do."/>
     <au:assertDestIsOutofdate
        src="${dest}" dest="${dest}.bak"/>
     <assertResourceExists>
-      <cmp:cpioentry name="tar-test.xml">
+      <cmp:sevenzentry name="tar-test.xml">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceExists>
     <au:assertTrue>
       <cond:islastmodified datetime="${timestamp}"
                            pattern="yyyy-MM-dd-HH:mm:ss Z">
-        <cmp:cpioentry name="zip-test.xml">
+        <cmp:sevenzentry name="zip-test.xml">
           <file file="${dest}"/>
-        </cmp:cpioentry>
+        </cmp:sevenzentry>
       </cond:islastmodified>
     </au:assertTrue>
   </target>
 
   <target name="testReplaceOfOutOfDate" depends="-prepareArchiveForModeTests">
     <touch file="${input}/ar-test.xml"/>
-    <cmp:cpio dest="${dest}" mode="replace">
+    <cmp:sevenz dest="${dest}" mode="replace">
       <fileset dir="${input}" includes="ar-test.xml,zip-test.xml"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <au:assertLogDoesntContain
-       text="test.cpio is up-to-date, nothing to do."/>
+       text="test.7z is up-to-date, nothing to do."/>
     <au:assertDestIsOutofdate
        src="${dest}" dest="${dest}.bak"/>
     <assertResourceExists>
-      <cmp:cpioentry name="tar-test.xml">
+      <cmp:sevenzentry name="tar-test.xml">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceExists>
     <au:assertTrue>
       <cond:islastmodified datetime="${timestamp}"
                            pattern="yyyy-MM-dd-HH:mm:ss Z">
-        <cmp:cpioentry name="zip-test.xml">
+        <cmp:sevenzentry name="zip-test.xml">
           <file file="${dest}"/>
-        </cmp:cpioentry>
+        </cmp:sevenzentry>
       </cond:islastmodified>
     </au:assertTrue>
   </target>
 
   <target name="testUpdateOfUpToDate" depends="-prepareArchiveForModeTests">
-    <cmp:cpio dest="${dest}" mode="update">
+    <cmp:sevenz dest="${dest}" mode="update">
       <fileset dir="${input}" includes="ar-test.xml,zip-test.xml"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <au:assertLogContains
-       text="test.cpio is up-to-date, nothing to do."/>
+       text="test.7z is up-to-date, nothing to do."/>
     <au:assertDestIsUptodate
        src="${dest}" dest="${dest}.bak"/>
   </target>
 
   <target name="testUpdateOfOutOfDate" depends="-prepareArchiveForModeTests">
     <touch file="${input}/ar-test.xml"/>
-    <cmp:cpio dest="${dest}" mode="update">
+    <cmp:sevenz dest="${dest}" mode="update">
       <fileset dir="${input}" includes="ar-test.xml,zip-test.xml"/>
-    </cmp:cpio>
+    </cmp:sevenz>
     <au:assertLogDoesntContain
-       text="test.cpio is up-to-date, nothing to do."/>
+       text="test.7z is up-to-date, nothing to do."/>
     <au:assertDestIsOutofdate
        src="${dest}" dest="${dest}.bak"/>
     <assertResourceExists>
-      <cmp:cpioentry name="tar-test.xml">
+      <cmp:sevenzentry name="tar-test.xml">
         <file file="${dest}"/>
-      </cmp:cpioentry>
+      </cmp:sevenzentry>
     </assertResourceExists>
     <au:assertFalse>
       <cond:islastmodified datetime="${timestamp}"
                            pattern="yyyy-MM-dd-HH:mm:ss Z">
-        <cmp:cpioentry name="zip-test.xml">
+        <cmp:sevenzentry name="zip-test.xml">
           <file file="${dest}"/>
-        </cmp:cpioentry>
+        </cmp:sevenzentry>
       </cond:islastmodified>
     </au:assertFalse>
   </target>

Modified: ant/antlibs/compress/trunk/src/tests/antunit/un7z-test.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/src/tests/antunit/un7z-test.xml?rev=1527275&r1=1527274&r2=1527275&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/src/tests/antunit/un7z-test.xml (original)
+++ ant/antlibs/compress/trunk/src/tests/antunit/un7z-test.xml Sun Sep 29 05:56:07 2013
@@ -26,11 +26,10 @@
     <mkdir dir="${input}"/>
   </target>
 
-  <!--
   <target name="testAgainstAntlib7zTask" depends="setUp">
-    <cmp:7z destfile="${input}/test.7z">
+    <cmp:sevenz destfile="${input}/test.7z">
       <fileset dir="." includes="un7z-test.xml"/>
-    </cmp:7z>
+    </cmp:sevenz>
     <cmp:un7z src="${input}/test.7z" dest="${output}"/>
     <au:assertFileExists file="${output}/un7z-test.xml"/>
     <au:assertFilesMatch
@@ -38,7 +37,6 @@
        expected="un7z-test.xml"
        />
   </target>
-  -->
 
   <target name="testAgainstNative7z" depends="setUp">
     <cmp:un7z src="../resources/asf-logo.gif.7z" dest="${output}" />



Mime
View raw message