microsoft / microsoft/azure-linux-dev-tools
`patch-add` overlay appends `PatchN:` tag at end of preamble instead of grouping with existing Patch tags
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 18
- Forks
- 27
- Avg merge
- 4d 33m
- Merged PRs (30d)
- 24
Description
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-addoverlay callsSpec.AddPatchEntry (edit.go:653). - When there is no
%patchlistsection, it falls back toAddTag(...)(edit.go:172). AddTagcallsAppendLinesToSection, which always inserts at the end of the section (edit.go:473).
Acceptance criteria
- New patches added via
patch-addare placed next to existing Patch/PatchN tags. (cosmetic change) - Specs with a
%patchlistsection continue to append there. - Specs with no existing patch tags behave as today.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in edit.go:653 and follow Spec.AddPatchEntry through edit.go:172 and AddTag/AppendLinesToSection at edit.go:473. Check the libsolv.spec example and existing patch-tag handling; done means patch-add groups new PatchN: tags with existing Patch tags, preserves %patchlist behavior, and leaves specs without patch tags unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100