From d2a2ec2ebe49c42127cbf316d215a64c60d68fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Wed, 29 Apr 2020 12:58:19 +0200 Subject: [PATCH] lib.version: change pre-git to post-git on the release branch 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. --- lib/trivial.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/trivial.nix b/lib/trivial.nix index a281cd70fb0e..b09b2f31bf93 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -178,7 +178,7 @@ rec { let suffixFile = ../.version-suffix; in if pathExists suffixFile then lib.strings.fileContents suffixFile - else "pre-git"; + else "post-git"; /* Attempts to return the the current revision of nixpkgs and returns the supplied default value otherwise.