2 ################################################################################
5 # Description: Salira make: Builds on the build server
6 # Author: Andrew@DeFaria.com
7 # Created: Fri Dec 7 18:45:20 2001
10 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved.
12 ################################################################################
13 # Set me to command name
16 # Source /etc/site_parms
17 if [ -f /etc/site_parms ]; then
20 echo "$me: WARNING: /etc/site_parms does not exist!"
24 adm_base="$SITE_TOOLS_PATH/adm"
27 adm_fpath=${adm_fpath:-$adm_base/functions}
32 # Define the build_server
33 build_server=$SITE_BUILD_SERVER
36 myhost=$(hostname | tr [:upper:] [:lower:])
38 # Some simple checks. First are we in a build directory?
39 parent_dir=$(echo ${PWD%/*})
40 parent_parent_dir=$(echo ${PWD%/*/*})
41 parent_parent_parent_dir=$(echo ${PWD%/*/*/*})
42 current_dir=$(basename $PWD)
44 if [ ! -z "$parent_dir" ]; then
45 parent_dir=$(basename $parent_dir)
50 if [ ! -z "$parent_parent_dir" ]; then
51 parent_parent_dir=$(basename $parent_parent_dir)
56 if [ ! -z "$parent_parent_parent_dir" ]; then
57 parent_parent_parent_dir=$(basename $parent_parent_parent_dir)
59 parent_parent_parent_dir=.
62 if [ $parent_dir != "build" -a $parent_parent_dir != "build" -a $current_dir != "build" -a $parent_parent_parent_dir != "build" ]; then
63 echo "$me: Error: You are not currently in a build/target directory!"
64 echo " Current working directory is $PWD"
68 # Now let's check to see that this directory is visible on the $build_server
69 #rsh $build_server ls -d $PWD > /dev/null 2>&1
71 #if [ $? -ne 0 ]; then
72 # echo "$me: Error: I cannot see $PWD from $build_server"
73 # echo " This might be because your view is local"
76 # Now let's check to see if this file system is local
77 filesystem=$(df . 2>/dev/null | grep -v ^Filesystem | /bin/head -1 | cut -f1 -d' ' | tr '\\' '/')
79 if [ "$filesystem" = "${filesystem#//*}" -a $myhost != $build_server ]; then
80 echo "$me: Warning: You're on a local file system!"
81 echo "Build server: $myhost View: $(cleartool pwv -short) [local]"
82 echo "User: $USER Dir: $PWD"
83 echo "Performing build locally on $myhost"
84 echo "$myhost:make $@"
85 if [ $myhost = "sons-clearcase" ]; then
86 export TOOLS_ROOT=E:/Tools && nice make -e "$@"
87 elif [ $myhost = "sons-cc" -o $myhost = "sonsbld1" ]; then
88 export TOOLS_ROOT=C:/Tools && nice make -e "$@"
93 if [ $myhost = $build_server ]; then
95 echo "Build server: $myhost View: $(cleartool pwv -short) [local]"
96 echo "User: $USER Dir: $PWD"
97 echo "Performing build locally on $myhost"
98 echo "$myhost:make $@"
99 if [ $myhost = "sons-clearcase" ]; then
100 export TOOLS_ROOT=E:/Tools && nice make -e "$@"
101 elif [ $myhost = "sons-cc" -o $myhost = "sonsbld1" ]; then
102 export TOOLS_ROOT=C:/Tools && nice make -e "$@"
107 echo "Build machine: $build_server View: $(cleartool pwv -short) [remote]"
108 echo "Launched from: $myhost by $USER"
110 echo "$build_server:make $@"
111 if [ $build_server = "sonsbld1" ]; then
112 rsh -n $build_server "cd $(pwd) && export TOOLS_ROOT=C:/Tools && nice make -e $@"
114 rsh -n $build_server "cd $(pwd) && export TOOLS_ROOT=E:/Tools && nice make -e $@"