Merge pull request #284626 from numinit/armagetronad-unstable-updates

armagetronad.*: 0.2.9.1.1 -> 0.2.9.2.3

authored by Sandro and committed by GitHub 60f419e0 18ffb7b3

+84 -63
+9 -3
nixos/tests/armagetronad.nix
··· 1 - import ./make-test-python.nix ({ pkgs, ...} : 1 + { system ? builtins.currentSystem, 2 + config ? {}, 3 + pkgs ? import ../.. { inherit system config; } 4 + }: 5 + 6 + with import ../lib/testing-python.nix { inherit system pkgs; }; 2 7 3 8 let 4 9 user = "alice"; ··· 16 21 test-support.displayManager.auto.user = user; 17 22 }; 18 23 19 - in { 24 + in 25 + makeTest { 20 26 name = "armagetronad"; 21 27 meta = with pkgs.lib.maintainers; { 22 28 maintainers = [ numinit ]; ··· 269 275 srv.node.wait_until_fails(f"ss --numeric --udp --listening | grep -q {srv.port}") 270 276 ''; 271 277 272 - }) 278 + }
+75 -60
pkgs/games/armagetronad/default.nix
··· 21 21 , libpng 22 22 , libxml2 23 23 , protobuf 24 + , xvfb-run 24 25 , dedicatedServer ? false 25 26 }: 26 27 ··· 28 29 latestVersionMajor = "0.2.9"; 29 30 unstableVersionMajor = "0.4"; 30 31 31 - latestCommonBuildInputs = [ SDL SDL_image SDL_mixer libpng ]; 32 - 33 - unstableCommonBuildInputs = [ SDL2 SDL2_image SDL2_mixer glew ftgl freetype ]; 34 - unstableCommonNativeBuildInputs = [ SDL ]; # for sdl-config 35 - 36 - srcs = { 37 - ${latestVersionMajor} = rec { 38 - version = "${latestVersionMajor}.1.1"; 39 - src = fetchFromGitLab { 32 + srcs = 33 + let 34 + fetchArmagetron = rev: hash: 35 + fetchFromGitLab { 40 36 owner = "armagetronad"; 41 37 repo = "armagetronad"; 38 + inherit rev hash; 39 + }; 40 + in 41 + { 42 + # https://gitlab.com/armagetronad/armagetronad/-/tags 43 + ${latestVersionMajor} = 44 + let 45 + version = "${latestVersionMajor}.2.3"; 42 46 rev = "v${version}"; 43 - sha256 = "tvmKGqzH8IYTSeahc8XmN3RV+GdE5GsP8pAlwG8Ph3M="; 47 + hash = "sha256-lfYJ3luGK9hB0aiiBiJIqq5ddANqGaVtKXckbo4fl2g="; 48 + in dedicatedServer: { 49 + inherit version; 50 + src = fetchArmagetron rev hash; 51 + extraBuildInputs = lib.optionals (!dedicatedServer) [ libpng SDL SDL_image SDL_mixer ]; 44 52 }; 45 - extraBuildInputs = latestCommonBuildInputs; 46 - }; 47 53 54 + # https://gitlab.com/armagetronad/armagetronad/-/commits/trunk/?ref_type=heads 48 55 ${unstableVersionMajor} = 49 56 let 50 - rev = "4bf6245a668ce181cd464b767ce436a6b7bf8506"; 51 - in 52 - { 57 + rev = "e7f41fd26363e7c6a72f0c673470ed06ab54ae08"; 58 + hash = "sha256-Uxxk6L7WPxKYQ4CNxWwEtvbZjK8BqYNTuwwdleZ44Ro="; 59 + in dedicatedServer: { 53 60 version = "${unstableVersionMajor}-${builtins.substring 0 8 rev}"; 54 - src = fetchFromGitLab { 55 - owner = "armagetronad"; 56 - repo = "armagetronad"; 57 - inherit rev; 58 - sha256 = "cpJmQHCS6asGasD7anEgNukG9hRXpsIJZrCr3Q7uU4I="; 59 - }; 60 - extraBuildInputs = [ protobuf boost ] ++ unstableCommonBuildInputs; 61 - extraNativeBuildInputs = [ bison ] ++ unstableCommonNativeBuildInputs; 61 + src = fetchArmagetron rev hash; 62 + extraBuildInputs = [ protobuf boost ] 63 + ++ lib.optionals (!dedicatedServer) [ glew ftgl freetype SDL2 SDL2_image SDL2_mixer ]; 64 + extraNativeBuildInputs = [ bison ]; 65 + extraNativeInstallCheckInputs = lib.optionals (!dedicatedServer) [ xvfb-run ]; 62 66 }; 63 67 68 + # https://gitlab.com/armagetronad/armagetronad/-/commits/hack-0.2.8-sty+ct+ap/?ref_type=heads 64 69 "${latestVersionMajor}-sty+ct+ap" = 65 70 let 66 - rev = "fdfd5fb97083aed45467385b96d50d87669e4023"; 67 - in 68 - { 71 + rev = "a5bffe9dda2b43d330433f76f14eb374701f326a"; 72 + hash = "sha256-cNABxfg3MSmbxU/R78QyPOMwXGqJEamaFOPNw5yhDGE="; 73 + in dedicatedServer: { 69 74 version = "${latestVersionMajor}-sty+ct+ap-${builtins.substring 0 8 rev}"; 70 - src = fetchFromGitLab { 71 - owner = "armagetronad"; 72 - repo = "armagetronad"; 73 - inherit rev; 74 - sha256 = "UDbe7DiMLzNFAs4C6BbnmdEjqSltSbnk/uQfNOLGAfo="; 75 - }; 76 - extraBuildInputs = latestCommonBuildInputs; 77 - extraNativeBuildInputs = [ python3 ]; 75 + src = fetchArmagetron rev hash; 76 + extraBuildInputs = lib.optionals (!dedicatedServer) [ libpng SDL SDL_image SDL_mixer ]; 78 77 }; 79 78 }; 80 79 81 - mkArmagetron = { version, src, dedicatedServer ? false, extraBuildInputs ? [ ], extraNativeBuildInputs ? [ ] }@params: 80 + # Creates an Armagetron build. Takes a function returning build inputs for a particular value of dedicatedServer. 81 + mkArmagetron = fn: dedicatedServer: 82 82 let 83 + # Compute the build params. 84 + resolvedParams = fn dedicatedServer; 85 + 86 + # Figure out the binary name depending on whether this is a dedicated server. 87 + mainProgram = if dedicatedServer then "armagetronad-dedicated" else "armagetronad"; 88 + 83 89 # Split the version into the major and minor parts 84 - versionParts = lib.splitString "-" version; 90 + versionParts = lib.splitString "-" resolvedParams.version; 85 91 splitVersion = lib.splitVersion (builtins.elemAt versionParts 0); 86 92 majorVersion = builtins.concatStringsSep "." (lib.lists.take 2 splitVersion); 87 93 88 - minorVersionPart = parts: sep: expectedSize: 94 + minorVersionPart = parts: sep: expectedSize: 89 95 if builtins.length parts > expectedSize then 90 96 sep + (builtins.concatStringsSep sep (lib.lists.drop expectedSize parts)) 91 97 else ··· 93 99 94 100 minorVersion = (minorVersionPart splitVersion "." 2) + (minorVersionPart versionParts "-" 1) + "-nixpkgs"; 95 101 in 96 - stdenv.mkDerivation rec { 97 - pname = if dedicatedServer then "armagetronad-dedicated" else "armagetronad"; 98 - inherit version src; 102 + stdenv.mkDerivation { 103 + pname = mainProgram; 104 + inherit (resolvedParams) version src; 99 105 100 106 # Build works fine; install has a race. 101 107 enableParallelBuilding = true; ··· 124 130 ] ++ lib.optional dedicatedServer "--enable-dedicated" 125 131 ++ lib.optional (!dedicatedServer) "--enable-music"; 126 132 127 - buildInputs = [ libxml2 ] ++ extraBuildInputs; 133 + buildInputs = [ libxml2 ] 134 + ++ (resolvedParams.extraBuildInputs or []); 128 135 129 136 nativeBuildInputs = [ autoconf automake gnum4 pkg-config which python3 ] 130 - ++ extraNativeBuildInputs; 137 + ++ (resolvedParams.extraNativeBuildInputs or []); 138 + 139 + nativeInstallCheckInputs = resolvedParams.extraNativeInstallCheckInputs or []; 131 140 132 141 postInstall = lib.optionalString (!dedicatedServer) '' 133 142 mkdir -p $out/share/{applications,icons/hicolor} ··· 139 148 140 149 installCheckPhase = '' 141 150 export XDG_RUNTIME_DIR=/tmp 142 - bin="$out/bin/${pname}" 143 - version="$("$bin" --version || true)" 144 - prefix="$("$bin" --prefix || true)" 145 - rubber="$("$bin" --doc | grep -m1 CYCLE_RUBBER)" 151 + bin="$out/bin/${mainProgram}" 152 + if command -v xvfb-run &>/dev/null; then 153 + run="xvfb-run $bin" 154 + else 155 + run="$bin" 156 + fi 157 + version="$($run --version || true)" 158 + prefix="$($run --prefix || true)" 159 + rubber="$($run --doc | grep -m1 CYCLE_RUBBER)" 146 160 147 161 echo "Version: $version" >&2 148 162 echo "Prefix: $prefix" >&2 149 163 echo "Docstring: $rubber" >&2 150 164 151 - if [[ "$version" != *"${version}"* ]] || \ 165 + if [[ "$version" != *"${resolvedParams.version}"* ]] || \ 152 166 [ "$prefix" != "$out" ] || \ 153 167 [[ ! "$rubber" =~ ^CYCLE_RUBBER[[:space:]]+Niceness[[:space:]]factor ]]; then 154 168 exit 1 ··· 160 174 # No passthru, end of the line. 161 175 # https://www.youtube.com/watch?v=NOMa56y_Was 162 176 } 163 - else if (version != srcs.${latestVersionMajor}.version) then { 177 + else if (resolvedParams.version != (srcs.${latestVersionMajor} dedicatedServer).version) then { 164 178 # Allow a "dedicated" passthru for versions other than the default. 165 - dedicated = mkArmagetron (params // { 166 - dedicatedServer = true; 167 - }); 179 + dedicated = mkArmagetron fn true; 168 180 } 169 - else (lib.mapAttrs (name: value: mkArmagetron value) (lib.filterAttrs (name: value: value.version != srcs.${latestVersionMajor}.version) srcs)) // { 170 - # Allow both a "dedicated" passthru and a passthru for all the options other than the latest version, which this is. 171 - dedicated = mkArmagetron (params // { 172 - dedicatedServer = true; 173 - }); 174 - }; 181 + else 182 + ( 183 + lib.mapAttrs (name: value: mkArmagetron value dedicatedServer) 184 + (lib.filterAttrs (name: value: (value dedicatedServer).version != (srcs.${latestVersionMajor} dedicatedServer).version) srcs) 185 + ) // 186 + { 187 + # Allow both a "dedicated" passthru and a passthru for all the options other than the latest version, which this is. 188 + dedicated = mkArmagetron fn true; 189 + }; 175 190 176 191 meta = with lib; { 177 - homepage = "http://armagetronad.org"; 192 + inherit mainProgram; 193 + homepage = "https://www.armagetronad.org"; 178 194 description = "A multiplayer networked arcade racing game in 3D similar to Tron"; 179 - mainProgram = "armagetronad-dedicated"; 180 195 maintainers = with maintainers; [ numinit ]; 181 196 license = licenses.gpl2Plus; 182 197 platforms = platforms.linux; 183 198 }; 184 199 }; 185 200 in 186 - mkArmagetron (srcs.${latestVersionMajor} // { inherit dedicatedServer; }) 201 + mkArmagetron srcs.${latestVersionMajor} dedicatedServer