Yegor Timoshenko | c2e4941 | 2018-10-07 01:58:27 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 2 | # |
Patrick Georgi | 7333a11 | 2020-05-08 20:48:04 +0200 | [diff] [blame] | 3 | # SPDX-License-Identifier: GPL-2.0-only |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 4 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 5 | # 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 Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 12 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 13 | # set -x # uncomment for debug |
| 14 | |
| 15 | # Check for tools |
| 16 | |
Patrick Georgi | fa13a64 | 2018-12-20 17:17:03 +0100 | [diff] [blame] | 17 | if ! ( git --version && cloc --version && rename --version ) > /dev/null 2>&1 |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 18 | then |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 19 | echo "ERROR: cloc, git or rename is not installed. Exiting" >&2 |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 20 | exit 1 |
| 21 | fi |
| 22 | |
Alex Thiessen | da384dd | 2018-01-13 16:31:28 +0000 | [diff] [blame] | 23 | if ! { cdup="$(git rev-parse --show-cdup 2>/dev/null)" && [ -z "${cdup}" ]; } |
| 24 | then |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 25 | echo "ERROR: This is not the top directory of a git repo. Exiting." >&2 |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 26 | exit 1 |
| 27 | fi |
| 28 | |
| 29 | # Try to verify that the repo is clean before losing state. |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 30 | if ! git diff-index --quiet --cached HEAD 2>/dev/null || \ |
| 31 | [ "$(git diff origin/master --shortstat 2>/dev/null | tail -n1)" != "" ]; then |
| 32 | echo "ERROR: repo is not clean. Exiting." >&2 |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 33 | exit 1 |
| 34 | fi |
| 35 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 36 | # Verify the command line arguments |
| 37 | if [ "$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" |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 41 | echo "New version can be a branch (origin/master) a tag (4.2), or a commit id" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 42 | 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 |
| 48 | else |
| 49 | OLD_GIT_VERSION="$1" |
| 50 | NEW_GIT_VERSION="$2" |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 51 | if [[ "$OLD_GIT_VERSION" = "HEAD" || "$NEW_GIT_VERSION" = "HEAD" ]]; then |
| 52 | echo "Error: using HEAD as a reference doesn't work" >&2 |
Patrick Georgi | 81a30ec | 2020-05-11 23:47:12 +0200 | [diff] [blame] | 53 | echo |
| 54 | exit 1 |
| 55 | fi |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 56 | TOTAL_COMMITS=$(git log --pretty=oneline \ |
| 57 | "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | wc -l) |
| 58 | fi |
| 59 | |
| 60 | TOP=$(pwd) |
| 61 | |
| 62 | if [ -n "$3" ]; then |
| 63 | MAIN_LOGFILE="${TOP}/$3" |
| 64 | else |
| 65 | MAIN_LOGFILE="${TOP}/relnotes.txt" |
| 66 | fi |
| 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 Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 71 | if [ -f "$MAIN_LOGFILE" ]; then |
| 72 | LOGFILE="$(mktemp "LOGFILE.XXXX")" |
| 73 | LOGFILE="${TOP}/$LOGFILE" |
| 74 | UPDATE_MAIN_LOGFILE=1 |
| 75 | else |
| 76 | LOGFILE="$MAIN_LOGFILE" |
| 77 | fi |
| 78 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 79 | get_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 Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 84 | log_versions() { |
| 85 | echo "Log of commit $1 to commit $2" |
| 86 | echo "Log of commit $1 to commit $2" >> "$LOGFILE" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 87 | echo "Total commits: ${TOTAL_COMMITS}" |
| 88 | echo "Total commits: ${TOTAL_COMMITS}" >> "$LOGFILE" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 89 | echo |
| 90 | } |
| 91 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 92 | # Get the first commit id in the current tree |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 93 | get_latest_commit_id() { |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 94 | ( |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 95 | cd "$1" || exit 1 |
| 96 | git log -n 1 2>/dev/null | grep '^commit ' | head -1 | sed 's/commit //' | sed 's/ .*//' |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 97 | ) |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 98 | } |
| 99 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 100 | # Main get log function |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 101 | _get_log() { |
| 102 | local oldver="$1" |
| 103 | local newver="$2" |
| 104 | local title="$3" |
| 105 | local paths="$4" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 106 | local keywords="$5" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 107 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 108 | # Leave ${paths} unquoted in the git commands |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 109 | # shellcheck disable=SC2086 |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 110 | { \ |
| 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 Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 122 | } |
| 123 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 124 | # Output to a new log, then compare to the first logfile, and only output |
| 125 | # non duplicated lines to the final file. |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 126 | get_log_dedupe() { |
| 127 | local title="$1" |
| 128 | local paths="$2" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 129 | local keywords="$3" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 130 | local log |
| 131 | local commits |
| 132 | |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 133 | dedupe_tmpfile="$(mktemp "LOGFILE.XXXX")" |
| 134 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 135 | log=$(_get_log "$OLD_GIT_VERSION" "$NEW_GIT_VERSION" \ |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 136 | "$title" "$paths" "$keywords") |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 137 | |
| 138 | echo "$log" > "$dedupe_tmpfile" |
| 139 | |
| 140 | log=$(grep -Fxv -f "$LOGFILE" "$dedupe_tmpfile") |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 141 | commits=$(echo "$log" | wc -l) |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 142 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 143 | 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 Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 148 | |
| 149 | rm "$dedupe_tmpfile" |
| 150 | } |
| 151 | |
| 152 | # get logs for the submodules |
| 153 | get_log_submodule() { |
| 154 | local old_version="$1" |
| 155 | local new_version="$2" |
| 156 | local submodule_dir="$3" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 157 | local log |
| 158 | local commits |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 159 | |
| 160 | printf "Submodule %s\n" "$submodule_dir" |
| 161 | printf "commit %s to commit %s\n\n" "$old_version" "$new_version" |
| 162 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 163 | if ! ( |
| 164 | cd "${TOP}/$submodule_dir" || exit 1 |
| 165 | log="$(_get_log "$old_version" "$new_version" "$submodule_dir" "." "")" || exit 1 |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 166 | commits=$(echo "$log" | wc -l) |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 167 | |
| 168 | if [ -n "$log" ]; then |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 169 | printf "%s\n" "$submodule_dir ($commits commits)" >> "$LOGFILE" |
| 170 | printf "\n" >> "$LOGFILE" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 171 | fi |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 172 | ); then |
| 173 | version_ctrl_c |
| 174 | fi |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 175 | } |
| 176 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 177 | find_areas() { |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 178 | local directory="$1" |
| 179 | local filename="$2" |
| 180 | local skip="$3" |
| 181 | find "$directory" -name "$filename" | sed "s|/$filename||" | sed "s|/$directory||" | grep -v "$skip" | sort |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | # Make sure things get cleaned up if ctl-c is pressed while the old version |
| 185 | # is checked out and files are renamed. This can be a real mess to clean |
| 186 | # up manually. |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 187 | version_ctrl_c() { |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 188 | printf "\n Cleaning up and exiting.\n" >&2 |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 189 | find 'src' -name 'gnumakefile' \ |
| 190 | -exec rename 's/gnumakefile/Makefile\.inc/' {} \; |
| 191 | git checkout origin/master > /dev/null 2>&1 |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 192 | git submodule update --init --checkout > /dev/null 2>&1 |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 193 | rm "$LOGFILE" |
| 194 | exit 1; |
| 195 | } |
| 196 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 197 | # Calculate areas that have been added or removed based on file lists |
| 198 | show_diff () { |
| 199 | local new |
| 200 | local old |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 201 | |
Patrick Georgi | 1916d68 | 2019-11-20 16:05:21 +0100 | [diff] [blame] | 202 | new="$(comm -13 <(echo "$2") <(echo "$3"))" |
| 203 | old="$(comm -23 <(echo "$2") <(echo "$3"))" |
| 204 | |
| 205 | # Allow running a postprocessor, given as 4th argument over the |
| 206 | # resulting diff, provide context if it's old or new data |
| 207 | if [ -n "$4" ]; then |
| 208 | new=$(echo "$new" | $4 new | sort) |
| 209 | old=$(echo "$old" | $4 old | sort) |
| 210 | fi |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 211 | new="$(printf "%s" "$new" | sed 's/^/* /')" |
| 212 | old="$(printf "%s" "$old" | sed 's/^/* /')" |
Patrick Georgi | 1916d68 | 2019-11-20 16:05:21 +0100 | [diff] [blame] | 213 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 214 | if [ -n "$new" ]; then |
| 215 | printf "Added %s $1:\n-------------------\n%s\n\n" \ |
| 216 | "$(echo "$new" | wc -l)" "$new" >> "$LOGFILE" |
| 217 | fi |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 218 | if [ -n "$old" ]; then |
| 219 | printf "Removed %s $1:\n-------------------\n%s\n\n" \ |
| 220 | "$(echo "$old" | wc -l)" "$old" >> "$LOGFILE" |
| 221 | fi |
| 222 | } |
| 223 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 224 | get_sloc () { |
| 225 | # Because cloc works on extensions, and .inc identifies as pascal, |
Patrick Georgi | 436296b | 2019-11-20 17:15:13 +0100 | [diff] [blame] | 226 | # while we use it both for Makefile.inc and some files that are |
| 227 | # really C, do three passes: everything but .inc files, all .inc files |
| 228 | # that aren't Makefiles, all Makefile.inc, then combine them. |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 229 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 230 | local base |
| 231 | base=$(mktemp) |
| 232 | find src -name Makefile.inc > "${base}.mak" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 233 | |
Patrick Georgi | 436296b | 2019-11-20 17:15:13 +0100 | [diff] [blame] | 234 | cloc --progress-rate=0 --quiet \ |
| 235 | --script-lang="Bourne Shell",bash --exclude-ext=inc \ |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 236 | --exclude-dir=vendorcode "--out=${base}" src |
Patrick Georgi | 436296b | 2019-11-20 17:15:13 +0100 | [diff] [blame] | 237 | cloc --progress-rate=0 --quiet \ |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 238 | "--exclude-list-file=${base}.mak" --force-lang=c,inc \ |
| 239 | --exclude-dir=vendorcode "--out=${base}.c" src |
Patrick Georgi | 436296b | 2019-11-20 17:15:13 +0100 | [diff] [blame] | 240 | cloc --progress-rate=0 --quiet \ |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 241 | "--list-file=${base}.mak" --force-lang=make,inc \ |
| 242 | --exclude-dir=vendorcode "--out=${base}.m" src |
Patrick Georgi | 436296b | 2019-11-20 17:15:13 +0100 | [diff] [blame] | 243 | cloc --progress-rate=0 --quiet --sum-reports \ |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 244 | "${base}" "${base}.c" "${base}.m" --out "${base}.result" |
Patrick Georgi | 436296b | 2019-11-20 17:15:13 +0100 | [diff] [blame] | 245 | |
| 246 | echo |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 247 | cat "${base}.result.lang" |
Patrick Georgi | 436296b | 2019-11-20 17:15:13 +0100 | [diff] [blame] | 248 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 249 | rm -f "${base}"* |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 250 | } |
| 251 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 252 | # Start collecting data from the old and new revisions. |
| 253 | # This is relatively disruptive to the tree, so trap on ctl-c so that |
| 254 | # things can be put back to normal |
| 255 | trap version_ctrl_c SIGINT |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 256 | |
| 257 | #check out old version and get information |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 258 | echo "Finding old submodule versions..." >&2 |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 259 | git checkout "$OLD_GIT_VERSION" > /dev/null 2>&1 |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 260 | echo "Git version: $(git log --oneline -n 1)" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 261 | git submodule update --init --checkout > /dev/null 2>&1 |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 262 | for module in $(git submodule --quiet foreach pwd); do |
| 263 | name="$(basename "$module" | sed 's/-/_/g')" |
| 264 | version="${name^^}_OLD_VERSION" |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 265 | declare "$version"="$(get_latest_commit_id "$module")" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 266 | done |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 267 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 268 | printf "Logging directories in the old tree\n" >&2 |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 269 | mainboard_list_old=$(grep -h "^[[:space:]]*config\>[[:space:]]*\<BOARD_" src/mainboard/*/*/Kconfig.name 2>/dev/null | sed "s,^.*\<BOARD_\([A-Z0-9_]*\)\>.*$,\1," | sort) |
| 270 | cpu_list_old=$(find_areas "src/cpu" "Kconfig" "intel/common") |
| 271 | soc_list_old=$(find_areas "src/soc" "Makefile.inc" "intel/common\|amd/common\|romstage") |
| 272 | northbridge_list_old=$(find_areas "src/northbridge" "Kconfig" "") |
| 273 | sio_list_old=$(find_areas "src/superio" "Makefile.inc" "") |
| 274 | southbridge_list_old=$(find_areas "src/southbridge" "Kconfig" "") |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 275 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 276 | echo "Calculating old SLOC" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 277 | OLD_SLOC=$(get_sloc) |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 278 | |
| 279 | #check out new version and get information |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 280 | printf -- "\nFinding new submodule versions...\n" >&2 |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 281 | git checkout "$NEW_GIT_VERSION" > /dev/null 2>&1 |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 282 | echo "Git version: $(git log --oneline -n 1)" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 283 | git submodule update --init --checkout > /dev/null 2>&1 |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 284 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 285 | for module in $(git submodule --quiet foreach pwd); do |
| 286 | name="$(basename "$module" | sed 's/-/_/g')" |
| 287 | version="${name^^}_NEW_VERSION" |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 288 | declare "$version"="$(get_latest_commit_id "$module")" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 289 | done |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 290 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 291 | echo "Logging directories in the new tree." >&2 |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 292 | mainboard_list_new=$(grep -h "^[[:space:]]*config\>[[:space:]]*\<BOARD_" src/mainboard/*/*/Kconfig.name 2>/dev/null | sed "s,^.*\<BOARD_\([A-Z0-9_]*\)\>.*$,\1," | sort) |
| 293 | cpu_list_new=$(find_areas "src/cpu" "Kconfig" "intel/common") |
| 294 | soc_list_new=$(find_areas "src/soc" "Makefile.inc" "intel/common\|amd/common\|romstage") |
| 295 | northbridge_list_new=$(find_areas "src/northbridge" "Kconfig" "") |
| 296 | sio_list_new=$(find_areas "src/superio" "Makefile.inc" "") |
| 297 | southbridge_list_new=$(find_areas "src/southbridge" "Kconfig" "") |
| 298 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 299 | printf "Calculating new SLOC\n" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 300 | NEW_SLOC=$(get_sloc) |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 301 | |
| 302 | git checkout origin/master > /dev/null 2>&1 |
| 303 | git submodule update --init --checkout > /dev/null 2>&1 |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 304 | trap "" SIGINT |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 305 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 306 | # Done collecting data from the old and new versions |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 307 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 308 | # Start outputting to logfile |
| 309 | echo "Generating release notes from version ${OLD_GIT_VERSION} to ${NEW_GIT_VERSION}" |
| 310 | echo; echo "Main repo" |
| 311 | echo "Main repo" >> "$LOGFILE" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 312 | echo "------------------" >> "$LOGFILE" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 313 | log_versions "$(git log --pretty=%H \ |
| 314 | "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | tail -1)" \ |
| 315 | "$(git log --pretty=%H \ |
| 316 | "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | head -1 )" |
| 317 | echo "" >> "$LOGFILE" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 318 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 319 | ### SPECIFIC AREAS FOR RELEASE ### |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 320 | get_log_dedupe "Documentation" "Documentation README" |
| 321 | |
| 322 | get_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" |
| 323 | |
| 324 | get_log_dedupe "ACPI Changes" "" "ASL 2.0 syntax" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 325 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 326 | get_log_dedupe "Google Kahlee / AMD Gardenia" "src/mainboard/google/kahlee src/mainboard/amd/gardenia" "kahlee\|gardenia" |
| 327 | get_log_dedupe "AMD Stoney Ridge" "src/soc/amd/stoneyridge" "stoney" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 328 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 329 | get_log_dedupe "Google Zork / AMD Mandolin / AMD Bilby" "src/mainboard/amd/mandolin src/mainboard/google/zork src/mainboard/amd/bilby" "mandolin\|zork\|bilby" |
| 330 | get_log_dedupe "AMD Picasso" "src/soc/amd/picasso" "picasso" |
| 331 | |
| 332 | get_log_dedupe "Google Guybrush / AMD Majolica" "src/mainboard/google/guybrush src/mainboard/amd/majolica" "majolica\|guybrush" |
| 333 | get_log_dedupe "AMD cezanne" "src/soc/amd/cezanne" "cezanne" |
| 334 | |
| 335 | get_log_dedupe "AMD chausie / Google Skyrim" "src/mainboard/amd/chausie src/mainboard/google/skyrim" "chausie\|skyrim" |
| 336 | get_log_dedupe "AMD sabrina" "src/soc/amd/sabrina" "sabrina" |
| 337 | |
| 338 | get_log_dedupe "Google Brya / Intel adlrvp" "src/mainboard/intel/adlrvp src/mainboard/google/brya" "brya\|adlrvp" |
| 339 | get_log_dedupe "Intel Alder Lake" "src/soc/intel/alderlake" "alderlake\|adl\|alder lake" |
| 340 | |
| 341 | get_log_dedupe "intel Elkhart Lake" "src/soc/intel/elkhartlake" "elkhartlake\|ehl\|elkhart lake" |
| 342 | |
| 343 | get_log_dedupe "Google Dedede" "src/mainboard/google/dedede" "dedede" |
| 344 | get_log_dedupe "intel Jasper Lake" "src/soc/intel/jasperlake" "jasperlake\|jsl\|jasper lake" |
| 345 | |
| 346 | get_log_dedupe "Intel Tiger Lake" "src/soc/intel/tigerlake" "tigerlake\|tgl\|tiger lake" |
| 347 | |
| 348 | get_log_dedupe "Google Hatch" "src/mainboard/google/hatch" "hatch" |
| 349 | get_log_dedupe "Intel Comet Lake" "src/soc/intel/cometlake" "cometlake\|cml\|comet lake" |
| 350 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 351 | get_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 Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 352 | |
| 353 | 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" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 354 | get_log_dedupe "Purism SKL" "src/mainboard/purism/librem_skl" "librem13v2\|librem_skl" |
| 355 | get_log_dedupe "Intel Skylake / Kabylake" "src/soc/intel/skylake" "skylake\|sky.lake\|kabylake\|kaby.lake" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 356 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 357 | get_log_dedupe "Intel Glkrvp / Google Octopus / Bip / Yorp" "src/mainboard/google/octopus src/mainboard/intel/glkrvp" "octopus\|glkrvp|\bip\|yorp" |
| 358 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 359 | get_log_dedupe "Google Cyan / Intel Strago" "src/mainboard/google/cyan src/mainboard/intel/strago" "cyan\|strago" |
| 360 | get_log_dedupe "Intel Braswell" "src/soc/intel/braswell" "braswell" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 361 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 362 | get_log_dedupe "Google Kevin / Gru / Bob / Scarlet / Nefario" "src/mainboard/google/gru" "kevin\|gru[^b]" |
| 363 | get_log_dedupe "Rockchip rk3399" "src/soc/rockchip/rk3399" "rk3399" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 364 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 365 | get_log_dedupe "Google Reef / Pyro / Sand / Snappy / Nasher" "src/mainboard/google/reef" "reef\|pyro\|sand[ :]\|snappy\|nasher" |
| 366 | #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" |
| 367 | get_log_dedupe "Siemens mc_apl1" "src/mainboard/siemens/mc_apl1" "mc_apl1" |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 368 | get_log_dedupe "Intel Apollolake/ Geminilake" "src/soc/intel/apollolake" "apollolake\|apollo.lake\|geminilake\|gemini.lake\|apl\|glk" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 369 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 370 | get_log_dedupe "Google Zoombini / Intel cannonlake_rvp" "src/mainboard/google/zoombini src/mainboard/intel/cannonlake_rvp" "zoombini\|cannonlake_rvp" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 371 | get_log_dedupe "Intel CannonLake" "src/soc/intel/cannonlake src/mainboard/intel/cannonlake_rvp" "cannonlake" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 372 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 373 | get_log_dedupe "Google Kuki" "src/mainboard/google/kukui" "kukui" |
| 374 | get_log_dedupe "mediatek/mt8183" "src/soc/mediatek/mt8183" "mt8183" |
| 375 | |
| 376 | get_log_dedupe "Google Cheza" "src/mainboard/google/cheza" "cheza" |
| 377 | get_log_dedupe "Qualcomm sdm845" "src/soc/qualcomm/sdm845" "sdm845" |
| 378 | |
| 379 | get_log_dedupe "Prodrive Hermes / Google Sarien / Intel coffeelake_rvp" "src/mainboard/intel/coffeelake_rvp src/mainboard/google/sarien src/mainboard/prodrive/hermes" |
| 380 | get_log_dedupe "Intel Coffeelake" "soc/intel/coffeelake" |
| 381 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 382 | get_log_dedupe "Cavium" "src/soc/cavium src/mainboard/cavium src/mainboard/opencellular/elgon " |
| 383 | get_log_dedupe "Scaleway Tagada" "src/mainboard/scaleway/tagada" "tagada" |
| 384 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 385 | get_log_dedupe "Intel Galileo" "src/mainboard/intel/galileo" "galileo" |
| 386 | get_log_dedupe "Intel Quark" "src/soc/intel/quark" "quark" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 387 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 388 | get_log_dedupe "Intel Baytrail" "src/soc/intel/baytrail" "baytrail" |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 389 | get_log_dedupe "Google Gale / Qualcomm QX ipq40xx" "src/mainboard/google/gale src/soc/qualcomm/ipq40xx" "gale\|ipq40" |
| 390 | get_log_dedupe "Google Rotor / Marvell Mvmap2315" "src/soc/marvell/mvmap2315 src/mainboard/google/rotor" "marvell\|mvmap\|rotor" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 391 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 392 | get_log_dedupe "Gigabyte ga-g41m-es2l" "src/mainboard/gigabyte/ga-g41m-es2l" "es2l" |
| 393 | get_log_dedupe "Intel x4x northbridge / LGA775" "src/northbridge/intel/x4x src/cpu/intel/socket_LGA775" "x4x\|lga775" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 394 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 395 | get_log_dedupe "Intel Haswell / Broadwell" "src/northbridge/haswell" "haswell" |
| 396 | get_log_dedupe "Intel Lynxpoint" "src/southbridge/intel/lynxpoint" "lynxpoint" |
| 397 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 398 | get_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 Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 399 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 400 | get_log_dedupe "Google Herbrine" "src/mainboard/google/herobrine" "herobrine" |
| 401 | get_log_dedupe "Qualcomm SC7280" "src/soc/qualcomm/sc2780" "sc2780" |
| 402 | |
| 403 | get_log_dedupe "Google Corsola" "src/mainboard/google/corsola" "corsola" |
| 404 | get_log_dedupe "Mediatek MT8186" "src/soc/mediatek/mt8186" "mt8186" |
| 405 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 406 | get_log_dedupe "Intel Common" "src/soc/intel/common src/southbridge/intel/common src/northbridge/intel/common" "" |
| 407 | get_log_dedupe "Amd Common" "src/soc/amd/common src/southbridge/amd/common" "" |
| 408 | |
Patrick Georgi | 3b34ef2 | 2019-06-30 11:41:51 +0200 | [diff] [blame] | 409 | get_log_dedupe "Nvidia" "src/southbridge/nvidia" "" |
| 410 | get_log_dedupe "Via" "src/northbridge/via src/southbridge/via" "" |
| 411 | get_log_dedupe "Broadcom" "src/southbridge/broadcom" "" |
| 412 | get_log_dedupe "Qualcomm" "src/soc/qualcomm" "" |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 413 | get_log_dedupe "Mediatek" "src/soc/mediatek" "" |
Patrick Georgi | 3b34ef2 | 2019-06-30 11:41:51 +0200 | [diff] [blame] | 414 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 415 | get_log_dedupe "Intel vendorcode / FSP" "src/drivers/intel/fsp* src/vendorcode/intel" "" |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 416 | get_log_dedupe "AMD vendorcode / AGESA / PI" "src/vendorcode/amd" "agesa\|binarypi" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 417 | get_log_dedupe "Google vendorcode" "src/vendorcode/google" |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 418 | get_log_dedupe "Cavium vendorcode" "src/vendorcode/cavium" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 419 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 420 | get_log_dedupe "Security" "src/drivers/i2c/tpm src/security" "tpm" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 421 | get_log_dedupe "Vboot" "src/vboot" "vboot" |
| 422 | |
| 423 | |
| 424 | ### GENERAL AREAS FOR RELEASE ### |
| 425 | # shellcheck disable=SC2013 |
| 426 | { |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 427 | |
| 428 | get_log_dedupe "X86 intel" \ |
| 429 | "src/cpu/intel src/soc/intel src/northbridge/intel \ |
| 430 | src/southbridge/intel src/include/intel src/drivers/intel" |
| 431 | |
| 432 | get_log_dedupe "X86 AMD" \ |
| 433 | "src/cpu/amd src/northbridge/amd src/southbridge/amd src/include/amd src/soc/amd" \ |
| 434 | "agesa\|binarypi\|binary.pi" |
| 435 | |
| 436 | get_log_dedupe "X86 common" \ |
| 437 | "src/arch/x86 src/cpu/x86 src/include/x86 src/include/pc80" |
| 438 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 439 | get_log_dedupe "ARM" \ |
| 440 | "$(for codedir in $(grep -rl "_ARM" --include=Kconfig | \ |
| 441 | grep -v 'src/mainboard\|payloads/\|drivers/\|vendorcode/\|console' ); \ |
| 442 | do dirname "$codedir"; done | grep -v '^src$')" |
| 443 | |
| 444 | get_log_dedupe "RISC-V" \ |
| 445 | "$(for codedir in $(grep -rl "_RISCV" --include=Kconfig | grep -v 'payloads/\|drivers/\|vendorcode/\|console' ); do dirname "$codedir"; done | grep -v '^src$')" \ |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 446 | "riscv\|risc-v\|lowrisc\|sifive" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 447 | } |
| 448 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 449 | get_log_dedupe "Google Mainboards" "src/mainboard/google" |
| 450 | get_log_dedupe "Intel Mainboards" "src/mainboard/intel" |
| 451 | get_log_dedupe "AMD Mainboards" "src/mainboard/amd" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 452 | get_log_dedupe "Mainboards" "src/mainboard/" |
| 453 | |
| 454 | # Next, print all the rest of the specific areas |
| 455 | get_log_dedupe "ACPI" "src/acpi/" |
| 456 | get_log_dedupe "Console" "src/console src/include/console" |
| 457 | get_log_dedupe "SuperIO" "src/superio src/include/superio" |
| 458 | get_log_dedupe "EC" "src/ec" |
| 459 | get_log_dedupe "Drivers" "src/drivers" |
| 460 | get_log_dedupe "Devices" "src/device src/include/device" |
| 461 | |
| 462 | # 5th, print the generic areas - This goes late so that the specific |
| 463 | # area changes will catch any commits in these areas first. |
| 464 | get_log_dedupe "Toolchain" "util/crossgcc" |
| 465 | get_log_dedupe "cbfstool" "util/cbfstool" |
| 466 | get_log_dedupe "Lint tools" "util/lint" |
| 467 | get_log_dedupe "Lib" "src/lib" |
| 468 | get_log_dedupe "Commonlib" "src/commonlib" |
| 469 | get_log_dedupe "Include" "src/include" |
| 470 | get_log_dedupe "Utilities" "util" |
| 471 | get_log_dedupe "Payloads" "payloads" |
| 472 | get_log_dedupe "Vendorcode" "src/vendorcode" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 473 | |
| 474 | # Then look at areas that are usually outside the mainboards and architectures |
| 475 | get_log_dedupe "Build system" \ |
| 476 | "Makefile Makefile.inc toolchain.inc src/Kconfig src/cpu/Makefile.inc" |
| 477 | |
| 478 | get_log_dedupe "Submodules" "3rdparty util/nvidia/cbootimage" |
Patrick Georgi | 3b34ef2 | 2019-06-30 11:41:51 +0200 | [diff] [blame] | 479 | |
| 480 | get_log_dedupe "Maintainers" "MAINTAINERS" "" |
| 481 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 482 | # Finally, get anything that was missed above |
| 483 | get_log_dedupe "MISC" "." |
| 484 | |
Patrick Georgi | 1916d68 | 2019-11-20 16:05:21 +0100 | [diff] [blame] | 485 | # Replace VENDOR_DEVICE from stdin with their nice names on stdout |
| 486 | real_mainboard_names() { |
| 487 | local tree_version=$1 # "old" or "new" |
| 488 | local git_version_var=${tree_version^^}_GIT_VERSION |
| 489 | local git_version=${!git_version_var} |
| 490 | local line |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 491 | local file |
| 492 | local vendor |
Patrick Georgi | 1916d68 | 2019-11-20 16:05:21 +0100 | [diff] [blame] | 493 | |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 494 | while read -r line; do |
| 495 | file="$(git grep -l "^[[:space:]]*config\>[[:space:]]*\<BOARD_${line}\$" "${git_version}" -- src/mainboard/\*/\*/Kconfig.name | sed "s,^${git_version}:,,")" |
Patrick Georgi | 1916d68 | 2019-11-20 16:05:21 +0100 | [diff] [blame] | 496 | if [ -z "$file" ]; then |
| 497 | echo "This shouldn't happen: couldn't find Kconfig for $line" |
| 498 | exit 1 |
| 499 | fi |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 500 | vendor="$(git grep \" "${git_version}" -- "$(echo "${file}" | cut -d/ -f1-3,5)" | cut -d\" -f2)" |
| 501 | git grep -h -A1 "^[[:space:]]*config\>[[:space:]]*\<BOARD_${line}\$" "${git_version}" -- "${file}" | grep \" |cut -d\" -f2 |sed "s,^,${vendor} ," |
Patrick Georgi | 1916d68 | 2019-11-20 16:05:21 +0100 | [diff] [blame] | 502 | done |
| 503 | } |
| 504 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 505 | # Show areas that have been added or removed |
Patrick Georgi | 1916d68 | 2019-11-20 16:05:21 +0100 | [diff] [blame] | 506 | show_diff "mainboards" "$mainboard_list_old" "$mainboard_list_new" real_mainboard_names |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 507 | show_diff "processors" "$cpu_list_old" "$cpu_list_new" |
| 508 | show_diff "socs" "$soc_list_old" "$soc_list_new" |
| 509 | show_diff "northbridges" "$northbridge_list_old" "$northbridge_list_new" |
| 510 | show_diff "southbridges" "$southbridge_list_old" "$southbridge_list_new" |
| 511 | show_diff "sios" "$sio_list_old" "$sio_list_new" |
| 512 | |
| 513 | # Log submodules |
| 514 | printf "Submodules\n----------\n" >> "$LOGFILE" |
| 515 | for module in $(git submodule --quiet foreach pwd); do |
| 516 | name=$(basename "$module") |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 517 | module="$(realpath "${module}")" |
| 518 | workingdir="$(realpath "${PWD}")" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 519 | # shellcheck disable=SC2001 |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 520 | path=${module#"$workingdir"} |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 521 | old_version=$(echo "${name^^}_OLD_VERSION" | sed 's/-/_/g') |
| 522 | new_version=$(echo "${name^^}_NEW_VERSION" | sed 's/-/_/g') |
Martin Roth | eb80d8d | 2022-02-28 14:41:57 -0700 | [diff] [blame] | 523 | get_log_submodule "${!old_version}" "${!new_version}" "${path}" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 524 | done |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 525 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 526 | printf "\nrepo statistics\n-------------------\n" >> "$LOGFILE" |
| 527 | before_names="$(mktemp "OLDNAMES.XXXX")" |
| 528 | after_names="$(mktemp "NEWNAMES.XXXX")" |
| 529 | NEW_AUTHORS=$(git log --pretty=%an "${OLD_GIT_VERSION}" 2>/dev/null | sort | \ |
| 530 | uniq > "$before_names" && \ |
| 531 | git log --pretty=%an "${NEW_GIT_VERSION}" 2>/dev/null | \ |
| 532 | sort | uniq > "$after_names" && \ |
| 533 | grep -Fxv -c -f "$before_names" "$after_names") |
Patrick Georgi | d653e49 | 2019-11-20 16:49:41 +0100 | [diff] [blame] | 534 | NEW_AUTHOR_LIST=$( grep -Fxv -f "$before_names" "$after_names") |
| 535 | rm -f "$before_names" "$after_names" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 536 | { |
| 537 | printf -- "- Total commits: %s\n" "$TOTAL_COMMITS" |
| 538 | printf -- "- Total authors: %s\n" \ |
| 539 | "$(git log "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | \ |
| 540 | grep -e '^Author:' | sed 's/.*Author: //' | sed 's/ <.*.>//' | \ |
| 541 | sort | uniq | wc -l)" |
| 542 | printf -- "- New authors: %s\n\nNew Authors:\n%s\n" "$NEW_AUTHORS" \ |
| 543 | "$NEW_AUTHOR_LIST" |
| 544 | } >> "$LOGFILE" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 545 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 546 | printf "Getting developer list\n" |
| 547 | printf "\n%-40s: %5s\n" "Developer" "Commits" >> "$LOGFILE" |
| 548 | git log "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | grep '^Author: ' | \ |
| 549 | sed 's|Author: ||' | sed 's|\s<.*||' | sort | uniq | \ |
| 550 | while read -r line; do |
| 551 | printf "%-40s: %5s %5s\n" "$line" \ |
| 552 | "$(git log "${OLD_GIT_VERSION}" 2>/dev/null | \ |
| 553 | grep -c "^Author: ${line} <")" \ |
| 554 | "$(git log "${NEW_GIT_VERSION}" 2>/dev/null | \ |
| 555 | grep -c "^Author: ${line} <")" >> "$LOGFILE"; |
| 556 | done |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 557 | |
| 558 | printf "\nOld SLOC (%s)\n%s" "$NOW" "$OLD_SLOC" >> "$LOGFILE" |
| 559 | printf "\nNew SLOC (%s)\n%s" "$NOW" "$NEW_SLOC" >> "$LOGFILE" |
| 560 | |
| 561 | # Add the collected data to the top of the existing logfile for parsing |
| 562 | if [ -n "$UPDATE_MAIN_LOGFILE" ]; then |
| 563 | tmpfile="$(mktemp "LOGFILE.XXXX")" |
| 564 | grep -Fxv -f "$MAIN_LOGFILE" "$LOGFILE" > "$tmpfile" |
| 565 | printf "\n\n" >> "$tmpfile" |
| 566 | cat "$MAIN_LOGFILE" >> "$tmpfile" |
| 567 | mv "$tmpfile" "$MAIN_LOGFILE" |
| 568 | rm -f "$LOGFILE" |
| 569 | fi |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 570 | |
| 571 | printf "Done.\n" |