def test_update_comments(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'some-comments')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches(extra=True)
        update_patches('master',
                       local_patches_branch='master-patches',
                       version='1.2.3')
    common.assert_distgit(dist_path, 'patched-comments')
def test_update_comments(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'some-comments')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches(extra=True)
        update_patches('master',
                       local_patches_branch='master-patches',
                       version='1.2.3')
    common.assert_distgit(dist_path, 'patched-comments')
def test_update_double_patches_base(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'double-patches')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        with pytest.raises(rdopkg.exception.DuplicatePatchesBaseError):
            update_patches('master',
                           local_patches_branch='master-patches',
                           version='1.2.3')
    common.assert_distgit(dist_path, 'double-patches')
def test_update_dense_ex(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'empty-dense-ex')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches(extra=True)
        update_patches('master',
                       local_patches_branch='master-patches',
                       version='1.2.3')
    common.assert_distgit(dist_path, 'patched-dense-ex')
def test_update_double_patches_base(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'double-patches')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        with pytest.raises(rdopkg.exception.LintProblemsFound):
            update_patches('master',
                           local_patches_branch='master-patches',
                           version='1.2.3')
    common.assert_distgit(dist_path, 'double-patches')
def test_update_dense_ex(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'empty-dense-ex')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches(extra=True)
        update_patches('master',
                       local_patches_branch='master-patches',
                       version='1.2.3')
    common.assert_distgit(dist_path, 'patched-dense-ex')
def test_update_git_am_buildarch_fail(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'git-am-fail')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches(extra=True)
        with pytest.raises(rdopkg.exception.BuildArchSanityCheckFailed):
            update_patches('master',
                           local_patches_branch='master-patches',
                           version='1.2.3')
        apply_method = specfile.Spec().patches_apply_method()
    assert apply_method == 'git-am'
def test_update_autosetup(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'autosetup')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches(extra=True)
        update_patches('master',
                       local_patches_branch='master-patches',
                       version='1.2.3')
        apply_method = specfile.Spec().patches_apply_method()
    assert apply_method == 'autosetup'
    common.assert_distgit(dist_path, 'patched-autosetup')
def test_update_autosetup(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'autosetup')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches(extra=True)
        update_patches('master',
                       local_patches_branch='master-patches',
                       version='1.2.3')
        apply_method = specfile.Spec().patches_apply_method()
    assert apply_method == 'autosetup'
    common.assert_distgit(dist_path, 'patched-autosetup')
def test_update_git_am_buildarch_fail(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'git-am-fail')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches(extra=True)
        with pytest.raises(rdopkg.exception.LintProblemsFound):
            update_patches('master',
                           local_patches_branch='master-patches',
                           version='1.2.3')
        apply_method = specfile.Spec().patches_apply_method()
    assert apply_method == 'git-am'
Example #11
0
def _test_patch_noop(tmpdir, distgit, cmd):
    dist_path = common.prep_spec_test(tmpdir, distgit)
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches()
        # regen patch files in order for hashes to match git
        rdopkg('update-patches', '--amend')
        commit_before = git('rev-parse', 'HEAD')
        rdopkg(*cmd)
        commit_after = git('rev-parse', 'HEAD')
        git_clean = git.is_clean()
    common.assert_distgit(dist_path, distgit)
    assert commit_before == commit_after, "New commit created for noop"
    assert git_clean, "git not clean after action"
Example #12
0
def test_patch_add(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'patched')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches()
        commit_before = git('rev-parse', 'HEAD')
        common.add_n_patches(3)
        rdopkg('patch', '-l')
        commit_after = git('rev-parse', 'HEAD')
        git_clean = git.is_clean()
        common.norm_changelog()
    common.assert_distgit(dist_path, 'patch-add')
    assert commit_before != commit_after, "New commit not created"
    assert git_clean, "git not clean after action"
Example #13
0
def test_patch_add(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'patched')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches()
        commit_before = git('rev-parse', 'HEAD')
        common.add_n_patches(3)
        rdopkg('patch', '-l')
        commit_after = git('rev-parse', 'HEAD')
        git_clean = git.is_clean()
        common.norm_changelog()
    common.assert_distgit(dist_path, 'patch-add')
    assert commit_before != commit_after, "New commit not created"
    assert git_clean, "git not clean after action"
Example #14
0
def _test_patch_noop(tmpdir, distgit, cmd):
    dist_path = common.prep_spec_test(tmpdir, distgit)
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches()
        # regen patch files in order for hashes to match git
        rdopkg('update-patches', '--amend')
        commit_before = git('rev-parse', 'HEAD')
        rdopkg(*cmd)
        commit_after = git('rev-parse', 'HEAD')
        git_clean = git.is_clean()
    common.assert_distgit(dist_path, distgit)
    assert commit_before == commit_after, "New commit created for noop"
    assert git_clean, "git not clean after action"
