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 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 bjornfor requested review from edolstra, Infinisil and nbp as code owners Apr 29, 2020
@bjornfor
Copy link
Contributor Author

bjornfor commented Apr 29, 2020

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

bjornfor commented Apr 29, 2020

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
Member

worldofpeace commented Apr 29, 2020

@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

Infinisil commented May 5, 2020

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

bjornfor commented May 11, 2020

Merging in 24 hours.

@bjornfor bjornfor merged commit d2a2ec2 into NixOS:release-20.03 May 12, 2020
13 checks passed
13 checks passed
Evaluation Performance Report Evaluator Performance Report
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="7f52277"; rev="7f522775be261c9e06563e9d8f34f472ab38b888"; } ./pkgs/t
Details
grahamcofborg-eval-lib-tests nix-build --arg pkgs import ./. {} ./lib/tests/release.nix
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="7f52277"; rev="7f522775be261c9e06563e9d8f34f472ab38b888"; } ./nixos/
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="7f52277"; rev="7f522775be261c9e06563e9d8f34f472ab38b888"; } ./nixos/
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="7f52277"; rev="7f522775be261c9e06563e9d8f34f472ab38b888"; } ./nixos/
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="7f52277"; rev="7f522775be261c9e06563e9d8f34f472ab38b888"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="7f52277"; rev="7f522775be261c9e06563e9d8f34f472ab38b888"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="7f52277"; rev="7f522775be261c9e06563e9d8f34f472ab38b888"; } ./pkgs/t
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
@bjornfor bjornfor deleted the bjornfor:fix-lib-version-from-git branch May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.