From c0ba1362eb38fdfaedba22a3991dc88601bacd52 Mon Sep 17 00:00:00 2001 From: Tyson Whitehead Date: Tue, 23 Jan 2018 18:50:45 -0500 Subject: [PATCH] Combine ccpkgs and nixpkgs versions together in suffix Want a unique name for the output product of each combination for the channel-update code. --- release.nix | 51 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/release.nix b/release.nix index 4d49dda..fccc855 100644 --- a/release.nix +++ b/release.nix @@ -1,10 +1,10 @@ -{ nixpkgs # Checked out nixpkgs git repe - ? { outPath = ./upstream; - revCount = 56789; - shortRev = "gfedcba"; - } -, ccpkgs # Checked out ccpkgs git repo +{ ccpkgs # Checked out ccpkgs git repo ? { outPath = ./.; + revCount = 1234; + shortRev = "gabcdef"; + } +, nixpkgs # Checked out nixpkgs git repe + ? { outPath = ./upstream; revCount = 56789; shortRev = "gfedcba"; } @@ -15,11 +15,10 @@ # Free up the nixpkgs and ccpkgs name for binding to final product. # let - # nixpkgsGit - git checkout of nixpkgs - # ccpkgsGit - git checkout of ccpkgs + # *Git - git checkout # nixpkgsGit = nixpkgs; - ccpkgsGit = ccpkgs; + ccpkgsGit = ccpkgs; # Tarball hydra release product for the ccpkgs channel. # @@ -34,14 +33,30 @@ in let # pkgs = import ccpkgsGit { upstream = nixpkgsGit; }; - # version - Version number of nixpkgs (and hence ccpkgs too) - # versionSuffix - Version suffix based on git commnit + # version - Version number (e.g., "17.09") + # version*Suffix - Version suffix (e.g., "5678.gfedcba") # # Code lifted from nixos/release.nix. # - version = pkgs.lib.fileContents ./.version; - versionSuffix = - (if stableBranch then "." else "beta") + "${toString (nixpkgsGit.revCount - 114283)}.${nixpkgsGit.shortRev}"; + version = + let + versionNixpkgs = pkgs.lib.fileContents (nixpkgsGit + /.version); + versionCcpkgs = pkgs.lib.fileContents ./.version; + in + assert (versionNixpkgs == versionCcpkgs); versionCcpkgs; + + versionSeparator = if stableBranch then "." else "beta"; + + mkVersion = base: git: rec { + count = toString (git.revCount - base); + commit = git.shortRev; + suffix = "${versionSeparator}${count}.${commit}"; + }; + + nixpkgsVersion = mkVersion 114283 nixpkgsGit; + ccpkgsVersion = mkVersion 0 ccpkgsGit; + + versionSuffix = "${versionSeparator}${ccpkgsVersion.count}.${nixpkgsVersion.count}.${ccpkgsVersion.commit}.${nixpkgsVersion.commit}"; # nixpkgs - The store path containing the unpacked nixpkgs channel. # @@ -50,18 +65,14 @@ in let # nixpkgs = let - # version - Version of checked out nixpkgs - # - version = pkgs.lib.fileContents (nixpkgsGit + /.version); - # channel - Store path containing the channel release tarballs. # # The nixos.channel attribute from nixos/release.nix builds the nixpkgs channel tarballs. # channel = ( import (nixpkgsGit + /nixos/release.nix) { - nixpkgs = nixpkgsGit; inherit stableBranch supportedSystems; + nixpkgs = nixpkgsGit; } ).channel; # nixpkgs - The store path containing the unpacked nixpkgs channel. @@ -72,7 +83,7 @@ in let ( import rec { name = "nixos"; channelName = "${name}-${version}"; - src = channel + /tarballs + "/${name}-${version}${versionSuffix}.tar.xz"; + src = channel + /tarballs + "/${name}-${version}${nixpkgsVersion.suffix}.tar.xz"; binaryCacheURL = https://cache.nixos.org; } ); in