5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-03 18:19:23 +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:
Andrew Bayer 2011-07-22 20:03:56 +00:00
parent 7b37789b4f
commit 7ecb3ee286
3 changed files with 28 additions and 3 deletions

View File

@ -312,10 +312,20 @@
the wrapper scripts to invoke each of these.
-->
<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"
dir="${basedir}" failonerror="true">
<arg value="${build.bin.dir}" />
<arg value="${script.src.dir}/tool-script.sh.template" />
<arg value="${build.dir}/tools-list" />
</exec>
</target>

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Licensed to Cloudera, Inc. under one or more
# contributor license agreements. See the NOTICE file distributed with
@ -18,15 +18,19 @@
# Arguments to this script:
# The output directory for the result scripts
# 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.
# It will run 'bin/sqoop help' and determine the names of all subprograms,
# and then generate wrapper scripts for each of these.
set -e
bin=`dirname $0`
bin=`cd ${bin} && pwd`
outdir=$1
template=$2
toollistfile=$3
if [ -z "$outdir" ]; then
echo "Output directory is required as the first argument."
@ -38,6 +42,11 @@ if [ -z "$template" ]; then
exit 1
fi
if [ -z "$toollistfile" ]; then
echo "The list of tools is not specified"
exit 1
fi
if [ ! -d "$outdir" ]; then
echo "Output directory does not exist!"
exit 1
@ -48,8 +57,14 @@ if [ ! -f "$template" ]; then
exit 1
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.
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} '`
# For each of these, copy the template into place and sed the

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Licensed to Cloudera, Inc. under one or more
# contributor license agreements. See the NOTICE file distributed with