Created
August 20, 2010 20:55
-
-
Save ekohl/541167 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from BeautifulSoup import BeautifulSoup | |
import portage | |
import urllib2 | |
url = 'http://www.gentoo.org/proj/en/qa/treecleaners/maintainer-needed.xml' | |
# Build a to remove set | |
f = urllib2.urlopen(url) | |
soup = BeautifulSoup(f.read()) | |
table = soup.first('table', {'class': 'ntable'}) | |
toremove = set(row.findChild('a').text for row in table.findChildren('tr')[1:]) | |
f.close() | |
# Build an installed set | |
vartree = portage.db[portage.root]['vartree'] | |
installed = set(vartree.dbapi.cp_all()) | |
# Print installed, but to be removed | |
packages = sorted(toremove.intersection(installed)) | |
if packages: | |
print "The following %d installed package(s) need a maintainer" % len(packages) | |
for package in packages: | |
print "-", package | |
exit(1) | |
else: | |
print "All installed packages have a maintainer :)" | |
exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment