#!/bin/bash
#------------------------------------------------------------------------------
set -u
# Run this AFTER Copy Up (dev -> main) has already happened, from your
# local directory in your release workspace client switched to
# //p4-sdp/main, corresponding to //p4-sdp/main/tools. By this point in
# the release process, main already has all of dev's latest content, so
# this writes the new version into main's own Version file
# (VersionDepotFile below); 'p4 where'/'p4 edit' on that path need to
# resolve against a client actually mapping //p4-sdp/main.
#
# You must have a valid ticket.
# Version ID Block. Relies on +k filetype modifier.
#------------------------------------------------------------------------------
# shellcheck disable=SC2016
declare VersionID='$Id: //p4-sdp/main/tools/preview_changes_and_update_version.sh#2 $ $Change: 33441 $'
declare VersionStream=${VersionID#*//}; VersionStream=${VersionStream#*/}; VersionStream=${VersionStream%%/*};
declare VersionCL=${VersionID##*: }; VersionCL=${VersionCL%% *}
declare Version=${VersionStream}.${VersionCL}
[[ "$VersionStream" == r* ]] || Version="${Version^^}"
declare ThisScript=${0##*/}
declare -i ErrorCount=0
declare OldMajorVersion=
declare NewMajorVersion=
declare OldReleaseCL=
declare NewReleaseCL=
declare NewReleaseDate=
declare VersionDepotFile="//p4-sdp/main/Version"
declare VersionLocalFile=
declare CL=
declare H1="=============================================================================="
declare H2="------------------------------------------------------------------------------"
declare Log=/tmp/${ThisScript%.sh}.log
function msg () { echo -e "$*"; }
function errmsg () { msg "\\nError: ${1:-Unknown Error}\\n"; ErrorCount+=1; }
function bail () { errmsg "${1:-Unknown Error}"; exit "${2:-$ErrorCount}"; }
# shellcheck disable=SC1091
source ./env.sh
OldMajorVersion=$(p4 print -q //p4-sdp/main/Version |cut -d '/' -f 3)
OldReleaseCL=$(p4 print -q //p4-sdp/main/Version |cut -d '/' -f 4|cut -d ' ' -f 1)
NewReleaseCL=$(p4 -ztag -F %change% changes -s submitted -m 1 //p4-sdp/main/...)
NewReleaseDate=$(p4 describe -s "$NewReleaseCL" | head -1 | cut -d ' ' -f 6)
# Redirect stdout and stderr to a log file.
exec > >(tee -a "$Log")
exec 2>&1
msg "${H1}\\nLog is: $Log\\n"
msg "Starting $ThisScript version $Version."
echo -n -e "Enter New Major Version: [$OldMajorVersion]: "
while [[ -z "$NewMajorVersion" ]]; do
read -r NewMajorVersion
if [[ -n "$NewMajorVersion" ]]; then
if [[ ! "$NewMajorVersion" =~ ^[0-9]{4}\.[0-9]+$ ]]; then
msg "Invalid version; form must by YYYY.N."
NewMajorVersion=
echo -n -e "Enter New Major Version: [$OldMajorVersion]: "
fi
else
NewMajorVersion="$OldMajorVersion"
fi
done
msg "Released: Rev. SDP/MultiArch/${NewMajorVersion}/${NewReleaseCL} ($NewReleaseDate)\\n"
msg "${H2}\\nChanges since change $OldReleaseCL up to $NewReleaseCL (B=Bug, D=Doc, F=Feature).\\n"
for CL in $(p4 -ztag -F %change% changes -s submitted //p4-sdp/main/...@$((OldReleaseCL+1)),@now); do
p4 describe -s "$CL" || bail "Could not do: p4 describe -s \"$CL\""
done
VersionLocalFile=$(p4 -ztag -F %path% where "$VersionDepotFile")
if [[ -n "$VersionLocalFile" ]]; then
msg "Updating $VersionLocalFile file."
if [[ -n "$(p4 files "$VersionDepotFile" 2>/dev/null)" ]]; then
p4 edit "$VersionLocalFile" || bail "Could not do: p4 edit \"$VersionLocalFile\""
echo "Rev. SDP/MultiArch/$NewMajorVersion/$NewReleaseCL ($NewReleaseDate)." > "$VersionLocalFile"
p4 diff "$VersionLocalFile"
else
# First-ever release: Version has never been created on this stream.
msg "$VersionDepotFile does not exist yet -- adding it (first release on this stream)."
echo "Rev. SDP/MultiArch/$NewMajorVersion/$NewReleaseCL ($NewReleaseDate)." > "$VersionLocalFile"
p4 add "$VersionLocalFile" || bail "Could not do: p4 add \"$VersionLocalFile\""
fi
else
errmsg "Could not determine local file for $VersionDepotFile"
fi
msg "\\n${H1}\\nLog is: $Log"
exit "$ErrorCount"
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #2 | 33441 | Claude (AI Agent by Anthropic) |
preview_changes_and_update_version.sh: handle the first-ever-release case where Version doesn't exist yet on main. Found while exercising release process Step 15 for real: main has never had a Version file before (Version is isolate'd, and this is the first release ever cut from the new Streams-based main), so 'p4 edit' on it fails outright. Now checks whether the file exists in the depot first, and uses 'p4 add' instead of 'p4 edit' when it doesn't. Agent: Claude Code, Model: Claude Sonnet 5 (claude-sonnet-5), operating as bot_Claude_Anthropic. |
||
| #1 | 33433 | Claude (AI Agent by Anthropic) |
Copy Up from //p4-sdp/dev into //p4-sdp/main. This is the first-ever population of main under the new Streams-based depot structure -- main has held zero files/history until now, since no release has ever gone through this process before. 463 files, covering the entire 2026.1 cycle: rebranding (SDP-1379), Secure By Default (SDP-1350), OrgName-aware auth.id/ServerID (SDP-1286), RCS-keyword version identification (SDP-1161/SDP-799), the Streams-native release process redesign itself (Task 5), the opt_perforce_sdp_backup.sh false-error fix, the P4D 2026.1 test-suite targeting, refreshed P4*.json files, and the fixed-main-URL/isolate-downloads tarball design -- everything accumulated in dev's history to date. Isolated paths (ai_dev_support/, Version, doc/*.html, doc/*.pdf, doc/gen/*.man.txt, doc/gen/sdp_install.cfg, Unsupported/doc/*.html, Unsupported/doc/*.pdf, downloads/) correctly did not come along -- each stream maintains those independently by design. Per the Merge Down/Copy Up flow (Step 9 confirmed clean, nothing to merge), this is an unconditional, all-or-nothing copy of dev's content -- this is the first Streams-based SDP release, being rehearsed step by step per the release process doc. Agent: Claude Code, Model: Claude Sonnet 5 (claude-sonnet-5), operating as bot_Claude_Anthropic. |
||
| //p4-sdp/dev/tools/preview_changes_and_update_version.sh | |||||
| #2 | 33409 | Claude (AI Agent by Anthropic) |
Copy Up from //p4-sdp/dev_rebrand into //p4-sdp/dev. This is the first promotion of dev_rebrand's work into dev since dev_rebrand was created (2025-05-24) -- 303 files, covering the entire 2026.1 rebranding effort (SDP-1379), the Secure By Default adaptation (SDP-1350), OrgName-aware auth.id/ServerID (SDP-1286), RCS-keyword version identification (SDP-1161/SDP-799), and the Streams-native release process redesign (Task 5) done this session, plus everything else accumulated in dev_rebrand's history before this session. Per the Merge Down/Copy Up flow, this is intentionally a full, unconditional blast-replace of dev's content from dev_rebrand -- all selectivity/care happened in the preceding Merge Down (dev -> dev_rebrand, changes 33407-33408), which absorbed Robert Cowham's independent dev-side work first so nothing of his is lost by this Copy Up. Two files are worth calling out since they might look alarming in isolation: - tools/mdcu.sh is deleted -- intentional, retired this session in favor of the two direct Streams commands now documented in doc/ReleaseProcessOverview.md. - tools/ReleaseProcessOverview.md is deleted -- this is a stale relic of a file move dev_rebrand made back in 2025-05-24 (tools/ -> doc/) that was never previously propagated to dev; the current, fully-rewritten doc/ReleaseProcessOverview.md is added/updated correctly by this same changelist. |
||
| #1 | 31397 | C. Thomas Tyler | Populate -b SDP_Classic_to_Streams -s //guest/perforce_software/sdp/...@31368. | ||
| //guest/perforce_software/sdp/tools/preview_changes_and_update_version.sh | |||||
| #3 | 31352 | C. Thomas Tyler | Enhanced preview output. | ||
| #2 | 29939 | C. Thomas Tyler | Tweaked output. | ||
| #1 | 29840 | C. Thomas Tyler | Enhanced release support tools. | ||
| //guest/perforce_software/sdp/tools/preview_changes_for_next_release.sh | |||||
| #1 | 29839 | C. Thomas Tyler | Added script to help produce release notes. | ||