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

lib.version: change pre-git to post-git on the release branch #86313

Merged
merged 1 commit into from May 12, 2020

Conversation

bjornfor
Copy link
Contributor

@bjornfor bjornfor commented Apr 29, 2020

Motivation for this change

When there is no .version-suffix file in nixpkgs (like when fetching
nixpkgs with builtins.fetchGit), lib.version suffixes the version string
with "pre-git". The "pre" bit is special cased in
builtins.compareVersions which means "20.03pre-git" is interpreted as
"less than 20.03". This is clearly wrong for the release-20.03 branch
after the release has been made.

Change the suffix to "post-git" to make code like this behave the same
whether nixpkgs is fetched from git or the channel (which has
.version-suffix file):

lib.versionOlder lib.version "20.03"
lib.versionAtLeast lib.version "20.03"

(Currently the result depend on how nixpkgs was obtained!)

This change should be made part of the release process.

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.

CC @worldofpeace @disassembler (release managers for NixOS 20.03)

When there is no .version-suffix file in nixpkgs (like when fetching
nixpkgs with builtins.fetchGit), lib.version suffixes the version string
with "pre-git". The "pre" bit is special cased in
builtins.compareVersions which means "20.03pre-git" is interpreted as
"less than 20.03". This is clearly wrong for the release-20.03 branch
*after* the release has been made.

Change the suffix to "post-git" to make code like this behave the same
whether nixpkgs is fetched from git or the channel (which has
.version-suffix file):

  lib.versionOlder lib.version "20.03"
  lib.versionAtLeast lib.version "20.03"

(Currently the result depend on how nixpkgs was obtained!)

This change should be made part of the release process.
@bjornfor
Copy link
Contributor Author

Hm, I see now https://nixos.org/nixpkgs/manual/ has the version string "20.03pre-git". Didn't it use to get built with proper version info?

@bjornfor
Copy link
Contributor Author

Is the release process documented somewhere? I think it'd be nice to add "set pre-git to post-git" as a step there.

@worldofpeace
Copy link
Contributor

@samueldr sorry for the ping. It seems even if there's a recording saying you're "the other samuel" there's still room for confusion 😁

@bjornfor
Copy link
Contributor Author

bjornfor commented May 2, 2020

@worldofpeace: Ah, thanks to #86368 I see the document is here.

@infinisil
Copy link
Member

How about having something like lib.release.isReleased, which is true on the release branches, but false on master? Then this can be used to conditionally set pre or post, and also other things if necessary.

@bjornfor
Copy link
Contributor Author

bjornfor commented May 9, 2020

@infinisil Sounds good. Something to add later?

Right now I just want to make my config compatible with NixOS 20.03 and 19.09 and I'm somewhat blocked by this.

@bjornfor
Copy link
Contributor Author

Merging in 24 hours.

@bjornfor bjornfor merged commit d2a2ec2 into NixOS:release-20.03 May 12, 2020
@bjornfor bjornfor deleted the fix-lib-version-from-git branch May 12, 2020 19:46
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