You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2014/11/18 18:36:35 UTC

svn commit: r1640396 - in /tomcat/tc7.0.x/trunk: ./ build.xml webapps/docs/changelog.xml

Author: kkolinko
Date: Tue Nov 18 17:36:34 2014
New Revision: 1640396

URL: http://svn.apache.org/r1640396
Log:
Automatically create target directory (base.path) when downloading files.
Use random temporary filename instead of "file.zip"/"file.tar.gz" to allow several downloads to run in parallel.

Merged r1637336 from tomcat/tc8.0.x/trunk.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/build.xml
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1637331
  Merged /tomcat/tc8.0.x/trunk:r1637336

Modified: tomcat/tc7.0.x/trunk/build.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/build.xml?rev=1640396&r1=1640395&r2=1640396&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/build.xml (original)
+++ tomcat/tc7.0.x/trunk/build.xml Tue Nov 18 17:36:34 2014
@@ -2789,75 +2789,95 @@ Apache Tomcat ${version} native binaries
 
   <target name="downloadgz" unless="exist" depends="setproxy,testexist">
     <!-- Download and extract the package -->
-    <get src="${sourcefile}" httpusecaches="${trydownload.httpusecaches}" dest="${base.path}/file.tar.gz" />
-    <gunzip src="${base.path}/file.tar.gz" dest="${base.path}/file.tar"/>
-    <untar src="${base.path}/file.tar" dest="${base.path}"/>
-    <delete file="${base.path}/file.tar"/>
-    <delete file="${base.path}/file.tar.gz"/>
+    <local name="temp.file"/>
+    <mkdir dir="${base.path}"/>
+    <tempfile property="temp.file" destdir="${base.path}" prefix="download-"/>
+    <get src="${sourcefile}" httpusecaches="${trydownload.httpusecaches}" dest="${temp.file}.tar.gz" />
+    <gunzip src="${temp.file}.tar.gz" dest="${temp.file}.tar"/>
+    <untar src="${temp.file}.tar" dest="${base.path}"/>
+    <delete file="${temp.file}.tar"/>
+    <delete file="${temp.file}.tar.gz"/>
   </target>
 
   <target name="downloadgz-2" unless="exist" depends="setproxy,testexist">
     <!-- Download and extract the package from the two alternative locations -->
-    <delete file="${base.path}/file.tar" quiet="true" />
-    <delete file="${base.path}/file.tar.gz" quiet="true" />
+    <local name="temp.file"/>
+    <mkdir dir="${base.path}"/>
+    <tempfile property="temp.file" destdir="${base.path}" prefix="download-"/>
     <antcall target="trydownload">
       <param name="sourcefile" value="${sourcefile.1}" />
-      <param name="destfile" value="${base.path}/file.tar.gz" />
+      <param name="destfile" value="${temp.file}.tar.gz" />
     </antcall>
     <antcall target="trydownload">
       <param name="sourcefile" value="${sourcefile.2}" />
-      <param name="destfile" value="${base.path}/file.tar.gz" />
+      <param name="destfile" value="${temp.file}.tar.gz" />
     </antcall>
-    <gunzip src="${base.path}/file.tar.gz" dest="${base.path}/file.tar"/>
-    <untar src="${base.path}/file.tar" dest="${base.path}"/>
-    <delete file="${base.path}/file.tar"/>
-    <delete file="${base.path}/file.tar.gz"/>
+    <gunzip src="${temp.file}.tar.gz" dest="${temp.file}.tar"/>
+    <untar src="${temp.file}.tar" dest="${base.path}"/>
+    <delete file="${temp.file}.tar"/>
+    <delete file="${temp.file}.tar.gz"/>
   </target>
 
   <target name="downloadzip" unless="exist" depends="setproxy,testexist">
     <!-- Download and extract the package -->
