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

st: copy config file in 'prePatch' instead of 'preBuild' #85443

Merged
merged 1 commit into from Apr 17, 2020
Merged

Conversation

Mic92
Copy link
Member

@Mic92 Mic92 commented Apr 17, 2020

The patch phase runs after the build phase. Which means than when
using an override to override both 'conf' and 'patches' to provide
a custom config file and apply some patches, it doesn't work:

  • first the patches applied (optionally changing config.def.h)
  • then preBuild is run which overrides config.def.h with the user
    supplied one (effectively cancelling previously applied patches)

By copying the config file in the prePatch phase instead, changes
are kept and applied in order.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

The patch phase runs after the build phase. Which means than when
using an override to override both 'conf' and 'patches' to provide
a custom config file and apply some patches, it doesn't work:
- first the patches applied (optionally changing config.def.h)
- then preBuild is run which overrides config.def.h with the user
supplied one (effectively cancelling previously applied patches)

By copying the config file in the prePatch phase instead, changes
are kept and applied in order.
@Mic92 Mic92 marked this pull request as ready for review April 17, 2020 13:53
@Mic92
Copy link
Member Author

Mic92 commented Apr 17, 2020

@GrahamcOfBorg build st

@Mic92 Mic92 merged commit 3cb479a into NixOS:master Apr 17, 2020
@Mic92 Mic92 deleted the st branch April 17, 2020 13:55
@Mic92
Copy link
Member Author

Mic92 commented Apr 17, 2020

Backport to 20.03:

Auto-merging pkgs/applications/misc/st/default.nix
[detached HEAD a96fbaa] st: copy config file in 'prePatch' instead of 'preBuild'
Author: nschoe nschoe@protonmail.com
Date: Fri Apr 17 14:50:08 2020 +0100
1 file changed, 3 insertions(+), 2 deletions(-)
Press Enter to continue
tig upstream/master 5.51s user 0.72s system 102% cpu 6.099 tota

@oxzi
Copy link
Member

oxzi commented Apr 22, 2020

I'm not quite sure about this changes, but I think it is breaking with common usage. I would guess that most users are adding some provided patches from upstream and a custom configuration file.

By default, the patches were written against the vanilla release version. Thus, by applying the patches first, they should work. The custom configuration file will then just replace the (potentially patched) config file.

However, if the custom configuration is applied at first, some patches are not compatible anymore because they are also adjusting the configuration file. This obviously fails, because it is no longer in its vanilla state.

Furthermore, I think the argumentation is wrong. Afaik, the patch phase is run before the build phase, not afterwards. The explained state in the commit message was already there before.

Would it be possible to revert this change?

@Mic92
Copy link
Member Author

Mic92 commented Apr 22, 2020

you can make a pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants