Skip to content

Commit eab3ead

Browse files
committed
fix(package): a bump from SYSTEM to SYSTEM keeps each dependency's version
A recipe's SYSTEM toolchain reads as system/system and --toolchain system as system with no version, so the bump took it for a retarget, left every dependency unconstrained, and moved Java 25 to 11 and CUDA 12.1.1 to 11.3.1 without a residual.
1 parent fe0b88f commit eab3ead

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

‎src/package_workflow.rs‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,12 @@ fn package_plan_from_easyconfig(
18351835
/// version constraint states what the package actually needs; when the plan
18361836
/// carries one, that constraint is the one to keep.
18371837
fn is_generation_retarget(source: &Toolchain, target: &Toolchain) -> bool {
1838+
// SYSTEM has one generation however its version is spelled: a recipe
1839+
// reads as `system/system` and `--toolchain system` as `system/`.
1840+
let system = |t: &Toolchain| t.name.eq_ignore_ascii_case("system");
1841+
if system(source) && system(target) {
1842+
return false;
1843+
}
18381844
!source.name.eq_ignore_ascii_case(&target.name) || source.version != target.version
18391845
}
18401846

@@ -2425,6 +2431,39 @@ pub enum PackageWorkflowError {
24252431
},
24262432
}
24272433

2434+
#[cfg(test)]
2435+
mod retarget_tests {
2436+
use super::is_generation_retarget;
2437+
use crate::domain::Toolchain;
2438+
2439+
fn tc(name: &str, version: &str) -> Toolchain {
2440+
Toolchain {
2441+
name: name.into(),
2442+
version: version.into(),
2443+
}
2444+
}
2445+
2446+
#[test]
2447+
fn system_to_system_is_one_generation_however_it_is_spelled() {
2448+
assert!(!is_generation_retarget(
2449+
&tc("system", "system"),
2450+
&tc("system", "")
2451+
));
2452+
assert!(!is_generation_retarget(
2453+
&tc("SYSTEM", ""),
2454+
&tc("system", "system")
2455+
));
2456+
assert!(is_generation_retarget(
2457+
&tc("system", "system"),
2458+
&tc("GCCcore", "15.2.0")
2459+
));
2460+
assert!(is_generation_retarget(
2461+
&tc("GCCcore", "14.3.0"),
2462+
&tc("GCCcore", "15.2.0")
2463+
));
2464+
}
2465+
}
2466+
24282467
#[cfg(test)]
24292468
mod portable_path_tests {
24302469
use super::portable_easyconfig_path;

0 commit comments

Comments
 (0)