Esempio n. 1
0
def main(args, config, proxy):
    start_logging(args)

    # Reset the logging config in python-dput and use the global config instead
    dputlog = logging.getLogger('dput')
    dputlog.propagate = True
    dputlog.setLevel(logging.NOTSET)
    while len(dputlog.handlers) > 0:
        dputlog.removeHandler(dputlog.handlers[-1])

    signal.signal(signal.SIGQUIT, system_exit_handler)
    signal.signal(signal.SIGABRT, system_exit_handler)
    signal.signal(signal.SIGTERM, system_exit_handler)

    signal.signal(signal.SIGHUP,  signal.SIG_IGN)
    signal.signal(signal.SIGUSR1, shutdown_request_handler)

    suites = config['suites']
    components = config['components']
    arches = config['arches']
    checks = config.get('checks', list(PLUGINS.keys()))

    while True:
        try:
            with workon(proxy, suites, components, arches, checks) as job:
                run_job(config, job)
            if shutdown_request:
                raise SystemExit(0)
        except KeyboardInterrupt:
            raise SystemExit(1)
        except SystemExit:
            raise
        except:
            if shutdown_request:
                raise SystemExit(0)
            time.sleep(60)
Esempio n. 2
0
def main(args, config, proxy):
    start_logging(args)

    # Reset the logging config in python-dput and use the global config instead
    dputlog = logging.getLogger('dput')
    dputlog.propagate = True
    dputlog.setLevel(logging.NOTSET)
    while len(dputlog.handlers) > 0:
        dputlog.removeHandler(dputlog.handlers[-1])

    signal.signal(signal.SIGQUIT, system_exit_handler)
    signal.signal(signal.SIGABRT, system_exit_handler)
    signal.signal(signal.SIGTERM, system_exit_handler)

    signal.signal(signal.SIGHUP,  signal.SIG_IGN)
    signal.signal(signal.SIGUSR1, shutdown_request_handler)

    suites = config['suites']
    components = config['components']
    arches = config['arches']
    checks = config.get('checks', list(PLUGINS.keys()))

    while True:
        try:
            with workon(proxy, suites, components, arches, checks) as job:
                run_job(config, job)
            if shutdown_request:
                raise SystemExit(0)
        except KeyboardInterrupt:
            raise SystemExit(1)
        except SystemExit:
            raise
        except:
            if shutdown_request:
                raise SystemExit(0)
            time.sleep(60)
Esempio n. 3
0
def iterate():
    arches = config["arches"]
    suites = config["suites"]
    checks = config.get("checks", list(PLUGINS.keys()))

    # job is a serialized dictionary from debile-master ORM
    with workon(suites, arches, checks) as job:
        if job is None:
            raise IDidNothingError("No more jobs")

        source = proxy.get_source(job["source_id"])

        package = {
            "name": source["name"],
            "version": source["version"],
            "type": "source",
            "arch": "all",
            "source": source,
            "binary": None,
        }

        if job["binary_id"]:
            binary = proxy.get_binary(job["binary_id"])
            package = {
                "name": binary["name"],
                "version": binary["version"],
                "type": "binary",
                "arch": binary["arch"],
                "source": source,
                "binary": binary,
            }

        with checkout(job, package) as check:
            run, version = load_module(job["name"])
            firehose = create_firehose(package, version)

            type_ = package["type"]
            if type_ == "source":
                target = check  # Only get one.
            elif type_ == "binary":
                target = check  # tons and tons
            else:
                raise Exception("Unknown type")

            firehose, log, failed, changes = run(target, package, job, firehose)

            prefix = "%s" % (str(job["id"]))

            dudf = "{prefix}.dud".format(prefix=prefix)
            dud = Dud_()
            dud["Created-By"] = "Dummy Entry <*****@*****.**>"
            dud["Source"] = package["source"]["name"]
            dud["Version"] = package["source"]["version"]
            dud["Architecture"] = package["arch"]
            dud["X-Debile-Failed"] = "Yes" if failed else "No"
            if type_ == "binary":
                dud["Binary"] = package["binary"]["name"]

            job["failed"] = failed

            with open("{prefix}.firehose.xml".format(prefix=prefix), "wb") as fd:
                fd.write(firehose.to_xml_bytes())

            dud.add_file("{prefix}.firehose.xml".format(prefix=prefix))

            with open("{prefix}.log".format(prefix=prefix), "wb") as fd:
                fd.write(log.encode("utf-8"))

            dud.add_file("{prefix}.log".format(prefix=prefix))

            with open(dudf, "w") as fd:
                dud.dump(fd=fd)

            if changes:
                upload(changes, job, package)

            upload(dudf, job, package)
