From 23f3c81f03d34f87ea51eb50901485147a6ae847 Mon Sep 17 00:00:00 2001 From: Bryan Kowal Date: Wed, 16 Sep 2015 10:37:37 -0500 Subject: [PATCH] Omaha #4869 - externalize the management of CAVE versioning information. amend: update version argument in developer.product. Change-Id: Icd309d886de0131228169dc3a6fd36ad3107fa28 Former-commit-id: af85930a71ace6a5e590e95030f7e17595548321 --- cave/build/static/linux/cave/cave.sh | 17 ++++- .../about.mappings | 4 ++ .../build.properties | 3 +- .../developer.product | 3 +- .../plugin.properties | 5 +- .../Installer.version/component.spec | 63 ++++++------------- 6 files changed, 45 insertions(+), 50 deletions(-) create mode 100644 cave/com.raytheon.viz.product.awips/about.mappings diff --git a/cave/build/static/linux/cave/cave.sh b/cave/build/static/linux/cave/cave.sh index 8211d70828..68d5202b6c 100644 --- a/cave/build/static/linux/cave/cave.sh +++ b/cave/build/static/linux/cave/cave.sh @@ -37,6 +37,7 @@ # Jun 17, 2015 #4148 rferrel Logback needs fewer environment variables. # Jul 23, 2015 ASM#13849 D. Friedman Use a unique Eclipse configuration directory # Aug 03, 2015 #4694 dlovely Logback will now add user.home to LOGDIR +# Sep 16, 2015 #4869 bkowal Read dynamic CAVE version information at startup. # @@ -117,6 +118,16 @@ else echo "getTestMode() not found - going to use defaults" fi +VERSION_ARGS=() +if [ -f ${CAVE_INSTALL}/awipsVersion.txt ]; then + prevIFS=${IFS} + IFS=$'\n' + for line in `cat ${CAVE_INSTALL}/awipsVersion.txt`; do + VERSION_ARGS+=(${line}) + done + IFS=${prevIFS} +fi + export TEXTWS=`hostname | sed -e 's/lx/xt/g'` hostName=`hostname -s` @@ -252,14 +263,14 @@ createEclipseConfigurationDir fi echo "Launching cave application using the following command: " >> ${LOGFILE_STARTUP_SHUTDOWN} - echo "${CAVE_INSTALL}/cave ${CAVE_INI_ARG} ${SWITCHES[@]} ${USER_ARGS[@]}" >> ${LOGFILE_STARTUP_SHUTDOWN} + echo "${CAVE_INSTALL}/cave ${CAVE_INI_ARG} ${SWITCHES[@]} ${USER_ARGS[@]} ${VERSION_ARGS[@]}" >> ${LOGFILE_STARTUP_SHUTDOWN} if [[ "${redirect}" == "true" ]] ; then # send output to /dev/null because the logback CaveConsoleAppender will capture that output - exec ${CAVE_INSTALL}/cave ${CAVE_INI_ARG} "${SWITCHES[@]}" "${USER_ARGS[@]}" >> /dev/null 2>&1 + exec ${CAVE_INSTALL}/cave ${CAVE_INI_ARG} "${SWITCHES[@]}" "${USER_ARGS[@]}" "${VERSION_ARGS[@]}" >> /dev/null 2>&1 else # allow output to print to the console/terminal that launched CAVE - exec ${CAVE_INSTALL}/cave ${CAVE_INI_ARG} "${SWITCHES[@]}" "${USER_ARGS[@]}" 2>&1 + exec ${CAVE_INSTALL}/cave ${CAVE_INI_ARG} "${SWITCHES[@]}" "${USER_ARGS[@]}" "${VERSION_ARGS[@]}" 2>&1 fi ) & diff --git a/cave/com.raytheon.viz.product.awips/about.mappings b/cave/com.raytheon.viz.product.awips/about.mappings new file mode 100644 index 0000000000..93b28dfdde --- /dev/null +++ b/cave/com.raytheon.viz.product.awips/about.mappings @@ -0,0 +1,4 @@ +0=$vizVersion$ +1=$buildDate$ +2=$buildTime$ +3=$buildSystem$ \ No newline at end of file diff --git a/cave/com.raytheon.viz.product.awips/build.properties b/cave/com.raytheon.viz.product.awips/build.properties index 18412db5aa..ec501a4db0 100644 --- a/cave/com.raytheon.viz.product.awips/build.properties +++ b/cave/com.raytheon.viz.product.awips/build.properties @@ -5,4 +5,5 @@ bin.includes = plugin.xml,\ .,\ icons/,\ plugin_customization.ini,\ - plugin.properties + plugin.properties,\ + about.mappings diff --git a/cave/com.raytheon.viz.product.awips/developer.product b/cave/com.raytheon.viz.product.awips/developer.product index ccb8c467bb..45113e95b8 100644 --- a/cave/com.raytheon.viz.product.awips/developer.product +++ b/cave/com.raytheon.viz.product.awips/developer.product @@ -35,7 +35,8 @@ -XX:G1MixedGCCountTarget=16 -XX:G1MixedGCLiveThresholdPercent=25 -XX:G1OldCSetRegionThresholdPercent=25 --XX:G1HeapWastePercent=5 +-XX:G1HeapWastePercent=5 +-DvizVersion=DEVELOPMENT -Dfile.encoding=UTF-8 diff --git a/cave/com.raytheon.viz.product.awips/plugin.properties b/cave/com.raytheon.viz.product.awips/plugin.properties index 949156c811..8c076d90f4 100644 --- a/cave/com.raytheon.viz.product.awips/plugin.properties +++ b/cave/com.raytheon.viz.product.awips/plugin.properties @@ -1,5 +1,8 @@ caveAboutText=Common AWIPS Visualization Environment (CAVE)\n\ \n\ Developed on the Raytheon Visualization Environment (viz)\n\ -\t~ DEVELOPMENT ~ +\tBUILD VERSION: {0}\n\ +\tBUILD DATE: {1}\n\ +\tBUILD TIME: {2}\n\ +\tBUILD SYSTEM: {3} caveVersion=DEVELOPMENT \ No newline at end of file diff --git a/rpms/awips2.core/Installer.version/component.spec b/rpms/awips2.core/Installer.version/component.spec index 17eae17353..51ccb9ecb0 100644 --- a/rpms/awips2.core/Installer.version/component.spec +++ b/rpms/awips2.core/Installer.version/component.spec @@ -24,7 +24,6 @@ URL: N/A License: N/A Distribution: N/A Vendor: Raytheon -Packager: Bryan Kowal AutoReq: no provides: %{_component_name} @@ -58,28 +57,6 @@ CONST_BANNER_LENGTH=47 AWIPS_PRODUCT_JAR= EDEX_BANNER_TXT= -# This function exists for upgrading from -# 11.6.X builds. -function updateCAVEVersionLegacy() -{ - local TMP_PRODUCTS_DIR="/awips2/${AWIPS_PRODUCT}/.tmp/products" - - cd ${TMP_PRODUCTS_DIR} - # update plugin.xml - sed '/aboutText/{n;s/\".*\"/\"%caveAboutText\"/;}' \ - -i plugin.xml - - # update the manifest. - touch manifestUpdate - echo "Bundle-Localization: plugin" > manifestUpdate - - # merge the updated plugin.xml and manifest into the jar. - /awips2/java/bin/jar umf manifestUpdate ${AWIPS_PRODUCT_JAR} - /awips2/java/bin/jar uf ${AWIPS_PRODUCT_JAR} plugin.xml - - rm -f manifestUpdate -} - function padEdexBannerLine() { local _output="${1}" @@ -100,7 +77,7 @@ function padEdexBannerLine() return 0 } -function updateVersion() +function updateAlertVizVersion() { local TMP_PRODUCTS_DIR="/awips2/${AWIPS_PRODUCT}/.tmp/products" @@ -118,11 +95,7 @@ function updateVersion() # Update the version information. cd ${TMP_PRODUCTS_DIR} unzip -qq ${AWIPS_PRODUCT_JAR} - if [ ! -f plugin.properties ]; then - updateCAVEVersionLegacy - else - rm -f plugin.properties - fi + rm -f plugin.properties ARCH="x86" # Determine the architecture. @@ -178,30 +151,32 @@ function updateEDEXVersion() >> ${EDEX_BANNER_TXT} } -AWIPS_PRODUCT_WILDCARD="/awips2/cave/plugins/com.raytheon.viz.product.awips_*.jar" -# Get the actual name of the product jar. -if [ -d /awips2/cave/plugins ]; then - AWIPS_PRODUCT_JAR=`ls -1 ${AWIPS_PRODUCT_WILDCARD}` - RC=$? - if [ ${RC} -eq 0 ]; then - # does the jar exist? - if [ -f ${AWIPS_PRODUCT_JAR} ]; then - AWIPS_PRODUCT="cave" - updateVersion - fi - fi +function updateCaveVersion() { + # Note: the system properties echoed to the versions script are based on + # about.mappings in the com.raytheon.viz.product.awips plugin. + AWIPS_VERSION_TXT=/awips2/cave/awipsVersion.txt + + echo "--launcher.appendVmargs" > ${AWIPS_VERSION_TXT} + echo "-vmargs" >> ${AWIPS_VERSION_TXT} + echo "-DvizVersion=%{_component_version}-%{_component_release}" >> ${AWIPS_VERSION_TXT} + echo "-DbuildDate=%{_component_build_date}" >> ${AWIPS_VERSION_TXT} + echo "-DbuildTime=%{_component_build_time}" >> ${AWIPS_VERSION_TXT} + echo "-DbuildSystem=%{_component_build_system}" >> ${AWIPS_VERSION_TXT} +} + +if [ -d /awips2/cave ]; then + updateCaveVersion fi AWIPS_PRODUCT_WILDCARD="/awips2/alertviz/plugins/com.raytheon.uf.viz.product.alertviz_*.jar" # Get the actual name of the product jar. if [ -d /awips2/alertviz/plugins ]; then AWIPS_PRODUCT_JAR=`ls -1 ${AWIPS_PRODUCT_WILDCARD}` - RC=$? - if [ ${RC} -eq 0 ]; then + if [ $? -eq 0 ]; then # does the jar exist? if [ -f ${AWIPS_PRODUCT_JAR} ]; then AWIPS_PRODUCT="alertviz" - updateVersion + updateAlertVizVersion fi fi fi