mirror of
https://github.com/apache/sqoop.git
synced 2025-05-04 08:50:50 +08:00
Remove dependency on installed Hadoop for script generation.
From: Aaron Kimball <aaron@cloudera.com> git-svn-id: https://svn.apache.org/repos/asf/incubator/sqoop/trunk@1149912 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7b37789b4f
commit
7ecb3ee286
10
build.xml
10
build.xml
@ -312,10 +312,20 @@
|
|||||||
the wrapper scripts to invoke each of these.
|
the wrapper scripts to invoke each of these.
|
||||||
-->
|
-->
|
||||||
<mkdir dir="${build.bin.dir}" />
|
<mkdir dir="${build.bin.dir}" />
|
||||||
|
<java classname="com.cloudera.sqoop.Sqoop"
|
||||||
|
fork="true"
|
||||||
|
failonerror="true"
|
||||||
|
output="${build.dir}/tools-list"
|
||||||
|
error="/dev/null">
|
||||||
|
<jvmarg value="-Dhadoop.security.log.file=${build.dir}/security-audit.log" />
|
||||||
|
<arg value="help" />
|
||||||
|
<classpath refid="compile.classpath"/>
|
||||||
|
</java>
|
||||||
<exec executable="${script.src.dir}/create-tool-scripts.sh"
|
<exec executable="${script.src.dir}/create-tool-scripts.sh"
|
||||||
dir="${basedir}" failonerror="true">
|
dir="${basedir}" failonerror="true">
|
||||||
<arg value="${build.bin.dir}" />
|
<arg value="${build.bin.dir}" />
|
||||||
<arg value="${script.src.dir}/tool-script.sh.template" />
|
<arg value="${script.src.dir}/tool-script.sh.template" />
|
||||||
|
<arg value="${build.dir}/tools-list" />
|
||||||
</exec>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Licensed to Cloudera, Inc. under one or more
|
# Licensed to Cloudera, Inc. under one or more
|
||||||
# contributor license agreements. See the NOTICE file distributed with
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -18,15 +18,19 @@
|
|||||||
# Arguments to this script:
|
# Arguments to this script:
|
||||||
# The output directory for the result scripts
|
# The output directory for the result scripts
|
||||||
# The path to the script template file.
|
# The path to the script template file.
|
||||||
|
# A file containing the list of tools, one per line.
|
||||||
# This script should be run in the base directory of the project.
|
# This script should be run in the base directory of the project.
|
||||||
# It will run 'bin/sqoop help' and determine the names of all subprograms,
|
# It will run 'bin/sqoop help' and determine the names of all subprograms,
|
||||||
# and then generate wrapper scripts for each of these.
|
# and then generate wrapper scripts for each of these.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
bin=`dirname $0`
|
bin=`dirname $0`
|
||||||
bin=`cd ${bin} && pwd`
|
bin=`cd ${bin} && pwd`
|
||||||
|
|
||||||
outdir=$1
|
outdir=$1
|
||||||
template=$2
|
template=$2
|
||||||
|
toollistfile=$3
|
||||||
|
|
||||||
if [ -z "$outdir" ]; then
|
if [ -z "$outdir" ]; then
|
||||||
echo "Output directory is required as the first argument."
|
echo "Output directory is required as the first argument."
|
||||||
@ -38,6 +42,11 @@ if [ -z "$template" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$toollistfile" ]; then
|
||||||
|
echo "The list of tools is not specified"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -d "$outdir" ]; then
|
if [ ! -d "$outdir" ]; then
|
||||||
echo "Output directory does not exist!"
|
echo "Output directory does not exist!"
|
||||||
exit 1
|
exit 1
|
||||||
@ -48,8 +57,14 @@ if [ ! -f "$template" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$toollistfile" ]; then
|
||||||
|
echo "Could not find tool list file: " $toollistfile
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Query 'sqoop help' for the list of available commands.
|
# Query 'sqoop help' for the list of available commands.
|
||||||
subprograms=`bin/sqoop help | awk ' BEGIN {use=0} /^$/ {use=0} \
|
# The output of 'sqoop help' has been written to $toollistfile.
|
||||||
|
subprograms=`cat $toollistfile | awk ' BEGIN {use=0} /^$/ {use=0} \
|
||||||
{ if (use) { print $1 } else { } } /^Available/ {use=1} '`
|
{ if (use) { print $1 } else { } } /^Available/ {use=1} '`
|
||||||
|
|
||||||
# For each of these, copy the template into place and sed the
|
# For each of these, copy the template into place and sed the
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Licensed to Cloudera, Inc. under one or more
|
# Licensed to Cloudera, Inc. under one or more
|
||||||
# contributor license agreements. See the NOTICE file distributed with
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
|
Loading…
Reference in New Issue
Block a user