forked from pool/javapackages-tools
This commit is contained in:
parent
121a082729
commit
addfba6fef
@ -1,41 +1,35 @@
|
||||
From 1f3c0d52b1e0feb42a48aa8ac8de4f3b37465e4e Mon Sep 17 00:00:00 2001
|
||||
From 2ffdd71d859af3254732e30013bfddb2497c8a41 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
|
||||
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 | 14 ++++++++++++--
|
||||
1 file changed, 12 insertions(+), 2 deletions(-)
|
||||
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..74860baf 100644
|
||||
index 4bfb877d..693cf5e3 100644
|
||||
--- a/java-utils/maven_depmap.py
|
||||
+++ b/java-utils/maven_depmap.py
|
||||
@@ -43,7 +43,8 @@ import sys
|
||||
@@ -43,7 +43,7 @@ import sys
|
||||
|
||||
from os.path import basename, dirname
|
||||
import zipfile
|
||||
-from time import gmtime, strftime
|
||||
+import time
|
||||
+import datetime
|
||||
from copy import deepcopy
|
||||
|
||||
from javapackages.maven.pom import POM
|
||||
@@ -172,7 +173,16 @@ def append_if_missing(archive_name, file_name, file_contents):
|
||||
@@ -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)
|
||||
+ date_time = datetime.datetime.fromtimestamp(
|
||||
+ int(os.environ.get('SOURCE_DATE_EPOCH', time.time())),
|
||||
+ tz=datetime.timezone.utc,
|
||||
+ ).timetuple()
|
||||
+ if date_time[0] < 1980:
|
||||
+ date_time = (1980, 1, 1, 0, 0, 0)
|
||||
+ elif date_time[0] > 2107:
|
||||
+ date_time = (2107, 12, 31, 23, 59, 59)
|
||||
+ file_zipinfo = zipfile.ZipInfo(file_name, date_time=date_time)
|
||||
+ 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()
|
||||
|
Loading…
Reference in New Issue
Block a user