diff options
| author | sternenseemann <sternenseemann@systemli.org> | 2025-07-16 23:45:13 +0200 |
|---|---|---|
| committer | sternenseemann <sternenseemann@systemli.org> | 2025-07-18 00:24:36 +0200 |
| commit | f89a54c9ebc1ae8b9901080fd421b9e3ed050920 (patch) | |
| tree | 818108462b2971689e6420d62236a0602beb21ba /pkgs/development/python-modules/python-mapnik/python-mapnik_std_optional.patch | |
| parent | 8dfbfd4d8c9895c97e4c5af89d7478db4ee98d74 (diff) | |
srcOnly: differentiate between computed and user passed drvAttrs
Currently srcOnly assumes that it can pass drv.drvAttrs to
drv.stdenv.mkDerivation and obtain basically the same resulting
derivation, i.e. that drvAttrs and the arguments passed to
stdenv.mkDerivation are equivalent.
It is obvious, that stdenv.mkDerivation may at any point violate this
assumption. Currently, there are two (known) problems stemming from this
assumption affecting srcOnly:
- If __structuredAttrs = true, drvAttrs will contain the env attribute
set as passed to stdenv.mkDerivation as well as its members at the
top level like they need to be passed to builtins.derivation.
If such an attribute set is passed to stdenv.mkDerivation again,
it triggers its consistency check implemented in #332750.
This affects e.g. pkgs.git since 318b8c61bdacb3e5c190c5ab3a7ac.
- The use of stdenv adapters that modify the env attribute set
(like withCFlags) causes another issue. In such cases, the
effect of the adapter, e.g. setting env.NIX_CFLAGS_COMPILE
can be observed as drvAttrs.NIX_CFLAGS_COMPILE. Without
__structuredAttrs, drvAttrs.env.NIX_CFLAGS_COMPILE would
not be set.
However, because srcOnly dutifully uses the same stdenv as the
original derivation, the stdenv adapter will be applied to the
derivation constructed by srcOnly as well. Because it can't tell that
NIX_CFLAGS_COMPILE was set by the adapter, it'll pass it to
stdenv.mkDerivation. Unaware of this, the stdenv adapter is applied
again and sets env.NIX_CFLAGS_COMPILE, triggering the same consistency
check as above.
tests.srcOnly now also checks that both these issues have been fixed in
srcOnly.
The solution to this is to change the derivation instead of
reconstructing it. Since srcOnly assumes that the input derivation is
based on stdenv.mkDerivation anyways, we are entitled to take advantage
of overrideAttrs. This enables us to see the (effective) arguments
passed to stdenv.mkDerivation via prevAttrs -- before any duplication
between env and the top level happens. We are also guaranteed that the
stdenv adapters are applied only once.
Resolves #269539.
Note that this commit passes the tests.srcOnly test suite both before
and after the change to getEquivAttrs, i.e. that test suite change may
be rebased out or applied after this commit.
Diffstat (limited to 'pkgs/development/python-modules/python-mapnik/python-mapnik_std_optional.patch')
0 files changed, 0 insertions, 0 deletions
