blob: 9db86317dc44608cf88aa3d8748707e5372221e2 [file] [log] [blame]
Martin Rothbec11082015-11-03 21:01:53 -07001#!/bin/bash
2#
3# This file is part of the coreboot project.
4#
Martin Rothfb190ed2016-10-01 20:13:43 -06005# Copyright 2015-2016 Google Inc.
Martin Rothbec11082015-11-03 21:01:53 -07006#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; version 2 of the License.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15
Martin Rothbec11082015-11-03 21:01:53 -070016
Martin Rothfb190ed2016-10-01 20:13:43 -060017# This script creates a list of commits between two releases, broken out into
18# fairly inexact categories, based on the directories that files are in. If
19# a commit touched anything in the path that is checked earlier, it's counted
20# as being in that category.
21#
22# Don't run this in your current working tree, it checks out different versions
23# and can lose things.
Martin Rothbec11082015-11-03 21:01:53 -070024
Martin Rothfb190ed2016-10-01 20:13:43 -060025# set -x # uncomment for debug
26
27# Check for tools
28
Martin Roth3ce67832017-11-04 18:36:19 -060029if ! ( git --version && cloc --version ) > /dev/null 2>&1
Martin Rothfb190ed2016-10-01 20:13:43 -060030then
Martin Rothbec11082015-11-03 21:01:53 -070031 echo "ERROR: cloc or git is not installed. Exiting"
32 exit 1
33fi
34
Alex Thiessenda384dd2018-01-13 16:31:28 +000035if ! { cdup="$(git rev-parse --show-cdup 2>/dev/null)" && [ -z "${cdup}" ]; }
36then
Martin Rothfb190ed2016-10-01 20:13:43 -060037 echo "ERROR: This is not the top directory of a git repo. Exiting."
38 exit 1
39fi
40
41# Try to verify that the repo is clean before losing state.
42if ! git diff-index --quiet --cached HEAD 2>/dev/null || \
43 [ "$(git diff origin/master --shortstat 2>/dev/null | tail -n1)" != "" ]; then
Martin Rothbec11082015-11-03 21:01:53 -070044 echo "ERROR: repo is not clean. Exiting."
45 exit 1
46fi
47
Martin Rothfb190ed2016-10-01 20:13:43 -060048# Verify the command line arguments
49if [ "$1" == "--help" ] || [ -z "$1" ] || [ -z "$2" ]; then
50 echo
51 echo "Usage: $0 <old_version> <new_version> [release notes file]"
52 echo "Old version should be a tag (4.1), a branch (origin/4.1), or a commit id"
53 echo "New version can be 'HEAD' a branch (origin/master) a tag (4.2), or a commit id"
54 echo "Logfile can be a new file or an existing file to update"
55 echo "Example: \"$0 origin/4.1 4.2 rnotes.txt\""
56 echo
57 echo "Note that the script starts at the commit AFTER the old version."
58 echo
59 exit 1
60else
61 OLD_GIT_VERSION="$1"
62 NEW_GIT_VERSION="$2"
63 TOTAL_COMMITS=$(git log --pretty=oneline \
64 "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | wc -l)
65fi
66
67TOP=$(pwd)
68
69if [ -n "$3" ]; then
70 MAIN_LOGFILE="${TOP}/$3"
71else
72 MAIN_LOGFILE="${TOP}/relnotes.txt"
73fi
74
75# Figure out which logfile we're writing to. If the specified logfile exists,
76# we need to write to a temporary logfile, then append changes to the main
77# logfile.
Martin Rothbec11082015-11-03 21:01:53 -070078if [ -f "$MAIN_LOGFILE" ]; then
79 LOGFILE="$(mktemp "LOGFILE.XXXX")"
80 LOGFILE="${TOP}/$LOGFILE"
81 UPDATE_MAIN_LOGFILE=1
82else
83 LOGFILE="$MAIN_LOGFILE"
84fi
85
Martin Rothfb190ed2016-10-01 20:13:43 -060086get_author_commit_count() {
87 git log "${NEW_GIT_VERSION}" 2>/dev/null | grep -c "^Author: $1"
88}
89
90# Print and log the versions
Martin Rothbec11082015-11-03 21:01:53 -070091log_versions() {
92 echo "Log of commit $1 to commit $2"
93 echo "Log of commit $1 to commit $2" >> "$LOGFILE"
Martin Rothfb190ed2016-10-01 20:13:43 -060094 echo "Total commits: ${TOTAL_COMMITS}"
95 echo "Total commits: ${TOTAL_COMMITS}" >> "$LOGFILE"
Martin Rothbec11082015-11-03 21:01:53 -070096 echo
97}
98
Martin Rothfb190ed2016-10-01 20:13:43 -060099# Get the first commit id in the current tree
Martin Rothbec11082015-11-03 21:01:53 -0700100get_latest_commit_id() {
Martin Roth3ce67832017-11-04 18:36:19 -0600101(
102 cd "$1"
Martin Rothfb190ed2016-10-01 20:13:43 -0600103 git log 2>/dev/null | grep '^commit ' | head -1 | sed 's/commit //'
Martin Roth3ce67832017-11-04 18:36:19 -0600104)
Martin Rothbec11082015-11-03 21:01:53 -0700105}
106
Martin Rothfb190ed2016-10-01 20:13:43 -0600107# Main get log function
Martin Rothbec11082015-11-03 21:01:53 -0700108_get_log() {
109 local oldver="$1"
110 local newver="$2"
111 local title="$3"
112 local paths="$4"
Martin Roth3ce67832017-11-04 18:36:19 -0600113 local keywords="$5"
Martin Rothbec11082015-11-03 21:01:53 -0700114
Martin Roth3ce67832017-11-04 18:36:19 -0600115 # Leave ${paths} unquoted in the git commands
Martin Rothfb190ed2016-10-01 20:13:43 -0600116 # shellcheck disable=SC2086
Martin Roth3ce67832017-11-04 18:36:19 -0600117 { \
118 if [ -n "$paths" ]; then \
119 git log --abbrev-commit --pretty=oneline \
120 "${oldver}..${newver}" -- ${paths} \
121 2>/dev/null; \
122 fi; \
123 if [ -n "$keywords" ]; then \
124 git log --abbrev-commit --pretty=oneline \
125 "${oldver}..${newver}" 2>/dev/null \
126 | grep -i "$keywords"; \
127 fi \
128 } | sort -t ' ' -k 2 | uniq
Martin Rothbec11082015-11-03 21:01:53 -0700129}
130
Martin Rothfb190ed2016-10-01 20:13:43 -0600131# Output to a new log, then compare to the first logfile, and only output
132# non duplicated lines to the final file.
Martin Rothbec11082015-11-03 21:01:53 -0700133get_log_dedupe() {
134 local title="$1"
135 local paths="$2"
Martin Roth3ce67832017-11-04 18:36:19 -0600136 local keywords="$3"
Martin Rothfb190ed2016-10-01 20:13:43 -0600137 local log
138 local commits
139
Martin Rothbec11082015-11-03 21:01:53 -0700140 dedupe_tmpfile="$(mktemp "LOGFILE.XXXX")"
141
Martin Rothfb190ed2016-10-01 20:13:43 -0600142 log=$(_get_log "$OLD_GIT_VERSION" "$NEW_GIT_VERSION" \
Martin Roth3ce67832017-11-04 18:36:19 -0600143 "$title" "$paths" "$keywords")
Martin Rothbec11082015-11-03 21:01:53 -0700144
145 echo "$log" > "$dedupe_tmpfile"
146
147 log=$(grep -Fxv -f "$LOGFILE" "$dedupe_tmpfile")
Martin Rothfb190ed2016-10-01 20:13:43 -0600148 commits=$(echo "$log" | wc -l)
Martin Rothbec11082015-11-03 21:01:53 -0700149
Martin Roth3ce67832017-11-04 18:36:19 -0600150 #echo "$title: $paths $keywords" >> "$LOGFILE"
151 printf "%s\n%s\n\n" "##### $title ($commits commits) #####" \
152 "$log" >> "$LOGFILE"
Martin Rothbec11082015-11-03 21:01:53 -0700153
154 rm "$dedupe_tmpfile"
155}
156
157# get logs for the submodules
158get_log_submodule() {
159 local old_version="$1"
160 local new_version="$2"
161 local submodule_dir="$3"
Martin Rothfb190ed2016-10-01 20:13:43 -0600162 local log
163 local commits
Martin Rothbec11082015-11-03 21:01:53 -0700164
165 printf "Submodule %s\n" "$submodule_dir"
166 printf "commit %s to commit %s\n\n" "$old_version" "$new_version"
167
Martin Roth3ce67832017-11-04 18:36:19 -0600168 (
169 cd "${TOP}/$submodule_dir"
170 log="$(_get_log "$old_version" "$new_version" "$submodule_dir" "." "")"
Martin Rothfb190ed2016-10-01 20:13:43 -0600171 commits=$(echo "$log" | wc -l)
Martin Rothbec11082015-11-03 21:01:53 -0700172
173 if [ -n "$log" ]; then
Martin Roth3ce67832017-11-04 18:36:19 -0600174 printf "%s\n" "$submodule_dir ($commits commits)" >> "$LOGFILE"
175 printf "\n" >> "$LOGFILE"
Martin Rothbec11082015-11-03 21:01:53 -0700176 fi
Martin Roth3ce67832017-11-04 18:36:19 -0600177 )
Martin Rothbec11082015-11-03 21:01:53 -0700178}
179
Martin Rothfb190ed2016-10-01 20:13:43 -0600180find_areas() {
Martin Roth3ce67832017-11-04 18:36:19 -0600181 local directory="$1"
182 local filename="$2"
183 local skip="$3"
184 find "$directory" -name "$filename" | sed "s|/$filename||" | sed "s|/$directory||" | grep -v "$skip" | sort
Martin Rothfb190ed2016-10-01 20:13:43 -0600185}
186
187# Make sure things get cleaned up if ctl-c is pressed while the old version
188# is checked out and files are renamed. This can be a real mess to clean
189# up manually.
Martin Rothbec11082015-11-03 21:01:53 -0700190version_ctrl_c() {
Martin Rothfb190ed2016-10-01 20:13:43 -0600191 printf "\n** Trapped CTRL-C\n Cleaning up and exiting.\n"
192 find 'src' -name 'gnumakefile' \
193 -exec rename 's/gnumakefile/Makefile\.inc/' {} \;
194 git checkout origin/master > /dev/null 2>&1
Martin Rothbec11082015-11-03 21:01:53 -0700195 git submodule update --init --checkout > /dev/null 2>&1
196 rm -f "$mainboard_list_old" "$mainboard_list_new"
197 rm "$LOGFILE"
198 exit 1;
199}
200
Martin Rothfb190ed2016-10-01 20:13:43 -0600201# Calculate areas that have been added or removed based on file lists
202show_diff () {
203 local new
204 local old
Martin Rothbec11082015-11-03 21:01:53 -0700205
Martin Rothfb190ed2016-10-01 20:13:43 -0600206 new="$(comm -13 <(echo "$2") <(echo "$3"))"
207 if [ -n "$new" ]; then
208 printf "Added %s $1:\n-------------------\n%s\n\n" \
209 "$(echo "$new" | wc -l)" "$new" >> "$LOGFILE"
210 fi
211 old="$(comm -23 <(echo "$2") <(echo "$3"))"
212 if [ -n "$old" ]; then
213 printf "Removed %s $1:\n-------------------\n%s\n\n" \
214 "$(echo "$old" | wc -l)" "$old" >> "$LOGFILE"
215 fi
216}
217
Martin Roth3ce67832017-11-04 18:36:19 -0600218get_sloc () {
219 # Because cloc works on extensions, and .inc identifies as pascal,
220 # rename Makefile.inc, then remap the other .inc files to c
221 find 'src' -name 'Makefile.inc' -exec rename 's/Makefile\.inc/gnumakefile/' {} \;
222
223 cloc --progress-rate=0 --quiet --script-lang="Bourne Shell",bash \
224 --force-lang=c,inc --exclude-dir=vendorcode src
225
226 # Change all the makefiles back to Makefile.inc
227 find 'src' -name 'gnumakefile' -exec rename 's/gnumakefile/Makefile\.inc/' {} \;
228}
229
Martin Rothfb190ed2016-10-01 20:13:43 -0600230# Start collecting data from the old and new revisions.
231# This is relatively disruptive to the tree, so trap on ctl-c so that
232# things can be put back to normal
233trap version_ctrl_c SIGINT
Martin Rothbec11082015-11-03 21:01:53 -0700234
235#check out old version and get information
236printf -- "Finding old submodule versions...\n"
Martin Rothfb190ed2016-10-01 20:13:43 -0600237git checkout "$OLD_GIT_VERSION" > /dev/null 2>&1
Martin Rothbec11082015-11-03 21:01:53 -0700238git submodule update --init --checkout > /dev/null 2>&1
Martin Roth3ce67832017-11-04 18:36:19 -0600239for module in $(git submodule --quiet foreach pwd); do
240 name="$(basename "$module" | sed 's/-/_/g')"
241 version="${name^^}_OLD_VERSION"
242 declare "$version"=$(get_latest_commit_id "$module")
243done
Martin Rothfb190ed2016-10-01 20:13:43 -0600244
Martin Roth3ce67832017-11-04 18:36:19 -0600245printf "Logging directories in the old tree\n"
246mainboard_list_old=$(grep -h "^[[:space:]]*config\>[[:space:]]*\<BOARD_" src/mainboard/*/*/Kconfig.name 2>/dev/null | sed "s,^.*\<BOARD_\([A-Z0-9_]*\)\>.*$,\1," | sort)
247cpu_list_old=$(find_areas "src/cpu" "Kconfig" "intel/common")
248soc_list_old=$(find_areas "src/soc" "Makefile.inc" "intel/common\|amd/common\|romstage")
249northbridge_list_old=$(find_areas "src/northbridge" "Kconfig" "")
250sio_list_old=$(find_areas "src/superio" "Makefile.inc" "")
251southbridge_list_old=$(find_areas "src/southbridge" "Kconfig" "")
Martin Rothfb190ed2016-10-01 20:13:43 -0600252
Martin Rothbec11082015-11-03 21:01:53 -0700253printf "Calculating old SLOC\n"
Martin Roth3ce67832017-11-04 18:36:19 -0600254OLD_SLOC=$(get_sloc)
Martin Rothbec11082015-11-03 21:01:53 -0700255
256#check out new version and get information
257printf -- "\nFinding new submodule versions...\n"
Martin Rothfb190ed2016-10-01 20:13:43 -0600258git checkout "$NEW_GIT_VERSION" > /dev/null 2>&1
Martin Rothbec11082015-11-03 21:01:53 -0700259git submodule update --init --checkout > /dev/null 2>&1
Martin Rothbec11082015-11-03 21:01:53 -0700260
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^^}_NEW_VERSION"
264 declare "$version"=$(get_latest_commit_id "$module")
265done
Martin Rothfb190ed2016-10-01 20:13:43 -0600266
Martin Roth3ce67832017-11-04 18:36:19 -0600267printf "Logging directories in the new tree\n"
268mainboard_list_new=$(grep -h "^[[:space:]]*config\>[[:space:]]*\<BOARD_" src/mainboard/*/*/Kconfig.name 2>/dev/null | sed "s,^.*\<BOARD_\([A-Z0-9_]*\)\>.*$,\1," | sort)
269cpu_list_new=$(find_areas "src/cpu" "Kconfig" "intel/common")
270soc_list_new=$(find_areas "src/soc" "Makefile.inc" "intel/common\|amd/common\|romstage")
271northbridge_list_new=$(find_areas "src/northbridge" "Kconfig" "")
272sio_list_new=$(find_areas "src/superio" "Makefile.inc" "")
273southbridge_list_new=$(find_areas "src/southbridge" "Kconfig" "")
274
Martin Rothfb190ed2016-10-01 20:13:43 -0600275printf "Calculating new SLOC\n"
Martin Roth3ce67832017-11-04 18:36:19 -0600276NEW_SLOC=$(get_sloc)
Martin Rothbec11082015-11-03 21:01:53 -0700277
278git checkout origin/master > /dev/null 2>&1
279git submodule update --init --checkout > /dev/null 2>&1
Martin Rothbec11082015-11-03 21:01:53 -0700280trap "" SIGINT
Martin Rothfb190ed2016-10-01 20:13:43 -0600281# Done collecting data from the old and new versions
Martin Rothbec11082015-11-03 21:01:53 -0700282
Martin Rothfb190ed2016-10-01 20:13:43 -0600283# Start outputting to logfile
284echo "Generating release notes from version ${OLD_GIT_VERSION} to ${NEW_GIT_VERSION}"
285echo; echo "Main repo"
286echo "Main repo" >> "$LOGFILE"
Martin Rothbec11082015-11-03 21:01:53 -0700287echo "------------------" >> "$LOGFILE"
Martin Rothfb190ed2016-10-01 20:13:43 -0600288log_versions "$(git log --pretty=%H \
289 "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | tail -1)" \
290 "$(git log --pretty=%H \
291 "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | head -1 )"
292echo "" >> "$LOGFILE"
Martin Rothbec11082015-11-03 21:01:53 -0700293
Martin Roth3ce67832017-11-04 18:36:19 -0600294### SPECIFIC AREAS FOR RELEASE ###
295get_log_dedupe "cleanup" "" "spelling\|Use tabs\|transition away from device_t\|space [around\|before]\|code formatting\|commented code\|code cleanup\|capitalize\|unnecessary whitespace\|checkpatch"
Martin Rothbec11082015-11-03 21:01:53 -0700296
Martin Roth3ce67832017-11-04 18:36:19 -0600297get_log_dedupe "Google Kahlee / AMD Gardenia" "src/mainboard/google/kahlee src/mainboard/amd/gardenia" "kahlee\|gardenia"
298get_log_dedupe "AMD Stoney Ridge" "src/soc/amd/stoneyridge" "stoney"
Martin Rothbec11082015-11-03 21:01:53 -0700299
Martin Roth3ce67832017-11-04 18:36:19 -0600300get_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"
301#get_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"
302get_log_dedupe "Purism SKL" "src/mainboard/purism/librem_skl" "librem13v2\|librem_skl"
303get_log_dedupe "Intel Skylake / Kabylake" "src/soc/intel/skylake" "skylake\|sky.lake\|kabylake\|kaby.lake"
Martin Rothbec11082015-11-03 21:01:53 -0700304
Martin Roth3ce67832017-11-04 18:36:19 -0600305get_log_dedupe "Google Cyan / Intel Strago" "src/mainboard/google/cyan src/mainboard/intel/strago" "cyan\|strago"
306get_log_dedupe "Intel Braswell" "src/soc/intel/braswell" "braswell"
Martin Rothbec11082015-11-03 21:01:53 -0700307
Martin Roth3ce67832017-11-04 18:36:19 -0600308get_log_dedupe "Google Kevin / Gru / Bob / Scarlet / Nefario" "src/mainboard/google/gru" "kevin\|gru[^b]"
309get_log_dedupe "Rockchip rk3399" "src/soc/rockchip/rk3399" "rk3399"
Martin Rothbec11082015-11-03 21:01:53 -0700310
Martin Roth3ce67832017-11-04 18:36:19 -0600311get_log_dedupe "Google Reef / Pyro / Sand / Snappy / Nasher" "src/mainboard/google/reef" "reef\|pyro\|sand[ :]\|snappy\|nasher"
312#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"
313get_log_dedupe "Siemens mc_apl1" "src/mainboard/siemens/mc_apl1" "mc_apl1"
314get_log_dedupe "Intel Apollolake" "src/soc/intel/apollolake" "apollolake\|apollo.lake"
Martin Rothbec11082015-11-03 21:01:53 -0700315
Martin Roth3ce67832017-11-04 18:36:19 -0600316get_log_dedupe "Google Zoombini / Intel cannonlake_rvp" "src/mainboard/google/zoombini src/mainboard/intel/cannonlake_rvp" "zoombini\|cannonlake_rvp"
317get_log_dedupe "Intel CannonLake" "src/soc/intel/cannonlake src/mainboard/intel/cannonlake_rvp" "cannonlake"
Martin Rothfb190ed2016-10-01 20:13:43 -0600318
Martin Roth3ce67832017-11-04 18:36:19 -0600319get_log_dedupe "Intel Galileo" "src/mainboard/intel/galileo" "galileo"
320get_log_dedupe "Intel Quark" "src/soc/intel/quark" "quark"
Martin Rothfb190ed2016-10-01 20:13:43 -0600321
Martin Roth3ce67832017-11-04 18:36:19 -0600322get_log_dedupe "Intel Baytrail" "src/soc/intel/baytrail" "baytrail"
323#get_log_dedupe "Google Gale / Qualcomm QX ipq40xx" "src/mainboard/google/gale src/soc/qualcomm/ipq40xx" "gale\|ipq40"
324#et_log_dedupe "Google Rotor / Marvell Mvmap2315" "src/soc/marvell/mvmap2315 src/mainboard/google/rotor" "marvell\|mvmap\|rotor"
Martin Rothfb190ed2016-10-01 20:13:43 -0600325
Martin Roth3ce67832017-11-04 18:36:19 -0600326get_log_dedupe "Gigabyte ga-g41m-es2l" "src/mainboard/gigabyte/ga-g41m-es2l" "es2l"
327get_log_dedupe "Intel x4x northbridge / LGA775" "src/northbridge/intel/x4x src/cpu/intel/socket_LGA775" "x4x\|lga775"
Martin Rothfb190ed2016-10-01 20:13:43 -0600328
Martin Roth3ce67832017-11-04 18:36:19 -0600329get_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 -0600330
Martin Roth3ce67832017-11-04 18:36:19 -0600331get_log_dedupe "Intel Common" "src/soc/intel/common src/southbridge/intel/common src/northbridge/intel/common" ""
332get_log_dedupe "Amd Common" "src/soc/amd/common src/southbridge/amd/common" ""
333
334get_log_dedupe "Intel vendorcode / FSP" "src/drivers/intel/fsp* src/vendorcode/intel" ""
335get_log_dedupe "AMD vendorcode / AGESA / PI" "src/vendorcode/amd" ""
336get_log_dedupe "Google vendorcode" "src/vendorcode/google"
337
338get_log_dedupe "TPM" "src/drivers/i2c/tpm" "tpm"
339get_log_dedupe "Vboot" "src/vboot" "vboot"
340
341
342### GENERAL AREAS FOR RELEASE ###
343# shellcheck disable=SC2013
344{
345get_log_dedupe "ARM" \
346 "$(for codedir in $(grep -rl "_ARM" --include=Kconfig | \
347 grep -v 'src/mainboard\|payloads/\|drivers/\|vendorcode/\|console' ); \
348 do dirname "$codedir"; done | grep -v '^src$')"
349
350get_log_dedupe "RISC-V" \
351 "$(for codedir in $(grep -rl "_RISCV" --include=Kconfig | grep -v 'payloads/\|drivers/\|vendorcode/\|console' ); do dirname "$codedir"; done | grep -v '^src$')" \
352 "riscv\|risc-v\|lowrisc"
353
354get_log_dedupe "MIPS" \
355 "$(for codedir in $(grep -rl "_MIPS" --include=Kconfig | \
356 grep -v 'src/mainboard\|payloads/\|drivers/\|vendorcode/\|console' ); \
357 do dirname "$codedir"; done | grep -v '^src$')"
358}
359
360get_log_dedupe "X86 intel" \
361 "src/cpu/intel src/soc/intel src/northbridge/intel \
362 src/southbridge/intel src/include/intel src/drivers/intel"
363
364get_log_dedupe "X86 amd" \
365 "src/cpu/amd src/northbridge/amd src/southbridge/amd src/include/amd src/soc/amd" \
366 "agesa\|binarypi\|binary.pi"
367
368get_log_dedupe "X86 common" \
369 "src/arch/x86 src/cpu/x86 src/include/x86 src/include/pc80"
370
371get_log_dedupe "Mainboards" "src/mainboard/"
372
373# Next, print all the rest of the specific areas
374get_log_dedupe "ACPI" "src/acpi/"
375get_log_dedupe "Console" "src/console src/include/console"
376get_log_dedupe "SuperIO" "src/superio src/include/superio"
377get_log_dedupe "EC" "src/ec"
378get_log_dedupe "Drivers" "src/drivers"
379get_log_dedupe "Devices" "src/device src/include/device"
380
381# 5th, print the generic areas - This goes late so that the specific
382# area changes will catch any commits in these areas first.
383get_log_dedupe "Toolchain" "util/crossgcc"
384get_log_dedupe "cbfstool" "util/cbfstool"
385get_log_dedupe "Lint tools" "util/lint"
386get_log_dedupe "Lib" "src/lib"
387get_log_dedupe "Commonlib" "src/commonlib"
388get_log_dedupe "Include" "src/include"
389get_log_dedupe "Utilities" "util"
390get_log_dedupe "Payloads" "payloads"
391get_log_dedupe "Vendorcode" "src/vendorcode"
392get_log_dedupe "Documentation" "Documentation README"
393
394# Then look at areas that are usually outside the mainboards and architectures
395get_log_dedupe "Build system" \
396 "Makefile Makefile.inc toolchain.inc src/Kconfig src/cpu/Makefile.inc"
397
398get_log_dedupe "Submodules" "3rdparty util/nvidia/cbootimage"
399# Finally, get anything that was missed above
400get_log_dedupe "MISC" "."
401
402# Show areas that have been added or removed
403show_diff "mainboards" "$mainboard_list_old" "$mainboard_list_new"
404show_diff "processors" "$cpu_list_old" "$cpu_list_new"
405show_diff "socs" "$soc_list_old" "$soc_list_new"
406show_diff "northbridges" "$northbridge_list_old" "$northbridge_list_new"
407show_diff "southbridges" "$southbridge_list_old" "$southbridge_list_new"
408show_diff "sios" "$sio_list_old" "$sio_list_new"
409
410# Log submodules
411printf "Submodules\n----------\n" >> "$LOGFILE"
412for module in $(git submodule --quiet foreach pwd); do
413 name=$(basename "$module")
414 # shellcheck disable=SC2001
415 path=$(echo "$module" | sed 's|.*coreboot||')
416 old_version=$(echo "${name^^}_OLD_VERSION" | sed 's/-/_/g')
417 new_version=$(echo "${name^^}_NEW_VERSION" | sed 's/-/_/g')
418 get_log_submodule "${!old_version}" "${!new_version}" "$path"
419done
Martin Rothbec11082015-11-03 21:01:53 -0700420
Martin Rothfb190ed2016-10-01 20:13:43 -0600421printf "\nrepo statistics\n-------------------\n" >> "$LOGFILE"
422before_names="$(mktemp "OLDNAMES.XXXX")"
423after_names="$(mktemp "NEWNAMES.XXXX")"
424NEW_AUTHORS=$(git log --pretty=%an "${OLD_GIT_VERSION}" 2>/dev/null | sort | \
425 uniq > "$before_names" && \
426 git log --pretty=%an "${NEW_GIT_VERSION}" 2>/dev/null | \
427 sort | uniq > "$after_names" && \
428 grep -Fxv -c -f "$before_names" "$after_names")
429NEW_AUTHOR_LIST=$( grep -Fxv -f "$before_names" "$after_names" && \
430 rm "$before_names" "$after_names")
431{
432 printf -- "- Total commits: %s\n" "$TOTAL_COMMITS"
433 printf -- "- Total authors: %s\n" \
434 "$(git log "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | \
435 grep -e '^Author:' | sed 's/.*Author: //' | sed 's/ <.*.>//' | \
436 sort | uniq | wc -l)"
437 printf -- "- New authors: %s\n\nNew Authors:\n%s\n" "$NEW_AUTHORS" \
438 "$NEW_AUTHOR_LIST"
439} >> "$LOGFILE"
Martin Rothbec11082015-11-03 21:01:53 -0700440
Martin Rothfb190ed2016-10-01 20:13:43 -0600441printf "Getting developer list\n"
442printf "\n%-40s: %5s\n" "Developer" "Commits" >> "$LOGFILE"
443git log "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | grep '^Author: ' | \
444 sed 's|Author: ||' | sed 's|\s<.*||' | sort | uniq | \
445 while read -r line; do
446 printf "%-40s: %5s %5s\n" "$line" \
447 "$(git log "${OLD_GIT_VERSION}" 2>/dev/null | \
448 grep -c "^Author: ${line} <")" \
449 "$(git log "${NEW_GIT_VERSION}" 2>/dev/null | \
450 grep -c "^Author: ${line} <")" >> "$LOGFILE";
451 done
Martin Rothbec11082015-11-03 21:01:53 -0700452
453printf "\nOld SLOC (%s)\n%s" "$NOW" "$OLD_SLOC" >> "$LOGFILE"
454printf "\nNew SLOC (%s)\n%s" "$NOW" "$NEW_SLOC" >> "$LOGFILE"
455
456# Add the collected data to the top of the existing logfile for parsing
457if [ -n "$UPDATE_MAIN_LOGFILE" ]; then
458 tmpfile="$(mktemp "LOGFILE.XXXX")"
459 grep -Fxv -f "$MAIN_LOGFILE" "$LOGFILE" > "$tmpfile"
460 printf "\n\n" >> "$tmpfile"
461 cat "$MAIN_LOGFILE" >> "$tmpfile"
462 mv "$tmpfile" "$MAIN_LOGFILE"
463 rm -f "$LOGFILE"
464fi
Martin Rothfb190ed2016-10-01 20:13:43 -0600465
466printf "Done.\n"