Skip to content

emacs: add two parameters to genericBuild to control errors#328573

Merged
vcunat merged 3 commits intoNixOS:staging-nextfrom
linj-fork:pr/emacs-build-error-control
Jul 21, 2024
Merged

emacs: add two parameters to genericBuild to control errors#328573
vcunat merged 3 commits intoNixOS:staging-nextfrom
linj-fork:pr/emacs-build-error-control

Conversation

@jian-lin
Copy link
Contributor

@jian-lin jian-lin commented Jul 20, 2024

Description of changes

Motivation: nix build for elisp packages can fail at errors or warnings now, which can be used in CI to improve code quality.

The patch introduces two parameters, turnCompilationWarningToError and
ignoreCompilationError, to control errors in genericBuild.

Note that this patch keeps the old behavior by default. Hopefully one
day we set the default value of ignoreCompilationError to false.

Also note that these two parameters can be changed per package using
the overrideAttrs interface.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • 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/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@jian-lin jian-lin requested a review from AndersonTorres July 20, 2024 02:13
@jian-lin jian-lin requested a review from adisbladis as a code owner July 20, 2024 02:13
@github-actions github-actions bot added the 6.topic: emacs Text editor label Jul 20, 2024
@jian-lin
Copy link
Contributor Author

jian-lin commented Jul 20, 2024

It would be good to create a job set (using emacs-overlay's nix-community hydra maybe?) with ignoreCompilationError = false so that we know what packages are broken and fix them and finally flip the default value of ignoreCompilationError.

@ofborg ofborg bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Jul 20, 2024
@AndersonTorres
Copy link
Member

This is wild. What is the raison d'étre of this?

@jian-lin
Copy link
Contributor Author

jian-lin commented Jul 20, 2024

This is wild. What is the raison d'étre of this?

Like other languages, reducing compilation errors and warnings is a way to improve code quality.

In addition, currently, nix build succeeds even if native compilation for some files fails, which is confusing to say the least. See #328400 (review)

@jian-lin jian-lin force-pushed the pr/emacs-build-error-control branch 2 times, most recently from c831a00 to 194a14f Compare July 20, 2024 05:23
@jian-lin jian-lin marked this pull request as draft July 20, 2024 14:41
@jian-lin jian-lin changed the base branch from staging to staging-next July 20, 2024 14:41
jian-lin added 2 commits July 20, 2024 22:43
This patch introduces two parameters, turnCompilationWarningToError
and ignoreCompilationError, to control errors in genericBuild, which
makes "nix build" be able to fail at elisp native compilation errors
or warnings.  This feature can be used in CI to improve code quality.

Note that this patch keeps the old behavior by default.  Hopefully one
day we can flip the default value of ignoreCompilationError to false
when enough packages are fixed.

Also note that these two parameters can be changed per package using
the overrideAttrs interface.
@jian-lin jian-lin force-pushed the pr/emacs-build-error-control branch from 194a14f to 45f2e58 Compare July 20, 2024 14:44
@jian-lin jian-lin marked this pull request as ready for review July 20, 2024 14:45
@jian-lin jian-lin requested a review from AndersonTorres July 20, 2024 14:45
@jian-lin
Copy link
Contributor Author

Tested it by building all 6213 elisp packages pkgs.emacs.pkgs and found no issue.

@jian-lin
Copy link
Contributor Author

This PR is in good shape. Unfortunately, we just missed the last staging-next #328673. Could this PR be merged into staging-next? @vcunat

@vcunat vcunat merged commit 94db461 into NixOS:staging-next Jul 21, 2024
@jian-lin jian-lin deleted the pr/emacs-build-error-control branch July 21, 2024 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: emacs Text editor 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants