How to Use “repoquery” Command to List Package Dependencies?

“repoquery” is a program for querying information from YUM repositories similarly to rpm queries. The “yum-utils” package should be installed to use this command. If it is not already installed in your system you can install the package by the following yum command:

# yum install yum-utils

 

The following command lets us to view the dependencies of an already installed rpm package.

# repoquery --requires --resolve [package]

 

Here,

  • –requires – List package dependencies.
  • –resolve – When used with –requires, resolve capabilities to originating packages.
  • package – rpm package name

 

Example:

# repoquery --requires --resolve nano
info-0:5.1-4.el7.x86_64
ncurses-libs-0:5.9-14.20130511.el7_4.x86_64
bash-0:4.2.46-29.el7_4.x86_64
glibc-0:2.17-55.el7_0.3.i686
glibc-0:2.17-106.el7_2.1.x86_64 

 

You can utilize the repoquery command in order to gather a list of packages that are dependencies of a package that you would like to update. Do note that this will grab the latest version of the dependencies even if you specify a version for the package that you are querying.

For further information, see the manual page man repoquery or the help text “repoquery –help”.

# man repoquery

 

# repoquery --help

 

 Resolving dependencies recursively

 

You can use the –recursive option with “–requires –resolve” option to query packages recursively. For example :

# repoquery --requires --resolve --recursive nano
pcre-0:8.32-15.el7_2.1.x86_64
glibc-0:2.17-55.el7_0.3.i686
bash-0:4.2.46-29.el7_4.x86_64
libselinux-0:2.2.2-6.el7.x86_64
basesystem-0:10.0-7.el7.noarch
tzdata-0:2014g-1.el7.noarch
pcre-0:8.32-15.el7_2.1.i686
libstdc++-0:4.8.2-16.2.el7_0.x86_64
libgcc-0:4.8.2-16.2.el7_0.x86_64
nss-softokn-freebl-0:3.16.2.3-9.el7.x86_64
setup-0:2.8.71-4.el7.noarch
ncurses-base-0:5.9-13.20130511.el7.noarch
zlib-0:1.2.7-13.el7.x86_64
glibc-0:2.17-106.el7_2.1.x86_64
filesystem-0:3.2-21.el7.x86_64
redhat-release-server-0:7.3-7.el7.x86_64
libsepol-0:2.5-6.el7.x86_64
ncurses-libs-0:5.9-14.20130511.el7_4.x86_64
libgcc-0:4.8.3-9.el7.i686
info-0:5.1-4.el7.x86_64
glibc-common-0:2.17-78.el7.x86_64 

 

Alternate method – yumdownloader

 

Another way is to use yumdownloader please note though, that this will not grab dependencies of dependencies, so you may still have to run it on further packages down the list until you have all of the requirements.

# yumdownloader --resolve systemd
Loaded plugins: langpacks, product-id
--> Running transaction check
---> Package systemd.x86_64 0:219-42.el7_4.4 will be installed
--> Processing Dependency: systemd-libs = 219-42.el7_4.4 for package: systemd-219-42.el7_4.4.x86_64
--> Running transaction check
---> Package systemd-libs.x86_64 0:219-30.el7_3.7 will be updated
--> Processing Dependency: systemd-libs = 219-30.el7_3.7 for package: libgudev1-219-30.el7_3.7.x86_64
--> Processing Dependency: systemd-libs = 219-30.el7_3.7 for package: systemd-219-30.el7_3.7.x86_64
--> Processing Dependency: systemd-libs = 219-30.el7_3.7 for package: systemd-python-219-30.el7_3.7.x86_64
---> Package systemd-libs.x86_64 0:219-42.el7_4.4 will be an update
--> Running transaction check
---> Package libgudev1.x86_64 0:219-30.el7_3.7 will be updated
---> Package libgudev1.x86_64 0:219-42.el7_4.4 will be an update
---> Package systemd.x86_64 0:219-30.el7_3.7 will be updated
--> Processing Dependency: systemd = 219-30.el7_3.7 for package: systemd-sysv-219-30.el7_3.7.x86_64
---> Package systemd-python.x86_64 0:219-30.el7_3.7 will be updated
---> Package systemd-python.x86_64 0:219-42.el7_4.4 will be an update
--> Running transaction check
---> Package systemd-sysv.x86_64 0:219-30.el7_3.7 will be updated
---> Package systemd-sysv.x86_64 0:219-42.el7_4.4 will be an update
--> Processing Conflict: systemd-219-42.el7_4.4.x86_64 conflicts dracut < 033-499
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package dracut.x86_64 0:033-463.el7 will be updated
--> Processing Dependency: dracut = 033-463.el7 for package: dracut-network-033-463.el7.x86_64
--> Processing Dependency: dracut = 033-463.el7 for package: dracut-config-rescue-033-463.el7.x86_64
---> Package dracut.x86_64 0:033-502.el7 will be an update
--> Running transaction check
---> Package dracut-config-rescue.x86_64 0:033-463.el7 will be updated
---> Package dracut-config-rescue.x86_64 0:033-502.el7 will be an update
---> Package dracut-network.x86_64 0:033-463.el7 will be updated
---> Package dracut-network.x86_64 0:033-502.el7 will be an update
--> Finished Dependency Resolution
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/8): dracut-config-rescue-033-502.el7.x86_64.rpm                                                                                                                      |  55 kB  00:00:00     
(2/8): dracut-033-502.el7.x86_64.rpm                                                                                                                                    | 321 kB  00:00:00     
(3/8): dracut-network-033-502.el7.x86_64.rpm                                                                                                                            |  97 kB  00:00:00     
(4/8): libgudev1-219-42.el7_4.4.x86_64.rpm                                                                                                                              |  83 kB  00:00:00     
(5/8): systemd-libs-219-42.el7_4.4.x86_64.rpm                                                                                                                           | 376 kB  00:00:00     
(6/8): systemd-python-219-42.el7_4.4.x86_64.rpm                                                                                                                         | 116 kB  00:00:00     
(7/8): systemd-sysv-219-42.el7_4.4.x86_64.rpm                                                                                                                           |  70 kB  00:00:00     
(8/8): systemd-219-42.el7_4.4.x86_64.rpm   

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)