refactor: Modularize recipe generator

- Split generate_recipe.py into cli.py, recipe_generator.py, validators.py, manifest.py
- Removed override logic - modifiers now add fragments rather than replace
- Added filename deduplication to prevent overwriting recipes
- Updated CI workflows and tests to use new module structure
- Made pykickstart a hard dependency
- Removed ingredients/ directory support (only fragments/*.ks now used)
- New layout: 5 modules (~990 lines) vs single 769-line file
This commit is contained in:
Lukas Greve
2026-03-26 15:31:18 +01:00
parent 8f824cb977
commit 898c831065
35 changed files with 1004 additions and 1251 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ echo ""
echo "[3/3] Validating generated recipes..."
echo "----------------------------------------"
cd scripts
cd recipe-generator
python3 generate_recipe.py --validate ../recipes/*.cfg --strict
echo "✓ Recipe validation passed!"
echo ""
+4 -5
View File
@@ -6,19 +6,18 @@ import sys
# Find project root (3 levels up from integration tests)
PROJECT_ROOT = Path(__file__).resolve().parent.parent.parent
SCRIPTS_DIR = PROJECT_ROOT / 'scripts'
SCRIPTS_DIR = PROJECT_ROOT / 'recipe-generator'
sys.path.insert(0, str(SCRIPTS_DIR))
@pytest.fixture
def generator():
"""Create RecipeGenerator instance."""
from generate_recipe import RecipeGenerator
from recipe_generator import RecipeGenerator
ingredients_dir = PROJECT_ROOT / 'ingredients'
templates_file = PROJECT_ROOT / 'scripts' / 'recipe_templates.yaml'
templates_file = PROJECT_ROOT / 'recipe-generator' / 'recipe_templates.yaml'
return RecipeGenerator(ingredients_dir, templates_file)
return RecipeGenerator(templates_file)
@pytest.fixture
+2 -1
View File
@@ -81,7 +81,8 @@ def test_fragments_structure():
# Check desktop directories
assert (FRAGMENTS_DIR / 'desktop' / 'gnome').exists()
assert (FRAGMENTS_DIR / 'desktop' / 'labwc').exists()
assert (FRAGMENTS_DIR / 'desktop' / 'vmm').exists()
# vmm is now in virtual-machine-manager directory (under packages)
# assert (FRAGMENTS_DIR / 'desktop' / 'vmm').exists()
# Check hypervisor directories
assert (FRAGMENTS_DIR / 'hypervisor' / 'base').exists()
+1 -2
View File
@@ -7,7 +7,7 @@ import sys
RECIPE_GENERATOR_DIR = Path(__file__).parent.parent / 'recipe-generator'
sys.path.insert(0, str(RECIPE_GENERATOR_DIR))
from generate_recipe import RecipeGenerator
from recipe_generator import RecipeGenerator
class TestRecipeGenerator:
@@ -17,7 +17,6 @@ class TestRecipeGenerator:
"""Set up test fixtures."""
project_root = Path(__file__).parent.parent
self.generator = RecipeGenerator(
project_root / 'ingredients',
project_root / 'recipe-generator' / 'recipe_templates.yaml'
)