def get_source_locations(sources):
    """
    Returns a list of source URLs and refs, currently for
    git, tar and patch sources.

    :sources A list of BuildStream Sources
    """
    source_locations = []
    for source in sources:
        if source.get_kind() in ['git']:
            url = source.translate_url(source.mirror.url, alias_override=
                None, primary=source.mirror.primary)
            source_locations.append({'type': source.get_kind(), 'url': url,
                'commit': source.mirror.ref})
        if source.get_kind() in ['git_tag']:
            url = source.translate_url(source.mirror.url, alias_override=
                None, primary=source.mirror.primary)
            source_locations.append({'type': 'git', 'x-bst-kind': source.
                get_kind(), 'url': url, 'commit': source.mirror.ref})
        if source.get_kind() in ['patch']:
            patch = source.path.rpartition('/')[2]
            source_locations.append({'type': source.get_kind(), 'path': patch})
        if source.get_kind() in ['tar', 'zip']:
            source_locations.append({'type': 'archive', 'url': source.url,
                'sha256': source.ref})
    return source_locations
