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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129 | #!/usr/bin/python3
import apt_pkg as apt
apt.init()
cache = apt.Cache()
depcache = apt.DepCache(cache)
records = apt.PackageRecords(cache)
srcrecords = apt.SourceRecords()
packagelist = [
'adduser',
'apt',
'base-files',
'base-passwd',
'bash',
'bsdutils',
'coreutils',
'dash',
'debconf',
'debianutils',
'diffutils',
'dmsetup',
'dpkg',
'e2fslibs',
'e2fsprogs',
'findutils',
'gcc-4.9-base',
'gcc-5-base',
'gnupg',
'gpgv',
'grep',
'gzip',
'hostname',
'init',
'initscripts',
'insserv',
'libacl1',
'libapparmor1',
'libapt-pkg4.12',
'libattr1',
'libaudit-common',
'libaudit1',
'libblkid1',
'libbz2-1.0',
'libc-bin',
'libc6',
'libcap2',
'libcap2-bin',
'libcomerr2',
'libcryptsetup4',
'libdb5.3',
'libdebconfclient0',
'libdevmapper1.02.1',
'libgcc1',
'libgcrypt20',
'libgpg-error0',
'libkmod2',
'liblzma5',
'libmount1',
'libncurses5',
'libncursesw5',
'libpam-modules',
'libpam-modules-bin',
'libpam-runtime',
'libpam0g',
'libpcre3',
'libprocps3',
'libreadline6',
'libselinux1',
'libsemanage-common',
'libsemanage1',
'libsepol1',
'libslang2',
'libsmartcols1',
'libss2',
'libstdc++6',
'libsystemd0',
'libtinfo5',
'libudev1',
'libusb-0.1-4',
'libustr-1.0-1',
'libuuid1',
'locales',
'login',
'lsb-base',
'makedev',
'mawk',
'mount',
'multiarch-support',
'ncurses-base',
'ncurses-bin',
'passwd',
'perl-base',
'procps',
'readline-common',
'sed',
'sensible-utils',
'systemd',
'systemd-sysv',
'sysv-rc',
'sysvinit-utils',
'tar',
'tzdata',
'ubuntu-keyring',
'udev',
'util-linux',
'zlib1g']
def pkgs2dev (packagelist) :
devpackages = {}
for package in packagelist:
cand = depcache.get_candidate_ver(cache[package])
for file_list in cand.file_list:
if records.lookup(file_list):
srcpkg = records.source_pkg
if srcpkg is '':
srcpkg = package
if srcrecords.lookup(srcpkg):
for binpkgs in srcrecords.binaries:
if binpkgs in cache:
if cache[binpkgs].section in ['libdevel', 'devel']:
devpackages[binpkgs] = True
return devpackages.keys()
for pack in pkgs2dev(packagelist):
print(pack)
|