summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2019-11-20 17:15:13 +0100
committerPatrick Georgi <pgeorgi@google.com>2019-11-22 21:50:47 +0000
commit436296b9bde3eddb976c2d3fdd4b35d915e40be8 (patch)
tree04d4ec0a235a4a13225c8ad7407a7b409fd9eb36
parent1916d68ee378c41bb60ebe0b67b2b69d6ba1166f (diff)
util/release: Don't wildly rename Makefiles
Even with four cloc invocations it's faster than doing the rename dance and messes up the tree less. It also opens up using cloc's git mode to work on a git tree instead of a checkout. Change-Id: I3ad8fc6802ecedb332359d00b28ea61c33ed2ea0 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/37023 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
-rwxr-xr-xutil/release/genrelnotes27
1 files changed, 21 insertions, 6 deletions
diff --git a/util/release/genrelnotes b/util/release/genrelnotes
index e3af48c913..c19aaa7215 100755
--- a/util/release/genrelnotes
+++ b/util/release/genrelnotes
@@ -226,14 +226,29 @@ show_diff () {
get_sloc () {
# 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/' {} \;
+ # while we use it both for Makefile.inc and some files that are
+ # really C, do three passes: everything but .inc files, all .inc files
+ # that aren't Makefiles, all Makefile.inc, then combine them.
+
+ local base=`mktemp`
+ find src -name Makefile.inc > ${base}.mak
+
+ cloc --progress-rate=0 --quiet \
+ --script-lang="Bourne Shell",bash --exclude-ext=inc \
+ --exclude-dir=vendorcode --out=${base} src
+ cloc --progress-rate=0 --quiet \
+ --exclude-list-file=${base}.mak --force-lang=c,inc \
+ --exclude-dir=vendorcode --out=${base}.c src
+ cloc --progress-rate=0 --quiet \
+ --list-file=${base}.mak --force-lang=make,inc \
+ --exclude-dir=vendorcode --out=${base}.m src
+ cloc --progress-rate=0 --quiet --sum-reports \
+ ${base} ${base}.c ${base}.m --out ${base}.result
- cloc --progress-rate=0 --quiet --script-lang="Bourne Shell",bash \
- --force-lang=c,inc --exclude-dir=vendorcode src
+ echo
+ cat ${base}.result.lang
- # Change all the makefiles back to Makefile.inc
- find 'src' -name 'gnumakefile' -exec rename 's/gnumakefile/Makefile\.inc/' {} \;
+ rm -f ${base}*
}
# Start collecting data from the old and new revisions.