Exemple #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)
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)
Exemple #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)
Exemple #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)
Exemple #5
0
def run(CONF):
    setup_versions_repository(CONF)
    packages_to_build = (CONF.get('build_packages').get('packages') or
                         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'))

    LOG.info("Building packages: %s", ", ".join(packages_to_build))
    bm = build_manager.BuildManager(packages_to_build, distro)
    bm.build()
Exemple #6
0
 def _run_mock_command(self, cmd):
     distro = distro_utils.get_distro(
         self.common_config.get('distro_name'),
         self.common_config.get('distro_version'),
         self.common_config.get('arch_and_endianness'))
     mock_config_file = self.config.get('mock_config').get(
         distro.lsb_name).get(distro.version)
     try:
         utils.run_command(
             "%s -r %s %s %s" %
             (self.mock_binary, mock_config_file, self.mock_args, cmd))
     except exception.SubprocessError:
         LOG.error("Failed to build ISO")
         raise
Exemple #7
0
def run(CONF):
    setup_versions_repository(CONF)
    packages_to_build = (CONF.get('build_packages').get('packages')
                         or 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('architecture'))

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

    LOG.info("Building packages: %s", ", ".join(packages_to_build_names))
    bm = build_manager.BuildManager(packages_to_build_names, distro)
    bm.build()
Exemple #8
0
    def _init_mock(self):
        """
        Initialize Mock instance with common mock arguments.
        """
        distro = distro_utils.get_distro(self.config.get('distro_name'),
                                         self.config.get('distro_version'),
                                         self.config.get('architecture'))
        mock_config_file_name = "build-iso-%s-%s-%s.cfg" % (
            distro.name, distro.version, distro.architecture)
        mock_config_file_path = os.path.join("config/mock", distro.name,
                                             distro.version,
                                             mock_config_file_name)
        if not os.path.isfile(mock_config_file_path):
            raise exception.BaseException("Mock config file not found at %s" %
                                          mock_config_file_path)

        self.mock = Mock(mock_config_file_path, self.timestamp)
    def _init_mock(self):
        """
        Initialize Mock instance with common mock arguments.
        """
        distro = distro_utils.get_distro(
            self.config.get('distro_name'),
            self.config.get('distro_version'),
            self.config.get('architecture'))
        mock_config_file_name = "build-images-%s-%s-%s.cfg" % (
            distro.name, distro.version, distro.architecture)
        mock_config_file_path = os.path.join(
            "config/mock", distro.name, distro.version,
            mock_config_file_name)
        if not os.path.isfile(mock_config_file_path):
            raise exception.BaseException(
                "Mock config file not found at %s" % mock_config_file_path)

        self.mock = Mock(mock_config_file_path, self.timestamp)
def run(CONF):
    versions_repo = setup_versions_repository(CONF)
    packages_to_build = (CONF.get('packages') or
                         packages_manager.discover_packages())
    distro = distro_utils.get_distro(
        CONF.get('distro_name'),
        CONF.get('distro_version'),
        CONF.get('architecture'))

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

    LOG.info("Building packages: %s", ", ".join(packages_to_build_names))
    bm = build_manager.BuildManager(packages_to_build_names, distro)
    bm.build()

    build_info.write_build_info(bm, versions_repo)

    LOG.info("Packages built succesfully")
def run(CONF):
    versions_repo = setup_versions_repository(CONF)
    package_names = discover_packages()

    architecture = CONF.get('architecture')
    distro = distro_utils.get_distro(CONF.get('distro_name'),
                                     CONF.get('distro_version'),
                                     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)

    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 = (CONF.get('commit_message')
                          or "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)

    LOG.info("Metapackage updated 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")
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")