From: Jason Ish Date: Mon, 1 Apr 2024 16:37:49 +0000 (-0600) Subject: configure: export release date for documentation X-Git-Tag: suricata-8.0.0-beta1~1581 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b58dd5e5855864217fe898b43a3e8f9aaff47ae9;p=thirdparty%2Fsuricata.git configure: export release date for documentation Sphinx embeds a date in the generated man pages, and to provide reproducible builds this date needs to be provided to Sphinx, otherwise it will use the current date. If building from Git, extract the date from the most recent commit. In a release, this commit would be the commit that sets the version so is accurate. If .git does not exist, use the most recent data found in the ChangeLog. The ChangeLog is not used when building from git, as the main/master branch may not have recent enough timestamps. This should provide a consistent date when re-building the distribution from the same non-git archive, or from the same git commit. Ticket: #6911 --- diff --git a/configure.ac b/configure.ac index 8219079969..397e03ad57 100644 --- a/configure.ac +++ b/configure.ac @@ -2515,12 +2515,26 @@ return 0; if test "$HAVE_GIT_CMD" != "no"; then if [ test -d .git ]; then REVISION=`git rev-parse --short HEAD` - DATE=`git log -1 --date=short --pretty=format:%cd` - REVISION="$REVISION $DATE" + LAST_COMMIT_DATE=`git log -1 --date=short --pretty=format:%cd` + REVISION="$REVISION $LAST_COMMIT_DATE" AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision]) fi fi +# Get the release date. If LAST_COMMIT_DATE was set in the previous +# step, use it, otherwise parse it from the ChangeLog. + AC_MSG_CHECKING([for release date]) + if test "x$LAST_COMMIT_DATE" != "x"; then + RELEASE_DATE=$LAST_COMMIT_DATE + else + RELEASE_DATE=`awk '/^[[0-9\.]]+ -- [[0-9]][[0-9]][[0-9]][[0-9]]-[[0-9]][[0-9]]-[[0-9]][[0-9]]/ { print $3; exit }' $srcdir/ChangeLog` + if test "x$RELEASE_DATE" = "x"; then + AC_MSG_ERROR([Failed to determine release date]) + fi + fi + AC_MSG_RESULT([${RELEASE_DATE}]) + AC_SUBST(RELEASE_DATE) + # get MAJOR_MINOR version for embedding in configuration file. MAJOR_MINOR=`expr "${PACKAGE_VERSION}" : "\([[0-9]]\+\.[[0-9]]\+\).*"`