llvmPackages: Dedupe monorepoSrc

This commit is contained in:
Artturin 2023-11-21 01:28:25 +02:00
parent 5ac86a99e7
commit e6751897e0
4 changed files with 24 additions and 47 deletions

View file

@ -54,24 +54,10 @@ in
let let
monorepoSrc' = monorepoSrc; monorepoSrc' = monorepoSrc;
in let in let
monorepoSrc = if monorepoSrc' != null then
monorepoSrc'
else let
sha256 = releaseInfo.original.sha256;
rev = if gitRelease != null then
gitRelease.rev
else
"llvmorg-${releaseInfo.version}";
in fetchFromGitHub {
owner = "llvm";
repo = "llvm-project";
inherit rev sha256;
};
# Import releaseInfo separately to avoid infinite recursion # Import releaseInfo separately to avoid infinite recursion
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo; inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version; inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib release_version gitRelease officialRelease; }) llvm_meta; inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
tools = lib.makeExtensible (tools: let tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc buildLlvmTools; }); callPackage = newScope (tools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc buildLlvmTools; });

View file

@ -54,24 +54,10 @@ in
let let
monorepoSrc' = monorepoSrc; monorepoSrc' = monorepoSrc;
in let in let
monorepoSrc = if monorepoSrc' != null then
monorepoSrc'
else let
sha256 = releaseInfo.original.sha256;
rev = if gitRelease != null then
gitRelease.rev
else
"llvmorg-${releaseInfo.version}";
in fetchFromGitHub {
owner = "llvm";
repo = "llvm-project";
inherit rev sha256;
};
# Import releaseInfo separately to avoid infinite recursion # Import releaseInfo separately to avoid infinite recursion
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo; inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version; inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib release_version gitRelease officialRelease; }) llvm_meta; inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
tools = lib.makeExtensible (tools: let tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc buildLlvmTools; }); callPackage = newScope (tools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc buildLlvmTools; });

View file

@ -1,10 +1,12 @@
{ lib { lib
, fetchFromGitHub ? null
, release_version ? null , release_version ? null
, gitRelease ? null , gitRelease ? null
, officialRelease ? null , officialRelease ? null
, monorepoSrc' ? null
}: }:
{ rec {
llvm_meta = { llvm_meta = {
license = lib.licenses.ncsa; license = lib.licenses.ncsa;
maintainers = lib.teams.llvm.members; maintainers = lib.teams.llvm.members;
@ -37,4 +39,22 @@
release_version; release_version;
}; };
monorepoSrc =
if monorepoSrc' != null then
monorepoSrc'
else
let
sha256 = releaseInfo.original.sha256;
rev =
if gitRelease != null then
gitRelease.rev
else
"llvmorg-${releaseInfo.version}";
in
fetchFromGitHub {
owner = "llvm";
repo = "llvm-project";
inherit rev sha256;
};
} }

View file

@ -53,25 +53,10 @@ in
let let
monorepoSrc' = monorepoSrc; monorepoSrc' = monorepoSrc;
in let in let
monorepoSrc = if monorepoSrc' != null then
monorepoSrc'
else let
sha256 = releaseInfo.original.sha256;
rev = if gitRelease != null then
gitRelease.rev
else
"llvmorg-${releaseInfo.version}";
in fetchFromGitHub {
owner = "llvm";
repo = "llvm-project";
inherit rev sha256;
};
# Import releaseInfo separately to avoid infinite recursion # Import releaseInfo separately to avoid infinite recursion
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo; inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version; inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib release_version gitRelease officialRelease; }) llvm_meta; inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
tools = lib.makeExtensible (tools: let tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc buildLlvmTools; }); callPackage = newScope (tools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc buildLlvmTools; });