How to use the conan.utils.merge_update_mappings function in conan

To help you get started, we’ve selected a few conan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nexB / conan / src / conan / image_v11.py View on Github external
# 1. build mapping for clustering
        by_digest = defaultdict(list)
        for layer in layers:
            by_digest[layer.layer_digest].append(layer)

        # layers with no digest or an empty digest are not merged (though
        # they could in the future using attribute similarities)
        merged.update(by_digest.pop(None, []))
        merged.update(by_digest.pop('', []))

        for similar_layers in by_digest.values():
            if len(similar_layers) == 1:
                merged.update(similar_layers)
            merged_layer = similar_layers.pop()
            for simi_layer in similar_layers:
                merged_layer, warns = merge_update_mappings(merged_layer, simi_layer)
                warnings.extend(warns)
            merged.append(merged_layer)

        return merged, warnings
github nexB / conan / src / conan / image_v11.py View on Github external
def merge_configs(container_config, config):
    """
    Merge and return a new mapping from the container_config and config Docker
    mappings. These two mappings have the same shape but may not contain the same
    data exactly: we need to keep only one of these.

    We give priority to the container_config which represent the configuration
    (including the command) used to create a layer originally. These config mappings
    are present in a layer "json" file (legacy v1.0) and in the image config json
    file (v1.1/v1.2).
    """
    return merge_update_mappings(container_config, config, mapping=OrderedDict)