Skip to content
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

allow fetchpatch everywhere, without restrictions #188587

Closed
wants to merge 15 commits into from
Closed

allow fetchpatch everywhere, without restrictions #188587

wants to merge 15 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Aug 28, 2022

Description of changes

This PR eliminates all restrictions on the use of fetchpatch, and makes a point of using it in the earliest part of the stdenv bootstrap (i.e. binutils) to demonstrate the functionality and serve as a regression test going forward.

If this merges it can be followed by a treewide to delete all of the (untested and untestable) "cannot use fetchpatch" comments.

See also NixOS/nix#7052; if you are running Nix >=2.12 you can revert the last two commits in this series.

Things done
  • Built (stdenv) on platform(s)
    • x86_64-linux
    • powerpc64le-linux
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@ghost

This comment was marked as resolved.

@ghost ghost closed this Aug 28, 2022
@ghost ghost reopened this Sep 16, 2022
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 16, 2022
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 16, 2022
This commit assumes that NixOS/nix#7052 merges.  If it
has not yet merged and you did not cherry-pick it into your copy of Nix, revert
this commit before testing.
@ghost ghost marked this pull request as ready for review September 16, 2022 08:18
@ghost ghost mentioned this pull request Sep 16, 2022
Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we must drop 30a099f until the minimal nix version contains that fix :/

In addition to that can you do a treewide change to remove the warnings that fetchpatch cannot be used?

Comment on lines +198 to +201
# the parts of patchutils used by fetchpatch do not
# require perl, so we could eliminate this by patching
# patchutils' build scripts...
perl = bootstrapTools;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if bootstrapTools contains anything related to perl. If not then I think it would be cleaner to exclude it like makeWrapper.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bootstrapTools contain a copy of perl. Mainly because autoconf/automake need it.

I would love to eliminate perl from the bootstrapTools. I tried a while back and while it is probably possible it is a very major undertaking. If it ever were eliminated we could (as my comment explains) apply a small patch to patchutils to drop all the parts of it that need perl (fetchpatch doesn't use those parts).

pkgs/development/tools/misc/binutils/default.nix Outdated Show resolved Hide resolved
pkgs/development/tools/misc/binutils/default.nix Outdated Show resolved Hide resolved
pkgs/build-support/fetchurl/boot.nix Outdated Show resolved Hide resolved
Adam Joseph and others added 5 commits September 16, 2022 17:47
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
@ghost
Copy link
Author

ghost commented Sep 16, 2022

I think we must drop 30a099f until the minimal nix version contains that fix :/

I have reverted 30a099f.

NixOS/nix#7052 just merged, so "minimal nix version" for 30a099f is now known to be "2.12".

Keep in mind that this PR still needs impure-derivations which is a Nix 2.8+ feature, so "minimal nix version" for the PR as a whole cannot go any lower than that -- unless there's some trick for adding a postFetch to <nix/fetchurl.nix> in older versions of Nix.

In addition to that can you do a treewide change to remove the warnings that fetchpatch cannot be used?

Yes, once this PR is deemed mergeable I would be happy to do that (and squash these commits too). But a treewide like that will accrue tons of merge conflicts if is is left sitting unmerged, so I'd rather wait until "the last minute" to push that commit into this PR.

@ghost ghost requested a review from SuperSandro2000 September 16, 2022 17:54
The method for signaling that `__impure` is desired went through a few minor
revisions between this PR being filed and NixOS/nix#7052
being merged.  This commit accounts for those changes so the "pre-Nix-2.12
emulation" uses the same interface that Nix 2.12 will use.

See also: NixOS/nix#7052 (comment)
@SuperSandro2000
Copy link
Member

@ofborg eval

@ghost
Copy link
Author

ghost commented Oct 3, 2022

@ofborg eval

@SuperSandro2000, please see the giant text at the very top of the PR.

If there were some way I could add <blink> tags to it, I would.

@ghost
Copy link
Author

ghost commented Oct 4, 2022

I guess I should draftify this until/if impure-derivations is stabilized.

That may be years in the future, when this patch no longer applies, but I'm cool with that. I just wanted to prove that this was possible.

@ghost ghost marked this pull request as draft October 4, 2022 08:12
@ghost ghost mentioned this pull request Jan 7, 2023
2 tasks
Minion3665 pushed a commit to Minion3665/nix that referenced this pull request Feb 23, 2023
This commit adds an optional `__impure` parameter to fetchurl.nix, which allows
the caller to use `libfetcher`'s fetcher in an impure derivation.  This allows
nixpkgs' patch-normalizing fetcher (fetchpatch) to be rewritten to use nix's
internal fetchurl, thereby eliminating the awkward "you can't use fetchpatch
here" banners scattered all over the place.

See also: NixOS/nixpkgs#188587
@ghost
Copy link
Author

ghost commented Nov 12, 2023

This needs ca-derivations, and it looks like we're still a very long way from being able to use those.

@ghost ghost closed this Nov 12, 2023
@ghost ghost deleted the pr/fetchpatch/boot branch January 23, 2024 06:47
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant