Package: grammalecte / 2.1.2+ds2-2

0006-make-reproducible.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--- a/graphspell/dawg.py
+++ b/graphspell/dawg.py
@@ -453,7 +453,7 @@
             hDst.write( json.dumps(self.getBinaryAsJSON(), ensure_ascii=False) )
 
     def _getDate (self):
-        return time.strftime("%Y-%m-%d %H:%M:%S")
+        return time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))))
 
     def _writeNodes (self, sPathFile):
         "for debugging only"
--- a/graphspell-js/dawg.js
+++ b/graphspell-js/dawg.js
@@ -444,6 +444,9 @@
 
     _getDate () {
         let oDate = new Date();
+    if (process.env.SOURCE_DATE_EPOCH) {
+        oDate = new Date((process.env.SOURCE_DATE_EPOCH * 1000) + (oDate.getTimezoneOffset() * 60000));
+    }
         let sMonth = (oDate.getMonth() + 1).toString().padStart(2, "0"); // Month+1: Because JS always sucks somehow.
         let sDay = (oDate.getDate()).toString().padStart(2, "0");
         let sHours = (oDate.getHours()).toString().padStart(2, "0");