new commit
This commit is contained in:
parent
505669c3d0
commit
d97f347a6a
@ -1,34 +1,24 @@
|
||||
# builder/core/bootstrap.py (Apenas Construção de Argumentos)
|
||||
|
||||
import os
|
||||
import logging
|
||||
import platform
|
||||
import sys
|
||||
# shutil não é necessário neste ficheiro com esta estratégia
|
||||
|
||||
# base_dir e sys.path.insert são geralmente feitos no script principal
|
||||
# from builder.core.bootstrap.paths import paths # Não é necessário importar paths aqui
|
||||
|
||||
try:
|
||||
from builder.configs import logger_config
|
||||
# from builder.core.command_runner import run_command # Não precisamos de run_command neste ficheiro com esta estratégia
|
||||
except ImportError as e:
|
||||
# Usar print ou logger básico se logger_config falhar
|
||||
try:
|
||||
basic_logger = logging.getLogger(__name__)
|
||||
logging.basicConfig(level=logging.ERROR) # Configurar um logger básico para erro
|
||||
logging.basicConfig(level=logging.ERROR)
|
||||
basic_logger.error(f"Error importing necessary modules for bootstrap helper: {e}. Ensure your environment is set up correctly.")
|
||||
except Exception:
|
||||
print(f"Error importing necessary modules for bootstrap helper: {e}. Ensure your environment is set up correctly.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
# Configurar logger para este módulo
|
||||
try:
|
||||
logger = logger_config.setup_logger('bootstrap')
|
||||
except NameError:
|
||||
# Fallback logger se logger_config não estiver disponível
|
||||
logging.basicConfig(level=logging.INFO) # Nível INFO por padrão para este helper
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger('bootstrap')
|
||||
|
||||
|
||||
@ -109,7 +99,7 @@ def construct_xbps_install_args(env_name, paths, target_architecture, repositori
|
||||
|
||||
if not packages_to_install:
|
||||
logger.warning(f"No packages defined for {env_name} on architecture {target_architecture}. Skipping command construction.")
|
||||
return [] # Return empty list if no packages
|
||||
return []
|
||||
|
||||
filtered_repo_args = filter_repositories_by_architecture(repositories_data, target_architecture)
|
||||
|
||||
@ -117,18 +107,15 @@ def construct_xbps_install_args(env_name, paths, target_architecture, repositori
|
||||
logger.error(f"No repositories found supporting target architecture: {target_architecture}. Cannot construct command for {env_name}.")
|
||||
raise ValueError(f"No repositories found for architecture {target_architecture}")
|
||||
|
||||
# Get the XBPS cache directory for the target architecture (on the host)
|
||||
host_cachedir = os.path.join(os.getcwd(), "xbps_package_cache", target_architecture)
|
||||
os.makedirs(host_cachedir, exist_ok=True)
|
||||
logger.debug(f"Using XBPS cache directory (on host): {host_cachedir}")
|
||||
|
||||
# Construct the xbps-install command arguments
|
||||
# This command will be run directly on the host, targeting the specified directory (-r)
|
||||
xbps_command_args = [
|
||||
"-S", "-y",
|
||||
] + filtered_repo_args + [
|
||||
"-r", target_directory_path, # Install to the target directory (path on host)
|
||||
"-c", host_cachedir, # XBPS cache directory (path on host)
|
||||
"-r", target_directory_path,
|
||||
"-c", host_cachedir,
|
||||
] + packages_to_install
|
||||
|
||||
logger.info(f"Constructed arguments for {env_name}: {xbps_command_args}")
|
||||
|
@ -31,7 +31,7 @@ try:
|
||||
from builder.core.command_runner import run_command
|
||||
from builder.configs import logger_config
|
||||
from builder.core.config_loader import load_yaml_config
|
||||
from builder.core import bootstrap
|
||||
from builder.core.bootstrap import bootstrap
|
||||
|
||||
logger = logger_config.setup_logger('packages_install')
|
||||
except ImportError as e:
|
||||
|
Loading…
Reference in New Issue
Block a user