1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/usr/bin/python import portage allpkgs=portage.db["/"]["porttree"].dbapi.cp_all() bestpkgs={} mycount=0 for x in allpkgs: if x not in list(bestpkgs.keys()): y=portage.db["/"]["porttree"].dbapi.xmatch("bestmatch-visible", x) bestpkgs[x]=y if y=="": continue xs=portage.pkgsplit(bestpkgs[x]) print('%s %s %s' % (xs[0].split("/")[1], xs[1], bestpkgs[x])) mycount+=1