MAPREDUCE-1926. MapReduce distribution is missing build-utils.xml

git-svn-id: https://svn.apache.org/repos/asf/hadoop/mapreduce/trunk@983122 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.txt b/CHANGES.txt
index cb1bf63..f7cbcbb 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1726,3 +1726,7 @@
 
     MAPREDUCE-1876. Fixes TaskAttemptStartedEvent to correctly log event type
     for all task types. (Amar Kamat via amareshwari)
+
+    MAPREDUCE-1926. MapReduce distribution is missing build-utils.xml.
+    (tomwhite)
+
diff --git a/build.xml b/build.xml
index af51638..4fb4f9e 100644
--- a/build.xml
+++ b/build.xml
@@ -865,8 +865,9 @@
   <!-- ================================================================== -->
   
   <target name="docs" depends="forrest.check" description="Generate forrest-based documentation. To use, specify -Dforrest.home=&lt;base of Apache Forrest installation&gt; on the command line." if="forrest.home">
+  	<!-- The template file may not exist if building from a tarball -->
   	<copy file="${conf.dir}/mapred-queues.xml.template"
-  	      tofile="${build.docs}/mapred-queues.xml"/>
+  	      tofile="${build.docs}/mapred-queues.xml" failonerror="false"/>
     <exec dir="${docs.src}" executable="${forrest.home}/bin/forrest"
 	  failonerror="true">
       <env key="JAVA_HOME" value="${java5.home}"/>
@@ -1139,6 +1140,7 @@
     </copy>
 
     <copy todir="${dist.dir}/" file="build.xml"/>
+    <copy todir="${dist.dir}/" file="build-utils.xml"/>
 
     <chmod perm="ugo+x" type="file" parallel="false">
         <fileset dir="${dist.dir}/bin"/>
diff --git a/src/contrib/capacity-scheduler/build.xml b/src/contrib/capacity-scheduler/build.xml
index dd62fd8..0e4e986 100644
--- a/src/contrib/capacity-scheduler/build.xml
+++ b/src/contrib/capacity-scheduler/build.xml
@@ -25,9 +25,19 @@
 
   <import file="../build-contrib.xml"/>
 
-  <target name="docs" depends="forrest.check" description="Generate forrest-based documentation. To use, specify -Dforrest.home=&lt;base of Apache Forrest installation&gt; on the command line." if="forrest.home">
+  <target name="docs.check">
+    <condition property="generate-capacity-scheduler-docs">
+      <and>
+        <isset property="forrest.home"/>
+        <available file="${conf.dir}/capacity-scheduler.xml.template" property="capacity-scheduler.xml.template.present"/>
+      </and>
+    </condition>
+  </target>
+  <target name="docs" depends="forrest.check,docs.check" if="generate-capacity-scheduler-docs" description="Generate forrest-based documentation. To use, specify -Dforrest.home=&lt;base of Apache Forrest installation&gt; on the command line.">
+  	<!-- The template file may not exist if building from a tarball -->
   	<copy file="src/java/mapred-queues.xml.template"
-  	      tofile="${build.docs}/mapred-queues-capacity-scheduler.xml"/>
+  	      tofile="${build.docs}/mapred-queues-capacity-scheduler.xml"
+  	      failonerror="false"/>
     <xslt in="${conf.dir}/capacity-scheduler.xml.template"
     	out="${build.docs}/capacity-scheduler-conf.html"
     	style="${conf.dir}/configuration.xsl"/>