diff options
Diffstat (limited to 'crates/shirabe/src/installer/library_installer.rs')
| -rw-r--r-- | crates/shirabe/src/installer/library_installer.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/crates/shirabe/src/installer/library_installer.rs b/crates/shirabe/src/installer/library_installer.rs index 5baffc15..8efd985a 100644 --- a/crates/shirabe/src/installer/library_installer.rs +++ b/crates/shirabe/src/installer/library_installer.rs @@ -315,14 +315,14 @@ impl InstallerInterface for LibraryInstaller { async fn install( &self, - repo: &mut dyn InstalledRepositoryInterface, + repo: &std::cell::RefCell<&mut dyn InstalledRepositoryInterface>, package: PackageInterfaceHandle, ) -> anyhow::Result<Option<PhpMixed>> { self.initialize_vendor_dir(); let download_path = self.get_install_path(package.clone()).unwrap(); // remove the binaries if it appears the package files are missing - if !Filesystem::is_readable(&download_path) && repo.has_package(package.clone()) { + if !Filesystem::is_readable(&download_path) && repo.borrow().has_package(package.clone()) { self.binary_installer .borrow_mut() .remove_binaries(package.clone()); @@ -334,6 +334,7 @@ impl InstallerInterface for LibraryInstaller { self.binary_installer .borrow_mut() .install_binaries(package.clone(), &install_path, true); + let mut repo = repo.borrow_mut(); if !repo.has_package(package.clone()) { repo.add_package(PackageInterfaceHandle::dup(&package)); } @@ -343,11 +344,11 @@ impl InstallerInterface for LibraryInstaller { async fn update( &self, - repo: &mut dyn InstalledRepositoryInterface, + repo: &std::cell::RefCell<&mut dyn InstalledRepositoryInterface>, initial: PackageInterfaceHandle, target: PackageInterfaceHandle, ) -> anyhow::Result<Option<PhpMixed>> { - if !repo.has_package(initial.clone()) { + if !repo.borrow().has_package(initial.clone()) { return Err(InvalidArgumentException { message: format!("Package is not installed: {}", initial), code: 0, @@ -366,6 +367,7 @@ impl InstallerInterface for LibraryInstaller { self.binary_installer .borrow_mut() .install_binaries(target.clone(), &install_path, true); + let mut repo = repo.borrow_mut(); repo.remove_package(initial.clone()); if !repo.has_package(target.clone()) { repo.add_package(PackageInterfaceHandle::dup(&target)); @@ -376,10 +378,10 @@ impl InstallerInterface for LibraryInstaller { async fn uninstall( &self, - repo: &mut dyn InstalledRepositoryInterface, + repo: &std::cell::RefCell<&mut dyn InstalledRepositoryInterface>, package: PackageInterfaceHandle, ) -> anyhow::Result<Option<PhpMixed>> { - if !repo.has_package(package.clone()) { + if !repo.borrow().has_package(package.clone()) { return Err(InvalidArgumentException { message: format!("Package is not installed: {}", package), code: 0, @@ -393,7 +395,7 @@ impl InstallerInterface for LibraryInstaller { self.binary_installer .borrow_mut() .remove_binaries(package.clone()); - repo.remove_package(package.clone()); + repo.borrow_mut().remove_package(package.clone()); if strpos(&package.get_name(), "/").is_some_and(|pos| pos != 0) { let package_vendor_dir = dirname(&download_path); |