-    <get src="${sourcefile}" httpusecaches="${trydownload.httpusecaches}" dest="${base.path}/file.zip" />
-    <mkdir dir="${destdir}" />
-    <unzip src="${base.path}/file.zip" dest="${destdir}"/>
-    <delete file="${base.path}/file.zip"/>
+    <local name="temp.file"/>
+    <mkdir dir="${base.path}"/>
+    <tempfile property="temp.file" destdir="${base.path}" prefix="download-" suffix=".zip"/>
+    <get src="${sourcefile}" httpusecaches="${trydownload.httpusecaches}" dest="${temp.file}"/>
+    <mkdir dir="${destdir}"/>
+    <unzip src="${temp.file}" dest="${destdir}"/>
+    <delete file="${temp.file}"/>
   </target>
 
   <target name="downloadzip-2" unless="exist" depends="testexist">
     <!-- Download and extract the package from the two alternative locations -->
-    <delete file="${base.path}/file.zip" quiet="true" />
+    <local name="temp.file"/>
+    <mkdir dir="${base.path}"/>
+    <tempfile property="temp.file" destdir="${base.path}" prefix="download-" suffix=".zip"/>
     <antcall target="trydownload">
       <param name="sourcefile" value="${sourcefile.1}" />
-      <param name="destfile" value="${base.path}/file.zip" />
+      <param name="destfile" value="${temp.file}" />
     </antcall>
     <antcall target="trydownload">
       <param name="sourcefile" value="${sourcefile.2}" />
-      <param name="destfile" value="${base.path}/file.zip" />
+      <param name="destfile" value="${temp.file}" />
     </antcall>
     <mkdir dir="${destdir}" />
-    <unzip src="${base.path}/file.zip" dest="${destdir}"/>
-    <delete file="${base.path}/file.zip"/>
+    <unzip src="${temp.file}" dest="${destdir}"/>
+    <delete file="${temp.file}"/>
   </target>
 
   <target name="downloadfile" unless="exist" depends="setproxy,testexist">
-    <!-- Download extract the file -->
-    <mkdir dir="${destdir}" />
-    <get src="${sourcefile}" httpusecaches="${trydownload.httpusecaches}" dest="${destfile}" />
+    <!-- Download the file -->
+    <local name="temp.file"/>
+    <mkdir dir="${base.path}"/>
+    <tempfile property="temp.file" destdir="${base.path}" prefix="download-" suffix=".tmp"/>
+    <get src="${sourcefile}" httpusecaches="${trydownload.httpusecaches}" dest="${temp.file}"/>
+    <mkdir dir="${destdir}"/>
+    <move file="${temp.file}" tofile="${destfile}"/>
   </target>
 
   <target name="downloadfile-2" unless="exist" depends="testexist">
     <!-- Download the file from the two alternative locations -->
-    <mkdir dir="${destdir}" />
+    <local name="temp.file"/>
+    <mkdir dir="${base.path}"/>
+    <tempfile property="temp.file" destdir="${base.path}" prefix="download-" suffix=".tmp"/>
 
     <antcall target="trydownload">
       <param name="sourcefile" value="${sourcefile.1}" />
+      <param name="destfile" value="${temp.file}" />
     </antcall>
 
     <antcall target="trydownload">
       <param name="sourcefile" value="${sourcefile.2}" />
+      <param name="destfile" value="${temp.file}" />
     </antcall>
 
-    <available file="${destfile}" property="exist"/>
+    <available file="${temp.file}" property="exist"/>
     <fail unless="exist" message="Failed to download [${destfile}]. All download sources are unavailable." />
+
+    <mkdir dir="${destdir}"/>
+    <move file="${temp.file}" tofile="${destfile}"/>
   </target>
 
   <target name="trydownload.check" depends="setproxy">

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1640396&r1=1640395&r2=1640396&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Nov 18 17:36:34 2014
@@ -74,6 +74,15 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="Other">
+    <changelog>
+      <update>
+        When downloading required libraries at build time, use random name
+        for temporary file and automatically create destination directory
+        (<code>base.path</code>). (kkolinko)
+      </update>
+    </changelog>
+  </subsection>
 </section>
 <section name="Tomcat 7.0.57 (violetagg)" rtext="released 2014-11-11">
   <subsection name="Catalina">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org