hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cnaur...@apache.org
Subject svn commit: r1507386 - in /hadoop/common/branches/branch-1-win: CHANGES.branch-1-win.txt build.xml src/native/packageBinNativeHadoop.py src/native/packageBinNativeHadoop.sh
Date Fri, 26 Jul 2013 18:16:47 GMT
Author: cnauroth
Date: Fri Jul 26 18:16:47 2013
New Revision: 1507386

URL: http://svn.apache.org/r1507386
Log:
HADOOP-9609. Remove sh dependency of bin-package target. Contributed by Chuan Liu.

Added:
    hadoop/common/branches/branch-1-win/src/native/packageBinNativeHadoop.py
Modified:
    hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt
    hadoop/common/branches/branch-1-win/build.xml
    hadoop/common/branches/branch-1-win/src/native/packageBinNativeHadoop.sh

Modified: hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt?rev=1507386&r1=1507385&r2=1507386&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt (original)
+++ hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt Fri Jul 26 18:16:47 2013
@@ -320,6 +320,9 @@ Branch-hadoop-1-win (branched from branc
     TestReplicationPolicyWithNodeGroup failed caused by 1) old APIs and
     2) incorrect value of depthOfAllLeaves. (Xi Fang via cnauroth)
 
+    HADOOP-9609. Remove sh dependency of bin-package target. (Chuan Liu via
+    cnauroth)
+
   Merged from branch-1
 
     HDFS-385. Backport: Add support for an experimental API that allows a

Modified: hadoop/common/branches/branch-1-win/build.xml
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/build.xml?rev=1507386&r1=1507385&r2=1507386&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/build.xml (original)
+++ hadoop/common/branches/branch-1-win/build.xml Fri Jul 26 18:16:47 2013
@@ -115,6 +115,10 @@
             value="${build.c++}/examples/pipes"/>
   <property name="build.docs" value="${build.dir}/docs"/>
   <property name="build.docs.cn" value="${build.dir}/docs/cn"/>
+  <property name="forrest.home" value="${env.FORREST_HOME}"/>
+  <condition property="forrest.exec" value="${forrest.home}/bin/forrest.bat" else="${forrest.home}/bin/forrest">
+    <os family="windows" />
+  </condition>
   <property name="build.javadoc" value="${build.docs}/api"/>
   <property name="build.javadoc.dev" value="${build.docs}/dev-api"/>
   <property name="build.encoding" value="ISO-8859-1"/>
@@ -1462,7 +1466,7 @@
     <echo file="${build.dir}/hadoop.ent" append="false">
       &lt;!ENTITY HadoopVersion "${version}"&gt; 
     </echo>
-    <exec dir="${docs.src}" executable="${forrest.home}/bin/forrest"
+    <exec dir="${docs.src}" executable="${forrest.exec}"
 	  failonerror="true">
     </exec>
     <copy todir="${build.docs}">
@@ -1481,7 +1485,7 @@
   <target name="cn-docs" depends="forrest.check, init" 
        description="Generate forrest-based Chinese documentation. To use, specify -Dforrest.home=&lt;base
of Apache Forrest installation&gt; on the command line." 
         if="forrest.home">
-    <exec dir="${src.docs.cn}" executable="${forrest.home}/bin/forrest" failonerror="true">
+    <exec dir="${src.docs.cn}" executable="${forrest.exec}" failonerror="true">
       <env key="LANG" value="en_US.utf8"/>
     </exec>
     <copy todir="${build.docs.cn}">
@@ -1683,7 +1687,7 @@
     </copy>
 
     <exec dir="${dist.dir}" executable="python" failonerror="true">
-    <env key="BASE_NATIVE_LIB_DIR" value="${lib.dir}/native"/>
+      <env key="BASE_NATIVE_LIB_DIR" value="${lib.dir}/native"/>
       <env key="BUILD_NATIVE_DIR" value="${build.dir}/native"/>
       <env key="DIST_LIB_DIR" value="${dist.dir}/lib/native"/>
       <env key="BUNDLE_SNAPPY_LIB" value="${bundle.snappy}"/>
@@ -1914,18 +1918,22 @@
       </fileset>
     </copy>
 
+    <condition property="lib.data.model" value="lib/native" >
+        <os family="windows" />
+    </condition>
+
     <condition property="lib.data.model" value="lib64" else="lib" >
       <and>
         <equals arg1="${sun.arch.data.model}" arg2="64" />
       </and>
     </condition>
 
-    <exec dir="${dist.dir}" executable="sh" failonerror="true">
+    <exec dir="${dist.dir}" executable="python" failonerror="true">
       <env key="BASE_NATIVE_LIB_DIR" value="${lib.dir}/native"/>
       <env key="BUILD_NATIVE_DIR" value="${build.dir}/native"/>
       <env key="DIST_LIB_DIR" value="${dist.dir}/${lib.data.model}"/>
       <env key="NATIVE_PLATFORM" value="${build.platform}" />
-      <arg line="${native.src.dir}/packageBinNativeHadoop.sh"/>
+      <arg line="${native.src.dir}/packageBinNativeHadoop.py"/>
     </exec>
 
     <subant target="package">
@@ -3056,7 +3064,8 @@
 
   <target name="jsvc" >
     <mkdir dir="${jsvc.build.dir}" />
-    <get src="${jsvc.location}" dest="${jsvc.build.dir}/${jsvc.dest.name}"/>
+    <get src="${jsvc.location}" dest="${jsvc.build.dir}/${jsvc.dest.name}" />
+
     <untar compression="gzip" src="${jsvc.build.dir}/${jsvc.dest.name}" dest="${jsvc.build.dir}"
