diff --git a/ssg/build_yaml.py b/ssg/build_yaml.py index 1bd4e9d4835..ed991fcbb3b 100644 --- a/ssg/build_yaml.py +++ b/ssg/build_yaml.py @@ -8,6 +8,7 @@ from copy import deepcopy import datetime +import time import json import os import os.path @@ -741,7 +742,10 @@ def _create_benchmark_xml_skeleton(self, env_yaml): root.set('xml:lang', 'en-US') status = ET.SubElement(root, '{%s}status' % XCCDF12_NS) - status.set('date', datetime.date.today().strftime("%Y-%m-%d")) + status.set( + 'date', + time.strftime("%Y-%m-%d", + time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))))) status.text = self.status add_sub_element(root, "title", XCCDF12_NS, self.title) diff --git a/utils/create_scap_delta_tailoring.py b/utils/create_scap_delta_tailoring.py index 6ccca8fc8c0..ee85a57bc01 100755 --- a/utils/create_scap_delta_tailoring.py +++ b/utils/create_scap_delta_tailoring.py @@ -2,6 +2,7 @@ import argparse import datetime +import time import json import os import re @@ -165,10 +166,8 @@ def setup_tailoring_profile(profile_id, profile_root): def _get_datetime(): - try: - return datetime.datetime.now(datetime.UTC).isoformat() - except AttributeError: - return datetime.datetime.utcnow().isoformat() + return datetime.datetime.fromtimestamp( + int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))).isoformat() def create_tailoring(args):