Update patch-git.lua to handle AlmaLinux branches correctly

This commit is contained in:
eabdullin 2025-09-16 13:30:18 +03:00
parent 7e5bf08f12
commit 5c0c36b092

View File

@ -8,6 +8,48 @@ actions:
%define target x86_64-redhat-linux
%endif
count: 1
- target: "patch-git.lua"
find: |
local have_git = (posix == nil -- Not running under rpm.
or (posix.access('/usr/bin/git', 'x')
and posix.access(sourcedir .. '/.git/.', 'x')))
local commit_marker_contents -- For git_commit_file.
replace: |
local have_git = (posix == nil -- Not running under rpm.
or (posix.access('/usr/bin/git', 'x')
and posix.access(sourcedir .. '/.git/.', 'x')))
local commit_marker_contents -- For git_commit_file.
-- If the branch is AlmaLinux branch, then we need to get history of Upstream
-- branch, and skip all AlmaLinux-specific commits. To avoid duplicates
-- in changelog and bumped release numbers
local branch = string.match(run_git('rev-parse --abbrev-ref HEAD'), '([^\n]+)')
local log_branch = branch
local anum = string.match(branch, '^a(%d+)s$')
if anum then
log_branch = 'c' .. anum .. 's'
else
log_branch = 'HEAD'
end
count: 1
- target: "patch-git.lua"
find: |
commit_marker_contents =
run_git('rev-parse HEAD') .. 'v' .. VERSION .. '\n'
replace: |
commit_marker_contents =
run_git('rev-parse ' .. log_branch) .. 'v' .. VERSION .. '\n'
count: 1
- target: "patch-git.lua"
find: |
'log --first-parent --no-renames --raw --pretty=fuller --date=default > '
.. git_log_file)
replace: |
'log --first-parent --no-renames --raw --pretty=fuller --date=default '
.. log_branch .. ' > ' .. git_log_file)
count: 1
- modify_release:
- suffix: ".alma.1"
@ -18,3 +60,4 @@ actions:
email: "eabdullin@almalinux.org"
line:
- "Overwrite target for x86_64_v2"
- "Update patch-git.lua to handle AlmaLinux branches correctly"