def download_sourcecode()

in tools/build-release.py [0:0]


def download_sourcecode(base_path, repo_meta):
    # these two have been checked before we get here
    alias = repo_meta["alias"]
    name = repo_meta["name"]
    # make sure the rest is OK
    if "tag" not in repo_meta:
        fail("repository tag missing in repo list")
    tag = repo_meta["tag"]
    if "repository" not in repo_meta:
        fail("repository url missing in repo list")
    url = repo_meta["repository"]
    description = ""
    if "description" in repo_meta:
        description = repo_meta["description"]
    print("downloading source code")
    print("repository info:")
    print(" - repository:  %s" % url)
    print(" - description: %s" % description)
    print(" - tag:         %s" % tag)
    repo = git.Repo.clone_from(url=url, to_path=os.path.join(base_path, alias))
    repo.git.checkout(tag)
    tags = repo.tag("refs/tags/" + tag)
    sha = tags.commit.hexsha
    print(" - tag sha:     %s" % sha)

    # avoid pulling dependencies from github,
    # add replace to go mod files to make sure it builds locally
    update_dep_ref(name, os.path.join(base_path, alias))
    return sha