- Fix environment variable handling in sbuild wrapper - Remove unsupported --log-dir and --env options from sbuild command - Clean up unused imports and fix linting issues - Organize examples directory with official Debian hello package - Fix YAML formatting (trailing spaces, newlines) - Remove placeholder example files - All tests passing (30/30) - Successfully tested build with official Debian hello package
50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
"""
|
|
Deb-Mock Core Configurations
|
|
|
|
This package provides default configuration files for various Debian-based Linux distributions,
|
|
similar to Mock's mock-core-configs package.
|
|
"""
|
|
|
|
from pathlib import Path
|
|
from typing import Dict, List
|
|
|
|
import yaml
|
|
|
|
# Base directory for config files
|
|
CONFIGS_DIR = Path(__file__).parent
|
|
|
|
|
|
def get_available_configs() -> List[str]:
|
|
"""Get list of available configuration names"""
|
|
configs = []
|
|
for config_file in CONFIGS_DIR.glob("*.yaml"):
|
|
if config_file.name != "__init__.py":
|
|
configs.append(config_file.stem)
|
|
return sorted(configs)
|
|
|
|
|
|
def load_config(config_name: str) -> Dict:
|
|
"""Load a configuration by name"""
|
|
config_file = CONFIGS_DIR / f"{config_name}.yaml"
|
|
if not config_file.exists():
|
|
raise ValueError(f"Configuration '{config_name}' not found")
|
|
|
|
with open(config_file, "r") as f:
|
|
return yaml.safe_load(f)
|
|
|
|
|
|
def list_configs() -> Dict[str, Dict]:
|
|
"""List all available configurations with their details"""
|
|
configs = {}
|
|
for config_name in get_available_configs():
|
|
try:
|
|
config = load_config(config_name)
|
|
configs[config_name] = {
|
|
"description": config.get("description", ""),
|
|
"suite": config.get("suite", ""),
|
|
"architecture": config.get("architecture", ""),
|
|
"mirror": config.get("mirror", ""),
|
|
}
|
|
except Exception:
|
|
continue
|
|
return configs
|