Created
March 17, 2012 21:13
-
-
Save shadeslayer/2065358 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/env python | |
import sys, re, subprocess, argparse, urllib2, StringIO, gzip, tempfile | |
from itertools import islice | |
from launchpadlib.launchpad import Launchpad | |
def get_http_gzip(url): | |
f = urllib2.urlopen(url) | |
compresseddata = f.read() | |
compressedstream = StringIO.StringIO(compresseddata) | |
gzipper = gzip.GzipFile(fileobj=compressedstream) | |
return gzipper.read() | |
lp = Launchpad.login_anonymously("kubuntu-parse-build-log", "production") | |
ubuntu = lp.distributions["ubuntu"] | |
series = ubuntu.current_series | |
ppa = 'ppa:neon/ppa' | |
log = tempfile.NamedTemporaryFile() | |
if not ppa.find(':') > 0 or not ppa.find('/') > 0: | |
parser.error('Invalid ppa syntax [%s], needs to be in ppa:<owner>/<ppa> form.' % ppa) | |
owner = ppa[ppa.find(':') + 1:ppa.find('/')] | |
PPA = ppa[ppa.find('/') + 1:] | |
lp_PPA = lp.people[owner].getPPAByName(name=PPA) | |
for source in lp_PPA.getPublishedSources(distro_series=series, status='Published'): | |
print('Now inspecting %s' % source.source_package_name) | |
build = source.getBuilds()[0] | |
buff = get_http_gzip(build.build_log_url) | |
if (re.search("Configuring done", buff) != None): | |
ret = re.findall("-{77}\n-- .*Configuring done", buff, re.DOTALL) | |
if ret: | |
print ret[0] | |
else: | |
# cmake package, but without summary | |
print ('\n'.join(re.findall("Could NOT find.*", buff))) | |
else: | |
ret = re.findall("CMake .*-- Configuring[^\n]*", buff, re.DOTALL) | |
if ret: | |
print ret[0] | |
else: | |
print ("Not a cmake package") | |
print("All Done") | |
sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment