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

Provide reverse-requires search in zypper #214

Closed
bzeller opened this issue Oct 22, 2018 · 15 comments · Fixed by openSUSE/libzypp#187 or #299
Closed

Provide reverse-requires search in zypper #214

bzeller opened this issue Oct 22, 2018 · 15 comments · Fixed by openSUSE/libzypp#187 or #299

Comments

@bzeller
Copy link
Contributor

bzeller commented Oct 22, 2018

Just as apt has a command called "apt-rdepends" that you can use to find all packages depending on a given package, we should have a option in zypper search (maybe reverse-requires) that allows the user to find all packages that require a given package.

For example:
zypper se --reverse-requires libqt5core5

Also we should have a switch wether to expand packages (i.e. 'FOO' as 'literally FOO' or 'everything FOO provides' in case it's a package)

@volklord
Copy link

Yes, please

bzeller added a commit to bzeller/libzypp that referenced this issue Oct 17, 2019
Extend zypp::sat::Pool by wrapping the pool_whatmatchesdep
functionality from libsolv. This is required to implement a reverse dependency search
in zypper (fixes openSUSE/zypper#214)
bzeller added a commit to bzeller/zypper that referenced this issue Oct 17, 2019
This patch adds a new switch to zypper to support searching
reverse dependencies for a package or a set of packages (fixes openSUSE#214)
@mlschroe
Copy link
Member

If you want to match against a given package (and not a dependency), you should not use pool_whatmatchesdep but pool_whatmatchessolvable (or selection_make_matchsolvablelist if you want to match against a list of packages).

@bzeller
Copy link
Contributor Author

bzeller commented Oct 17, 2019

If you want to match against a given package (and not a dependency), you should not use pool_whatmatchesdep but pool_whatmatchessolvable (or selection_make_matchsolvablelist if you want to match against a list of packages).

@mlschroe What the code does is look for a package to extract all its "provides:" then looks for packages that require one of the provides. Would I get the same from pool_whatmatchessolvable too?

@bzeller
Copy link
Contributor Author

bzeller commented Oct 17, 2019

also pool_whatmatchessolvable has the comment this currently only works for installable packages

bzeller added a commit to bzeller/zypper that referenced this issue Oct 17, 2019
This patch adds a new switch to zypper to support searching
reverse dependencies for a package or a set of packages (fixes openSUSE#214)
@volklord
Copy link

While at it, please add a short command like "rr" as abbreviation for reverse-requires, other commands have such short commands too. (if, se, in,..).
If it would make sense or is doable is another topic, but it helps to remember the commands. Especially for people new to zypper or those who use GUI most of time.

@jreidinger
Copy link
Member

@linuunix rr is already used for remove repo.

@mlandres
Copy link
Member

Apart from that, --reverse-requires is an option to search and no command.

@mlschroe
Copy link
Member

Regarding looking at the provides and then searching for packages that match the provides: that doesn't really work with rich dependencies. If a package has Requires: A unless B, you can't do that correctly without considering the package provides as a whole.

(That's actually why pool_whatmatchessolvavble was added, because dnf also did it wrong and a bug was opened against it.)

Regarding the name: --reverse-requires is pretty horrible, what does the reverse even mean in this context? We already have --requires which is acrually --whatrequires. I'd prefer something like --requires-pkg.

Regarding this currently only works for installable packages. I think libzypp only has installable packages in the pool.

@mlandres
Copy link
Member

Maybe we have different understanding of installable.

@mlschroe
Copy link
Member

Installable in the libsolv sense means that the package architecture is allowed on the system and the package is not disabled (libzypp does not do this). See pool_installable() in repo.h.

@bzeller
Copy link
Contributor Author

bzeller commented Oct 18, 2019

Regarding looking at the provides and then searching for packages that match the provides: that doesn't really work with rich dependencies. If a package has Requires: A unless B, you can't do that correctly without considering the package provides as a whole.

Ok then we should not do it the wrong way :D.

Regarding the name: --reverse-requires is pretty horrible, what does the reverse even mean in this context? We already have --requires which is acrually --whatrequires. I'd prefer something like --requires-pkg.

Naming is not fixed yet, it was just meant as a temporary switch for now. We take suggestions.

One thing missing though, zypper se has the --verbose switch which shows a list of which depenencies have matched in the search. Any chance we can get that data from libsolv or if not already possible the API can be extended to get to the information?

bzeller added a commit to bzeller/libzypp that referenced this issue Oct 22, 2019
Exposes the following libsolv functions by wrapping them in sat::Pool:
  - pool_whatmatchesdep -> Pool::whatMatchesDep
  - pool_whatmatchessolvable -> Pool::whatMatchesSolvable
  - pool_whatcontainsdep -> Pool::whatContainsDep

Also adds a new sat::Solver function by wrapping:
  - solvable_matchessolvable -> Solvable::matchesSolvable
bzeller added a commit to bzeller/zypper that referenced this issue Oct 22, 2019
This patch adds a new switch to zypper to support searching
reverse dependencies for a package or a set of packages
bzeller added a commit to bzeller/zypper that referenced this issue Oct 28, 2019
This patch adds a new switch to zypper to support searching
reverse dependencies for a package or a set of packages
bzeller added a commit to bzeller/libzypp that referenced this issue Oct 28, 2019
Exposes the following libsolv functions by wrapping them in sat::Pool:
  - pool_whatmatchesdep -> Pool::whatMatchesDep
  - pool_whatmatchessolvable -> Pool::whatMatchesSolvable
  - pool_whatcontainsdep -> Pool::whatContainsDep

Also adds a new sat::Solver function by wrapping:
  - solvable_matchessolvable -> Solvable::matchesSolvable
@darix
Copy link
Member

darix commented Oct 28, 2019

imho ... use something like "zypper what-dependson" or at least have it as an alias. similar to "zypper what-provides"

bzeller added a commit to bzeller/zypper that referenced this issue Oct 28, 2019
This patch adds a new switch to zypper to support searching
reverse dependencies for a package or a set of packages
bzeller added a commit to bzeller/zypper that referenced this issue Oct 28, 2019
This patch adds a new set of switches to zypper to support searching
reverse dependencies for a package or a set of packages
bzeller added a commit to bzeller/zypper that referenced this issue Oct 28, 2019
This patch adds a new set of switches to zypper to support searching
reverse dependencies for a package or a set of packages
@bzeller
Copy link
Contributor Author

bzeller commented Oct 28, 2019

imho ... use something like "zypper what-dependson" or at least have it as an alias. similar to "zypper what-provides"

We decided to add switches to the normal search command, for now. Zypper already has many many commands adding new ones will just make it worse.

bzeller added a commit to openSUSE/libzypp that referenced this issue Oct 28, 2019
Exposes the following libsolv functions by wrapping them in sat::Pool:
  - pool_whatmatchesdep -> Pool::whatMatchesDep
  - pool_whatmatchessolvable -> Pool::whatMatchesSolvable
  - pool_whatcontainsdep -> Pool::whatContainsDep

Also adds a new sat::Solver function by wrapping:
  - solvable_matchessolvable -> Solvable::matchesSolvable
bzeller added a commit to bzeller/zypper that referenced this issue Oct 28, 2019
This patch adds a new set of switches to zypper to support searching
reverse dependencies for a package or a set of packages
bzeller added a commit that referenced this issue Oct 28, 2019
This patch adds a new set of switches to zypper to support searching
reverse dependencies for a package or a set of packages
@brianjmurrell
Copy link

What version of opensuse/leap should this be available in?

@mlandres
Copy link
Member

mlandres commented Nov 23, 2020

What version of opensuse/leap should this be available in?

@brianjmurrell zypper-1.14.33 (1.14.*) should go to TW and Leap15*

- Provide reverse search in zypper (fixes #214)
  This patch adds a new set of switches to zypper to support
  searching reverse dependencies for a package or a set of packages.
...
- version 1.14.33

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