From: Herton Krzesinski on gitlab.com Merge Request: https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865
The current awk logic is complex and relied on Patchwork metadata. As we moved on to gitlab, it doesn't pick anymore bugzilla or CVE info from commits. This adds a simpler python script which can scan through the commit log and adds bugzilla/cve info if available.
From: Herton R. Krzesinski herton@redhat.com
redhat: add genlog.py script
Upstream Status: RHEL only Tested: verified changelog created after make rh-release
This change adds a separate python script that will generate changelog items for the kernel RPM package, based on git log contents. It aims to be a straight replacement of the current awk logic in redhat/genspec.sh.
I received review feedback from Jan Stancek, Frantisek Hrbata, Don Zickus on an earlier version of the script, and this version contains suggestions made by them.
Signed-off-by: Herton R. Krzesinski herton@redhat.com
diff a/redhat/genlog.py b/redhat/genlog.py --- /dev/null +++ b/redhat/genlog.py @@ -0,0 +1,110 @@ +#!/usr/bin/python3 +# +# This script parses a git log from stdin, which should be given with: +# $ git log [<options>] -z --format="- %s (%an)%n%b" [<range>] [[--] <path>...] | ... +# And then outputs to stdout a trimmed changelog for use with rpm packaging +# +# Author: Herton R. Krzesinski herton@redhat.com +# Copyright (C) 2021 Red Hat, Inc. +# +# This software may be freely redistributed under the terms of the GNU +# General Public License (GPL). + +"""Parses a git log from stdin, and output a log entry for an rpm.""" + +import re +import sys + +def find_bz_in_line(line, prefix): + """Return bug number from properly formated Bugzilla: line.""" + # BZs must begin with '{prefix}: ' and contain a complete BZ URL or id + _bugs = [] + if not line.startswith(f"{prefix}: "): + return _bugs + bznum_re = re.compile(r'(?P<bug_ids> \d{4,8})|' + r'( http(s)?://bugzilla.redhat.com/(show_bug.cgi?id=)?(?P<url_bugs>\d{4,8}))') + for match in bznum_re.finditer(line[len(f"{prefix}:"):]): + for group in [ 'bug_ids', 'url_bugs' ]: + if match.group(group): + bid = match.group(group).strip() + if not bid in _bugs: + _bugs.append(bid) + return _bugs + + +def find_cve_in_line(line): + """Return cve number from properly formated CVE: line.""" + # CVEs must begin with 'CVE: ' + cve_list = [] + if not line.startswith("CVE: "): + return cve_list + _cves = line[len("CVE: "):].split() + pattern = "(?P<cve>CVE-[0-9]+-[0-9]+)" + cve_re = re.compile(pattern) + for cve_item in _cves: + cve = cve_re.match(cve_item) + if cve: + cve_list.append(cve.group('cve')) + return cve_list + + +def parse_commit(commit): + """Extract metadata from a commit log message.""" + lines = commit.split('\n') + + # remove any '%' character, since it'll be used inside the rpm spec changelog + log_entry = lines[0].replace("%","") + + patchwork = lines[2].startswith("Patchwork-id: ") + + cve_list = [] + bug_list = [] + zbug_list = [] + for line in lines[1:]: + # If this is a patch applied through patchwork, we can leave processing + # when outside of Patchwork metadata block + if patchwork and line == "": + break + + # Process Bugzilla and ZStream Bugzilla entries + _bugs = find_bz_in_line(line, 'Bugzilla') + if _bugs: + for bzn in _bugs: + if not bzn in bug_list: + bug_list.append(bzn) + continue + _zbugs = find_bz_in_line(line, 'Z-Bugzilla') + if _zbugs: + for bzn in _zbugs: + if not bzn in zbug_list: + zbug_list.append(bzn) + continue + + # Grab CVE tags if they are present + _cves = find_cve_in_line(line) + for cve in _cves: + if not cve in cve_list: + cve_list.append(cve) + + return (log_entry, cve_list, bug_list, zbug_list) + + +if __name__ == "__main__": + commits = sys.stdin.read().split('\0') + for c in commits: + if not c: + continue + log_item, cves, bugs, zbugs = parse_commit(c) + entry = f"{log_item}" + if bugs or zbugs: + entry += " [" + if zbugs: + entry += " ".join(zbugs) + if bugs and zbugs: + entry += " " + if bugs: + entry += " ".join(bugs) + entry += "]" + if cves: + entry += " {" + " ".join(cves) + "}" + print(entry)
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865
From: CKI Bot on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865#note_48918360...
Hi! This is the friendly CKI test bot.
It appears that you are not a member of redhat/red-hat-ci- tools/kernel/cki-runs/trusted-pipelines. This means that the CI pipeline on your MR will fail. As getting testing is important, I'll be responsible for testing your changes. After every MR change, I'll start a small testing pipeline and link it here so you can follow the results. I'll also create and link a pipeline for hardware testing that the reviewers can start to get extra test coverage.
From: Herton R. Krzesinski herton@redhat.com
redhat: replace inline awk script with genlog.py call
Upstream Status: RHEL only Tested: verified changelog created after make rh-release
This wires in the genlog.py script call in genspec.sh, replacing the previous inline awk script.
Signed-off-by: Herton R. Krzesinski herton@redhat.com
diff a/redhat/genspec.sh b/redhat/genspec.sh --- a/redhat/genspec.sh +++ b/redhat/genspec.sh @@ -47,124 +47,8 @@ if [[ -z $lasttag ]]; then fi fi echo "Gathering new log entries since $lasttag" -git format-patch --no-renames -k --stdout ^master "$lasttag".. -- ":!/redhat/rhdocs" | awk ' -BEGIN{TYPE="PATCHJUNK"; } - # add an entry to changelog - function changelog(subjectline, nameline, zstream) - { - subj = substr(subjectline, 10); - gsub(/%/, "", subj) - name = substr(nameline, 7); - pos=match(name, /</); - name=substr(name,1,pos-2); - bz=substr(BZ,11); - zbz=substr(ZBZ,13); - meta = ""; - if (zstream == "no") { - if (bz != "") { - meta = " [" bz "]"; - } - } else { - if (zbz != "") { - if (bz != "") { - meta = " [" zbz " " bz "]"; - } else { - meta = " [" zbz "]"; - } - } - } - cve = substr(CVE, 6); - if (cve != "") { - if (meta != "") { - meta = meta " {" cve "}"; - } else { - meta = " {" cve "}"; - } - } - - print "- " subj " (" name ")" meta >> CLOGF; - } - - #special separator, close previous patch - /^From / { if (TYPE=="PATCHJUNK") { - COMMIT=substr($0, 6, 40); - TYPE="HEADER"; - LASTHDR="NEW"; - next; - } } - - #interesting header stuff - /^From: / { if (TYPE=="HEADER") { - namestr=$0; - #check for mime encoding on the email headers - #git uses utf-8 q encoding - if ( $0 ~ /=?utf-8?q/ ) { - #get rid of the meta utf-8 junk - gsub(/=?utf-8?q?/, ""); - gsub(/?=/, ""); - - #translate each char - n=split($0, a, "="); - namestr = sprintf("%s", a[1]); - for (i = 2; i <= n; ++i) { - utf = substr(a[i], 0, 2); - c = strtonum("0x" utf); - namestr = sprintf("%s%c%s", namestr, c, substr(a[i],3)); - } - } - NAMELINE=namestr; next; - } - } - /^Date: / {if (TYPE=="HEADER") {DATELINE=$0; next; } } - /^Subject: / { if (TYPE=="HEADER") {SUBJECTLINE=$0; LASTHDR="SUBJ"; next; } } - # partially attempt to deal with RFC2822 continuation lines in headers - /^\s/ { if (TYPE=="HEADER") { if (LASTHDR=="SUBJ") { SUBJECTLINE=(SUBJECTLINE $0); } next; } } - /^Bugzilla: / { if (TYPE=="META") {BZ=$0; } } - /^Z-Bugzilla: / { if (TYPE=="META") {ZBZ=$0; } } - /^CVE: / { if (TYPE=="META") {CVE=$0; } } - - #blank line triggers end of header and to begin processing - /^$/ { - if (TYPE=="META") { - #create the dynamic changelog entry - changelog(SUBJECTLINE, NAMELINE, ZSTREAM); - #reset cve values because they do not always exist - CVE=""; - BZ=""; - ZBZ=""; - TYPE="BODY"; - } - if (TYPE=="HEADER") { - TYPE="META"; next; - } - } - - #in order to handle overlapping keywords, we keep track of each - #section of the patchfile and only process keywords in the correct section - /^---$/ { - if (TYPE=="META") { - # no meta data found, just use the subject line to fill - # the changelog - changelog(SUBJECTLINE, NAMELINE, ZSTREAM); - #reset cve values because they do not always exist - CVE=""; - BZ=""; - ZBZ=""; - TYPE="BODY"; - } - if (TYPE=="BODY") { - TYPE="PATCHSEP"; - } - } - /^diff --git/ { if (TYPE=="PATCHSEP") { TYPE="PATCH"; } } - /^-- $/ { if (TYPE=="PATCH") { TYPE="PATCHJUNK"; } } - - #filter out stuff we do not care about - { if (TYPE == "PATCHSEP") { next; } } - { if (TYPE == "PATCHJUNK") { next; } } - { if (TYPE == "HEADER") { next; } } - -' SOURCES="$SOURCES" SPECFILE="$SPECFILE" CLOGF="$clogf" ZSTREAM="$ZSTREAM_FLAG" +git log --topo-order --reverse --no-merges -z --format="- %s (%an)%n%b" \ + ^master "$lasttag".. -- ':!/redhat/rhdocs' | ${0%/*}/genlog.py >> "$clogf"
grep -v "tagging $RPM_VERSION" "$clogf" > "$clogf.stripped" cp "$clogf.stripped" "$clogf"
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865
From: CKI Bot on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865#note_48918376...
Testing pipeline status: Basic testing pipeline:
https://gitlab.com/redhat/red-hat-ci-tools/kernel/cki- runs/external-pipelines/-/pipelines/243999686 - created :hourglass_flowing_sand:
From: Herton Krzesinski on gitlab.com Merge Request: https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865
The current awk logic is complex and relied on Patchwork metadata. As we moved on to gitlab, it doesn't pick anymore bugzilla or CVE info from commits. This adds a simpler python script which can scan through the commit log and adds bugzilla/cve info if available.
From: Herton R. Krzesinski herton@redhat.com
redhat: add genlog.py script
Upstream Status: RHEL only Tested: verified changelog created after make rh-release
This change adds a separate python script that will generate changelog items for the kernel RPM package, based on git log contents. It aims to be a straight replacement of the current awk logic in redhat/genspec.sh.
I received review feedback from Jan Stancek, Frantisek Hrbata, Don Zickus on an earlier version of the script, and this version contains suggestions made by them.
Signed-off-by: Herton R. Krzesinski herton@redhat.com
diff a/redhat/genlog.py b/redhat/genlog.py --- /dev/null +++ b/redhat/genlog.py @@ -0,0 +1,105 @@ +#!/usr/bin/python3 +# +# This script parses a git log from stdin, which should be given with: +# $ git log [<options>] -z --format="- %s (%an)%n%b" [<range>] [[--] <path>...] | ... +# And then outputs to stdout a trimmed changelog for use with rpm packaging +# +# Author: Herton R. Krzesinski herton@redhat.com +# Copyright (C) 2021 Red Hat, Inc. +# +# This software may be freely redistributed under the terms of the GNU +# General Public License (GPL). + +"""Parses a git log from stdin, and output a log entry for an rpm.""" + +import re +import sys + +def find_bz_in_line(line, prefix): + """Return bug number from properly formated Bugzilla: line.""" + # BZs must begin with '{prefix}: ' and contain a complete BZ URL + line = line.rstrip() + pattern = prefix + r': http(s)?://bugzilla.redhat.com/(show_bug.cgi?id=)?(?P<bug>\d{4,8})$' + bznum_re = re.compile(pattern) + _bugs = bznum_re.match(line) + if _bugs: + return [ _bugs.group('bug') ] + return [] + + +def find_cve_in_line(line): + """Return cve number from properly formated CVE: line.""" + # CVEs must begin with 'CVE: ' + cve_list = [] + if not line.startswith("CVE: "): + return cve_list + _cves = line[len("CVE: "):].split() + pattern = "(?P<cve>CVE-[0-9]+-[0-9]+)" + cve_re = re.compile(pattern) + for cve_item in _cves: + cve = cve_re.match(cve_item) + if cve: + cve_list.append(cve.group('cve')) + return cve_list + + +def parse_commit(commit): + """Extract metadata from a commit log message.""" + lines = commit.split('\n') + + # remove any '%' character, since it'll be used inside the rpm spec changelog + log_entry = lines[0].replace("%","") + + patchwork = lines[2].startswith("Patchwork-id: ") + + cve_list = [] + bug_list = [] + zbug_list = [] + for line in lines[1:]: + # If this is a patch applied through patchwork, we can leave processing + # when outside of Patchwork metadata block + if patchwork and line == "": + break + + # Process Bugzilla and ZStream Bugzilla entries + _bugs = find_bz_in_line(line, 'Bugzilla') + if _bugs: + for bzn in _bugs: + if not bzn in bug_list: + bug_list.append(bzn) + continue + _zbugs = find_bz_in_line(line, 'Z-Bugzilla') + if _zbugs: + for bzn in _zbugs: + if not bzn in zbug_list: + zbug_list.append(bzn) + continue + + # Grab CVE tags if they are present + _cves = find_cve_in_line(line) + for cve in _cves: + if not cve in cve_list: + cve_list.append(cve) + + return (log_entry, cve_list, bug_list, zbug_list) + + +if __name__ == "__main__": + commits = sys.stdin.read().split('\0') + for c in commits: + if not c: + continue + log_item, cves, bugs, zbugs = parse_commit(c) + entry = f"{log_item}" + if bugs or zbugs: + entry += " [" + if zbugs: + entry += " ".join(zbugs) + if bugs and zbugs: + entry += " " + if bugs: + entry += " ".join(bugs) + entry += "]" + if cves: + entry += " {" + " ".join(cves) + "}" + print(entry)
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865
From: Herton R. Krzesinski herton@redhat.com
redhat: replace inline awk script with genlog.py call
Upstream Status: RHEL only Tested: verified changelog created after make rh-release
This wires in the genlog.py script call in genspec.sh, replacing the previous inline awk script.
Signed-off-by: Herton R. Krzesinski herton@redhat.com
diff a/redhat/genspec.sh b/redhat/genspec.sh --- a/redhat/genspec.sh +++ b/redhat/genspec.sh @@ -47,124 +47,8 @@ if [[ -z $lasttag ]]; then fi fi echo "Gathering new log entries since $lasttag" -git format-patch --no-renames -k --stdout ^master "$lasttag".. -- ":!/redhat/rhdocs" | awk ' -BEGIN{TYPE="PATCHJUNK"; } - # add an entry to changelog - function changelog(subjectline, nameline, zstream) - { - subj = substr(subjectline, 10); - gsub(/%/, "", subj) - name = substr(nameline, 7); - pos=match(name, /</); - name=substr(name,1,pos-2); - bz=substr(BZ,11); - zbz=substr(ZBZ,13); - meta = ""; - if (zstream == "no") { - if (bz != "") { - meta = " [" bz "]"; - } - } else { - if (zbz != "") { - if (bz != "") { - meta = " [" zbz " " bz "]"; - } else { - meta = " [" zbz "]"; - } - } - } - cve = substr(CVE, 6); - if (cve != "") { - if (meta != "") { - meta = meta " {" cve "}"; - } else { - meta = " {" cve "}"; - } - } - - print "- " subj " (" name ")" meta >> CLOGF; - } - - #special separator, close previous patch - /^From / { if (TYPE=="PATCHJUNK") { - COMMIT=substr($0, 6, 40); - TYPE="HEADER"; - LASTHDR="NEW"; - next; - } } - - #interesting header stuff - /^From: / { if (TYPE=="HEADER") { - namestr=$0; - #check for mime encoding on the email headers - #git uses utf-8 q encoding - if ( $0 ~ /=?utf-8?q/ ) { - #get rid of the meta utf-8 junk - gsub(/=?utf-8?q?/, ""); - gsub(/?=/, ""); - - #translate each char - n=split($0, a, "="); - namestr = sprintf("%s", a[1]); - for (i = 2; i <= n; ++i) { - utf = substr(a[i], 0, 2); - c = strtonum("0x" utf); - namestr = sprintf("%s%c%s", namestr, c, substr(a[i],3)); - } - } - NAMELINE=namestr; next; - } - } - /^Date: / {if (TYPE=="HEADER") {DATELINE=$0; next; } } - /^Subject: / { if (TYPE=="HEADER") {SUBJECTLINE=$0; LASTHDR="SUBJ"; next; } } - # partially attempt to deal with RFC2822 continuation lines in headers - /^\s/ { if (TYPE=="HEADER") { if (LASTHDR=="SUBJ") { SUBJECTLINE=(SUBJECTLINE $0); } next; } } - /^Bugzilla: / { if (TYPE=="META") {BZ=$0; } } - /^Z-Bugzilla: / { if (TYPE=="META") {ZBZ=$0; } } - /^CVE: / { if (TYPE=="META") {CVE=$0; } } - - #blank line triggers end of header and to begin processing - /^$/ { - if (TYPE=="META") { - #create the dynamic changelog entry - changelog(SUBJECTLINE, NAMELINE, ZSTREAM); - #reset cve values because they do not always exist - CVE=""; - BZ=""; - ZBZ=""; - TYPE="BODY"; - } - if (TYPE=="HEADER") { - TYPE="META"; next; - } - } - - #in order to handle overlapping keywords, we keep track of each - #section of the patchfile and only process keywords in the correct section - /^---$/ { - if (TYPE=="META") { - # no meta data found, just use the subject line to fill - # the changelog - changelog(SUBJECTLINE, NAMELINE, ZSTREAM); - #reset cve values because they do not always exist - CVE=""; - BZ=""; - ZBZ=""; - TYPE="BODY"; - } - if (TYPE=="BODY") { - TYPE="PATCHSEP"; - } - } - /^diff --git/ { if (TYPE=="PATCHSEP") { TYPE="PATCH"; } } - /^-- $/ { if (TYPE=="PATCH") { TYPE="PATCHJUNK"; } } - - #filter out stuff we do not care about - { if (TYPE == "PATCHSEP") { next; } } - { if (TYPE == "PATCHJUNK") { next; } } - { if (TYPE == "HEADER") { next; } } - -' SOURCES="$SOURCES" SPECFILE="$SPECFILE" CLOGF="$clogf" ZSTREAM="$ZSTREAM_FLAG" +git log --topo-order --reverse --no-merges -z --format="- %s (%an)%n%b" \ + ^master "$lasttag".. -- ':!/redhat/rhdocs' | ${0%/*}/genlog.py >> "$clogf"
grep -v "tagging $RPM_VERSION" "$clogf" > "$clogf.stripped" cp "$clogf.stripped" "$clogf"
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865
From: CKI Bot on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865#note_48921904...
Testing pipeline status: Basic testing pipeline:
https://gitlab.com/redhat/red-hat-ci-tools/kernel/cki- runs/external-pipelines/-/pipelines/244010121 - created :hourglass_flowing_sand:
From: Veronika Kabátová on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865#note_48922651...
FYI, I'm trying to find out why the bot spams contributors who have direct access to CI but so far can't figure out anything except weird cache magic :cry: Running the check locally the bot correctly recognizes this MR and doesn't get involved.
I'll continue digging into this to hopefully find the cause.
From: Herton Krzesinski on gitlab.com Merge Request: https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865
The current awk logic is complex and relied on Patchwork metadata. As we moved on to gitlab, it doesn't pick anymore bugzilla or CVE info from commits. This adds a simpler python script which can scan through the commit log and adds bugzilla/cve info if available.
From: Herton R. Krzesinski herton@redhat.com
redhat: add genlog.py script
Upstream Status: RHEL only Tested: verified changelog created after make rh-release
This change adds a separate python script that will generate changelog items for the kernel RPM package, based on git log contents. It aims to be a straight replacement of the current awk logic in redhat/genspec.sh.
I received review feedback from Jan Stancek, Frantisek Hrbata, Don Zickus on an earlier version of the script, and this version contains suggestions made by them.
Signed-off-by: Herton R. Krzesinski herton@redhat.com
diff a/redhat/genlog.py b/redhat/genlog.py --- /dev/null +++ b/redhat/genlog.py @@ -0,0 +1,86 @@ +#!/usr/bin/python3 +# +# This script parses a git log from stdin, which should be given with: +# $ git log [<options>] -z --format="- %s (%an)%n%b" [<range>] [[--] <path>...] | ... +# And then outputs to stdout a trimmed changelog for use with rpm packaging +# +# Author: Herton R. Krzesinski herton@redhat.com +# Copyright (C) 2021 Red Hat, Inc. +# +# This software may be freely redistributed under the terms of the GNU +# General Public License (GPL). + +"""Parses a git log from stdin, and output a log entry for an rpm.""" + +import re +import sys + +def find_bz_in_line(line, prefix): + """Return bug number from properly formated Bugzilla: line.""" + # BZs must begin with '{prefix}: ' and contain a complete BZ URL + line = line.rstrip() + pattern = prefix + r': http(s)?://bugzilla.redhat.com/(show_bug.cgi?id=)?(?P<bug>\d{4,8})$' + bznum_re = re.compile(pattern) + bzn = set() + match = bznum_re.match(line) + if match: + bzn.add(match.group('bug')) + return bzn + + +def find_cve_in_line(line): + """Return cve number from properly formated CVE: line.""" + # CVEs must begin with 'CVE: ' + cve_set = set() + if not line.startswith("CVE: "): + return cve_set + _cves = line[len("CVE: "):].split() + pattern = "(?P<cve>CVE-[0-9]+-[0-9]+)" + cve_re = re.compile(pattern) + for cve_item in _cves: + cve = cve_re.match(cve_item) + if cve: + cve_set.add(cve.group('cve')) + return cve_set + + +def parse_commit(commit): + """Extract metadata from a commit log message.""" + lines = commit.split('\n') + + # remove any '%' character, since it'll be used inside the rpm spec changelog + log_entry = lines[0].replace("%","") + + cve_set = set() + bug_set = set() + zbug_set = set() + for line in lines[1:]: + # 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')) + + # Grab CVE tags if they are present + cve_set.update(find_cve_in_line(line)) + + return (log_entry, sorted(cve_set), sorted(bug_set), sorted(zbug_set)) + + +if __name__ == "__main__": + commits = sys.stdin.read().split('\0') + for c in commits: + if not c: + continue + log_item, cves, bugs, zbugs = parse_commit(c) + entry = f"{log_item}" + if bugs or zbugs: + entry += " [" + if zbugs: + entry += " ".join(zbugs) + if bugs and zbugs: + entry += " " + if bugs: + entry += " ".join(bugs) + entry += "]" + if cves: + entry += " {" + " ".join(cves) + "}" + print(entry)
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865
From: Herton R. Krzesinski herton@redhat.com
redhat: replace inline awk script with genlog.py call
Upstream Status: RHEL only Tested: verified changelog created after make rh-release
This wires in the genlog.py script call in genspec.sh, replacing the previous inline awk script.
Signed-off-by: Herton R. Krzesinski herton@redhat.com
diff a/redhat/genspec.sh b/redhat/genspec.sh --- a/redhat/genspec.sh +++ b/redhat/genspec.sh @@ -47,124 +47,8 @@ if [[ -z $lasttag ]]; then fi fi echo "Gathering new log entries since $lasttag" -git format-patch --no-renames -k --stdout ^master "$lasttag".. -- ":!/redhat/rhdocs" | awk ' -BEGIN{TYPE="PATCHJUNK"; } - # add an entry to changelog - function changelog(subjectline, nameline, zstream) - { - subj = substr(subjectline, 10); - gsub(/%/, "", subj) - name = substr(nameline, 7); - pos=match(name, /</); - name=substr(name,1,pos-2); - bz=substr(BZ,11); - zbz=substr(ZBZ,13); - meta = ""; - if (zstream == "no") { - if (bz != "") { - meta = " [" bz "]"; - } - } else { - if (zbz != "") { - if (bz != "") { - meta = " [" zbz " " bz "]"; - } else { - meta = " [" zbz "]"; - } - } - } - cve = substr(CVE, 6); - if (cve != "") { - if (meta != "") { - meta = meta " {" cve "}"; - } else { - meta = " {" cve "}"; - } - } - - print "- " subj " (" name ")" meta >> CLOGF; - } - - #special separator, close previous patch - /^From / { if (TYPE=="PATCHJUNK") { - COMMIT=substr($0, 6, 40); - TYPE="HEADER"; - LASTHDR="NEW"; - next; - } } - - #interesting header stuff - /^From: / { if (TYPE=="HEADER") { - namestr=$0; - #check for mime encoding on the email headers - #git uses utf-8 q encoding - if ( $0 ~ /=?utf-8?q/ ) { - #get rid of the meta utf-8 junk - gsub(/=?utf-8?q?/, ""); - gsub(/?=/, ""); - - #translate each char - n=split($0, a, "="); - namestr = sprintf("%s", a[1]); - for (i = 2; i <= n; ++i) { - utf = substr(a[i], 0, 2); - c = strtonum("0x" utf); - namestr = sprintf("%s%c%s", namestr, c, substr(a[i],3)); - } - } - NAMELINE=namestr; next; - } - } - /^Date: / {if (TYPE=="HEADER") {DATELINE=$0; next; } } - /^Subject: / { if (TYPE=="HEADER") {SUBJECTLINE=$0; LASTHDR="SUBJ"; next; } } - # partially attempt to deal with RFC2822 continuation lines in headers - /^\s/ { if (TYPE=="HEADER") { if (LASTHDR=="SUBJ") { SUBJECTLINE=(SUBJECTLINE $0); } next; } } - /^Bugzilla: / { if (TYPE=="META") {BZ=$0; } } - /^Z-Bugzilla: / { if (TYPE=="META") {ZBZ=$0; } } - /^CVE: / { if (TYPE=="META") {CVE=$0; } } - - #blank line triggers end of header and to begin processing - /^$/ { - if (TYPE=="META") { - #create the dynamic changelog entry - changelog(SUBJECTLINE, NAMELINE, ZSTREAM); - #reset cve values because they do not always exist - CVE=""; - BZ=""; - ZBZ=""; - TYPE="BODY"; - } - if (TYPE=="HEADER") { - TYPE="META"; next; - } - } - - #in order to handle overlapping keywords, we keep track of each - #section of the patchfile and only process keywords in the correct section - /^---$/ { - if (TYPE=="META") { - # no meta data found, just use the subject line to fill - # the changelog - changelog(SUBJECTLINE, NAMELINE, ZSTREAM); - #reset cve values because they do not always exist - CVE=""; - BZ=""; - ZBZ=""; - TYPE="BODY"; - } - if (TYPE=="BODY") { - TYPE="PATCHSEP"; - } - } - /^diff --git/ { if (TYPE=="PATCHSEP") { TYPE="PATCH"; } } - /^-- $/ { if (TYPE=="PATCH") { TYPE="PATCHJUNK"; } } - - #filter out stuff we do not care about - { if (TYPE == "PATCHSEP") { next; } } - { if (TYPE == "PATCHJUNK") { next; } } - { if (TYPE == "HEADER") { next; } } - -' SOURCES="$SOURCES" SPECFILE="$SPECFILE" CLOGF="$clogf" ZSTREAM="$ZSTREAM_FLAG" +git log --topo-order --reverse --no-merges -z --format="- %s (%an)%n%b" \ + ^master "$lasttag".. -- ':!/redhat/rhdocs' | ${0%/*}/genlog.py >> "$clogf"
grep -v "tagging $RPM_VERSION" "$clogf" > "$clogf.stripped" cp "$clogf.stripped" "$clogf"
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865
From: CKI Bot on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865#note_48924590...
Testing pipeline status: Basic testing pipeline:
https://gitlab.com/redhat/red-hat-ci-tools/kernel/cki- runs/external-pipelines/-/pipelines/244021073 - created :hourglass_flowing_sand:
From: CKI Bot on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865#note_49000744...
ACK/NACK Summary: NeedsReview - Requires at least 2 ACK(s) from someone in the set jstancek@redhat.com★, fhrbata@redhat.com★, ptalbert@redhat.com★, bmasney@redhat.com★, herton@redhat.com★, dvlasenk@redhat.com★, jforbes@fedoraproject.org★, rvrbovsk@redhat.com★, dzickus@redhat.com★, jlelli@redhat.com★, bmeneg@redhat.com★, williams@redhat.com★, lgoncalv@redhat.com★, trix@redhat.com★, acaringi@redhat.com★. Code owners are marked with a ★.
From: CKI Bot on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865#note_49019074...
Acked-by: Justin Forbes jforbes@fedoraproject.org (via approve button)
From: CKI Bot on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/865#note_50018704...
Acked-by: Patrick Talbert ptalbert@redhat.com (via approve button)
kernel@lists.fedoraproject.org