Struct aur_depends::Resolver

source ·
pub struct Resolver<'a, 'b, H = Handle> { /* private fields */ }
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, Vec::new(), &mut cache, &raur, Flags::aur());
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>.

Set the custom repos to use.

Getter for the aur cache

Mut getter for the aur cache

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, Vec::new(), &mut cache, &raur, 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);
}

Fetch updates from a list of local repos.

Fetch updates from custom repo.

Fetch updates from custom repo that exist in your local repo.

Resolve a list of targets.

Resolve a list of dependencies.

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
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