From: Herton R. Krzesinski <herton(a)redhat.com>
redhat: make genspec prefer metadata from git notes
This is forwarded ported from current rhel-9/centos9 tree. Due lots
of recent changes in the ARK tree regarding Makefile and variables,
some changes had to be done to this: dropped variable changes/additions
to redhat/Makefile and redhat/genspec.sh, since those now are exported
from the Makefile; for the same reason, the usage of ZSTREAM_FLAG
variable was not present, and used the exported __ZSTREAM variable from
the Makefile.
From: Jan Stancek <jstancek(a)redhat.com>
Bugzilla: INTERNAL
Upstream Status: RHEL only
Conflicts: rhel-9 genlog.py is using sets instead
Forward-port of rhel-8 commit:
commit fb48fa615c3e8ad4c613a4ae97caec9cabe6081f
Author: Jan Stancek <jstancek(a)redhat.com>
Date: Wed Mar 9 09:58:53 2022 +0100
redhat: make genspec prefer metadata from git notes
Bugzilla: INTERNAL
Upstream Status: RHEL only
Rather than relying on ZSTREAM flag to choose between git notes and commit log,
use both and make genlog.py prefer git notes.
Signed-off-by: Jan Stancek <jstancek(a)redhat.com>
Signed-off-by: Jan Stancek <jstancek(a)redhat.com>
Signed-off-by: Herton R. Krzesinski <herton(a)redhat.com>
diff --git a/redhat/genlog.py b/redhat/genlog.py
index blahblah..blahblah 100755
--- a/redhat/genlog.py
+++ b/redhat/genlog.py
@@ -57,6 +57,12 @@ def parse_commit(commit):
bug_set = set()
zbug_set = set()
for line in lines[1:]:
+ # Metadata in git notes has priority over commit log
+ # If we found any BZ/ZBZ/CVE in git notes, we ignore commit log
+ if line == "^^^NOTES-END^^^":
+ if bug_set or zbug_set or cve_set:
+ break
+
# Process Bugzilla and ZStream Bugzilla entries
bug_set.update(find_bz_in_line(line, 'Bugzilla'))
zbug_set.update(find_bz_in_line(line, 'Z-Bugzilla'))
diff --git a/redhat/genspec.sh b/redhat/genspec.sh
index blahblah..blahblah 100755
--- a/redhat/genspec.sh
+++ b/redhat/genspec.sh
@@ -87,12 +87,8 @@ done
# test changes.
[ -n "$RHSELFTESTDATA" ] && exit 0
-GIT_FORMAT="--format=- %s (%an)%n%b"
-GIT_NOTES=""
-if [ "$__ZSTREAM" != "no" ]; then
- GIT_FORMAT="--format=- %s (%an)%n%N"
- GIT_NOTES="--notes=refs/notes/${RHEL_MAJOR}.${RHEL_MINOR}*"
-fi
+GIT_FORMAT="--format=- %s (%an)%n%N%n^^^NOTES-END^^^%n%b"
+GIT_NOTES="--notes=refs/notes/${RHEL_MAJOR}.${RHEL_MINOR}*"
echo > "$clogf"
--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1764