Пример #1
0
def test_set_spec_ver_empty_changelog(tmpdir):
    t = Path(str(tmpdir))

    u_remote_path = t / "upstream_remote"
    u_remote_path.mkdir(parents=True, exist_ok=True)

    subprocess.check_call(["git", "init", "--bare", "."], cwd=u_remote_path)

    u = t / "upstream_git"
    shutil.copytree(EMPTY_CHANGELOG, u)
    initiate_git_repo(u, tag="0.1.0")

    with cwd(tmpdir):
        c = get_test_config()

        pc = get_local_package_config(str(u))
        pc.upstream_project_url = str(u)
        lp = LocalProject(working_dir=str(u))

        ups = Upstream(c, pc, lp)

    new_ver = "1.2.3"
    ups.set_spec_version(version=new_ver, changelog_entry="- asdqwe")

    assert ups.get_specfile_version() == new_ver
    assert "%changelog" not in u.joinpath("beer.spec").read_text()
Пример #2
0
def example_repo(request, tmpdir):
    example_path, tag, remote = request.param
    t = Path(str(tmpdir))
    u = t / "up"
    initiate_git_repo(u,
                      tag=tag,
                      copy_from=example_path,
                      upstream_remote=remote)
    return u
Пример #3
0
def upstream_and_remote(tmpdir) -> Tuple[Path, Path]:
    t = Path(str(tmpdir))

    u_remote_path = t / "upstream_remote"
    u_remote_path.mkdir(parents=True, exist_ok=True)
    subprocess.check_call(["git", "init", "--bare", "."], cwd=u_remote_path)

    u = t / "upstream_git"
    shutil.copytree(UPSTREAM, u)
    initiate_git_repo(u, tag="0.1.0", push=True, upstream_remote=str(u_remote_path))

    return u, u_remote_path
Пример #4
0
def cockpit_ostree(tmpdir, upstream_without_config):
    t = Path(str(tmpdir))

    u = t / "up"
    initiate_git_repo(u, tag="179", copy_from=UP_COCKPIT_OSTREE)

    flexmock(utils, get_namespace_and_repo_name=lambda url: ("asd", "qwe"))
    d = t / "dg"
    d.mkdir()
    initiate_git_repo(d, upstream_remote=upstream_without_config, push=True)

    shutil.copy2(UP_COCKPIT_OSTREE / "cockpit-ostree.spec.dg",
                 d / "cockpit-ostree.spec")

    return u, d
Пример #5
0
def sourcegit_and_remote(tmpdir):
    temp_dir = Path(str(tmpdir))

    sourcegit_remote = temp_dir / "source_git_remote"
    sourcegit_remote.mkdir()
    subprocess.check_call(["git", "init", "--bare", "."], cwd=sourcegit_remote)

    sourcegit_dir = temp_dir / "source_git"
    shutil.copytree(SOURCEGIT_UPSTREAM, sourcegit_dir)
    initiate_git_repo(sourcegit_dir, tag="0.1.0")
    subprocess.check_call(["cp", "-R", SOURCEGIT_SOURCEGIT, temp_dir],
                          cwd=sourcegit_remote)
    git_add_and_commit(directory=sourcegit_dir, message="sourcegit content")

    return sourcegit_dir, sourcegit_remote
Пример #6
0
def downstream_n_distgit(tmpdir):
    t = Path(str(tmpdir))

    d_remote = t / "downstream_remote"
    d_remote.mkdir()
    subprocess.check_call(["git", "init", "--bare", "."], cwd=d_remote)

    d = t / "dist_git"
    shutil.copytree(DISTGIT, d)
    initiate_git_repo(d, tag="0.0.0")

    u = t / "upstream_git"
    shutil.copytree(UPSTREAM, u)
    initiate_git_repo(u, push=False, upstream_remote=str(d_remote))

    return u, d
Пример #7
0
def test_get_api(tmpdir, remotes, package_config, is_upstream):
    t = Path(str(tmpdir))

    repo = t / "project_repo"
    repo.mkdir(parents=True, exist_ok=True)
    initiate_git_repo(repo, remotes=remotes)

    flexmock(utils).should_receive("get_local_package_config").and_return(
        package_config)

    c = get_test_config()
    api = get_packit_api(config=c,
                         local_project=LocalProject(working_dir=str(repo)))

    if is_upstream:
        assert api.upstream_local_project
    else:
        assert api.downstream_local_project
Пример #8
0
def ogr_distgit_and_remote(tmpdir) -> Tuple[Path, Path]:
    temp_dir = Path(str(tmpdir))

    d_remote_path = temp_dir / "ogr_dist_git_remote"
    d_remote_path.mkdir(parents=True, exist_ok=True)
    subprocess.check_call(["git", "init", "--bare", "."], cwd=d_remote_path)

    d = temp_dir / "ogr_dist_git"
    shutil.copytree(DG_OGR, d)
    initiate_git_repo(
        d,
        push=True,
        remotes=[
            ("origin", str(d_remote_path)),
            ("i_am_distgit", "https://src.fedoraproject.org/rpms/python-ogr"),
        ],
    )
    prepare_dist_git_repo(d)
    return d, d_remote_path
Пример #9
0
def osbuild(tmpdir):
    t = Path(str(tmpdir))
    u = t / "up"
    shutil.copytree(UP_OSBUILD, u)
    initiate_git_repo(u, tag="2")
    return u
Пример #10
0
def snapd(tmpdir):
    t = Path(str(tmpdir))
    u = t / "up"
    shutil.copytree(UP_SNAPD, u)
    initiate_git_repo(u, tag="2.41")
    return u