Bug 1687070

Summary: [REF] Provide single command, which tells what depends on specific package.
Product: [Fedora] Fedora Reporter: Vít Ondruch <vondruch>
Component: dnfAssignee: Jaroslav Mracek <jmracek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dmach, igor.raits, jmracek, jrohel, kparal, mblaha, mhatina, packaging-team-maint, pbrobinson, pkratoch, rpm-software-management, samuel-rhbugs, vmukhame, vondruch
Target Milestone: ---Keywords: FutureFeature, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-4.2.2-1.fc30 dnf-4.2.2-1.fc29 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-03-31 00:04:10 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 Vít Ondruch 2019-03-09 11:39:15 UTC
Description of problem:
Running `dnf update`, it tries to install:

~~~
Installing weak dependencies:
  mkpasswd                        x86_64 5.4.1-3.fc31
rawhide                 39 k
~~~

Trying to query for weak dependencies, nothing requires it:

~~~
$ sudo dnf repoquery --whatrecommends mkpasswd
Last metadata expiration check: 0:07:13 ago on Fri Mar  8 23:51:51 2019.

$ sudo dnf repoquery --supplements mkpasswd
Last metadata expiration check: 0:07:53 ago on Fri Mar  8 23:51:51 2019. 
~~~

I was told that to get the dependencies, I should use:

~~~
$ dnf repoquery --disablerepo=\* --enablerepo=koji-31 --provides mkpasswd 2>/dev/null | while read f ; do echo -n -e "$f\t" ; dnf repoquery --disablerepo=\* --enablerepo=koji-31 --whatrecommends "$f" 2>/dev/null ; echo ; done 
~~~

But this is awfully complex.

So is there chance to have a command, which would tell me that there is a list of packages, which somehow depends on the `mkpasswd` package, no matter if it is hard, weak, straight or reverse dependency, if it is a dependency on virtual provide or what not.


Version-Release number of selected component (if applicable):
$ rpm -q dnf
dnf-4.1.0-1.fc30.noarch



Additional info:

This is the original ML thread:
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/SH4GC7HAEOV67UQ2QLV26XQ4S6RNQXOH/

Comment 1 Vít Ondruch 2019-03-09 11:44:03 UTC
Just FTR, in the old day, when there were just hard dependencies, it was easy to disable the newly installed package, and the dependency, which pulled in that specific package become uninstallable and therefore it was obvious what is the dependency chain. This does not work because the weak dependency is "just not installed". So there is no way how to identify the package which pulls in some weak dependency.

Comment 2 Igor Raits 2019-03-09 11:55:08 UTC
If https://bugzilla.redhat.com/show_bug.cgi?id=1534123 would be implemented, then it would work automatically in this case too.

Comment 3 Igor Raits 2019-03-09 11:59:58 UTC
⋊> ~ cat 6.py                                                                                                                                         12:59:43
import solv

pool = solv.Pool()
pool.setarch()

repo = pool.add_repo('available')
f = solv.xfopen('/var/cache/dnf/rawhide.solv')
repo.add_solv(f)
f.close()

pool.addfileprovides()
pool.createwhatprovides()

sel = pool.select('mkpasswd', solv.Selection.SELECTION_NAME)
s = sel.solvables()[0]

print(f'{s}:')
for k, n in ((solv.SOLVABLE_REQUIRES, 'requires'),
             (solv.SOLVABLE_RECOMMENDS, 'recommends'),
             (solv.SOLVABLE_SUGGESTS, 'suggests')):
    matches = pool.whatmatchessolvable(k, s)
    if matches:
        print(f'  {n}:')
        for m in matches:
            print(f'    - {m}')
⋊> ~ python3 6.py                                                                                                                                     12:59:46
mkpasswd-5.4.1-3.fc31.x86_64:
  recommends:
    - libxcrypt-4.4.4-1.fc31.i686
    - libxcrypt-4.4.4-1.fc31.x86_64

Comment 4 Jaroslav Mracek 2019-03-11 18:12:56 UTC
Please could you try our new repoquery option "--depends" and "--whatdepends"? Both options handles all weak and normal dependencies together. Is it what you search for?

Comment 5 Vít Ondruch 2019-03-12 11:26:13 UTC
@Jaroslav: Oh, nice. The results seem to be what I am looking for.

So can I reformulate the request a bit? :) Could you please update DNF manpages in a way, that `--whatrequires` and similar will reference the `--whatdepends`? I am afraid there is no way I could find this option in man pages.

Comment 6 Vít Ondruch 2019-03-12 11:33:22 UTC
Also, it would be useful to know what type of dependency it is.

Comment 7 Jaroslav Mracek 2019-03-12 12:46:03 UTC
I create a pull-request that enhances the documentation (https://github.com/rpm-software-management/dnf/pull/1353).

Comment 8 Fedora Update System 2019-03-27 13:37:20 UTC
dnf-4.2.2-1.fc30 librepo-1.9.6-1.fc30 libdnf-0.28.1-1.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-b504d6ad8f

Comment 9 Fedora Update System 2019-03-27 13:37:44 UTC
dnf-4.2.2-1.fc29 librepo-1.9.6-1.fc29 libdnf-0.28.1-1.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-7fbfa37585

Comment 10 Fedora Update System 2019-03-27 18:18:26 UTC
dnf-4.2.2-1.fc30, libdnf-0.28.1-1.fc30, librepo-1.9.6-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-b504d6ad8f

Comment 11 Fedora Update System 2019-03-27 20:01:57 UTC
dnf-4.2.2-1.fc29, libdnf-0.28.1-1.fc29, librepo-1.9.6-1.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-7fbfa37585

Comment 12 Fedora Update System 2019-03-31 00:04:10 UTC
dnf-4.2.2-1.fc30, libdnf-0.28.1-1.fc30, librepo-1.9.6-1.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2019-03-31 03:00:46 UTC
dnf-4.2.2-1.fc29, libdnf-0.28.1-1.fc29, librepo-1.9.6-1.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.