Exemplo n.º 1
0
def blocks_process(hive_holder, biiout):
    """ This function processes the edition blocks of the hive, nothing related with deps.
    It searches resolved-unresolved between edition blocks.
    param hive_holder: current HiveHolder
    param processor_changes: ProcessorChanges to annotate changes done during process
    param biiout: biiout
    """

    logger.debug("---------- process blocks --------")

    settings = hive_holder.settings
    langs = [lang for lang in ['arduino', 'fortran', 'python']
             if getattr(settings, lang, None)]
    block_processor = BlockProcessor(langs)
    for block_holder in hive_holder.block_holders:
        changevalidator.check_block_size(block_holder, biiout)
        block_processor.process(block_holder, biiout)
Exemplo n.º 2
0
def blocks_process(hive_holder, processor_changes, biiout):
    """ This function processes the edition blocks of the hive, nothing related with deps.
    It searches resolved-unresolved between edition blocks.
    param hive_holder: current HiveHolder
    param processor_changes: ProcessorChanges to annotate changes done during process
    param biiout: biiout
    """
    assert isinstance(processor_changes, ProcessorChanges)

    logger.debug("---------- process blocks --------")

    settings = hive_holder.hive.settings
    langs = [
        lang for lang in ['arduino', 'fortran', 'python']
        if getattr(settings, lang, None)
    ]
    block_processor = BlockProcessor(langs)
    for block_holder in hive_holder.block_holders:
        changevalidator.check_block_size(block_holder, biiout)
        block_processor.process(block_holder, processor_changes, biiout)
Exemplo n.º 3
0
def build_publish_request(biiapi, hive_holder, block_name, tag, msg,
                          versiontag, origin, biiout):
    block_name, dep_block_names = _check_input(hive_holder, block_name)
    _check_dep_blocks(biiapi, hive_holder, dep_block_names, biiout)
    block_holder = hive_holder[block_name]
    if not changevalidator.check_block_size(block_holder, biiout):
        raise PublishException("Block is too large to be published")

    parent = block_holder.parent
    _check_possible(parent, biiapi, biiout)

    if parent.time != -1:  # Update
        remote_block_holder = biiapi.get_block_holder(parent)
        base_resources = remote_block_holder.resources
        parent_delta_info = biiapi.get_version_delta_info(parent)
    else:  # New block
        base_resources = None
        parent_delta_info = None
        remote_block_holder = None

    changes = compare(base_resources, block_holder.resources)
    if not block_changed(changes, block_holder, remote_block_holder):
        if parent_delta_info and tag > parent_delta_info.tag:
            biiout.info('No changes, promoting tag %s -> %s' % (parent_delta_info.tag, tag))
            changes.modified.pop(BIICODE_FILE, None)
        else:
            raise UpToDatePublishException("Up to date, nothing to publish")
    changes.deduce_renames()

    request = PublishRequest()
    request.parent = parent
    request.changes = changes
    if parent_delta_info:
        request.parent_time = parent_delta_info.date
    assert all(bv.time is not None for bv in block_holder.requirements.itervalues())
    request.deptable = block_holder.requirements
    request.tag = tag
    request.msg = msg
    request.versiontag = versiontag
    request.origin = origin
    return request
Exemplo n.º 4
0
def build_publish_request(biiapi, hive_holder, block_name, tag, msg,
                          versiontag, origin, biiout):
    block_name, dep_block_names = _check_input(hive_holder, block_name)
    _check_dep_blocks(biiapi, hive_holder, dep_block_names, biiout)
    block_holder = hive_holder[block_name]
    if not changevalidator.check_block_size(block_holder, biiout):
        raise PublishException("Block is too large to be published")

    parent = block_holder.parent
    _check_possible(parent, biiapi, biiout)

    if parent.time != -1:  # Update
        remote_block_holder = biiapi.get_block_holder(parent)
        base_resources = remote_block_holder.resources
        parent_delta_info = biiapi.get_version_delta_info(parent)
    else:  # New block
        base_resources = None
        parent_delta_info = None
        remote_block_holder = None

    changes = compare(base_resources, block_holder.resources)
    if not block_changed(changes, block_holder, remote_block_holder):
        if parent_delta_info and tag > parent_delta_info.tag:
            biiout.info('No changes, promoting tag %s -> %s' % (parent_delta_info.tag, tag))
            changes.modified.pop(BIICODE_FILE, None)
        else:
            raise UpToDatePublishException("Up to date, nothing to publish")
    changes.deduce_renames()

    request = PublishRequest()
    request.parent = parent
    request.changes = changes
    if parent_delta_info:
        request.parent_time = parent_delta_info.date
    assert all(bv.time is not None for bv in block_holder.requirements.itervalues())
    request.deptable = block_holder.requirements
    request.tag = tag
    request.msg = msg
    request.versiontag = versiontag
    request.origin = origin
    return request