From 275500944b9cd7d6cfc036daba925a0475362525 Mon Sep 17 00:00:00 2001 From: "ingenarel (NeoJesus)" Date: Thu, 7 May 2026 13:22:29 +0600 Subject: [PATCH] games-util/protonup-rs: use CARGO_SKIP_TESTS instead of PATCHES previous versions was patching the source code to manually rip out the code related to online tests these versions use CARGO_SKIP_TESTS instead, making the process much easier to maintain, test, bump, and, if need arises, easier to re-enable/disable patches again Signed-off-by: ingenarel (NeoJesus) --- .../protonup-rs/files/fix-tests-0.10.0.patch | 93 ------------------- .../protonup-rs/files/fix-tests-0.12.0.patch | 93 ------------------- .../protonup-rs/protonup-rs-0.11.0.ebuild | 13 ++- .../protonup-rs/protonup-rs-0.12.0.ebuild | 13 ++- 4 files changed, 20 insertions(+), 192 deletions(-) delete mode 100644 games-util/protonup-rs/files/fix-tests-0.10.0.patch delete mode 100644 games-util/protonup-rs/files/fix-tests-0.12.0.patch diff --git a/games-util/protonup-rs/files/fix-tests-0.10.0.patch b/games-util/protonup-rs/files/fix-tests-0.10.0.patch deleted file mode 100644 index 161730def8..0000000000 --- a/games-util/protonup-rs/files/fix-tests-0.10.0.patch +++ /dev/null @@ -1,93 +0,0 @@ -diff --git a/libprotonup/src/downloads.rs b/libprotonup/src/downloads.rs -index 20f618b..1580f7e 100644 ---- a/libprotonup/src/downloads.rs -+++ b/libprotonup/src/downloads.rs -@@ -280,87 +280,10 @@ impl Download { - mod tests { - use std::str::FromStr; - -- use crate::{constants, sources}; -+ use crate::sources; - - use super::*; - -- #[tokio::test] -- async fn test_list_releases() { -- let conditions = &[ -- ( -- sources::CompatTool::from_str(constants::DEFAULT_LUTRIS_TOOL).unwrap(), -- "Get WineGE", -- ), -- ( -- sources::CompatTool::from_str(constants::DEFAULT_STEAM_TOOL).unwrap(), -- "Get GEProton", -- ), -- ( -- sources::CompatTool::from_str("Luxtorpeda").unwrap(), -- "Get Luxtorpeda", -- ), -- ]; -- -- for (source_parameters, desc) in conditions { -- let result = list_releases(source_parameters).await; -- -- assert!( -- result.is_ok(), -- "case : '{desc}' test: list_releases returned error" -- ); -- -- let result = result.unwrap(); -- -- assert!( -- result.len() > 1, -- "case : '{desc}' test: test_list_releases returned an empty list" -- ); -- } -- } -- -- #[tokio::test] -- async fn test_get_release() { -- let agent = format!("{}/v{}", constants::USER_AGENT, constants::VERSION,); -- -- let client = match reqwest::Client::builder().user_agent(agent).build() { -- Ok(client) => client, -- Err(e) => { -- eprintln!("Error: {e}"); -- std::process::exit(1) -- } -- }; -- -- let conditions = &[ -- ( -- sources::CompatTool::from_str(constants::DEFAULT_LUTRIS_TOOL).unwrap(), -- "Get WineGE", -- ), -- ( -- sources::CompatTool::from_str(constants::DEFAULT_STEAM_TOOL).unwrap(), -- "Get GEProton", -- ), -- ]; -- for (source_parameters, desc) in conditions { -- let url = format!( -- "{}/{}/{}/releases/latest", -- source_parameters.forge.get_url(), -- source_parameters.repository_account, -- source_parameters.repository_name -- ); -- -- let rel = match client.get(url).send().await { -- Ok(res) => res, -- Err(e) => { -- panic!("Error: {e}"); -- } -- } -- .json::() -- .await; -- -- assert!(rel.is_ok(), "case : '{desc}' test: test_get_release wrong"); -- } -- } -- - #[tokio::test] - async fn test_get_download_name() { - let empty = "".to_owned(); diff --git a/games-util/protonup-rs/files/fix-tests-0.12.0.patch b/games-util/protonup-rs/files/fix-tests-0.12.0.patch deleted file mode 100644 index 6345fc9dfb..0000000000 --- a/games-util/protonup-rs/files/fix-tests-0.12.0.patch +++ /dev/null @@ -1,93 +0,0 @@ -diff --git a/libprotonup/src/downloads.rs b/libprotonup/src/downloads.rs -index 6cfc3e6..de4f460 100644 ---- a/libprotonup/src/downloads.rs -+++ b/libprotonup/src/downloads.rs -@@ -280,87 +280,10 @@ impl Download { - mod tests { - use std::str::FromStr; - -- use crate::{constants, sources}; -+ use crate::sources; - - use super::*; - -- #[tokio::test] -- async fn test_list_releases() { -- let conditions = &[ -- ( -- sources::CompatTool::from_str(constants::DEFAULT_LUTRIS_TOOL).unwrap(), -- "Get GEProton", -- ), -- ( -- sources::CompatTool::from_str(constants::DEFAULT_STEAM_TOOL).unwrap(), -- "Get GEProton", -- ), -- ( -- sources::CompatTool::from_str("Luxtorpeda").unwrap(), -- "Get Luxtorpeda", -- ), -- ]; -- -- for (source_parameters, desc) in conditions { -- let result = list_releases(source_parameters).await; -- -- assert!( -- result.is_ok(), -- "case : '{desc}' test: list_releases returned error" -- ); -- -- let result = result.unwrap(); -- -- assert!( -- result.len() > 1, -- "case : '{desc}' test: test_list_releases returned an empty list" -- ); -- } -- } -- -- #[tokio::test] -- async fn test_get_release() { -- let agent = format!("{}/v{}", constants::USER_AGENT, constants::VERSION,); -- -- let client = match reqwest::Client::builder().user_agent(agent).build() { -- Ok(client) => client, -- Err(e) => { -- eprintln!("Error: {e}"); -- std::process::exit(1) -- } -- }; -- -- let conditions = &[ -- ( -- sources::CompatTool::from_str(constants::DEFAULT_LUTRIS_TOOL).unwrap(), -- "Get GEProton", -- ), -- ( -- sources::CompatTool::from_str(constants::DEFAULT_STEAM_TOOL).unwrap(), -- "Get GEProton", -- ), -- ]; -- for (source_parameters, desc) in conditions { -- let url = format!( -- "{}/{}/{}/releases/latest", -- source_parameters.forge.get_url(), -- source_parameters.repository_account, -- source_parameters.repository_name -- ); -- -- let rel = match client.get(url).send().await { -- Ok(res) => res, -- Err(e) => { -- panic!("Error: {e}"); -- } -- } -- .json::() -- .await; -- -- assert!(rel.is_ok(), "case : '{desc}' test: test_get_release wrong"); -- } -- } -- - #[tokio::test] - async fn test_get_download_name() { - let empty = "".to_owned(); diff --git a/games-util/protonup-rs/protonup-rs-0.11.0.ebuild b/games-util/protonup-rs/protonup-rs-0.11.0.ebuild index dac1b31b77..b1d9fccf11 100644 --- a/games-util/protonup-rs/protonup-rs-0.11.0.ebuild +++ b/games-util/protonup-rs/protonup-rs-0.11.0.ebuild @@ -343,8 +343,6 @@ QA_FLAGS_IGNORED="usr/bin/${PN}" DOCS=( README.md docs ) -PATCHES=( "${FILESDIR}/fix-tests-0.10.0.patch" ) - # apply-crates-fixes start src_compile(){ export ZSTD_SYS_USE_PKG_CONFIG=1 # fix for zstd-sys crate @@ -358,8 +356,17 @@ src_compile(){ # but what it can do is use set the AWS_LC_SYS_CFLAGS var to override CFLAGS cargo_src_compile } + +src_test(){ + local CARGO_SKIP_TESTS=( + 'downloads::tests::test_get_release' + 'downloads::tests::test_list_releases' + ) + cargo_src_test +} + # apply-crates-fixes end -src_install() { +src_install(){ cargo_src_install --path "${S}/${PN}" einstalldocs } diff --git a/games-util/protonup-rs/protonup-rs-0.12.0.ebuild b/games-util/protonup-rs/protonup-rs-0.12.0.ebuild index 3a25b37232..9985cf08b7 100644 --- a/games-util/protonup-rs/protonup-rs-0.12.0.ebuild +++ b/games-util/protonup-rs/protonup-rs-0.12.0.ebuild @@ -345,8 +345,6 @@ QA_FLAGS_IGNORED="usr/bin/${PN}" DOCS=( README.md docs ) -PATCHES=( "${FILESDIR}/fix-tests-0.12.0.patch" ) - # apply-crates-fixes start src_compile(){ export ZSTD_SYS_USE_PKG_CONFIG=1 # fix for zstd-sys crate @@ -361,7 +359,16 @@ src_compile(){ cargo_src_compile } # apply-crates-fixes end -src_install() { + +src_test(){ + local CARGO_SKIP_TESTS=( + 'downloads::tests::test_get_release' + 'downloads::tests::test_list_releases' + ) + cargo_src_test +} + +src_install(){ cargo_src_install --path "${S}/${PN}" einstalldocs }