def _process_name_values(name_values):
    """Converts input parameters to a config map

    >>> _process_name_values(['build_threads=4', 'jana', 'branch=greenfield',  'build_threads=1'])
    {'global': {'build_threads': '4'}, 'jana': {'branch': 'greenfield', 'build_threads': '1'}}

    """
    context = 'global'
    result = {context: {}}
    for name_value in name_values:
        if '=' in name_value:
            name, value = tuple(name_value.split('=', 1))
            result[context][name] = value
        else:
            context = name_value
            keys = list(result)
            if context not in keys:
                result[context] = {}
    keys = list(result)
    for key in keys:
        if not result[key]:
            del result[key]
    return result
