From f0654aa1e44ae1b7f840735d78ed01ea250000fa Mon Sep 17 00:00:00 2001
From: al_xipe <al_xipe@localhost>
Date: Sun, 18 Feb 2007 07:20:02 +0000
Subject: [PATCH] move from ant 1.6.5 to 1.7.0

---
 opends/ext/ant/bin/ant |   84 +++++++++++++++++++++++++++---------------
 1 files changed, 54 insertions(+), 30 deletions(-)

diff --git a/opends/ext/ant/bin/ant b/opends/ext/ant/bin/ant
index 14fc591..bcc63c8 100755
--- a/opends/ext/ant/bin/ant
+++ b/opends/ext/ant/bin/ant
@@ -1,18 +1,19 @@
 #! /bin/sh
 
-#   Copyright 2001-2004 The Apache Software Foundation
+# 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
 #
-#   Licensed 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
 #
-#       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.
+# 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.
 
 # Extract launch and ant arguments, (see details below).
 ant_exec_args=
@@ -43,9 +44,11 @@
   rpm_mode=false
   usejikes=$use_jikes_default
 else
-  # load system-wide ant configuration
-  if [ -f "/etc/ant.conf" ] ; then
-    . /etc/ant.conf
+  # load system-wide ant configuration (ONLY if ANT_HOME has NOT been set)
+  if [ -z "$ANT_HOME" -o "$ANT_HOME" = "/usr/share/ant" ]; then
+      if [ -f "/etc/ant.conf" ] ; then
+          . /etc/ant.conf
+      fi
   fi
 
   # load user ant configuration
@@ -87,15 +90,6 @@
 esac
 
 if [ -z "$ANT_HOME" -o ! -d "$ANT_HOME" ] ; then
-  # try to find ANT
-  if [ -d /opt/ant ] ; then
-    ANT_HOME=/opt/ant
-  fi
-
-  if [ -d "${HOME}/opt/ant" ] ; then
-    ANT_HOME="${HOME}/opt/ant"
-  fi
-
   ## resolve links - $0 may be a link to ant's home
   PRG="$0"
   progname=`basename "$0"`
@@ -130,9 +124,11 @@
 
 if [ -z "$JAVACMD" ] ; then
   if [ -n "$JAVA_HOME"  ] ; then
+    # IBM's JDK on AIX uses strange locations for the executables
     if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
-      # IBM's JDK on AIX uses strange locations for the executables
       JAVACMD="$JAVA_HOME/jre/sh/java"
+    elif [ -x "$JAVA_HOME/jre/bin/java" ] ; then
+      JAVACMD="$JAVA_HOME/jre/bin/java"
     else
       JAVACMD="$JAVA_HOME/bin/java"
     fi
@@ -153,12 +149,34 @@
 # Build local classpath using just the launcher in non-rpm mode or
 # use the Jpackage helper in rpm mode with basic and default jars
 # specified in the ant.conf configuration. Because the launcher is
-# used, libraries linked in ANT_HOME will also be include, but this
+# used, libraries linked in ANT_HOME/lib will also be included, but this
 # is discouraged as it is not java-version safe. A user should
 # request optional jars and their dependencies via the OPT_JAR_LIST
 # variable
-if $rpm_mode && [ -f /usr/bin/build-classpath ] ; then
+if $rpm_mode && [ -x /usr/bin/build-classpath ] ; then
   LOCALCLASSPATH="$(/usr/bin/build-classpath ant ant-launcher jaxp_parser_impl xml-commons-apis)"
+
+  # If no optional jars have been specified then build the default list
+  if [ -z "$OPT_JAR_LIST" ] ; then
+    for file in /etc/ant.d/*; do
+      if [ -f "$file" ]; then
+        case "$file" in
+        *~) ;;
+        *#*) ;;
+        *.rpmsave) ;;
+        *.rpmnew) ;;
+        *)
+          for dep in `cat "$file"`; do
+            case "$OPT_JAR_LIST" in
+            *"$dep"*) ;;
+            *) OPT_JAR_LIST="$OPT_JAR_LIST${OPT_JAR_LIST:+ }$dep"
+            esac
+          done
+        esac
+      fi
+    done
+  fi
+
   # If the user requested to try to add some other jars to the classpath
   if [ -n "$OPT_JAR_LIST" ] ; then
     _OPTCLASSPATH="$(/usr/bin/build-classpath $OPT_JAR_LIST 2> /dev/null)"
@@ -192,7 +210,7 @@
       LOCALCLASSPATH="$LOCALCLASSPATH:$CLASSPATH"
     fi
 
-    # remove class path from launcher -lib option
+    # remove class path from launcher -cp option
     CLASSPATH=""
   fi
 else
@@ -223,6 +241,10 @@
 fi
 
 # For Cygwin, switch paths to appropriate format before running java
+# For PATHs convert to unix format first, then to windows format to ensure
+# both formats are supported. Probably this will fail on directories with ;
+# in the name in the path. Let's assume that paths containing ; are more
+# rare than windows style paths on cygwin.
 if $cygwin; then
   if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then
     format=mixed
@@ -232,9 +254,11 @@
   ANT_HOME=`cygpath --$format "$ANT_HOME"`
   ANT_LIB=`cygpath --$format "$ANT_LIB"`
   JAVA_HOME=`cygpath --$format "$JAVA_HOME"`
-  LOCALCLASSPATH=`cygpath --path --$format "$LOCALCLASSPATH"`
+  LCP_TEMP=`cygpath --path --unix "$LOCALCLASSPATH"`
+  LOCALCLASSPATH=`cygpath --path --$format "$LCP_TEMP"`
   if [ -n "$CLASSPATH" ] ; then
-    CLASSPATH=`cygpath --path --$format "$CLASSPATH"`
+    CP_TEMP=`cygpath --path --unix "$CLASSPATH"`
+    CLASSPATH=`cygpath --path --$format "$CP_TEMP"`
   fi
   CYGHOME=`cygpath --$format "$HOME"`
 fi
@@ -295,7 +319,7 @@
     ant_sys_opts="-Djikes.class.path=\"$JIKESPATH\""
   fi
 fi
-ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -lib \"$CLASSPATH\" $ant_exec_args"
+ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args"
 if $ant_exec_debug ; then
     echo $ant_exec_command
 fi

--
Gitblit v1.10.0