From 355d00685137aa0c42fdd93853096ac718a474b2 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Thu, 8 Jan 2015 16:48:29 -0500
Subject: [PATCH] Rationalize use of AUTOBUILD environment variable across
 languages. Ensure that AUTOBUILD is always in native path syntax on every
 platform. Remove local build.sh logic to infer AUTOBUILD: either the generic
 build.sh has set it properly, or scream for help. Since cygwin bash scripts
 need a cygwin-syntax path to autobuild, convert to a local 'autobuild'
 variable using shell_path. Remove kludges in other languages involving
 cygdrive twiddling.

---
 build.sh                         | 36 ++++++++++----------------------
 indra/cmake/FindAutobuild.cmake  | 21 +++++++------------
 indra/newview/viewer_manifest.py |  4 ++--
 scripts/packages-formatter.py    |  6 +-----
 4 files changed, 22 insertions(+), 45 deletions(-)

diff --git a/build.sh b/build.sh
index 690e9c0ec3e..9e1ebf21495 100755
--- a/build.sh
+++ b/build.sh
@@ -101,7 +101,7 @@ pre_build()
 
     check_for "Confirm dictionaries are installed before 'autobuild configure'" ${build_dir}/packages/dictionaries
 
-    "$AUTOBUILD" configure -c $variant -- \
+    "$autobuild" configure -c $variant -- \
      -DPACKAGE:BOOL=ON \
      -DRELEASE_CRASH_REPORTING:BOOL=ON \
      -DVIEWER_CHANNEL:STRING="\"$viewer_channel\"" \
@@ -119,12 +119,12 @@ package_llphysicsextensions_tpv()
   if [ "$variant" = "Release" ]
   then 
       llpetpvcfg=$build_dir/packages/llphysicsextensions/autobuild-tpv.xml
-      "$AUTOBUILD" build --verbose --config-file $llpetpvcfg -c Tpv
+      "$autobuild" build --verbose --config-file $llpetpvcfg -c Tpv
       
       # capture the package file name for use in upload later...
       PKGTMP=`mktemp -t pgktpv.XXXXXX`
       trap "rm $PKGTMP* 2>/dev/null" 0
-      "$AUTOBUILD" package --verbose --config-file $llpetpvcfg --results-file "$(native_path $PKGTMP)"
+      "$autobuild" package --verbose --config-file $llpetpvcfg --results-file "$(native_path $PKGTMP)"
       tpv_status=$?
       if [ -r "${PKGTMP}" ]
       then
@@ -148,7 +148,7 @@ build()
   then
     begin_section "Viewer$variant"
 
-    "$AUTOBUILD" build --no-configure -c $variant
+    "$autobuild" build --no-configure -c $variant
     build_ok=$?
     end_section "Viewer$variant"
 
@@ -216,30 +216,16 @@ fi
 # Check to see if we're skipping the platform
 eval '$build_'"$arch" || pass
 
-if [ -z "$AUTOBUILD" ]
+# set "$autobuild" to cygwin path form for use locally in this script
+autobuild="$(shell_path "$AUTOBUILD")"
+if [ ! -x "$autobuild" ]
 then
-  export autobuild_dir="$here/../../../autobuild/bin/"
-  if [ -d "$autobuild_dir" ]
-  then
-    export AUTOBUILD="$autobuild_dir"autobuild
-    if [ -x "$AUTOBUILD" ]
-    then
-      # *HACK - bash doesn't know how to pass real pathnames to native windows python
-      case "$arch" in
-      CYGWIN) AUTOBUILD=$(cygpath -u $AUTOBUILD.cmd) ;;
-      esac
-    else
-      record_failure "Not executable: $AUTOBUILD"
-      exit 1
-    fi
-  else
-    record_failure "Not found: $autobuild_dir"
-    exit 1
-  fi
+  record_failure "AUTOBUILD not executable: '$autobuild'"
+  exit 1
 fi
 
-# load autbuild provided shell functions and variables
-eval "$("$AUTOBUILD" source_environment)"
+# load autobuild provided shell functions and variables
+eval "$("$autobuild" source_environment)"
 
 # dump environment variables for debugging
 begin_section "Environment"
diff --git a/indra/cmake/FindAutobuild.cmake b/indra/cmake/FindAutobuild.cmake
index 84ae41e8aa7..ea5ad6d1086 100755
--- a/indra/cmake/FindAutobuild.cmake
+++ b/indra/cmake/FindAutobuild.cmake
@@ -4,7 +4,7 @@
 #
 # Output variables:
 #
-#   AUTOBUILD_EXECUTABLE - path to autobuild or pautobuild executable
+#   AUTOBUILD_EXECUTABLE - path to autobuild executable
 
 
 
