Ejemplo n.º 1
0
def update_version_and_merge_for_component(component, opts):
    project_dir = builder.clone_branch(component)

    try:
        git_branch = promote.get_current_git_upstream_branch(project_dir)
        parent_branch = component.get('parent_branch')
    except subprocess.CalledProcessError:
        # most likely, git branch is a tag. In that event, there's nothing to update or
        # merge forward. The script was either called with the wrong release config, or is
        # being used as an expedient to check out the git repos for a given release config.
        # Either way, nothing can be done with this branch.
        print(("Unable to determine git branch for git repo in {}, HEAD is probably a tag."
               " Moving to next component.").format(project_dir))
        return

    if opts.update_version:
        if git_branch.endswith('-release'):
            # Even if update_version was requested, the only way versions should get updated on an
            # x.y-release branch is through the merging of a released tag.
            print("Not updating version on release branch, only merging branches forward.")
        else:
            promotion_chain = promote.get_promotion_chain(project_dir, git_branch,
                                                          parent_branch=parent_branch)
            promote.check_merge_forward(project_dir, promotion_chain)
            update_version = os.path.join(CI_DIR, 'update-version.py')
            # Update the version to the one specified in the config
            command = ['./update-version.py', '--version', component['version'], project_dir]
            subprocess.call(command, cwd=CI_DIR)
            command = ['git', 'commit', '-a', '-m', 'Bumping version to %s' % component['version']]
            subprocess.call(command, cwd=project_dir)
            if opts.push:
                command = ['git', 'push', '-v']
                subprocess.call(command, cwd=project_dir)
    else:
        print("Skipping version update, only merging branches forward.")
    promote.merge_forward(project_dir, push=opts.push, parent_branch=parent_branch)
Ejemplo n.º 2
0
    build_ids = builder.build_with_koji(build_tag_prefix=opts.koji_prefix,
                                        srpm_dir=TITO_DIR, scratch=True)
    builder.wait_for_completion(build_ids)

    if opts.release:
        print "Performing koji release build"
        # Clean out the tito dir first
        builder.ensure_dir(TITO_DIR)
        spec_dir_set = set()
        for spec, dist in build_list:
            spec_dir = os.path.dirname(spec)
            if spec_dir not in spec_dir_set:
                spec_dir_set.add(spec_dir)
                # make sure we are clean to merge forward before tagging
                print "validating merge forward for %s" % spec_dir
                git_branch = promote.get_current_git_upstream_branch(spec_dir)
                parent_branch = component.get('parent_branch', None)
                promotion_chain = promote.get_promotion_chain(spec_dir, git_branch, parent_branch=parent_branch)
                promote.check_merge_forward(spec_dir, promotion_chain)
                # Tito tag the new releases
                command = ['tito', 'tag', '--keep-version', '--no-auto-changelog']
                subprocess.check_call(command, cwd=spec_dir)
            builder.build_srpm_from_spec(spec_dir, TITO_DIR, testing=False, dist=dist)

        build_ids = builder.build_with_koji(build_tag_prefix=opts.koji_prefix,
                                            srpm_dir=TITO_DIR, scratch=False)
        builder.wait_for_completion(build_ids)
        for spec_dir in spec_dir_set:
            # Push the tags
            command = ['git', 'push']
            subprocess.check_call(command, cwd=spec_dir)
def get_components(configuration):
    repos = configuration['repositories']
    for component in repos:
        yield component

# Build our working_dir
working_dir = WORKING_DIR
print working_dir
# Load the config file
configuration = load_config(opts.config)

print "Getting git repos"
for component in get_components(configuration):
    print "Cloning from github: %s" % component.get('git_url')
    branch_name = component['git_branch']
    parent_branch = component.get('parent_branch', None)
    command = ['git', 'clone', component.get('git_url'), '--branch', branch_name]
    subprocess.call(command, cwd=working_dir)
    project_dir = os.path.join(working_dir, component['name'])
    git_branch = promote.get_current_git_upstream_branch(project_dir)
    promotion_chain = promote.get_promotion_chain(project_dir, git_branch, parent_branch=parent_branch)
    promote.check_merge_forward(project_dir, promotion_chain)
    update_version = os.path.join(CI_DIR, 'update-version.py')
    # Update the version to the one specified in the config
    command = ['./update-version.py', '--version', component['version'], project_dir]
    subprocess.call(command, cwd=CI_DIR)
    command = ['git', 'commit', '-a', '-m', 'Bumping version to %s' % component['version']]
    subprocess.call(command, cwd=project_dir)
    promote.merge_forward(project_dir, push=push_to_github, parent_branch=parent_branch) 
Ejemplo n.º 4
0
def get_components(configuration):
    repos = configuration['repositories']
    for component in repos:
        yield component

# Build our working_dir
working_dir = WORKING_DIR
print working_dir
# Load the config file
configuration = load_config(opts.config)

print "Getting git repos"
for component in get_components(configuration):
    print "Cloning from github: %s" % component.get('git_url')
    branch_name = component['git_branch']
    parent_branch = component.get('parent_branch', None)
    command = ['git', 'clone', component.get('git_url'), '--branch', branch_name]
    subprocess.call(command, cwd=working_dir)
    project_dir = os.path.join(working_dir, component['name'])
    git_branch = promote.get_current_git_upstream_branch(project_dir)
    promotion_chain = promote.get_promotion_chain(project_dir, git_branch, parent_branch=parent_branch)
    promote.check_merge_forward(project_dir, promotion_chain)
    update_version = os.path.join(CI_DIR, 'update-version.py')
    # Update the version to the one specified in the config
    command = ['./update-version.py', '--version', component['version'], project_dir]
    subprocess.call(command, cwd=CI_DIR)
    command = ['git', 'commit', '-a', '-m', 'Bumping version to %s' % component['version']]
    subprocess.call(command, cwd=project_dir)
    promote.merge_forward(project_dir, push=push_to_github, parent_branch=parent_branch) 
Ejemplo n.º 5
0
    build_ids = builder.build_with_koji(build_tag_prefix=koji_prefix,
                                        srpm_dir=TITO_DIR, scratch=True)
    builder.wait_for_completion(build_ids)

    if release_build:
        print "Performing koji release build"
        # Clean out the tito dir first
        builder.ensure_dir(TITO_DIR)
        spec_dir_set = set()
        for spec, dist in build_list:
            spec_dir = os.path.dirname(spec)
            if spec_dir not in spec_dir_set:
                spec_dir_set.add(spec_dir)
                # make sure we are clean to merge forward before tagging
                print "validating merge forward for %s" % spec_dir
                git_branch = promote.get_current_git_upstream_branch(spec_dir)
                promotion_chain = promote.get_promotion_chain(spec_dir, git_branch)
                promote.check_merge_forward(spec_dir, promotion_chain)
                # Tito tag the new releases
                command = ['tito', 'tag', '--keep-version', '--no-auto-changelog']
                subprocess.check_call(command, cwd=spec_dir)
            builder.build_srpm_from_spec(spec_dir, TITO_DIR, testing=False, dist=dist)

        build_ids = builder.build_with_koji(build_tag_prefix=koji_prefix,
                                            srpm_dir=TITO_DIR, scratch=False)
        builder.wait_for_completion(build_ids)
        for spec_dir in spec_dir_set:
            # Push the tags
            command = ['git', 'push']
            subprocess.check_call(command, cwd=spec_dir)
            command = ['git', 'push', '--tag']