Reverse dependency generation with zypper
-
29-06-2021 - |
Pregunta
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?
Solución
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.
Otros consejos
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.
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.
This works:
rpm -e --test PKGNAME
Source: man rpm
I hope it's useful:
betatester@myryzen:~/tmp> rpm -qi --requires \`rpm -qa | grep 'package-name'\`