util/release: Update genrelnotes.script to the latest version

Internal changes:
- Fix shellcheck issues.
- Add some help text and update section header text.
- Reorder sections to try to get better estimates of what the commits
were mainly touching.
- Start making the script slightly less coreboot-centric.
- Don't print git errors.

Changes in output:
- Find new and deleted CPUs, SOCs, northbridges, southbridges, and SIOs.
- Show new users.
- Show before and after commit count for all authors.

Change-Id: I9858436f9458b2859a91273a525901df34796df4
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/16848
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Martin Roth 2016-10-01 20:13:43 -06:00
parent 58afca4a1a
commit fb190ed764
1 changed files with 286 additions and 130 deletions

View File

@ -2,7 +2,7 @@
# #
# This file is part of the coreboot project. # This file is part of the coreboot project.
# #
# Copyright 2015 Google Inc. # Copyright 2015-2016 Google Inc.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -13,40 +13,74 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
#set -x # uncomment for debug
TOP=$(pwd) # This script creates a list of commits between two releases, broken out into
MAIN_LOGFILE="${TOP}/relnotes.txt" # fairly inexact categories, based on the directories that files are in. If
# a commit touched anything in the path that is checked earlier, it's counted
# as being in that category.
#
# Don't run this in your current working tree, it checks out different versions
# and can lose things.
#check for tools # set -x # uncomment for debug
( git --version && cloc --version ) > /dev/null 2>&1
if [ $? -ne 0 ]; then # Check for tools
if ! ( git --version cloc --version ) > /dev/null 2>&1
then
echo "ERROR: cloc or git is not installed. Exiting" echo "ERROR: cloc or git is not installed. Exiting"
exit 1 exit 1
fi fi
#verify that the repo is clean before losing state. if [ ! -e ".git" ];then
git diff-index --quiet --cached HEAD echo "ERROR: This is not the top directory of a git repo. Exiting."
if [ $? -ne 0 ] || [ "$(git diff --shortstat 2> /dev/null | tail -n1)" != "" ]; then exit 1
fi
# Try to verify that the repo is clean before losing state.
if ! git diff-index --quiet --cached HEAD 2>/dev/null || \
[ "$(git diff origin/master --shortstat 2>/dev/null | tail -n1)" != "" ]; then
echo "ERROR: repo is not clean. Exiting." echo "ERROR: repo is not clean. Exiting."
exit 1 exit 1
fi fi
#verify command line arguments if grep -q 'review.coreboot.org' .git/config; then
if [ -z "$1" ] || [ -z "$2" ]; then COREBOOT=1
echo
echo "Usage: $0 <old_version> <new_version>"
echo "Old version should be a tag (4.1), a branch (origin/4.1), or a commit id"
echo "New version can be 'HEAD' a branch (origin/master) a tag (4.2), or a commit id"
echo "Example: \"$0 origin/4.1 4.2\""
echo
exit 1
else else
OLD_COREBOOT_VERSION="$1" echo "This doesn't look like a coreboot repo. Disabling coreboot specifics"
NEW_COREBOOT_VERSION="$2" COREBOOT=0
fi fi
#Figure out which logfile we're writing to. # Verify the command line arguments
if [ "$1" == "--help" ] || [ -z "$1" ] || [ -z "$2" ]; then
echo
echo "Usage: $0 <old_version> <new_version> [release notes file]"
echo "Old version should be a tag (4.1), a branch (origin/4.1), or a commit id"
echo "New version can be 'HEAD' a branch (origin/master) a tag (4.2), or a commit id"
echo "Logfile can be a new file or an existing file to update"
echo "Example: \"$0 origin/4.1 4.2 rnotes.txt\""
echo
echo "Note that the script starts at the commit AFTER the old version."
echo
exit 1
else
OLD_GIT_VERSION="$1"
NEW_GIT_VERSION="$2"
TOTAL_COMMITS=$(git log --pretty=oneline \
"${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | wc -l)
fi
TOP=$(pwd)
if [ -n "$3" ]; then
MAIN_LOGFILE="${TOP}/$3"
else
MAIN_LOGFILE="${TOP}/relnotes.txt"
fi
# Figure out which logfile we're writing to. If the specified logfile exists,
# we need to write to a temporary logfile, then append changes to the main
# logfile.
if [ -f "$MAIN_LOGFILE" ]; then if [ -f "$MAIN_LOGFILE" ]; then
LOGFILE="$(mktemp "LOGFILE.XXXX")" LOGFILE="$(mktemp "LOGFILE.XXXX")"
LOGFILE="${TOP}/$LOGFILE" LOGFILE="${TOP}/$LOGFILE"
@ -55,51 +89,64 @@ else
LOGFILE="$MAIN_LOGFILE" LOGFILE="$MAIN_LOGFILE"
fi fi
#print and log the versions
get_author_commit_count() {
git log "${NEW_GIT_VERSION}" 2>/dev/null | grep -c "^Author: $1"
}
# Print and log the versions
log_versions() { log_versions() {
echo "Log of commit $1 to commit $2" echo "Log of commit $1 to commit $2"
echo "Log of commit $1 to commit $2" >> "$LOGFILE" echo "Log of commit $1 to commit $2" >> "$LOGFILE"
echo "Total commits: $(git log "${1}..${2}" | grep -c '^commit ' )" echo "Total commits: ${TOTAL_COMMITS}"
echo "Total commits: $(git log "${1}..${2}" | grep -c '^commit ' )" >> "$LOGFILE" echo "Total commits: ${TOTAL_COMMITS}" >> "$LOGFILE"
echo echo
} }
#get the first commit id in the current tree # Get the first commit id in the current tree
get_latest_commit_id() { get_latest_commit_id() {
pushd "$1" > /dev/null pushd "$1" > /dev/null
git log | grep '^commit ' | head -1 | sed 's/commit //' git log 2>/dev/null | grep '^commit ' | head -1 | sed 's/commit //'
popd > /dev/null popd > /dev/null
} }
#main get log function # Main get log function
_get_log() { _get_log() {
local oldver="$1" local oldver="$1"
local newver="$2" local newver="$2"
local title="$3" local title="$3"
local paths="$4" local paths="$4"
#Leave ${paths} unquoted # Leave ${paths} unquoted
git log --abbrev-commit --pretty=oneline "${oldver}..${newver}" -- ${paths} | \ # shellcheck disable=SC2086
git log --abbrev-commit --pretty=oneline \
"${oldver}..${newver}" -- ${paths} 2>/dev/null | \
sort -t ' ' -k 2 | \ sort -t ' ' -k 2 | \
uniq uniq
} }
#output to a new log, then compare to the first logfile, and only output # Output to a new log, then compare to the first logfile, and only output
#non duplicated lines to the final file. # non duplicated lines to the final file.
get_log_dedupe() { get_log_dedupe() {
local title="$1" local title="$1"
local paths="$2" local paths="$2"
local log
local commits
dedupe_tmpfile="$(mktemp "LOGFILE.XXXX")" dedupe_tmpfile="$(mktemp "LOGFILE.XXXX")"
local log=$(_get_log "$OLD_COREBOOT_VERSION" "$NEW_COREBOOT_VERSION" "$title" "$paths") log=$(_get_log "$OLD_GIT_VERSION" "$NEW_GIT_VERSION" \
"$title" "$paths")
echo "$log" > "$dedupe_tmpfile" echo "$log" > "$dedupe_tmpfile"
log=$(grep -Fxv -f "$LOGFILE" "$dedupe_tmpfile") log=$(grep -Fxv -f "$LOGFILE" "$dedupe_tmpfile")
local commits=$(echo "$log" | wc -l) commits=$(echo "$log" | wc -l)
if [ -n "$log" ]; then if [ -n "$log" ]; then
printf "%s\n%s\n\n" "$title ($commits commits)" "$log" >> "$LOGFILE" printf "%s\n%s\n\n" "$title ($commits commits)" \
"$log" >> "$LOGFILE"
fi fi
rm "$dedupe_tmpfile" rm "$dedupe_tmpfile"
@ -110,27 +157,35 @@ get_log_submodule() {
local old_version="$1" local old_version="$1"
local new_version="$2" local new_version="$2"
local submodule_dir="$3" local submodule_dir="$3"
local log
local commits
printf "Submodule %s\n" "$submodule_dir" printf "Submodule %s\n" "$submodule_dir"
printf "commit %s to commit %s\n\n" "$old_version" "$new_version" printf "commit %s to commit %s\n\n" "$old_version" "$new_version"
pushd "${TOP}/$submodule_dir" > /dev/null pushd "${TOP}/$submodule_dir" > /dev/null
local log=$(_get_log "$old_version" "$new_version" "$submodule_dir" ".") log=$(_get_log "$old_version" "$new_version" "$submodule_dir" ".")
local commits=$(echo "$log" | wc -l) commits=$(echo "$log" | wc -l)
if [ -n "$log" ]; then if [ -n "$log" ]; then
printf "%s\n%s\n\n" "$submodule_dir ($commits commits)" "$log" >> "$LOGFILE" printf "%s\n%s\n\n" "$submodule_dir ($commits commits)" \
"$log" >> "$LOGFILE"
fi fi
popd > /dev/null popd > /dev/null
} }
#make sure things get cleaned up if ctl-c is pressed while the old version find_areas() {
#is checked out and files are renamed. This can be a real mess to clean find "$1" -name "$2" | sed "s|$1/||" | sed "s|/$2||" | sort
#up manually. }
# Make sure things get cleaned up if ctl-c is pressed while the old version
# is checked out and files are renamed. This can be a real mess to clean
# up manually.
version_ctrl_c() { version_ctrl_c() {
printf "\n** Trapped CTRL-C\n Cleaning up and exiting." printf "\n** Trapped CTRL-C\n Cleaning up and exiting.\n"
find 'src' -name 'gnumakefile' -exec rename 's/gnumakefile/Makefile\.inc/' {} \; find 'src' -name 'gnumakefile' \
-exec rename 's/gnumakefile/Makefile\.inc/' {} \;
git checkout origin/master > /dev/null 2>&1 git checkout origin/master > /dev/null 2>&1
git submodule update --init --checkout > /dev/null 2>&1 git submodule update --init --checkout > /dev/null 2>&1
rm -f "$mainboard_list_old" "$mainboard_list_new" rm -f "$mainboard_list_old" "$mainboard_list_new"
@ -138,117 +193,216 @@ version_ctrl_c() {
exit 1; exit 1;
} }
trap version_ctrl_c SIGINT # Calculate areas that have been added or removed based on file lists
show_diff () {
local new
local old
mainboard_list_new="$(mktemp "LOGFILE.XXXX")" new="$(comm -13 <(echo "$2") <(echo "$3"))"
mainboard_list_old="$(mktemp "LOGFILE.XXXX")" if [ -n "$new" ]; then
printf "Added %s $1:\n-------------------\n%s\n\n" \
"$(echo "$new" | wc -l)" "$new" >> "$LOGFILE"
fi
old="$(comm -23 <(echo "$2") <(echo "$3"))"
if [ -n "$old" ]; then
printf "Removed %s $1:\n-------------------\n%s\n\n" \
"$(echo "$old" | wc -l)" "$old" >> "$LOGFILE"
fi
}
# Start collecting data from the old and new revisions.
# This is relatively disruptive to the tree, so trap on ctl-c so that
# things can be put back to normal
trap version_ctrl_c SIGINT
#check out old version and get information #check out old version and get information
printf -- "Finding old submodule versions...\n" printf -- "Finding old submodule versions...\n"
git checkout "$OLD_COREBOOT_VERSION" > /dev/null 2>&1 git checkout "$OLD_GIT_VERSION" > /dev/null 2>&1
git submodule update --init --checkout > /dev/null 2>&1 git submodule update --init --checkout > /dev/null 2>&1
BLOBS_OLD_VERSION=$(get_latest_commit_id "${TOP}/3rdparty/blobs") if [ "$COREBOOT" -eq "1" ]; then
VBOOT_OLD_VERSION=$(get_latest_commit_id "${TOP}/3rdparty/vboot") BLOBS_OLD_VERSION=$(get_latest_commit_id "${TOP}/3rdparty/blobs")
ARM_OLD_VERSION=$(get_latest_commit_id "${TOP}/3rdparty/arm-trusted-firmware") VBOOT_OLD_VERSION=$(get_latest_commit_id "${TOP}/3rdparty/vboot")
NVIDIA_OLD_VERSION=$(get_latest_commit_id "${TOP}/util/nvidia/cbootimage") ARM_OLD_VERSION=$(get_latest_commit_id "${TOP}/3rdparty/arm-trusted-firmware")
find 'src/mainboard' -name 'Kconfig.name' | sed 's|/Kconfig.name||' | sed 's|src/mainboard/|- |' | grep '/' | sort > "$mainboard_list_old" CHROME_EC_OLD_VERSION=$(get_latest_commit_id "${TOP}/3rdparty/chromeec/")
#because cloc works on extensions, and .inc identifies as pascal, rename Makefile.inc, then remap the other .inc files to c NVIDIA_OLD_VERSION=$(get_latest_commit_id "${TOP}/util/nvidia/cbootimage")
printf "Logging directories in the old tree\n"
mainboard_list_old=$(find_areas "src/mainboard" 'Kconfig.name' | grep '/')
cpu_list_old=$(find_areas "src/cpu" "Kconfig")
soc_list_old=$(find_areas "src/soc" "Kconfig")
northbridge_list_old=$(find_areas "src/northbridge" "Kconfig")
sio_list_old=$(find_areas "src/superio" "Makefile.inc")
southbridge_list_old=$(find_areas "src/southbridge" "Kconfig")
# Because cloc works on extensions, and .inc identifies as pascal,
# rename Makefile.inc, then remap the other .inc files to c
find 'src' -name 'Makefile.inc' -exec rename 's/Makefile\.inc/gnumakefile/' {} \;
fi
printf "Calculating old SLOC\n" printf "Calculating old SLOC\n"
find 'src' -name 'Makefile.inc' -exec rename 's/Makefile\.inc/gnumakefile/' {} \; OLD_SLOC=$(cloc --progress-rate=0 --quiet --script-lang="Bourne Shell",bash \
OLD_SLOC=$(cloc --progress-rate=0 --quiet --script-lang="Bourne Shell",bash --force-lang=c,inc --exclude-dir=vendorcode src) --force-lang=c,inc --exclude-dir=vendorcode src)
find 'src' -name 'gnumakefile' -exec rename 's/gnumakefile/Makefile\.inc/' {} \; if [ "$COREBOOT" -eq "1" ]; then
find 'src' -name 'gnumakefile' -exec rename 's/gnumakefile/Makefile\.inc/' {} \;
fi
#check out new version and get information #check out new version and get information
printf -- "\nFinding new submodule versions...\n" printf -- "\nFinding new submodule versions...\n"
git checkout "$NEW_COREBOOT_VERSION" > /dev/null 2>&1 git checkout "$NEW_GIT_VERSION" > /dev/null 2>&1
git submodule update --init --checkout > /dev/null 2>&1 git submodule update --init --checkout > /dev/null 2>&1
BLOBS_NEW_VERSION=$(get_latest_commit_id "${TOP}/3rdparty/blobs") if [ "$COREBOOT" -eq "1" ]; then
VBOOT_NEW_VERSION=$(get_latest_commit_id "${TOP}/3rdparty/vboot") BLOBS_NEW_VERSION=$(get_latest_commit_id "${TOP}/3rdparty/blobs")
ARM_NEW_VERSION=$(get_latest_commit_id "${TOP}/3rdparty/arm-trusted-firmware") VBOOT_NEW_VERSION=$(get_latest_commit_id "${TOP}/3rdparty/vboot")
NVIDIA_NEW_VERSION=$(get_latest_commit_id "${TOP}/util/nvidia/cbootimage") ARM_NEW_VERSION=$(get_latest_commit_id "${TOP}/3rdparty/arm-trusted-firmware")
find 'src/mainboard' -name 'Kconfig.name' | sed 's|/Kconfig.name||' | sed 's|src/mainboard/|- |' | grep '/' | sort > "$mainboard_list_new" CHROME_EC_NEW_VERSION=$(get_latest_commit_id "${TOP}/3rdparty/chromeec/")
printf "Calculating new SLOC\n" NVIDIA_NEW_VERSION=$(get_latest_commit_id "${TOP}/util/nvidia/cbootimage")
find 'src' -name 'Makefile.inc' -exec rename 's/Makefile\.inc/gnumakefile/' {} \;
NEW_SLOC=$(cloc --progress-rate=0 --quiet --script-lang="Bourne Shell",bash --force-lang=c,inc --exclude-dir=vendorcode src)
find 'src' -name 'gnumakefile' -exec rename 's/gnumakefile/Makefile\.inc/' {} \;
new_mainboards=$(grep -Fxv -f "$mainboard_list_old" "$mainboard_list_new") printf "Logging directories in the new tree\n"
removed_mainboards=$(grep -Fxv -f "$mainboard_list_new" "$mainboard_list_old") mainboard_list_new=$(find_areas "src/mainboard" 'Kconfig.name' | grep '/')
cpu_list_new=$(find_areas "src/cpu" "Kconfig")
soc_list_new=$(find_areas "src/soc" "Kconfig")
northbridge_list_new=$(find_areas "src/northbridge" "Kconfig")
sio_list_new=$(find_areas "src/superio" "Makefile.inc")
southbridge_list_new=$(find_areas "src/southbridge" "Kconfig")
find 'src' -name 'Makefile.inc' -exec rename 's/Makefile\.inc/gnumakefile/' {} \;
fi
printf "Calculating new SLOC\n"
NEW_SLOC=$(cloc --progress-rate=0 --quiet --script-lang="Bourne Shell",bash \
--force-lang=c,inc --exclude-dir=vendorcode src)
if [ "$COREBOOT" -eq "1" ]; then
find 'src' -name 'gnumakefile' -exec rename 's/gnumakefile/Makefile\.inc/' {} \;
fi
git checkout origin/master > /dev/null 2>&1 git checkout origin/master > /dev/null 2>&1
git submodule update --init --checkout > /dev/null 2>&1 git submodule update --init --checkout > /dev/null 2>&1
rm -f "$mainboard_list_old" "$mainboard_list_new"
trap "" SIGINT trap "" SIGINT
# Done collecting data from the old and new versions
#start outputting to logfile # Start outputting to logfile
echo "Generating release notes from version ${OLD_COREBOOT_VERSION} to ${NEW_COREBOOT_VERSION}" echo "Generating release notes from version ${OLD_GIT_VERSION} to ${NEW_GIT_VERSION}"
echo; echo "Main coreboot repo" echo; echo "Main repo"
echo "Main coreboot repo" >> "$LOGFILE" echo "Main repo" >> "$LOGFILE"
echo "------------------" >> "$LOGFILE" echo "------------------" >> "$LOGFILE"
log_versions "$(git log --pretty=%H "${OLD_COREBOOT_VERSION}..${NEW_COREBOOT_VERSION}" | tail -1)" "$(git log --pretty=%H "${OLD_COREBOOT_VERSION}..${NEW_COREBOOT_VERSION}" | head -1 )" log_versions "$(git log --pretty=%H \
"${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | tail -1)" \
"$(git log --pretty=%H \
"${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | head -1 )"
echo "" >> "$LOGFILE"
NOW=$(date -u) if [ "$COREBOOT" -eq "1" ]; then
( echo "$NOW"; echo ) >> "$LOGFILE"
#first get things that are generally outside the mainboards and architectures # 1st, Show mainboards so that changes that are mainboard specific don't get
get_log_dedupe "Build system" "Makefile Makefile.inc toolchain.inc src/Kconfig src/cpu/Makefile.inc" # grabbed by changes in the architectures
get_log_dedupe "Utilities" "util/" get_log_dedupe "Mainboards" "src/mainboard/"
get_log_dedupe "Documentation" "Documentation/ README"
get_log_dedupe "Payloads" "payloads/"
get_log_dedupe "Vendorcode" "src/vendorcode/"
# get mainboards 2nd so that changes that are mainboard specific don't get # Show architectures 2nd - separate the various pieces out
# grabbed by the architectures # This works by getting a list of directories that have Kconfigs containing _ARCH
get_log_dedupe "Mainboards" "src/mainboard/" # then filtering out generic areas. X86 has too many non-compliant directories
# for that to work well, so just supply a list
# shellcheck disable=SC2013
{
get_log_dedupe "ARM" \
"$(for codedir in $(grep -rl "_ARM" --include=Kconfig | \
grep -v 'src/mainboard\|payloads/\|drivers/\|vendorcode/\|console' ); \
do dirname "$codedir"; done | grep -v '^src$')"
#Get architectures 3rd so separate the various pieces out get_log_dedupe "RISC-V" \
get_log_dedupe "ARM" "$(for codedir in $(grep -rl "_ARM" --include=Kconfig | grep -v 'src/mainboard\|payloads/\|drivers/\|vendorcode/\|console' ) ; do dirname "$codedir"; done | grep -v '^src$')" "$(for codedir in $(grep -rl "_RISCV" --include=Kconfig | \
get_log_dedupe "RISC-V" "$(for codedir in $(grep -rl "_RISCV" --include=Kconfig | grep -v 'src/mainboard\|payloads/\|drivers/\|vendorcode/\|console' ) ; do dirname "$codedir"; done | grep -v '^src$')" grep -v 'src/mainboard\|payloads/\|drivers/\|vendorcode/\|console' ); \
get_log_dedupe "X86" "src/arch/x86 src/cpu/x86 src/cpu/intel src/soc/intel src/cpu/amd src/northbridge/intel src/northbridge/amd src/southbridge/intel src/southbridge/amd src/drivers/intel/fsp1_0 src/drivers/intel/fsp1_1 src/include/amd src/include/intel src/include/x86 src/include/pc80" do dirname "$codedir"; done | grep -v '^src$')"
get_log_dedupe "MIPS" "$(for codedir in $(grep -rl "_MIPS" --include=Kconfig | grep -v 'src/mainboard\|payloads/\|drivers/\|vendorcode/\|console' ) ; do dirname "$codedir"; done | grep -v '^src$')"
#4th, get all the rest of the specific areas get_log_dedupe "X86" \
get_log_dedupe "ACPI" "src/acpi/" "src/arch/x86 src/cpu/x86 src/cpu/intel src/soc/intel src/cpu/amd \
get_log_dedupe "Console" "src/console/ src/include/console" src/northbridge/intel src/northbridge/amd src/southbridge/intel \
get_log_dedupe "SuperIO" "src/superio/ src/include/superio" src/southbridge/amd src/drivers/intel/fsp1_0 src/drivers/intel/fsp1_1 \
get_log_dedupe "EC " "src/ec" src/include/amd src/include/intel src/include/x86 src/include/pc80"
get_log_dedupe "Drivers" "src/drivers/"
get_log_dedupe "Devices" "src/device/ src/include/device"
get_log_dedupe "Lib" "src/lib/"
get_log_dedupe "Commonlib" "src/commonlib/"
get_log_dedupe "Include" "src/include/"
#Last, get anything that was missed above get_log_dedupe "MIPS" \
get_log_dedupe "MISC" "." "$(for codedir in $(grep -rl "_MIPS" --include=Kconfig | \
grep -v 'src/mainboard\|payloads/\|drivers/\|vendorcode/\|console' ); \
do dirname "$codedir"; done | grep -v '^src$')"
}
# Next, print all the rest of the specific areas
get_log_dedupe "ACPI" "src/acpi/"
get_log_dedupe "Console" "src/console/ src/include/console"
get_log_dedupe "SuperIO" "src/superio/ src/include/superio"
get_log_dedupe "EC " "src/ec"
get_log_dedupe "Drivers" "src/drivers/"
get_log_dedupe "Devices" "src/device/ src/include/device"
if [ -n "$new_mainboards" ]; then # 5th, print the generic areas - This goes late so that the specific
printf "Added %s mainboards:\n-------------------\n%s\n\n" "$(echo "$new_mainboards" | wc -l)" "$new_mainboards" >> "$LOGFILE" # area changes will catch any commits in these areas first.
get_log_dedupe "Lib" "src/lib/"
get_log_dedupe "Commonlib" "src/commonlib/"
get_log_dedupe "Include" "src/include/"
get_log_dedupe "Utilities" "util/"
get_log_dedupe "Payloads" "payloads/"
get_log_dedupe "Vendorcode" "src/vendorcode/"
get_log_dedupe "Documentation" "Documentation/ README"
# Then look at areas that are usually outside the mainboards and architectures
get_log_dedupe "Build system" \
"Makefile Makefile.inc toolchain.inc src/Kconfig src/cpu/Makefile.inc"
# Finally, get anything that was missed above
get_log_dedupe "MISC" "."
# Show areas that have been added or removed
show_diff "mainboards" "$mainboard_list_old" "$mainboard_list_new"
show_diff "processors" "$cpu_list_old" "$cpu_list_new"
show_diff "socs" "$soc_list_old" "$soc_list_new"
show_diff "northbridges" "$northbridge_list_old" "$northbridge_list_new"
show_diff "southbridges" "$southbridge_list_old" "$southbridge_list_new"
show_diff "sios" "$sio_list_old" "$sio_list_new"
# Log submodules
printf "Submodules\n----------\n" >> "$LOGFILE"
get_log_submodule "$BLOBS_OLD_VERSION" "$BLOBS_NEW_VERSION" \
"3rdparty/blobs"
get_log_submodule "$ARM_OLD_VERSION" "$ARM_NEW_VERSION" \
"3rdparty/arm-trusted-firmware"
get_log_submodule "$VBOOT_OLD_VERSION" "$VBOOT_NEW_VERSION" \
"3rdparty/vboot"
get_log_submodule "$CHROME_EC_OLD_VERSION" "$CHROME_EC_NEW_VERSION" \
"3rdparty/chromeec/"
get_log_submodule "$NVIDIA_OLD_VERSION" "$NVIDIA_NEW_VERSION" \
"util/nvidia/cbootimage"
else
get_log_dedupe "Commits" "."
fi fi
if [ -n "$removed_mainboards" ]; then printf "\nrepo statistics\n-------------------\n" >> "$LOGFILE"
printf "Removed %s mainboards:\n---------------------\n%s\n\n" "$(echo "$removed_mainboards" | wc -l)" "$removed_mainboards" >> "$LOGFILE" before_names="$(mktemp "OLDNAMES.XXXX")"
fi after_names="$(mktemp "NEWNAMES.XXXX")"
NEW_AUTHORS=$(git log --pretty=%an "${OLD_GIT_VERSION}" 2>/dev/null | sort | \
uniq > "$before_names" && \
git log --pretty=%an "${NEW_GIT_VERSION}" 2>/dev/null | \
sort | uniq > "$after_names" && \
grep -Fxv -c -f "$before_names" "$after_names")
NEW_AUTHOR_LIST=$( grep -Fxv -f "$before_names" "$after_names" && \
rm "$before_names" "$after_names")
{
printf -- "- Total commits: %s\n" "$TOTAL_COMMITS"
printf -- "- Total authors: %s\n" \
"$(git log "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | \
grep -e '^Author:' | sed 's/.*Author: //' | sed 's/ <.*.>//' | \
sort | uniq | wc -l)"
printf -- "- New authors: %s\n\nNew Authors:\n%s\n" "$NEW_AUTHORS" \
"$NEW_AUTHOR_LIST"
} >> "$LOGFILE"
# log submodules printf "Getting developer list\n"
printf "Submodules\n----------\n" >> "$LOGFILE" printf "\n%-40s: %5s\n" "Developer" "Commits" >> "$LOGFILE"
get_log_submodule "$BLOBS_OLD_VERSION" "$BLOBS_NEW_VERSION" "3rdparty/blobs" git log "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | grep '^Author: ' | \
get_log_submodule "$ARM_OLD_VERSION" "$ARM_NEW_VERSION" "3rdparty/arm-trusted-firmware" sed 's|Author: ||' | sed 's|\s<.*||' | sort | uniq | \
get_log_submodule "$VBOOT_OLD_VERSION" "$VBOOT_NEW_VERSION" "3rdparty/vboot" while read -r line; do
get_log_submodule "$NVIDIA_OLD_VERSION" "$NVIDIA_NEW_VERSION" "util/nvidia/cbootimage" printf "%-40s: %5s %5s\n" "$line" \
"$(git log "${OLD_GIT_VERSION}" 2>/dev/null | \
printf "\ncoreboot statistics\n-------------------\n" >> "$LOGFILE" grep -c "^Author: ${line} <")" \
NEW_AUTHORS=$(git log --pretty=%an "${OLD_COREBOOT_VERSION}" | sort | uniq > before_names.txt && git log --pretty=%an | sort | uniq > after_names.txt && grep -Fxv -c -f before_names.txt after_names.txt && rm before_names.txt after_names.txt) "$(git log "${NEW_GIT_VERSION}" 2>/dev/null | \
TOTAL_COMMITS=$(git log --pretty=oneline "${1}..${2}" | wc -l) grep -c "^Author: ${line} <")" >> "$LOGFILE";
printf -- "- Total commits: %s\n" "$TOTAL_COMMITS" >> "$LOGFILE" done
#TODO: Fix days between releases - between two branches or tags works well, between individual patches works poorly, as we get the creation date of the patch, not the merge date.
#DAYS_BETWEEN_RELEASES=$(( ( $(date -ud "$(git show "$NEW_COREBOOT_VERSION" | grep -m 1 '^Date: ' | sed 's/Date:[[:space:]]*//' | sed 's/[+-].*//g')" +'%s') - $(date -ud "$(git show "$OLD_COREBOOT_VERSION" | grep -m 1 '^Date: ' | sed 's/Date:[[:space:]]*//' | sed 's/[+-].*//g')" +'%s') ) /60/60/24 ))
#AVERAGE_COMMITS=$((TOTAL_COMMITS / DAYS_BETWEEN_RELEASES))
#printf "- Average daily commits: %s\n" "$AVERAGE_COMMITS"
printf -- "- New authors: %s\n" "$NEW_AUTHORS" >> "$LOGFILE"
printf -- "- Total authors: %s\n" "$(git log "${OLD_COREBOOT_VERSION}..${NEW_COREBOOT_VERSION}" | grep -e '^Author:' | sed 's/.*Author: //' | sed 's/ <.*.>//' | sort | uniq | wc -l)" >> "$LOGFILE"
printf -- "- Reviewers on submitted patches: %s\n" "$(git log "${OLD_COREBOOT_VERSION}..${NEW_COREBOOT_VERSION}" | grep -e '^ *Reviewed-by: ' | sed 's/.*Reviewed-by: //' | sed 's/ <.*.>//' | sort | uniq | wc -l)" >> "$LOGFILE"
printf "\nOld SLOC (%s)\n%s" "$NOW" "$OLD_SLOC" >> "$LOGFILE" printf "\nOld SLOC (%s)\n%s" "$NOW" "$OLD_SLOC" >> "$LOGFILE"
printf "\nNew SLOC (%s)\n%s" "$NOW" "$NEW_SLOC" >> "$LOGFILE" printf "\nNew SLOC (%s)\n%s" "$NOW" "$NEW_SLOC" >> "$LOGFILE"
@ -262,3 +416,5 @@ if [ -n "$UPDATE_MAIN_LOGFILE" ]; then
mv "$tmpfile" "$MAIN_LOGFILE" mv "$tmpfile" "$MAIN_LOGFILE"
rm -f "$LOGFILE" rm -f "$LOGFILE"
fi fi
printf "Done.\n"