5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-02 15:12:33 +08:00
sqoop/bin/sqoop
Andrew Bayer 15c1ba7241 SQOOP-53. Build test jar and publish to maven.
Sqoop now builds a sqoop-test-(version).jar file.
Added "jar-all" target to build.xml to build all artifacts.
Default ant target switched to "jar-all".
mvn-install, mvn-deploy updated deploy to deploy all main, test, and shim jars.
Added source jar artifacts to maven installation/deploy process.
Fixed build dependency bugs in generated poms.
Added Sqoop pom template; generating from ivy.xml was over-broad.
write-version-info.sh generates correct directory hierarchy in build/src/.
bin/sqoop and bin/configure-sqoop tweaked to account for multiple sqoop-* jars
in the $SQOOP_HOME directory.

From: Aaron Kimball <aaron@cloudera.com>

git-svn-id: https://svn.apache.org/repos/asf/incubator/sqoop/trunk@1149946 13f79535-47bb-0310-9956-ffa450edef68
2011-07-22 20:04:07 +00:00

99 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
#
# Licensed to Cloudera, Inc. under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# Cloudera, Inc. 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.
follow_one() {
# Resolve symlinks and relative path components along a path. This requires
# its argument to be an absolute path. This does not recursively re-resolve
# symlinks; if that is required, use the 'follow' method.
target=$1
OIFS=$IFS
IFS='/'
# Taking each dir component along the way, build up a new target directory,
# resolving '.', '..', and symlinks.
newtarget=''
for part in ${target}; do
if [ -z "${part}" ]; then
continue # Empty dir part. 'foo//bar'
elif [ "." == "${part}" ]; then
continue # Nothing special to do for '.'
elif [ ".." == "${part}" ]; then
IFS=$OIFS
newtarget=`dirname ${newtarget}` # pop a component.
elif [ -h "${newtarget}/${part}" ]; then
IFS=$OIFS
link=`readlink ${newtarget}/${part}`
# links can be relative or absolute. Relative ones get appended to
# newtarget; absolute ones replace it.
if [ "${link:0:1}" != "/" ]; then
newtarget="${newtarget}/${link}" # relative
else
newtarget="${link}" # absolute
fi
else # Regular file component.
newtarget="${newtarget}/${part}"
fi
IFS='/'
done
IFS=$OIFS
echo $newtarget
}
follow() {
# Portable 'readlink -f' function to follow a file's links to the final
# target. Calls follow_one recursively til we're finished tracing symlinks.
target=$1
depth=$2
if [ -z "$depth" ]; then
depth=0
elif [ "$depth" == "1000" ]; then
# Don't recurse indefinitely; we've probably hit a symlink cycle.
# Just bail out here.
echo $target
return 1
fi
# Canonicalize the target to be an absolute path.
targetdir=`dirname ${target}`
targetdir=`cd ${targetdir} && pwd`
target=${targetdir}/`basename ${target}`
# Use follow_one to resolve links. Test that we get the same result twice,
# to terminate iteration.
first=`follow_one ${target}`
second=`follow_one ${first}`
if [ "${first}" == "${second}" ]; then
# We're done.
echo "${second}"
else
# Need to continue resolving links.
echo `follow ${second} $(( $depth + 1 ))`
fi
}
prgm=`follow $0`
bin=`dirname ${prgm}`
bin=`cd ${bin} && pwd`
source ${bin}/configure-sqoop "${bin}"
exec ${HADOOP_HOME}/bin/hadoop com.cloudera.sqoop.Sqoop "$@"