Skip to content

Patches: template arch-derived paths in auto-generated base patch#820

Merged
lacraig2 merged 1 commit into
mainfrom
config-reshape-patches
Jun 11, 2026
Merged

Patches: template arch-derived paths in auto-generated base patch#820
lacraig2 merged 1 commit into
mainfrom
config-reshape-patches

Conversation

@lacraig2

@lacraig2 lacraig2 commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

Third PR in the config-reshape series. Targets config-reshape-core (#818) — it builds on that branch's Jinja templating. Independent of the plugin PR (#819); they're siblings on #818.

Puts the new templating to work in Penguin's auto-generated patches so architecture-dependent values are resolved from core.arch at load time instead of being compiled into the generated YAML. This directly addresses the original gripe that changing arch didn't update arch-derived values baked into patches.

What changes

  • New arch-derived template variables exposed by templating.build_context, derived from the file's core.arch:
    • {{ arch_dir }} — generic static subdir (e.g. intel64x86_64, powerpc64lepowerpc64)
    • {{ dylib_dir }} — prebuilt-dylib subdir (e.g. aarch64arm64, powerpc64leppc64el)
    • Imports are lazy/guarded so self-contained contexts (schema generation) are unaffected.
  • arch.get_dylib_subdir() is now the single source of truth for the dylib mapping; BasePatch.set_arch_info uses it instead of an inline copy (verified equivalent for every schema-supported arch).
  • BasePatch.generate emits {{ dylib_dir }} / {{ arch_dir }} in the /igloo/dylibs/* and /igloo/utils/* host paths instead of baking the subdir in. The generated base.yaml defines core.arch, so these resolve when load_config renders the patch.
  • core.arch and core.kernel deliberately stay concrete — they're the source values (templating them would be circular). Serial-device major/minor (conditional ints) and kernel-module version paths (padded-version mismatch with {{ kernel_version }}) are intentionally left baked; noted for a possible follow-up.

Testing

  • tests/unit_tests/test_config.py: +10 tests (32 total, all passing on host) — derived-var values across 7 arches, get_dylib_subdir parity, in-patch resolution, and an assertion that the generator emits the placeholders.
  • End-to-end load_config (a patch that defines core.arch and uses the derived vars) resolves to /igloo_static/dylibs/arm64/* and /igloo_static/aarch64/* as expected.

@lacraig2 lacraig2 force-pushed the config-reshape-core branch from f1b6227 to 74f934b Compare June 7, 2026 02:09
@lacraig2 lacraig2 force-pushed the config-reshape-patches branch from 098c882 to d87ba87 Compare June 7, 2026 02:09
Base automatically changed from config-reshape-core to main June 7, 2026 02:55
@lacraig2 lacraig2 force-pushed the config-reshape-patches branch from d87ba87 to 388e2b4 Compare June 7, 2026 03:08
@lacraig2 lacraig2 marked this pull request as ready for review June 7, 2026 03:23
@lacraig2 lacraig2 force-pushed the config-reshape-patches branch 4 times, most recently from 7250a13 to 7a740a6 Compare June 10, 2026 00:30
Use the new Jinja templating in auto-generated config patches so
architecture-dependent values are resolved from core.arch at load time instead
of being compiled into the generated YAML.

- Expose two arch-derived template variables, {{ arch_dir }} (generic static
  subdir, e.g. intel64 -> x86_64) and {{ dylib_dir }} (prebuilt-dylib subdir,
  e.g. aarch64 -> arm64), in templating.build_context, derived from the file's
  core.arch (lazy/guarded imports so schema-gen contexts are unaffected).
- Add arch.get_dylib_subdir() as the single source of truth for the dylib
  mapping; BasePatch.set_arch_info now uses it instead of an inline copy.
- BasePatch.generate emits {{ dylib_dir }} / {{ arch_dir }} in the /igloo/dylibs
  and /igloo/utils host paths instead of baking the subdir in. core.arch and
  core.kernel stay concrete (they are the source values).
- Tests for the derived vars, mapping parity, in-patch resolution, and that the
  generator emits the placeholders. Docs updated.
@lacraig2 lacraig2 enabled auto-merge (squash) June 11, 2026 17:16
@lacraig2 lacraig2 force-pushed the config-reshape-patches branch from 99b376e to da51102 Compare June 11, 2026 17:16
@lacraig2 lacraig2 merged commit 5f24f05 into main Jun 11, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant