From d1f31de066da64da271ceab2cad3320019a0576a Mon Sep 17 00:00:00 2001 From: figsoda Date: Thu, 10 Nov 2022 13:14:30 -0500 Subject: [PATCH] srvc: fix build on darwin, set meta.mainProgram --- .../version-management/srvc/default.nix | 6 +++- .../srvc/tests-no-timeout.patch | 36 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 pkgs/applications/version-management/srvc/tests-no-timeout.patch diff --git a/pkgs/applications/version-management/srvc/default.nix b/pkgs/applications/version-management/srvc/default.nix index 0379acbd158f..7547d6d4051e 100644 --- a/pkgs/applications/version-management/srvc/default.nix +++ b/pkgs/applications/version-management/srvc/default.nix @@ -1,4 +1,4 @@ -{ lib, fetchFromGitHub, rustPlatform, stdenv, Security }: +{ lib, rustPlatform, fetchFromGitHub, stdenv, Security }: rustPlatform.buildRustPackage rec { pname = "srvc"; @@ -13,6 +13,9 @@ rustPlatform.buildRustPackage rec { cargoSha256 = "sha256-nJM7/w4awbCZQysUOSTO6bfsBXO3agJRdp1RyRZhtUY="; + # remove timeouts in tests to make them less flaky + patches = [ ./tests-no-timeout.patch ]; + buildInputs = lib.optionals stdenv.isDarwin [ Security ]; @@ -22,5 +25,6 @@ rustPlatform.buildRustPackage rec { homepage = "https://github.com/insilica/rs-srvc"; license = licenses.asl20; maintainers = with maintainers; [ john-shaffer ]; + mainProgram = "sr"; }; } diff --git a/pkgs/applications/version-management/srvc/tests-no-timeout.patch b/pkgs/applications/version-management/srvc/tests-no-timeout.patch new file mode 100644 index 000000000000..d353b9e5f44b --- /dev/null +++ b/pkgs/applications/version-management/srvc/tests-no-timeout.patch @@ -0,0 +1,36 @@ +--- a/tests/common/mod.rs ++++ b/tests/common/mod.rs +@@ -1,15 +1,13 @@ + #![allow(dead_code)] + + use std::path::PathBuf; +-use std::time::Duration; + + use assert_cmd::Command; + #[cfg(unix)] + use rexpect::session::PtySession; + +-pub fn cmd(timeout_millis: u64) -> Command { ++pub fn cmd(_: u64) -> Command { + let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); +- cmd.timeout(Duration::from_millis(timeout_millis)); + cmd.env_remove("RUST_BACKTRACE"); + cmd + } +@@ -19,14 +17,14 @@ pub fn spawn( + dir: &str, + args: Vec<&str>, + timestamp_override: u64, +- timeout_millis: u64, ++ _: u64, + ) -> Result { + let mut cmd = std::process::Command::new(env!("CARGO_BIN_EXE_sr")); + cmd.args(args); + cmd.current_dir(dir); + cmd.env("SR_TIMESTAMP_OVERRIDE", timestamp_override.to_string()); + cmd.env_remove("RUST_BACKTRACE"); +- Ok(rexpect::session::spawn_command(cmd, Some(timeout_millis))?) ++ rexpect::session::spawn_command(cmd, None) + } + + pub fn remove_sink(dir: &str) -> Result<(), std::io::Error> {