#!/usr/bin/env python

import os
os.environ["PORTDIR_OVERLAY"] = ""
import portage

aux_keys = ["LICENSE", "RESTRICT", "SRC_URI"]
mirror = "mirror"
fetch = "fetch"
for cp in portage.portdb.cp_all():
	for cpv in portage.portdb.cp_list(cp):
		lic, restrict, src_uri = portage.portdb.aux_get(cpv, aux_keys)
		if mirror in restrict and fetch in restrict:
			print cp, lic, src_uri
			break
