blob: e899c3e7e76fdd480b4dd697179309c8e0663fda [file] [log] [blame]
Yegor Timoshenkoc2e49412018-10-07 01:58:27 +00001#!/usr/bin/env bash
Martin Rothbec11082015-11-03 21:01:53 -07002#
Patrick Georgi7333a112020-05-08 20:48:04 +02003# SPDX-License-Identifier: GPL-2.0-only
Martin Rothbec11082015-11-03 21:01:53 -07004
Martin Rothfb190ed2016-10-01 20:13:43 -06005# This script creates a list of commits between two releases, broken out into
6# fairly inexact categories, based on the directories that files are in. If
7# a commit touched anything in the path that is checked earlier, it's counted
8# as being in that category.
9#
10# Don't run this in your current working tree, it checks out different versions
11# and can lose things.
Martin Rothbec11082015-11-03 21:01:53 -070012
Martin Rothfb190ed2016-10-01 20:13:43 -060013# set -x # uncomment for debug
14
15# Check for tools
16
Patrick Georgifa13a642018-12-20 17:17:03 +010017if ! ( git --version && cloc --version && rename --version ) > /dev/null 2>&1
Martin Rothfb190ed2016-10-01 20:13:43 -060018then
Martin Rotheb80d8d2022-02-28 14:41:57 -070019 echo "ERROR: cloc, git or rename is not installed. Exiting" >&2
Martin Rothbec11082015-11-03 21:01:53 -070020 exit 1
21fi
22
Alex Thiessenda384dd2018-01-13 16:31:28 +000023if ! { cdup="$(git rev-parse --show-cdup 2>/dev/null)" && [ -z "${cdup}" ]; }
24then
Martin Rotheb80d8d2022-02-28 14:41:57 -070025 echo "ERROR: This is not the top directory of a git repo. Exiting." >&2
Martin Rothfb190ed2016-10-01 20:13:43 -060026 exit 1
27fi
28
29# Try to verify that the repo is clean before losing state.
Martin Rotheb80d8d2022-02-28 14:41:57 -070030if ! git diff-index --quiet --cached HEAD 2>/dev/null || \
Stefan Reinauer0d3a1fb2023-06-10 12:32:50 -070031 [ "$(git diff origin/main --shortstat 2>/dev/null | tail -n1)" != "" ]; then
Martin Rotheb80d8d2022-02-28 14:41:57 -070032 echo "ERROR: repo is not clean. Exiting." >&2
Martin Rothbec11082015-11-03 21:01:53 -070033 exit 1
34fi
35
Martin Rothfb190ed2016-10-01 20:13:43 -060036# Verify the command line arguments
37if [ "$1" == "--help" ] || [ -z "$1" ] || [ -z "$2" ]; then
38 echo
39 echo "Usage: $0 <old_version> <new_version> [release notes file]"
40 echo "Old version should be a tag (4.1), a branch (origin/4.1), or a commit id"
Stefan Reinauer0d3a1fb2023-06-10 12:32:50 -070041 echo "New version can be a branch (origin/main) a tag (4.2), or a commit id"
Martin Rothfb190ed2016-10-01 20:13:43 -060042 echo "Logfile can be a new file or an existing file to update"
43 echo "Example: \"$0 origin/4.1 4.2 rnotes.txt\""
44 echo
45 echo "Note that the script starts at the commit AFTER the old version."
46 echo
47 exit 1
48else
49 OLD_GIT_VERSION="$1"
50 NEW_GIT_VERSION="$2"
Martin Rotheb80d8d2022-02-28 14:41:57 -070051 if [[ "$OLD_GIT_VERSION" = "HEAD" || "$NEW_GIT_VERSION" = "HEAD" ]]; then
52 echo "Error: using HEAD as a reference doesn't work" >&2
Patrick Georgi81a30ec2020-05-11 23:47:12 +020053 echo
54 exit 1
55 fi
Martin Rothfb190ed2016-10-01 20:13:43 -060056 TOTAL_COMMITS=$(git log --pretty=oneline \
57 "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | wc -l)
58fi
59
60TOP=$(pwd)
61
62if [ -n "$3" ]; then
63 MAIN_LOGFILE="${TOP}/$3"
64else
65 MAIN_LOGFILE="${TOP}/relnotes.txt"
66fi
67
68# Figure out which logfile we're writing to. If the specified logfile exists,
69# we need to write to a temporary logfile, then append changes to the main
70# logfile.
Martin Rothbec11082015-11-03 21:01:53 -070071if [ -f "$MAIN_LOGFILE" ]; then
72 LOGFILE="$(mktemp "LOGFILE.XXXX")"
73 LOGFILE="${TOP}/$LOGFILE"
74 UPDATE_MAIN_LOGFILE=1
75else
76 LOGFILE="$MAIN_LOGFILE"
77fi
78
Martin Rothfb190ed2016-10-01 20:13:43 -060079get_author_commit_count() {
80 git log "${NEW_GIT_VERSION}" 2>/dev/null | grep -c "^Author: $1"
81}
82
83# Print and log the versions
Martin Rothbec11082015-11-03 21:01:53 -070084log_versions() {
85 echo "Log of commit $1 to commit $2"
86 echo "Log of commit $1 to commit $2" >> "$LOGFILE"
Martin Rothfb190ed2016-10-01 20:13:43 -060087 echo "Total commits: ${TOTAL_COMMITS}"
88 echo "Total commits: ${TOTAL_COMMITS}" >> "$LOGFILE"
Martin Rothbec11082015-11-03 21:01:53 -070089 echo
90}
91
Martin Rothfb190ed2016-10-01 20:13:43 -060092# Get the first commit id in the current tree
Martin Rothbec11082015-11-03 21:01:53 -070093get_latest_commit_id() {
Martin Roth3ce67832017-11-04 18:36:19 -060094(
Martin Rotheb80d8d2022-02-28 14:41:57 -070095 cd "$1" || exit 1
96 git log -n 1 2>/dev/null | grep '^commit ' | head -1 | sed 's/commit //' | sed 's/ .*//'
Martin Roth3ce67832017-11-04 18:36:19 -060097)
Martin Rothbec11082015-11-03 21:01:53 -070098}
99
Martin Rothfb190ed2016-10-01 20:13:43 -0600100# Main get log function
Martin Rothbec11082015-11-03 21:01:53 -0700101_get_log() {
102 local oldver="$1"
103 local newver="$2"
104 local title="$3"
105 local paths="$4"
Martin Roth3ce67832017-11-04 18:36:19 -0600106 local keywords="$5"
Martin Rothbec11082015-11-03 21:01:53 -0700107
Martin Roth3ce67832017-11-04 18:36:19 -0600108 # Leave ${paths} unquoted in the git commands
Martin Rothfb190ed2016-10-01 20:13:43 -0600109 # shellcheck disable=SC2086
Martin Roth3ce67832017-11-04 18:36:19 -0600110 { \
111 if [ -n "$paths" ]; then \
112 git log --abbrev-commit --pretty=oneline \
113 "${oldver}..${newver}" -- ${paths} \
114 2>/dev/null; \
115 fi; \
116 if [ -n "$keywords" ]; then \
117 git log --abbrev-commit --pretty=oneline \
118 "${oldver}..${newver}" 2>/dev/null \
119 | grep -i "$keywords"; \
120 fi \
121 } | sort -t ' ' -k 2 | uniq
Martin Rothbec11082015-11-03 21:01:53 -0700122}
123
Martin Rothfb190ed2016-10-01 20:13:43 -0600124# Output to a new log, then compare to the first logfile, and only output
125# non duplicated lines to the final file.
Martin Rothbec11082015-11-03 21:01:53 -0700126get_log_dedupe() {
127 local title="$1"
128 local paths="$2"
Martin Roth3ce67832017-11-04 18:36:19 -0600129 local keywords="$3"
Martin Rothfb190ed2016-10-01 20:13:43 -0600130 local log
131 local commits
132
Martin Rothbec11082015-11-03 21:01:53 -0700133 dedupe_tmpfile="$(mktemp "LOGFILE.XXXX")"
134
Martin Rothfb190ed2016-10-01 20:13:43 -0600135 log=$(_get_log "$OLD_GIT_VERSION" "$NEW_GIT_VERSION" \
Martin Roth3ce67832017-11-04 18:36:19 -0600136 "$title" "$paths" "$keywords")
Martin Rothbec11082015-11-03 21:01:53 -0700137
138 echo "$log" > "$dedupe_tmpfile"
139
140 log=$(grep -Fxv -f "$LOGFILE" "$dedupe_tmpfile")
Martin Rothfb190ed2016-10-01 20:13:43 -0600141 commits=$(echo "$log" | wc -l)
Martin Rothbec11082015-11-03 21:01:53 -0700142
Martin Rotheb80d8d2022-02-28 14:41:57 -0700143 if [ -n "$log" ]; then
144 #echo "$title: $paths $keywords" >> "$LOGFILE"
145 printf "%s\n%s\n\n" "##### $title ($commits commits) #####" \
146 "$log" >> "$LOGFILE"
147 fi
Martin Rothbec11082015-11-03 21:01:53 -0700148
149 rm "$dedupe_tmpfile"
150}
151
152# get logs for the submodules
153get_log_submodule() {
154 local old_version="$1"
155 local new_version="$2"
156 local submodule_dir="$3"
Martin Rothfb190ed2016-10-01 20:13:43 -0600157 local log
158 local commits
Martin Rothbec11082015-11-03 21:01:53 -0700159
160 printf "Submodule %s\n" "$submodule_dir"
161 printf "commit %s to commit %s\n\n" "$old_version" "$new_version"
162
Martin Rotheb80d8d2022-02-28 14:41:57 -0700163 if ! (
164 cd "${TOP}/$submodule_dir" || exit 1
165 log="$(_get_log "$old_version" "$new_version" "$submodule_dir" "." "")" || exit 1
Martin Rothfb190ed2016-10-01 20:13:43 -0600166 commits=$(echo "$log" | wc -l)
Martin Rothbec11082015-11-03 21:01:53 -0700167
168 if [ -n "$log" ]; then
Martin Rothcbc792c2023-08-20 19:21:55 -0600169 printf "* %s: Update from commit id %s to %s (%s commits)\n" "${submodule_dir}" "${old_version:0:10}" "${new_version:0:10}" "${commits}" >> "$LOGFILE"
Martin Rothbec11082015-11-03 21:01:53 -0700170 fi
Martin Rotheb80d8d2022-02-28 14:41:57 -0700171 ); then
172 version_ctrl_c
173 fi
Martin Rothbec11082015-11-03 21:01:53 -0700174}
175
Martin Rothfb190ed2016-10-01 20:13:43 -0600176find_areas() {
Martin Roth3ce67832017-11-04 18:36:19 -0600177 local directory="$1"
178 local filename="$2"
179 local skip="$3"
180 find "$directory" -name "$filename" | sed "s|/$filename||" | sed "s|/$directory||" | grep -v "$skip" | sort
Martin Rothfb190ed2016-10-01 20:13:43 -0600181}
182
183# Make sure things get cleaned up if ctl-c is pressed while the old version
184# is checked out and files are renamed. This can be a real mess to clean
185# up manually.
Martin Rothbec11082015-11-03 21:01:53 -0700186version_ctrl_c() {
Martin Rotheb80d8d2022-02-28 14:41:57 -0700187 printf "\n Cleaning up and exiting.\n" >&2
Martin Rothfb190ed2016-10-01 20:13:43 -0600188 find 'src' -name 'gnumakefile' \
189 -exec rename 's/gnumakefile/Makefile\.inc/' {} \;
Stefan Reinauer0d3a1fb2023-06-10 12:32:50 -0700190 git checkout origin/main > /dev/null 2>&1
Martin Rothbec11082015-11-03 21:01:53 -0700191 git submodule update --init --checkout > /dev/null 2>&1
Martin Rothbec11082015-11-03 21:01:53 -0700192 rm "$LOGFILE"
193 exit 1;
194}
195
Martin Rothfb190ed2016-10-01 20:13:43 -0600196# Calculate areas that have been added or removed based on file lists
197show_diff () {
198 local new
199 local old
Martin Rothbec11082015-11-03 21:01:53 -0700200
Patrick Georgi1916d682019-11-20 16:05:21 +0100201 new="$(comm -13 <(echo "$2") <(echo "$3"))"
202 old="$(comm -23 <(echo "$2") <(echo "$3"))"
203
204 # Allow running a postprocessor, given as 4th argument over the
205 # resulting diff, provide context if it's old or new data
206 if [ -n "$4" ]; then
207 new=$(echo "$new" | $4 new | sort)
208 old=$(echo "$old" | $4 old | sort)
209 fi
Martin Rotheb80d8d2022-02-28 14:41:57 -0700210 new="$(printf "%s" "$new" | sed 's/^/* /')"
211 old="$(printf "%s" "$old" | sed 's/^/* /')"
Patrick Georgi1916d682019-11-20 16:05:21 +0100212
Martin Rothfb190ed2016-10-01 20:13:43 -0600213 if [ -n "$new" ]; then
214 printf "Added %s $1:\n-------------------\n%s\n\n" \
215 "$(echo "$new" | wc -l)" "$new" >> "$LOGFILE"
216 fi
Martin Rothfb190ed2016-10-01 20:13:43 -0600217 if [ -n "$old" ]; then
218 printf "Removed %s $1:\n-------------------\n%s\n\n" \
219 "$(echo "$old" | wc -l)" "$old" >> "$LOGFILE"
220 fi
221}
222
Martin Roth3ce67832017-11-04 18:36:19 -0600223get_sloc () {
224 # Because cloc works on extensions, and .inc identifies as pascal,
Patrick Georgi436296b2019-11-20 17:15:13 +0100225 # while we use it both for Makefile.inc and some files that are
226 # really C, do three passes: everything but .inc files, all .inc files
227 # that aren't Makefiles, all Makefile.inc, then combine them.
Martin Roth3ce67832017-11-04 18:36:19 -0600228
Martin Rotheb80d8d2022-02-28 14:41:57 -0700229 local base
230 base=$(mktemp)
231 find src -name Makefile.inc > "${base}.mak"
Martin Roth3ce67832017-11-04 18:36:19 -0600232
Patrick Georgi436296b2019-11-20 17:15:13 +0100233 cloc --progress-rate=0 --quiet \
234 --script-lang="Bourne Shell",bash --exclude-ext=inc \
Martin Rotheb80d8d2022-02-28 14:41:57 -0700235 --exclude-dir=vendorcode "--out=${base}" src
Patrick Georgi436296b2019-11-20 17:15:13 +0100236 cloc --progress-rate=0 --quiet \
Martin Rotheb80d8d2022-02-28 14:41:57 -0700237 "--exclude-list-file=${base}.mak" --force-lang=c,inc \
238 --exclude-dir=vendorcode "--out=${base}.c" src
Patrick Georgi436296b2019-11-20 17:15:13 +0100239 cloc --progress-rate=0 --quiet \
Martin Rotheb80d8d2022-02-28 14:41:57 -0700240 "--list-file=${base}.mak" --force-lang=make,inc \
241 --exclude-dir=vendorcode "--out=${base}.m" src
Patrick Georgi436296b2019-11-20 17:15:13 +0100242 cloc --progress-rate=0 --quiet --sum-reports \
Martin Rotheb80d8d2022-02-28 14:41:57 -0700243 "${base}" "${base}.c" "${base}.m" --out "${base}.result"
Patrick Georgi436296b2019-11-20 17:15:13 +0100244
245 echo
Martin Rotheb80d8d2022-02-28 14:41:57 -0700246 cat "${base}.result.lang"
Patrick Georgi436296b2019-11-20 17:15:13 +0100247
Martin Rotheb80d8d2022-02-28 14:41:57 -0700248 rm -f "${base}"*
Martin Roth3ce67832017-11-04 18:36:19 -0600249}
250
Martin Rothfb190ed2016-10-01 20:13:43 -0600251# Start collecting data from the old and new revisions.
252# This is relatively disruptive to the tree, so trap on ctl-c so that
253# things can be put back to normal
254trap version_ctrl_c SIGINT
Martin Rothbec11082015-11-03 21:01:53 -0700255
256#check out old version and get information
Martin Rotheb80d8d2022-02-28 14:41:57 -0700257echo "Finding old submodule versions..." >&2
Martin Rothfb190ed2016-10-01 20:13:43 -0600258git checkout "$OLD_GIT_VERSION" > /dev/null 2>&1
Martin Rotheb80d8d2022-02-28 14:41:57 -0700259echo "Git version: $(git log --oneline -n 1)"
Martin Rothbec11082015-11-03 21:01:53 -0700260git submodule update --init --checkout > /dev/null 2>&1
Martin Roth3ce67832017-11-04 18:36:19 -0600261for module in $(git submodule --quiet foreach pwd); do
262 name="$(basename "$module" | sed 's/-/_/g')"
263 version="${name^^}_OLD_VERSION"
Martin Rotheb80d8d2022-02-28 14:41:57 -0700264 declare "$version"="$(get_latest_commit_id "$module")"
Martin Roth3ce67832017-11-04 18:36:19 -0600265done
Martin Rothfb190ed2016-10-01 20:13:43 -0600266
Martin Rotheb80d8d2022-02-28 14:41:57 -0700267printf "Logging directories in the old tree\n" >&2
Martin Roth3ce67832017-11-04 18:36:19 -0600268mainboard_list_old=$(grep -h "^[[:space:]]*config\>[[:space:]]*\<BOARD_" src/mainboard/*/*/Kconfig.name 2>/dev/null | sed "s,^.*\<BOARD_\([A-Z0-9_]*\)\>.*$,\1," | sort)
269cpu_list_old=$(find_areas "src/cpu" "Kconfig" "intel/common")
270soc_list_old=$(find_areas "src/soc" "Makefile.inc" "intel/common\|amd/common\|romstage")
271northbridge_list_old=$(find_areas "src/northbridge" "Kconfig" "")
272sio_list_old=$(find_areas "src/superio" "Makefile.inc" "")
273southbridge_list_old=$(find_areas "src/southbridge" "Kconfig" "")
Martin Rothfb190ed2016-10-01 20:13:43 -0600274
Martin Rotheb80d8d2022-02-28 14:41:57 -0700275echo "Calculating old SLOC"
Martin Roth3ce67832017-11-04 18:36:19 -0600276OLD_SLOC=$(get_sloc)
Martin Rothbec11082015-11-03 21:01:53 -0700277
278#check out new version and get information
Martin Rotheb80d8d2022-02-28 14:41:57 -0700279printf -- "\nFinding new submodule versions...\n" >&2
Martin Rothfb190ed2016-10-01 20:13:43 -0600280git checkout "$NEW_GIT_VERSION" > /dev/null 2>&1
Martin Rotheb80d8d2022-02-28 14:41:57 -0700281echo "Git version: $(git log --oneline -n 1)"
Martin Rothbec11082015-11-03 21:01:53 -0700282git submodule update --init --checkout > /dev/null 2>&1
Martin Rothbec11082015-11-03 21:01:53 -0700283
Martin Roth3ce67832017-11-04 18:36:19 -0600284for module in $(git submodule --quiet foreach pwd); do
285 name="$(basename "$module" | sed 's/-/_/g')"
286 version="${name^^}_NEW_VERSION"
Martin Rotheb80d8d2022-02-28 14:41:57 -0700287 declare "$version"="$(get_latest_commit_id "$module")"
Martin Roth3ce67832017-11-04 18:36:19 -0600288done
Martin Rothfb190ed2016-10-01 20:13:43 -0600289
Martin Rotheb80d8d2022-02-28 14:41:57 -0700290echo "Logging directories in the new tree." >&2
Martin Roth3ce67832017-11-04 18:36:19 -0600291mainboard_list_new=$(grep -h "^[[:space:]]*config\>[[:space:]]*\<BOARD_" src/mainboard/*/*/Kconfig.name 2>/dev/null | sed "s,^.*\<BOARD_\([A-Z0-9_]*\)\>.*$,\1," | sort)
292cpu_list_new=$(find_areas "src/cpu" "Kconfig" "intel/common")
293soc_list_new=$(find_areas "src/soc" "Makefile.inc" "intel/common\|amd/common\|romstage")
294northbridge_list_new=$(find_areas "src/northbridge" "Kconfig" "")
295sio_list_new=$(find_areas "src/superio" "Makefile.inc" "")
296southbridge_list_new=$(find_areas "src/southbridge" "Kconfig" "")
297
Martin Rothfb190ed2016-10-01 20:13:43 -0600298printf "Calculating new SLOC\n"
Martin Roth3ce67832017-11-04 18:36:19 -0600299NEW_SLOC=$(get_sloc)
Martin Rothbec11082015-11-03 21:01:53 -0700300
Stefan Reinauer0d3a1fb2023-06-10 12:32:50 -0700301git checkout origin/main > /dev/null 2>&1
Martin Rothbec11082015-11-03 21:01:53 -0700302git submodule update --init --checkout > /dev/null 2>&1
Martin Rothbec11082015-11-03 21:01:53 -0700303trap "" SIGINT
Martin Rotheb80d8d2022-02-28 14:41:57 -0700304
Martin Rothfb190ed2016-10-01 20:13:43 -0600305# Done collecting data from the old and new versions
Martin Rothbec11082015-11-03 21:01:53 -0700306
Martin Rothfb190ed2016-10-01 20:13:43 -0600307# Start outputting to logfile
308echo "Generating release notes from version ${OLD_GIT_VERSION} to ${NEW_GIT_VERSION}"
309echo; echo "Main repo"
310echo "Main repo" >> "$LOGFILE"
Martin Rothbec11082015-11-03 21:01:53 -0700311echo "------------------" >> "$LOGFILE"
Martin Rothfb190ed2016-10-01 20:13:43 -0600312log_versions "$(git log --pretty=%H \
313 "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | tail -1)" \
314 "$(git log --pretty=%H \
315 "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | head -1 )"
316echo "" >> "$LOGFILE"
Martin Rothbec11082015-11-03 21:01:53 -0700317
Martin Roth3ce67832017-11-04 18:36:19 -0600318### SPECIFIC AREAS FOR RELEASE ###
Martin Rotheb80d8d2022-02-28 14:41:57 -0700319get_log_dedupe "Documentation" "Documentation README"
320
321get_log_dedupe "cleanup" "" "add missing\|fix typo\|clean up\|spelling\|Use tabs\|space [around\|before]\|code formatting\|commented code\|code cleanup\|capitalize\|[unnecessary\|unneeded\|trailing] whitespace\|checkpatch\|remove [unused\|dead\|unneeded\|duplicated\|not used]\|[transition away from\|get rid of\|don't use] device_t"
322
323get_log_dedupe "ACPI Changes" "" "ASL 2.0 syntax"
Martin Rothbec11082015-11-03 21:01:53 -0700324
Martin Roth3ce67832017-11-04 18:36:19 -0600325get_log_dedupe "Google Kahlee / AMD Gardenia" "src/mainboard/google/kahlee src/mainboard/amd/gardenia" "kahlee\|gardenia"
326get_log_dedupe "AMD Stoney Ridge" "src/soc/amd/stoneyridge" "stoney"
Martin Rothbec11082015-11-03 21:01:53 -0700327
Martin Rotheb80d8d2022-02-28 14:41:57 -0700328get_log_dedupe "Google Zork / AMD Mandolin / AMD Bilby" "src/mainboard/amd/mandolin src/mainboard/google/zork src/mainboard/amd/bilby" "mandolin\|zork\|bilby"
329get_log_dedupe "AMD Picasso" "src/soc/amd/picasso" "picasso"
330
331get_log_dedupe "Google Guybrush / AMD Majolica" "src/mainboard/google/guybrush src/mainboard/amd/majolica" "majolica\|guybrush"
332get_log_dedupe "AMD cezanne" "src/soc/amd/cezanne" "cezanne"
333
334get_log_dedupe "AMD chausie / Google Skyrim" "src/mainboard/amd/chausie src/mainboard/google/skyrim" "chausie\|skyrim"
335get_log_dedupe "AMD sabrina" "src/soc/amd/sabrina" "sabrina"
336
337get_log_dedupe "Google Brya / Intel adlrvp" "src/mainboard/intel/adlrvp src/mainboard/google/brya" "brya\|adlrvp"
338get_log_dedupe "Intel Alder Lake" "src/soc/intel/alderlake" "alderlake\|adl\|alder lake"
339
340get_log_dedupe "intel Elkhart Lake" "src/soc/intel/elkhartlake" "elkhartlake\|ehl\|elkhart lake"
341
342get_log_dedupe "Google Dedede" "src/mainboard/google/dedede" "dedede"
343get_log_dedupe "intel Jasper Lake" "src/soc/intel/jasperlake" "jasperlake\|jsl\|jasper lake"
344
345get_log_dedupe "Intel Tiger Lake" "src/soc/intel/tigerlake" "tigerlake\|tgl\|tiger lake"
346
347get_log_dedupe "Google Hatch" "src/mainboard/google/hatch" "hatch"
348get_log_dedupe "Intel Comet Lake" "src/soc/intel/cometlake" "cometlake\|cml\|comet lake"
349
Martin Roth3ce67832017-11-04 18:36:19 -0600350get_log_dedupe "Google Eve / Poppy / Fizz / Soraka / Nautilus / Intel KblRvp" "src/mainboard/google/eve src/mainboard/google/poppy src/mainboard/google/fizz src/mainboard/intel/kblrvp" "eve[ :]\|poppy\|fizz\|soraka\|nautilus\|kblrvp"
Martin Rotheb80d8d2022-02-28 14:41:57 -0700351
352get_log_dedupe "Intel Kunimitsu / Google Chell / Lars / Glados" "src/mainboard/google/lars src/mainboard/google/chell src/mainboard/google/glados src/mainboard/intel/kunimitsu" "chell\|lars\|kunimitsu"
Martin Roth3ce67832017-11-04 18:36:19 -0600353get_log_dedupe "Purism SKL" "src/mainboard/purism/librem_skl" "librem13v2\|librem_skl"
354get_log_dedupe "Intel Skylake / Kabylake" "src/soc/intel/skylake" "skylake\|sky.lake\|kabylake\|kaby.lake"
Martin Rothbec11082015-11-03 21:01:53 -0700355
Martin Rotheb80d8d2022-02-28 14:41:57 -0700356get_log_dedupe "Intel Glkrvp / Google Octopus / Bip / Yorp" "src/mainboard/google/octopus src/mainboard/intel/glkrvp" "octopus\|glkrvp|\bip\|yorp"
357
Martin Roth3ce67832017-11-04 18:36:19 -0600358get_log_dedupe "Google Cyan / Intel Strago" "src/mainboard/google/cyan src/mainboard/intel/strago" "cyan\|strago"
359get_log_dedupe "Intel Braswell" "src/soc/intel/braswell" "braswell"
Martin Rothbec11082015-11-03 21:01:53 -0700360
Martin Roth3ce67832017-11-04 18:36:19 -0600361get_log_dedupe "Google Kevin / Gru / Bob / Scarlet / Nefario" "src/mainboard/google/gru" "kevin\|gru[^b]"
362get_log_dedupe "Rockchip rk3399" "src/soc/rockchip/rk3399" "rk3399"
Martin Rothbec11082015-11-03 21:01:53 -0700363
Martin Roth3ce67832017-11-04 18:36:19 -0600364get_log_dedupe "Google Reef / Pyro / Sand / Snappy / Nasher" "src/mainboard/google/reef" "reef\|pyro\|sand[ :]\|snappy\|nasher"
365#get_log_dedupe "Intel apollolake_rvp leafhill minnow3" "src/mainboard/intel/apollolake_rvp src/mainboard/intel/leafhill src/mainboard/intel/minnow3" "apollolake_rvp\|leafhill\|minnow3"
366get_log_dedupe "Siemens mc_apl1" "src/mainboard/siemens/mc_apl1" "mc_apl1"
Martin Rotheb80d8d2022-02-28 14:41:57 -0700367get_log_dedupe "Intel Apollolake/ Geminilake" "src/soc/intel/apollolake" "apollolake\|apollo.lake\|geminilake\|gemini.lake\|apl\|glk"
Martin Rothbec11082015-11-03 21:01:53 -0700368
Martin Rotheb80d8d2022-02-28 14:41:57 -0700369get_log_dedupe "Google Zoombini / Intel cannonlake_rvp" "src/mainboard/google/zoombini src/mainboard/intel/cannonlake_rvp" "zoombini\|cannonlake_rvp"
Martin Roth3ce67832017-11-04 18:36:19 -0600370get_log_dedupe "Intel CannonLake" "src/soc/intel/cannonlake src/mainboard/intel/cannonlake_rvp" "cannonlake"
Martin Rothfb190ed2016-10-01 20:13:43 -0600371
Martin Rotheb80d8d2022-02-28 14:41:57 -0700372get_log_dedupe "Google Kuki" "src/mainboard/google/kukui" "kukui"
373get_log_dedupe "mediatek/mt8183" "src/soc/mediatek/mt8183" "mt8183"
374
375get_log_dedupe "Google Cheza" "src/mainboard/google/cheza" "cheza"
376get_log_dedupe "Qualcomm sdm845" "src/soc/qualcomm/sdm845" "sdm845"
377
378get_log_dedupe "Prodrive Hermes / Google Sarien / Intel coffeelake_rvp" "src/mainboard/intel/coffeelake_rvp src/mainboard/google/sarien src/mainboard/prodrive/hermes"
379get_log_dedupe "Intel Coffeelake" "soc/intel/coffeelake"
380
Martin Rotheb80d8d2022-02-28 14:41:57 -0700381get_log_dedupe "Cavium" "src/soc/cavium src/mainboard/cavium src/mainboard/opencellular/elgon "
382get_log_dedupe "Scaleway Tagada" "src/mainboard/scaleway/tagada" "tagada"
383
Martin Roth3ce67832017-11-04 18:36:19 -0600384get_log_dedupe "Intel Galileo" "src/mainboard/intel/galileo" "galileo"
385get_log_dedupe "Intel Quark" "src/soc/intel/quark" "quark"
Martin Rothfb190ed2016-10-01 20:13:43 -0600386
Martin Roth3ce67832017-11-04 18:36:19 -0600387get_log_dedupe "Intel Baytrail" "src/soc/intel/baytrail" "baytrail"
Martin Rotheb80d8d2022-02-28 14:41:57 -0700388get_log_dedupe "Google Gale / Qualcomm QX ipq40xx" "src/mainboard/google/gale src/soc/qualcomm/ipq40xx" "gale\|ipq40"
389get_log_dedupe "Google Rotor / Marvell Mvmap2315" "src/soc/marvell/mvmap2315 src/mainboard/google/rotor" "marvell\|mvmap\|rotor"
Martin Rothfb190ed2016-10-01 20:13:43 -0600390
Martin Roth3ce67832017-11-04 18:36:19 -0600391get_log_dedupe "Gigabyte ga-g41m-es2l" "src/mainboard/gigabyte/ga-g41m-es2l" "es2l"
392get_log_dedupe "Intel x4x northbridge / LGA775" "src/northbridge/intel/x4x src/cpu/intel/socket_LGA775" "x4x\|lga775"
Martin Rothfb190ed2016-10-01 20:13:43 -0600393
Martin Rotheb80d8d2022-02-28 14:41:57 -0700394get_log_dedupe "Intel Haswell / Broadwell" "src/northbridge/haswell" "haswell"
395get_log_dedupe "Intel Lynxpoint" "src/southbridge/intel/lynxpoint" "lynxpoint"
396
Martin Roth3ce67832017-11-04 18:36:19 -0600397get_log_dedupe "Intel Sandybridge / Ivybridge" "src/southbridge/intel/bd82x6x src/southbridge/intel/fsp_bd82x6x src/northbridge/intel/sandybridge src/northbridge/intel/fsp_sandybridge src/cpu/intel/fsp_model_206ax src/cpu/intel/model_206ax" "sandybridge\|ivybridge\|bd82x6x"
Martin Rothfb190ed2016-10-01 20:13:43 -0600398
Martin Rotheb80d8d2022-02-28 14:41:57 -0700399get_log_dedupe "Google Herbrine" "src/mainboard/google/herobrine" "herobrine"
400get_log_dedupe "Qualcomm SC7280" "src/soc/qualcomm/sc2780" "sc2780"
401
402get_log_dedupe "Google Corsola" "src/mainboard/google/corsola" "corsola"
403get_log_dedupe "Mediatek MT8186" "src/soc/mediatek/mt8186" "mt8186"
404
Martin Roth3ce67832017-11-04 18:36:19 -0600405get_log_dedupe "Intel Common" "src/soc/intel/common src/southbridge/intel/common src/northbridge/intel/common" ""
406get_log_dedupe "Amd Common" "src/soc/amd/common src/southbridge/amd/common" ""
407
Patrick Georgi3b34ef22019-06-30 11:41:51 +0200408get_log_dedupe "Nvidia" "src/southbridge/nvidia" ""
409get_log_dedupe "Via" "src/northbridge/via src/southbridge/via" ""
410get_log_dedupe "Broadcom" "src/southbridge/broadcom" ""
411get_log_dedupe "Qualcomm" "src/soc/qualcomm" ""
Martin Rotheb80d8d2022-02-28 14:41:57 -0700412get_log_dedupe "Mediatek" "src/soc/mediatek" ""
Patrick Georgi3b34ef22019-06-30 11:41:51 +0200413
Martin Roth3ce67832017-11-04 18:36:19 -0600414get_log_dedupe "Intel vendorcode / FSP" "src/drivers/intel/fsp* src/vendorcode/intel" ""
Martin Rotheb80d8d2022-02-28 14:41:57 -0700415get_log_dedupe "AMD vendorcode / AGESA / PI" "src/vendorcode/amd" "agesa\|binarypi"
Martin Roth3ce67832017-11-04 18:36:19 -0600416get_log_dedupe "Google vendorcode" "src/vendorcode/google"
Martin Rotheb80d8d2022-02-28 14:41:57 -0700417get_log_dedupe "Cavium vendorcode" "src/vendorcode/cavium"
Martin Roth3ce67832017-11-04 18:36:19 -0600418
Martin Rotheb80d8d2022-02-28 14:41:57 -0700419get_log_dedupe "Security" "src/drivers/i2c/tpm src/security" "tpm"
Martin Roth3ce67832017-11-04 18:36:19 -0600420get_log_dedupe "Vboot" "src/vboot" "vboot"
421
422
423### GENERAL AREAS FOR RELEASE ###
424# shellcheck disable=SC2013
425{
Martin Rotheb80d8d2022-02-28 14:41:57 -0700426
427get_log_dedupe "X86 intel" \
428 "src/cpu/intel src/soc/intel src/northbridge/intel \
429 src/southbridge/intel src/include/intel src/drivers/intel"
430
431get_log_dedupe "X86 AMD" \
432 "src/cpu/amd src/northbridge/amd src/southbridge/amd src/include/amd src/soc/amd" \
433 "agesa\|binarypi\|binary.pi"
434
435get_log_dedupe "X86 common" \
436 "src/arch/x86 src/cpu/x86 src/include/x86 src/include/pc80"
437
Martin Roth3ce67832017-11-04 18:36:19 -0600438get_log_dedupe "ARM" \
439 "$(for codedir in $(grep -rl "_ARM" --include=Kconfig | \
440 grep -v 'src/mainboard\|payloads/\|drivers/\|vendorcode/\|console' ); \
441 do dirname "$codedir"; done | grep -v '^src$')"
442
443get_log_dedupe "RISC-V" \
444 "$(for codedir in $(grep -rl "_RISCV" --include=Kconfig | grep -v 'payloads/\|drivers/\|vendorcode/\|console' ); do dirname "$codedir"; done | grep -v '^src$')" \
Martin Rotheb80d8d2022-02-28 14:41:57 -0700445 "riscv\|risc-v\|lowrisc\|sifive"
Martin Roth3ce67832017-11-04 18:36:19 -0600446}
447
Martin Rotheb80d8d2022-02-28 14:41:57 -0700448get_log_dedupe "Google Mainboards" "src/mainboard/google"
449get_log_dedupe "Intel Mainboards" "src/mainboard/intel"
450get_log_dedupe "AMD Mainboards" "src/mainboard/amd"
Martin Roth3ce67832017-11-04 18:36:19 -0600451get_log_dedupe "Mainboards" "src/mainboard/"
452
453# Next, print all the rest of the specific areas
454get_log_dedupe "ACPI" "src/acpi/"
455get_log_dedupe "Console" "src/console src/include/console"
456get_log_dedupe "SuperIO" "src/superio src/include/superio"
457get_log_dedupe "EC" "src/ec"
458get_log_dedupe "Drivers" "src/drivers"
459get_log_dedupe "Devices" "src/device src/include/device"
460
461# 5th, print the generic areas - This goes late so that the specific
462# area changes will catch any commits in these areas first.
463get_log_dedupe "Toolchain" "util/crossgcc"
464get_log_dedupe "cbfstool" "util/cbfstool"
465get_log_dedupe "Lint tools" "util/lint"
466get_log_dedupe "Lib" "src/lib"
467get_log_dedupe "Commonlib" "src/commonlib"
468get_log_dedupe "Include" "src/include"
469get_log_dedupe "Utilities" "util"
470get_log_dedupe "Payloads" "payloads"
471get_log_dedupe "Vendorcode" "src/vendorcode"
Martin Roth3ce67832017-11-04 18:36:19 -0600472
473# Then look at areas that are usually outside the mainboards and architectures
474get_log_dedupe "Build system" \
475 "Makefile Makefile.inc toolchain.inc src/Kconfig src/cpu/Makefile.inc"
476
477get_log_dedupe "Submodules" "3rdparty util/nvidia/cbootimage"
Patrick Georgi3b34ef22019-06-30 11:41:51 +0200478
479get_log_dedupe "Maintainers" "MAINTAINERS" ""
480
Martin Roth3ce67832017-11-04 18:36:19 -0600481# Finally, get anything that was missed above
482get_log_dedupe "MISC" "."
483
Patrick Georgi1916d682019-11-20 16:05:21 +0100484# Replace VENDOR_DEVICE from stdin with their nice names on stdout
485real_mainboard_names() {
486 local tree_version=$1 # "old" or "new"
487 local git_version_var=${tree_version^^}_GIT_VERSION
488 local git_version=${!git_version_var}
489 local line
Martin Rotheb80d8d2022-02-28 14:41:57 -0700490 local file
491 local vendor
Patrick Georgi1916d682019-11-20 16:05:21 +0100492
Martin Rotheb80d8d2022-02-28 14:41:57 -0700493 while read -r line; do
494 file="$(git grep -l "^[[:space:]]*config\>[[:space:]]*\<BOARD_${line}\$" "${git_version}" -- src/mainboard/\*/\*/Kconfig.name | sed "s,^${git_version}:,,")"
Patrick Georgi1916d682019-11-20 16:05:21 +0100495 if [ -z "$file" ]; then
496 echo "This shouldn't happen: couldn't find Kconfig for $line"
497 exit 1
498 fi
Martin Rotheb80d8d2022-02-28 14:41:57 -0700499 vendor="$(git grep \" "${git_version}" -- "$(echo "${file}" | cut -d/ -f1-3,5)" | cut -d\" -f2)"
500 git grep -h -A1 "^[[:space:]]*config\>[[:space:]]*\<BOARD_${line}\$" "${git_version}" -- "${file}" | grep \" |cut -d\" -f2 |sed "s,^,${vendor} ,"
Patrick Georgi1916d682019-11-20 16:05:21 +0100501 done
502}
503
Martin Roth3ce67832017-11-04 18:36:19 -0600504# Show areas that have been added or removed
Patrick Georgi1916d682019-11-20 16:05:21 +0100505show_diff "mainboards" "$mainboard_list_old" "$mainboard_list_new" real_mainboard_names
Martin Roth3ce67832017-11-04 18:36:19 -0600506show_diff "processors" "$cpu_list_old" "$cpu_list_new"
507show_diff "socs" "$soc_list_old" "$soc_list_new"
508show_diff "northbridges" "$northbridge_list_old" "$northbridge_list_new"
509show_diff "southbridges" "$southbridge_list_old" "$southbridge_list_new"
510show_diff "sios" "$sio_list_old" "$sio_list_new"
511
512# Log submodules
513printf "Submodules\n----------\n" >> "$LOGFILE"
514for module in $(git submodule --quiet foreach pwd); do
515 name=$(basename "$module")
Martin Rotheb80d8d2022-02-28 14:41:57 -0700516 module="$(realpath "${module}")"
517 workingdir="$(realpath "${PWD}")"
Martin Roth3ce67832017-11-04 18:36:19 -0600518 # shellcheck disable=SC2001
Martin Rotheb80d8d2022-02-28 14:41:57 -0700519 path=${module#"$workingdir"}
Martin Roth3ce67832017-11-04 18:36:19 -0600520 old_version=$(echo "${name^^}_OLD_VERSION" | sed 's/-/_/g')
521 new_version=$(echo "${name^^}_NEW_VERSION" | sed 's/-/_/g')
Martin Rotheb80d8d2022-02-28 14:41:57 -0700522 get_log_submodule "${!old_version}" "${!new_version}" "${path}"
Martin Roth3ce67832017-11-04 18:36:19 -0600523done
Martin Rothbec11082015-11-03 21:01:53 -0700524
Martin Rothfb190ed2016-10-01 20:13:43 -0600525printf "\nrepo statistics\n-------------------\n" >> "$LOGFILE"
526before_names="$(mktemp "OLDNAMES.XXXX")"
527after_names="$(mktemp "NEWNAMES.XXXX")"
528NEW_AUTHORS=$(git log --pretty=%an "${OLD_GIT_VERSION}" 2>/dev/null | sort | \
529 uniq > "$before_names" && \
530 git log --pretty=%an "${NEW_GIT_VERSION}" 2>/dev/null | \
531 sort | uniq > "$after_names" && \
532 grep -Fxv -c -f "$before_names" "$after_names")
Patrick Georgid653e492019-11-20 16:49:41 +0100533NEW_AUTHOR_LIST=$( grep -Fxv -f "$before_names" "$after_names")
534rm -f "$before_names" "$after_names"
Martin Rothfb190ed2016-10-01 20:13:43 -0600535{
Martin Rothcbc792c2023-08-20 19:21:55 -0600536 printf -- "* Total commits: %s\n" "$TOTAL_COMMITS"
537 printf -- "* Total authors: %s\n" \
Martin Rothfb190ed2016-10-01 20:13:43 -0600538 "$(git log "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | \
539 grep -e '^Author:' | sed 's/.*Author: //' | sed 's/ <.*.>//' | \
540 sort | uniq | wc -l)"
Martin Rothcbc792c2023-08-20 19:21:55 -0600541 printf -- "* New authors: %s\n\nNew Authors:\n%s\n" "$NEW_AUTHORS" \
Martin Rothfb190ed2016-10-01 20:13:43 -0600542 "$NEW_AUTHOR_LIST"
543} >> "$LOGFILE"
Martin Rothbec11082015-11-03 21:01:53 -0700544
Martin Rothfb190ed2016-10-01 20:13:43 -0600545printf "Getting developer list\n"
546printf "\n%-40s: %5s\n" "Developer" "Commits" >> "$LOGFILE"
547git log "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | grep '^Author: ' | \
548 sed 's|Author: ||' | sed 's|\s<.*||' | sort | uniq | \
549 while read -r line; do
Martin Rothcbc792c2023-08-20 19:21:55 -0600550 printf "* %-40s: %5s %5s\n" "$line" \
Martin Rothfb190ed2016-10-01 20:13:43 -0600551 "$(git log "${OLD_GIT_VERSION}" 2>/dev/null | \
552 grep -c "^Author: ${line} <")" \
553 "$(git log "${NEW_GIT_VERSION}" 2>/dev/null | \
554 grep -c "^Author: ${line} <")" >> "$LOGFILE";
555 done
Martin Rothbec11082015-11-03 21:01:53 -0700556
557printf "\nOld SLOC (%s)\n%s" "$NOW" "$OLD_SLOC" >> "$LOGFILE"
558printf "\nNew SLOC (%s)\n%s" "$NOW" "$NEW_SLOC" >> "$LOGFILE"
559
560# Add the collected data to the top of the existing logfile for parsing
561if [ -n "$UPDATE_MAIN_LOGFILE" ]; then
562 tmpfile="$(mktemp "LOGFILE.XXXX")"
563 grep -Fxv -f "$MAIN_LOGFILE" "$LOGFILE" > "$tmpfile"
564 printf "\n\n" >> "$tmpfile"
565 cat "$MAIN_LOGFILE" >> "$tmpfile"
566 mv "$tmpfile" "$MAIN_LOGFILE"
567 rm -f "$LOGFILE"
568fi
Martin Rothfb190ed2016-10-01 20:13:43 -0600569
570printf "Done.\n"