Exemplo n.º 1
0
def run(CONF):
    versions_repo = setup_versions_repository(CONF)
    package_names = discover_packages()

    architecture = CONF.get('common').get('architecture')
    distro = distro_utils.get_distro(
        CONF.get('common').get('distro_name'),
        CONF.get('common').get('distro_version'), architecture)

    commit_updates = CONF.get('common').get('commit_updates')
    push_updates = CONF.get('common').get('push_updates')
    push_repo_url = CONF.get('common').get('push_repo_url')
    push_repo_branch = CONF.get('common').get('push_repo_branch')
    updater_name = CONF.get('common').get('updater_name')
    updater_email = CONF.get('common').get('updater_email')

    REQUIRED_PARAMETERS = ["updater_name", "updater_email"]
    if push_updates:
        REQUIRED_PARAMETERS += ["push_repo_url", "push_repo_branch"]
    for parameter in REQUIRED_PARAMETERS:
        if CONF.get('common').get(parameter) is None:
            raise exception.RequiredParameterMissing(parameter=parameter)

    METAPACKAGE_NAME = "open-power-host-os"
    package_names.remove(METAPACKAGE_NAME)
    update_metapackage(versions_repo, distro, METAPACKAGE_NAME, package_names,
                       updater_name, updater_email)

    if commit_updates:
        commit_message = "Update {} dependencies".format(METAPACKAGE_NAME)
        versions_repo.commit_changes(commit_message, updater_name,
                                     updater_email)
        if push_updates:
            LOG.info("Pushing updated {} files".format(METAPACKAGE_NAME))
            versions_repo.push_head_commits(push_repo_url, push_repo_branch)
Exemplo n.º 2
0
def run(CONF):
    versions_repo = setup_versions_repository(CONF)
    packages = discover_packages()

    architecture = CONF.get('common').get('architecture')
    distro = distro_utils.get_distro(
        CONF.get('common').get('distro_name'),
        CONF.get('common').get('distro_version'), architecture)

    commit_updates = CONF.get('common').get('commit_updates')
    push_updates = CONF.get('common').get('push_updates')
    push_repo_url = CONF.get('update_versions_readme').get('push_repo_url')
    push_repo_branch = CONF.get('update_versions_readme').get(
        'push_repo_branch')
    updater_name = CONF.get('common').get('updater_name')
    updater_email = CONF.get('common').get('updater_email')

    REQUIRED_PARAMETERS = [("common", "updater_name"),
                           ("common", "updater_email")]
    if push_updates:
        REQUIRED_PARAMETERS += [("update_versions_readme", "push_repo_url"),
                                ("update_versions_readme", "push_repo_branch")]
    for section, parameter in REQUIRED_PARAMETERS:
        if CONF.get(section).get(parameter) is None:
            raise exception.RequiredParameterMissing(parameter=parameter)

    update_versions_in_readme(versions_repo, distro, packages)

    if commit_updates:
        commit_message = "Update README versions table"
        versions_repo.commit_changes(commit_message, updater_name,
                                     updater_email)
        if push_updates:
            LOG.info("Pushing updated versions README")
            versions_repo.push_head_commits(push_repo_url, push_repo_branch)
Exemplo n.º 3
0
def run(CONF):
    versions_repo = setup_versions_repository(CONF)

    version_milestone = read_version_and_milestone(versions_repo)

    packages_names = packages_manager.discover_packages()
    distro = distro_utils.get_distro(
        CONF.get('common').get('distro_name'),
        CONF.get('common').get('distro_version'),
        CONF.get('common').get('arch_and_endianness'))
    release_notes_repo_url = CONF.get('build_release_notes').get(
        'release_notes_repo_url')
    release_notes_repo_branch = CONF.get('build_release_notes').get(
        'release_notes_repo_branch')
    commit_updates = CONF.get('common').get('commit_updates')
    push_updates = CONF.get('common').get('push_updates')
    push_repo_url = CONF.get('build_release_notes').get('push_repo_url')
    push_repo_branch = CONF.get('build_release_notes').get('push_repo_branch')
    updater_name = CONF.get('common').get('updater_name')
    updater_email = CONF.get('common').get('updater_email')

    REQUIRED_PARAMETERS = [("common", "updater_name"),
                           ("common", "updater_email")]
    if push_updates:
        REQUIRED_PARAMETERS += [("build_release_notes", "push_repo_url"),
                                ("build_release_notes", "push_repo_branch")]
    for section, parameter in REQUIRED_PARAMETERS:
        if CONF.get(section).get(parameter) is None:
            raise exception.RequiredParameterMissing(parameter=parameter)

    LOG.info("Creating release notes with packages: {}".format(
        ", ".join(packages_names)))
    package_manager = packages_manager.PackagesManager(packages_names)
    package_manager.prepare_packages(packages_class=rpm_package.RPM_Package,
                                     download_source_code=False,
                                     distro=distro)

    repositories_dir_path = os.path.join(
        CONF.get('common').get('work_dir'), REPOSITORIES_DIR)
    website_repo = repository.get_git_repository(release_notes_repo_url,
                                                 repositories_dir_path)
    website_repo.checkout(release_notes_repo_branch)

    WEBSITE_POSTS_DIR = "_posts"
    release_date = datetime.today().date().isoformat()
    release_tag = "{version}-{date}".format(version=version_milestone,
                                            date=release_date)
    release_file_name = RELEASE_FILE_NAME_TEMPLATE.format(date=release_date)
    release_file_path = os.path.join(website_repo.working_tree_dir,
                                     WEBSITE_POSTS_DIR, release_file_name)
    write_version_info(release_tag, release_file_path, versions_repo,
                       package_manager.packages)

    if commit_updates:
        commit_release_notes(website_repo, release_date, updater_name,
                             updater_email)
        if push_updates:
            push_website_head_commit(website_repo, push_repo_url,
                                     push_repo_branch)
Exemplo n.º 4
0
def run(CONF):
    versions_repo = setup_versions_repository(CONF)
    packages_to_update = CONF.get('update_versions').get(
        'packages') or PACKAGES
    distro = distro_utils.get_distro(
        CONF.get('common').get('distro_name'),
        CONF.get('common').get('distro_version'),
        CONF.get('common').get('architecture'))
    commit_updates = CONF.get('common').get('commit_updates')
    push_updates = CONF.get('common').get('push_updates')
    push_repo_url = CONF.get('update_versions').get('push_repo_url')
    push_repo_branch = CONF.get('update_versions').get('push_repo_branch')
    updater_name = CONF.get('common').get('updater_name')
    updater_email = CONF.get('common').get('updater_email')

    REQUIRED_PARAMETERS = [("common", "updater_name"),
                           ("common", "updater_email")]
    if push_updates:
        REQUIRED_PARAMETERS += [("update_versions", "push_repo_url"),
                                ("update_versions", "push_repo_branch")]
    for section, parameter in REQUIRED_PARAMETERS:
        if CONF.get(section).get(parameter) is None:
            raise exception.RequiredParameterMissing(parameter=parameter)

    # get packages names
    packages_to_update_names = []
    for package in packages_to_update:
        packages_to_update_names.append(package.split("#")[0])

    LOG.info("Checking for updates in packages versions: %s",
             ", ".join(packages_to_update_names))
    pm = packages_manager.PackagesManager(packages_to_update_names)
    pm.prepare_packages(packages_class=rpm_package.RPM_Package,
                        download_source_code=False,
                        distro=distro)

    for pkg in pm.packages:
        pkg.lock()
        pkg_version = Version(pkg)
        pkg_version.update(updater_name, updater_email)
        pkg.unlock()

    packages_names = discover_packages()
    METAPACKAGE_NAME = "open-power-host-os"
    packages_names.remove(METAPACKAGE_NAME)

    update_metapackage(versions_repo, distro, METAPACKAGE_NAME, packages_names,
                       updater_name, updater_email)
    update_versions_in_readme(versions_repo, distro, packages_names)

    release_date = datetime.today().date().isoformat()
    if commit_updates:
        commit_message = "Weekly build {date}".format(date=release_date)
        versions_repo.commit_changes(commit_message, updater_name,
                                     updater_email)
        if push_updates:
            LOG.info("Pushing packages versions updates")
            versions_repo.push_head_commits(push_repo_url, push_repo_branch)
