new commit
This commit is contained in:
parent
27a9f42bf0
commit
d020dda393
@ -30,7 +30,7 @@ sys.path.insert(0, BASE_DIR)
|
||||
try:
|
||||
from builder.core.command_runner import run_command
|
||||
from builder.configs import logger_config
|
||||
from builder.core.bootstrap import bootstrap
|
||||
from builder.core.bootstrap import bootstrap
|
||||
|
||||
logger = logger_config.setup_logger('install_kernel')
|
||||
except ImportError as e:
|
||||
@ -42,7 +42,6 @@ except ImportError as e:
|
||||
print(f"Error importing necessary modules for install_kernel: {e}. Ensure your environment is set up correctly.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def install_kernel(arch, kernel_type, kernels_config, target_env='rootfs', paths=None, host_arch=None, repositories_data=None):
|
||||
"""
|
||||
Installs the specified kernel in the target environment (rootfs, pep-target, pep-host),
|
||||
@ -52,7 +51,7 @@ def install_kernel(arch, kernel_type, kernels_config, target_env='rootfs', paths
|
||||
arch (str): Architecture (e.g., 'aarch64').
|
||||
kernel_type (str): Kernel type (e.g., 'current', 'lts', 'mainline').
|
||||
kernels_config (dict): Kernel configuration loaded from the YAML file.
|
||||
Expected structure: {kernels: {<kernel_type>: {<architecture>: package_name}}}
|
||||
Expected structure: {kernels: {<kernel_type>: {package_names: {<architecture>: package_name_string}}}}
|
||||
target_env (str): Target environment to install the kernel in ('rootfs', 'pep-target', 'pep-host').
|
||||
Defaults to 'rootfs'.
|
||||
paths (dict): Dictionary of build paths. Required to get target path and cache dir.
|
||||
@ -72,29 +71,29 @@ def install_kernel(arch, kernel_type, kernels_config, target_env='rootfs', paths
|
||||
logger.error("Paths dictionary is missing or incorrect.")
|
||||
raise ValueError("Paths dictionary is required.")
|
||||
|
||||
kernel_package_name = None
|
||||
|
||||
kernel_package_name_string = None
|
||||
if kernels_config and 'kernels' in kernels_config and kernel_type in kernels_config['kernels']:
|
||||
kernel_info_for_type = kernels_config['kernels'][kernel_type]
|
||||
if isinstance(kernel_info_for_type, dict):
|
||||
kernel_package_name = kernel_info_for_type.get(arch)
|
||||
package_names_dict = kernel_info_for_type.get('package_names', {})
|
||||
if isinstance(package_names_dict, dict):
|
||||
kernel_package_name_string = package_names_dict.get(arch)
|
||||
|
||||
if kernel_package_name:
|
||||
logger.info(f"=> Selected Void Linux kernel package name (YAML) for {arch} / {kernel_type}: {kernel_package_name}")
|
||||
if kernel_package_name_string:
|
||||
logger.info(f"=> Selected Void Linux kernel package name string (YAML) for {arch} / {kernel_type}: '{kernel_package_name_string}'")
|
||||
kernel_packages_list = kernel_package_name_string.split()
|
||||
else:
|
||||
default_package_name = "linux"
|
||||
logger.warning(f"Kernel type '{kernel_type}' or architecture '{arch}' not found in the YAML configuration. Using '{default_package_name}' as default package name.")
|
||||
kernel_package_name = default_package_name
|
||||
default_package_name_string = "linux"
|
||||
logger.warning(f"Kernel type '{kernel_type}' or architecture '{arch}' not found in 'package_names' section of the YAML configuration. Using '{default_package_name_string}' as default package name string.")
|
||||
kernel_packages_list = [default_package_name_string]
|
||||
|
||||
if not kernel_package_name:
|
||||
logger.error(f"Kernel package name is empty even after fallback. Cannot install kernel.")
|
||||
raise ValueError("Kernel package name is not defined.")
|
||||
|
||||
adapted_package_structure = {target_env: {arch: [kernel_package_name]}}
|
||||
if not kernel_packages_list:
|
||||
logger.error(f"Kernel package list is empty even after fallback. Cannot install kernel.")
|
||||
raise ValueError("Kernel package list is not defined.")
|
||||
|
||||
adapted_package_structure = {target_env: {arch: kernel_packages_list}}
|
||||
kernel_packages_args = bootstrap.construct_xbps_install_args(
|
||||
target_env,
|
||||
paths,
|
||||
arch,
|
||||
repositories_data,
|
||||
adapted_package_structure
|
||||
@ -111,7 +110,7 @@ def install_kernel(arch, kernel_type, kernels_config, target_env='rootfs', paths
|
||||
logger.info(f"=> Kernel installed successfully in the environment: {target_env}.")
|
||||
except Exception as e:
|
||||
logger.error(f"Error installing the kernel in the environment: {target_env}: {e}")
|
||||
raise
|
||||
raise
|
||||
|
||||
|
||||
logger.info(f"=> Kernel installation: {kernel_type} ({target_env}) completed.")
|
||||
|
@ -207,10 +207,6 @@ def iso_builder_main(
|
||||
)
|
||||
|
||||
kernels_config = load_yaml_config(paths['KERNELS_CONFIG_YAML'], 'kernels.yaml')
|
||||
logger.info(f"=> DEBUG: Kernel YAML file path loaded: {paths['KERNELS_CONFIG_YAML']}") # Linha de debug temporária
|
||||
import json # Importa a biblioteca json para formatar o dicionário
|
||||
logger.info(f"=> DEBUG: Loaded kernels_config content: {json.dumps(kernels_config, indent=2)}") # Linha de debug temporária
|
||||
|
||||
install_kernel(
|
||||
arch=architecture,
|
||||
kernel_type=kernel_type,
|
||||
|
Loading…
Reference in New Issue
Block a user