sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject git commit: SQOOP-954: Create Sqoop runtime scripts to run Sqoop on Windows
Date Tue, 23 Apr 2013 18:55:27 GMT
Updated Branches:
  refs/heads/trunk 389187058 -> ed2a90363


SQOOP-954: Create Sqoop runtime scripts to run Sqoop on Windows

(Ahmed El Baz via Jarek Jarcec Cecho)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/ed2a9036
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/ed2a9036
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/ed2a9036

Branch: refs/heads/trunk
Commit: ed2a9036345d03c35cad9071d7e19c8d825f00c3
Parents: 3891870
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Tue Apr 23 11:54:49 2013 -0700
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Tue Apr 23 11:54:49 2013 -0700

----------------------------------------------------------------------
 bin/configure-sqoop.cmd     |  144 ++++++++++++++++++++++++++++++++++++++
 bin/sqoop.cmd               |   29 ++++++++
 conf/sqoop-env-template.cmd |   36 ++++++++++
 3 files changed, 209 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/ed2a9036/bin/configure-sqoop.cmd
----------------------------------------------------------------------
diff --git a/bin/configure-sqoop.cmd b/bin/configure-sqoop.cmd
new file mode 100644
index 0000000..f5fd608
--- /dev/null
+++ b/bin/configure-sqoop.cmd
@@ -0,0 +1,144 @@
+:: 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.
+
+if not exist %bin% (
+  echo Error: Environment variable bin not defined.
+  echo This is generally because this script should not be invoked directly. Use sqoop instead.
+  exit /b 1
+)
+
+if not defined SQOOP_HOME (
+  set SQOOP_HOME=%bin%\..
+)
+
+if not defined SQOOP_CONF_DIR (
+  set SQOOP_CONF_DIR=%SQOOP_HOME%\conf
+)
+
+:: Call sqoop-env if it exists under SQOOP_CONF_DIR
+if exist %SQOOP_CONF_DIR%\sqoop-env.cmd (
+  call %SQOOP_CONF_DIR%\sqoop-env.cmd
+)
+
+:: Find paths to our dependency systems. If they are unset, use CDH defaults.
+
+if not defined HADOOP_COMMON_HOME (
+  if defined HADOOP_HOME (
+    set HADOOP_COMMON_HOME=%HADOOP_HOME%
+  ) else (
+    :: Check: If we can't find our dependencies, give up here.
+    echo Error: The environment variable HADOOP_HOME has not been defined.
+    echo Please set HADOOP_HOME to the root of your Hadoop installation.
+    exit /b 1
+  )
+)
+if not defined HADOOP_MAPRED_HOME (
+  if defined HADOOP_HOME (
+    set HADOOP_MAPRED_HOME=%HADOOP_HOME%
+  ) else (
+    :: Check: If we can't find our dependencies, give up here.
+    echo Error: The environment variable HADOOP_HOME has not been defined.
+    echo Please set HADOOP_HOME to the root of your Hadoop installation.
+    exit /b 1
+  )
+)
+:: Check for HBase dependency
+if not defined HBASE_HOME (
+  if defined HBASE_VERSION (
+    set HBASE_HOME=%HADOOP_HOME%\..\hbase-%HBASE_VERSION%
+  ) else (
+    echo Warning: HBASE_HOME and HBASE_VERSION not set.
+  )
+)
+
+:: Check: If we can't find our dependencies, give up here.
+
+:: Check: If HADOOP_COMMON_HOME path actually exists
+if not exist %HADOOP_COMMON_HOME% (
+  echo Error: HADOOP_COMMON_HOME does not exist!
+  echo Please set HADOOP_COMMON_HOME to the root of your Hadoop installation.
+  exit /b 1
+)
+:: Check: If HADOOP_MAPRED_HOME path actually exists
+if not exist %HADOOP_MAPRED_HOME% (
+  echo Error: HADOOP_MAPRED_HOME does not exist!
+  echo Please set HADOOP_MAPRED_HOME to the root of your Hadoop installation.
+  exit /b 1
+)
+if not exist "%HBASE_HOME%" (
+  echo Warning: HBASE_HOME does not exist! HBase imports will fail.
+  echo Please set HBASE_HOME to the root of your HBase installation.
+)
+
+:: Add sqoop dependencies to classpath
+set SQOOP_CLASSPATH=
+
+:: Where to find the main Sqoop jar
+set SQOOP_JAR_DIR=%SQOOP_HOME%
+
+:: If there's a "build" subdir, override with this, so we use
+:: the newly-compiled copy.
+if exist "%SQOOP_JAR_DIR%\build" (
+  set SQOOP_JAR_DIR=%SQOOP_JAR_DIR%\build
+)
+call :add_dir_to_classpath %SQOOP_JAR_DIR%
+
+if exist "%SQOOP_HOME%\lib" (
+  call :add_dir_to_classpath %SQOOP_HOME%\lib
+)
+
+:: Add HBase to dependency list
+if exist "%HBASE_HOME%" (
+  call :add_dir_to_classpath %HBASE_HOME%
+  call :add_dir_to_classpath %HBASE_HOME%\lib
+)
+
+if not defined ZOOCFGDIR (
+  if defined ZOOKEEPER_CONF_DIR (
+    set ZOOCFGDIR=%ZOOKEEPER_CONF_DIR%
+  ) else (
+  if defined ZOOKEEPER_HOME (
+    set ZOOCFGDIR=%ZOOKEEPER_HOME%\conf
+  ))
+)
+
+if "%ZOOCFGDIR%" NEQ "" (
+  call :add_dir_to_classpath %ZOOCFGDIR%
+)
+
+call :add_dir_to_classpath %SQOOP_CONF_DIR%
+
+:: If there's a build subdir, use Ivy-retrieved dependencies too.
+if exist "%SQOOP_HOME%\build\ivy\lib\sqoop" (
+  call :add_dir_to_classpath %SQOOP_HOME%\build\ivy\lib\sqoop
+)
+
+set HADOOP_CLASSPATH=%SQOOP_CLASSPATH%;%HADOOP_CLASSPATH%
+if defined SQOOP_USER_CLASSPATH (
+  :: User has elements to prepend to the classpath, forcibly overriding
+  :: Sqoop's own lib directories.
+  set HADOOP_CLASSPATH=%SQOOP_USER_CLASSPATH%;%HADOOP_CLASSPATH%
+)
+
+goto :eof
+
+:: Function to add the given directory to the list of classpath directories
+:: All jars under the given directory are added to the classpath
+:add_dir_to_classpath
+if not "%1"=="" (
+  set SQOOP_CLASSPATH=!SQOOP_CLASSPATH!;%1\*
+)
+goto :eof

