def gen_deps(objects_with_dependencies, dep_types):
    """
    Generate a dictionary name -> dependencies for the objects
    passed as parameters (projects or packages).
    """
    res = dict()
    for object_with_dependencies in objects_with_dependencies:
        deps = set()
        if "build" in dep_types:
            deps.update(object_with_dependencies.build_depends)
        if "runtime" in dep_types:
            deps.update(object_with_dependencies.run_depends)
        if "test" in dep_types:
            deps.update(object_with_dependencies.test_depends)
        res[object_with_dependencies.name] = deps
    return res