示例#1
0
    def test_is_lpae_available(self, is_arm, mock_open):
        """Test the is_lpae_available function."""
        is_arm.return_value = False
        assert util.is_lpae_available() is False

        is_arm.return_value = True
        cpu_info = """
        processor       : 0
        model name      : ARMv7 Processor rev 2 (v7l)
        BogoMIPS        : 50.00
        Features        : half thumb fastmult vfp edsp thumbee vfpv3 tls idiva idivt vfpd32
        CPU implementer : 0x56
        CPU architecture: 7
        CPU variant     : 0x2
        CPU part        : 0x584
        CPU revision    : 2
        """

        mock_open.return_value = StringIO(dedent(cpu_info))
        assert util.is_lpae_available() is False

        cpu_info = """
        processor       : 0
        model name      : ARMv7 Processor rev 2 (v7l)
        BogoMIPS        : 50.00
        Features        : half thumb fastmult vfp edsp thumbee vfpv3 tls idiva idivt vfpd32 lpae
        CPU implementer : 0x56
        CPU architecture: 7
        CPU variant     : 0x2
        CPU part        : 0x584
        CPU revision    : 2
        """

        mock_open.return_value = StringIO(dedent(cpu_info))
        assert util.is_lpae_available() is True
示例#2
0
def get_kernel_package(dnf_base, exclude_list):
    """Get an installable kernel package.

    :param dnf_base: a DNF base
    :param exclude_list: a list of excluded packages
    :return: a package name or None
    """
    if "kernel" in exclude_list:
        return None

    # Get the kernel packages.
    kernels = ["kernel"]

    # ARM systems use either the standard Multiplatform or LPAE platform.
    if is_lpae_available():
        kernels.insert(0, "kernel-lpae")

    # Find an installable one.
    for kernel_package in kernels:
        subject = dnf.subject.Subject(kernel_package)
        installable = bool(subject.get_best_query(dnf_base.sack))

        if installable:
            log.info("kernel: selected %s", kernel_package)
            return kernel_package

        log.info("kernel: no such package %s", kernel_package)

    log.error("kernel: failed to select a kernel from %s", kernels)
    return None
示例#3
0
def get_kernel_package(dnf_manager, exclude_list):
    """Get an installable kernel package.

    :param dnf_manager: a DNF manager
    :param exclude_list: a list of excluded packages
    :return: a package name or None
    """
    if "kernel" in exclude_list:
        return None

    # Get the kernel packages.
    kernels = ["kernel"]

    # ARM systems use either the standard Multiplatform or LPAE platform.
    if is_lpae_available():
        kernels.insert(0, "kernel-lpae")

    # Find an installable one.
    for kernel_package in kernels:
        if kernel_package in exclude_list:
            log.info("kernel: excluded %s", kernel_package)
            continue

        if not dnf_manager.is_package_available(kernel_package):
            log.info("kernel: no such package %s", kernel_package)
            continue

        log.info("kernel: selected %s", kernel_package)
        return kernel_package

    log.error("kernel: failed to select a kernel from %s", kernels)
    return None