Set a variable in the make.conf

    Return a dict containing the new value for variable::

        {'<variable>': {'old': '<old-value>',
                        'new': '<new-value>'}}

    CLI Example:

    .. code-block:: bash

        salt '*' makeconf.set_var 'LINGUAS' 'en'

def set_var(var, value):
    '''
    Set a variable in the make.conf

    Return a dict containing the new value for variable::

        {'<variable>': {'old': '<old-value>',
                        'new': '<new-value>'}}

    CLI Example:

    .. code-block:: bash

        salt '*' makeconf.set_var 'LINGUAS' 'en'
    '''
    makeconf = _get_makeconf()

    old_value = get_var(var)

    # If var already in file, replace its value
    if old_value is not None:
        __salt__['file.sed'](
            makeconf, '^{0}=.*'.format(var), '{0}="{1}"'.format(var, value)
        )
    else:
        _add_var(var, value)

    new_value = get_var(var)
    return {var: {'old': old_value, 'new': new_value}}