summaryrefslogtreecommitdiffstats
path: root/kdoctools
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2020-03-13 09:42:43 +0100
committerSlávek Banko <slavek.banko@axis.cz>2020-03-15 16:55:27 +0100
commit799489de17c13e9bcdbf5f14eb470e74590e9d3f (patch)
tree9d08dc77258b225bf9d61e003c93264b722c0bf2 /kdoctools
parent922e81bf4548dcaf96b4e6b4dcfd90f3390a76e5 (diff)
downloadtdelibs-799489de17c13e9bcdbf5f14eb470e74590e9d3f.tar.gz
tdelibs-799489de17c13e9bcdbf5f14eb470e74590e9d3f.zip
Use the source package date or the source git repository date
instead of the current build date. The use of a stable date is necessary to achieve reproducible builds. Updating release information in docbook entities is done directly in CMake rules. Entities will no longer be duplicated during repeated updates. Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'kdoctools')
-rw-r--r--kdoctools/ConfigureChecks.cmake103
-rw-r--r--kdoctools/customization/entities/general.entities3
-rw-r--r--kdoctools/update-entities.sh69
3 files changed, 77 insertions, 98 deletions
diff --git a/kdoctools/ConfigureChecks.cmake b/kdoctools/ConfigureChecks.cmake
index 3b65c67fd..432811825 100644
--- a/kdoctools/ConfigureChecks.cmake
+++ b/kdoctools/ConfigureChecks.cmake
@@ -1,6 +1,6 @@
#################################################
#
-# (C) 2012 Trinity Project
+# (C) 2012-2020 Trinity Project
#
# Improvements and feedback are welcome
#
@@ -8,32 +8,83 @@
#
#################################################
-configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/update-entities.sh ${CMAKE_CURRENT_BINARY_DIR}/update-entities IMMEDIATE @ONLY )
+if( NOT TDE_RELEASE_ENTITIES )
-set( UPDATE_SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/update-entities" )
-set( TDEVERSION_FILE "${CMAKE_SOURCE_DIR}/tdecore/tdeversion.h" )
-set( ENTITIES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/customization/entities/general.entities" )
+ set( TDEVERSION_FILE "${CMAKE_SOURCE_DIR}/tdecore/tdeversion.h" )
+ set( ENTITIES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/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( )
+ if( NOT EXISTS ${TDEVERSION_FILE} )
+ tde_message_fatal( "${TDEVERSION_FILE} not found! Check your sources." )
+ endif( )
+ if( NOT EXISTS ${ENTITIES_FILE} )
+ tde_message_fatal( "${ENTITIES_FILE} not found! Check your sources." )
+ endif( )
+
+ # read source metadata
+ tde_read_src_metadata()
+
+ # read TDE_VERSION_STRING
+ file( STRINGS ${TDEVERSION_FILE} TDE_VERSION_STRING REGEX "define TDE_VERSION_STRING" )
+ string( REGEX REPLACE ".*#define TDE_VERSION_STRING \"([^\"]*)\".*" "\\1"
+ TDE_VERSION_STRING "${TDE_VERSION_STRING}" )
+ if( "${TDE_VERSION_STRING}" STREQUAL "" )
+ tde_message_fatal( "Cannot determine the Trinity version number." )
+ endif( )
+
+ # compose TDE_RELEASE_DATE
+ if( "${TDE_VERSION_STRING}" MATCHES "DEVELOPMENT" )
+ tde_curdatetime( TDE_RELEASE_DATE )
+ else( )
+ if( TDE_SCM_MODULE_DATETIME )
+ set( TDE_RELEASE_DATE "${TDE_SCM_MODULE_DATETIME}" )
+ else( )
+ execute_process(
+ COMMAND find ${TDEVERSION_FILE} -printf "%Tm/%Te/%TY"
+ OUTPUT_VARIABLE TDE_RELEASE_DATE
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ endif( )
+ endif( )
+ execute_process(
+ COMMAND date +2010-%Y -d "${TDE_RELEASE_DATE}"
+ OUTPUT_VARIABLE TDE_RELEASE_COPYRIGHT
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ execute_process(
+ COMMAND date +%B\ %e,\ %Y -d "${TDE_RELEASE_DATE}"
+ OUTPUT_VARIABLE TDE_RELEASE_DATE
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ # update entities
+ message( STATUS "Updating ${ENTITIES_FILE}
+ TDE Release Version: ${TDE_VERSION_STRING}
+ TDE Release Date: ${TDE_RELEASE_DATE}
+ TDE Release Copyright: ${TDE_RELEASE_COPYRIGHT}"
+ )
+ file( READ ${ENTITIES_FILE} ENTITIES_DATA )
+ if( "${ENTITIES_DATA}" MATCHES "ENTITY tde-release-version" )
+ string( REGEX REPLACE "(ENTITY tde-release-version) \"[^\"]*\""
+ "\\1 \"${TDE_VERSION_STRING}\"" ENTITIES_DATA "${ENTITIES_DATA}" )
+ else( )
+ set( ENTITIES_DATA
+ "${ENTITIES_DATA}<!ENTITY tde-release-version \"${TDE_VERSION_STRING}\">\n" )
+ endif( )
+ if( "${ENTITIES_DATA}" MATCHES "ENTITY tde-release-date" )
+ string( REGEX REPLACE "(ENTITY tde-release-date) \"[^\"]*\""
+ "\\1 \"${TDE_RELEASE_DATE}\"" ENTITIES_DATA "${ENTITIES_DATA}" )
+ else( )
+ set( ENTITIES_DATA
+ "${ENTITIES_DATA}<!ENTITY tde-release-date \"${TDE_RELEASE_DATE}\">\n" )
+ endif( )
+ if( "${ENTITIES_DATA}" MATCHES "ENTITY tde-copyright-date" )
+ string( REGEX REPLACE "(ENTITY tde-copyright-date) \"[^\"]*\""
+ "\\1 \"${TDE_RELEASE_COPYRIGHT}\"" ENTITIES_DATA "${ENTITIES_DATA}" )
+ else( )
+ set( ENTITIES_DATA
+ "${ENTITIES_DATA}<!ENTITY tde-copyright-date \"${TDE_RELEASE_COPYRIGHT}\">\n" )
+ endif( )
+ file( WRITE ${ENTITIES_FILE} "${ENTITIES_DATA}" )
+ set( TDE_RELEASE_ENTITIES 1 CACHE INTERNAL "" )
-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/customization/entities/general.entities b/kdoctools/customization/entities/general.entities
index a44c4ccb7..cfb5f6a7a 100644
--- a/kdoctools/customization/entities/general.entities
+++ b/kdoctools/customization/entities/general.entities
@@ -425,6 +425,3 @@
<!ENTITY tde-team "The &tde; Team">
-<!ENTITY tde-release-version "R14.1.0 [DEVELOPMENT]">
-<!ENTITY tde-release-date "December 15, 2014">
-<!ENTITY tde-copyright-date "2010-2014">
diff --git a/kdoctools/update-entities.sh b/kdoctools/update-entities.sh
deleted file mode 100644
index 5345a71c6..000000000
--- a/kdoctools/update-entities.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/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
-
-# $TDEVERSION_FILE (tdeversion.h) remains stagnant throughout the git cycle.
-# The internal release data is manually patched only for the official release.
-# Therefore the file date stamp does not change. As the development cycle
-# progresses, the file date stamp looks really old in the help handbooks. As
-# the tde-release-date entity eventually will match the official release file
-# date stamp, we can use the actual date up to that point, which looks nicer
-# in the handbooks during the development cycle.
-if [ -n "`echo \"$TDE_RELEASE_VERSION\" | grep DEVELOPMENT`" ]; then
- # Development cycle: use the actual date as the release date.
- TDE_RELEASE_DATE=`date +'%B %e, %Y'`
-else
- # Official release: extract the file date stamp as the release date.
- TDE_RELEASE_DATE=`find $TDEVERSION_FILE -printf "%TB %Te, %TY\n"`
-fi
-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 "<!ENTITY tde-release-version \"${TDE_RELEASE_VERSION}\">" >> $ENTITIES_FILE
- echo -e "<!ENTITY tde-release-date \"${TDE_RELEASE_DATE}\">" >> $ENTITIES_FILE
- echo -e "<!ENTITY tde-copyright-date \"${TDE_RELEASE_COPYRIGHT}\">" >> $ENTITIES_FILE
-else
- echo "Please verify $ENTITIES_FILE exists."
- echo
- exit 1
-fi
-exit 0