ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1158767 - in /ant/antlibs/compress/trunk: docs/ src/main/org/apache/ant/compress/ src/main/org/apache/ant/compress/taskdefs/ src/main/org/apache/ant/compress/util/ src/tests/antunit/
Date Wed, 17 Aug 2011 15:20:43 GMT
Author: bodewig
Date: Wed Aug 17 15:20:42 2011
New Revision: 1158767

URL: http://svn.apache.org/viewvc?rev=1158767&view=rev
Log:
undump task for the Unix dump format

Added:
    ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Undump.java
      - copied, changed from r1158757, ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Uncpio.java
    ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/DumpStreamFactory.java
      - copied, changed from r1158757, ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/CpioStreamFactory.java
    ant/antlibs/compress/trunk/src/tests/antunit/undump-test.xml
      - copied, changed from r1158757, ant/antlibs/compress/trunk/src/tests/antunit/uncpio-test.xml
Modified:
    ant/antlibs/compress/trunk/docs/expand.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/util/EntryHelper.java

Modified: ant/antlibs/compress/trunk/docs/expand.html
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/docs/expand.html?rev=1158767&r1=1158766&r2=1158767&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/docs/expand.html (original)
+++ ant/antlibs/compress/trunk/docs/expand.html Wed Aug 17 15:20:42 2011
@@ -111,10 +111,19 @@ mapper</a>.</p>
   of 1.2) Commons Compress can only read archives using the GNU/SRV4
   variant.</p>
 
-<h3><a name="uncpio">UnCpio</a></h3>
+<h3><a name="undump">UnCpio</a></h3>
 
 <p>An <a href="#expand">unarchiving task</a> for CPIO archives.</p>
 
+<h3><a name="uncpio">UnDump</a></h3>
+
+<p><em>Since Apache Compress Antlib 1.1</em>.</p>
+
+<p>An <a href="#expand">unarchiving task</a> for Unix dump archives.</p>
+
+<p>Note that entries likely have a leading "/" so you may want to
+  set <code>stripabsolutepathspec</code> to <code>true</code>.</p>
+
 <h3><a name="untar">UnTar</a></h3>
 
 <p>An <a href="#expand">unarchiving task</a> for TAR archives.</p>

Modified: ant/antlibs/compress/trunk/docs/index.html
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/docs/index.html?rev=1158767&r1=1158766&r2=1158767&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/docs/index.html (original)
+++ ant/antlibs/compress/trunk/docs/index.html Wed Aug 17 15:20:42 2011
@@ -29,8 +29,8 @@
       compression/uncompression and archival/unarchival capabilities
       based on <a href="http://commons.apache.org/compress/">Apache
       Commons Compress</a>.  Using Apache Commons Compress 1.3 this
-      Antlib supports gzip and bzip2 compression and ar, cpio, tar and
-      zip archives.</p>
+      Antlib supports gzip and bzip2 compression and ar, cpio, Unix
+      dump, tar and zip archives.  Support for dump is read-only.</p>
 
     <h3>Known Limitations</h3>
 
@@ -52,6 +52,7 @@
       <li><a href="archive.html#tar">tar</a></li>
       <li><a href="expand.html#unar">unar</a></li>
       <li><a href="expand.html#uncpio">uncpio</a></li>
+      <li><a href="expand.html#undump">undump</a></li>
       <li><a href="expand.html#untar">untar</a></li>
       <li><a href="expand.html#unzip">unzip</a></li>
       <li><a href="archive.html#zip">zip</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=1158767&r1=1158766&r2=1158767&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 Wed Aug 17 15:20:42
2011
@@ -17,12 +17,16 @@
   -->
 <antlib>
   <taskdef
+     name="unar"
+     classname="org.apache.ant.compress.taskdefs.Unar"
+     />
+  <taskdef
      name="uncpio"
      classname="org.apache.ant.compress.taskdefs.Uncpio"
      />
   <taskdef
-     name="unar"
-     classname="org.apache.ant.compress.taskdefs.Unar"
+     name="undump"
+     classname="org.apache.ant.compress.taskdefs.Undump"
      />
   <taskdef
      name="untar"

Copied: ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Undump.java (from
r1158757, ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Uncpio.java)
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Undump.java?p2=ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Undump.java&p1=ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Uncpio.java&r1=1158757&r2=1158767&rev=1158767&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Uncpio.java (original)
+++ ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Undump.java Wed Aug
17 15:20:42 2011
@@ -18,13 +18,14 @@
 
 package org.apache.ant.compress.taskdefs;
 
-import org.apache.ant.compress.util.CpioStreamFactory;
+import org.apache.ant.compress.util.DumpStreamFactory;
 
 /**
- * Uncpio a file.
+ * Undump a file.
+ * @since Apache Commons Compress 1.1
  */
