Product SiteDocumentation Site

8.2. Query repositories with repoquery

repoquery is a program to query information from YUM repositories, in a similar way as the queries with rpm.
repoquery is a YUM tool with a set of deep and complicated options. It is intended to be similar to rpm -q but over remote repositories. This explains its complexity. Some pero ejecutada sobre los repositorios remotos. Esto explica el por qué de lo complicado y profundo. Below are some common uses.
By default repoquery acts over configured and enabled repositories in yum configuration. Repositories can be enabled/disabled with the --enablerepo=repoid and --disablerepo=repoid command line options. Occasionally it is only needed to query a particular repository, for this situation the option --repoid=repoid must be used. With this last option it will be queried only that repository regardless of yum settings.
Sometimes you will need to query an unconfigured repository. repoquery handles that situation too with the use of --repofrompath option:
$ repoquery  --repofrompath=reponame,http://path/to/the/repo --repoid=reponame  -q -a
repoquery can work over any architecture, and uses the system's architecture where it is run from by default. However it is possible to specify other architectures with --archlist command line option.
Just i686 packages:
$ repoquery -q --archlist=i686 -a
Just i686 and i386 packages:
$ repoquery -q --archlist=i686,i386 -a
Only srpms source packages:
$ repoquery -q --archlist=src -a
List the contents of a given package.
$ repoquery --list iftop
/usr/sbin/iftop
/usr/share/doc/iftop-0.17
/usr/share/doc/iftop-0.17/COPYING
/usr/share/doc/iftop-0.17/ChangeLog
/usr/share/doc/iftop-0.17/README
/usr/share/doc/iftop-0.17/TODO
/usr/share/man/man8/iftop.8.gz
List the packages owner of a given installed file.
$ repoquery -q --file /usr/bin/yum
yum-0:3.2.25-1.fc12.noarch
yum-0:3.2.27-3.fc12.noarch
Use of repoquery limiting it to installed packages.
$ repoquery --pkgnarrow=installed -q --whatrequires --alldeps lsof
rkhunter-0:1.3.6-7.fc12.noarch
rkhunter-0:1.3.4-8.fc12.noarch
libguestfs-1:1.0.75-1.fc12.i686
libguestfs-1:1.2.7-1.fc12.1.i686
If you need to find out which srpms have a build requirement on a particular package, run:
$ repoquery --archlist=src --repoid=fedora-source -q --whatrequires lsof
libguestfs-1:1.0.75-1.fc12.src
If you need to find out the dependence tree of a given package, run the command:
$ repoquery --tree-requires fwsnort

fwsnort-1.0.6-7.fc13.noarch [cmd line]
 \_  bash-4.1.7-1.fc13.x86_64 [1: /bin/sh]
 |   \_  glibc-2.12.1-2.i686 [1: rtld(GNU_HASH)]
 |   |   \_  basesystem-10.0-3.noarch [1: basesystem]
 |   |   |   \_  filesystem-2.4.31-1.fc13.x86_64 [1: filesystem]
 |   |   |   |   \_  setup-2.8.20-1.fc13.noarch [1: setup >= 2.5.4-1]
 |   |   |   \_  setup-2.8.20-1.fc13.noarch [1: setup]
 ...
 ...
 |   \_  4:perl-libs-5.10.1-119.fc13.x86_64 [3: libperl.so()(64bit), perl-libs, perl-libs = 4:5.10.1-119.fc13]
 |   \_  3:perl-version-0.82-1.fc13.x86_64 [1: perl(version)]
 \_  perl-IPTables-Parse-0.7-5.fc13.noarch [1: perl-IPTables-Parse]
 |   \_  4:perl-5.10.1-112.fc13.i686 [7: perl >= 5.006, perl(:MODULE_COMPAT_5.10.1), perl(Carp), perl(POSIX), perl(strict), perl(vars), perl(warnings)]
 |   \_  4:perl-5.10.1-119.fc13.x86_64 [7: perl >= 5.006, perl(:MODULE_COMPAT_5.10.1), perl(Carp), perl(POSIX), perl(strict), perl(vars), perl(warnings)]
 \_  perl-Net-IPv4Addr-0.10-7.fc13.noarch [1: perl-Net-IPv4Addr]
 |   \_  4:perl-5.10.1-112.fc13.i686 [6: /usr/bin/perl, perl(:MODULE_COMPAT_5.10.1), perl(Carp), perl(Getopt::Long), perl(strict), perl(vars)]
 |   \_  4:perl-5.10.1-119.fc13.x86_64 [6: /usr/bin/perl, perl(:MODULE_COMPAT_5.10.1), perl(Carp), perl(Getopt::Long), perl(strict), perl(vars)]
If you need a formated package list, with their url and the repository where they came from, you must repoquery as follows:
$ repoquery -q --qf="%{name} %{repoid} %{location}" pkg1 pkg2 pkg3
Query the packages with a pattern to a specific repository:
$ repoquery -q --repoid=updates-testing fw*
fwsnort-0:1.0.6-7.fc13.noarch
For more details please see the man page, man repoquery.