unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
blob bdf9f201454c87725af22406db1b336dd9d4c66b 1527 bytes (raw)
name: gnu/packages/patches/python-3-deterministic-build-info.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 
Always provide the same date and time in 'Py_GetBuildInfo'.
This is the information shown at the REPL and in 'sys.version'.
We cannot pass it in CPPFLAGS due to whitespace in the DATE string.

--- Modules/getbuildinfo.c
+++ Modules/getbuildinfo.c
@@ -4,6 +4,10 @@
 #include <stdio.h>
 #endif
 
+/* Deterministic date and time.  */
+#define DATE "Jan  1 1970"
+#define TIME "00:00:01"
+
 #ifndef DATE
 #ifdef __DATE__
 #define DATE __DATE__

--- Lib/importlib/_bootstrap.py
+++ Lib/importlib/_bootstrap.py
@@ -1443,7 +1443,8 @@ class SourceLoader(_LoaderBasics):
         Implementing this method allows the loader to read bytecode files.
         Raises IOError when the path cannot be handled.
         """
-        return {'mtime': self.path_mtime(path)}
+        return {'mtime': float(_os.environ.get(b'SOURCE_DATE_EPOCH',
+                                               st.st_mtime))}
 
     def _cache_bytecode(self, source_path, cache_path, data):
         """Optional method which writes data (bytes) to a file path (a str).
@@ -1580,7 +1581,10 @@ class SourceFileLoader(FileLoader, SourceLoader):
     def path_stats(self, path):
         """Return the metadata for the path."""
         st = _path_stat(path)
-        return {'mtime': st.st_mtime, 'size': st.st_size}
+        return {
+            'mtime':  float(_os.environ.get(b'SOURCE_DATE_EPOCH', st.st_mtime)),
+            'size': st.st_size
+        }
 
     def _cache_bytecode(self, source_path, bytecode_path, data):
         # Adapt between the two APIs

debug log:

solving bdf9f20 ...
found bdf9f20 in https://yhetil.org/guix-bugs/87oa9nuol6.fsf@gnu.org/
found 22c372a in https://git.savannah.gnu.org/cgit/guix.git
preparing index
index prepared:
100644 22c372a0cfb0e5e3e9b892d15d1598b64f0ead3d	gnu/packages/patches/python-3-deterministic-build-info.patch

applying [1/1] https://yhetil.org/guix-bugs/87oa9nuol6.fsf@gnu.org/
diff --git a/gnu/packages/patches/python-3-deterministic-build-info.patch b/gnu/packages/patches/python-3-deterministic-build-info.patch
index 22c372a..bdf9f20 100644

1:19: trailing whitespace.
 
1:31: trailing whitespace.
 
Checking patch gnu/packages/patches/python-3-deterministic-build-info.patch...
Applied patch gnu/packages/patches/python-3-deterministic-build-info.patch cleanly.
warning: 2 lines add whitespace errors.

index at:
100644 bdf9f201454c87725af22406db1b336dd9d4c66b	gnu/packages/patches/python-3-deterministic-build-info.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).