示例#1
0
文件: incoming.py 项目: paultag/lucy
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")
示例#2
0
文件: server.py 项目: paultag/lucy
 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
示例#3
0
文件: server.py 项目: paultag/lucy
 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
示例#4
0
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")
示例#5
0
文件: server.py 项目: paultag/lucy
    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']}
示例#6
0
文件: server.py 项目: paultag/lucy
    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']}