Exemplo n.º 1
0
    def update(self, add_version=False, add_major=False, add_minor=False,
               new_extra=None):
        """
        Update the revision.

        The current directory should be git repository of Coral.

        :param add_version: Increase the version number. Default: False.
        :param add_major: Increase the major number. Default: False.
        :param add_minor: Increase the minor number. Default: True.
        :param new_extra: Change extra part of reviesion. Default: None. To
            remove the existing extra field, specify --new-extra "".
        :param update_license_key: Update the license key. If it is desired
            to the licenses of old versions, please specify this option.
        """
        # pylint: disable=no-self-use
        source_dir = os.getcwd()
        log, workspace = cmd_general.init_env_noconfig(source_dir,
                                                       self._cvc_log_to_file,
                                                       True)
        cmd_general.check_argument_bool(log, "add_version", add_version)
        cmd_general.check_argument_bool(log, "add_major", add_major)
        cmd_general.check_argument_bool(log, "add_minor", add_minor)
        if new_extra is not None:
            new_extra = cmd_general.check_argument_str(log, "new_extra",
                                                       new_extra)
            if "-" in new_extra:
                log.cl_error("character [-] is not allowed in extra field [%s]",
                             new_extra)
                cmd_general.cmd_exit(log, -1)
        rc = _update_version(log, workspace, source_dir,
                             add_version=add_version,
                             add_major=add_major, add_minor=add_minor,
                             new_extra=new_extra)
        cmd_general.cmd_exit(log, rc)
Exemplo n.º 2
0
def barrele_version(barrele_command):
    """
    Print Barreleye version on local host and exit.
    """
    # pylint: disable=unused-argument,protected-access
    logdir = barrele_command._bec_logdir
    log_to_file = barrele_command._bec_log_to_file
    logdir_is_default = (logdir == barrele_constant.BARRELE_LOG_DIR)
    log, _ = cmd_general.init_env_noconfig(logdir, log_to_file,
                                           logdir_is_default)
    log.cl_stdout(version.CORAL_VERSION)
    cmd_general.cmd_exit(log, 0)
Exemplo n.º 3
0
def barrele_version(barrele_command):
    """
    Print Barreleye version on local host and exit.
    """
    # pylint: disable=unused-argument,protected-access
    logdir = barrele_command._bec_logdir
    log_to_file = barrele_command._bec_log_to_file
    simple = True
    if simple:
        logdir_is_default = (logdir == barrele_constant.BARRELE_LOG_DIR)
        log, _ = cmd_general.init_env_noconfig(logdir, log_to_file,
                                               logdir_is_default)
        cmd_general.print_field(log, constant.TITLE_CURRENT_RELEASE,
                                version.CORAL_VERSION)
        cmd_general.cmd_exit(log, 0)
Exemplo n.º 4
0
def barrele_lustre_versions(barrele_command):
    """
    Print Lustres versions supported by Barreleye.

    The Lustre version name can be used in "lustre_fallback_version" of
    /etc/coral/barreleye.conf.
    """
    # pylint: disable=unused-argument,protected-access
    logdir = barrele_command._bec_logdir
    log_to_file = barrele_command._bec_log_to_file
    logdir_is_default = (logdir == barrele_constant.BARRELE_LOG_DIR)
    log, _ = cmd_general.init_env_noconfig(logdir, log_to_file,
                                           logdir_is_default)
    lustre_versions = []
    for lversion in lustre_version.LUSTRE_VERSION_DICT.values():
        fname = barrele_collectd.lustre_version_xml_fname(log,
                                                          lversion,
                                                          quiet=True)
        if fname is None:
            continue
        lustre_versions.append(lversion)
    ret = print_lustre_versions(log, lustre_versions)
    cmd_general.cmd_exit(log, ret)
Exemplo n.º 5
0
def build(coral_command,
          cache=constant.CORAL_BUILD_CACHE,
          lustre=None,
          e2fsprogs=None,
          collectd=None,
          enable_zfs=False,
          enable_devel=False,
          disable_plugin=None,
          origin_mirror=False):
    """
    Build the Coral ISO.
    :param debug: Whether to dump debug logs into files, default: False.
    :param cache: The dir that caches build RPMs. Default:
        /var/log/coral/build_cache.
    :param lustre: The dir of Lustre RPMs (usually generated by lbuild).
        Default: /var/log/coral/build_cache/$type/lustre.
    :param e2fsprogs: The dir of E2fsprogs RPMs.
        Default: /var/log/coral/build_cache/$type/e2fsprogs.
    :param collectd: The Collectd source codes.
        Default: https://github.com/LiXi-storage/collectd/releases/$latest.
        A local source dir or .tar.bz2 generated by "make dist" of Collectd
        can be specified if modification to Collectd is needed.
    :param enable_zfs: Whether enable ZFS support. Default: False.
    :param enable_devel: Whether enable development support. Default: False.
    :param disable_plugin: Disable one or more plugins. Default: None.
    :param origin_mirror: Whether use origin Yum mirrors. If not use Tsinghua
        mirror for possible speedup. Default: False.
    """
    # pylint: disable=too-many-arguments,unused-argument,protected-access
    if not isinstance(coral_command._cc_log_to_file, bool):
        print("ERROR: invalid debug option [%s], should be a bool type" %
              (coral_command._cc_log_to_file),
              file=sys.stderr)
        sys.exit(1)

    source_dir = os.getcwd()
    identity = build_common.get_build_path()
    log, workspace = cmd_general.init_env_noconfig(
        source_dir, coral_command._cc_log_to_file, True, identity=identity)

    cache = cmd_general.check_argument_str(log, "cache", cache)
    if lustre is not None:
        lustre = cmd_general.check_argument_str(log, "lustre", lustre)
    if e2fsprogs is not None:
        e2fsprogs = cmd_general.check_argument_str(log, "e2fsprogs", e2fsprogs)
    if collectd is not None:
        collectd = cmd_general.check_argument_str(log, "collectd", collectd)
    cmd_general.check_argument_bool(log, "enable_zfs", enable_zfs)
    cmd_general.check_argument_bool(log, "enable_devel", enable_devel)
    if disable_plugin is not None:
        disable_plugin = cmd_general.check_argument_list_str(
            log, "disable_plugin", disable_plugin)
    cmd_general.check_argument_bool(log, "origin_mirror", origin_mirror)
    rc = coral_build.build(log,
                           source_dir,
                           workspace,
                           cache=cache,
                           lustre_rpms_dir=lustre,
                           e2fsprogs_rpms_dir=e2fsprogs,
                           collectd=collectd,
                           enable_zfs=enable_zfs,
                           enable_devel=enable_devel,
                           disable_plugin=disable_plugin,
                           origin_mirror=origin_mirror)
    cmd_general.cmd_exit(log, rc)