1
0
mirror of https://passt.top/passt synced 2024-12-22 13:45:32 +00:00
passt/contrib/fedora/rpkg.macros
Stefano Brivio f87b11c7be fedora/rpkg: List myself as author for changelog entries
...instead of the latest author for contrib/fedora.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2024-07-26 16:40:41 +02:00

62 lines
1.7 KiB
Plaintext

# SPDX-License-Identifier: GPL-2.0-or-later
#
# PASST - Plug A Simple Socket Transport
# for qemu/UNIX domain socket mode
#
# PASTA - Pack A Subtle Tap Abstraction
# for network namespace/tap device mode
#
# contrib/fedora/rpkg.macros - rpkg macros (for COPR builds)
#
# Copyright (c) 2022 Red Hat GmbH
# Author: Stefano Brivio <sbrivio@redhat.com>
function git_version {
__commit="$(git rev-parse --short "${1:-HEAD}")"
__date="$(git log --pretty="format:%cI" "${__commit}" -1)"
printf "0^%s.g%s" "$(date -uI -d "${__date}" | tr -d -)" "${__commit}"
}
function git_head {
git rev-parse HEAD
}
function passt_git_changelog_entry {
__from="${2}"
__to="${1}"
[ -z "${__from}" ] && __from="$(git rev-list --max-parents=0 HEAD)"
__date="$(git log --pretty="format:%cI" "${__to}" -1)"
__author="Stefano Brivio <sbrivio@redhat.com>"
# Use:
# __author="$(git log -1 --pretty="format:%an <%ae>" ${__to} -- contrib/fedora)"
# if you want the author of changelog entries to match the latest
# author for contrib/fedora
printf "* %s %s - %s\n" "$(date "+%a %b %e %Y" -d "${__date}")" "${__author}" "$(git_version "${__to}")-1"
IFS='
'
for l in $(git log ${__from}..${__to} --pretty=format:"- %s" -- contrib/fedora); do
printf "%s%s\n" '-' "${l#*:}" | sed s/%/%%/g
done
unset IFS
printf "%s Upstream changes: https://passt.top/passt/log/?qt=range&q=%s..%s\n\n" '-' "${__from}" "${__to}"
}
function passt_git_changelog_pairs {
while [ -n "${2}" ]; do
passt_git_changelog_entry "${1}" "${2}"
shift 2
done
passt_git_changelog_entry "${1}" ""
}
function passt_git_changelog {
passt_git_changelog_pairs $((git tag --sort="-v:refname"|tail -n+2; git tag --sort="-v:refname") | sort -r)
}