From 8c03e13c8520bae51c9a2c8dfbf4864ef6dc824f Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Thu, 5 Apr 2012 21:36:10 -0500 Subject: Added support for automated release version, date, copyright entities in help files. --- kdoctools/CMakeLists.txt | 2 ++ kdoctools/ConfigureChecks.cmake | 39 ++++++++++++++++++++++++++++ kdoctools/update-entities.sh | 57 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 kdoctools/ConfigureChecks.cmake create mode 100644 kdoctools/update-entities.sh diff --git a/kdoctools/CMakeLists.txt b/kdoctools/CMakeLists.txt index 7db2f426c..9d97712c6 100644 --- a/kdoctools/CMakeLists.txt +++ b/kdoctools/CMakeLists.txt @@ -9,6 +9,8 @@ # ################################################# +include( ConfigureChecks.cmake ) + include_directories( ${TQT_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} diff --git a/kdoctools/ConfigureChecks.cmake b/kdoctools/ConfigureChecks.cmake new file mode 100644 index 000000000..01086cf36 --- /dev/null +++ b/kdoctools/ConfigureChecks.cmake @@ -0,0 +1,39 @@ +################################################# +# +# (C) 2012 Trinity Project +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +configure_file( ${CMAKE_SOURCE_DIR}/kdoctools/update-entities.sh ${CMAKE_SOURCE_DIR}/kdoctools/update-entities IMMEDIATE @ONLY ) + +set( UPDATE_SCRIPT "${CMAKE_SOURCE_DIR}/kdoctools/update-entities" ) +set( TDEVERSION_FILE "${CMAKE_SOURCE_DIR}/tdecore/tdeversion.h" ) +set( ENTITIES_FILE "${CMAKE_SOURCE_DIR}/kdoctools/customization/entities/general.entities" ) + +if( NOT EXISTS ${UPDATE_SCRIPT} ) + tde_message_fatal( "${UPDATE_SCRIPT} not found!\n Check your sources." ) +endif( ) +if( NOT EXISTS ${TDEVERSION_FILE} ) + tde_message_fatal( "${TDEVERSION_FILE} not found!\n Check your sources." ) +endif( ) +if( NOT EXISTS ${ENTITIES_FILE} ) + tde_message_fatal( "${ENTITIES_FILE} not found!\n Check your sources." ) +endif( ) + +execute_process( COMMAND chmod +x ${UPDATE_SCRIPT} ) +execute_process( + COMMAND ${UPDATE_SCRIPT} + RESULT_VARIABLE _result + OUTPUT_STRIP_TRAILING_WHITESPACE ) +if( _result ) + tde_message_fatal( "Unable to update ${ENTITIES_FILE}!\n " ) +else( ) + message( STATUS "Updated as follows:" ) + execute_process( COMMAND echo ) + execute_process( COMMAND tail -n3 ${ENTITIES_FILE} ) + execute_process( COMMAND echo ) +endif( ) diff --git a/kdoctools/update-entities.sh b/kdoctools/update-entities.sh new file mode 100644 index 000000000..1b6e3bf2a --- /dev/null +++ b/kdoctools/update-entities.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# A script to dynamically update general.entities with the current version release information. + +# As the help files are updated/revised, DocBook entities can be used rather than static strings for +# release version, release date, and copyright date. This allows for a professional touch with each +# updated help file to show the file is relevant to the current Trinity release. + +TDEVERSION_FILE="@CMAKE_SOURCE_DIR@/tdecore/tdeversion.h" +ENTITIES_FILE="@CMAKE_SOURCE_DIR@/kdoctools/customization/entities/general.entities" + +echo "-- Updating $ENTITIES_FILE:" +# Extract the Trinity version number. +if [ -f "$TDEVERSION_FILE" ]; then + TDE_RELEASE_VERSION="`grep TDE_VERSION_STRING \"$TDEVERSION_FILE\"`" + #echo " TDE_RELEASE_VERSION: $TDE_RELEASE_VERSION" + if [ -z "$TDE_RELEASE_VERSION" ]; then + echo "Cannot determine the Trinity version number. Please verify $TDEVERSION_FILE exists." + echo + exit 1 + fi + if [ -n "`echo \"$TDE_RELEASE_VERSION\" | grep DEVELOPMENT`" ]; then + TDE_RELEASE_VERSION="`echo $TDE_RELEASE_VERSION | awk '{print $3,$4}' | sed -e 's/"//g'`" + else + TDE_RELEASE_VERSION="`echo $TDE_RELEASE_VERSION | awk '{print $3}' | sed -e 's/"//g'`" + fi + echo " TDE Release Version: $TDE_RELEASE_VERSION" + if [ -z "$TDE_RELEASE_VERSION" ]; then + echo "Cannot determine the Trinity version number. Please verify $TDEVERSION_FILE exists." + echo + exit 1 + fi +else + echo "Please verify $TDEVERSION_FILE exists." + echo + exit 1 +fi + +# Extract the file date stamp to use as the release date. +TDE_RELEASE_DATE=`find $TDEVERSION_FILE -printf "%TB %Te, %TY\n"` +echo " TDE Release Date: $TDE_RELEASE_DATE" +# Create a copyright date string. First release of Trinity was 3.5.11, April 29, 2010. +TDE_RELEASE_COPYRIGHT="2010-`date +%Y`" +echo " TDE Release Copyright: $TDE_RELEASE_COPYRIGHT" + +# Now update $ENTITIES_FILE. +if [ -r "$ENTITIES_FILE" ]; then + echo "" >> $ENTITIES_FILE + echo -e "" >> $ENTITIES_FILE + echo -e "" >> $ENTITIES_FILE + echo -e "" >> $ENTITIES_FILE +else + echo "Please verify $ENTITIES_FILE exists." + echo + exit 1 +fi +exit 0 -- cgit v1.2.1