Example #1
0
    def deserialize(buildobj, args):
        if buildobj['type'] == 'compile':
            # See https://github.com/mozilla/areweslimyet/issues/47
            raise Exception("Build type 'compile' is not currently supported")
        elif buildobj['type'] == 'tinderbox':
            build = BuildGetter.TinderboxBuild(buildobj['timestamp'],
                                               buildobj['branch'])
        elif buildobj['type'] == 'nightly':
            build = BuildGetter.NightlyBuild(
                parse_nightly_time(buildobj['for']))
        elif buildobj['type'] == 'ftp':
            build = BuildGetter.FTPBuild(buildobj['path'])
        elif buildobj['type'] == 'try':
            build = BuildGetter.TryBuild(buildobj['changeset'])
        else:
            raise Exception("Unkown build type %s" % buildobj['type'])

        ret = BatchBuild(build, buildobj['revision'])
        ret.series = buildobj['series']
        ret.uid = buildobj['uid']
        ret.timestamp = buildobj['timestamp']
        ret.note = buildobj['note']
        ret.started = buildobj['started']
        ret.finished = buildobj['finished']
        ret.force = buildobj['force']

        return ret
Example #2
0
    def _process_batch_inner(globalargs, batchargs, hook):
        if not batchargs['firstbuild']:
            raise Exception("--firstbuild is required")

        mode = batchargs['mode']
        dorange = 'lastbuild' in batchargs and batchargs['lastbuild']
        builds = []
        # Queue builds
        if mode == 'nightly':
            startdate = parse_nightly_time(batchargs['firstbuild'])
            if dorange:
                enddate = parse_nightly_time(batchargs['lastbuild'])
                dates = range(startdate.toordinal(), enddate.toordinal() + 1)
            else:
                dates = [startdate.toordinal()]
            for x in dates:
                builds.append(
                    BuildGetter.NightlyBuild(datetime.date.fromordinal(x)))
        elif mode == 'tinderbox':
            startdate = float(batchargs['firstbuild'])
            if dorange:
                enddate = float(batchargs['lastbuild'])
                tinderbuilds = BuildGetter.list_tinderbox_builds(
                    startdate, enddate)
                for x in tinderbuilds:
                    builds.append(BuildGetter.TinderboxBuild(x))
            else:
                builds.append(BuildGetter.TinderboxBuild(startdate))
        elif mode == 'ftp':
            path = batchargs['firstbuild']
            builds.append(BuildGetter.FTPBuild(path))
        elif mode == 'try':
            path = batchargs['firstbuild']
            builds.append(BuildGetter.TryBuild(path))
        elif mode == 'compile':
            # See https://github.com/mozilla/areweslimyet/issues/47
            raise Exception("Build type 'compile' is not currently supported")
        else:
            raise Exception("Unknown mode %s" % mode)

        readybuilds = []
        skippedbuilds = []
        force = batchargs.get('force') if batchargs.get(
            'force') else globalargs.get('force')
        for build in builds:
            rev = build.get_revision()
            #HACKITY HACK HACK HACK
            build._scraper = None

            build = BatchBuild(build, rev)
            build.force = force
            build.series = batchargs.get('series')
            if not build.build.get_valid():
                # Can happen with FTP builds we failed to lookup on ftp.m.o, or any
                # builds that arn't found in pushlog
                build.note = "Build is not found or missing from pushlog"
            elif hook and not hook.should_test(build, globalargs):
                if not build.note:
                    build.note = "Build skipped by tester"
            else:
                readybuilds.append(build)
                continue

            build.finished = time.time()
            skippedbuilds.append(build)

        return [readybuilds, skippedbuilds]