#!/bin/bash
set -u
# Initialize install_sdp.sh test suite storage dirs for '-local' installs:
# /root/downloads
# /root/p4_binaries (may already exist, populated by bootstrap_test_machine.sh)
#==============================================================================
# Declarations and Environment
declare ThisScript=${0##*/}
declare -i ErrorCount=0
declare ThisArch=
declare Binary=
declare BinRel=r26.1
declare BinArch=
declare SampleDepotURL="https://ftp.perforce.com/perforce/tools/sampledepot.tar.gz"
declare FTPURLBase=
declare FTPURL=
declare Log=
declare LogLink=
declare H1="=============================================================================="
#==============================================================================
# Local Functions
function msg () { echo -e "$*"; }
function errmsg () { msg "\\nError: ${1:-Unknown Error}\\n"; ErrorCount+=1; }
function bail () { errmsg "${1:-Unknown Error}"; exit "$ErrorCount"; }
#==============================================================================
# Main Program
Log="${ThisScript%.sh}.$(date +'%Y-%m-%d-%H%M%S').log"
LogLink="${ThisScript%.sh}.log"
touch "$Log" || bail "Could not initialize log with: touch \"$Log\""
exec > >(tee "$Log")
exec 2>&1
if [[ -e "$LogLink" ]]; then
if [[ -L "$LogLink" ]]; then
rm -f "$LogLink"
else
# If the name that should be a symlink is not a symlink, move it aside before
# creating the symlink.
mv -f "$LogLink" "${LogLink%.log}.old.log"
fi
fi
# Point LogLink symlink to current log.
ln -f -s "$Log" "$LogLink"
msg "${H1}\\nLog is: $Log\\n"
if [[ -d /root/downloads ]]; then
bail "Directory already exists unexpectedly: /root/downloads. To ensure a clean start, do: rm -rf /root/downloads"
fi
# Handing of BinArch here is oversimplified, but good enough for now. The
# SDP get_p4_binaries.sh script has more sophisticted and nuanced handling.
ThisArch="$(uname -m)"
if [[ "$ThisArch" == "x86_64" ]]; then
BinArch="bin.linux26x86_64"
elif [[ "$ThisArch" == "aarch64" ]]; then
BinArch="bin.linux26aarch64"
else
errmsg "Unhandled arch ($ThisArch); using bin.linux26x86_64"
BinArch="bin.linux26x86_64"
fi
FTPURLBase="https://ftp.perforce.com/perforce/$BinRel/$BinArch"
if [[ -d /root/p4_binaries ]]; then
msg "Skipping /root/p4_binaries: already exists (likely populated by bootstrap_test_machine.sh)."
else
mkdir /root/p4_binaries || bail "Could not do: mkdir /root/p4_binaries"
cd /root/p4_binaries || bail "Could not do: cd /root/p4_binaries"
msg "Operating in $PWD"
for Binary in p4 p4d p4broker p4p; do
FTPURL="$FTPURLBase/$Binary"
msg "Acquiring: $FTPURL"
curl -O "$FTPURL" || errmsg "Error calling: curl -O $FTPURL"
chmod +x $Binary
./$Binary -V|grep Rev || errmsg "Could not determine version for binary /root/p4_binaries/$Binary."
done
fi
mkdir /root/downloads || bail "Could not do: mkdir /root/downloads"
cd /root/downloads || bail "Could not do: cd /root/downloads"
curl -O "$SampleDepotURL" ||\
errmsg "Error calling: curl -O $SampleDepotURL"
if tar -tzf ${SampleDepotURL##*/}; then
msg "Verified: Sample Depot tarball is a tarball."
else
errmsg "Sample Depot tarball is garbage."
fi
if [[ "$ErrorCount" -eq 0 ]]; then
msg "\\nRoot Dirs initialized OK."
else
errmsg "$ErrorCount errors encountered initializing root dirs."
fi
msg "\\nLog is: $Log\\n${H1}"
exit "$ErrorCount"
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #3 | 33179 | Claude (AI Agent by Anthropic) |
Rename /root/helix_binaries to /root/p4_binaries consistently; fix init_root_dirs_for_local_installs.sh's stale duplicate-download logic. cli_tests.cfg used /root/helix_binaries as its rsync source in all 14 Sample-Depot/local-install test-setup steps, while bootstrap_test_machine.sh (new this session) independently creates and populates that same cache directory for its own initial-clone bootstrap need -- both under the old pre-SDP-1379 Helix-branded name. Renamed to /root/p4_binaries in both. init_root_dirs_for_local_installs.sh (older, predates bootstrap_test_machine.sh) created BOTH /root/helix_binaries and /root/p4_binaries as a redundant duplicate download; its own comment mislabeled helix_binaries as the 'legacy' name even though it was the only one cli_tests.cfg ever actually used. Its preflight check also unconditionally bailed if either already existed, meaning it could no longer run on any machine already bootstrapped via bootstrap_test_machine.sh. Simplified to a single /root/p4_binaries (skipping the download if bootstrap_test_machine.sh already populated it) and /root/downloads (the Sample Depot tarball cache, which nothing else populates). Verified on the r9x86_64 canary: LocalInstallWithSD (Sample Depot group) 15/15, and a full suite run of 287/287 with zero failures. Agent: Claude Code (Sonnet 5, claude-sonnet-5) |
||
| #2 | 33158 | Claude (AI Agent by Anthropic) |
Task 1.2: SDP Installer Test Suite source-swapping capability. Adds swap_source.sh (park/restore or fresh-clone via p4-sdp_*/test-install_sdp_* remote specs) and bootstrap_test_machine.sh (self-contained, curl-bootstrappable machine-join script, SDP Bash Coding Standard style with documented deviations, ShellCheck-clean). Fixes dev_env.sh's hardcoded P4USER/P4PORT, and init_root_dirs_for_local_installs.sh's stale r25.1 P4D default and a real bin.aarch64 URL bug (404; should be bin.linux26aarch64). Restructures InstallSDP-TestServerSetup.md around the new bootstrap script and adds a "Qualifying a New Platform" section. Agent: Claude Code, Model: Claude Sonnet 5 (claude-sonnet-5), operating as bot_Claude_Anthropic. |
||
| #1 | 33144 | C. Thomas Tyler | Initialized //test-install_sdp/dev with p4 populate -b test-install_sdp_Classic_to_Streams | ||
| //guest/tom_tyler/sw/main/install_sdp/dev/bin/init_root_dirs_for_local_installs.sh | |||||
| #1 | 31901 | C. Thomas Tyler | Added new script to initialize root dirs. | ||