mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 17:42:20 +00:00
Generators can now declare variant axes. Every generated entry is multiplied by each combination of choices, one per axis. A choice sets the axis name to the choice name and inserts its own values, and the entry name is suffixed with the choice names. Generators can also declare exclude rules, which remove generated entries whose values match every glob pattern in a rule. This covers unwanted variant combinations and entries like BLS rescue kernels. Entry matching for default-entry and the bootloader interface now accepts `*` anywhere in the pattern instead of only at the end, so generated entry names can be matched regardless of the kernel version in the middle of the name. The BLS generator gains a pin-names option (default true, the existing behavior). Two BLS generators reading the same directory previously produced entries with identical names; disabling pin-names prefixes them with the generator name instead. Sprout now warns when more than one entry has the same name. * docs(config): note that variants suffix pinned BLS entry names Pinned BLS entry names match the BLS entry ids, but variants still append their choice names, so those entries need a pattern like <id>-* to be selected.
47 lines
1.6 KiB
Rust
47 lines
1.6 KiB
Rust
use crate::entries::EntryDeclaration;
|
|
use alloc::string::{String, ToString};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// The default path to the BLS directory.
|
|
const BLS_TEMPLATE_PATH: &str = "\\loader";
|
|
|
|
/// The configuration of the BLS generator.
|
|
/// The BLS uses the Bootloader Specification to produce
|
|
/// entries from an input template.
|
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
|
pub struct BlsConfiguration {
|
|
/// The entry to use for as a template.
|
|
pub entry: EntryDeclaration,
|
|
/// The path to the BLS directory.
|
|
#[serde(default = "default_bls_path")]
|
|
pub path: String,
|
|
/// Whether generated entries keep the name of the BLS entry file as-is.
|
|
/// When enabled, the generator name is not prepended, so the entry names match
|
|
/// the BLS entry ids used by tools like `bootctl set-default`. Variants still append
|
|
/// their choice names, so entries of a generator with variants never match the ids
|
|
/// exactly, and are best selected with a pattern like `<id>-*`. Two BLS generators
|
|
/// that read the same BLS directory will produce entries with the same names, so
|
|
/// generators that reuse a BLS directory should disable this.
|
|
#[serde(default = "default_pin_names", rename = "pin-names")]
|
|
pub pin_names: bool,
|
|
}
|
|
|
|
/// The default configuration, which matches an empty BLS generator section.
|
|
impl Default for BlsConfiguration {
|
|
fn default() -> Self {
|
|
Self {
|
|
entry: Default::default(),
|
|
path: default_bls_path(),
|
|
pin_names: default_pin_names(),
|
|
}
|
|
}
|
|
}
|
|
|
|
fn default_pin_names() -> bool {
|
|
true
|
|
}
|
|
|
|
fn default_bls_path() -> String {
|
|
BLS_TEMPLATE_PATH.to_string()
|
|
}
|