Merge pull request #120993 from regnat/easy-ca

Make the bootsrap respect the contentAddressedByDefault setting
This commit is contained in:
John Ericson 2021-04-28 11:27:59 -04:00 committed by GitHub
commit 50a11f4f43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 45 additions and 14 deletions

View file

@ -40,7 +40,7 @@ in rec {
stripAllFlags=" " # the Darwin "strip" command doesn't know "-s"
'';
bootstrapTools = derivation {
bootstrapTools = derivation ({
inherit system;
name = "bootstrap-tools";
@ -50,7 +50,11 @@ in rec {
inherit (bootstrapFiles) mkdir bzip2 cpio tarball;
__impureHostDeps = commonImpureHostDeps;
};
} // lib.optionalAttrs (config.contentAddressedByDefault or false) {
__contentAddressed = true;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
});
stageFun = step: last: {shell ? "${bootstrapTools}/bin/bash",
overrides ? (self: super: {}),

View file

@ -170,7 +170,7 @@ in
({}: {
__raw = true;
bootstrapTools = derivation {
bootstrapTools = derivation ({
inherit system;
inherit make bash coreutils findutils
diffutils grep patch gawk cpio sed
@ -182,7 +182,11 @@ in
buildInputs = [ make ];
mkdir = "/bin/mkdir";
ln = "/bin/ln";
};
} // lib.optionalAttrs (config.contentAddressedByDefault or false) {
__contentAddressed = true;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
});
})
({ bootstrapTools, ... }: rec {

View file

@ -84,6 +84,11 @@ let
allowedRequisites = allowedRequisites
++ defaultNativeBuildInputs ++ defaultBuildInputs;
}
// lib.optionalAttrs (config.contentAddressedByDefault or false) {
__contentAddressed = true;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
}
// {
inherit name;

View file

@ -1,6 +1,6 @@
{ system, bootstrapFiles }:
{ system, bootstrapFiles, extraAttrs }:
derivation {
derivation ({
name = "bootstrap-tools";
builder = bootstrapFiles.busybox;
@ -15,4 +15,4 @@ derivation {
langC = true;
langCC = true;
isGNU = true;
}
} // extraAttrs)

View file

@ -1,6 +1,6 @@
{ system, bootstrapFiles }:
{ system, bootstrapFiles, extraAttrs }:
derivation {
derivation ({
name = "bootstrap-tools";
builder = bootstrapFiles.busybox;
@ -15,4 +15,4 @@ derivation {
langC = true;
langCC = true;
isGNU = true;
}
} // extraAttrs)

View file

@ -61,7 +61,16 @@ let
# Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...).
bootstrapTools = import (if localSystem.libc == "musl" then ./bootstrap-tools-musl else ./bootstrap-tools) { inherit system bootstrapFiles; };
bootstrapTools = import (if localSystem.libc == "musl" then ./bootstrap-tools-musl else ./bootstrap-tools) {
inherit system bootstrapFiles;
extraAttrs = lib.optionalAttrs
(config.contentAddressedByDefault or false)
{
__contentAddressed = true;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
};
};
getLibc = stage: stage.${localSystem.libc};

View file

@ -224,15 +224,24 @@ in with pkgs; rec {
bootstrapTools = runCommand "bootstrap-tools.tar.xz" {} "cp ${build}/on-server/bootstrap-tools.tar.xz $out";
};
bootstrapTools = if (stdenv.hostPlatform.libc == "glibc") then
bootstrapTools =
let extraAttrs = lib.optionalAttrs
(config.contentAddressedByDefault or false)
{
__contentAddressed = true;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
};
in
if (stdenv.hostPlatform.libc == "glibc") then
import ./bootstrap-tools {
inherit (stdenv.buildPlatform) system; # Used to determine where to build
inherit bootstrapFiles;
inherit bootstrapFiles extraAttrs;
}
else if (stdenv.hostPlatform.libc == "musl") then
import ./bootstrap-tools-musl {
inherit (stdenv.buildPlatform) system; # Used to determine where to build
inherit bootstrapFiles;
inherit bootstrapFiles extraAttrs;
}
else throw "unsupported libc";