-public class Uncpio extends ExpandBase {
-    public Uncpio() {
-        super(new CpioStreamFactory());
+public class Undump extends ExpandBase {
+    public Undump() {
+        super(new DumpStreamFactory());
     }
 }

Copied: ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/DumpStreamFactory.java
(from r1158757, ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/CpioStreamFactory.java)
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/DumpStreamFactory.java?p2=ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/DumpStreamFactory.java&p1=ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/CpioStreamFactory.java&r1=1158757&r2=1158767&rev=1158767&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/CpioStreamFactory.java
(original)
+++ ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/DumpStreamFactory.java
Wed Aug 17 15:20:42 2011
@@ -22,12 +22,16 @@ import java.io.InputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 
+import org.apache.commons.compress.archivers.ArchiveException;
 import org.apache.commons.compress.archivers.ArchiveInputStream;
 import org.apache.commons.compress.archivers.ArchiveOutputStream;
-import org.apache.commons.compress.archivers.cpio.CpioArchiveInputStream;
-import org.apache.commons.compress.archivers.cpio.CpioArchiveOutputStream;
+import org.apache.commons.compress.archivers.dump.DumpArchiveInputStream;
+import org.apache.tools.ant.BuildException;
 
-public class CpioStreamFactory implements ArchiveStreamFactory {
+/**
+ * @since Apache Commons Compress 1.1
+ */
+public class DumpStreamFactory implements ArchiveStreamFactory {
 
     /**
      * @param stream the stream to read from, should be buffered
@@ -36,16 +40,19 @@ public class CpioStreamFactory implement
     public ArchiveInputStream getArchiveStream(InputStream stream,
                                                String encoding)
         throws IOException {
-        return new CpioArchiveInputStream(stream);
+        try {
+            return new DumpArchiveInputStream(stream);
+        } catch (ArchiveException ex) {
+            throw new BuildException(ex);
+        }
     }
 
     /**
-     * @param stream the stream to write to, should be buffered
-     * @param encoding the encoding of the entry names, ignored
+     * Not implemented.
      */
     public ArchiveOutputStream getArchiveStream(OutputStream stream,
                                                 String encoding)
         throws IOException {
-        return new CpioArchiveOutputStream(stream);
+        throw new UnsupportedOperationException();
     }
 }
\ No newline at end of file

Modified: ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/EntryHelper.java
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/EntryHelper.java?rev=1158767&r1=1158766&r2=1158767&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/EntryHelper.java (original)
+++ ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/EntryHelper.java Wed
Aug 17 15:20:42 2011
@@ -25,12 +25,13 @@ import org.apache.tools.ant.BuildExcepti
 import org.apache.commons.compress.archivers.ArchiveEntry;
 import org.apache.commons.compress.archivers.ar.ArArchiveEntry;
 import org.apache.commons.compress.archivers.cpio.CpioArchiveEntry;
+import org.apache.commons.compress.archivers.dump.DumpArchiveEntry;
 import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
 import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
 
 /**
  * Helper methods that gloss over API differences between the
- * ArchiveEntry implementations of Apache Commons Compress 1.1.
+ * ArchiveEntry implementations of Apache Commons Compress 1.3.
  */
 public class EntryHelper {
     private EntryHelper() {}
@@ -56,6 +57,9 @@ public class EntryHelper {
         if (entry instanceof ZipArchiveEntry) {
             return ((ZipArchiveEntry) entry).getUnixMode();
         }
+        if (entry instanceof DumpArchiveEntry) {
+            return ((DumpArchiveEntry) entry).getMode();
+        }
         throw new BuildException("archive entry " + entry.getClass()
                                  + " is not supported.");
     }
@@ -82,6 +86,9 @@ public class EntryHelper {
         if (entry instanceof ZipArchiveEntry) {
             return UNKNOWN_ID;
         }
+        if (entry instanceof DumpArchiveEntry) {
+            return ((DumpArchiveEntry) entry).getUserId();
+        }
         throw new BuildException("archive entry " + entry.getClass()
                                  + " is not supported.");
     }
@@ -106,6 +113,9 @@ public class EntryHelper {
         if (entry instanceof ZipArchiveEntry) {
             return UNKNOWN_ID;
         }
+        if (entry instanceof DumpArchiveEntry) {
+            return (int) ((DumpArchiveEntry) entry).getGroupId();
+        }
         throw new BuildException("archive entry " + entry.getClass()
                                  + " is not supported.");
     }

Copied: ant/antlibs/compress/trunk/src/tests/antunit/undump-test.xml (from r1158757, ant/antlibs/compress/trunk/src/tests/antunit/uncpio-test.xml)
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/src/tests/antunit/undump-test.xml?p2=ant/antlibs/compress/trunk/src/tests/antunit/undump-test.xml&p1=ant/antlibs/compress/trunk/src/tests/antunit/uncpio-test.xml&r1=1158757&r2=1158767&rev=1158767&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/src/tests/antunit/uncpio-test.xml (original)
+++ ant/antlibs/compress/trunk/src/tests/antunit/undump-test.xml Wed Aug 17 15:20:42 2011
@@ -26,74 +26,9 @@
     <mkdir dir="${input}"/>
   </target>
 
-  <target name="testAgainstAntlibCpioTaskBinary" depends="setUp">
-    <cmp:cpio destfile="${input}/test.cpio">
-      <fileset dir="."/>
-    </cmp:cpio>
-    <cmp:uncpio src="${input}/test.cpio" dest="${output}"/>
-    <au:assertFileExists file="${output}/uncpio-test.xml"/>
-    <au:assertFilesMatch
-       actual="${output}/uncpio-test.xml"
-       expected="uncpio-test.xml"
-       />
-  </target>
-
-  <target name="testAgainstAntlibCpioTaskOldAscii" depends="setUp">
-    <cmp:cpio destfile="${input}/test.cpio" format="odc">
-      <fileset dir="."/>
-    </cmp:cpio>
-    <cmp:uncpio src="${input}/test.cpio" dest="${output}"/>
-    <au:assertFileExists file="${output}/uncpio-test.xml"/>
-    <au:assertFilesMatch
-       actual="${output}/uncpio-test.xml"
-       expected="uncpio-test.xml"
-       />
-  </target>
-
-  <target name="testAgainstAntlibCpioTaskNewAscii" depends="setUp">
-    <cmp:cpio destfile="${input}/test.cpio" format="new-ascii">
-      <fileset dir="."/>
-    </cmp:cpio>
-    <cmp:uncpio src="${input}/test.cpio" dest="${output}"/>
-    <au:assertFileExists file="${output}/uncpio-test.xml"/>
-    <au:assertFilesMatch
-       actual="${output}/uncpio-test.xml"
-       expected="uncpio-test.xml"
-       />
-  </target>
-
-  <!--target name="testAgainstAntlibCpioTaskCRC" depends="setUp">
-    <cmp:cpio destfile="${input}/test.cpio" format="crc">
-      <fileset dir="."/>
-    </cmp:cpio>
-    <cmp:uncpio src="${input}/test.cpio" dest="${output}"/>
-    <au:assertFileExists file="${output}/uncpio-test.xml"/>
-    <au:assertFilesMatch
-       actual="${output}/uncpio-test.xml"
-       expected="uncpio-test.xml"
-       />
-  </target-->
-
-  <target name="testAgainstNativeCpioBinary" depends="setUp">
-    <cmp:uncpio src="../resources/asf-logo.gif.bin.cpio" dest="${output}" />
-    <au:assertFileExists file="${output}/asf-logo.gif"/>
-    <au:assertFilesMatch
-       actual="${output}/asf-logo.gif"
-       expected="../resources/asf-logo.gif"
-       />
-  </target>
-
-  <target name="testAgainstNativeCpioOldAscii" depends="setUp">
-    <cmp:uncpio src="../resources/asf-logo.gif.odc.cpio" dest="${output}" />
-    <au:assertFileExists file="${output}/asf-logo.gif"/>
-    <au:assertFilesMatch
-       actual="${output}/asf-logo.gif"
-       expected="../resources/asf-logo.gif"
-       />
-  </target>
-
-  <target name="testAgainstNativeCpioNewAscii" depends="setUp">
-    <cmp:uncpio src="../resources/asf-logo.gif.new.cpio" dest="${output}" />
+  <target name="testAgainstNativeDump" depends="setUp">
+    <cmp:undump src="../resources/asf-logo.gif.dump" dest="${output}"
+                stripabsolutepathspec="true"/>
     <au:assertFileExists file="${output}/asf-logo.gif"/>
     <au:assertFilesMatch
        actual="${output}/asf-logo.gif"
@@ -101,8 +36,9 @@
        />
   </target>
 
-  <target name="testAgainstNativeCpioCRC" depends="setUp">
-    <cmp:uncpio src="../resources/asf-logo.gif.crc.cpio" dest="${output}" />
+  <target name="testAgainstNativeDumpCompressed" depends="setUp">
+    <cmp:undump src="../resources/asf-logo.gif.z.dump" dest="${output}"
+                stripabsolutepathspec="true"/>
     <au:assertFileExists file="${output}/asf-logo.gif"/>
     <au:assertFilesMatch
        actual="${output}/asf-logo.gif"
@@ -112,13 +48,13 @@
 
   <target name="testResourceCollection" depends="setUp">
     <zip destfile="${input}/test.zip">
-      <fileset dir="../resources" includes="*.cpio"/>
+      <fileset dir="../resources" includes="*.dump"/>
     </zip>
-    <cmp:uncpio dest="${output}">
+    <cmp:undump dest="${output}" stripabsolutepathspec="true">
       <zipfileset src="${input}/test.zip">
-        <include name="*.cpio"/>
+        <include name="*.dump"/>
       </zipfileset>
-    </cmp:uncpio>
+    </cmp:undump>
     <au:assertFileExists file="${output}/asf-logo.gif"/>
     <au:assertFilesMatch
        actual="${output}/asf-logo.gif"



Mime
View raw message