about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2016-02-01 12:31:17 +0100
committerVladimír Čunát <vcunat@gmail.com>2016-02-03 10:21:16 +0100
commite4ab8aee62fe65252b40861900decc7e880517a7 (patch)
treec8f915c7d571d7c6adbb95e7e807c622acaa2c2b
parent70efc87a06c3cfbbd9f559e5442318f6c978edcb (diff)
downloadnixlib-e4ab8aee62fe65252b40861900decc7e880517a7.tar
nixlib-e4ab8aee62fe65252b40861900decc7e880517a7.tar.gz
nixlib-e4ab8aee62fe65252b40861900decc7e880517a7.tar.bz2
nixlib-e4ab8aee62fe65252b40861900decc7e880517a7.tar.lz
nixlib-e4ab8aee62fe65252b40861900decc7e880517a7.tar.xz
nixlib-e4ab8aee62fe65252b40861900decc7e880517a7.tar.zst
nixlib-e4ab8aee62fe65252b40861900decc7e880517a7.zip
add ensureNewerSourcesHook and apply to all python
Fixes #12663: problems in python stuff due to old timestamps in sources.
- Files in sources older than a certain year are set to that year.
- Applied with 1980 for all python packages due to the way it often uses zip.
-rw-r--r--pkgs/development/python-modules/generic/default.nix4
-rw-r--r--pkgs/top-level/all-packages.nix8
2 files changed, 11 insertions, 1 deletions
diff --git a/pkgs/development/python-modules/generic/default.nix b/pkgs/development/python-modules/generic/default.nix
index dab20b2f7447..15f369a44f2d 100644
--- a/pkgs/development/python-modules/generic/default.nix
+++ b/pkgs/development/python-modules/generic/default.nix
@@ -3,7 +3,8 @@
    (http://pypi.python.org/pypi/setuptools/), which represents a large
    number of Python packages nowadays.  */
 
-{ python, setuptools, unzip, wrapPython, lib, bootstrapped-pip }:
+{ python, setuptools, unzip, wrapPython, lib, bootstrapped-pip
+, ensureNewerSourcesHook }:
 
 { name
 
@@ -60,6 +61,7 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "doCheck"] //
   name = namePrefix + name;
 
   buildInputs = [ wrapPython bootstrapped-pip ] ++ buildInputs ++ pythonPath
+    ++ [ (ensureNewerSourcesHook { year = "1980"; }) ]
     ++ (lib.optional (lib.hasSuffix "zip" attrs.src.name or "") unzip);
 
   # propagate python/setuptools to active setup-hook in nix-shell
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 6e743e2d7138..1d25ccc49973 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -259,6 +259,14 @@ let
     { substitutions = { inherit autoconf automake gettext libtool; }; }
     ../build-support/setup-hooks/autoreconf.sh;
 
+  ensureNewerSourcesHook = { year }: makeSetupHook {}
+    (writeScript "ensure-newer-sources-hook.sh" ''
+      postUnpackHooks+=(_ensureNewerSources)
+      _ensureNewerSources() {
+        find "$sourceRoot" '!' -newermt '${year}-01-01' -exec touch -d '${year}-01-02' '{}' '+'
+      }
+    '');
+
   buildEnv = callPackage ../build-support/buildenv { }; # not actually a package
 
   buildFHSEnv = callPackage ../build-support/build-fhs-chrootenv/env.nix {