aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/repository')
-rw-r--r--crates/shirabe/src/repository/array_repository.rs5
-rw-r--r--crates/shirabe/src/repository/filesystem_repository.rs38
-rw-r--r--crates/shirabe/src/repository/filter_repository.rs3
-rw-r--r--crates/shirabe/src/repository/installed_filesystem_repository.rs5
-rw-r--r--crates/shirabe/src/repository/repository_set.rs19
-rw-r--r--crates/shirabe/src/repository/vcs/forgejo_driver.rs23
-rw-r--r--crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs32
-rw-r--r--crates/shirabe/src/repository/vcs/github_driver.rs32
-rw-r--r--crates/shirabe/src/repository/vcs/gitlab_driver.rs37
-rw-r--r--crates/shirabe/src/repository/vcs/svn_driver.rs24
-rw-r--r--crates/shirabe/src/repository/vcs_repository.rs13
-rw-r--r--crates/shirabe/src/repository/writable_array_repository.rs29
-rw-r--r--crates/shirabe/src/repository/writable_repository_interface.rs11
13 files changed, 151 insertions, 120 deletions
diff --git a/crates/shirabe/src/repository/array_repository.rs b/crates/shirabe/src/repository/array_repository.rs
index eec49f2..dc31baa 100644
--- a/crates/shirabe/src/repository/array_repository.rs
+++ b/crates/shirabe/src/repository/array_repository.rs
@@ -11,7 +11,6 @@ use crate::repository::{
AbandonedInfo, FindPackageConstraint, LoadPackagesResult, ProviderInfo, RepositoryInterface,
RepositoryInterfaceHandle, RepositoryInterfaceWeakHandle, SearchResult,
};
-use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_php_shim::{implode, preg_quote, strtolower};
@@ -119,7 +118,7 @@ impl ArrayRepository {
}
/// @param array<PackageInterface> $packages
- pub fn new(packages: Vec<PackageInterfaceHandle>) -> Result<Self> {
+ pub fn new(packages: Vec<PackageInterfaceHandle>) -> anyhow::Result<Self> {
let this = Self {
packages: RefCell::new(None),
package_map: RefCell::new(None),
@@ -132,7 +131,7 @@ impl ArrayRepository {
}
/// Adds a new package to the repository
- pub fn add_package(&self, package: PackageInterfaceHandle) -> Result<()> {
+ pub fn add_package(&self, package: PackageInterfaceHandle) -> anyhow::Result<()> {
if self.packages.borrow().is_none() {
self.initialize();
}
diff --git a/crates/shirabe/src/repository/filesystem_repository.rs b/crates/shirabe/src/repository/filesystem_repository.rs
index ebe7600..0e17841 100644
--- a/crates/shirabe/src/repository/filesystem_repository.rs
+++ b/crates/shirabe/src/repository/filesystem_repository.rs
@@ -18,7 +18,6 @@ use crate::repository::{FindPackageConstraint, LoadPackagesResult, ProviderInfo,
use crate::util::Filesystem;
use crate::util::Platform;
use crate::util::Silencer;
-use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_php_shim::{
@@ -55,7 +54,7 @@ impl FilesystemRepository {
dump_versions: bool,
root_package: Option<RootPackageInterfaceHandle>,
filesystem: Option<std::rc::Rc<std::cell::RefCell<Filesystem>>>,
- ) -> Result<Self> {
+ ) -> anyhow::Result<Self> {
let filesystem = filesystem
.unwrap_or_else(|| std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(None))));
if dump_versions && root_package.is_none() {
@@ -88,7 +87,7 @@ impl FilesystemRepository {
self.inner.get_repo_name()
}
- fn ensure_initialized(&mut self) -> Result<()> {
+ fn ensure_initialized(&mut self) -> anyhow::Result<()> {
if !self.inner.is_initialized() {
self.initialize()?;
}
@@ -96,14 +95,14 @@ impl FilesystemRepository {
}
/// Initializes repository (reads file, or remote address).
- pub(crate) fn initialize(&mut self) -> Result<()> {
+ pub(crate) fn initialize(&mut self) -> anyhow::Result<()> {
self.inner.initialize();
if !self.file.exists() {
return Ok(());
}
- let packages: PhpMixed = match (|| -> Result<PhpMixed> {
+ let packages: PhpMixed = match (|| -> anyhow::Result<PhpMixed> {
let data = self.file.read()?;
let packages_value = if let PhpMixed::Array(ref m) = data {
if m.contains_key("packages") {
@@ -177,20 +176,20 @@ impl FilesystemRepository {
Ok(())
}
- pub fn reload(&mut self) -> Result<()> {
+ pub fn reload(&mut self) -> anyhow::Result<()> {
self.inner.reset_packages();
self.initialize()
}
- pub fn add_package(&mut self, package: PackageInterfaceHandle) -> Result<()> {
+ pub fn add_package(&mut self, package: PackageInterfaceHandle) -> anyhow::Result<()> {
self.inner.add_package(package)
}
- pub fn remove_package(&mut self, package: PackageInterfaceHandle) -> Result<()> {
+ pub fn remove_package(&mut self, package: PackageInterfaceHandle) -> anyhow::Result<()> {
self.inner.remove_package(package)
}
- pub fn get_canonical_packages(&mut self) -> Result<Vec<PackageInterfaceHandle>> {
+ pub fn get_canonical_packages(&mut self) -> anyhow::Result<Vec<PackageInterfaceHandle>> {
self.ensure_initialized()?;
Ok(self.inner.get_canonical_packages())
}
@@ -208,7 +207,7 @@ impl FilesystemRepository {
&mut self,
dev_mode: bool,
installation_manager: &mut dyn InstallationManagerInterface,
- ) -> Result<()> {
+ ) -> anyhow::Result<()> {
let mut data: IndexMap<String, PhpMixed> = IndexMap::new();
data.insert("packages".to_string(), PhpMixed::List(vec![]));
data.insert("dev".to_string(), PhpMixed::Bool(dev_mode));
@@ -455,7 +454,7 @@ impl FilesystemRepository {
install_paths: &IndexMap<String, Option<String>>,
dev_mode: bool,
repo_dir: &str,
- ) -> Result<IndexMap<String, PhpMixed>> {
+ ) -> anyhow::Result<IndexMap<String, PhpMixed>> {
let dev_packages = array_flip(&PhpMixed::List(
self.inner
.dev_package_names
@@ -757,7 +756,7 @@ impl FilesystemRepository {
}
impl RepositoryInterface for FilesystemRepository {
- fn count(&self) -> Result<usize> {
+ fn count(&self) -> anyhow::Result<usize> {
self.inner.count()
}
@@ -769,7 +768,7 @@ impl RepositoryInterface for FilesystemRepository {
&mut self,
name: &str,
constraint: FindPackageConstraint,
- ) -> Result<Option<BasePackageHandle>> {
+ ) -> anyhow::Result<Option<BasePackageHandle>> {
self.ensure_initialized()?;
self.inner.find_package(name, constraint)
}
@@ -778,12 +777,12 @@ impl RepositoryInterface for FilesystemRepository {
&mut self,
name: &str,
constraint: Option<FindPackageConstraint>,
- ) -> Result<Vec<BasePackageHandle>> {
+ ) -> anyhow::Result<Vec<BasePackageHandle>> {
self.ensure_initialized()?;
self.inner.find_packages(name, constraint)
}
- fn get_packages(&mut self) -> Result<Vec<BasePackageHandle>> {
+ fn get_packages(&mut self) -> anyhow::Result<Vec<BasePackageHandle>> {
self.ensure_initialized()?;
self.inner.get_packages()
}
@@ -794,7 +793,7 @@ impl RepositoryInterface for FilesystemRepository {
acceptable_stabilities: IndexMap<String, i64>,
stability_flags: IndexMap<String, i64>,
already_loaded: IndexMap<String, IndexMap<String, PackageInterfaceHandle>>,
- ) -> Result<LoadPackagesResult> {
+ ) -> anyhow::Result<LoadPackagesResult> {
self.ensure_initialized()?;
self.inner.load_packages(
package_name_map,
@@ -809,12 +808,15 @@ impl RepositoryInterface for FilesystemRepository {
query: String,
mode: i64,
r#type: Option<String>,
- ) -> Result<Vec<SearchResult>> {
+ ) -> anyhow::Result<Vec<SearchResult>> {
self.ensure_initialized()?;
self.inner.search(query, mode, r#type)
}
- fn get_providers(&mut self, package_name: String) -> Result<IndexMap<String, ProviderInfo>> {
+ fn get_providers(
+ &mut self,
+ package_name: String,
+ ) -> anyhow::Result<IndexMap<String, ProviderInfo>> {
self.ensure_initialized()?;
self.inner.get_providers(package_name)
}
diff --git a/crates/shirabe/src/repository/filter_repository.rs b/crates/shirabe/src/repository/filter_repository.rs
index 0882973..bdf17c5 100644
--- a/crates/shirabe/src/repository/filter_repository.rs
+++ b/crates/shirabe/src/repository/filter_repository.rs
@@ -8,7 +8,6 @@ use crate::repository::{
FindPackageConstraint, LoadPackagesResult, ProviderInfo, RepositoryInterface,
RepositoryInterfaceHandle, SearchResult,
};
-use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_php_shim::{InvalidArgumentException, PhpMixed};
@@ -26,7 +25,7 @@ impl FilterRepository {
pub fn new(
repo: RepositoryInterfaceHandle,
options: IndexMap<String, PhpMixed>,
- ) -> Result<Self> {
+ ) -> anyhow::Result<Self> {
let mut only: Option<String> = None;
let mut exclude: Option<String> = None;
let mut canonical = true;
diff --git a/crates/shirabe/src/repository/installed_filesystem_repository.rs b/crates/shirabe/src/repository/installed_filesystem_repository.rs
index 8ce07e4..9d505cb 100644
--- a/crates/shirabe/src/repository/installed_filesystem_repository.rs
+++ b/crates/shirabe/src/repository/installed_filesystem_repository.rs
@@ -12,7 +12,6 @@ use crate::repository::{
FindPackageConstraint, LoadPackagesResult, ProviderInfo, RepositoryInterface, SearchResult,
};
use crate::util::Filesystem;
-use anyhow::Result;
use indexmap::IndexMap;
use shirabe_semver::constraint::AnyConstraint;
@@ -30,7 +29,7 @@ impl InstalledFilesystemRepository {
dump_versions: bool,
root_package: Option<RootPackageInterfaceHandle>,
filesystem: Option<std::rc::Rc<std::cell::RefCell<Filesystem>>>,
- ) -> Result<Self> {
+ ) -> anyhow::Result<Self> {
Ok(Self {
inner: FilesystemRepository::new(
repository_file,
@@ -49,7 +48,7 @@ impl InstalledFilesystemRepository {
dump_versions: bool,
root_package: Option<RootPackageInterfaceHandle>,
filesystem: Option<std::rc::Rc<std::cell::RefCell<Filesystem>>>,
- ) -> Result<Self> {
+ ) -> anyhow::Result<Self> {
Ok(Self {
mock: true,
..Self::new(repository_file, dump_versions, root_package, filesystem)?
diff --git a/crates/shirabe/src/repository/repository_set.rs b/crates/shirabe/src/repository/repository_set.rs
index c19f61a..b858151 100644
--- a/crates/shirabe/src/repository/repository_set.rs
+++ b/crates/shirabe/src/repository/repository_set.rs
@@ -20,7 +20,6 @@ use crate::repository::InstalledRepository;
use crate::repository::LockArrayRepositoryHandle;
use crate::repository::PlatformRepository;
use crate::repository::{FindPackageConstraint, RepositoryInterfaceHandle};
-use anyhow::Result;
use indexmap::IndexMap;
use shirabe_php_shim::{LogicException, RuntimeException, ksort, strtolower};
use shirabe_semver::constraint::AnyConstraint;
@@ -161,7 +160,7 @@ impl RepositorySet {
/// repository the search for that package ends, and following repos will not be consulted.
///
/// @param RepositoryInterface $repo A package repository
- pub fn add_repository(&mut self, repo: RepositoryInterfaceHandle) -> Result<()> {
+ pub fn add_repository(&mut self, repo: RepositoryInterfaceHandle) -> anyhow::Result<()> {
if self.locked {
return Err(RuntimeException {
message: "Pool has already been created from this repository set, it cannot be modified anymore.".to_string(),
@@ -276,7 +275,7 @@ impl RepositorySet {
package_names: Vec<String>,
allow_partial_advisories: bool,
ignore_unreachable: bool,
- ) -> Result<SecurityAdvisoriesResult> {
+ ) -> anyhow::Result<SecurityAdvisoriesResult> {
let mut map: IndexMap<String, AnyConstraint> = IndexMap::new();
for name in &package_names {
map.insert(name.clone(), MatchAllConstraint::new(None).into());
@@ -303,7 +302,7 @@ impl RepositorySet {
packages: Vec<PackageInterfaceHandle>,
allow_partial_advisories: bool,
ignore_unreachable: bool,
- ) -> Result<SecurityAdvisoriesResult> {
+ ) -> anyhow::Result<SecurityAdvisoriesResult> {
let mut map: IndexMap<String, AnyConstraint> = IndexMap::new();
for package in packages {
// ignore root alias versions as they are not actual package versions and should not matter when it comes to vulnerabilities
@@ -363,10 +362,10 @@ impl RepositorySet {
allow_partial_advisories: bool,
ignore_unreachable: bool,
unreachable_repos: &mut Vec<String>,
- ) -> Result<IndexMap<String, Vec<AnySecurityAdvisory>>> {
+ ) -> anyhow::Result<IndexMap<String, Vec<AnySecurityAdvisory>>> {
let mut repo_advisories: Vec<IndexMap<String, Vec<AnySecurityAdvisory>>> = vec![];
for repository in &self.repositories {
- let attempt: Result<()> = (|| -> Result<()> {
+ let attempt: anyhow::Result<()> = (|| -> anyhow::Result<()> {
let mut repo_ref = repository.borrow_mut();
let Some(advisory_repo) = repo_ref.as_advisory_provider_mut() else {
return Ok(());
@@ -455,7 +454,7 @@ impl RepositorySet {
ignored_types: Vec<String>,
allowed_types: Option<Vec<String>>,
security_advisory_pool_filter: Option<SecurityAdvisoryPoolFilter>,
- ) -> Result<Pool> {
+ ) -> anyhow::Result<Pool> {
let root_aliases = self
.root_aliases
.iter()
@@ -511,7 +510,7 @@ impl RepositorySet {
}
/// Create a pool for dependency resolution from the packages in this repository set.
- pub fn create_pool_with_all_packages(&mut self) -> Result<Pool> {
+ pub fn create_pool_with_all_packages(&mut self) -> anyhow::Result<Pool> {
for repo in &self.repositories {
let is_installed = {
let repo_ref = repo.borrow();
@@ -581,7 +580,7 @@ impl RepositorySet {
&mut self,
package_name: &str,
locked_repo: Option<LockArrayRepositoryHandle>,
- ) -> Result<Pool> {
+ ) -> anyhow::Result<Pool> {
// TODO unify this with above in some simpler version without "request"?
self.create_pool_for_packages(vec![package_name.to_string()], locked_repo)
}
@@ -591,7 +590,7 @@ impl RepositorySet {
&mut self,
package_names: Vec<String>,
locked_repo: Option<LockArrayRepositoryHandle>,
- ) -> Result<Pool> {
+ ) -> anyhow::Result<Pool> {
let mut request = Request::new(locked_repo);
let mut allowed_packages: Vec<String> = vec![];
diff --git a/crates/shirabe/src/repository/vcs/forgejo_driver.rs b/crates/shirabe/src/repository/vcs/forgejo_driver.rs
index 9557847..764a2d2 100644
--- a/crates/shirabe/src/repository/vcs/forgejo_driver.rs
+++ b/crates/shirabe/src/repository/vcs/forgejo_driver.rs
@@ -14,7 +14,6 @@ use crate::util::Forgejo;
use crate::util::ForgejoRepositoryData;
use crate::util::ForgejoUrl;
use crate::util::http::Response;
-use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
@@ -49,7 +48,7 @@ impl ForgejoDriver {
}
}
- pub fn initialize(&mut self) -> Result<()> {
+ pub fn initialize(&mut self) -> anyhow::Result<()> {
let forgejo_url = ForgejoUrl::create(&self.inner.url)?;
self.inner.origin_url = forgejo_url.origin_url.clone();
@@ -90,7 +89,11 @@ impl ForgejoDriver {
Ok(())
}
- pub fn get_file_content(&mut self, file: &str, identifier: &str) -> Result<Option<String>> {
+ pub fn get_file_content(
+ &mut self,
+ file: &str,
+ identifier: &str,
+ ) -> anyhow::Result<Option<String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_file_content(file, identifier);
}
@@ -177,7 +180,7 @@ impl ForgejoDriver {
pub fn get_change_date(
&mut self,
identifier: &str,
- ) -> Result<Option<chrono::DateTime<chrono::FixedOffset>>> {
+ ) -> anyhow::Result<Option<chrono::DateTime<chrono::FixedOffset>>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_change_date(identifier);
}
@@ -214,7 +217,7 @@ impl ForgejoDriver {
Ok(Some(date))
}
- pub fn get_root_identifier(&mut self) -> Result<String> {
+ pub fn get_root_identifier(&mut self) -> anyhow::Result<String> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_root_identifier();
}
@@ -227,7 +230,7 @@ impl ForgejoDriver {
.clone())
}
- pub fn get_branches(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_branches(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_branches();
}
@@ -270,7 +273,7 @@ impl ForgejoDriver {
Ok(self.branches.clone().unwrap_or_default())
}
- pub fn get_tags(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_tags(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_tags();
}
@@ -330,7 +333,7 @@ impl ForgejoDriver {
pub fn get_composer_information(
&mut self,
identifier: &str,
- ) -> Result<Option<IndexMap<String, PhpMixed>>> {
+ ) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_composer_information(identifier);
}
@@ -526,7 +529,7 @@ impl ForgejoDriver {
Ok(true)
}
- fn setup_git_driver(&mut self, url: &str) -> Result<()> {
+ fn setup_git_driver(&mut self, url: &str) -> anyhow::Result<()> {
let mut git_driver = GitDriver {
inner: VcsDriverBase::new(
{
@@ -549,7 +552,7 @@ impl ForgejoDriver {
Ok(())
}
- fn fetch_repository_data(&mut self) -> Result<()> {
+ fn fetch_repository_data(&mut self) -> anyhow::Result<()> {
if self.repository_data.is_some() {
return Ok(());
}
diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
index f28a005..45c0c68 100644
--- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
+++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
@@ -13,7 +13,6 @@ use crate::repository::vcs::VcsDriverBase;
use crate::repository::vcs::VcsDriverInterface;
use crate::util::Bitbucket;
use crate::util::http::Response;
-use anyhow::Result;
use chrono::{DateTime, FixedOffset};
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
@@ -84,7 +83,7 @@ impl GitBitbucketDriver {
}
/// @inheritDoc
- pub fn initialize(&mut self) -> Result<()> {
+ pub fn initialize(&mut self) -> anyhow::Result<()> {
let mut m: indexmap::IndexMap<CaptureKey, String> = indexmap::IndexMap::new();
if !Preg::is_match3(
r"#^https?://bitbucket\.org/([^/]+)/([^/]+?)(?:\.git|/?)?$#i",
@@ -150,7 +149,7 @@ impl GitBitbucketDriver {
/// sets some parameters which are used in other methods
///
/// @phpstan-impure
- fn get_repo_data(&mut self) -> Result<bool> {
+ fn get_repo_data(&mut self) -> anyhow::Result<bool> {
let resource = format!(
"https://api.bitbucket.org/2.0/repositories/{}/{}?{}",
self.owner.clone(),
@@ -246,7 +245,7 @@ impl GitBitbucketDriver {
pub fn get_composer_information(
&mut self,
identifier: &str,
- ) -> Result<Option<IndexMap<String, PhpMixed>>> {
+ ) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> {
if let Some(fallback) = self.fallback_driver.as_mut() {
return fallback.get_composer_information(identifier);
}
@@ -416,7 +415,11 @@ impl GitBitbucketDriver {
}
/// @inheritDoc
- pub fn get_file_content(&mut self, file: &str, identifier: &str) -> Result<Option<String>> {
+ pub fn get_file_content(
+ &mut self,
+ file: &str,
+ identifier: &str,
+ ) -> anyhow::Result<Option<String>> {
if let Some(fallback) = self.fallback_driver.as_mut() {
return fallback.get_file_content(file, identifier);
}
@@ -444,7 +447,10 @@ impl GitBitbucketDriver {
}
/// @inheritDoc
- pub fn get_change_date(&mut self, identifier: &str) -> Result<Option<DateTime<FixedOffset>>> {
+ pub fn get_change_date(
+ &mut self,
+ identifier: &str,
+ ) -> anyhow::Result<Option<DateTime<FixedOffset>>> {
if let Some(fallback) = self.fallback_driver.as_mut() {
return fallback.get_change_date(identifier);
}
@@ -476,7 +482,7 @@ impl GitBitbucketDriver {
pub fn get_source(&self, identifier: &str) -> IndexMap<String, String> {
if let Some(fallback) = self.fallback_driver.as_ref() {
// TODO(phase-c): PHP getSource is infallible (: array), but the Rust trait made it
- // Result, so the fallback's Result is flattened here. The faithful fix is making the
+ // anyhow::Result, so the fallback's anyhow::Result is flattened here. The faithful fix is making the
// VcsDriverInterface get_source/get_dist infallible across all implementations.
return fallback.get_source(identifier).unwrap_or_default();
}
@@ -514,7 +520,7 @@ impl GitBitbucketDriver {
}
/// @inheritDoc
- pub fn get_tags(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_tags(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(fallback) = self.fallback_driver.as_mut() {
return fallback.get_tags();
}
@@ -593,7 +599,7 @@ impl GitBitbucketDriver {
}
/// @inheritDoc
- pub fn get_branches(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_branches(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(fallback) = self.fallback_driver.as_mut() {
return fallback.get_branches();
}
@@ -680,7 +686,7 @@ impl GitBitbucketDriver {
&mut self,
url: &str,
fetching_repo_data: bool,
- ) -> Result<Response> {
+ ) -> anyhow::Result<Response> {
match self.inner.get_contents(url) {
Ok(r) => Ok(r),
Err(e) => {
@@ -741,7 +747,7 @@ impl GitBitbucketDriver {
///
/// @return true
/// @throws \RuntimeException
- fn attempt_clone_fallback(&mut self) -> Result<bool> {
+ fn attempt_clone_fallback(&mut self) -> anyhow::Result<bool> {
match self.setup_fallback_driver(&self.generate_ssh_url()) {
Ok(()) => Ok(true),
Err(e) => {
@@ -759,7 +765,7 @@ impl GitBitbucketDriver {
}
}
- fn setup_fallback_driver(&mut self, url: &str) -> Result<()> {
+ fn setup_fallback_driver(&mut self, url: &str) -> anyhow::Result<()> {
let mut repo_config: IndexMap<String, PhpMixed> = IndexMap::new();
repo_config.insert("url".to_string(), PhpMixed::String(url.to_string()));
let mut driver = GitDriver::new(
@@ -796,7 +802,7 @@ impl GitBitbucketDriver {
}
/// @inheritDoc
- pub fn get_root_identifier(&mut self) -> Result<String> {
+ pub fn get_root_identifier(&mut self) -> anyhow::Result<String> {
if let Some(fallback) = self.fallback_driver.as_mut() {
return fallback.get_root_identifier();
}
diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs
index e8e67ea..d68bf4e 100644
--- a/crates/shirabe/src/repository/vcs/github_driver.rs
+++ b/crates/shirabe/src/repository/vcs/github_driver.rs
@@ -12,7 +12,6 @@ use crate::repository::vcs::GitDriver;
use crate::repository::vcs::VcsDriverBase;
use crate::util::GitHub;
use crate::util::http::Response;
-use anyhow::Result;
use chrono::{DateTime, FixedOffset};
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
@@ -69,7 +68,7 @@ impl GitHubDriver {
}
}
- pub fn initialize(&mut self) -> Result<()> {
+ pub fn initialize(&mut self) -> anyhow::Result<()> {
let mut match_: IndexMap<CaptureKey, String> = IndexMap::new();
if !Preg::is_match3(
r"#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#",
@@ -177,7 +176,7 @@ impl GitHubDriver {
)
}
- pub fn get_root_identifier(&mut self) -> Result<String> {
+ pub fn get_root_identifier(&mut self) -> anyhow::Result<String> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_root_identifier();
}
@@ -255,7 +254,7 @@ impl GitHubDriver {
pub fn get_composer_information(
&mut self,
identifier: &str,
- ) -> Result<Option<IndexMap<String, PhpMixed>>> {
+ ) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_composer_information(identifier);
}
@@ -713,7 +712,11 @@ impl GitHubDriver {
result_mixed
}
- pub fn get_file_content(&mut self, file: &str, identifier: &str) -> Result<Option<String>> {
+ pub fn get_file_content(
+ &mut self,
+ file: &str,
+ identifier: &str,
+ ) -> anyhow::Result<Option<String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_file_content(file, identifier);
}
@@ -791,7 +794,10 @@ impl GitHubDriver {
Ok(Some(content))
}
- pub fn get_change_date(&mut self, identifier: &str) -> Result<Option<DateTime<FixedOffset>>> {
+ pub fn get_change_date(
+ &mut self,
+ identifier: &str,
+ ) -> anyhow::Result<Option<DateTime<FixedOffset>>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_change_date(identifier);
}
@@ -825,7 +831,7 @@ impl GitHubDriver {
Ok(Some(date))
}
- pub fn get_tags(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_tags(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_tags();
}
@@ -875,7 +881,7 @@ impl GitHubDriver {
Ok(self.tags.clone().unwrap_or_default())
}
- pub fn get_branches(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_branches(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_branches();
}
@@ -979,7 +985,7 @@ impl GitHubDriver {
/// Gives back the loaded <github-api>/repos/<owner>/<repo> result
///
/// @return mixed[]|null
- pub fn get_repo_data(&mut self) -> Result<Option<IndexMap<String, PhpMixed>>> {
+ pub fn get_repo_data(&mut self) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> {
self.fetch_root_identifier()?;
Ok(self.repo_data.clone())
@@ -1004,7 +1010,7 @@ impl GitHubDriver {
&mut self,
url: &str,
fetching_repo_data: bool,
- ) -> Result<Response, TransportException> {
+ ) -> anyhow::Result<Response, TransportException> {
let response_result = self.inner.get_contents(url);
match response_result {
Ok(r) => Ok(r),
@@ -1145,7 +1151,7 @@ impl GitHubDriver {
/// Fetch root identifier from GitHub
///
/// @throws TransportException
- pub(crate) fn fetch_root_identifier(&mut self) -> Result<()> {
+ pub(crate) fn fetch_root_identifier(&mut self) -> anyhow::Result<()> {
if self.repo_data.is_some() {
return Ok(());
}
@@ -1220,7 +1226,7 @@ impl GitHubDriver {
pub(crate) fn attempt_clone_fallback(
&mut self,
e: Option<&TransportException>,
- ) -> Result<bool> {
+ ) -> anyhow::Result<bool> {
if !self.allow_git_fallback {
return Err(RuntimeException {
message: format!(
@@ -1257,7 +1263,7 @@ impl GitHubDriver {
}
}
- pub(crate) fn setup_git_driver(&mut self, url: &str) -> Result<()> {
+ pub(crate) fn setup_git_driver(&mut self, url: &str) -> anyhow::Result<()> {
if !self.allow_git_fallback {
return Err(RuntimeException {
message: "Fallback to git driver disabled".to_string(),
diff --git a/crates/shirabe/src/repository/vcs/gitlab_driver.rs b/crates/shirabe/src/repository/vcs/gitlab_driver.rs
index 136d0d6..3f66223 100644
--- a/crates/shirabe/src/repository/vcs/gitlab_driver.rs
+++ b/crates/shirabe/src/repository/vcs/gitlab_driver.rs
@@ -13,7 +13,6 @@ use crate::repository::vcs::VcsDriverBase;
use crate::util::GitLab;
use crate::util::HttpDownloader;
use crate::util::http::Response;
-use anyhow::Result;
use chrono::{DateTime, FixedOffset};
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
@@ -80,7 +79,7 @@ impl GitLabDriver {
/// Extracts information from the repository url.
///
/// SSH urls use https by default. Set "secure-http": false on the repository config to use http instead.
- pub fn initialize(&mut self) -> Result<()> {
+ pub fn initialize(&mut self) -> anyhow::Result<()> {
let mut match_: IndexMap<CaptureKey, String> = IndexMap::new();
if !Preg::is_match3(Self::URL_REGEX, &self.inner.url, Some(&mut match_)) {
return Err(InvalidArgumentException {
@@ -262,7 +261,7 @@ impl GitLabDriver {
pub fn get_composer_information(
&mut self,
identifier: &str,
- ) -> Result<Option<IndexMap<String, PhpMixed>>> {
+ ) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_composer_information(identifier);
}
@@ -416,7 +415,11 @@ impl GitLabDriver {
.unwrap_or(None))
}
- pub fn get_file_content(&mut self, file: &str, identifier: &str) -> Result<Option<String>> {
+ pub fn get_file_content(
+ &mut self,
+ file: &str,
+ identifier: &str,
+ ) -> anyhow::Result<Option<String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_file_content(file, identifier);
}
@@ -451,7 +454,10 @@ impl GitLabDriver {
Ok(content)
}
- pub fn get_change_date(&mut self, identifier: &str) -> Result<Option<DateTime<FixedOffset>>> {
+ pub fn get_change_date(
+ &mut self,
+ identifier: &str,
+ ) -> anyhow::Result<Option<DateTime<FixedOffset>>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_change_date(identifier);
}
@@ -546,7 +552,7 @@ impl GitLabDriver {
result
}
- pub fn get_root_identifier(&mut self) -> Result<String> {
+ pub fn get_root_identifier(&mut self) -> anyhow::Result<String> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_root_identifier();
}
@@ -560,7 +566,7 @@ impl GitLabDriver {
.to_string())
}
- pub fn get_branches(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_branches(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_branches();
}
@@ -572,7 +578,7 @@ impl GitLabDriver {
Ok(self.branches.clone().unwrap_or_default())
}
- pub fn get_tags(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_tags(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_tags();
}
@@ -621,7 +627,10 @@ impl GitLabDriver {
}
/// @return string[] where keys are named references like tags or branches and the value a sha
- pub(crate) fn get_references(&mut self, r#type: &str) -> Result<IndexMap<String, String>> {
+ pub(crate) fn get_references(
+ &mut self,
+ r#type: &str,
+ ) -> anyhow::Result<IndexMap<String, String>> {
let per_page = 100;
let mut resource: Option<String> = Some(format!(
"{}/repository/{}?per_page={}",
@@ -684,7 +693,7 @@ impl GitLabDriver {
Ok(references)
}
- pub(crate) fn fetch_project(&mut self) -> Result<()> {
+ pub(crate) fn fetch_project(&mut self) -> anyhow::Result<()> {
if self.project.is_some() {
return Ok(());
}
@@ -718,7 +727,7 @@ impl GitLabDriver {
///
/// @return true
/// @throws \RuntimeException
- pub(crate) fn attempt_clone_fallback(&mut self) -> Result<bool> {
+ pub(crate) fn attempt_clone_fallback(&mut self) -> anyhow::Result<bool> {
let url = if !self.is_private {
self.generate_public_url()
} else {
@@ -768,7 +777,7 @@ impl GitLabDriver {
)
}
- pub(crate) fn setup_git_driver(&mut self, url: &str) -> Result<()> {
+ pub(crate) fn setup_git_driver(&mut self, url: &str) -> anyhow::Result<()> {
let mut repo_config: IndexMap<String, PhpMixed> = IndexMap::new();
repo_config.insert("url".to_string(), PhpMixed::String(url.to_string()));
let mut git_driver = GitDriver::new(
@@ -787,7 +796,7 @@ impl GitLabDriver {
&mut self,
url: &str,
fetching_repo_data: bool,
- ) -> Result<Response, TransportException> {
+ ) -> anyhow::Result<Response, TransportException> {
let response_result = self.inner.get_contents(url);
match response_result {
Ok(response) => {
@@ -1027,7 +1036,7 @@ impl GitLabDriver {
/// Gives back the loaded <gitlab-api>/projects/<owner>/<repo> result
///
/// @return mixed[]|null
- pub fn get_repo_data(&mut self) -> Result<Option<IndexMap<String, PhpMixed>>> {
+ pub fn get_repo_data(&mut self) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> {
self.fetch_project()?;
Ok(self.project.clone())
diff --git a/crates/shirabe/src/repository/vcs/svn_driver.rs b/crates/shirabe/src/repository/vcs/svn_driver.rs
index cb4ff87..7df7f02 100644
--- a/crates/shirabe/src/repository/vcs/svn_driver.rs
+++ b/crates/shirabe/src/repository/vcs/svn_driver.rs
@@ -11,7 +11,6 @@ use crate::util::Filesystem;
use crate::util::ProcessExecutor;
use crate::util::Svn as SvnUtil;
use crate::util::Url;
-use anyhow::Result;
use chrono::{DateTime, FixedOffset, Utc};
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
@@ -68,7 +67,7 @@ impl SvnDriver {
}
}
- pub fn initialize(&mut self) -> Result<()> {
+ pub fn initialize(&mut self) -> anyhow::Result<()> {
let normalized = Self::normalize_url(&self.inner.url);
self.inner.url = normalized.trim_end_matches('/').to_string();
self.base_url = self.inner.url.clone();
@@ -164,7 +163,7 @@ impl SvnDriver {
pub fn get_composer_information(
&mut self,
identifier: &str,
- ) -> Result<Option<IndexMap<String, PhpMixed>>> {
+ ) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> {
if !self.inner.info_cache.contains_key(identifier) {
if self.should_cache(identifier)
&& let Some(mut res) = self
@@ -255,7 +254,11 @@ impl SvnDriver {
Ok(cached)
}
- pub fn get_file_content(&mut self, file: &str, identifier: &str) -> Result<Option<String>> {
+ pub fn get_file_content(
+ &mut self,
+ file: &str,
+ identifier: &str,
+ ) -> anyhow::Result<Option<String>> {
let identifier = format!("/{}/", trim(identifier, Some("/")));
let (path, rev) = if let Some(m) =
@@ -292,7 +295,10 @@ impl SvnDriver {
Ok(Some(output))
}
- pub fn get_change_date(&mut self, identifier: &str) -> Result<Option<DateTime<FixedOffset>>> {
+ pub fn get_change_date(
+ &mut self,
+ identifier: &str,
+ ) -> anyhow::Result<Option<DateTime<FixedOffset>>> {
let identifier = format!("/{}/", trim(identifier, Some("/")));
let (path, rev) = if let Some(m) =
@@ -329,7 +335,7 @@ impl SvnDriver {
Ok(None)
}
- pub fn get_tags(&mut self) -> Result<&IndexMap<String, String>> {
+ pub fn get_tags(&mut self) -> anyhow::Result<&IndexMap<String, String>> {
if self.tags.is_none() {
let mut tags: IndexMap<String, String> = IndexMap::new();
@@ -373,7 +379,7 @@ impl SvnDriver {
Ok(self.tags.as_ref().unwrap())
}
- pub fn get_branches(&mut self) -> Result<&IndexMap<String, String>> {
+ pub fn get_branches(&mut self) -> anyhow::Result<&IndexMap<String, String>> {
if self.branches.is_none() {
let mut branches: IndexMap<String, String> = IndexMap::new();
@@ -464,7 +470,7 @@ impl SvnDriver {
_config: std::rc::Rc<std::cell::RefCell<Config>>,
url: &str,
deep: bool,
- ) -> Result<bool> {
+ ) -> anyhow::Result<bool> {
let url = Self::normalize_url(url);
if Preg::is_match(r"#(^svn://|^svn\+ssh://|svn\.)#i", &url) {
return Ok(true);
@@ -527,7 +533,7 @@ impl SvnDriver {
/// @param non-empty-list<string> $command The svn command to run.
/// @param string $url The SVN URL.
/// @throws \RuntimeException
- pub(crate) fn execute(&mut self, command: Vec<String>, url: &str) -> Result<String> {
+ pub(crate) fn execute(&mut self, command: Vec<String>, url: &str) -> anyhow::Result<String> {
if self.util.is_none() {
self.util = Some(SvnUtil::new(
self.base_url.clone(),
diff --git a/crates/shirabe/src/repository/vcs_repository.rs b/crates/shirabe/src/repository/vcs_repository.rs
index d799532..8d747c6 100644
--- a/crates/shirabe/src/repository/vcs_repository.rs
+++ b/crates/shirabe/src/repository/vcs_repository.rs
@@ -26,7 +26,6 @@ use crate::util::HttpDownloader;
use crate::util::Platform;
use crate::util::ProcessExecutor;
use crate::util::Url;
-use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_php_shim::{InvalidArgumentException, PhpMixed, in_array, str_replace, strpos};
@@ -103,7 +102,7 @@ impl VcsRepository {
process: Option<std::rc::Rc<std::cell::RefCell<ProcessExecutor>>>,
drivers: Option<IndexMap<String, VcsDriverKind>>,
version_cache: Option<Box<dyn VersionCacheInterface>>,
- ) -> Result<Self> {
+ ) -> anyhow::Result<Self> {
let inner = ArrayRepository::new(vec![])?;
let drivers = drivers.unwrap_or_else(|| {
let mut m: IndexMap<String, VcsDriverKind> = IndexMap::new();
@@ -297,7 +296,7 @@ impl VcsRepository {
Ok(())
}
- pub fn initialize(&self) -> Result<()> {
+ pub fn initialize(&self) -> anyhow::Result<()> {
self.inner.initialize();
let is_verbose = self.is_verbose;
@@ -436,7 +435,7 @@ impl VcsRepository {
.overwrite_error4(&msg, false, None, io_interface::NORMAL);
}
- let result: Result<()> = (|| -> Result<()> {
+ let result: anyhow::Result<()> = (|| -> anyhow::Result<()> {
let data_opt = self
.driver
.borrow_mut()
@@ -708,7 +707,7 @@ impl VcsRepository {
CachedPackageResult::None => {}
}
- let result: Result<()> = (|| -> Result<()> {
+ let result: anyhow::Result<()> = (|| -> anyhow::Result<()> {
let data_opt = self
.driver
.borrow_mut()
@@ -847,7 +846,7 @@ impl VcsRepository {
driver: &dyn VcsDriverInterface,
mut data: IndexMap<String, PhpMixed>,
identifier: &str,
- ) -> Result<IndexMap<String, PhpMixed>> {
+ ) -> anyhow::Result<IndexMap<String, PhpMixed>> {
// keep the name of the main identifier for all packages
// this ensures that a package can be renamed in one place and that all old tags
// will still be installable using that new name without requiring re-tagging
@@ -963,7 +962,7 @@ impl VcsRepository {
is_verbose: bool,
is_very_verbose: bool,
is_default_branch: bool,
- ) -> Result<CachedPackageResult> {
+ ) -> anyhow::Result<CachedPackageResult> {
if self.version_cache.is_none() {
return Ok(CachedPackageResult::None);
}
diff --git a/crates/shirabe/src/repository/writable_array_repository.rs b/crates/shirabe/src/repository/writable_array_repository.rs
index c4b31aa..e415a1e 100644
--- a/crates/shirabe/src/repository/writable_array_repository.rs
+++ b/crates/shirabe/src/repository/writable_array_repository.rs
@@ -7,7 +7,6 @@ use crate::repository::ArrayRepository;
use crate::repository::RepositoryInterface;
use crate::repository::RepositoryInterfaceWeakHandle;
use crate::repository::{FindPackageConstraint, LoadPackagesResult, ProviderInfo, SearchResult};
-use anyhow::Result;
use indexmap::IndexMap;
use shirabe_semver::constraint::AnyConstraint;
@@ -19,7 +18,7 @@ pub struct WritableArrayRepository {
}
impl WritableArrayRepository {
- pub fn new(packages: Vec<crate::package::PackageInterfaceHandle>) -> Result<Self> {
+ pub fn new(packages: Vec<crate::package::PackageInterfaceHandle>) -> anyhow::Result<Self> {
Ok(Self {
inner: ArrayRepository::new(packages)?,
dev_package_names: Vec::new(),
@@ -44,7 +43,7 @@ impl WritableArrayRepository {
&mut self,
dev_mode: bool,
_installation_manager: &InstallationManager,
- ) -> Result<()> {
+ ) -> anyhow::Result<()> {
self.dev_mode = Some(dev_mode);
Ok(())
}
@@ -61,7 +60,10 @@ impl WritableArrayRepository {
self.inner.is_initialized()
}
- pub fn add_package(&mut self, package: crate::package::PackageInterfaceHandle) -> Result<()> {
+ pub fn add_package(
+ &mut self,
+ package: crate::package::PackageInterfaceHandle,
+ ) -> anyhow::Result<()> {
self.inner.add_package(package)
}
@@ -72,12 +74,12 @@ impl WritableArrayRepository {
pub fn remove_package(
&mut self,
package: crate::package::PackageInterfaceHandle,
- ) -> Result<()> {
+ ) -> anyhow::Result<()> {
self.inner.remove_package(package);
Ok(())
}
- pub fn initialize(&mut self) -> Result<()> {
+ pub fn initialize(&mut self) -> anyhow::Result<()> {
self.inner.initialize();
Ok(())
}
@@ -134,7 +136,7 @@ impl RepositoryInterface for WritableArrayRepository {
&mut self,
name: &str,
constraint: FindPackageConstraint,
- ) -> Result<Option<BasePackageHandle>> {
+ ) -> anyhow::Result<Option<BasePackageHandle>> {
self.inner.find_package(name, constraint)
}
@@ -142,11 +144,11 @@ impl RepositoryInterface for WritableArrayRepository {
&mut self,
name: &str,
constraint: Option<FindPackageConstraint>,
- ) -> Result<Vec<BasePackageHandle>> {
+ ) -> anyhow::Result<Vec<BasePackageHandle>> {
self.inner.find_packages(name, constraint)
}
- fn get_packages(&mut self) -> Result<Vec<BasePackageHandle>> {
+ fn get_packages(&mut self) -> anyhow::Result<Vec<BasePackageHandle>> {
self.inner.get_packages()
}
@@ -156,7 +158,7 @@ impl RepositoryInterface for WritableArrayRepository {
acceptable_stabilities: IndexMap<String, i64>,
stability_flags: IndexMap<String, i64>,
already_loaded: IndexMap<String, IndexMap<String, PackageInterfaceHandle>>,
- ) -> Result<LoadPackagesResult> {
+ ) -> anyhow::Result<LoadPackagesResult> {
self.inner.load_packages(
package_name_map,
acceptable_stabilities,
@@ -170,11 +172,14 @@ impl RepositoryInterface for WritableArrayRepository {
query: String,
mode: i64,
r#type: Option<String>,
- ) -> Result<Vec<SearchResult>> {
+ ) -> anyhow::Result<Vec<SearchResult>> {
self.inner.search(query, mode, r#type)
}
- fn get_providers(&mut self, package_name: String) -> Result<IndexMap<String, ProviderInfo>> {
+ fn get_providers(
+ &mut self,
+ package_name: String,
+ ) -> anyhow::Result<IndexMap<String, ProviderInfo>> {
self.inner.get_providers(package_name)
}
diff --git a/crates/shirabe/src/repository/writable_repository_interface.rs b/crates/shirabe/src/repository/writable_repository_interface.rs
index 9cdecb5..7a50506 100644
--- a/crates/shirabe/src/repository/writable_repository_interface.rs
+++ b/crates/shirabe/src/repository/writable_repository_interface.rs
@@ -3,22 +3,21 @@
use crate::installer::InstallationManager;
use crate::package::PackageInterfaceHandle;
use crate::repository::RepositoryInterface;
-use anyhow::Result;
pub trait WritableRepositoryInterface: RepositoryInterface {
fn write(
&mut self,
dev_mode: bool,
installation_manager: &mut InstallationManager,
- ) -> Result<()>;
+ ) -> anyhow::Result<()>;
- fn add_package(&mut self, package: PackageInterfaceHandle) -> Result<()>;
+ fn add_package(&mut self, package: PackageInterfaceHandle) -> anyhow::Result<()>;
- fn remove_package(&mut self, package: PackageInterfaceHandle) -> Result<()>;
+ fn remove_package(&mut self, package: PackageInterfaceHandle) -> anyhow::Result<()>;
- fn get_canonical_packages(&mut self) -> Result<Vec<PackageInterfaceHandle>>;
+ fn get_canonical_packages(&mut self) -> anyhow::Result<Vec<PackageInterfaceHandle>>;
- fn reload(&mut self) -> Result<()>;
+ fn reload(&mut self) -> anyhow::Result<()>;
fn set_dev_package_names(&mut self, dev_package_names: Vec<String>);