From 2ffdd71d859af3254732e30013bfddb2497c8a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fridrich=20=C5=A0trba?= Date: Tue, 16 Jul 2024 06:56:39 +0200 Subject: [PATCH 8/8] Reproducible builds: constant timestamp for pom.properties --- java-utils/maven_depmap.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/java-utils/maven_depmap.py b/java-utils/maven_depmap.py index 4bfb877d..693cf5e3 100644 --- a/java-utils/maven_depmap.py +++ b/java-utils/maven_depmap.py @@ -43,7 +43,7 @@ import sys from os.path import basename, dirname import zipfile -from time import gmtime, strftime +import time from copy import deepcopy from javapackages.maven.pom import POM @@ -172,7 +172,11 @@ def append_if_missing(archive_name, file_name, file_contents): archive = zipfile.ZipFile(archive_name, 'a') try: if file_name not in archive.namelist(): - archive.writestr(file_name, file_contents) + file_time = min(4354819199, + max(315532800, + int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))) + file_zipinfo = zipfile.ZipInfo(file_name, date_time=time.gmtime(file_time)) + archive.writestr(file_zipinfo, file_contents) finally: archive.close() -- 2.45.2