Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # This file is part of the coreboot project. |
| 4 | # |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 5 | # Copyright 2015-2016 Google Inc. |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 6 | # |
| 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 Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 16 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 17 | # 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 Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 24 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 25 | # set -x # uncomment for debug |
| 26 | |
| 27 | # Check for tools |
| 28 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 29 | if ! ( git --version && cloc --version ) > /dev/null 2>&1 |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 30 | then |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 31 | echo "ERROR: cloc or git is not installed. Exiting" |
| 32 | exit 1 |
| 33 | fi |
| 34 | |
Alex Thiessen | da384dd | 2018-01-13 16:31:28 +0000 | [diff] [blame] | 35 | if ! { cdup="$(git rev-parse --show-cdup 2>/dev/null)" && [ -z "${cdup}" ]; } |
| 36 | then |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 37 | echo "ERROR: This is not the top directory of a git repo. Exiting." |
| 38 | exit 1 |
| 39 | fi |
| 40 | |
| 41 | # Try to verify that the repo is clean before losing state. |
| 42 | if ! git diff-index --quiet --cached HEAD 2>/dev/null || \ |
| 43 | [ "$(git diff origin/master --shortstat 2>/dev/null | tail -n1)" != "" ]; then |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 44 | echo "ERROR: repo is not clean. Exiting." |
| 45 | exit 1 |
| 46 | fi |
| 47 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 48 | # Verify the command line arguments |
| 49 | if [ "$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 |
| 60 | else |
| 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) |
| 65 | fi |
| 66 | |
| 67 | TOP=$(pwd) |
| 68 | |
| 69 | if [ -n "$3" ]; then |
| 70 | MAIN_LOGFILE="${TOP}/$3" |
| 71 | else |
| 72 | MAIN_LOGFILE="${TOP}/relnotes.txt" |
| 73 | fi |
| 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 Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 78 | if [ -f "$MAIN_LOGFILE" ]; then |
| 79 | LOGFILE="$(mktemp "LOGFILE.XXXX")" |
| 80 | LOGFILE="${TOP}/$LOGFILE" |
| 81 | UPDATE_MAIN_LOGFILE=1 |
| 82 | else |
| 83 | LOGFILE="$MAIN_LOGFILE" |
| 84 | fi |
| 85 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 86 | get_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 Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 91 | log_versions() { |
| 92 | echo "Log of commit $1 to commit $2" |
| 93 | echo "Log of commit $1 to commit $2" >> "$LOGFILE" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 94 | echo "Total commits: ${TOTAL_COMMITS}" |
| 95 | echo "Total commits: ${TOTAL_COMMITS}" >> "$LOGFILE" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 96 | echo |
| 97 | } |
| 98 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 99 | # Get the first commit id in the current tree |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 100 | get_latest_commit_id() { |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 101 | ( |
| 102 | cd "$1" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 103 | git log 2>/dev/null | grep '^commit ' | head -1 | sed 's/commit //' |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 104 | ) |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 105 | } |
| 106 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 107 | # Main get log function |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 108 | _get_log() { |
| 109 | local oldver="$1" |
| 110 | local newver="$2" |
| 111 | local title="$3" |
| 112 | local paths="$4" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 113 | local keywords="$5" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 114 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 115 | # Leave ${paths} unquoted in the git commands |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 116 | # shellcheck disable=SC2086 |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 117 | { \ |
| 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 Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 129 | } |
| 130 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 131 | # Output to a new log, then compare to the first logfile, and only output |
| 132 | # non duplicated lines to the final file. |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 133 | get_log_dedupe() { |
| 134 | local title="$1" |
| 135 | local paths="$2" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 136 | local keywords="$3" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 137 | local log |
| 138 | local commits |
| 139 | |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 140 | dedupe_tmpfile="$(mktemp "LOGFILE.XXXX")" |
| 141 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 142 | log=$(_get_log "$OLD_GIT_VERSION" "$NEW_GIT_VERSION" \ |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 143 | "$title" "$paths" "$keywords") |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 144 | |
| 145 | echo "$log" > "$dedupe_tmpfile" |
| 146 | |
| 147 | log=$(grep -Fxv -f "$LOGFILE" "$dedupe_tmpfile") |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 148 | commits=$(echo "$log" | wc -l) |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 149 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 150 | #echo "$title: $paths $keywords" >> "$LOGFILE" |
| 151 | printf "%s\n%s\n\n" "##### $title ($commits commits) #####" \ |
| 152 | "$log" >> "$LOGFILE" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 153 | |
| 154 | rm "$dedupe_tmpfile" |
| 155 | } |
| 156 | |
| 157 | # get logs for the submodules |
| 158 | get_log_submodule() { |
| 159 | local old_version="$1" |
| 160 | local new_version="$2" |
| 161 | local submodule_dir="$3" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 162 | local log |
| 163 | local commits |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 164 | |
| 165 | printf "Submodule %s\n" "$submodule_dir" |
| 166 | printf "commit %s to commit %s\n\n" "$old_version" "$new_version" |
| 167 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 168 | ( |
| 169 | cd "${TOP}/$submodule_dir" |
| 170 | log="$(_get_log "$old_version" "$new_version" "$submodule_dir" "." "")" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 171 | commits=$(echo "$log" | wc -l) |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 172 | |
| 173 | if [ -n "$log" ]; then |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 174 | printf "%s\n" "$submodule_dir ($commits commits)" >> "$LOGFILE" |
| 175 | printf "\n" >> "$LOGFILE" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 176 | fi |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 177 | ) |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 178 | } |
| 179 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 180 | find_areas() { |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 181 | 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 Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 185 | } |
| 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 Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 190 | version_ctrl_c() { |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 191 | 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 Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 195 | 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 Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 201 | # Calculate areas that have been added or removed based on file lists |
| 202 | show_diff () { |
| 203 | local new |
| 204 | local old |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 205 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 206 | 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 Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 218 | get_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 Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 230 | # 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 |
| 233 | trap version_ctrl_c SIGINT |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 234 | |
| 235 | #check out old version and get information |
| 236 | printf -- "Finding old submodule versions...\n" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 237 | git checkout "$OLD_GIT_VERSION" > /dev/null 2>&1 |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 238 | git submodule update --init --checkout > /dev/null 2>&1 |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 239 | for 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") |
| 243 | done |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 244 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 245 | printf "Logging directories in the old tree\n" |
| 246 | mainboard_list_old=$(grep -h "^[[:space:]]*config\>[[:space:]]*\<BOARD_" src/mainboard/*/*/Kconfig.name 2>/dev/null | sed "s,^.*\<BOARD_\([A-Z0-9_]*\)\>.*$,\1," | sort) |
| 247 | cpu_list_old=$(find_areas "src/cpu" "Kconfig" "intel/common") |
| 248 | soc_list_old=$(find_areas "src/soc" "Makefile.inc" "intel/common\|amd/common\|romstage") |
| 249 | northbridge_list_old=$(find_areas "src/northbridge" "Kconfig" "") |
| 250 | sio_list_old=$(find_areas "src/superio" "Makefile.inc" "") |
| 251 | southbridge_list_old=$(find_areas "src/southbridge" "Kconfig" "") |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 252 | |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 253 | printf "Calculating old SLOC\n" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 254 | OLD_SLOC=$(get_sloc) |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 255 | |
| 256 | #check out new version and get information |
| 257 | printf -- "\nFinding new submodule versions...\n" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 258 | git checkout "$NEW_GIT_VERSION" > /dev/null 2>&1 |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 259 | git submodule update --init --checkout > /dev/null 2>&1 |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 260 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 261 | for 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") |
| 265 | done |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 266 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 267 | printf "Logging directories in the new tree\n" |
| 268 | mainboard_list_new=$(grep -h "^[[:space:]]*config\>[[:space:]]*\<BOARD_" src/mainboard/*/*/Kconfig.name 2>/dev/null | sed "s,^.*\<BOARD_\([A-Z0-9_]*\)\>.*$,\1," | sort) |
| 269 | cpu_list_new=$(find_areas "src/cpu" "Kconfig" "intel/common") |
| 270 | soc_list_new=$(find_areas "src/soc" "Makefile.inc" "intel/common\|amd/common\|romstage") |
| 271 | northbridge_list_new=$(find_areas "src/northbridge" "Kconfig" "") |
| 272 | sio_list_new=$(find_areas "src/superio" "Makefile.inc" "") |
| 273 | southbridge_list_new=$(find_areas "src/southbridge" "Kconfig" "") |
| 274 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 275 | printf "Calculating new SLOC\n" |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 276 | NEW_SLOC=$(get_sloc) |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 277 | |
| 278 | git checkout origin/master > /dev/null 2>&1 |
| 279 | git submodule update --init --checkout > /dev/null 2>&1 |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 280 | trap "" SIGINT |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 281 | # Done collecting data from the old and new versions |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 282 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 283 | # Start outputting to logfile |
| 284 | echo "Generating release notes from version ${OLD_GIT_VERSION} to ${NEW_GIT_VERSION}" |
| 285 | echo; echo "Main repo" |
| 286 | echo "Main repo" >> "$LOGFILE" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 287 | echo "------------------" >> "$LOGFILE" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 288 | log_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 )" |
| 292 | echo "" >> "$LOGFILE" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 293 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 294 | ### SPECIFIC AREAS FOR RELEASE ### |
| 295 | get_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 Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 296 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 297 | get_log_dedupe "Google Kahlee / AMD Gardenia" "src/mainboard/google/kahlee src/mainboard/amd/gardenia" "kahlee\|gardenia" |
| 298 | get_log_dedupe "AMD Stoney Ridge" "src/soc/amd/stoneyridge" "stoney" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 299 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 300 | 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" |
| 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" |
| 302 | get_log_dedupe "Purism SKL" "src/mainboard/purism/librem_skl" "librem13v2\|librem_skl" |
| 303 | 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] | 304 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 305 | get_log_dedupe "Google Cyan / Intel Strago" "src/mainboard/google/cyan src/mainboard/intel/strago" "cyan\|strago" |
| 306 | get_log_dedupe "Intel Braswell" "src/soc/intel/braswell" "braswell" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 307 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 308 | get_log_dedupe "Google Kevin / Gru / Bob / Scarlet / Nefario" "src/mainboard/google/gru" "kevin\|gru[^b]" |
| 309 | get_log_dedupe "Rockchip rk3399" "src/soc/rockchip/rk3399" "rk3399" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 310 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 311 | get_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" |
| 313 | get_log_dedupe "Siemens mc_apl1" "src/mainboard/siemens/mc_apl1" "mc_apl1" |
| 314 | get_log_dedupe "Intel Apollolake" "src/soc/intel/apollolake" "apollolake\|apollo.lake" |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 315 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 316 | get_log_dedupe "Google Zoombini / Intel cannonlake_rvp" "src/mainboard/google/zoombini src/mainboard/intel/cannonlake_rvp" "zoombini\|cannonlake_rvp" |
| 317 | 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] | 318 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 319 | get_log_dedupe "Intel Galileo" "src/mainboard/intel/galileo" "galileo" |
| 320 | get_log_dedupe "Intel Quark" "src/soc/intel/quark" "quark" |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 321 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 322 | get_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 Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 325 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 326 | get_log_dedupe "Gigabyte ga-g41m-es2l" "src/mainboard/gigabyte/ga-g41m-es2l" "es2l" |
| 327 | 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] | 328 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 329 | 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] | 330 | |
Martin Roth | 3ce6783 | 2017-11-04 18:36:19 -0600 | [diff] [blame] | 331 | get_log_dedupe "Intel Common" "src/soc/intel/common src/southbridge/intel/common src/northbridge/intel/common" "" |
| 332 | get_log_dedupe "Amd Common" "src/soc/amd/common src/southbridge/amd/common" "" |
| 333 | |
| 334 | get_log_dedupe "Intel vendorcode / FSP" "src/drivers/intel/fsp* src/vendorcode/intel" "" |
| 335 | get_log_dedupe "AMD vendorcode / AGESA / PI" "src/vendorcode/amd" "" |
| 336 | get_log_dedupe "Google vendorcode" "src/vendorcode/google" |
| 337 | |
| 338 | get_log_dedupe "TPM" "src/drivers/i2c/tpm" "tpm" |
| 339 | get_log_dedupe "Vboot" "src/vboot" "vboot" |
| 340 | |
| 341 | |
| 342 | ### GENERAL AREAS FOR RELEASE ### |
| 343 | # shellcheck disable=SC2013 |
| 344 | { |
| 345 | get_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 | |
| 350 | get_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 | |
| 354 | get_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 | |
| 360 | get_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 | |
| 364 | get_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 | |
| 368 | get_log_dedupe "X86 common" \ |
| 369 | "src/arch/x86 src/cpu/x86 src/include/x86 src/include/pc80" |
| 370 | |
| 371 | get_log_dedupe "Mainboards" "src/mainboard/" |
| 372 | |
| 373 | # Next, print all the rest of the specific areas |
| 374 | get_log_dedupe "ACPI" "src/acpi/" |
| 375 | get_log_dedupe "Console" "src/console src/include/console" |
| 376 | get_log_dedupe "SuperIO" "src/superio src/include/superio" |
| 377 | get_log_dedupe "EC" "src/ec" |
| 378 | get_log_dedupe "Drivers" "src/drivers" |
| 379 | get_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. |
| 383 | get_log_dedupe "Toolchain" "util/crossgcc" |
| 384 | get_log_dedupe "cbfstool" "util/cbfstool" |
| 385 | get_log_dedupe "Lint tools" "util/lint" |
| 386 | get_log_dedupe "Lib" "src/lib" |
| 387 | get_log_dedupe "Commonlib" "src/commonlib" |
| 388 | get_log_dedupe "Include" "src/include" |
| 389 | get_log_dedupe "Utilities" "util" |
| 390 | get_log_dedupe "Payloads" "payloads" |
| 391 | get_log_dedupe "Vendorcode" "src/vendorcode" |
| 392 | get_log_dedupe "Documentation" "Documentation README" |
| 393 | |
| 394 | # Then look at areas that are usually outside the mainboards and architectures |
| 395 | get_log_dedupe "Build system" \ |
| 396 | "Makefile Makefile.inc toolchain.inc src/Kconfig src/cpu/Makefile.inc" |
| 397 | |
| 398 | get_log_dedupe "Submodules" "3rdparty util/nvidia/cbootimage" |
| 399 | # Finally, get anything that was missed above |
| 400 | get_log_dedupe "MISC" "." |
| 401 | |
| 402 | # Show areas that have been added or removed |
| 403 | show_diff "mainboards" "$mainboard_list_old" "$mainboard_list_new" |
| 404 | show_diff "processors" "$cpu_list_old" "$cpu_list_new" |
| 405 | show_diff "socs" "$soc_list_old" "$soc_list_new" |
| 406 | show_diff "northbridges" "$northbridge_list_old" "$northbridge_list_new" |
| 407 | show_diff "southbridges" "$southbridge_list_old" "$southbridge_list_new" |
| 408 | show_diff "sios" "$sio_list_old" "$sio_list_new" |
| 409 | |
| 410 | # Log submodules |
| 411 | printf "Submodules\n----------\n" >> "$LOGFILE" |
| 412 | for 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" |
| 419 | done |
Martin Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 420 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 421 | printf "\nrepo statistics\n-------------------\n" >> "$LOGFILE" |
| 422 | before_names="$(mktemp "OLDNAMES.XXXX")" |
| 423 | after_names="$(mktemp "NEWNAMES.XXXX")" |
| 424 | NEW_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") |
| 429 | NEW_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 Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 440 | |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 441 | printf "Getting developer list\n" |
| 442 | printf "\n%-40s: %5s\n" "Developer" "Commits" >> "$LOGFILE" |
| 443 | git 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 Roth | bec1108 | 2015-11-03 21:01:53 -0700 | [diff] [blame] | 452 | |
| 453 | printf "\nOld SLOC (%s)\n%s" "$NOW" "$OLD_SLOC" >> "$LOGFILE" |
| 454 | printf "\nNew SLOC (%s)\n%s" "$NOW" "$NEW_SLOC" >> "$LOGFILE" |
| 455 | |
| 456 | # Add the collected data to the top of the existing logfile for parsing |
| 457 | if [ -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" |
| 464 | fi |
Martin Roth | fb190ed | 2016-10-01 20:13:43 -0600 | [diff] [blame] | 465 | |
| 466 | printf "Done.\n" |