feat: Static release bumped during dist-git generation#54
feat: Static release bumped during dist-git generation#54Tonisal-byte wants to merge 2 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Enables automatic bumping of static RPM Release: values during synthetic dist-git generation (--with-git), so releases remain unique per synthetic commit when %autorelease is not used.
Changes:
- Add logic to detect
%autoreleasevs staticRelease:values and bump static releases by the number of synthetic commits. - Invoke the static release bump as part of synthetic history preparation before staging changes.
- Add unit tests for release detection, bumping, and Release tag extraction.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/app/azldev/core/sources/sourceprep.go | Calls the new static release bump step during synthetic history creation. |
| internal/app/azldev/core/sources/releaseoverlay.go | Introduces helpers to read Release: from spec, detect %autorelease, bump static releases, and apply an overlay. |
| internal/app/azldev/core/sources/releaseoverlay_test.go | Adds tests covering %autorelease detection, static bumping, and Release tag parsing behavior. |
| func BumpStaticRelease(releaseValue string, commitCount int) (string, error) { | ||
| matches := staticReleasePattern.FindStringSubmatch(releaseValue) | ||
| if matches == nil { | ||
| return "", fmt.Errorf("release value %#q does not start with an integer", releaseValue) |
There was a problem hiding this comment.
We know we'll find specs that don't use autorelease and don't have a standard integer followed by %{?dist}.
Example: https://src.fedoraproject.org/rpms/kernel/blob/rawhide/f/kernel.spec
For these, we'll want some way to avoid this being a fatal error. From Dan's "3 categories", this would be that 3rd case.
For those it would be okay for us to manually manage their Release values, but we'd need a way to do so. We can use an overlay to set the Release tag's value, but would then also need a way to disable this logic from running (and failing).
This PR allows azldev to automatically update the static release number for spec which do not use
%autorelease. The new release number is calculated by taking the original release number and adding the number of synthetic commits (from the project repo). This behavior can only be observed when creating synthetic dist-git using the--with-gitflag on eitherprepare-sourcesorbuildcommands.