# bbi_paths.lib Version=3.5.2 #============================================================================== # Copyright and license info is available in the LICENSE file included with # the P4BBI tool, and also available online: # https://swarm.workshop.perforce.com/view/p4bbi/main/LICENSE #------------------------------------------------------------------------------ #============================================================================== # BBI Library Functions. #------------------------------------------------------------------------------ # Function: get_stream_subdir ($path) # Given: Return: # //stream/main/... "" (empty) # //stream/main/ACE/... ACE # //stream/main/ACE/d1/d2/... ACE/d1/d2 function get_stream_subdir () { # Write debug to stderr to avoid corrupting return value on stdout. [[ $VERBOSITY -ge 3 ]] && echo "CALL: get_stream_subdir ($*)" >&2 declare path=${1:-""} declare streamDepth=${2:-1} declare -i i=0 # Replace trailing '/...' with '/'. path=${path/\/.../\/} # Trim leading '//*/*'. path=${path#//*/*/} if [[ $streamDepth =~ ^[0-9]+$ && $streamDepth -ge 1 ]]; then # Trim one directory level per level of stream depth. i=1; while [[ $i -lt $streamDepth ]]; do path=${path#*/} i=$((i+1)) done fi # Trim trailing '/'. path=${path%/} echo $path } #------------------------------------------------------------------------------ # Function: get_stream ($path) # # Given: Return: # //stream/main/... //stream/main # //stream/main/ACE/... //stream/main # //stream/main/ACE/d1/d2/... //stream/main # //stream/main //stream/main function get_stream () { # Write debug to stderr to avoid corrupting return value on stdout. [[ $VERBOSITY -ge 3 ]] && echo "CALL: get_stream ($*)" >&2 declare path=${1:-""} declare streamDepth=${2:-1} declare -i i=0 fieldNum=0 declare stream= nextDir # Trim trailing '/...'. path=${path/\/...//} # Replace '/' with ':' (for easier field separation). path=$(echo $path | sed "s:/:\::g") stream="//$(echo $path|cut -d ':' -f 3)/$(echo $path|cut -d ':' -f 4)" if [[ $streamDepth =~ ^[0-9]+$ && $streamDepth -ge 1 ]]; then i=1; while [[ $i -lt $streamDepth ]]; do fieldNum=$((i+4)) nextDir="$(echo $path|cut -d ':' -f $fieldNum)" if [[ -n "$nextDir" ]]; then stream="$stream/$nextDir" else break fi i=$((i+1)) done fi echo $stream }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 30973 | C. Thomas Tyler |
Adapting to new home in //p4bbi stream depot. Mostly minor changes to doc links. More significant changes we needed for package_downloads.sh. |
||
#1 | 30968 | C. Thomas Tyler |
Migration from Classic to Streams with: p4 copy -b P4BBI_Classic_to_Streams |
||
//guest/perforce_software/p4bbi/main/lib/bbi_paths.sh | |||||
#2 | 19072 | C. Thomas Tyler | Released P4BBI/MultiArch/2016.3/19070 (2016/04/21). | ||
#1 | 18422 | C. Thomas Tyler | Corrected push from dev. | ||
//guest/perforce_software/p4bbi/dev/lib/bbi_paths.sh | |||||
#3 | 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. |
||
#2 | 16438 | C. Thomas Tyler |
Removed '-special' editions. A bit more copyright cleanup. No functional changes. |
||
#1 | 13590 | C. Thomas Tyler |
Changed naming convention to use standard '.sh'; using '.lib' confused some text editors. |
||
//guest/perforce_software/p4bbi/dev/lib/bbi_paths.lib | |||||
#1 | 12934 | C. Thomas Tyler |
Add ability to import subdirectories of a stream workspace root dir, allowing for smaller, more granular tar files. This is a partial implementation; it works for Streams but breaks Classic imports. TO DO: Fix this. Corrected rsync commands to use '--delete' option. This change introduces a new library file, bbi_paths.lib. Updated test suite accordingly. |