diff --git a/lib/build-status.nix b/lib/build-status.nix new file mode 100644 index 00000000..0c3aa10b --- /dev/null +++ b/lib/build-status.nix @@ -0,0 +1,13 @@ +{lib, ...}: { + getBuildStatus = package: version: system: let + data = lib.importJSON ./../pkgs/${package}/build-status.json; + in + data.${version}.${system} + or { + # If not build status is found, we assume that the package builds + # successfully with no workarounds. + build = true; + check = true; + skippedTests = []; + }; +} diff --git a/lib/mk-gh-actions-matrix.nix b/lib/mk-gh-actions-matrix.nix index 83738f1e..447b2ed2 100644 --- a/lib/mk-gh-actions-matrix.nix +++ b/lib/mk-gh-actions-matrix.nix @@ -12,6 +12,8 @@ # "macos-latest-xlarge" = "aarch64-darwin"; }; + inherit (import ./build-status.nix {inherit lib;}) getBuildStatus; + mkGHActionsMatrix = { include = lib.pipe (builtins.attrNames nixSystemToGHPlatform) [ (builtins.concatMap @@ -23,7 +25,7 @@ p = self.packages.${system}.${package}; in { os = platform; - allowedToFail = builtins.elem system (p.passthru.allowedToFailOn or []); + allowedToFail = !(p.passthru.buildStatus or (throw "${package} does not expose build status")).build; inherit system package; attrPath = "packages.${system}.${lib.strings.escapeNixIdentifier package}"; }) diff --git a/pkgs/dmd/binary.nix b/pkgs/dmd/binary.nix index 11b65c47..897639b0 100644 --- a/pkgs/dmd/binary.nix +++ b/pkgs/dmd/binary.nix @@ -13,6 +13,10 @@ ... }: let inherit (stdenv) hostPlatform; + + inherit (import ../../lib/build-status.nix {inherit lib;}) getBuildStatus; + buildStatus = getBuildStatus "dmd" version stdenv.system; + OS = if hostPlatform.isDarwin then "osx" @@ -26,6 +30,10 @@ in pname = "dmd-binary"; inherit version; + passthru = { + inherit buildStatus; + }; + src = fetchurl rec { name = "dmd.${version}.${OS}.tar.xz"; url = "http://downloads.dlang.org/releases/2.x/${version}/${name}"; diff --git a/pkgs/dmd/build-status.json b/pkgs/dmd/build-status.json new file mode 100644 index 00000000..032c26a7 --- /dev/null +++ b/pkgs/dmd/build-status.json @@ -0,0 +1,22 @@ +{ + "2.098.1": { + "x86_64-darwin": { + "build": true, + "check": true, + "skippedTests": [ + "dmd/test/runnable/test17868.d", + "dmd/test/runnable/test17868b.d" + ] + } + }, + "2.102.2": { + "x86_64-darwin": { + "build": true, + "check": true, + "skippedTests": [ + "dmd/compiler/test/runnable/objc_class.d", + "dmd/compiler/test/runnable/objc_self_test.d" + ] + } + } +} diff --git a/pkgs/dmd/generic.nix b/pkgs/dmd/generic.nix index 35f2fb6d..d8f1dcb6 100644 --- a/pkgs/dmd/generic.nix +++ b/pkgs/dmd/generic.nix @@ -5,7 +5,6 @@ druntimeSha256 ? "", phobosSha256, toolsSha256, - doCheck ? true, enableAsserts ? false, enableCoverage ? false, enableDebug ? false, @@ -35,6 +34,10 @@ unzip, HOST_DMD ? "${callPackage ./bootstrap.nix {}}/bin/dmd", }: let + inherit (import ../../lib/build-status.nix {inherit lib;}) getBuildStatus; + + buildStatus = getBuildStatus "dmd" version stdenv.system; + pathConfig = runCommand "phobos-tzdata-curl-paths" {} '' mkdir $out echo '${tzdata}/share/zoneinfo/' > $out/TZDatabaseDirFile @@ -110,6 +113,10 @@ in pname = "dmd"; inherit version; + passthru = { + inherit buildStatus; + }; + enableParallelBuilding = true; srcs = @@ -264,19 +271,21 @@ in runHook postBuild ''; - inherit doCheck; + doCheck = buildStatus.check; checkInputs = lib.optional stdenv.isDarwin Foundation; checkFlags = commonBuildFlags ++ ["N=$(checkJobs)"]; # many tests are disbled because they are failing - # NOTE: Purity check is disabled for checkPhase because it doesn't fare well # with the DMD linker. See https://github.com/NixOS/nixpkgs/issues/97420 checkPhase = '' runHook preCheck - + ${ + lib.optionalString (buildStatus.skippedTests != []) + (lib.concatMapStringsSep "\n" (test: ''rm -v ${test}'') buildStatus.skippedTests) + } export checkJobs=$NIX_BUILD_CORES if [ -z $enableParallelChecking ]; then checkJobs=1 diff --git a/pkgs/dub/build-status.json b/pkgs/dub/build-status.json new file mode 100644 index 00000000..0db3279e --- /dev/null +++ b/pkgs/dub/build-status.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/pkgs/dub/default.nix b/pkgs/dub/default.nix index 8a1cc178..d22fb44e 100644 --- a/pkgs/dub/default.nix +++ b/pkgs/dub/default.nix @@ -9,6 +9,11 @@ dcompiler ? ldc, }: assert dcompiler != null; let + inherit (import ../../lib/build-status.nix {inherit lib;}) getBuildStatus; + buildStatus = getBuildStatus "dub" version stdenv.system; + + version = "1.30.0"; + xdmdName = if lib.hasPrefix "ldc" dcompiler.pname then "ldmd2" @@ -18,7 +23,11 @@ assert dcompiler != null; let in stdenv.mkDerivation rec { pname = "dub"; - version = "1.30.0"; + inherit version; + + passthru = { + inherit buildStatus; + }; enableParallelBuilding = true; @@ -58,7 +67,7 @@ in ./build ''; - doCheck = !stdenv.isDarwin; + doCheck = buildStatus.check; checkPhase = '' export DUB=$NIX_BUILD_TOP/source/bin/dub diff --git a/pkgs/ldc/binary.nix b/pkgs/ldc/binary.nix index 0f9b3d92..b8f98197 100644 --- a/pkgs/ldc/binary.nix +++ b/pkgs/ldc/binary.nix @@ -12,6 +12,9 @@ }: let inherit (stdenv) hostPlatform system; + inherit (import ../../lib/build-status.nix {inherit lib;}) getBuildStatus; + buildStatus = getBuildStatus "ldc" version stdenv.system; + systemToArchivePlatform = { # FIXME: How should Android be supported? # (It is not a separate Nixpkgs platform.) @@ -37,6 +40,10 @@ in pname = "ldc-binary"; inherit version; + passthru = { + inherit buildStatus; + }; + src = fetchurl rec { name = "ldc2-${version}-${archivePlatform}.${tarballSuffix}"; url = "https://github.com/ldc-developers/ldc/releases/download/v${version}/${name}"; diff --git a/pkgs/ldc/build-status.json b/pkgs/ldc/build-status.json new file mode 100644 index 00000000..2a9ef795 --- /dev/null +++ b/pkgs/ldc/build-status.json @@ -0,0 +1,14 @@ +{ + "1.30.0": { + "x86_64-linux": { + "build": true, + "check": false, + "skippedTests": [] + }, + "x86_64-darwin": { + "build": true, + "check": false, + "skippedTests": [] + } + } +} diff --git a/pkgs/ldc/generic.nix b/pkgs/ldc/generic.nix index 9cde5c2f..dfd8f1ae 100644 --- a/pkgs/ldc/generic.nix +++ b/pkgs/ldc/generic.nix @@ -25,6 +25,9 @@ targetPackages, ldcBootstrap ? callPackage ./bootstrap.nix {}, }: let + inherit (import ../../lib/build-status.nix {inherit lib;}) getBuildStatus; + buildStatus = getBuildStatus "ldc" version stdenv.system; + pathConfig = runCommand "phobos-tzdata-curl-paths" {} '' mkdir $out echo ${tzdata}/share/zoneinfo/ > $out/TZDatabaseDirFile @@ -67,6 +70,10 @@ in pname = "ldc"; inherit version; + passthru = { + inherit buildStatus; + }; + src = fetchurl { url = "https://github.com/ldc-developers/ldc/releases/download/v${version}/ldc-${version}-src.tar.gz"; inherit sha256; @@ -162,25 +169,32 @@ in lib.optionalString stdenv.hostPlatform.isDarwin "|druntime-test-shared"; - checkPhase = '' - # Build default lib test runners - ninja -j$NIX_BUILD_CORES all-test-runners + doCheck = buildStatus.check; - ${fixNames} + checkPhase = + ( + lib.optionalString (buildStatus.skippedTests != []) + (lib.concatMapStringsSep "\n" (test: ''rm -v ${test}'') buildStatus.skippedTests) + ) + + '' + # Build default lib test runners + ninja -j$NIX_BUILD_CORES all-test-runners - # Run dmd testsuite - export DMD_TESTSUITE_MAKE_ARGS="-j$NIX_BUILD_CORES DMD=$DMD" - ctest -V -R "dmd-testsuite" + ${fixNames} - # Build and run LDC D unittests. - ctest --output-on-failure -R "ldc2-unittest" + # Run dmd testsuite + export DMD_TESTSUITE_MAKE_ARGS="-j$NIX_BUILD_CORES DMD=$DMD" + ctest -V -R "dmd-testsuite" - # Run LIT testsuite. - ctest -V -R "lit-tests" + # Build and run LDC D unittests. + ctest --output-on-failure -R "ldc2-unittest" - # Run default lib unittests - ctest -j$NIX_BUILD_CORES --output-on-failure -E "ldc2-unittest|lit-tests|dmd-testsuite${additionalExceptions}" - ''; + # Run LIT testsuite. + ctest -V -R "lit-tests" + + # Run default lib unittests + ctest -j$NIX_BUILD_CORES --output-on-failure -E "ldc2-unittest|lit-tests|dmd-testsuite${additionalExceptions}" + ''; postInstall = '' substitute ${ldcConfFile} "$out/etc/ldc2.conf" --subst-var out @@ -190,10 +204,6 @@ in --set-default CC "${targetPackages.stdenv.cc}/bin/cc" ''; - passthru = { - allowedToFailOn = ["x86_64-darwin" "aarch64-darwin"]; - }; - meta = with lib; { description = "The LLVM-based D compiler"; homepage = "https://github.com/ldc-developers/ldc";