#!/bin/bash
#==============================================================================
# Copyright and license info is available in the LICENSE file included with
# the Helm Management System (HMS), and also available online:
# https://workshop.perforce.com/projects/p4-hms/main/LICENSE
set -u
# Generate an SDP instance-specific variant of the generic
# P4Broker config file, suitable for use with HMS New Job
# (NJ) Package. Display to standard output.
# Usage: In these examples, replace 'N' with SDP instance name.
# cd /p4/common/config
# /p4/common/bin/gen_nj_broker_cfg.sh N > p4_N.broker.cfg.ToBeReviewed
#
# After reviewing, remove the .ToBeReviewed suffix. Alternately, blend the
# generated content in an existing broker configuration file.
export SDP_INSTANCE=${1:-${SDP_INSTANCE:-Unset}}
if [[ "$SDP_INSTANCE" == Unset ]]; then
echo "Instance parameter not supplied."
echo "You must supply the SDP instance as a parameter to this script."
exit 1
fi
source /p4/common/bin/p4_vars "$SDP_INSTANCE"
declare BrokerLogLevel=1
declare BrokerConfigTemplate=p4_N.broker.cfg.t
declare P4CodeReviewUser=swarm
declare NJVersionFile=Version
declare NJVersion=
if [[ ! -r "$BrokerConfigTemplate" ]]; then
echo "Error: Could not find broker config template: [$PWD/$BrokerConfigTemplate]."
exit 1
fi
if [[ ! -r "$NJVersionFile" ]]; then
echo "Error: Could not find NJ Version file [$PWD/$NJVersionFile]."
exit 1
fi
NJVersion=$(cat $NJVersionFile)
sed -e "s|__P4PORT__|$P4PORT|g" \
-e "s|__P4USER__|$P4USER|g" \
-e "s|__P4BROKERPORT__|$P4BROKERPORT|g" \
-e "s|__P4BINDIR__|${P4BIN%/*}|g" \
-e "s|__BROKER_LOG_LEVEL__|$BrokerLogLevel|g" \
-e "s|__LOGS__|$LOGS|g" \
-e "s|__MAILTO__|$MAILTO|g" \
-e "s|__SWARM_USER__|$P4CodeReviewUser|g" \
-e "s|__NJ_VERSION__|$NJVersion|g" \
"$BrokerConfigTemplate"
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #1 | 33516 | C. Thomas Tyler |
Consistency pass: fix absolute URLs, p4ms->hms renames, script/doc typos and bugs - Convert absolute workshop.perforce.com URLs to relative paths in dlp/ReadMe.md - Fix case-mismatch link to HMS_Product_Roadmap.md in README.md - Rename reset_p4ms.sh -> reset_hms.sh and p4broker_p4ms_test -> p4broker_hms_test - Fix .sh-suffix bugs: bin/hms calling global_replica_status.sh (should be no ext), and matching SEE ALSO / doc references for sdp_sync and global_replica_status - Add missing scripts (gtu, hrun, irun, global_replica_status) to gen_script_man_pages.sh - Add stub scripts: nj_help.sh, broker_njob.pl, broker_mkproj.pl, broker_jr.pl - Remove dangling absolute symlinks HostCM/p4 and HostCM/p4d (cruft) - Rename test/b -> test/broker_ctl.sh for clarity - Fix real bugs: broker_imply-u.pl broken regex match, gen_dlp_broker_cfg.sh and gen_nj_broker_cfg.sh copy-pasted Version-file existence check, garbled comment in broker_must_be_owner.pl, unclosed quote in tools/gsr.sh usage(), missing 'h' in HMS_SystemComponents.md broker command example (^ms$ -> ^hms$) - Fix broken sed command and incomplete sentence in HMS_Install_Notes.md and SDP_and_HMS_Update_Process.md - Fix broken markdown table in HMS_Product_Roadmap.md - Fix unclosed parenthesis, missing verb, and FKA Swarm mislabel in HMSDeploymentPlanning.adoc - Standardize //streams/main/... naming in HostCM/ReadMe.md - Numerous typo fixes across README.md, HMS_SystemComponents.md, SDP_and_HMS_Update_Process.md, HMS_TightShipManagement.adoc, HMSDeploymentPlanning.adoc, HostCM/ReadMe.md, and various scripts Co-authored-by: Copilot <[email protected]> |