This is an automated email from the ASF dual-hosted git repository. sebb pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit d623d016ae2258e77a15f3d68f266b36f5a85c68 Author: Sebb <[email protected]> AuthorDate: Tue Nov 30 17:24:40 2021 +0000 Include endpoints and main.py in version --- server/main.py | 7 +++---- server/server_version.py | 2 ++ server/update_version.sh | 17 ++++++++++++----- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/server/main.py b/server/main.py index 05a1aa0..96d5a4d 100644 --- a/server/main.py +++ b/server/main.py @@ -39,8 +39,7 @@ import plugins.server import plugins.session PONYMAIL_FOAL_VERSION = "0.1.0" -# The following version is generated by update_version.sh -PONYMAIL_PLUGIN_VERSION = '2732886' # Must use single quotes +from server_version import PONYMAIL_SERVER_VERSION # Certain environments such as MinGW-w64 will not register as a TTY and uses buffered output. @@ -55,7 +54,7 @@ class Server(plugins.server.BaseServer): def __init__(self, args: argparse.Namespace): print( - "==== Apache Pony Mail (Foal v/%s ~%s) starting... ====" % (PONYMAIL_FOAL_VERSION, PONYMAIL_PLUGIN_VERSION) + "==== Apache Pony Mail (Foal v/%s ~%s) starting... ====" % (PONYMAIL_FOAL_VERSION, PONYMAIL_SERVER_VERSION) ) # Load configuration yml = yaml.safe_load(open(args.config)) @@ -111,7 +110,7 @@ class Server(plugins.server.BaseServer): # Define response headers first... headers = { - "Server": "Apache Pony Mail (Foal/%s ~%s)" % (PONYMAIL_FOAL_VERSION, PONYMAIL_PLUGIN_VERSION), + "Server": "Apache Pony Mail (Foal/%s ~%s)" % (PONYMAIL_FOAL_VERSION, PONYMAIL_SERVER_VERSION), } # Figure out who is going to handle this request, if any diff --git a/server/server_version.py b/server/server_version.py new file mode 100644 index 0000000..b94c0fc --- /dev/null +++ b/server/server_version.py @@ -0,0 +1,2 @@ +# This file is generated by server/update_version.sh +PONYMAIL_SERVER_VERSION = 'd1b9612' diff --git a/server/update_version.sh b/server/update_version.sh index 71b1dca..afde850 100755 --- a/server/update_version.sh +++ b/server/update_version.sh @@ -7,10 +7,17 @@ FILE=main.py test -r $FILE || { echo "Must be run from the directory containing $FILE!"; exit 1; } -# plugin revision (for updating HTML) -PLUGINS_REV=$(git log -1 --pretty=%h -- plugins) +# Find latest of plugin, endpoint and main.py revisions +SERVER_REV=$({ + git log -1 --pretty='%ct %h' -- endpoints + git log -1 --pretty='%ct %h' -- plugins + git log -1 --pretty='%ct %h' -- main.py +} | sort -r | head -1 | cut -d' ' -f 2) -echo $PLUGINS_REV +cat <<EOD >server_version.py +# This file is generated by server/update_version.sh +PONYMAIL_SERVER_VERSION = '$SERVER_REV' +EOD -perl -0pe "s/^PONYMAIL_PLUGIN_VERSION = '[^']*'/PONYMAIL_PLUGIN_VERSION = '$PLUGINS_REV'/smg" \ - ${FILE} > ${FILE}.tmp && mv ${FILE}.tmp ${FILE} +# Has it changed? +git diff --exit-code -- server_version.py
