Fedora

如何使用 dnf 列出弱依賴關係?

  • September 25, 2021

例如,如果我開始安裝希臘語言元包,系統會提示我安裝其依賴項和弱依賴項。

$ LC_ALL=C sudo dnf install langpacks-el
[sudo] password for roman: 
Last metadata expiration check: 4:03:14 ago on Sat Sep 25 13:17:49 2021.
Dependencies resolved.
===============================================================================
Package                    Arch      Version                 Repository  Size
===============================================================================
Installing:
langpacks-el               noarch    3.0-14.fc34             fedora      10 k
Installing dependencies:
autocorr-el                noarch    1:7.1.6.2-1.fc34        updates     81 k
langpacks-core-el          noarch    3.0-14.fc34             fedora      10 k
langpacks-core-font-el     noarch    3.0-14.fc34             fedora      10 k
Installing weak dependencies:
glibc-langpack-el          x86_64    2.33-20.fc34            updates    512 k
hunspell-el                noarch    1:0.9-7.fc34            fedora     1.7 M
hyphen-el                  noarch    0.20051018-23.fc34      fedora     9.3 k
libreoffice-help-el        x86_64    1:7.1.6.2-1.fc34        updates    3.6 M
libreoffice-langpack-el    x86_64    1:7.1.6.2-1.fc34        updates    854 k
mythes-el                  noarch    0.20070412-25.fc34      fedora     161 k

Transaction Summary
===============================================================================
Install  10 Packages

Total download size: 6.9 M
Installed size: 56 M
Is this ok [y/N]:

但是,如果我嘗試手動列出依賴項,我看不到弱依賴項。我怎樣才能查到它們?

這是我嘗試過的。

$ LC_ALL=C dnf repoquery --depends langpacks-el
Last metadata expiration check: 3:15:20 ago on Sat Sep 25 14:07:02 2021.
langpacks-core-el
$ LC_ALL=C dnf repoquery --depends langpacks-core-el
Last metadata expiration check: 3:15:42 ago on Sat Sep 25 14:07:02 2021.
langpacks-core-font-el
$ LC_ALL=C dnf repoquery --depends langpacks-core-font-el
Last metadata expiration check: 3:16:08 ago on Sat Sep 25 14:07:02 2021.
dejavu-sans-fonts

根據手冊頁:

dnf$$ options $$回購$$ <select-options> $$ $$ <query-options> $$ $$ <package-file-spec> $$

在可用的 DNF 儲存庫中搜尋選定的包並顯示有關它們的請求資訊。它相當於遠端儲存庫的rpm -q

- 要看

顯示軟體包依賴、增強、推薦、建議或補充的功能。

dnf repoquery --depends僅列印正向依賴項(在langpacks-el包中列為Requires/Recommends/Suggests的依賴項),因此它可以按預期工作,因為“額外”包是通過反向/反向依賴項引入的。例如,該hunspell-el軟體包具有反向弱依賴(此依賴列在hunspell-elSupplements),(hunspell and langpacks-el)這意味著它將在您同時安裝hunspell並安裝時langpack-el安裝。使用語言包,這允許只為已安裝的包安裝語言包——如果您還沒有 KDE,您將不會獲得 KDE 本地化(kde-l10n-el也是補充langpacks-el)。

您可以使用列印反向弱依賴項--whatsupplements

# dnf repoquery --whatsupplements langpacks-core-el
glibc-langpack-el-0:2.33-20.fc34.x86_64
glibc-langpack-el-0:2.33-5.fc34.x86_64

# dnf repoquery --whatsupplements langpacks-el
gimp-help-el-0:2.10.0-6.fc34.noarch
guayadeque-langpack-el-0:0.4.7-0.27.20210315git37840c1.fc34.noarch
guayadeque-langpack-el-0:0.4.7-0.30.20210415git79ec09d.fc34.noarch
hunspell-el-1:0.9-7.fc34.noarch
hyphen-el-0:0.20051018-23.fc34.noarch
kde-l10n-el-0:17.08.3-10.fc34.noarch
libreoffice-langpack-el-1:7.1.2.2-1.fc34.x86_64
libreoffice-langpack-el-1:7.1.6.2-1.fc34.x86_64
mythes-el-0:0.20070412-25.fc34.noarch
shotcut-langpack-el-0:21.03.21-2.fc34.noarch
tesseract-langpack-ell-0:4.1.0-1.fc34.noarch

我認為不可能用一個命令同時列印前向和後向依賴項。

引用自:https://unix.stackexchange.com/questions/670602