Example #15
0
def _test_patch_regen(tmpdir, distgit, distgit_after,
                      cmd, norm_changelog=True):
    dist_path = common.prep_spec_test(tmpdir, distgit)
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches()
        commit_before = git('rev-parse', 'HEAD')
        rdopkg(*cmd)
        commit_after = git('rev-parse', 'HEAD')
        git_clean = git.is_clean()
        if norm_changelog:
            common.norm_changelog()
    common.assert_distgit(dist_path, distgit_after)
    assert commit_before != commit_after, \
        "New commit not created after patch regen"
    assert git_clean, "git not clean after action"
def _test_new_version(asset, dir, steps):
    dist_path = common.prep_spec_test(dir, asset)
    log.log.setLevel(log.WARN)

    with dist_path.as_cwd():
        common.prep_patches_branch()
        for new_version, spec_version, spec_release_parts, spec_milestone \
                in steps:
            commit_before = git('rev-parse', 'HEAD')
            common.add_patches(tag=new_version)
            rdopkg('new-version', '-l', '-d', new_version)

            # after
            commit_after = git('rev-parse', 'HEAD')
            common.assert_spec_version(spec_version, spec_release_parts,
                                       spec_milestone)
            assert commit_before != commit_after
def test_update_noop(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'patched')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        spec_before = spec_path.read()
        common.add_patches()
        update_patches('master',
                       local_patches_branch='master-patches',
                       version='1.2.3')
        spec_after = spec_path.read()
        assert spec_after == spec_before
        spec_before = spec_after
        update_patches('master',
                       local_patches_branch='master-patches',
                       version='1.2.3')
        spec_after = spec_path.read()
        assert spec_after == spec_before
def test_update_noop(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'patched')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        spec_before = spec_path.read()
        common.add_patches()
        update_patches('master',
                       local_patches_branch='master-patches',
                       version='1.2.3')
        spec_after = spec_path.read()
        assert spec_after == spec_before
        spec_before = spec_after
        update_patches('master',
                       local_patches_branch='master-patches',
                       version='1.2.3')
        spec_after = spec_path.read()
        assert spec_after == spec_before
Example #19
0
def _test_patch_regen(tmpdir,
                      distgit,
                      distgit_after,
                      cmd,
                      norm_changelog=True):
    dist_path = common.prep_spec_test(tmpdir, distgit)
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches()
        commit_before = git('rev-parse', 'HEAD')
        rdopkg(*cmd)
        commit_after = git('rev-parse', 'HEAD')
        git_clean = git.is_clean()
        if norm_changelog:
            common.norm_changelog()
    common.assert_distgit(dist_path, distgit_after)
    assert commit_before != commit_after, \
        "New commit not created after patch regen"
    assert git_clean, "git not clean after action"
Example #20
0
def _test_patch(asset, version, dir):
    dist_path = common.prep_spec_test(dir, asset)
    log.log.setLevel(log.WARN)

    with dist_path.as_cwd():
        spec_version, spec_release_parts, spec_milestone = version
        tag = spec_version
        if spec_milestone:
            tag += spec_milestone

        common.prep_patches_branch(tag=tag)
        commit_before = git('rev-parse', 'HEAD')
        common.add_patches()

        rdopkg('patch', '-l')
        # after
        commit_after = git('rev-parse', 'HEAD')

        common.assert_spec_version(spec_version, spec_release_parts,
                                   spec_milestone)
        assert commit_before != commit_after, "No commit created"
        prev = git('rev-parse', 'HEAD~')
        assert prev == commit_before, "Multiple commits created"
Example #21
0
def _test_patch(asset, version, dir):
    dist_path = common.prep_spec_test(dir, asset)
    log.log.setLevel(log.WARN)

    with dist_path.as_cwd():
        spec_version, spec_release_parts, spec_milestone = version
        tag = spec_version
        if spec_milestone:
            tag += spec_milestone

        common.prep_patches_branch(tag=tag)
        commit_before = git('rev-parse', 'HEAD')
        common.add_patches()

        rdopkg('patch', '-l')
        # after
        commit_after = git('rev-parse', 'HEAD')

        common.assert_spec_version(spec_version, spec_release_parts,
                                   spec_milestone)
        assert commit_before != commit_after, "No commit created"
        prev = git('rev-parse', 'HEAD~')
        assert prev == commit_before, "Multiple commits created"