Ubuntu Pastebin

Paste from cjwatson at Sun, 31 Jan 2016 00:44:51 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! /usr/bin/python

from __future__ import print_function

from contextlib import closing
import datetime
from gzip import GzipFile
from io import BytesIO
from optparse import OptionParser
from urllib2 import urlopen

from launchpadlib.launchpad import Launchpad
import wadllib


parser = OptionParser()
parser.add_option(
    "-l", "--launchpad", dest="launchpad_instance", default="production")
options, _ = parser.parse_args()

earliest = datetime.datetime(
    2015, 12, 27, 0, 0, 0, 0, tzinfo=wadllib.iso_strptime.TimeZone("+00:00"))
launchpad = Launchpad.login_with(
    "builder-history", options.launchpad_instance, version="devel")
for builder in launchpad.builders:
#    if builder.virtualized:
#        continue
    if not any(p.endswith("i386") for p in builder.processors):
        continue
    print(builder.name)
    for build in builder.getBuildRecords(build_state="Failed to build"):
        if build.date_started < earliest:
            break
        if build.arch_tag != "i386":
            continue
        if build.can_be_retried:
            print(build.web_link)
            try:
                build.retry()
            except Exception as e:
                print(e)
#            with closing(urlopen(build.build_log_url)) as comp_log:
#                with closing(BytesIO(comp_log.read())) as comp_bytes:
#                    with closing(GzipFile(fileobj=comp_bytes)) as log:
#                        for line in log:
#                            if "Fail-Stage: init" in line:
#                                print("to retry: %s" % build.web_link)
#                                try:
#                                    build.retry()
#                                except Exception as e:
#                                    print(e)
#                                break
Download as text