allow mapping of debian/gentoo packages to multiple gentoo/debian packages

This commit is contained in:
josch 2012-10-08 09:27:13 +02:00
parent 97baa850c3
commit 70659ae66b
2 changed files with 17 additions and 11 deletions

2
BUGS
View file

@ -6,8 +6,6 @@
* software in Debian that's not in Gentoo
* different source package splittings
* disjunctive dependencies not handled yet
* how to handle virtual/* gentoo packages?
* no mapping to multiple packets yet
* many direct build dependencies of gentoo packages do not appear in debian
source packages as they are indirectly pulled in
* gentoo packages directly depend on build-essential or essential packages

View file

@ -43,14 +43,19 @@ def flatten(l):
l[0:1] = l[0]
if l: yield l.pop(0)
# TODO: what about mapping to multiple packets?
deb2gen = dict()
gen2deb = dict()
with open("./deb2gen_mapping.list") as f:
for line in f:
d, g = line.strip().split('\t')
deb2gen[d] = g
gen2deb[g] = d
if deb2gen.get(d):
deb2gen[d].append(g)
else:
deb2gen[d] = [g]
if gen2deb.get(g):
gen2deb[g].append(d)
else:
gen2deb[g] = [d]
with open("./deb_source_pkgs.list") as f:
debian_names = [p[4:].strip() for p in f]
@ -80,10 +85,11 @@ for cat in os.listdir(portdir):
# only grab newest package
pkg, ver, rev = sorted(pkgs, key=cmp_to_key(pkgcmp), reverse=True)[0]
deb = gen2deb.get("%s/%s"%(cat, pkg))
deb = gen2deb.get("%s/%s"%(cat, pkg), [])
# assure that the package is relevant
if deb not in debian_names:
cont = [d for d in deb if d in debian_names]
if not cont:
continue
pkgnames.append((cat, pkg, ver, rev))
@ -143,7 +149,7 @@ for i, (cat, pkg, ver, rev) in enumerate(pkgnames):
missing_gen_mappings.append(p)
continue
ddeps.append(r)
ddeps.extend(r)
debian_deps["%s/%s"%(cat,pkg)] = list(set(ddeps))
count +=1
@ -175,7 +181,9 @@ for d in debian_names:
continue
# get the droppable dependencies
deps = debian_deps.get(g)
deps = []
for r in g:
deps.extend(debian_deps.get(r, []))
if not deps:
continue
@ -188,10 +196,10 @@ for d in debian_names:
for r in deps:
# convert source package to binary packages
# only retain those binary packages that are a build dependency
bindeps.extend([p for p in src2bin[r] if p in pdeps])
bindeps.extend([p for p in src2bin.get(r, []) if p in pdeps])
if bindeps:
print d, bindeps
print "src:%s %s"%(d, " ".join(bindeps))
print list(set(missing_deb_mappings))
print list(set(missing_gen_mappings))