#!/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 /usr/local/bin/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 /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]." 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 | |
---|---|---|---|---|---|
#14 | 18459 | C. Thomas Tyler | Added 'T' alias for quick testing. | ||
#13 | 18402 | C. Thomas Tyler |
bbi.sh v3.5.1: Added support for BRANCH_SPEC, DEPOT_SPEC, and STREAM_SPEC actions, which allow imports to use hand-crafted spec files during imports. This allows the BBI import process to simulate the evolution of stream specs over time, e.g. to reflect reparenting, and to account for things like non-branching files and CBD workflows that use sophisticated, hand-crafted stream specs. The required BBI Config file version has been updated from 3.2 to 3.5. Test suite has been updated to test new functionality. |
||
#12 | 18388 | C. Thomas Tyler |
Re-added ASTYLE testing into default test suite. Added P4BBI_TEST_BIN setting (e.g. /p4/p4bbi/test/bin), which is appended to the PATH. A fake astyle-new executable is included there for testing astyle, but is only detected if a 'real' astyle-new executable isn't found on the PATH. |
||
#11 | 18378 | C. Thomas Tyler |
Added hack to env.sh to support Mac OSX, which doesn't (and accoring to blogs, won't) use bash v4.x. Updated test suite so it works on Mac. |
||
#10 | 18374 | adrian_waters | Trap/default $CUT / $GREP if not set | ||
#9 | 16431 | C. Thomas Tyler |
Added support for local shell environment, e.g. to make PATH adjustments as needed, without modifying the baseline env.sh file. If a env.local.sh file exists, it will be sourced. Added P4IGNORE exclusion for env.local.sh (and other minor tweaks to the P4IGNORE file). |
||
#8 | 16423 | C. Thomas Tyler |
Added support for ASTYLE option for UPDATE entry in *.bbi.cfg files. Fixed bug chekcing for User P4CONFIG file; it was checking $P4CONFIG rather than $UserP4CONFIG. Update Copyright to new, simpler and smaller-chunk-of-text standard for some files. |
||
#7 | 14018 | C. Thomas Tyler | Added P4BBI_CFG def'n. | ||
#6 | 12927 | C. Thomas Tyler | Removed broken alias referencing undefined variable. | ||
#5 | 12926 | C. Thomas Tyler |
Added support for BASELINE_STORAGE definition in the BBI Config file. The value can be reference a shell environment variable, added to env.sh. Updated BBI Config File required veresion to 3.2.0 Updated test suite accordingly. |
||
#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). |