Summary
When the patch-add overlay adds a patch to a spec that has no %patchlist section, the new PatchN: tag is appended at the very end of the preamble (just before %description) rather than being placed alongside the existing Patch/PatchN tags. This produces valid but awkwardly-placed output.
Example
For libsolv.spec, which has an upstream Patch: tag near the top of the preamble, running the patch-add overlay:
[[components.libsolv.overlays]]
description = "Make file time available for dnf plugins, a prerequisite for virtual snapshots"
type = "patch-add"
source = "0002-Make-file-time-available-for-dnf-plugins.patch"
inserts Patch1: at ~L92 (after the %if %{with zchunk}...%endif BuildRequires block, immediately before %description), instead of next to the existing Patch: tag at ~L70.
Root cause
- The
patch-add overlay calls Spec.AddPatchEntry (edit.go:653).
- When there is no
%patchlist section, it falls back to AddTag(...) (edit.go:172).
AddTag calls AppendLinesToSection, which always inserts at the end of the section (edit.go:473).
Acceptance criteria
- New patches added via
patch-add are placed next to existing Patch/PatchN tags. (cosmetic change)
- Specs with a
%patchlist section continue to append there.
- Specs with no existing patch tags behave as today.
Summary
When the
patch-addoverlay adds a patch to a spec that has no%patchlistsection, the newPatchN:tag is appended at the very end of the preamble (just before%description) rather than being placed alongside the existing Patch/PatchN tags. This produces valid but awkwardly-placed output.Example
For
libsolv.spec, which has an upstream Patch: tag near the top of the preamble, running the patch-add overlay:inserts Patch1: at ~L92 (after the
%if %{with zchunk}...%endifBuildRequires block, immediately before%description), instead of next to the existing Patch: tag at ~L70.Root cause
patch-addoverlay callsSpec.AddPatchEntry (edit.go:653).%patchlistsection, it falls back toAddTag(...)(edit.go:172).AddTagcallsAppendLinesToSection, which always inserts at the end of the section (edit.go:473).Acceptance criteria
patch-addare placed next to existing Patch/PatchN tags. (cosmetic change)%patchlistsection continue to append there.