Struct aur_depends::Resolver [−][src]
pub struct Resolver<'a, 'b, H = Handle> { /* fields omitted */ }
Expand description
Resolver is the main type for resolving dependencies
Given a list of targets of either repo or AUR packages it will resolve the dependencies needed to install them.
This resolver assumes all the repo packages will be installed first, then each base is built and installed together.
aur-depends will try to solve dependnecies using the minimum ammount of AUR RPC requests.
Resolving is done via the AUR RPC. No packages are downloaded.
Example
use std::collections::HashSet;
use alpm::Alpm;
use raur::Handle;
use aur_depends::{Flags, Resolver};
let alpm = Alpm::new("/", "/var/lib/pacman")?;
let raur = Handle::default();
let mut cache = HashSet::new();
let resolver = Resolver::new(&alpm, &mut cache, &raur, Flags::new() | Flags::AUR_ONLY);
let actions = resolver.resolve_targets(&["discord-canary", "spotify"]).await?;
for install in &actions.install {
println!("install: {}", install.pkg.name())
}
for build in actions.iter_build_pkgs() {
println!("build: {}", build.pkg.name)
}
Implementations
Create a new Resolver
Set the provider callback
The provider callback will be called any time there is a choice of multiple AUR packages that can satisfy a dependency. This callback receives the dependency that we are trying to satisfy and a slice of package names satisfying it.
The callback returns returns the index of which package to pick.
Retuning an invalid index will cause a panic.
Set the group callback
The group callback is called whenever a group is processed. The callback recieves the group and returns a list of packages should be installed from the group;
Set the function for determining if a package is devel.
Devel packages are never skipped when using NEEDED.
By default, no packages are considered devel.
If enabled, causes aur/foo
to mean from the AUR, instead of a repo named aur
.
Causes <name>/foo
to mean from the AUR, instead of a repo named <name>
.
Get which aur packages need to be updated.
Example
use std::collections::HashSet;
use alpm::Alpm;
use raur::Handle;
use aur_depends::{Flags, Resolver};
let alpm = Alpm::new("/", "/var/lib/pacman")?;
let raur = Handle::default();
let mut cache = HashSet::new();
let mut resolver = Resolver::new(&alpm, &mut cache, &raur, Flags::new() | Flags::AUR_ONLY);
let updates = resolver.aur_updates().await?;
for update in updates.updates {
println!("update: {}: {} -> {}", update.local.name(), update.local.version(),
update.remote.version);
}
pub async fn local_aur_updates<S: AsRef<str>>(
&mut self,
repos: &[S]
) -> Result<AurUpdates<'a>, Error>
pub async fn local_aur_updates<S: AsRef<str>>(
&mut self,
repos: &[S]
) -> Result<AurUpdates<'a>, Error>
Fetch updates from a list of local repos.
Resolve a list of targets.
Trait Implementations
Auto Trait Implementations
impl<'a, 'b, H = Handle> !RefUnwindSafe for Resolver<'a, 'b, H>
impl<'a, 'b, H = Handle> !UnwindSafe for Resolver<'a, 'b, H>
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more