Add an XBPS repository to the system.

    repo
        url of repo to add (persistent).

    conffile
        path to xbps conf file to add this repo
        default: /usr/share/xbps.d/15-saltstack.conf

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.add_repo <repo url> [conffile=/path/to/xbps/repo.conf]

def add_repo(repo, conffile='/usr/share/xbps.d/15-saltstack.conf'):
    '''
    Add an XBPS repository to the system.

    repo
        url of repo to add (persistent).

    conffile
        path to xbps conf file to add this repo
        default: /usr/share/xbps.d/15-saltstack.conf

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.add_repo <repo url> [conffile=/path/to/xbps/repo.conf]
    '''

    if not _locate_repo_files(repo):
        try:
            with salt.utils.files.fopen(conffile, 'a+') as conf_file:
                conf_file.write(
                    salt.utils.stringutils.to_str(
                        'repository={0}\n'.format(repo)
                    )
                )
        except IOError:
            return False

    return True