Author: bodewig
Date: Fri Jul 31 04:48:05 2009
New Revision: 799517

URL: http://svn.apache.org/viewvc?rev=799517&view=rev
Log:
initial import of a single untested task

Added:
    ant/sandbox/antlibs/compress/trunk/NOTICE
    ant/sandbox/antlibs/compress/trunk/build.xml   (with props)
    ant/sandbox/antlibs/compress/trunk/changes.xml   (with props)
    ant/sandbox/antlibs/compress/trunk/contributors.xml   (with props)
    ant/sandbox/antlibs/compress/trunk/doap_CompressAntlib.rdf   (with props)
    ant/sandbox/antlibs/compress/trunk/docs/
    ant/sandbox/antlibs/compress/trunk/src/
    ant/sandbox/antlibs/compress/trunk/src/main/
    ant/sandbox/antlibs/compress/trunk/src/main/org/
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/
    
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml  
 (with props)
    
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/
    
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Uncpio.java
   (with props)
    ant/sandbox/antlibs/compress/trunk/version.properties   (with props)

Added: ant/sandbox/antlibs/compress/trunk/NOTICE
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/NOTICE?rev=799517&view=auto
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/NOTICE (added)
+++ ant/sandbox/antlibs/compress/trunk/NOTICE Fri Jul 31 04:48:05 2009
@@ -0,0 +1,6 @@
+   Apache [PRODUCT_NAME]
+   Copyright [yyyy] The Apache Software Foundation
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+

Added: ant/sandbox/antlibs/compress/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/build.xml?rev=799517&view=auto
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/build.xml (added)
+++ ant/sandbox/antlibs/compress/trunk/build.xml Fri Jul 31 04:48:05 2009
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<project default="compile" name="compress">
+
+  <!-- easy way to override properties -->
+  <property file="build.properties"/>
+
+  <import file="common/build.xml"/>
+
+</project>

