Updated find/replace strings in the 'log --first-parent' ReplaceAction to match new patch-git.lua format that includes '--no-decorate' and splits the string across two lines.
114 lines
4.8 KiB
YAML
114 lines
4.8 KiB
YAML
actions:
|
|
- replace:
|
|
- target: "spec"
|
|
find: "%define target %{_target_cpu}-redhat-linux"
|
|
replace: |
|
|
%define target %{_target_cpu}-redhat-linux
|
|
%ifarch x86_64_v2
|
|
%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', 'r')))
|
|
local commit_marker_contents -- For git_commit_file.
|
|
if have_git then
|
|
commit_marker_contents =
|
|
replace: |
|
|
local have_git = (posix == nil -- Not running under rpm.
|
|
or (posix.access('/usr/bin/git', 'x')
|
|
and posix.access(sourcedir .. '/.git', 'r')))
|
|
local commit_marker_contents -- For git_commit_file.
|
|
-- If the branch/tag is AlmaLinux, then we need to get history of Upstream
|
|
-- branch/tag, and skip all AlmaLinux-specific commits. To avoid duplicates
|
|
-- in changelog and bumped release numbers
|
|
local log_branch = 'HEAD'
|
|
if have_git then
|
|
log_branch = string.match(run_git('rev-parse --abbrev-ref HEAD'), '([^\n]+)')
|
|
local anum = string.match(log_branch, '^a(%d+s?)$')
|
|
if anum then
|
|
log_branch = 'c' .. anum
|
|
else
|
|
log_branch = string.match(run_git('describe --tags --exact-match'), '([^\n]+)')
|
|
local anum, aname = string.match(log_branch, '^changed/a(%d+s?)/(.+)$')
|
|
if anum then
|
|
local cname = string.gsub(aname, '%.alma%.[0-9]+$', '')
|
|
log_branch = 'imports/c' .. anum .. '/' .. cname
|
|
end
|
|
end
|
|
commit_marker_contents =
|
|
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-decorate --no-renames --raw --pretty=fuller'
|
|
.. ' --date=default > ' .. git_log_file)
|
|
replace: |
|
|
'log --first-parent --no-decorate --no-renames --raw --pretty=fuller'
|
|
.. ' --date=default ' .. log_branch .. ' > ' .. git_log_file)
|
|
count: 1
|
|
- target: "patch-git.lua"
|
|
find: |
|
|
function parse_trailer(message)
|
|
replace: |
|
|
-- Try to parse version/release from "import UBI glibc-X.XX-XX.elXX" format.
|
|
-- Returns a synthetic trailer result or nil if pattern doesn't match.
|
|
local function parse_import_ubi_message(message)
|
|
-- Match pattern: import UBI glibc-VERSION-RELEASE
|
|
local version, release = string.match(message,
|
|
'^import UBI glibc%-([%d%.]+)%-([%d%.%w_]+)%s*\n')
|
|
if version and release then
|
|
local full_nvr = 'glibc-' .. version .. '-' .. release
|
|
return {
|
|
rpm_version = version,
|
|
rpm_release = release,
|
|
rpm_changelog = {'- Sync with upstream ' .. full_nvr},
|
|
rpm_changelog_stop = true,
|
|
patchgit_version = 1,
|
|
}
|
|
end
|
|
return nil
|
|
end
|
|
|
|
function parse_trailer(message)
|
|
count: 1
|
|
- target: "patch-git.lua"
|
|
find: |
|
|
-- No '\n\n', no trailer.
|
|
replace: |
|
|
-- No '\n\n', no trailer. Try fallback for "import UBI" format.
|
|
local fallback = parse_import_ubi_message(message)
|
|
if fallback then
|
|
return fallback
|
|
end
|
|
count: 1
|
|
- target: "patch-git.lua"
|
|
find: |
|
|
generate_files()
|
|
parse_commits()
|
|
replace: |
|
|
-- generate_files()
|
|
parse_commits()
|
|
count: 6
|
|
|
|
- modify_release:
|
|
- suffix: ".alma.1"
|
|
enabled: true
|
|
|
|
- changelog_entry:
|
|
- name: "Eduard Abdullin"
|
|
email: "eabdullin@almalinux.org"
|
|
line:
|
|
- "Overwrite target for x86_64_v2"
|
|
- "Update patch-git.lua to handle AlmaLinux branches correctly"
|
|
- "Add support for AlmaLinux import UBI format"
|