/>
 
     <copy file="${jsvc.build.dir}/jsvc" toFile="${jsvc.install.dir}/jsvc.${os.arch}" verbose="true"
/>

Added: hadoop/common/branches/branch-1-win/src/native/packageBinNativeHadoop.py
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/native/packageBinNativeHadoop.py?rev=1507386&view=auto
==============================================================================
--- hadoop/common/branches/branch-1-win/src/native/packageBinNativeHadoop.py (added)
+++ hadoop/common/branches/branch-1-win/src/native/packageBinNativeHadoop.py Fri Jul 26 18:16:47
2013
@@ -0,0 +1,78 @@
+#! /usr/bin/python
+
+# 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.
+
+
+# packageNativeHadoop.py - A simple script to help package native-hadoop libraries
+
+#
+# Note: 
+# This script relies on the following environment variables to function correctly:
+#  * BASE_NATIVE_LIB_DIR
+#  * BUILD_NATIVE_DIR
+#  * DIST_LIB_DIR
+# All these are setup by build.xml.
+#
+
+import os
+import sys
+import re
+from glob import iglob
+from shutil import copy2
+from shutil import copytree
+from os.path import join
+from os.path import basename
+
+# Convert Windows paths with back-slashes into canonical Unix paths
+# with forward slashes.  Unix paths are unchanged.  Mixed formats
+# just naively have back-slashes converted to forward slashes.
+def canonicalpath(path):
+  return re.sub('\\\\','/',path)
+
+def copy_files(src_glob, dst_folder):
+  for fname in iglob(src_glob):
+    src_file = canonicalpath(fname)
+    dst_file = canonicalpath(join(dst_folder, basename(fname)))
+    if (os.path.isdir(src_file)):
+      copytree(src_file, dst_file)
+    else:
+      copy2(src_file, dst_file)
+
+def main(argv=None):
+  dist_lib_dir = os.environ["DIST_LIB_DIR"]
+  platform = os.environ["NATIVE_PLATFORM"]
+  if not os.path.isdir(dist_lib_dir):
+    os.makedirs(dist_lib_dir)
+
+  # Copy the pre-built libraries in BASE_NATIVE_LIB_DIR
+  if os.path.isdir(os.environ["BASE_NATIVE_LIB_DIR"]):
+    base_path = canonicalpath(os.path.join(os.environ["BASE_NATIVE_LIB_DIR"], platform))
+    dist_path = canonicalpath(dist_lib_dir)
+    print "Copying libraries from %s to %s" % (base_path+ "/*hadoop*", dist_path)
+    copy_files(base_path + "/*hadoop*", dist_path)
+
+  # Copy the custom-built libraries in BUILD_NATIVE_DIR
+  if os.path.isdir(os.environ["BUILD_NATIVE_DIR"]):
+    base_path = canonicalpath(os.path.join(os.environ["BUILD_NATIVE_DIR"], platform))
+    dist_path = canonicalpath(dist_lib_dir)
+    print "Copying libraries from %s to %s" % (base_path+ "/lib/*hadoop*", dist_path)
+    copy_files(base_path + "/lib/*hadoop*", dist_path)
+
+  return 0
+
+##########################
+if __name__ == "__main__":
+  sys.exit(main())

Modified: hadoop/common/branches/branch-1-win/src/native/packageBinNativeHadoop.sh
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/native/packageBinNativeHadoop.sh?rev=1507386&r1=1507385&r2=1507386&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/src/native/packageBinNativeHadoop.sh (original)
+++ hadoop/common/branches/branch-1-win/src/native/packageBinNativeHadoop.sh Fri Jul 26 18:16:47
2013
@@ -1,61 +0,0 @@
-#!/bin/sh
-
-# 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.
-
-
-# packageBinNativeHadoop.sh - A simple script to help package a single set of 
-#     native-hadoop libraries for bin-packaging
-
-#
-# Note: 
-# This script relies on the following environment variables to function correctly:
-#  * BASE_NATIVE_LIB_DIR
-#  * BUILD_NATIVE_DIR
-#  * DIST_LIB_DIR
-#  * NATIVE_PLATFORM
-# All these are setup by build.xml.
-#
-
-TAR='tar cf -'
-UNTAR='tar xfBp -'
-platform=$NATIVE_PLATFORM
-
-# Copy the pre-built libraries in $BASE_NATIVE_LIB_DIR
-if [ -d $BASE_NATIVE_LIB_DIR ]
-then
-  echo "Copying libraries in $BASE_NATIVE_LIB_DIR/$platform to $DIST_LIB_DIR/"
-  if [ ! -d $BASE_NATIVE_LIB_DIR/$platform ]
-  then 
-    echo "ERROR: Platform $platform does not exist in $BASE_NATIVE_LIB_DIR"
-    exit -1
-  fi
-  cd $BASE_NATIVE_LIB_DIR/$platform/
-  $TAR *hadoop* | (cd $DIST_LIB_DIR/; $UNTAR)
-fi
-
-# Copy the custom-built libraries in $BUILD_NATIVE_DIR
-if [ -d $BUILD_NATIVE_DIR ]
-then 
-  echo "Copying libraries in $BUILD_NATIVE_DIR/$platform/lib to $DIST_LIB_DIR/"
-  if [ ! -d $BUILD_NATIVE_DIR/$platform ]
-  then
-    echo "ERROR: Platform $platform does not exist in $BUILD_NATIVE_DIR"
-    exit -1
-  fi
-  cd $BUILD_NATIVE_DIR/$platform/lib
-  $TAR *hadoop* | (cd $DIST_LIB_DIR/; $UNTAR)
-fi
-



Mime
View raw message