Honor the 'SOURCE_DATE_EPOCH' environment variable to allow for
determinitic builds.
--- a/Lib/py_compile.py
+++ b/Lib/py_compile.py
@@ -105,7 +105,10 @@ def compile(file, cfile=None, dfile=None, doraise=False):
"""
with open(file, 'U') as f:
try:
- timestamp = long(os.fstat(f.fileno()).st_mtime)
+ if 'SOURCE_DATE_EPOCH' in os.environ:
+ timestamp = long(os.environ['SOURCE_DATE_EPOCH'])
+ else:
+ timestamp = long(os.fstat(f.fileno()).st_mtime)
except AttributeError:
timestamp = long(os.stat(file).st_mtime)
codestring = f.read()
diff --git a/Python/import.c b/Python/import.c
index e47ce63..7eecf9c 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -945,6 +945,11 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat, t
/* Now write the true mtime (as a 32-bit field) */
fseek(fp, 4L, 0);
assert(mtime <= 0xFFFFFFFF);
+ if (Py_GETENV("SOURCE_DATE_EPOCH") != NULL) {
+ const char *epoch = Py_GETENV("SOURCE_DATE_EPOCH");
+ mtime = atoi(epoch);
+ }
+
PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION);
fflush(fp);
fclose(fp);
ix/tree/tests/import-utils.scm?id=26741f5cfd2e4fd48f890d193a875014d18cf630'>treecommitdiff
|
Age | Commit message (Expand) | Author |
2023-07-19 | import/utils: beautify-description: Wrap class names in @code{...}....* guix/import/utils.scm (beautify-description): Add procedure to wrap words in
@code{...} markup.
* tests/import-utils.scm: Add two tests.
| Ricardo Wurmus |
2023-04-07 | packages: Remove 'origin-sha256' procedure....* guix/packages.scm (origin-sha256): Remove procedure.
* tests/import-utils.scm (test-import-utils)
[alist->package with explicit source]: Use content-hash-value.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| Bruno Victal |
2022-12-31 | tests: import-utils: Ignore extra keyword arguments....* tests/import-utils.scm ("recursive-import", "recursive-import: skip false
packages (toplevel)", "recursive-import: skip false packages (dependency)"):
Do not try to match all arguments.
| Ricardo Wurmus |
2022-11-18 | import/utils: spdx-string->license: Support '+' operator....Previously, '+' was supported only via special cases for deprecated
GNU identifiers like 'GPL-N+'. This commit adds support
for other uses of '+', such as 'AFL-2.0+' and 'LPPL-1.0+'.
Strictly speaking, '+' is an operator, not part of the SPDX license
identifier, but it is useful to handle it here.
* guix/import/utils.scm (spdx-string->license): Support '+' operator.
* tests/import-utils.scm ("spdx-string->license"): Test it.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| Philip McGrath |
2022-11-18 | import/utils: spdx-string->license: Match case-insensitively....SPDX specifies that license identifiers (unlike the 'AND', 'OR', and
'WITH' operators) are matched case-insensitively.
* guix/import/utils.scm (%spdx-license-identifiers): New variable.
(spdx-string->license): Search in '%spdx-license-identifiers' using
'string-ci=?'.
* tests/import-utils.scm ("spdx-string->license"): New test.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
| Philip McGrath |
2022-10-05 | tests: Add new test cases for beautify-description....* tests/import-utils.scm ("beautify-description: use double spacing"): Update.
("beautify-description: remove single quotes",
"beautify-description: escape @"): New tests.
| Ricardo Wurmus |
2022-09-29 | import/utils: alist->package: Include properties....* guix/import/utils.scm (alist->package): Process properties field in input
data and include it in the generated package.
* tests/import-utils.scm ("alist->package with properties"): New test.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| itd |
2021-09-01 | import: utils: Skip not found packages....* guix/import/utils.scm (recursive-import): Skip packages when the
package returned by 'repo->guix-package' is false.
* tests/import-utils.scm: New tests.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| Sarah Morgensen |