rel_notes.sh #2

  • //
  • guest/
  • perforce_software/
  • sdp/
  • tools/
  • rel_notes.sh
  • View
  • Commits
  • Open Download .zip Download (2 KB)
#!/bin/bash
#------------------------------------------------------------------------------

set -u

declare OldCL=
declare NewCL=
declare Description=
declare Type=
declare TypeTag=
declare AppHome=${0%/*}
declare ReleaseTag=
declare RelNotesFile
declare TmpFile=/tmp/tmp.sdp_rel_notes.$$.$RANDOM

# Micro functions.
function msg () { echo -e $*; }
function bail () { msg "Error: ${1:-Unknown Error}"; exit ${2:-1}; }
function cmd () { msg "Executing: $*"; $*; return $?; }

if [[ "$(p4 opened //guest/perforce_software/sdp/dev/Version)" != "//"* ]]; then
   bail "The Version file is not checked out. Aborting."
fi

p4 diff //guest/perforce_software/sdp/dev/Version > $TmpFile 2>&1

OldCL=$(grep '< Rev' $TmpFile|cut -d '/' -f 4)
OldCL=${OldCL%% *}
NewCL=$(grep '> Rev' $TmpFile|cut -d '/' -f 4)
NewCL=${NewCL%% *}
ReleaseTag=$(head -1 $AppHome/../dev/Version)
ReleaseTag=${ReleaseTag%\.}

if [[ "$OldCL" == "$NewCL" ]]; then
   bail "Changelist number not updated in Version file."
fi

RelNotesFile=${AppHome}/../dev/doc/ReleaseNotes.txt

if [[ -n "$(p4 -ztag -F %depotFile% files $RelNotesFile)" ]]; then
   if [[ -z "$(p4 -ztag -F %depotFile% opened $RelNotesFile)" ]]; then
      p4 edit $RelNotesFile
   else
      bail "Release notes file is checked out already. Aborting."
   fi
else
   bail "Can't identify release notes file [$RelNotesFile]. Aborting."
fi

echo -e "\nReleased: $ReleaseTag\n\nJobs Fixed between changelists $OldCL and $NewCL (F=Feature, B=Bug):\n" > $TmpFile
for j in $(p4 -ztag -F %Job% jobs //guest/perforce_software/sdp/dev/...@${OldCL},@${NewCL}); do
   Description=$(p4 -ztag -F %Description% job -o $j|head -1)
   Type=$(p4 -ztag -F %Type% job -o $j)
   case $Type in
      (Feature) TypeTag=F;;
      (Bug) TypeTag=B;;
      (*) TypeTag=$Type;;
   esac
   echo -e "$j ($TypeTag): $Description" >> $TmpFile
done

cat $TmpFile
# Change User Description Committed
#24 29835 C. Thomas Tyler Updated Release Process to account for migration to JIRA.

Removed scripts made obsolete by this change to avoid
confusion.
#23 29020 C. Thomas Tyler Added support for new 'Doc' type in jobspec.
#22 28991 C. Thomas Tyler Enhanced to change ':revdate:' field in ReleaseNotes.adoc.
#21 28258 C. Thomas Tyler Enhanced to apply new post-2020.1 versions.
#20 27538 C. Thomas Tyler Added explicit BASH version check.
#19 27523 C. Thomas Tyler Added release header.
#18 27461 C. Thomas Tyler Refined AsciiDoc generated doc update part of release process.
#17 27365 C. Thomas Tyler rel_notes.sh v1.4.1:
* Fixed bug in genererated per-job adoc refs.
#16 27329 C. Thomas Tyler Updated user instructions in release notes script, to include
generation of adoc-based release notes.
#15 27119 C. Thomas Tyler Further adoc adaptation.
#14 27117 C. Thomas Tyler Corrected file extension.
#13 27115 C. Thomas Tyler Updated SDP release process doc, adding info on how to ensure
generated script docs are incorporated in AsciiDoc files.

Adjusted generated release notes file from .txt to .adoc format.

Updated rel_notes.sh to add bulleted list items with links to
each fixed job.

Updated old release notes content to use new format (using
disposable link conversion scripts).
#12 26884 C. Thomas Tyler Fixed issue with errors going to stderr not being caught in grep expressions.
#11 25503 C. Thomas Tyler rel_notes.sh: Shellcheck compliance only.
#10 25244 C. Thomas Tyler Enhanced to support patch release versions.
#9 21719 C. Thomas Tyler Added '-n' flag to preview release notes.
Added internal comments.
#8 21336 C. Thomas Tyler Added check to fisrt a merge down preview, and bail if one is
required.  This prevents generating incorrect release notes
that don't account for changes made directly in main.

Also enhanced temp file handling.
#7 21237 C. Thomas Tyler Typo.
#6 20765 C. Thomas Tyler Tweaked.
#5 20756 C. Thomas Tyler Fixed bug showing correct new version in release notes.
#4 20516 C. Thomas Tyler Cosmetic tweak and enhancement to end-user instructions.
#3 20479 C. Thomas Tyler Added release process overview script.

Overhauled release notes helper script.

Fixed bug that listed a job in the release notes for the current
release that was associated with the last changelist of the prior
release.

Updated more of the manual steps in the SDP release process.
#2 19693 C. Thomas Tyler Minor enhancements to release notes script:
* Added job type (Bug/Feature) for each job.
* Generates more of the text needed to copy/paste
  into release notes file.
#1 17316 C. Thomas Tyler Added script to help generate release notes for SDP.