-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python3: proper syntax for Windows patches #351010
base: master
Are you sure you want to change the base?
Conversation
(lib.hasSuffix ".patch" f) && | ||
(!(lib.any (s: lib.hasSuffix s f) skipped-patches)) | ||
) | ||
(lib.filesystem.listFilesRecursive mingw-patch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this be import-from-derivation (IFD), which is not allowed in Nixpkgs?
(If I'm right, OfBorg will fail.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know? Its just pulling files from a fetched collection, same as any other source files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's different, because it's examining the contents of an output at eval time, which is IFD:
% nix-instantiate -A pkgsCross.mingwW64.python3 https://github.com/NixOS/nixpkgs/tarball/pull/351010/head --no-allow-import-from-derivation
unpacking 'https://github.com/NixOS/nixpkgs/tarball/pull/351010/head' into the Git cache...
error:
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:34:12:
33|
34| strict = derivationStrict drvAttrs;
| ^
35|
… while evaluating derivation 'python3-x86_64-w64-mingw32-3.12.6'
whose name attribute is located at /nix/store/3rrsajixf7mw09ccjczdxj2cbs04i7px-source/pkgs/stdenv/generic/make-derivation.nix:336:7
… while evaluating attribute 'patches' of derivation 'python3-x86_64-w64-mingw32-3.12.6'
at /nix/store/3rrsajixf7mw09ccjczdxj2cbs04i7px-source/pkgs/stdenv/generic/make-derivation.nix:400:15:
399|
400| inherit patches;
| ^
401|
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: cannot build '/nix/store/2g908pd3xl5i4f35d869ijkfb5hxvnn2-mingw-python-patches.drv^out' during evaluation because the option 'allow-import-from-derivation' is disabled
This filtering needs to happen during the build, not during eval.
(I was wrong about OfBorg though, because it's not testing Windows of course!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm, so how do I do that? I've only ever applied patches through the patch argument to the derivation. I haven't seen any discussion of filtering them thusly. Do I need to just reference each file with a separate fetchpatch in the list? Or is there a way to do the dynamic filtering at build time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, wait, I can just explicitly list off the patches from that git derivation that I do want and then it won't be reading the derivation at eval time. Let me try it that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I've made it a whitelist of the patches rather than trying to read from the patch set. Hopefully this works better?
Windows patches were being added with a shell glob, which was dying with an error. See NixOS#351007. Use filesystem methods to walk the patch set and retrieve the patch names. Also, update the patches from the Fedora project to the latest for Python 3.11.9 and add filtering for any that are already applied to the 3.11.10 in the current cycle. python312 still fails to cross-compile after this patch, but at least 3.11 will again be available
872f63f
to
708a493
Compare
}; | ||
in [ | ||
"${mingw-patch}/*.patch" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It worked when I merged #227818 and the last time I tried to compile python3 mingw (with patch conflicts) about a month ago.
Did the nix update from 2.18 to 2.24 break it? or did one of the recent structuredAttrs PRs break it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to run a git bisect
between master and that commit, but it's not easy to say. A few of the builds are failing because of mpdecimal
having been a build req at one point, and it not being available on mingw. Let's see what the result of the bisect is, though, to know if it helps or if that false negative is going to interrupt it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It must've broke within 30 days
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing a git bisect
between the current head of master and the one you linked above (ignoring the failures from mpdecimal
being flagged non-Windows) brings me to this commit:
commit 6c04557835ebfd0fa90dd5037b7422a9d4300a81 (HEAD)
Merge: fba309020fb2 fe944df56f83
Author: Vladimír Čunát <v@cunat.cz>
Date: Sun Oct 13 09:45:55 2024 +0200
staging-next 2024-09-21 (#343421)
That doesn't seem like such a very helpful commit. I did run the bisect with --first-parent
.
Windows patches were being added with a shell glob, which was dying with
an error. See #351007. Use filesystem methods to walk the patch set and
retrieve the patch names.
Also, update the patches from the Fedora project to the latest for
Python 3.11.9 and add filtering for any that are already applied to the
3.11.10 in the current cycle.
python312 still fails to cross-compile after this patch, but at least
3.11 will again be available
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.