refactor: Simplify template logic - reduce from 6 to 3 categories, remove variant_type, keep validation, remove tests
Simplified template logic: reduced from 6 categories (required, modifiers, optional, versioned, conditional, flags) to 3 categories (required, modifiers, optional). Removed variant_type and replaced with modifier-based approach (version, bootloader replaced, hardware_support). All validation methods kept for recipe generation and validation. Removed tests directory (tests/test_recipe_generator.py, tests/integration/, tests/container/). Removed non-ISO workflows (validate-recipes, test-generation, container-tests, validate-ingredients). Updated Makefile, requirements.txt, and documentation. All 20 recipes successfully generated, validated, and flattened.
This commit is contained in:
@@ -396,7 +396,7 @@ def generate_from_manifest(args: argparse.Namespace, generator: RecipeGenerator)
|
||||
|
||||
# Generate all recipes from the manifest
|
||||
for recipe_config in manifest.get('recipes', []):
|
||||
recipe_type = recipe_config['name']
|
||||
recipe_type = recipe_config.get('recipe_type', recipe_config['name'])
|
||||
if recipe_type not in generator.templates:
|
||||
print(f"Error: Unknown recipe type in manifest: {recipe_type}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
@@ -411,12 +411,8 @@ def generate_from_manifest(args: argparse.Namespace, generator: RecipeGenerator)
|
||||
# Extract version and other modifiers from variant
|
||||
version = variant['version']
|
||||
modifiers = {k: v for k, v in variant.items() if k not in ['name', 'version']}
|
||||
variant_subname = variant.get('name', '')
|
||||
|
||||
# Add variant name as modifier if present
|
||||
if variant_subname:
|
||||
modifiers['variant_type'] = variant_subname
|
||||
modifiers['variant_subname'] = variant_subname
|
||||
modifiers = {k: v for k, v in variant.items() if k not in ['name', 'version']}
|
||||
# name kept for manifest organization only, not passed to generator
|
||||
|
||||
# Generate the recipe content
|
||||
content = generator.generate(recipe_type, version, **modifiers)
|
||||
@@ -472,7 +468,7 @@ def generate_single(args: argparse.Namespace, generator: RecipeGenerator) -> Non
|
||||
# Build modifiers dictionary from command-line arguments
|
||||
# Only include non-default values to keep filenames clean
|
||||
modifiers = {
|
||||
'variant_type': 'desktop',
|
||||
|
||||
'desktop': args.desktop if args.desktop else None,
|
||||
'storage': args.storage if args.storage != 'standard' else None,
|
||||
'security': args.security if args.security != 'secure' else None,
|
||||
|
||||
Reference in New Issue
Block a user