You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.3 KiB
Python
55 lines
1.3 KiB
Python
12 years ago
|
#!/usr/bin/env python
|
||
|
|
||
|
import sys
|
||
|
from os import path
|
||
|
|
||
|
pym_path = path.join(path.dirname(path.realpath(__file__)), "portage", "pym")
|
||
|
sys.path.insert(0, pym_path)
|
||
|
|
||
|
from portage.versions import pkgsplit
|
||
|
|
||
|
if len(sys.argv) != 4:
|
||
|
print "usage: %s pkg_mapping debian_names gentoo_deps"%sys.argv[0]
|
||
|
exit(1)
|
||
|
|
||
|
deb2gen = dict()
|
||
|
gen2deb = dict()
|
||
|
with open(sys.argv[1]) as f:
|
||
|
for line in f:
|
||
|
d, g = line.strip().split('\t')
|
||
|
deb2gen[d] = g
|
||
|
gen2deb[g] = d
|
||
|
|
||
|
with open(sys.argv[2]) as f:
|
||
|
debian_names = [p[4:].strip() for p in f]
|
||
|
|
||
|
gentoo_deps = dict()
|
||
|
with open(sys.argv[3]) as f:
|
||
|
for line in f:
|
||
|
p = line.strip().split()
|
||
|
gentoo_deps[pkgsplit(p[1])[0]] = p[2:]
|
||
|
|
||
|
missing_deb_mappings = list()
|
||
|
missing_gen_mappings = list()
|
||
|
|
||
|
for d in debian_names:
|
||
|
g = deb2gen.get(d)
|
||
|
if g:
|
||
|
deps = gentoo_deps.get(g)
|
||
|
if deps:
|
||
|
ddeps = []
|
||
|
for p in deps:
|
||
|
r = gen2deb.get(p)
|
||
|
if r:
|
||
|
ddeps.append(r)
|
||
|
else:
|
||
|
missing_gen_mappings.append(p)
|
||
|
ddeps = list(set(ddeps))
|
||
|
if ddeps:
|
||
|
print d, ddeps
|
||
|
else:
|
||
|
missing_deb_mappings.append(d)
|
||
|
|
||
|
print list(set(missing_deb_mappings))
|
||
|
print list(set(missing_gen_mappings))
|