Unverified Commit 324f3f75 authored by Masum Reza's avatar Masum Reza Committed by GitHub
Browse files

Merge pull request #316823 from numinit/armagetronad-fix-install-check

armagetronad: update 0.4; fix possible problem in installCheckPhase
parents 3dcfab7d d968402c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ let

    { imports = [ ./common/user-account.nix ./common/x11.nix ];
      hardware.graphics.enable = true;
      virtualisation.memorySize = 256;
      virtualisation.memorySize = 384;
      environment = {
        systemPackages = [ pkgs.armagetronad ];
        variables.XAUTHORITY = "/home/${user}/.Xauthority";
@@ -208,7 +208,7 @@ makeTest {
        barrier.wait()

      # Get to the Server Bookmarks screen on both clients. This takes a while so do it asynchronously.
      barrier = threading.Barrier(3, timeout=120)
      barrier = threading.Barrier(len(clients) + 1, timeout=240)
      for client in clients:
        threading.Thread(target=client_setup, args=(client, servers, barrier)).start()
      barrier.wait()
+19 −12
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@
, libxml2
, protobuf
, xvfb-run
, gnugrep
, nixosTests
, dedicatedServer ? false
}:

@@ -54,22 +56,21 @@ let
    # https://gitlab.com/armagetronad/armagetronad/-/commits/trunk/?ref_type=heads
    ${unstableVersionMajor} =
      let
        rev = "e7f41fd26363e7c6a72f0c673470ed06ab54ae08";
        hash = "sha256-Uxxk6L7WPxKYQ4CNxWwEtvbZjK8BqYNTuwwdleZ44Ro=";
        rev = "391a74625c1222dd180f069f1b61c3e069a3ba8c";
        hash = "sha256-fUY0dBj85k0QhnAoDzyBmmKmRh9oCYC6r6X4ukt7/L0=";
      in dedicatedServer: {
        version = "${unstableVersionMajor}-${builtins.substring 0 8 rev}";
        src = fetchArmagetron rev hash;
        extraBuildInputs = [ protobuf boost ]
          ++ lib.optionals (!dedicatedServer) [ glew ftgl freetype SDL2 SDL2_image SDL2_mixer ];
        extraNativeBuildInputs = [ bison ];
        extraNativeInstallCheckInputs = lib.optionals (!dedicatedServer) [ xvfb-run ];
      };

    # https://gitlab.com/armagetronad/armagetronad/-/commits/hack-0.2.8-sty+ct+ap/?ref_type=heads
    "${latestVersionMajor}-sty+ct+ap" =
      let
        rev = "a5bffe9dda2b43d330433f76f14eb374701f326a";
        hash = "sha256-cNABxfg3MSmbxU/R78QyPOMwXGqJEamaFOPNw5yhDGE=";
        rev = "5a17cc9fb6e1e27a358711afbd745ae54d4a8c60";
        hash = "sha256-111C1j/hSaASGcvYy3//TyHs4Z+3fuiOvCmtcWLdFd4=";
      in dedicatedServer: {
        version = "${latestVersionMajor}-sty+ct+ap-${builtins.substring 0 8 rev}";
        src = fetchArmagetron rev hash;
@@ -130,13 +131,15 @@ let
      ] ++ lib.optional dedicatedServer "--enable-dedicated"
        ++ lib.optional (!dedicatedServer) "--enable-music";

      buildInputs = [ libxml2 ]
      buildInputs = lib.singleton (libxml2.override { enableHttp = true; })
        ++ (resolvedParams.extraBuildInputs or []);

      nativeBuildInputs = [ autoconf automake gnum4 pkg-config which python3 ]
        ++ (resolvedParams.extraNativeBuildInputs or []);

      nativeInstallCheckInputs = resolvedParams.extraNativeInstallCheckInputs or [];
      nativeInstallCheckInputs = [ gnugrep ]
        ++ lib.optional (!dedicatedServer) xvfb-run
        ++ (resolvedParams.extraNativeInstallCheckInputs or []);

      postInstall = lib.optionalString (!dedicatedServer) ''
        mkdir -p $out/share/{applications,icons/hicolor}
@@ -154,18 +157,21 @@ let
        else
          run="$bin"
        fi
        echo "Checking game info:" >&2
        version="$($run --version || true)"
        echo "  - Version: $version" >&2
        prefix="$($run --prefix || true)"
        rubber="$($run --doc | grep -m1 CYCLE_RUBBER)"

        echo "Version: $version" >&2
        echo "Prefix: $prefix" >&2
        echo "Docstring: $rubber" >&2
        echo "  - Prefix: $prefix" >&2
        rubber="$(($run --doc || true) | grep -m1 CYCLE_RUBBER)"
        echo "  - Docstring: $rubber" >&2

        if [[ "$version" != *"${resolvedParams.version}"* ]] || \
           [ "$prefix" != "$out" ] || \
           [[ ! "$rubber" =~ ^CYCLE_RUBBER[[:space:]]+Niceness[[:space:]]factor ]]; then
          echo "Something didn't match. :-(" >&2
          exit 1
        else
          echo "Everything is ok." >&2
        fi
      '';

@@ -186,6 +192,7 @@ let
          {
            # Allow both a "dedicated" passthru and a passthru for all the options other than the latest version, which this is.
            dedicated = mkArmagetron fn true;
            tests.armagetronad = nixosTests.armagetronad;
          };

      meta = with lib; {