@@ -13,12 +13,9 @@ IF (NOT AUTOBUILD_EXECUTABLE)
   # If cmake was executed by autobuild, autobuild will have set the AUTOBUILD env var
   IF (DEFINED ENV{AUTOBUILD})
     SET(AUTOBUILD_EXECUTABLE $ENV{AUTOBUILD})
-    # In case $AUTOBUILD is a cygwin path, fix it back to Windows style
-    STRING(REGEX REPLACE "^/cygdrive/(.)/" "\\1:/" AUTOBUILD_EXECUTABLE
-           "${AUTOBUILD_EXECUTABLE}")
   ELSE (DEFINED ENV{AUTOBUILD})
     IF(WIN32)
-      SET(AUTOBUILD_EXE_NAMES autobuild.cmd autobuild.exe)
+      SET(AUTOBUILD_EXE_NAMES autobuild.exe autobuild.cmd)
     ELSE(WIN32)
       SET(AUTOBUILD_EXE_NAMES autobuild)
     ENDIF(WIN32)
@@ -28,21 +25,19 @@ IF (NOT AUTOBUILD_EXECUTABLE)
       AUTOBUILD_EXECUTABLE 
       NAMES ${AUTOBUILD_EXE_NAMES}
       PATHS 
-    ENV PATH
-    ${CMAKE_SOURCE_DIR}/.. 
-    ${CMAKE_SOURCE_DIR}/../..
-    ${CMAKE_SOURCE_DIR}/../../..
+        ENV PATH
+        ${CMAKE_SOURCE_DIR}/.. 
+        ${CMAKE_SOURCE_DIR}/../..
+        ${CMAKE_SOURCE_DIR}/../../..
       PATH_SUFFIXES "/autobuild/bin/"
     )
   ENDIF (DEFINED ENV{AUTOBUILD})
 
-  IF (AUTOBUILD_EXECUTABLE)
-    GET_FILENAME_COMPONENT(_autobuild_name ${AUTOBUILD_EXECUTABLE} NAME_WE)
-  ELSE (AUTOBUILD_EXECUTABLE)
+  IF (NOT AUTOBUILD_EXECUTABLE)
     IF (AUTOBUILD_FIND_REQUIRED)
       MESSAGE(FATAL_ERROR "Could not find autobuild executable")
     ENDIF (AUTOBUILD_FIND_REQUIRED)
-  ENDIF (AUTOBUILD_EXECUTABLE)
+  ENDIF (NOT AUTOBUILD_EXECUTABLE)
 
   MARK_AS_ADVANCED(AUTOBUILD_EXECUTABLE)
 ENDIF (NOT AUTOBUILD_EXECUTABLE)
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index c360fc32ac1..33f31c05786 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -38,7 +38,7 @@
 # Put it FIRST because some of our build hosts have an ancient install of
 # indra.util.llmanifest under their system Python!
 sys.path.insert(0, os.path.join(viewer_dir, os.pardir, "lib", "python"))
-from indra.util.llmanifest import LLManifest, main, proper_windows_path, path_ancestors, CHANNEL_VENDOR_BASE, RELEASE_CHANNEL, ManifestError
+from indra.util.llmanifest import LLManifest, main, path_ancestors, CHANNEL_VENDOR_BASE, RELEASE_CHANNEL, ManifestError
 try:
     from llbase import llsd
 except ImportError:
@@ -613,7 +613,7 @@ def package_finish(self):
         while (not installer_created) and (nsis_attempts > 0):
             try:
                 nsis_attempts-=1;
-                self.run_command('"' + proper_windows_path(NSIS_path) + '" ' + self.dst_path_of(tempfile))
+                self.run_command('"' + NSIS_path + '" ' + self.dst_path_of(tempfile))
                 installer_created=True # if no exception was raised, the codesign worked
             except ManifestError, err:
                 if nsis_attempts:
diff --git a/scripts/packages-formatter.py b/scripts/packages-formatter.py
index 7e5e690e49f..4e66cf9ed44 100755
--- a/scripts/packages-formatter.py
+++ b/scripts/packages-formatter.py
@@ -30,11 +30,7 @@
 import re
 import subprocess
 
-_autobuild=os.getenv('AUTOBUILD',
-                    'autobuild' if not ( sys.platform == 'win32' or sys.platform == 'cygwin')
-                    else 'autobuild.cmd')
-# HACK: temporarily work around cygwin /cygdrive/c madness
-_autobuild = re.sub(r"^/cygdrive/(.)/", r"\1:/", _autobuild)
+_autobuild=os.getenv('AUTOBUILD', 'autobuild')
 
 pkg_line=re.compile('^([\w-]+):\s+(.*)$')
 
-- 
GitLab