Author: maartenc
Date: Wed Apr 21 21:40:59 2010
New Revision: 936523

URL: http://svn.apache.org/viewvc?rev=936523&view=rev
Log:
FIX: Packager resolver always extracts all files from archives even when the 
packaging instructions contains include tags (IVY-1179) (thanks to Stefan De 
Boey)

Added:
    ant/ivy/core/trunk/test/repositories/IVY-1179/
    ant/ivy/core/trunk/test/repositories/IVY-1179/repo/
    ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/
    ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/A/
    ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/A/1.0/
    ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/A/1.0/ivy.xml   
(with props)
    ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/A/1.0/packager.xml   
(with props)
    ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/B/
    ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/B/1.0/
    ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/B/1.0/ivy.xml   
(with props)
    ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/B/1.0/packager.xml   
(with props)
    ant/ivy/core/trunk/test/repositories/IVY-1179/website/
    ant/ivy/core/trunk/test/repositories/IVY-1179/website/dist/
    ant/ivy/core/trunk/test/repositories/IVY-1179/website/dist/A-1.0.zip   
(with props)
    ant/ivy/core/trunk/test/repositories/IVY-1179/website/dist/B-1.0.tar.gz   
(with props)
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/packager.xsl
    
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/PackagerResolverTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=936523&r1=936522&r2=936523&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Wed Apr 21 21:40:59 2010
@@ -34,6 +34,7 @@ for detailed view of each issue, please 
        Andrea Bernardo Ciddio
        Archie Cobbs
        Flavio Coutinho da Costa
+       Stefan De Boey
        Martin Eigenbrodt
        Gregory Fernandez
        Danno Ferrin
@@ -120,6 +121,7 @@ for detailed view of each issue, please 
 - IMPROVEMENT: Trace a message when a property file referenced from the 
settings doesn't exixts (IVY-1074)
 - IMPROVEMENT: use defaultconf in combination with defaultconfmapping 
(IVY-1135) (thanks to Jon Schneider)
 
+- FIX: Packager resolver always extracts all files from archives even when the 
packaging instructions contains include tags (IVY-1179) (thanks to Stefan De 
Boey)
 - FIX: Ivy cannot connect to URLs with '_' in their hostname
 - FIX: Transitive dependencies resolutions issue when eviction is triggered 
(IVY-1178)
 - FIX: Can't deal with [VERSION] version pattern from Maven (IVY-1177) (thanks 
to Richard Vowles)

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/packager.xsl
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/packager.xsl?rev=936523&r1=936522&r2=936523&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/packager.xsl
 (original)
+++ 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/packager.xsl
 Wed Apr 21 21:40:59 2010
@@ -419,9 +419,9 @@
             <xsl:when test="$type = 'zip' or $type = 'war' or $type = 'jar'">
                 <unzip src="{$file}" dest="{$dir}">
                     <xsl:if test="$includes">
-                        <fileset dir=".">
+                        <patternset>
                             <xsl:copy-of select="$includes"/>
-                        </fileset>
+                        </patternset>
                     </xsl:if>
                 </unzip>
             </xsl:when>
@@ -438,9 +438,9 @@
                         </xsl:when>
                     </xsl:choose>
                     <xsl:if test="$includes">
-                        <fileset dir=".">
+                        <patternset>
                             <xsl:copy-of select="$includes"/>
-                        </fileset>
+                        </patternset>
                     </xsl:if>
                 </untar>
             </xsl:when>

Modified: 
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/PackagerResolverTest.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/PackagerResolverTest.java?rev=936523&r1=936522&r2=936523&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/PackagerResolverTest.java
 (original)
+++ 
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/PackagerResolverTest.java
 Wed Apr 21 21:40:59 2010
@@ -107,7 +107,6 @@ public class PackagerResolverTest extend
         try {
             // set the locale to UK as workaround for SUN bug 6240963
             Locale.setDefault(Locale.UK);
-
     
             // Create and configure resolver
             PackagerResolver resolver = new PackagerResolver();
@@ -183,4 +182,88 @@ public class PackagerResolverTest extend
             Locale.setDefault(oldLocale);
         }
     }