def run(CONF):

    release_notes_repo_url = CONF.get('release_notes_repo_url')
    release_notes_repo_branch = CONF.get('release_notes_repo_branch')
    commit_updates = CONF.get('commit_updates')
    push_updates = CONF.get('push_updates')
    push_repo_url = CONF.get('push_repo_url')
    push_repo_branch = CONF.get('push_repo_branch')
    updater_name = CONF.get('updater_name')
    updater_email = CONF.get('updater_email')
    info_files_dir = CONF.get('info_files_dir')
    release_category = CONF.get('release_category')

    required_parameters = []
    if commit_updates:
        required_parameters += ["updater_name", "updater_email"]
    if push_updates:
        required_parameters += ["push_repo_url", "push_repo_branch"]
    for parameter in required_parameters:
        if not CONF.get(parameter):
            raise exception.RequiredParameterMissing(parameter=parameter)

    LOG.info(
        "Creating release notes based on files at: {}".format(info_files_dir))

    repositories_dir_path = os.path.join(CONF.get('work_dir'),
                                         REPOSITORIES_DIR)
    website_repo = repository.get_git_repository(release_notes_repo_url,
                                                 repositories_dir_path)
    website_repo.checkout(release_notes_repo_branch)

    WEBSITE_POSTS_DIR = "_posts"

    build_info_file = os.path.join(info_files_dir, BUILD_INFO_FILE_NAME)
    build_info = json.load(open(build_info_file))

    packages_info_file = os.path.join(info_files_dir, PACKAGES_INFO_FILE_NAME)
    packages_info = json.load(open(packages_info_file))

    # timestamp format is YYYY-MM-DDThh:mm:ss.xxx
    release_date = build_info['timestamp'].split('T')[0]
    release_file_name = RELEASE_FILE_NAME_TEMPLATE.format(
        date=release_date, suffix=release_category)
    release_file_path = os.path.join(website_repo.working_tree_dir,
                                     WEBSITE_POSTS_DIR, release_file_name)
    write_version_info(release_file_path, release_category, release_date,
                       build_info, packages_info)

    if commit_updates:
        commit_message = (
            CONF.get('commit_message')
            or "Host OS release of {date}".format(date=release_date))
        website_repo.commit_changes(commit_message, updater_name,
                                    updater_email)
        if push_updates:
            website_repo.push_head_commits(push_repo_url, push_repo_branch)

    LOG.info("Release notes built succesfully")
def run(CONF):
    versions_repo = setup_versions_repository(CONF)
    packages_to_update = CONF.get('packages') or PACKAGES
    distro = distro_utils.get_distro(CONF.get('distro_name'),
                                     CONF.get('distro_version'),
                                     CONF.get('architecture'))
    commit_updates = CONF.get('commit_updates')
    push_updates = CONF.get('push_updates')
    push_repo_url = CONF.get('push_repo_url')
    push_repo_branch = CONF.get('push_repo_branch')
    updater_name = CONF.get('updater_name')
    updater_email = CONF.get('updater_email')

    REQUIRED_PARAMETERS = ["updater_name", "updater_email"]
    if push_updates:
        REQUIRED_PARAMETERS += ["push_repo_url", "push_repo_branch"]
    for parameter in REQUIRED_PARAMETERS:
        if not CONF.get(parameter):
            raise exception.RequiredParameterMissing(parameter=parameter)

    # get packages names
    packages_to_update_names = []
    for package in packages_to_update:
        packages_to_update_names.append(package.split("#")[0])

    LOG.info("Checking for updates in packages versions: %s",
             ", ".join(packages_to_update_names))
    pm = packages_manager.PackagesManager(packages_to_update_names)
    pm.prepare_packages(packages_class=rpm_package.RPM_Package,
                        download_source_code=False,
                        distro=distro)

    updates_available = False
    for pkg in pm.packages:
        pkg.lock()
        pkg_version = Version(pkg)
        updates_available = (pkg_version.update(updater_name, updater_email)
                             or updates_available)
        pkg.unlock()

    if updates_available:
        packages_names = discover_packages()
        METAPACKAGE_NAME = "open-power-host-os"
        packages_names.remove(METAPACKAGE_NAME)
        update_metapackage(versions_repo, distro, METAPACKAGE_NAME,
                           packages_names, updater_name, updater_email)

        if commit_updates:
            commit_message = (CONF.get('commit_message')
                              or "Update packages versions")
            versions_repo.commit_changes(commit_message, updater_name,
                                         updater_email)

            if push_updates:
                LOG.info("Pushing packages versions updates")
                versions_repo.push_head_commits(push_repo_url,
                                                push_repo_branch)
        elif push_updates:
            LOG.warning("Not pushing branch because no commit was created")
    else:
        LOG.info("No updates in packages versions, skipping metapackage "
                 "update and commit creation")
        if push_updates:
            LOG.info("No updates, pushing branch with unaltered head")
            versions_repo.push_head_commits(push_repo_url, push_repo_branch)
        raise exception.NoPackagesUpdated()

    LOG.info("Packages updated succesfully")