Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream some Alpm methods #30

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

fosskers
Copy link
Contributor

This PR upstreams some local functionality I've had for a while, but it's better suited to live here than in Aura.

@Morganamilo
Copy link
Member

Right. I don't really know how this ended up like this. I think I have have just been experimenting and accidentally committed the file I don't know.

///
/// An orphan is a package that was installed as a dependency, but whose parent
/// package is no longer installed.
pub fn orphans(alpm: &Alpm) -> impl Iterator<Item = Package<'_>> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too opinionated to belong here IMO. This won't watch dependency cycles, an issue pacman also suffers from.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required_by wouldn't be enough to cover the cyclic dependency case?

alpm-utils/src/alpm.rs Outdated Show resolved Hide resolved
alpm-utils/src/alpm.rs Outdated Show resolved Hide resolved
alpm-utils/src/alpm.rs Outdated Show resolved Hide resolved
name: S,
version: V,
) -> bool {
pub fn satisfies_dep<S: AsRef<str>, V: AsRef<Ver>>(dep: impl AsDep, name: S, version: V) -> bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you got some custom cargo fmt config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't, but the last changes to these lines occurred in 2019, so there's a chance that rustfmt changed since then.

alpm-utils/src/alpm.rs Outdated Show resolved Hide resolved
@fosskers
Copy link
Contributor Author

Looks like my email message didn't get delivered to the PR for some reason. Oh well. Anyway I was on vacation for a few days; fixing this now.

@fosskers
Copy link
Contributor Author

Should be good to go now.

@fosskers
Copy link
Contributor Author

fosskers commented Sep 9, 2022

Is this okay to merge?

@fosskers
Copy link
Contributor Author

Any further thoughts?

pub trait AlpmExt {
fn find_local_satisfier<S: Into<String>>(&self, pkg: S) -> Result<Option<Package>>;
}
/// All official packages.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no concept off "official" packages. Comment should describe the concept of packages that can also be found in a syncdb.

return Ok(Some(alpm_pkg));
}
}
/// All foreign packages as an `Iterator`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above but the opposite.

@Morganamilo
Copy link
Member

Sorry bit busy. Also you removed the alpmext trait (even though it was dead code anyway). I think the trait should remain and these methods be on it. Especially if one day I wish to add these functions back.

@fosskers
Copy link
Contributor Author

fosskers commented Oct 4, 2022

Roger, no problem. Busy here too, settling into a new job in a new country.

@fosskers
Copy link
Contributor Author

fosskers commented Oct 11, 2022 via email

This required fixing `find_local_satisfier` which wasn't compiling. This
module had been previously left out of the module tree, so the broken
code was never compiled and thus never detected.
And rename a few functions.
This required implementing some custom iterator structs, since `impl
Foo` is not allowed for the return types of trait methods.
@fosskers
Copy link
Contributor Author

Finally updated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants