Skip to content

treewide: handle *Phases variables __structuredAttrs-agnostically#339117

Merged
philiptaron merged 6 commits intoNixOS:stagingfrom
ShamrockLee:structured-attrs-phases
Sep 7, 2024
Merged

treewide: handle *Phases variables __structuredAttrs-agnostically#339117
philiptaron merged 6 commits intoNixOS:stagingfrom
ShamrockLee:structured-attrs-phases

Conversation

@ShamrockLee
Copy link
Contributor

Description of changes

Always specify the preDistPhases attribute as a list instead of a string.

Append elements to the preDistPhases Bash variable using appendToVar instead of string or Bash array concatenation.

Handle element insertion before a specific element using string substitution as before, but handle both structured and unstructured attributes.

State explicitly in the Nixpkgs Manual, "*Phases attributes are lists" and "elements of *Phases variables contain no spaces."

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.

Always specify the prePhases attribute as a list instead of a string.

Append elements to the prePhases Bash variable using appendToVar
instead of string or Bash array concatenation.
Always specify the preConfigurePhases attribute as a list instead of a
string.

Append elements to the preConfigurePhases Bash variable using
appendToVar instead of string or Bash array concatenation.
Always specify the preInstallPhases attribute as a list instead of a
string.

Append elements to the preInstallPhases Bash variable using appendToVar
instead of string or Bash array concatenation.
Always specify the preDistPhases attribute as a list instead of a string.

Append elements to the preDistPhases Bash variable using appendToVar
instead of string or Bash array concatenation.

Handle element insertion before a specific element using string
substitution as before, but handle both structured and unstructured
attributes.
Always specify the postPhases attribute as a list instead of a string.

Append elements to the postPhases Bash variable using appendToVar
instead of string or Bash array concatenation.
Require the elements of *Phases not to contain spaces.

Require the *Phases attribute to be specified as Nix Language lists.
@github-actions github-actions bot added 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: qt/kde Object-oriented framework for GUI creation 8.has: documentation This PR adds or changes documentation 6.topic: vim Advanced text editor 6.topic: xfce The Xfce Desktop Environment 6.topic: dotnet Language: .NET labels Sep 2, 2024
@ofborg ofborg bot added 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. 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 Sep 3, 2024
@ShamrockLee ShamrockLee marked this pull request as ready for review September 6, 2024 18:02
Copy link
Contributor

@corngood corngood left a comment

Choose a reason for hiding this comment

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

+1 for dotnet stuff. I promise to keep an eye out for this in the future. :)

@ShamrockLee
Copy link
Contributor Author

Test buildVimPlugin:
@ofborg build spacevim

Test autoreconfHook:
@ofborg build voms
@ofborg build dasher

Test gimpPlugins:
@ofborg build gimpPlugins

I'm unsure how to test the pkgs/build-support/coq/default.nix changes. Ping @CohenCyril

I'm unsure how to test the makeDarwinBundle changes. Ping @hexagonal-sun

I'm unsure how to test releaseTools. Ping @edolstra

Test hareHook:
@ofborg build bonsai
@ofborg build haredo

I'm unsure how to test the setup hook of gnustep-make. Ping @ashalkhakov @matthewbauer @2xsaiko

Test xfce4.setupHook
@ofborg build xfce.xfce4-i3-workspaces-plugin

Test dotnet-sdk-setup-hook.sh:
@ofborg build nbxplorer

Test writeRequiredOctavePackagesHooks:
@ofborg build octavePackages.audio

Test pytestCheckHook:
@ofborg build python3Packages.six

Test pytest-forked's setup hook:
@ofborg build python3Packages.httplib2

Test pytest-xdist's setup hook:
@ofborg build python3Packages.quodlibet

Test pytest_7's setup hook:
@ofborg build python3Packages.graphviz

Test the setup hook of pytest for Python 2 (PyPy is still supporting Python2, and will continue to support it):
@ofborg build pypy2Packages.six

Test glib's setup hook.
@ofborg build image-roll

Test liquidfun:
@ofborg build liquidfun

I'm unsure how to test the changes in qtbase-setup-hook.sh qmake-hook.sh for Qt 5 and 6. Ping @ttuegel

I'm unsure how to test the changes in pkgs/servers/home-assistant/build-custom-component/manifest-requirements-check-hook.sh. Ping @graham33