+    
+    public void testZipResourceInclusion() throws Exception {
+        Locale oldLocale = Locale.getDefault();
+        
+        try {
+            // set the locale to UK as workaround for SUN bug 6240963
+            Locale.setDefault(Locale.UK);
+    
+            // Create and configure resolver
+            PackagerResolver resolver = new PackagerResolver();
+            resolver.setSettings(_settings);
+            File repoRoot = new File("test/repositories/IVY-1179/repo");
+            resolver.addIvyPattern(
+              "" + new File(repoRoot, 
"[organisation]/[module]/[revision]/ivy.xml").getAbsoluteFile().toURL().toExternalForm());
+            resolver.setPackagerPattern(
+              "" + new File(repoRoot, 
"[organisation]/[module]/[revision]/packager.xml").getAbsoluteFile().toURL().toExternalForm());
+            resolver.setBuildRoot(_builddir);
+            resolver.setResourceCache(_cachedir);
+            resolver.setPreserveBuildDirectories(true);
+            resolver.setVerbose(true);
+            
+            resolver.setProperty("packager.website.url", 
+                new 
File("test/repositories/IVY-1179/website").getAbsoluteFile().toURL().toExternalForm());
+    
+            resolver.setName("packager");
+    
+            // Get module descriptor
+            ModuleRevisionId mrid = ModuleRevisionId.newInstance("org", "A", 
"1.0");
+            ResolvedModuleRevision rmr = resolver.getDependency(
+              new DefaultDependencyDescriptor(mrid, false), _data);
+    
+            // Download artifact
+            Artifact artifact = new DefaultArtifact(mrid, 
rmr.getPublicationDate(), "A", "jar", "jar");
+            resolver.download(new Artifact[] {artifact}, downloadOptions());
+            
+            // assert that the file README is not extracted from the archive
+            File readme = new File(_builddir, 
"org/A/1.0/extract/A-1.0/README");
+            assertFalse(readme.exists());
+        } finally {
+            Locale.setDefault(oldLocale);
+        }
+    }
+    
+    public void testTarResourceInclusion() throws Exception {
+        Locale oldLocale = Locale.getDefault();
+        
+        try {
+            // set the locale to UK as workaround for SUN bug 6240963
+            Locale.setDefault(Locale.UK);
+
+            // Create and configure resolver
+            PackagerResolver resolver = new PackagerResolver();
+            resolver.setSettings(_settings);
+            File repoRoot = new File("test/repositories/IVY-1179/repo");
+            resolver.addIvyPattern(
+              "" + new File(repoRoot, 
"[organisation]/[module]/[revision]/ivy.xml").getAbsoluteFile().toURL().toExternalForm());
+            resolver.setPackagerPattern(
+              "" + new File(repoRoot, 
"[organisation]/[module]/[revision]/packager.xml").getAbsoluteFile().toURL().toExternalForm());
+            resolver.setBuildRoot(_builddir);
+            resolver.setResourceCache(_cachedir);
+            resolver.setPreserveBuildDirectories(true);
+            resolver.setVerbose(true);
+            
+            resolver.setProperty("packager.website.url", 
+                new 
File("test/repositories/IVY-1179/website").getAbsoluteFile().toURL().toExternalForm());
+    
+            resolver.setName("packager");
+    
+            // Get module descriptor
+            ModuleRevisionId mrid = ModuleRevisionId.newInstance("org", "B", 
"1.0");
+            ResolvedModuleRevision rmr = resolver.getDependency(
+              new DefaultDependencyDescriptor(mrid, false), _data);
+    
+            // Download artifact
+            Artifact artifact = new DefaultArtifact(mrid, 
rmr.getPublicationDate(), "B", "jar", "jar");
+            resolver.download(new Artifact[] {artifact}, downloadOptions());
+            
+            // assert that the file README is not extracted from the archive
+            File readme = new File(_builddir, 
"org/B/1.0/extract/B-1.0/README");
+            assertFalse(readme.exists());
+        } finally {
+            Locale.setDefault(oldLocale);
+        }
+    }
 }

