Description: Make the build reproducible
Author: Chris Lamb <lamby@debian.org>
Last-Update: 2025-04-21

--- openvpn3-client-24+dfsg.orig/src/python/openvpn3/gen-python-constants.cpp
+++ openvpn3-client-24+dfsg/src/python/openvpn3/gen-python-constants.cpp
@@ -29,6 +29,8 @@
 #include "netcfg/netcfg-changetype.hpp"
 #include "sessionmgr/sessionmgr-events.hpp"
 
+#include <openvpn/common/path.hpp>
+
 
 enum class FlagType
 {
@@ -117,7 +119,7 @@ int main(int argc, char **argv)
 {
 
     std::cout << "#" << std::endl
-              << "# Generated by " << argv[0] << std::endl
+              << "# Generated by " << openvpn::path::basename(argv[0]) << std::endl
               << "# as part of the project build." << std::endl
               << "#" << std::endl
               << "# This file is part of openvpn3-linux, licensed" << std::endl
--- openvpn3-client-24+dfsg.orig/src/shell/bash-completion/gen-openvpn2-completion.py
+++ openvpn3-client-24+dfsg/src/shell/bash-completion/gen-openvpn2-completion.py
@@ -17,9 +17,12 @@
 import importlib
 import sys
 import argparse
-from datetime import date
+import os
+import time
+import datetime
 from jinja2 import Template
 
+
 completion_template = """#  OpenVPN 3 Linux client -- Next generation OpenVPN client
 #
 #  SPDX-License-Identifier: AGPL-3.0-only
@@ -122,8 +125,13 @@ if __name__ == '__main__':
         else:
             valid_args[opt] = '%s' % values[0]
 
+    build_date = datetime.datetime.fromtimestamp(
+        int(os.environ.get('SOURCE_DATE_EPOCH', time.time())),
+        tz=datetime.timezone.utc,
+    )
+
     ctpl = Template(completion_template)
     script = ctpl.render(valid_args=valid_args, option_list=option_list,
-                         year=date.today().year)
+                         year=build_date.year)
 
     print(script)