@emilazy
Copy link
Member

emilazy commented Sep 6, 2024

Test the setup hook of pytest for Python 2 (PyPy is still supporting Python2, and will continue to support it): @ofborg build pypy2Packages.six

(FWIW although PyPy2 will of course continue to be packaged, I’m quite sure python2-modules will go away as soon as the new GIMP comes out and I figure out how to get resholve onto the C++ OSH. resholve would be a more relevant test here.)

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label Sep 6, 2024
Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

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

One two things in here look scary at all to me.

I did a "quick" staging build on those two and everything came up roses. 🌹🌹🦌🌹🌹

Result of nixpkgs-review pr 339117 -p python3Packages.pytest-forked -p python3Packages.pytest-xdist run on x86_64-linux 1

4 packages built:
  • python3Packages.pytest-forked
  • python3Packages.pytest-forked.dist (python3Packages.pytest-forked.dist.dist)
  • python3Packages.pytest-xdist
  • python3Packages.pytest-xdist.dist (python3Packages.pytest-xdist.dist.dist)

@philiptaron
Copy link
Contributor

I intend to merge this within the next day.

@ShamrockLee
Copy link
Contributor Author

One two things in here look scary at all to me.

I did a "quick" staging build on those two and everything came up roses. 🌹🌹🦌🌹🌹

Result of nixpkgs-review pr 339117 -p python3Packages.pytest-forked -p python3Packages.pytest-xdist run on x86_64-linux 1

4 packages built:
  • python3Packages.pytest-forked
  • python3Packages.pytest-forked.dist (python3Packages.pytest-forked.dist.dist)
  • python3Packages.pytest-xdist
  • python3Packages.pytest-xdist.dist (python3Packages.pytest-xdist.dist.dist)

It would be great if they could be handled more gracefully (e.g. without string substitutions or if-blocks). Still, I wonder if it worths it to craft a generic global Bash helper function (like appendToVar) for such a specific use case.

@philiptaron
Copy link
Contributor

It would be great if they could be handled more gracefully (e.g. without string substitutions or if-blocks). Still, I wonder if it worth it to craft a generic global Bash helper function (like appendToVar) for such a specific use case.

Yeah, I see no need to do so at the present juncture; it's likely that these two derivations could get golfed into something neater, in fact I'm certain of it, but no need to make the perfect be the enemy of this quite good PR.

@wegank wegank added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Sep 7, 2024
@philiptaron philiptaron merged commit 4160ccc into NixOS:staging Sep 7, 2024
@ShamrockLee ShamrockLee deleted the structured-attrs-phases branch October 31, 2024 17:37
@Artturin
Copy link
Member

This might have caused #351010 "${mingw-patch}/*.patch" to break

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Oct 31, 2024

This might have caused #351010 "${mingw-patch}/*.patch" to break

This PR changed the semantics of the __structuredAttrs = false packages only when changing from fooPhases+=(myPhase) to appendToVar fooPhases myPhase.

The breakage of patches = [ "${mingw-patch}/*patch" ] seems like an issue of the globbing handling of patches, but the diff of this PR hasn't touched the code processing patches.

Does patches = [ "${mingw-patch}/*patch" ] work before the merging commit of this PR but break afterward?

@greg-hellings
Copy link
Contributor

This might have caused #351010 "${mingw-patch}/*.patch" to break

This PR changed the semantics of the __structuredAttrs = false packages only when changing from fooPhases+=(myPhase) to appendToVar fooPhases myPhase.

The breakage of patches = [ "${mingw-patch}/*patch" ] seems like an issue of the globbing handling of patches, but the diff of this PR hasn't touched the code processing patches.

Does patches = [ "${mingw-patch}/*patch" ] work before the merging commit of this PR but break afterward?

Doing a bisect on the problematic branches, it appears that the breakage appeared here which doesn't seem to be part of this branch.

@emilazy
Copy link
Member

emilazy commented Nov 4, 2024

cc @wolfgangwalther

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

Labels

6.topic: dotnet Language: .NET 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: qt/kde Object-oriented framework for GUI creation 6.topic: vim Advanced text editor 6.topic: xfce The Xfce Desktop Environment 8.has: documentation This PR adds or changes documentation 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-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 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. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. 12.approvals: 2 This PR was reviewed and approved by two persons.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants