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

main
josch 12 years ago
parent 97baa850c3
commit 70659ae66b

@ -6,8 +6,6 @@
* software in Debian that's not in Gentoo * software in Debian that's not in Gentoo
* different source package splittings * different source package splittings
* disjunctive dependencies not handled yet * 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 * many direct build dependencies of gentoo packages do not appear in debian
source packages as they are indirectly pulled in source packages as they are indirectly pulled in
* gentoo packages directly depend on build-essential or essential packages * gentoo packages directly depend on build-essential or essential packages

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

Loading…
Cancel
Save