#!/bin/bash #------------------------------------------------------------------------------ # Shell environment file for P4BBI. #------------------------------------------------------------------------------ # Usage: # cd /install/directory/for/p4bbi # Typical: /p4/p4bbi # source ./env.sh # # Due to intended usage of being sourced in, this does not have the 'chmod +x' # executable bit set. set -u export P4BBI_HOME="$PWD" export P4BBI_BIN="$P4BBI_HOME/bin" export P4BBI_LIB="$P4BBI_HOME/lib" export P4BBI_CFG="$P4BBI_HOME/cfg" export P4BBI_LOGS="$P4BBI_HOME/logs" export P4BBI_TEST_BIN="$P4BBI_HOME/test/bin" export P4BBI_BASELINES="$PWD/test/baselines" export P4U_HOME="$P4BBI_LIB" export P4U_LIB="$P4BBI_LIB" export P4U_ENV="$P4U_LIB/p4u_env.sh" export TestP4PORT=8674 export CUT=${CUT:-cut} export GREP=${GREP:-grep} # Environment isolation. For stability and security reasons, prepend # PATH to include dirs where known-good executables exist. The P4BBI_TEST_BIN # path ia appened rather than prepended, so the 'spoof' astyle-new tool is # found only if the real one isn't found in the PATH. export PATH="$P4BBI_HOME:$P4BBI_BIN:$PATH:.:$P4BBI_TEST_BIN" export P4BIN="$P4BBI_HOME/bin/p4" export P4DBIN="$P4BBI_HOME/bin/p4d" export P4D_VERSION="$("$P4DBIN" -V 2>/dev/null|"$GREP" ^Rev.|$CUT -d '/' -f 3).$("$P4DBIN" -V 2>/dev/null|"$GREP" ^Rev.|"$CUT" -d '/' -f 4|"$CUT" -d ' ' -f 1)" export PS1='$USER@${HOSTNAME%%\.*}:$PWD ' export SHELL=/bin/bash export P4CONFIG=${P4CONFIG:-.p4config} export P4TICKETS=$P4BBI_HOME/.p4tickets export P4TRUST=$P4BBI_HOME/.p4trust # Aliases set -o vi alias cls=clear alias ct=cleartool alias cdb="cd \$P4BBI_HOME" alias go=cd alias o="p4 opened ..." alias lsh="p4 filelog" alias md="/bin/mkdir -p" alias rd="/bin/rmdir" # A hack for Apple. According to blogs I read, Apple won't update # /bin/bash to bash v4.x, apparently due to GPL licensing issues. # bbi.sh requires modern bash, so if we're on Mac, generate a bbi_mac.sh # from the existing bbi.sh, replacing only the shebang line at the top to # reference the local bash. If that doesn't exist and the wrong/old # bash is used, the bbi.sh script will give an appropriate error # telling how to get it. export P4BBI_SCRIPT="$P4BBI_HOME/bbi.sh" if [[ "$(uname)" == Darwin ]]; then if [[ -x /opt/homebrew/bin/bash ]]; then sed 's:#!/bin/bash:#!/opt/homebrew/bin/bash:g' "$P4BBI_HOME/bbi.sh" > "$P4BBI_HOME/bbi_mac.sh" chmod +x bbi_mac.sh alias bbi.sh=bbi_mac.sh export P4BBI_SCRIPT=$P4BBI_HOME/bbi_mac.sh echo "Generated bbi_mac.sh and created alias bbi.sh=bbi_mac.sh." elif [[ -x /usr/local/bin/bash ]]; then sed 's:#!/bin/bash:#!/usr/local/bin/bash:g' "$P4BBI_HOME/bbi.sh" > "$P4BBI_HOME/bbi_mac.sh" chmod +x bbi_mac.sh alias bbi.sh=bbi_mac.sh export P4BBI_SCRIPT=$P4BBI_HOME/bbi_mac.sh echo "Generated bbi_mac.sh and created alias bbi.sh=bbi_mac.sh." fi fi echo "Loaded P4BBI Environment for $USER on ${HOSTNAME%%\.*}." declare LocalEnvFile="$P4BBI_HOME/env.local.sh" if [[ -r "$LocalEnvFile" ]]; then echo -e "Loading local Environment settings from [$LocalEnvFile]." # shellcheck disable=SC1090 source "$LocalEnvFile" fi alias T='cd /p4/p4bbi/test; ./start_p4d.sh reset; cd /p4/p4bbi/sample_cfg; bbi.sh -c SymlinkRefactoring.bbi.cfg -P $PWD/p4config.test'
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 30968 | C. Thomas Tyler |
Migration from Classic to Streams with: p4 copy -b P4BBI_Classic_to_Streams |
||
//guest/perforce_software/p4bbi/main/env.sh | |||||
#6 | 30957 | C. Thomas Tyler | Addressed various ShellCheck errors. | ||
#5 | 18506 | C. Thomas Tyler | Released P4BBI/MultiArch/2016.2/18504 (2016/03/04). | ||
#4 | 18412 | C. Thomas Tyler | Released P4BBI. | ||
#3 | 16882 | C. Thomas Tyler |
Update of BBI with latest dev changes: * Added support for processing 'astyle' as part of an import. * Fixed bug in COPY rule. |
||
#2 | 15968 | C. Thomas Tyler |
Copy Up to main from dev using: p4 copy -r -b perforce-software-p4bbi-dev |
||
#1 | 11814 | C. Thomas Tyler | Copy up for dev for release of p4bbi.2015.2.11812. | ||
//guest/perforce_software/p4bbi/dev/env.sh | |||||
#4 | 11784 | C. Thomas Tyler |
Refactored bash libriaries. Added bbi_actions.lib to hold the BBI functionality. Branched 3 bash library files from the SDP, removing the SDP dependency. Enhanced docs. |
||
#3 | 11776 | C. Thomas Tyler |
Added directory structure placeholder for logs and bin dirs. Provided a way to override SDP executables. Changed default logs dir to $P4BBI_HOME/logs. Adjusted environment. |
||
#2 | 11770 | C. Thomas Tyler | Adjusted PATH setting in env.sh. | ||
#1 | 11767 | C. Thomas Tyler | Broke ground on BBI v3.0 (shell script version). |