Se você precisar de um resultado personalizado, pode ser uma boa opção implementar um script para realizar essa tarefa usando python-apt
:
import argparse
from itertools import chain
from collections import deque
import apt
def main(args):
packages_seen = set()
dependencies = deque()
def print_package(package):
print package.name, package.installedVersion
packages_seen.add(package.name)
or_dependencies = [dependency.or_dependencies
for dependency in package.installedDependencies]
dependencies.extend(chain.from_iterable(or_dependencies))
cache = apt.cache.Cache()
package = cache[args.package_name]
print_package(package)
while dependencies:
dependency = dependencies.popleft()
package_name = dependency.name
# Skip virtual packages
if package_name not in cache:
continue
if package_name not in packages_seen:
package = cache[dependency.name]
print_package(package)
if __name__ == '__main__':
parser = argparse.ArgumentParser('Print all package dependencies '
'and their installed version')
parser.add_argument('package_name', help='Package name')
args = parser.parse_args()
main(args)
Exemplo de saída:
$ python depends.py sqlite
sqlite 2.8.17-6.1ubuntu1
libc6 2.13-20ubuntu5
libreadline6 6.2-2ubuntu1
libsqlite0 2.8.17-6.1ubuntu1
libc-bin 2.13-20ubuntu5
libgcc1 1:4.6.1-9ubuntu3
tzdata 2011n-0ubuntu0.11.10
readline-common 6.2-2ubuntu1
libtinfo5 5.9-1ubuntu5
multiarch-support 2.13-20ubuntu5
gcc-4.6-base 4.6.1-9ubuntu3
debconf 1.5.40ubuntu1
dpkg 1.16.0.3ubuntu5
install-info 4.13a.dfsg.1-8ubuntu1
perl-base 5.12.4-4
libbz2-1.0 1.0.5-6ubuntu1
libselinux1 2.0.98-1.1
zlib1g 1:1.2.3.4.dfsg-3ubuntu3
coreutils 8.5-1ubuntu6
xz-utils 5.0.0-2
libacl1 2.2.51-3
libattr1 1:2.4.46-3
liblzma2 5.0.0-2