Skip to content

Commit

Permalink
add ensureNewerSourcesHook and apply to all python
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vcunat committed Feb 3, 2016
1 parent 70efc87 commit e4ab8ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkgs/development/python-modules/generic/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e4ab8ae

Please sign in to comment.