blob: a02547aceb96d42ca786521ed4a7aee45207b744 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/usr/bin/env python
import apt
import sys
pkgs = set()
cache = apt.Cache()
for pkg in cache:
candver = cache._depcache.get_candidate_ver(pkg._pkg)
if candver is None:
continue
dependslist = candver.depends_list
for dep in dependslist.keys():
# get the list of each dependency object
for depVerList in dependslist[dep]:
for z in depVerList:
# get all TargetVersions of
# the dependency object
for tpkg in z.all_targets():
if sys.argv[1] == tpkg.parent_pkg.name:
pkgs.add(pkg.name)
main = set()
universe = set()
for pkg in pkgs:
if "universe" in cache[pkg].section:
universe.add(cache[pkg].source_name)
else:
main.add(cache[pkg].source_name)
print "main:"
print "\n".join(main)
print
print "universe:"
print "\n".join(universe)
|