def get_proxy(): xml = config.get("xmlrpc", None) if xml is None: raise Exception("No xmlrpc found in slave yaml") proxy = xmlrpclib.ServerProxy( "http://{user}:{password}@{host}:{port}/".format( user=xml['user'], password=xml['password'], host=xml['host'], port=xml['port'], ), allow_none=True) return proxy
def prepare_binary_for_upload(changes, job): jobize(changes, job) gpg = config.get('gpg', None) if gpg is None: raise Exception("No GPG in config YAML") if changes.endswith(".dud"): out, err, ret = run_command(['gpg', '-u', gpg, '--clearsign', changes]) if ret != 0: print(out) print(err) raise Exception("bad clearsign") os.unlink(changes) os.rename("%s.asc" % (changes), changes) return else: out, err, ret = run_command(['debsign', '-k%s' % (gpg), changes]) if ret != 0: print(out) print(err) raise Exception("bad debsign") return
def get_proxy(): xml = config.get("xmlrpc", None) if xml is None: raise Exception("No xmlrpc found in slave yaml") proxy = xmlrpclib.ServerProxy( "http://{user}:{password}@{host}:{port}/".format( user=xml['user'], password=xml['password'], host=xml['host'], port=xml['port'], ), allow_none=True) try: proxy._non_existing_method() except xmlrpclib.Fault: # We should trigger this pass except socket.error: raise Exception( 'Connection to master failed. Check your "xmlrpc" settings.') return proxy
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)
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)
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)