Propchange: ant/sandbox/antlibs/compress/trunk/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/compress/trunk/changes.xml
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/changes.xml?rev=799517&view=auto
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/changes.xml (added)
+++ ant/sandbox/antlibs/compress/trunk/changes.xml Fri Jul 31 04:48:05 2009
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<!DOCTYPE document
+[
+<!ELEMENT document (properties?, release+)>
+<!ELEMENT properties (title)>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT release (action*)>
+<!ELEMENT action (#PCDATA)>
+<!ATTLIST release
+          version CDATA #REQUIRED
+          date CDATA #REQUIRED
+          description CDATA #IMPLIED>
+<!ATTLIST action
+          issue CDATA #IMPLIED
+          type (add|fix|remove|update) #REQUIRED
+          breaks-bwc (true|false) #IMPLIED>
+]
+>
+  <document>
+    <properties>
+      <title>Apache Compress Ant Library</title>
+    </properties>
+
+    <release version="SVN trunk" date="unpublished">
+    </release>
+  </document>

Propchange: ant/sandbox/antlibs/compress/trunk/changes.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/compress/trunk/contributors.xml
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/contributors.xml?rev=799517&view=auto
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/contributors.xml (added)
+++ ant/sandbox/antlibs/compress/trunk/contributors.xml Fri Jul 31 04:48:05 2009
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<!DOCTYPE contributors
+[
+<!ELEMENT name (first?, middle?, last)>
+<!ELEMENT contributors (introduction, name+)>
+<!ELEMENT first (#PCDATA)>
+<!ELEMENT introduction (#PCDATA)>
+<!ELEMENT middle (#PCDATA)>
+<!ELEMENT last (#PCDATA)>
+]
+>
+
+<contributors>
+  <introduction>
+  These are some of the many people who have helped with this Ant Library.
+  </introduction>
+  <name>
+    <first>Stefan</first>
+    <last>Bodewig</last>
+  </name>
+</contributors>

Propchange: ant/sandbox/antlibs/compress/trunk/contributors.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/compress/trunk/doap_CompressAntlib.rdf
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/doap_CompressAntlib.rdf?rev=799517&view=auto
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/doap_CompressAntlib.rdf (added)
+++ ant/sandbox/antlibs/compress/trunk/doap_CompressAntlib.rdf Fri Jul 31 
04:48:05 2009
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<rdf:RDF xml:lang="en"
+         xmlns="http://usefulinc.com/ns/doap#"; 
+         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; 
+         xmlns:asfext="http://projects.apache.org/ns/asfext#";>
+  <Project rdf:about="http://ant.apache.org/antlibs/dotnet/";>
+    <created>2009-07-31</created>
+    <license rdf:resource="http://usefulinc.com/doap/licenses/asl20"; />
+    <name>Apache Compress Ant Library</name>
+    <homepage rdf:resource="http://ant.apache.org/antlibs/dotnet/"; />
+    <asfext:pmc rdf:resource="http://ant.apache.org/"; />
+    <shortdesc>Provides Support for Some Archive Formats not Supported by 
Ant's Core</shortdesc>
+    <description>This is a library of Ant tasks and types uses Apache
+      Commons Compress to support additional archive formats like ar
+      and cpio.</description>
+    <bug-database 
rdf:resource="http://issues.apache.org/bugzilla/buglist.cgi?product=Ant"; />
+    <mailing-list rdf:resource="http://ant.apache.org/mail.html"; />
+    <download-page 
rdf:resource="http://ant.apache.org/antlibs/bindownload.cgi"; />
+    <programming-language>Java</programming-language>
+    <category 
rdf:resource="http://projects.apache.org/category/build-management"; />
+    <release>
+    </release>
+    <repository>
+      <SVNRepository>
+        <location 
rdf:resource="http://svn.apache.org/repos/asf/ant/sandbox/antlibs/compress"/>
+        <browse 
rdf:resource="http://svn.apache.org/viewcvs.cgi/ant/sandbox/antlibs/compress"/>
+      </SVNRepository>
+    </repository>
+  </Project>
+</rdf:RDF>

Propchange: ant/sandbox/antlibs/compress/trunk/doap_CompressAntlib.rdf
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml?rev=799517&view=auto
==============================================================================
--- 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml 
(added)
+++ 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml 
Fri Jul 31 04:48:05 2009
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<antlib>
+  <taskdef
+    name="uncpio"
+    classname="org.apache.ant.compress.Uncpio"
+    />
+</antlib>

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Uncpio.java
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Uncpio.java?rev=799517&view=auto
==============================================================================
--- 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Uncpio.java
 (added)
+++ 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Uncpio.java
 Fri Jul 31 04:48:05 2009
@@ -0,0 +1,127 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.ant.compress.taskdefs;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Expand;
+import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.util.FileNameMapper;
+import org.apache.tools.ant.util.FileUtils;
+
+import org.apache.commons.compress.archivers.cpio.CpioArchiveEntry;
+import org.apache.commons.compress.archivers.cpio.CpioArchiveInputStream;
+
+/**
+ * Uncpio a file.
+ * <p>PatternSets are used to select files to extract
+ * <I>from</I> the archive.  If no patternset is used, all files are extracted.
+ * </p>
+ * <p>FileSet's may be used to select archived files
+ * to perform unarchival upon.
+ * </p>
+ * <p>File permissions will not be restored on extracted files.</p>
+ */
+public class Uncpio extends Expand {
+    /**
+     * No encoding support in Uncpio.
+     * @param encoding not used
+     * @throws BuildException always
+     * @since Ant 1.6
+     */
+    public void setEncoding(String encoding) {
+        throw new BuildException("The " + getTaskName()
+                                 + " task doesn't support the encoding"
+                                 + " attribute", getLocation());
+    }
+
+    /** {...@inheritdoc} */
+    protected void expandFile(FileUtils fileUtils, File srcF, File dir) {
+        if (!srcF.exists()) {
+            throw new BuildException("Unable to uncpio "
+                    + srcF
+                    + " as the file does not exist",
+                    getLocation());
+        }
+        FileInputStream fis = null;
+        try {
+            fis = new FileInputStream(srcF);
+            expandStream(srcF.getPath(), fis, dir);
+        } catch (IOException ioe) {
+            throw new BuildException("Error while expanding " + srcF.getPath()
+                                     + "\n" + ioe.toString(),
+                                     ioe, getLocation());
+        } finally {
+            FileUtils.close(fis);
+        }
+    }
+
+    /** {...@inheritdoc} */
+    protected void expandResource(Resource srcR, File dir) {
+        if (!srcR.isExists()) {
+            throw new BuildException("Unable to uncpio "
+                                     + srcR.getName()
+                                     + " as the it does not exist",
+                                     getLocation());
+        }
+
+        InputStream i = null;
+        try {
+            i = srcR.getInputStream();
+            expandStream(srcR.getName(), i, dir);
+        } catch (IOException ioe) {
+            throw new BuildException("Error while expanding " + srcR.getName(),
+                                     ioe, getLocation());
+        } finally {
+            FileUtils.close(i);
+        }
+    }
+
+    private void expandStream(String name, InputStream stream, File dir)
+        throws IOException {
+        CpioArchiveInputStream is = null;
+        try {
+            is = new CpioArchiveInputStream(new BufferedInputStream(stream));
+            log("Expanding: " + name + " into " + dir, Project.MSG_INFO);
+            CpioArchiveEntry ent = null;
+            boolean empty = true;
+            FileNameMapper mapper = getMapper();
+            while ((ent = is.getNextCPIOEntry()) != null) {
+                empty = false;
+                extractFile(FileUtils.getFileUtils(), null, dir, is,
+                            ent.getName(),
+                            /* TODO revisit */ new Date(ent.getTime()),
+                            ent.isDirectory(), mapper);
+            }
+            if (empty && getFailOnEmptyArchive()) {
+                throw new BuildException("archive '" + name + "' is empty");
+            }
+            log("expand complete", Project.MSG_VERBOSE);
+        } finally {
+            FileUtils.close(is);
+        }
+    }
+}

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Uncpio.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/compress/trunk/version.properties
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/version.properties?rev=799517&view=auto
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/version.properties (added)
+++ ant/sandbox/antlibs/compress/trunk/version.properties Fri Jul 31 04:48:05 
2009
@@ -0,0 +1,15 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+artifact.version=1.0Alpha

Propchange: ant/sandbox/antlibs/compress/trunk/version.properties
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to