Skip to content

Commit

Permalink
fix arch not recognizing optional dependencies (#39)
Browse files Browse the repository at this point in the history
* fix arch not recognizing optional dependencies

Signed-off-by: innocentzero <[email protected]>

* implement changes in map_managed_packages

Signed-off-by: innocentzero <[email protected]>

* remove commented macro

Signed-off-by: innocentzero <[email protected]>

---------

Signed-off-by: innocentzero <[email protected]>
  • Loading branch information
InnocentZero authored Nov 1, 2024
1 parent 73c3cf5 commit 2c11bab
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/backends/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ macro_rules! is_empty {
}
};
}

macro_rules! to_package_ids {
($($backend:ident),*) => {
pub fn to_package_ids(&self) -> PackageIds {
Expand Down
31 changes: 27 additions & 4 deletions src/backends/arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,40 @@ impl Backend for Arch {
)?;

for group_package in group_packages.lines() {
let overridden =
packages.insert(group_package.to_string(), install_options.clone());
let overridden = packages
.insert(group_package.to_string(), install_options.clone())
.is_some();

if overridden.is_some() {
if overridden {
log::warn!("arch package {group_package} has been overridden by the {group} package group");
}
}
}
}

Ok(packages)
let mut final_packages = BTreeMap::new();

for (main_package, opts) in packages {
let overridden = final_packages
.insert(main_package.clone(), Self::InstallOptions::default())
.is_some();

if overridden {
log::warn!("Package {main_package} overwrote another entry");
}

for package in opts.optional_deps.iter() {
let overridden = final_packages
.insert(package.clone(), Self::InstallOptions::default())
.is_some();

if overridden {
log::warn!("Dependency {package} of {main_package} overwrote another entry");
}
}
}

Ok(final_packages)
}

fn query_installed_packages(config: &Config) -> Result<BTreeMap<String, Self::QueryInfo>> {
Expand Down

0 comments on commit 2c11bab

Please sign in to comment.