From: Herton R. Krzesinski <[email protected]>

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 <[email protected]>

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 <[email protected]>
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 <[email protected]>

Signed-off-by: Jan Stancek <[email protected]>
Signed-off-by: Herton R. Krzesinski <[email protected]>

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
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to