diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-06 15:16:07 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-06 15:17:00 +0900 |
| commit | 1e7aabcae1b2139aa20a80fbf303c74388933f55 (patch) | |
| tree | 07c5f4e7502841fef21909b2aa8269e6e71fb2a3 /crates/shirabe/src/repository | |
| parent | adba8b1969a3f40245324d7feb5905693ca65d5e (diff) | |
| download | php-shirabe-1e7aabcae1b2139aa20a80fbf303c74388933f55.tar.gz php-shirabe-1e7aabcae1b2139aa20a80fbf303c74388933f55.tar.zst php-shirabe-1e7aabcae1b2139aa20a80fbf303c74388933f55.zip | |
fix(array-dumper): emit package links and require Link pretty constraint
Resolve the phase-b TODO that left the supported-link-types loop as dead
code (links were always an empty Vec), so requires/conflicts/provides/
replaces/require-dev are dumped again via
PackageInterface::get_links_for_type, matching the PHP magic-call loop.
Every Link in production is constructed with a pretty constraint (all
ArrayLoader/AliasPackage/PlatformRepository/InstalledRepository sites
pass one), so make Link::pretty_constraint a required String instead of
Option<String>. get_pretty_constraint() now returns &str directly rather
than anyhow::Result<&str>, dropping the unreachable
UnexpectedValueException guard, and all call sites are updated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository')
| -rw-r--r-- | crates/shirabe/src/repository/filesystem_repository.rs | 4 | ||||
| -rw-r--r-- | crates/shirabe/src/repository/installed_repository.rs | 11 | ||||
| -rw-r--r-- | crates/shirabe/src/repository/platform_repository.rs | 6 |
3 files changed, 7 insertions, 14 deletions
diff --git a/crates/shirabe/src/repository/filesystem_repository.rs b/crates/shirabe/src/repository/filesystem_repository.rs index c373bd9..d9d3289 100644 --- a/crates/shirabe/src/repository/filesystem_repository.rs +++ b/crates/shirabe/src/repository/filesystem_repository.rs @@ -559,7 +559,7 @@ impl FilesystemRepository { todo!("mutate nested versions['versions'][target]['dev_requirement']"); #[allow(unreachable_code)] { - let mut replaced = replace.get_pretty_constraint().unwrap_or("").to_string(); + let mut replaced = replace.get_pretty_constraint().to_string(); if replaced == "self.version" { replaced = package.get_pretty_version().to_string(); } @@ -576,7 +576,7 @@ impl FilesystemRepository { todo!("mutate nested versions['versions'][target]['dev_requirement']"); #[allow(unreachable_code)] { - let mut provided = provide.get_pretty_constraint().unwrap_or("").to_string(); + let mut provided = provide.get_pretty_constraint().to_string(); if provided == "self.version" { provided = package.get_pretty_version().to_string(); } diff --git a/crates/shirabe/src/repository/installed_repository.rs b/crates/shirabe/src/repository/installed_repository.rs index e6f022e..b8321d6 100644 --- a/crates/shirabe/src/repository/installed_repository.rs +++ b/crates/shirabe/src/repository/installed_repository.rs @@ -282,11 +282,7 @@ impl InstalledRepository { link.get_target().to_string(), MatchAllConstraint::new(None).into(), Some(Link::TYPE_REQUIRE.to_string()), - Some(format!( - "{} {}", - link.get_pretty_constraint().unwrap_or_default(), - description - )), + format!("{} {}", link.get_pretty_constraint(), description), ), None, )); @@ -351,10 +347,7 @@ impl InstalledRepository { link.get_target().to_string(), MatchAllConstraint::new(None).into(), Some(Link::TYPE_DOES_NOT_REQUIRE.to_string()), - Some(format!( - "but {} is installed", - pkg.get_pretty_version() - )), + format!("but {} is installed", pkg.get_pretty_version()), ), None, )); diff --git a/crates/shirabe/src/repository/platform_repository.rs b/crates/shirabe/src/repository/platform_repository.rs index 957e335..3a59475 100644 --- a/crates/shirabe/src/repository/platform_repository.rs +++ b/crates/shirabe/src/repository/platform_repository.rs @@ -1775,7 +1775,7 @@ impl PlatformRepository { "lib-uuid".to_string(), SimpleConstraint::new("=".to_string(), version.to_string(), None).into(), Some(Link::TYPE_REPLACE.to_string()), - Some(ext.get_pretty_version().to_string()), + ext.get_pretty_version().to_string(), ), ); ext.inner.set_replaces(replaces); @@ -1840,7 +1840,7 @@ impl PlatformRepository { format!("lib-{}", replace_lower), SimpleConstraint::new("=".to_string(), version.to_string(), None).into(), Some(Link::TYPE_REPLACE.to_string()), - Some(lib.get_pretty_version().to_string()), + lib.get_pretty_version().to_string(), ), ); } @@ -1854,7 +1854,7 @@ impl PlatformRepository { format!("lib-{}", provide_lower), SimpleConstraint::new("=".to_string(), version.to_string(), None).into(), Some(Link::TYPE_PROVIDE.to_string()), - Some(lib.get_pretty_version().to_string()), + lib.get_pretty_version().to_string(), ), ); } |
