2025-12-08 11:43:39 +01:00
|
|
|
|
# Capability Resolution & Installer Shadowing
|
|
|
|
|
|
|
2025-12-10 17:23:33 +01:00
|
|
|
|
This document explains how `pkgmgr` decides **which installer should run** when multiple installation mechanisms are available in a repository.
|
|
|
|
|
|
It reflects the logic shown in the setup-controller diagram:
|
|
|
|
|
|
|
|
|
|
|
|
➡️ **Full graphical schema:** [https://s.veen.world/pkgmgrmp](https://s.veen.world/pkgmgrmp)
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## Layer Hierarchy (Strength Order)
|
|
|
|
|
|
|
|
|
|
|
|
Installers are evaluated from **strongest to weakest**.
|
|
|
|
|
|
A stronger layer shadows all layers below it.
|
2025-12-08 11:43:39 +01:00
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
┌───────────────────────────┐ Highest layer
|
|
|
|
|
|
│ OS-PACKAGES │ (PKGBUILD / debian / rpm)
|
|
|
|
|
|
└───────────▲───────────────┘
|
|
|
|
|
|
│ shadows lower layers
|
|
|
|
|
|
┌───────────┴───────────────┐
|
|
|
|
|
|
│ NIX │ (flake.nix)
|
|
|
|
|
|
└───────────▲───────────────┘
|
|
|
|
|
|
│ shadows lower layers
|
|
|
|
|
|
┌───────────┴───────────────┐
|
|
|
|
|
|
│ PYTHON │ (pyproject.toml)
|
|
|
|
|
|
└───────────▲───────────────┘
|
|
|
|
|
|
│ shadows lower layers
|
|
|
|
|
|
┌───────────┴───────────────┐
|
|
|
|
|
|
│ MAKEFILE │ (Makefile)
|
|
|
|
|
|
└────────────────────────────┘ Lowest layer
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2025-12-10 17:23:33 +01:00
|
|
|
|
## Capability Matrix
|
|
|
|
|
|
|
|
|
|
|
|
Each layer provides a set of **capabilities**.
|
|
|
|
|
|
Layers that provide *all* capabilities of a lower layer **shadow** that layer.
|
|
|
|
|
|
|
|
|
|
|
|
| Capability | Makefile | Python | Nix | OS-Pkgs |
|
|
|
|
|
|
| -------------------- | -------- | ------------ | --- | ------- |
|
|
|
|
|
|
| `make-install` | ✔ | (optional) ✔ | ✔ | ✔ |
|
|
|
|
|
|
| `python-runtime` | – | ✔ | ✔ | ✔ |
|
|
|
|
|
|
| `binary/cli` | – | – | ✔ | ✔ |
|
|
|
|
|
|
| `system-integration` | – | – | – | ✔ |
|
|
|
|
|
|
|
|
|
|
|
|
✔ = capability available
|
|
|
|
|
|
– = not provided by this layer
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## Scenario Matrix (Expected Installer Execution)
|
2025-12-08 11:43:39 +01:00
|
|
|
|
|
|
|
|
|
|
| Scenario | Makefile | Python | Nix | OS-Pkgs | Test Name |
|
|
|
|
|
|
| -------------------------- | -------- | ------ | --- | ------- | ----------------------------- |
|
|
|
|
|
|
| 1) Only Makefile | ✔ | – | – | – | `only_makefile` |
|
|
|
|
|
|
| 2) Python + Makefile | ✔ | ✔ | – | – | `python_and_makefile` |
|
|
|
|
|
|
| 3) Python shadows Makefile | ✗ | ✔ | – | – | `python_shadows_makefile` |
|
|
|
|
|
|
| 4) Nix shadows Py & MF | ✗ | ✗ | ✔ | – | `nix_shadows_python_makefile` |
|
|
|
|
|
|
| 5) OS-Pkgs shadow all | ✗ | ✗ | ✗ | ✔ | `os_packages_shadow_all` |
|
|
|
|
|
|
|
|
|
|
|
|
Legend:
|
|
|
|
|
|
✔ = installer runs
|
2025-12-10 17:23:33 +01:00
|
|
|
|
✗ = installer is skipped (shadowed)
|
|
|
|
|
|
– = layer not present in this scenario
|
2025-12-08 11:43:39 +01:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## What the Integration Test Confirms
|
|
|
|
|
|
|
2025-12-10 17:23:33 +01:00
|
|
|
|
The integration tests ensure that the **actual execution** matches the theoretical capability model.
|
2025-12-08 11:43:39 +01:00
|
|
|
|
|
|
|
|
|
|
### 1) Only Makefile
|
|
|
|
|
|
|
2025-12-10 17:23:33 +01:00
|
|
|
|
* Only `Makefile` present
|
|
|
|
|
|
→ MakefileInstaller runs.
|
2025-12-08 11:43:39 +01:00
|
|
|
|
|
|
|
|
|
|
### 2) Python + Makefile
|
|
|
|
|
|
|
2025-12-10 17:23:33 +01:00
|
|
|
|
* Python provides `python-runtime`
|
|
|
|
|
|
* Makefile provides `make-install`
|
|
|
|
|
|
→ Both run (capabilities are disjoint).
|
2025-12-08 11:43:39 +01:00
|
|
|
|
|
|
|
|
|
|
### 3) Python shadows Makefile
|
|
|
|
|
|
|
2025-12-10 17:23:33 +01:00
|
|
|
|
* Python additionally advertises `make-install`
|
|
|
|
|
|
→ MakefileInstaller is skipped.
|
2025-12-08 11:43:39 +01:00
|
|
|
|
|
|
|
|
|
|
### 4) Nix shadows Python & Makefile
|
|
|
|
|
|
|
2025-12-10 17:23:33 +01:00
|
|
|
|
* Nix provides: `python-runtime` + `make-install`
|
|
|
|
|
|
→ PythonInstaller and MakefileInstaller are skipped.
|
|
|
|
|
|
→ Only NixInstaller runs.
|
2025-12-08 11:43:39 +01:00
|
|
|
|
|
2025-12-10 17:23:33 +01:00
|
|
|
|
### 5) OS-Pkg layer shadows all
|
2025-12-08 11:43:39 +01:00
|
|
|
|
|
2025-12-10 17:23:33 +01:00
|
|
|
|
* OS packages provide all capabilities
|
|
|
|
|
|
→ Only OS installer runs.
|
2025-12-08 11:43:39 +01:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## Capability Processing Flowchart
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
┌────────────────────────────┐
|
|
|
|
|
|
│ Start │
|
|
|
|
|
|
└───────────────┬────────────┘
|
|
|
|
|
|
│
|
|
|
|
|
|
provided_capabilities = ∅
|
|
|
|
|
|
│
|
|
|
|
|
|
▼
|
|
|
|
|
|
┌──────────────────────────────────────────────┐
|
|
|
|
|
|
│ For each installer in layer order (low→high) │
|
|
|
|
|
|
└───────────────────┬──────────────────────────┘
|
|
|
|
|
|
│
|
|
|
|
|
|
supports(ctx)?│
|
|
|
|
|
|
┌─────────┴──────────┐
|
|
|
|
|
|
│ no │
|
|
|
|
|
|
│ → skip installer │
|
|
|
|
|
|
└─────────┬──────────┘
|
|
|
|
|
|
│ yes
|
|
|
|
|
|
▼
|
|
|
|
|
|
caps = detect_capabilities(layer)
|
|
|
|
|
|
│
|
|
|
|
|
|
caps ⊆ provided_capabilities ?
|
|
|
|
|
|
┌─────────────┬─────────────┐
|
|
|
|
|
|
│ yes │ no │
|
|
|
|
|
|
│ skip │ run installer│
|
|
|
|
|
|
└─────────────┴──────────────┘
|
|
|
|
|
|
│
|
|
|
|
|
|
▼
|
|
|
|
|
|
provided_capabilities ∪= caps
|
|
|
|
|
|
│
|
|
|
|
|
|
▼
|
|
|
|
|
|
┌────────────────────────┐
|
|
|
|
|
|
│ End of installer list │
|
|
|
|
|
|
└────────────────────────┘
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2025-12-10 17:23:33 +01:00
|
|
|
|
## Core Principle
|
|
|
|
|
|
|
|
|
|
|
|
**A layer is executed only if it contributes at least one capability that no stronger layer has already provided.**
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## Link to the Setup Controller Diagram
|
|
|
|
|
|
|
|
|
|
|
|
The full visual schema is available here:
|
2025-12-08 11:43:39 +01:00
|
|
|
|
|
2025-12-10 17:23:33 +01:00
|
|
|
|
➡️ **[https://s.veen.world/pkgmgrmp](https://s.veen.world/pkgmgrmp)**
|