sbt: Replace VM test with installCheckPhase

This commit is contained in:
Tim Steinbach 2021-02-21 10:34:07 -05:00 committed by Tim Steinbach
parent 2962d51b90
commit af2e9e5046
3 changed files with 44 additions and 49 deletions

View File

@ -343,7 +343,6 @@ in
samba = handleTest ./samba.nix {}; samba = handleTest ./samba.nix {};
samba-wsdd = handleTest ./samba-wsdd.nix {}; samba-wsdd = handleTest ./samba-wsdd.nix {};
sanoid = handleTest ./sanoid.nix {}; sanoid = handleTest ./sanoid.nix {};
sbt = handleTest ./sbt.nix {};
sddm = handleTest ./sddm.nix {}; sddm = handleTest ./sddm.nix {};
searx = handleTest ./searx.nix {}; searx = handleTest ./searx.nix {};
service-runner = handleTest ./service-runner.nix {}; service-runner = handleTest ./service-runner.nix {};

View File

@ -1,18 +0,0 @@
import ./make-test-python.nix ({ pkgs, ...} : {
name = "sbt";
meta = with pkgs.lib.maintainers; {
maintainers = [ nequissimus ];
};
machine = { pkgs, ... }:
{
environment.systemPackages = [ pkgs.sbt ];
};
testScript =
''
machine.succeed(
"(sbt --offline --version 2>&1 || true) | grep 'getting org.scala-sbt sbt ${pkgs.sbt.version} (this may take some time)'"
)
'';
})

View File

@ -1,5 +1,18 @@
{ lib, stdenv, fetchurl, jre, autoPatchelfHook, zlib, writeScript { lib
, common-updater-scripts, git, nixfmt, nix, coreutils, gnused, nixosTests }: , stdenv
, fetchurl
, jre
, autoPatchelfHook
, zlib
, writeScript
, common-updater-scripts
, git
, nixfmt
, nix
, coreutils
, gnused
, nixosTests
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "sbt"; pname = "sbt";
@ -28,6 +41,11 @@ stdenv.mkDerivation rec {
} $out/bin/sbtn } $out/bin/sbtn
''; '';
doInstallCheck = true;
installCheckPhase = ''
($out/bin/sbt --offline --version 2>&1 || true) | grep 'getting org.scala-sbt sbt ${version} (this may take some time)'
'';
meta = with lib; { meta = with lib; {
homepage = "https://www.scala-sbt.org/"; homepage = "https://www.scala-sbt.org/";
license = licenses.bsd3; license = licenses.bsd3;
@ -36,34 +54,30 @@ stdenv.mkDerivation rec {
platforms = platforms.unix; platforms = platforms.unix;
}; };
passthru = { passthru.updateScript = writeScript "update.sh" ''
tests = { inherit (nixosTests) sbt; }; #!${stdenv.shell}
set -o errexit
PATH=${
lib.makeBinPath [
common-updater-scripts
git
nixfmt
nix
coreutils
gnused
]
}
updateScript = writeScript "update.sh" '' oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion sbt" | tr -d '"')"
#!${stdenv.shell} latestTag="$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags git@github.com:sbt/sbt.git '*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3 | sed 's|^v||g')"
set -o errexit
PATH=${
lib.makeBinPath [
common-updater-scripts
git
nixfmt
nix
coreutils
gnused
]
}
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion sbt" | tr -d '"')" if [ ! "$oldVersion" = "$latestTag" ]; then
latestTag="$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags git@github.com:sbt/sbt.git '*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3 | sed 's|^v||g')" update-source-version sbt "$latestTag" --version-key=version --print-changes
nixpkgs="$(git rev-parse --show-toplevel)"
if [ ! "$oldVersion" = "$latestTag" ]; then default_nix="$nixpkgs/pkgs/development/tools/build-managers/sbt/default.nix"
update-source-version sbt "$latestTag" --version-key=version --print-changes nixfmt "$default_nix"
nixpkgs="$(git rev-parse --show-toplevel)" else
default_nix="$nixpkgs/pkgs/development/tools/build-managers/sbt/default.nix" echo "sbt is already up-to-date"
nixfmt "$default_nix" fi
else '';
echo "sbt is already up-to-date"
fi
'';
};
} }