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

treewide: convert patch series files to Nix expressions #96269

Merged
merged 3 commits into from Sep 3, 2020

Conversation

deviant
Copy link
Member

@deviant deviant commented Aug 25, 2020

lib.readPathsFromFile is slow, unidiomatic, and barely used throughout nixpkgs.
It exists to read patch series files in the Quilt format, something made completely
redundant by the Nix expression language having full support for lists and comments.

This proposes to remove usage of these, opting to instead use Nix lists for the task,
which both removes indirection (patch series are now visible directly in the derivation),
and is more efficient. There were not many instances of lib.readPathsFromFile being
used, mostly localised to KDE software.

This also adds a warning notice to users of lib.readPathsFromFile. I didn't modify
its documentation, and am unsure whether it should just be removed entirely. There
doesn't seem to be any documentation for process or deprecating things, so I just
took the most reasonable conservative approach I could.

By the way, is there a convenient way of testing if a particular commit changed the
derivation of an expression or not? It would be useful for refactors like this, where
there shouldn't be any difference between the two. nixpkgs-review just crashed.
I ended up checking each package manually; am I missing a simpler way?

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.

@ttuegel
Copy link
Member

ttuegel commented Aug 26, 2020

It exists to read patch series files in the Quilt format, something made completely
redundant by the Nix expression language having full support for lists and comments.

Quilt is in no way made redundant by the Nix expression language. Nix does not provide a workflow for managing patches: applying patches to an unpacked source tree, editing, and reordering patches. By all means, let's remove the patch series files, but let's not justify it with false statements.

By the way, as a maintainer, the only thing that was a bigger pain for me than dealing with Quilt, was dealing with lots of patches without Quilt, so if anyone has suggestions there, I'm listening.

@deviant
Copy link
Member Author

deviant commented Aug 26, 2020

Quilt is in no way made redundant by the Nix expression language. Nix does not provide a workflow for managing patches: applying patches to an unpacked source tree, editing, and reordering patches. By all means, let's remove the patch series files, but let's not justify it with false statements.

I didn't say that. I said that the file format is redundant if using the Nix expression language, which offers the same syntactical constructs (and more). There's no reason why Quilt itself couldn't be modified to produce Nix expressions.

By the way, as a maintainer, the only thing that was a bigger pain for me than dealing with Quilt, was dealing with lots of patches without Quilt, so if anyone has suggestions there, I'm listening.

Have you checked out git-series? It offers a lot of the functionality provided by Quilt, but integrated into git (so you have full patchset history and diffing). It also has really nice support for rebasing patches (each patchset has a base commit, and the history of all rebases is retained). Applying patches/fixing rejects can be done normally with git itself. Of course, you will have projects that do not use git, and since you're probably more interested in the distribution aspects of patchsets, there are probably places where you cannot replace Quilt itself. But again, I'm talking about the format.

I maintain a private overlay with a set of series.nix files for each of the pieces of software I have patches for, and while I don't have enough to justify using Quilt for the most part (and in the cases where there are conflicts/large numbers of patches/etc, I am generally working with the upstream repository), it's just a 1-1 translation between the two (indent everything by two spaces, stick square brackets around the ends, prefix with ./ to turn the paths into Nix paths, and add comments at the end of each line containing the commit message/mail subject to make things easier to browse through). One could easily imagine modifying Quilt itself to generate these.

I hope this clarifies things.

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

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

Looking good, will merge after conflicts resolved!

Nix expressions provide all the features that Quilt series files have,
so using those instead is pointless. Also, lib.readPathsFromFile
(the function used to read series files) has the following warning:

> NOTE: This function is not performant and should be avoided.

This also removes some orphaned series files, and unused references to
copyPathsToStore (which were probably missed in previous commits
where calls to lib.readPathsFromFile were removed)
> NOTE: This function is not performant and should be avoided.

It's not used at all in-tree now, so we can remove it completely after
any remaining users are given notice.
@deviant
Copy link
Member Author

deviant commented Sep 3, 2020

@infinisil Done.

@deviant
Copy link
Member Author

deviant commented Sep 3, 2020

(Is the editorconfig check new? Either way, it's not on lines I touched)

@infinisil infinisil merged commit 8272eff into NixOS:master Sep 3, 2020
@deviant deviant deleted the remove-quilt-series branch September 3, 2020 21:20
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

5 participants