def accept_binary(config, changes): key = changes.validate_signature() arch = changes['Architecture'] if " " in arch: arches = set(arch.split(" ")) if "all" in arches: arches.remove("all") arches = list(arches) if len(arches) != 1: return reject(config, changes, 'too-many-arches') arch = changes._data['Architecture'] = arches[0] suite = changes['Distribution'] binaries = changes.get_files() try: job = changes['x-lucy-job'] except KeyError: return reject(config, changes, 'no-job') try: job = Job.load(job) except KeyError: return reject(config, changes, 'invalid-job') try: buildd = Machine.get_by_key(key) except KeyError: return reject(config, changes, 'youre-not-a-machine') binary = Binary(job=job['_id'], arch=arch, suite=suite, binaries=[os.path.basename(x) for x in binaries], builder=buildd['_id']) binary.save() add_jobs(binary, 'binary', config, 'binary', changes) path = move_to_pool(config, binary['source'], changes, root=arch) os.unlink(changes.get_filename()) print("accept binary")
def get_binary_package(self, package): """ Get the DB entry for the binary package. Return None if it doesn't exist. """ try: return dict(Binary.load(package)) except KeyError: return None
def get_deb_info(self, package): """ Get a list of .debs for the given Binary package, otherwise None. """ pkg = Binary.load(package) source = pkg.get_source() public = config['public'] root = "{public}/{pool}/{arch}".format( public=public, pool=source['path'], arch=pkg['arch'], ) return {"root": root, "packages": pkg['binaries']}