コード例 #1
0
def test_parse_git_repo_from_git_url():
    flexmock(local_project).should_receive("get_repo").with_args(
        "http://some.example/url/reponame"
    ).and_return(flexmock())
    project = LocalProject(git_url="http://some.example/url/reponame", refresh=False)
    changed = project._parse_git_repo_from_git_url()

    assert changed
    assert project.git_url
    assert project.git_repo
    assert project.working_dir_temporary

    project.working_dir_temporary = False
コード例 #2
0
ファイル: test_local_project.py プロジェクト: rpitonak/packit
def test_local_project_clone():
    flexmock(local_project).should_receive("get_repo").with_args(
        "http://some.example/url").and_return(
            flexmock(working_dir="some/example/path", active_branch="branch"))

    project = LocalProject(git_url="http://some.example/url")

    assert project.git_url
    assert project.git_repo
    assert project.branch == "branch"
    assert project.working_dir_temporary

    project.working_dir_temporary = False
コード例 #3
0
def sg2srpm(config, dest_dir, upstream_ref, version, repo):
    """
    Generate a srpm from packit.

    This script is meant to accept a source git repo with a branch as an input and produce a SRPM.

    It is expected to do this:

    1. clone the repo

    2. create archive out of the sources

    3. create SRPM
    """

    package_config = get_local_package_config()
    sourcegit = LocalProject(git_url=repo)
    if not package_config:
        package_config = get_local_package_config(directory=sourcegit.working_dir)

    distgit = LocalProject(
        git_url=package_config.metadata["dist_git_url"],
        namespace="rpms",
        repo_name=package_config.metadata["package_name"],
        working_dir=dest_dir,
    )

    distgit.working_dir_temporary = False
    with Transformator(
        sourcegit=sourcegit,
        distgit=distgit,
        version=version,
        fas_username=config.fas_user,
        package_config=package_config,
    ) as t:
        t.download_upstream_archive()
        t.copy_synced_content_to_distgit_directory(
            synced_files=package_config.synced_files
        )
        patches = t.create_patches(upstream=upstream_ref)
        t.add_patches_to_specfile(patch_list=patches)
        srpm = t.create_srpm()
        click.echo(srpm)