From 436296b9bde3eddb976c2d3fdd4b35d915e40be8 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 20 Nov 2019 17:15:13 +0100 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/37023 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- util/release/genrelnotes | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'util/release/genrelnotes') 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. -- cgit v1.2.3