示例#1
0
def accept_source(config, changes):
    key = changes.validate_signature()

    try:
        who = User.get_by_key(key)
    except KeyError:
        return reject(changes, config, 'bad-user-account')

    dsc = os.path.basename(changes.get_dsc())

    group = None
    if 'X-Lucy-Group' in changes:
        group = changes['X-Lucy-Group']

    obj = Source(source=changes['source'],
                 version=changes['version'],
                 owner=who['_id'],
                 group=group,
                 dsc=dsc)
    obj.save()

    path = move_to_pool(config, obj['_id'], changes)
    os.unlink(changes.get_filename())

    obj['path'] = path
    obj.save()

    print("ACCEPT: {source}/{version} for {owner} as {_id}".format(**obj))
    #send_mail("ACCEPTED: {source}/{version} for {owner} as {_id}".format(
    #    **obj), who['email'], "ACCEPTED!")

    add_jobs(obj, 'source', config, 'source', changes)
示例#2
0
文件: incoming.py 项目: paultag/lucy
def accept_source(config, changes):
    key = changes.validate_signature()

    try:
        who = User.get_by_key(key)
    except KeyError:
        return reject(changes, config, 'bad-user-account')

    dsc = os.path.basename(changes.get_dsc())

    group = None
    if 'X-Lucy-Group' in changes:
        group = changes['X-Lucy-Group']

    obj = Source(source=changes['source'],
                 version=changes['version'],
                 owner=who['_id'],
                 group=group,
                 dsc=dsc)
    obj.save()

    path = move_to_pool(config, obj['_id'], changes)
    os.unlink(changes.get_filename())

    obj['path'] = path
    obj.save()

    print("ACCEPT: {source}/{version} for {owner} as {_id}".format(**obj))
    #send_mail("ACCEPTED: {source}/{version} for {owner} as {_id}".format(
    #    **obj), who['email'], "ACCEPTED!")

    add_jobs(obj, 'source', config, 'source', changes)
示例#3
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")
示例#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")