You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/overlays.md
+19-2Lines changed: 19 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ These overlays modify `.spec` files using the structured spec parser, allowing p
15
15
| Type | Description | Required Fields |
16
16
|------|-------------|-----------------|
17
17
|`spec-add-tag`| Adds a tag to the spec; **fails if the tag already exists**|`tag`, `value`|
18
+
|`spec-insert-tag`| Inserts a tag after the last tag of the same family (e.g., `Source9999` after the last `Source*`); falls back to after the last tag of any kind, then appends to the section end. **Fails if targeting a sub-package that doesn't exist.**|`tag`, `value`|
18
19
|`spec-set-tag`| Sets a tag value; replaces if exists, adds if not |`tag`, `value`|
19
20
|`spec-update-tag`| Updates an existing tag; **fails if the tag doesn't exist**|`tag`, `value`|
20
21
|`spec-remove-tag`| Removes a tag from the spec; **fails if the tag doesn't exist**|`tag`|
@@ -50,8 +51,8 @@ successfully makes a replacement to at least one matching file.
50
51
|-------|----------|-------------|---------|
51
52
| Type |`type`|**Required.** The overlay type to apply | All overlays |
52
53
| Description |`description`| Human-readable explanation documenting the need for the change; helps identify overlays in error messages | All (optional) |
53
-
| Tag |`tag`| The spec tag name (e.g., `BuildRequires`, `Requires`, `Version`) |`spec-add-tag`, `spec-set-tag`, `spec-update-tag`, `spec-remove-tag`|
54
-
| Value |`value`| The tag value to set, or value to match for removal |`spec-add-tag`, `spec-set-tag`, `spec-update-tag`, `spec-remove-tag` (optional for matching) |
54
+
| Tag |`tag`| The spec tag name (e.g., `BuildRequires`, `Requires`, `Version`) |`spec-add-tag`, `spec-insert-tag`, `spec-set-tag`, `spec-update-tag`, `spec-remove-tag`|
55
+
| Value |`value`| The tag value to set, or value to match for removal |`spec-add-tag`, `spec-insert-tag`, `spec-set-tag`, `spec-update-tag`, `spec-remove-tag` (optional for matching) |
55
56
| Section |`section`| The spec section to target (e.g., `%build`, `%install`, `%files`, `%description`) |`spec-prepend-lines`, `spec-append-lines`, `spec-search-replace` (optional) |
56
57
| Package |`package`| The sub-package name for multi-package specs; omit to target the main package | All spec overlays (optional) |
57
58
| Regex |`regex`| Regular expression pattern to match |`spec-search-replace`, `file-search-replace`|
@@ -74,6 +75,22 @@ tag = "BuildRequires"
74
75
value = "some-devel-package"
75
76
```
76
77
78
+
### Inserting a Tag by Family
79
+
80
+
Use `spec-insert-tag` to place a tag after the last existing tag of the same family rather than appending it to the end of the section. The "family" is determined by stripping trailing digits from the tag name (case-insensitive), so `Source0`, `Source1`, and `Source` all belong to the `Source` family.
81
+
82
+
This is useful when tag placement matters — for example, ensuring a new `Source` tag doesn't end up after macros like `%fontpkg` or inside `%if` conditionals:
83
+
84
+
```toml
85
+
[[components.mypackage.overlays]]
86
+
type = "spec-insert-tag"
87
+
description = "Add macros file as a source"
88
+
tag = "Source9999"
89
+
value = "macros.azl.macros"
90
+
```
91
+
92
+
If no tags from the same family exist, the tag is placed after the last tag of any kind. If there are no tags at all, it falls back to `spec-add-tag` behavior (appending to the section end).
93
+
77
94
### Setting a Version
78
95
79
96
Use `spec-set-tag` when you want to set a value regardless of whether the tag exists:
Copy file name to clipboardExpand all lines: internal/projectconfig/overlay.go
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ import (
15
15
// ComponentOverlay represents an overlay that may be applied to a component's spec and/or its sources.
16
16
typeComponentOverlaystruct {
17
17
// The type of overlay to apply.
18
-
TypeComponentOverlayType`toml:"type" json:"type" validate:"required" jsonschema:"enum=spec-add-tag,enum=spec-set-tag,enum=spec-update-tag,enum=spec-remove-tag,enum=spec-prepend-lines,enum=spec-append-lines,enum=spec-search-replace,enum=patch-add,enum=patch-remove,enum=file-prepend-lines,enum=file-search-replace,enum=file-add,enum=file-remove,enum=file-rename,title=Overlay type,description=The type of overlay to apply"`
18
+
TypeComponentOverlayType`toml:"type" json:"type" validate:"required" jsonschema:"enum=spec-add-tag,enum=spec-insert-tag,enum=spec-set-tag,enum=spec-update-tag,enum=spec-remove-tag,enum=spec-prepend-lines,enum=spec-append-lines,enum=spec-search-replace,enum=patch-add,enum=patch-remove,enum=file-prepend-lines,enum=file-search-replace,enum=file-add,enum=file-remove,enum=file-rename,title=Overlay type,description=The type of overlay to apply"`
19
19
// Human readable description of overlay; primarily present to document the need for the change.
20
20
Descriptionstring`toml:"description,omitempty" json:"description,omitempty" jsonschema:"title=Description,description=Human readable description of overlay"`
0 commit comments