user626201
user626201

Reputation: 1682

Reverse dependency generation with zypper

With zypper, I can get package A depends on package B. However, what I need to know is which packages depend on package B.

Is there a way of generating a reverse dependency list?

Upvotes: 14

Views: 14005

Answers (6)

djoreilly
djoreilly

Reputation: 79

Zypper 1.14.33+ has --requires-pkg which might yield more results than --requires. See here for details.

# zypper se --requires-pkg packagename

# zypper help search | grep -A1 requires-pkg
--requires-pkg          Search for all packages that require any of the provides of the
                        package(s) matched by the input parameters.

Upvotes: 5

joe
joe

Reputation: 1

I hope it's useful:

betatester@myryzen:~/tmp> rpm -qi --requires \`rpm -qa | grep 'package-name'\`

Upvotes: -1

arielCo
arielCo

Reputation: 431

If it's already installed, you can use rpm --whatrequires:

--whatrequires CAPABILITY
        Query all packages that require CAPABILITY for proper functioning.
        Note that this does not return what requires a given package. 

If not, you[we]'re out of luck for now.

Upvotes: 0

Antonio
Antonio

Reputation: 307

You can search (abbreviated with "se") for packages that require a certain package with:

zypper se --requires packagename

Also, you can search only among installed packages with:

zypper se -i --requires packagename

For example, to look for packages requiring libpng:

# zypper se -i --requires libpng
Loading repository data... 
Reading installed packages...
S | Name                        | Summary                                                             | Type   
--+-----------------------------+---------------------------------------------------------------------+--------
i | DirectFB                    | Graphics Library for Framebuffer Devices                            | package
i | MPlayer                     | Multimedia Player                                                   | package
i | cairo-devel                 | Development environment for cairo                                   | package
etc.

Upvotes: 29

Orwellophile
Orwellophile

Reputation: 13933

This works:

rpm -e --test PKGNAME

Source: man rpm

Upvotes: -1

Michalis Giannakidis
Michalis Giannakidis

Reputation: 197

Let's say you want to know who depends on libpng14

In tcsh:

zypper search -i | cut -d \| -f 2 | tr -s '\n' ' ' > z.txt
foreach i ( `cat z.txt` )
  zypper info --requires $i |grep libpng14 &&echo $i
end

And you in a while, you will start getting results like:

libpng14.so.14()(64bit)
libpng14.so.14(PNG14_0)(64bit)
DirectFB
libpng14.so.14()(64bit)
libpng14.so.14(PNG14_0)(64bit)
MPlayer

You need to separate the packages from the grep messages, however.

Upvotes: 1

Related Questions