From 7db7750e7b0070ce17e2b7a2af7a4bf62005750d Mon Sep 17 00:00:00 2001 From: John Ellson Date: Fri, 28 Jul 2017 10:55:48 -0400 Subject: [PATCH] use author info from git --- autogen.sh | 31 ++++++++++++++++++++++--------- configure.ac | 12 ++++++++++++ redhat/graphviz.spec.fedora.in | 2 +- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/autogen.sh b/autogen.sh index b3e452e1d..5ca763da8 100755 --- a/autogen.sh +++ b/autogen.sh @@ -4,9 +4,17 @@ if ! GRAPHVIZ_GIT_DATE=$( git log -n 1 --format=%ci ) ; then GRAPHVIZ_VERSION_DATE="0" echo "Warning: build not started in a Git clone, or Git is not installed: setting version date to 0." >&2 else + GRAPHVIZ_AUTHOR_NAME=$( git log -n 1 --format="%an" ) + GRAPHVIZ_AUTHOR_EMAIL=$( git log -n 1 --format="%ae" ) if ! GRAPHVIZ_VERSION_DATE=$( date -u +%Y%m%d.%H%M -d "$GRAPHVIZ_GIT_DATE" 2>/dev/null ) ; then # try date with FreeBSD syntax - if ! GRAPHVIZ_VERSION_DATE=$( date -u -j -f "%Y-%m-%d %H:%M:%S %z" "$GRAPHVIZ_GIT_DATE" +%Y%m%d.%H%M ); then + if ! GRAPHVIZ_VERSION_DATE=$( date -u -j -f "%Y%m%d.%H%M" "$GRAPHVIZ_GIT_DATE" 2>/dev/null); then + echo "Warning: we do not know how to invoke date correctly." >&2 + fi + fi + if ! GRAPHVIZ_CHANGE_DATE=$( date -u +"%a %b %e %Y" -d "$GRAPHVIZ_GIT_DATE" 2>/dev/null ) ; then + # try date with FreeBSD syntax + if ! GRAPHVIZ_CHANGE_DATE=$( date -u -j -f "%a %b %e %Y" -d "$GRAPHVIZ_GIT_DATE" 2>/dev/null); then echo "Warning: we do not know how to invoke date correctly." >&2 fi fi @@ -16,25 +24,30 @@ else echo "Graphviz: abbreviated hash of last commit: $GRAPHVIZ_VERSION_COMMIT" fi -# initialize version for a "stable" build +# initialize version for a "development" build cat >./version.m4 < unstable series dnl even => stable series dnl For the micro number: 0 => in-progress development dnl timestamp => tar-file snapshot or release -m4_define(graphviz_version_major, 2) -m4_define(graphviz_version_minor, 41) +m4_define([graphviz_version_major],[2]) +m4_define([graphviz_version_minor],[41]) dnl NB: The next line is for hard-coding the micro version for stable releases -dnl m4_define(graphviz_version_micro, 1) +dnl m4_define([graphviz_version_micro],[1]) dnl NB: the next line gets changed to a date/time string for development releases -m4_define(graphviz_version_micro, $GRAPHVIZ_VERSION_DATE) +m4_define([graphviz_version_micro],[$GRAPHVIZ_VERSION_DATE]) + +m4_define([graphviz_version_date],[$GRAPHVIZ_VERSION_DATE]) +m4_define([graphviz_change_date],["$GRAPHVIZ_CHANGE_DATE"]) +m4_define([graphviz_git_date],["$GRAPHVIZ_GIT_DATE"]) +m4_define([graphviz_author_name],["$GRAPHVIZ_AUTHOR_NAME"]) +m4_define([graphviz_author_email],[$GRAPHVIZ_AUTHOR_EMAIL]) +m4_define([graphviz_collection],[development]) +m4_define([graphviz_version_commit],[$GRAPHVIZ_VERSION_COMMIT]) -m4_define(graphviz_version_date, $GRAPHVIZ_VERSION_DATE) -m4_define(graphviz_collection, development) -m4_define(graphviz_version_commit, $GRAPHVIZ_VERSION_COMMIT) EOF autoreconf -v --install --force || exit 1 diff --git a/configure.ac b/configure.ac index 76ee73548..be65bc90d 100644 --- a/configure.ac +++ b/configure.ac @@ -11,6 +11,9 @@ dnl Set Graphviz version information # graphviz_version_micro # graphviz_collection # graphviz_version_date +# graphviz_change_date +# graphviz_author_name +# graphviz_author_email # graphviz_version_commit m4_include(./version.m4) @@ -26,6 +29,11 @@ GRAPHVIZ_COLLECTION=graphviz_collection() # NB: date/time of last commit - or "0" GRAPHVIZ_VERSION_DATE=graphviz_version_date() +GRAPHVIZ_GIT_DATE=graphviz_git_date() +GRAPHVIZ_AUTHOR_NAME=graphviz_author_name() +GRAPHVIZ_AUTHOR_EMAIL=graphviz_author_email() +GRAPHVIZ_CHANGE_DATE=graphviz_change_date() + # NB: git commit hash of last commit GRAPHVIZ_VERSION_COMMIT=graphviz_version_commit() @@ -35,6 +43,10 @@ AC_SUBST([GRAPHVIZ_VERSION_MAJOR]) AC_SUBST([GRAPHVIZ_VERSION_MINOR]) AC_SUBST([GRAPHVIZ_VERSION_MICRO]) AC_SUBST([GRAPHVIZ_VERSION_DATE]) +AC_SUBST([GRAPHVIZ_GIT_DATE]) +AC_SUBST([GRAPHVIZ_AUTHOR_NAME]) +AC_SUBST([GRAPHVIZ_AUTHOR_EMAIL]) +AC_SUBST([GRAPHVIZ_CHANGE_DATE]) AC_SUBST([GRAPHVIZ_VERSION_COMMIT]) AC_SUBST([GRAPHVIZ_COLLECTION]) AC_SUBST([GRAPHVIZ_SOURCES]) diff --git a/redhat/graphviz.spec.fedora.in b/redhat/graphviz.spec.fedora.in index 2f8e5f372..68e9e318c 100644 --- a/redhat/graphviz.spec.fedora.in +++ b/redhat/graphviz.spec.fedora.in @@ -1025,7 +1025,7 @@ rm -rf %{buildroot} #-- changelog -------------------------------------------------- %changelog -* Thu Jul 20 2017 John Ellson @VERSION@ +* @GRAPHVIZ_CHANGE_DATE@ @GRAPHVIZ_AUTHOR_NAME@ <@GRAPHVIZ_AUTHOR_EMAIL@> @VERSION@ - see git log (This automatically-replaced single-entry is used for frequent updates in the unstable development series of releases. -- 2.40.0