Esempio n. 4
0
def iterate():
    arches = config['arches']
    suites = config['suites']
    components = config['components']
    checks = config.get('checks', list(PLUGINS.keys()))

    # job is a serialized dictionary from debile-master ORM
    with workon(suites, components, arches, checks) as job:
        if job is None:
            raise IDidNothingError("No more jobs")

        group = proxy.get_group(job['group_id'])
        source = proxy.get_source(job['source_id'])
        binary = proxy.get_binary(job['binary_id']) if job['binary_id'] else None

        package = {
            "name": source['name'],
            "version": source['version'],
            "type": "source" if binary is None else "binary",
            "arch": "all" if binary is None else binary['arch'],
            "suite": source['suite'],
            "component": source['component'],
            "group": group,
            "source": source,
            "binary": binary,
        }

        with checkout(job, package) as check:
            run, version = load_module(job['check'])
            firehose = create_firehose(package, version)

            type_ = package['type']
            if type_ == "source":
                target = check  # Only get one.
            elif type_ == "binary":
                target = check  # tons and tons
            else:
                raise Exception("Unknown type")

            firehose, log, failed, changes = run(
                target, package, job, firehose)

            prefix = "%s" % (str(job['id']))

            dudf = "{prefix}.dud".format(prefix=prefix)
            dud = Dud_()
            dud['Created-By'] = "Dummy Entry <*****@*****.**>"
            dud['Source'] = package['source']['name']
            dud['Version'] = package['source']['version']
            dud['Architecture'] = package['arch']
            dud['X-Debile-Failed'] = "Yes" if failed else "No"
            if type_ == 'binary':
                dud['Binary'] = package['binary']['name']

            job['failed'] = failed

            with open('{prefix}.firehose.xml'.format(
                    prefix=prefix), 'wb') as fd:
                fd.write(firehose.to_xml_bytes())

            dud.add_file('{prefix}.firehose.xml'.format(prefix=prefix))

            with open('{prefix}.log'.format(prefix=prefix), 'wb') as fd:
                fd.write(log.encode('utf-8'))

            dud.add_file('{prefix}.log'.format(prefix=prefix))

            with open(dudf, 'w') as fd:
                dud.dump(fd=fd)

            if changes:
                upload(changes, job, package)
            upload(dudf, job, package)
Esempio n. 5
0
def iterate():
    arches = config['arches']
    suites = config['suites']
    checks = config.get('checks', list(PLUGINS.keys()))

    # job is a serialized dictionary from debile-master ORM
    with workon(suites, arches, checks) as job:
        if job is None:
            raise IDidNothingError("No more jobs")

        source = proxy.get_source(job['source_id'])

        package = {
            "name": source['name'],
            "version": source['version'],
            "type": "source",
            "arch": "all",
            "source": source,
            "binary": None,
        }

        if job['binary_id']:
            binary = proxy.get_binary(job['binary_id'])
            package = {
                "name": binary['name'],
                "version": binary['version'],
                "type": "binary",
                "arch": binary['arch'],
                "source": source,
                "binary": binary,
            }

        with checkout(job, package) as check:
            run, version = load_module(job['name'])
            firehose = create_firehose(package, version)

            type_ = package['type']
            if type_ == "source":
                target = check  # Only get one.
            elif type_ == "binary":
                target = check  # tons and tons
            else:
                raise Exception("Unknown type")

            firehose, log, failed, changes = run(
                target, package, job, firehose)

            prefix = "%s" % (str(job['id']))

            dudf = "{prefix}.dud".format(prefix=prefix)
            dud = Dud_()
            dud['Created-By'] = "Dummy Entry <*****@*****.**>"
            dud['Source'] = package['source']['name']
            dud['Version'] = package['source']['version']
            dud['Architecture'] = package['arch']
            dud['X-Debile-Failed'] = "Yes" if failed else "No"
            if type_ == 'binary':
                dud['Binary'] = package['binary']['name']

            job['failed'] = failed

            with open('{prefix}.firehose.xml'.format(
                    prefix=prefix), 'wb') as fd:
                fd.write(firehose.to_xml_bytes())

            dud.add_file('{prefix}.firehose.xml'.format(prefix=prefix))

            with open('{prefix}.log'.format(prefix=prefix), 'wb') as fd:
                fd.write(log.encode('utf-8'))

            dud.add_file('{prefix}.log'.format(prefix=prefix))

            with open(dudf, 'w') as fd:
                dud.dump(fd=fd)

            if changes:
                upload(changes, job, package)
            upload(dudf, job, package)