Skip to content

Commit 4cc310e

Browse files
committed
feat(patch application test): compare against gnu patch
1 parent f26ac56 commit 4cc310e

File tree

8 files changed

+222
-233
lines changed

8 files changed

+222
-233
lines changed

.github/workflows/rust.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,17 @@ jobs:
3838
toolchain: "1.86.0"
3939
components: clippy,rustfmt
4040
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
41+
# https://github.com/actions/runner-images/issues/5459#issuecomment-1532856844
42+
- name: Set up PATH on Windows
43+
# Needed to use GNU patch instead of Strawberry Perl patch
44+
if: ${{ contains(github.event.pull_request.labels.*.name, 'need-patch-apply-tests') && matrix.os == 'windows-latest' }}
45+
run: echo "C:\Program Files\Git\usr\bin" >> $env:GITHUB_PATH
4146
- name: Run tests
4247
run: cargo test --features=tui,recipe-generation --verbose -- --nocapture
4348
- name: Run patch apply tests
4449
# https://github.com/orgs/community/discussions/26261#discussioncomment-3251039
4550
if: ${{ contains(github.event.pull_request.labels.*.name, 'need-patch-apply-tests') }}
46-
run: cargo test --features=tui,recipe-generation --verbose -- --nocapture --ignored
51+
run: cargo test --features=tui,recipe-generation --verbose --jobs 1 -- --nocapture --ignored
4752

4853
build:
4954
name: Build ${{ matrix.target }}

Cargo.lock

Lines changed: 24 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ tracing-test = "0.2.5"
201201
tracing-indicatif = "0.3.9"
202202
serial_test = "3.2.0"
203203
criterion = { version = "0.5.1", features = ["html_reports"] }
204+
pretty_assertions = "1.4.1"
204205

205206
[[bench]]
206207
name = "line_breaks"

py-rattler-build/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/build.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use miette::{Context, IntoDiagnostic};
66
use rattler_conda_types::{Channel, MatchSpec};
77

88
use crate::{
9-
apply_patch_git,
9+
apply_patch_custom,
1010
metadata::{Output, build_reindexed_channels},
1111
recipe::parser::TestType,
1212
render::solver::load_repodatas,
@@ -116,11 +116,8 @@ pub async fn run_build(
116116
let output = if output.recipe.cache.is_some() {
117117
output.build_or_fetch_cache(tool_configuration).await?
118118
} else {
119-
let system_tools = output.system_tools.clone();
120119
output
121-
.fetch_sources(tool_configuration, |wd, p| {
122-
apply_patch_git(&system_tools, wd, p)
123-
})
120+
.fetch_sources(tool_configuration, apply_patch_custom)
124121
.await
125122
.into_diagnostic()?
126123
};

src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ use rattler_solve::SolveStrategy;
7474
use rattler_virtual_packages::{VirtualPackage, VirtualPackageOverrides};
7575
use recipe::parser::{Dependency, TestType, find_outputs_from_src};
7676
use selectors::SelectorConfig;
77-
use source::patch::apply_patch_git;
77+
use source::patch::apply_patch_custom;
7878
use source_code::Source;
7979
use system_tools::SystemTools;
8080
use tool_configuration::{Configuration, ContinueOnFailure, SkipExisting, TestStrategy};
@@ -1064,11 +1064,8 @@ pub async fn debug_recipe(
10641064
.directories
10651065
.recreate_directories()
10661066
.into_diagnostic()?;
1067-
let system_tools = output.system_tools.clone();
10681067
let output = output
1069-
.fetch_sources(&tool_config, |wd, pf| {
1070-
apply_patch_git(&system_tools, wd, pf)
1071-
})
1068+
.fetch_sources(&tool_config, apply_patch_custom)
10721069
.await
10731070
.into_diagnostic()?;
10741071
let output = output

0 commit comments

Comments
 (0)