Added: ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/A/1.0/ivy.xml
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/A/1.0/ivy.xml?rev=936523&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/A/1.0/ivy.xml (added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/A/1.0/ivy.xml Wed 
Apr 21 21:40:59 2010
@@ -0,0 +1,29 @@
+<!--
+   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.
+-->
+<ivy-module version="1.3">
+       <info organisation="org"
+              module="A"
+              revision="1.0"
+              status="integration"
+              publication="20041101110000"
+       />
+       <publications>
+        <artifact />
+       </publications>
+</ivy-module>

Propchange: ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/A/1.0/ivy.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/A/1.0/packager.xml
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/A/1.0/packager.xml?rev=936523&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/A/1.0/packager.xml 
(added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/A/1.0/packager.xml 
Wed Apr 21 21:40:59 2010
@@ -0,0 +1,34 @@
+<!--
+   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.
+-->
+<packager-module version="1.0">
+
+    <property name="name" value="${ivy.packager.module}"/>
+    <property name="version" value="${ivy.packager.revision}"/>
+    <property name="archive" value="${name}-${version}"/>
+
+    <resource dest="extract" url="${packager.website.url}/dist/${archive}.zip"
+      sha1="c79d0b496dbb7f0d5affda645f3a0476f8999871">
+        <include name="${archive}/${name}.jar"/>
+    </resource>
+
+    <build>
+        <move file="extract/${archive}/${name}.jar" todir="artifacts/jars"/>
+    </build>
+
+</packager-module>

Propchange: 
ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/A/1.0/packager.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/B/1.0/ivy.xml
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/B/1.0/ivy.xml?rev=936523&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/B/1.0/ivy.xml (added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/B/1.0/ivy.xml Wed 
Apr 21 21:40:59 2010
@@ -0,0 +1,29 @@
+<!--
+   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.
+-->
+<ivy-module version="1.3">
+       <info organisation="org"
+              module="B"
+              revision="1.0"
+              status="integration"
+              publication="20041101110000"
+       />
+       <publications>
+        <artifact />
+       </publications>
+</ivy-module>

Propchange: ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/B/1.0/ivy.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/B/1.0/packager.xml
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/B/1.0/packager.xml?rev=936523&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/B/1.0/packager.xml 
(added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/B/1.0/packager.xml 
Wed Apr 21 21:40:59 2010
@@ -0,0 +1,34 @@
+<!--
+   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.
+-->
+<packager-module version="1.0">
+
+    <property name="name" value="${ivy.packager.module}"/>
+    <property name="version" value="${ivy.packager.revision}"/>
+    <property name="archive" value="${name}-${version}"/>
+
+    <resource dest="extract" 
url="${packager.website.url}/dist/${archive}.tar.gz"
+      sha1="9cc9462ce72ad46d7dd6741d2cf97551ebec7df2">
+        <include name="${archive}/${name}.jar"/>
+    </resource>
+
+    <build>
+        <move file="extract/${archive}/${name}.jar" todir="artifacts/jars"/>
+    </build>
+
+</packager-module>

Propchange: 
ant/ivy/core/trunk/test/repositories/IVY-1179/repo/org/B/1.0/packager.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/core/trunk/test/repositories/IVY-1179/website/dist/A-1.0.zip
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1179/website/dist/A-1.0.zip?rev=936523&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ant/ivy/core/trunk/test/repositories/IVY-1179/website/dist/A-1.0.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ant/ivy/core/trunk/test/repositories/IVY-1179/website/dist/B-1.0.tar.gz
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1179/website/dist/B-1.0.tar.gz?rev=936523&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
ant/ivy/core/trunk/test/repositories/IVY-1179/website/dist/B-1.0.tar.gz
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream


Reply via email to