Unverified Commit ae36f39b authored by Emily's avatar Emily Committed by GitHub
Browse files

corretto{11,17,21}: {11.0.23.9.1,17.0.11.9.1,21.0.3.9.1} -> {11.0.24.… (#342262)

parents 32eefa3d a0bec3f7
Loading
Loading
Loading
Loading
+18 −11
Original line number Diff line number Diff line
{ fetchFromGitHub
, gradle_7
, jdk11
, lib
, stdenv
, rsync
, runCommand
, testers
{
  fetchFromGitHub,
  gradle_7,
  jdk11,
  lib,
  stdenv,
  rsync,
  runCommand,
  testers,
}:

let
  corretto = import ./mk-corretto.nix rec {
    inherit lib stdenv rsync runCommand testers;
    inherit
      lib
      stdenv
      rsync
      runCommand
      testers
      ;
    jdk = jdk11;
    gradle = gradle_7;
    extraConfig = [
@@ -19,12 +26,12 @@ let
      # Corretto, too.
      "--disable-warnings-as-errors"
    ];
    version = "11.0.23.9.1";
    version = "11.0.24.8.1";
    src = fetchFromGitHub {
      owner = "corretto";
      repo = "corretto-11";
      rev = version;
      sha256 = "sha256-qSx0kgXTgvsvBaEqgy7Jrp/c1Imoi5/IOqEWoLenJYI=";
      sha256 = "sha256-MD/ipEulQCEgfqqa0QQrD6x6GQwirQfb8OT2UBDLYEE=";
    };
  };
in
+28 −19
Original line number Diff line number Diff line
{ fetchFromGitHub
, fetchurl
, gradle_7
, jdk17
, lib
, stdenv
, rsync
, runCommand
, testers
{
  fetchFromGitHub,
  fetchurl,
  gradle_7,
  jdk17,
  lib,
  stdenv,
  rsync,
  runCommand,
  testers,
}:

let
  corretto = import ./mk-corretto.nix rec {
    inherit lib stdenv rsync runCommand testers;
    inherit
      lib
      stdenv
      rsync
      runCommand
      testers
      ;
    jdk = jdk17;
    gradle = gradle_7;
    version = "17.0.11.9.1";
    version = "17.0.12.7.1";
    src = fetchFromGitHub {
      owner = "corretto";
      repo = "corretto-17";
      rev = version;
      sha256 = "sha256-LxZSFILFfyh8oBiYEnuBQ0Og2i713qdK2jIiCBnrlj0=";
      sha256 = "sha256-aRn1hqaqNsBkp2jHHkwMKc8cNiBM+TYVm3tVMPJJ1YE=";
    };
  };
in
corretto.overrideAttrs (final: prev: {
  # HACK: Removes the FixNullPtrCast patch, as it fails to apply. Need to figure out what causes it to fail to apply.
  patches = lib.remove
    (fetchurl {
corretto.overrideAttrs (
  final: prev: {
    # Corretto17 has incorporated this patch already so it fails to apply.
    # We thus skip it here.
    # See https://github.com/corretto/corretto-17/pull/158
    patches = lib.remove (fetchurl {
      url = "https://git.alpinelinux.org/aports/plain/community/openjdk17/FixNullPtrCast.patch?id=41e78a067953e0b13d062d632bae6c4f8028d91c";
      sha256 = "sha256-LzmSew51+DyqqGyyMw2fbXeBluCiCYsS1nCjt9hX6zo=";
    })
    (prev.patches or [ ]);
})
    }) (prev.patches or [ ]);
  }
)
+19 −12
Original line number Diff line number Diff line
{ corretto21
, fetchFromGitHub
, gradle_7
, jdk21
, lib
, stdenv
, rsync
, runCommand
, testers
{
  corretto21,
  fetchFromGitHub,
  gradle_7,
  jdk21,
  lib,
  stdenv,
  rsync,
  runCommand,
  testers,
}:

let
  corretto = import ./mk-corretto.nix rec {
    inherit lib stdenv rsync runCommand testers;
    inherit
      lib
      stdenv
      rsync
      runCommand
      testers
      ;
    jdk = jdk21;
    gradle = gradle_7;
    version = "21.0.3.9.1";
    version = "21.0.4.7.1";
    src = fetchFromGitHub {
      owner = "corretto";
      repo = "corretto-21";
      rev = version;
      sha256 = "sha256-V8UDyukDCQVTWUg4IpSKoY0qnnQ5fePbm3rxcw06Vr0=";
      sha256 = "sha256-EQqktd2Uz9PhkCaqvbuzmONcSiRppQ40tpLB3mqu2wo=";
    };
  };
in
+105 −90
Original line number Diff line number Diff line
{ jdk
, version
, src
, lib
, stdenv
, gradle
, extraConfig ? [ ]
, rsync
, runCommand
, testers
{
  jdk,
  version,
  src,
  lib,
  stdenv,
  gradle,
  extraConfig ? [ ],
  rsync,
  runCommand,
  testers,
}:

# Each Corretto version is based on a corresponding OpenJDK version. So
@@ -19,21 +20,28 @@

let
  pname = "corretto";
in
# The version scheme is different between OpenJDK & Corretto.
# See https://github.com/corretto/corretto-17/blob/release-17.0.8.8.1/build.gradle#L40
# "major.minor.security.build.revision"
in
jdk.overrideAttrs (finalAttrs: oldAttrs: {
jdk.overrideAttrs (
  finalAttrs: oldAttrs: {
    inherit pname version src;
    name = "${pname}-${version}";

  nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ jdk gradle rsync ];
    nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [
      jdk
      gradle
      rsync
    ];

    dontConfigure = true;

  postPatch = let
    postPatch =
      let
        extra_config = builtins.concatStringsSep " " extraConfig;
  in ''
      in
      ''
        # The rpm/deb task definitions require a Gradle plugin which we don't
        # have and so the build fails. We'll simply remove them here because
        # they are not needed anyways.
@@ -55,9 +63,11 @@ jdk.overrideAttrs (finalAttrs: oldAttrs: {
    gradleBuildTask =
      if stdenv.hostPlatform.isDarwin then
        ":installers:mac:tar:build"
    else ":installers:linux:universal:tar:packageBuildResults";
      else
        ":installers:linux:universal:tar:packageBuildResults";

  postBuild = ''
    postBuild =
      ''
        # Prepare for the installPhase so that it looks like if a normal
        # OpenJDK had been built.
        dir=build/jdkImageName/images
@@ -65,9 +75,12 @@ jdk.overrideAttrs (finalAttrs: oldAttrs: {
        file=$(find ./installers -name 'amazon-corretto-${version}*.tar.gz')
        tar -xzf $file -C $dir
        mv $dir/amazon-corretto-* $dir/jdk
  '' + oldAttrs.postBuild or "";
      ''
      + oldAttrs.postBuild or "";

  installPhase = oldAttrs.installPhase + ''
    installPhase =
      oldAttrs.installPhase
      + ''
        # The installPhase will place everything in $out/lib/openjdk and
        # reference through symlinks. We don't rewrite the installPhase but at
        # least move the folder to convey that this is not OpenJDK anymore.
@@ -79,11 +92,10 @@ jdk.overrideAttrs (finalAttrs: oldAttrs: {
      let
        pkg = finalAttrs.finalPackage;
      in
    oldAttrs.passthru // {
      oldAttrs.passthru
      // {
        tests = {
        version = testers.testVersion {
          package = pkg;
        };
          version = testers.testVersion { package = pkg; };
          vendor = runCommand "${pname}-vendor" { nativeBuildInputs = [ pkg ]; } ''
            output=$(${pkg.meta.mainProgram} -XshowSettings:properties -version 2>&1 | grep vendor)
            grep -Fq "java.vendor = Amazon.com Inc." - <<< "$output" && touch $out
@@ -102,14 +114,17 @@ jdk.overrideAttrs (finalAttrs: oldAttrs: {
        };
      };


    # Some of the OpenJDK derivation set their `pos` by hand. We need to
    # overwrite this in order to point to Corretto, not OpenJDK.
    pos = __curPos;
  meta = with lib; oldAttrs.meta // {
    meta =
      with lib;
      oldAttrs.meta
      // {
        homepage = "https://aws.amazon.com/corretto";
        license = licenses.gpl2Only;
        description = "Amazon's distribution of OpenJDK";
        maintainers = with maintainers; [ rollf ];
      };
})
  }
)