http://git-wip-us.apache.org/repos/asf/sqoop/blob/ed2a9036/bin/sqoop.cmd
----------------------------------------------------------------------
diff --git a/bin/sqoop.cmd b/bin/sqoop.cmd
new file mode 100644
index 0000000..c2b997f
--- /dev/null
+++ b/bin/sqoop.cmd
@@ -0,0 +1,29 @@
+@echo off
+:: 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.
+
+setlocal enabledelayedexpansion
+
+set prgm=%~f0
+set bin=%~dp0
+if "%bin:~-1%" == "\" (
+  set bin=%bin:~0,-1%
+)
+
+call "%bin%\configure-sqoop.cmd" "%bin%"
+call %HADOOP_HOME%\bin\hadoop org.apache.sqoop.Sqoop %*
+
+endlocal

http://git-wip-us.apache.org/repos/asf/sqoop/blob/ed2a9036/conf/sqoop-env-template.cmd
----------------------------------------------------------------------
diff --git a/conf/sqoop-env-template.cmd b/conf/sqoop-env-template.cmd
new file mode 100644
index 0000000..9a598d4
--- /dev/null
+++ b/conf/sqoop-env-template.cmd
@@ -0,0 +1,36 @@
+@echo off
+:: 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.
+
+:: included in all the hadoop scripts with source command
+:: should not be executable directly
+:: also should not be passed any arguments, since we need original $*
+
+:: Set Hadoop-specific environment variables here.
+
+::Set path to where bin/hadoop is available
+::set HADOOP_COMMON_HOME=
+
+::Set path to where hadoop-*-core.jar is available
+::set HADOOP_MAPRED_HOME=
+
+::set the path to where bin/hbase is available
+::set HBASE_HOME=
+
+::Set the path to where bin/hive is available
+::set HIVE_HOME=
+
+::Set the path for where zookeper config dir is
+::set ZOOCFGDIR=


Mime
View raw message