13

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?

jvdm
  • 846
  • 6
  • 22
user626201
  • 1,623
  • 3
  • 19
  • 36

6 Answers6

27

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.
Antonio
  • 279
  • 3
  • 4
  • 1
    But `zypper se --requires gdal` shows `gdal-devel`, while `zypper info --requires gdal-devel` does not list `gdal` as requirement. What am I misunderstanding? – bers Feb 13 '20 at 15:34
2

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.
djoreilly
  • 49
  • 2
1

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.

0

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.

guettli
  • 25,042
  • 81
  • 346
  • 663
arielCo
  • 413
  • 5
  • 16
  • 1
    Thanks - but rpm does not seem to be working correctly. According to rpm nothing in the system is required by anything else. Hence, rpm can uninstall everything by itself :( – user626201 Sep 10 '12 at 07:01
-1

This works:

rpm -e --test PKGNAME

Source: man rpm

Orwellophile
  • 13,235
  • 3
  • 69
  • 45
-1

I hope it's useful:

betatester@myryzen:~/tmp> rpm -qi --requires \`rpm -qa | grep 'package-name'\`
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
joe
  • 1
  • How does this compare to the existing answers? Given that this question is answers, and have an answers with over twenty upvotes, it's useful to ensure your answer is adding new information—and to explain to readers why that new information is relevant and useful compared to the existing answers. – Jeremy Caney Sep 19 '20 at 19:52