소스 검색

MAPREDUCE-4780. MapReduce distribution build fails on Windows. Contributed by Chris Nauroth.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-trunk-win@1408416 13f79535-47bb-0310-9956-ffa450edef68
Suresh Srinivas 12 년 전
부모
커밋
85bd709c2f
2개의 변경된 파일15개의 추가작업 그리고 13개의 파일을 삭제
  1. 2 0
      hadoop-mapreduce-project/CHANGES.branch-trunk-win.txt
  2. 13 13
      hadoop-mapreduce-project/pom.xml

+ 2 - 0
hadoop-mapreduce-project/CHANGES.branch-trunk-win.txt

@@ -3,3 +3,5 @@ branch-trunk-win changes - unreleased
   MAPREDUCE-4739. Some MapReduce tests fail to find winutils.
   MAPREDUCE-4739. Some MapReduce tests fail to find winutils.
   (Chris Nauroth via suresh)
   (Chris Nauroth via suresh)
 
 
+  MAPREDUCE-4780. MapReduce distribution build fails on Windows.
+  (Chris Nauroth via suresh)

+ 13 - 13
hadoop-mapreduce-project/pom.xml

@@ -178,22 +178,22 @@
               <goal>run</goal>
               <goal>run</goal>
             </goals>
             </goals>
             <configuration>
             <configuration>
-              <!-- this is identical from hadoop-project-dist, eventually they must be unified -->
               <target if="tar">
               <target if="tar">
-                <!-- Using Unix script to preserve symlinks -->
-                <echo file="${project.build.directory}/dist-maketar.sh">
+                <!-- This script preserves permissions and symlinks. -->
+                <!-- Python requires resetting indentation to far left. -->
+                <echo file="${project.build.directory}/dist-maketar.py">
+from os.path import join, normpath
+import tarfile
 
 
-                  which cygpath 2&gt; /dev/null
-                  if [ $? = 1 ]; then
-                    BUILD_DIR="${project.build.directory}"
-                  else
-                    BUILD_DIR=`cygpath --unix '${project.build.directory}'`
-                  fi
-                  cd $BUILD_DIR
-                  tar czf ${project.artifactId}-${project.version}.tar.gz ${project.artifactId}-${project.version}
+base_name = "${project.artifactId}" + "-" + "${project.version}"
+dir_name = normpath(join(r"${project.build.directory}", base_name))
+tar_name = dir_name + ".tar.gz"
+
+with tarfile.open(tar_name, "w:gz") as tar:
+  tar.add(dir_name, arcname=base_name)
                 </echo>
                 </echo>
-                <exec executable="sh" dir="${project.build.directory}" failonerror="true">
-                  <arg line="./dist-maketar.sh"/>
+                <exec executable="python" dir="${project.build.directory}" failonerror="true">
+                  <arg value="dist-maketar.py" />
                 </exec>
                 </exec>
               </target>
               </target>
             </configuration>
             </configuration>