diff options
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/mozart-registry/src/resolver.rs | 4 | ||||
| -rw-r--r-- | crates/mozart-registry/src/vcs_bridge.rs | 4 | ||||
| -rw-r--r-- | crates/mozart-sat-resolver/src/pool_builder.rs | 17 | ||||
| -rw-r--r-- | crates/mozart/tests/installer.rs | 2 |
4 files changed, 24 insertions, 3 deletions
diff --git a/crates/mozart-registry/src/resolver.rs b/crates/mozart-registry/src/resolver.rs index e8076b4..9cc0751 100644 --- a/crates/mozart-registry/src/resolver.rs +++ b/crates/mozart-registry/src/resolver.rs @@ -409,6 +409,7 @@ fn packagist_to_pool_inputs( pretty_version: version_str.to_string(), requires: make_pool_links( package_name, + version_normalized, &pv.require .iter() .map(|(k, v)| (k.clone(), v.clone())) @@ -416,6 +417,7 @@ fn packagist_to_pool_inputs( ), replaces: make_pool_links( package_name, + version_normalized, &pv.replace .iter() .map(|(k, v)| (k.clone(), v.clone())) @@ -423,6 +425,7 @@ fn packagist_to_pool_inputs( ), provides: make_pool_links( package_name, + version_normalized, &pv.provide .iter() .map(|(k, v)| (k.clone(), v.clone())) @@ -430,6 +433,7 @@ fn packagist_to_pool_inputs( ), conflicts: make_pool_links( package_name, + version_normalized, &pv.conflict .iter() .map(|(k, v)| (k.clone(), v.clone())) diff --git a/crates/mozart-registry/src/vcs_bridge.rs b/crates/mozart-registry/src/vcs_bridge.rs index 7714630..1f93a51 100644 --- a/crates/mozart-registry/src/vcs_bridge.rs +++ b/crates/mozart-registry/src/vcs_bridge.rs @@ -73,6 +73,7 @@ pub fn vcs_to_pool_inputs( pretty_version: vpkg.version.clone(), requires: make_pool_links( &vpkg.name, + &vpkg.version_normalized, &require .iter() .map(|(k, v)| (k.clone(), v.clone())) @@ -80,6 +81,7 @@ pub fn vcs_to_pool_inputs( ), replaces: make_pool_links( &vpkg.name, + &vpkg.version_normalized, &replace .iter() .map(|(k, v)| (k.clone(), v.clone())) @@ -87,6 +89,7 @@ pub fn vcs_to_pool_inputs( ), provides: make_pool_links( &vpkg.name, + &vpkg.version_normalized, &provide .iter() .map(|(k, v)| (k.clone(), v.clone())) @@ -94,6 +97,7 @@ pub fn vcs_to_pool_inputs( ), conflicts: make_pool_links( &vpkg.name, + &vpkg.version_normalized, &conflict .iter() .map(|(k, v)| (k.clone(), v.clone())) diff --git a/crates/mozart-sat-resolver/src/pool_builder.rs b/crates/mozart-sat-resolver/src/pool_builder.rs index 94bbf4c..83684aa 100644 --- a/crates/mozart-sat-resolver/src/pool_builder.rs +++ b/crates/mozart-sat-resolver/src/pool_builder.rs @@ -120,11 +120,24 @@ impl Default for PoolBuilder { } /// Helper to convert (name, constraint) pairs from Packagist into PoolLinks. -pub fn make_pool_links(source: &str, deps: &[(String, String)]) -> Vec<PoolLink> { +/// +/// `source_version` is the normalized version of the package declaring these +/// links; it replaces any `"self.version"` constraint, mirroring Composer's +/// `ArrayLoader::createLink` (and `AliasPackage::replaceSelfVersionDependencies`, +/// which feeds the alias's own version in for the same purpose). +pub fn make_pool_links( + source: &str, + source_version: &str, + deps: &[(String, String)], +) -> Vec<PoolLink> { deps.iter() .map(|(target, constraint)| PoolLink { target: target.clone(), - constraint: constraint.clone(), + constraint: if constraint.trim() == "self.version" { + source_version.to_string() + } else { + constraint.clone() + }, source: source.to_string(), }) .collect() diff --git a/crates/mozart/tests/installer.rs b/crates/mozart/tests/installer.rs index 99ef2d8..6c0291b 100644 --- a/crates/mozart/tests/installer.rs +++ b/crates/mozart/tests/installer.rs @@ -333,7 +333,7 @@ installer_fixture!( remove_does_nothing_if_removal_requires_update_of_dep, ignore ); -installer_fixture!(replace_alias, ignore); +installer_fixture!(replace_alias); installer_fixture!(replace_priorities); installer_fixture!(replace_range_require_single_version); installer_fixture!(replace_root_require); |
