Bug 1393704

Summary: [RFE] add 'rpm -q --whatrequires --all-deps' functionality
Product: [Fedora] Fedora Reporter: Pavel Raiskup <praiskup>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fmuta, kardos.lubos, novyjindrich, packaging-team-maint, pknirsch, pmatilai, riehecky
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-03-24 07:12:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pavel Raiskup 2016-11-10 08:07:58 UTC
Based on fedora devel [1] list, there's neat dnf's functionality:

  $ dnf repoquery --whatrequires libarchive --alldeps --installed

But it would be nice to have something like '--whatrequires --alldeps'
option directly in RPM (unless that's already there).

[1] https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/XI2JCLX5CIFWCJNKAV23KRESCQGT54RO/

Comment 1 Igor Gnatenko 2016-11-10 08:36:59 UTC
$ rpm -q --provides libarchive | awk '{print $1}' | xargs rpm -q --whatrequires

Comment 2 Pavel Raiskup 2016-11-10 09:01:39 UTC
Yep, something like that could solve RPM directly.

Comment 3 Panu Matilainen 2016-11-10 10:46:17 UTC
This is technically a dupe of bug 142651 which is a dupe of bug 84176 which easily predates repoquery but I never much cared for the suggested --whatneeds name. What a software *needs* is users, what it *requires* to function is an entirely different question, and whether the requirements are depsolved or not is yet another question.

repoquery (the yum-based one) originally mimiced rpm but then sanity prevailed:

> commit bc3d026acd1c8f332d024bf9a9918da6451c8c07
> Author: Ville Skyttä <ville.skytta>
> Date:   Tue Feb 9 21:35:15 2010 +0200
>
>    Make --alldeps the default in repoquery.
>    
>    --alldeps is what people really almost always want, but fail to
>    specify for some reason.  --exactdeps can be used to get the previous
>    default of exact matching.

Not sure what dnf repoquery does but from the sound of this, it's defaulting to the stupid rpm behavior which almost nobody wants.

So what rpm really needs is a switch to enable/disable depsolve on all those --whatrequires/recommends etc options, which is what this bug describes in clear and conscise matter. So to keep in tradition of closing the older bug as dupe ;) I'm keeping this one.

There's also another way to get rpms opinion:

    $ rpm -e --test rpm-libs 2>&1 | awk '/^\t/ {print $NF}'

That is subtly different from the --provides/--whatrequires combination in comment #1 as --test considers the %pre/%post dependency differences (ie its a real dependency check), --provides/--whatrequires does not.

Comment 4 Panu Matilainen 2016-11-10 10:53:33 UTC
*** Bug 142651 has been marked as a duplicate of this bug. ***

Comment 5 Igor Gnatenko 2016-11-10 11:07:45 UTC
(In reply to Panu Matilainen from comment #3)
> repoquery (the yum-based one) originally mimiced rpm but then sanity
> prevailed:
> 
> > commit bc3d026acd1c8f332d024bf9a9918da6451c8c07
> > Author: Ville Skyttä <ville.skytta>
> > Date:   Tue Feb 9 21:35:15 2010 +0200
> >
> >    Make --alldeps the default in repoquery.
> >    
> >    --alldeps is what people really almost always want, but fail to
> >    specify for some reason.  --exactdeps can be used to get the previous
> >    default of exact matching.
> 
> Not sure what dnf repoquery does but from the sound of this, it's defaulting
> to the stupid rpm behavior which almost nobody wants.
Since DNF 2.0, it's not true anymore.

Comment 6 Panu Matilainen 2016-11-10 11:11:58 UTC
(In reply to Igor Gnatenko from comment #5)
> (In reply to Panu Matilainen from comment #3)
> > Not sure what dnf repoquery does but from the sound of this, it's defaulting
> > to the stupid rpm behavior which almost nobody wants.
> Since DNF 2.0, it's not true anymore.

Good.

So once again history repeats itself :)

Comment 7 Panu Matilainen 2023-03-24 07:12:55 UTC
Moving the RFE to upstream.

Comment 8 Panu Matilainen 2023-03-24 08:27:43 UTC
https://github.com/rpm-software-management/rpm/pull/2451

If you want to provide feedback on the defaults, naming and the like, this is the once-in-a-lifetime chance :D