[RFC] Add community health scripts

Message ID 20260407183150.3951426-1-andrew.pinski@oss.qualcomm.com
State New
Headers
Series [RFC] Add community health scripts |

Commit Message

Andrew Pinski April 7, 2026, 6:31 p.m. UTC
  This is the scripts which I have been using to generate the
data I sent out recently about community health.
I am sending them out for others to use and if folks want to improve them too.

Right now you need to modify the .awk script to say which
section wants to be outputted. I am not going to add the option to change
what is printed.

The only thing I wish I could figure out how to do better is awk and arrays
as right now there is some duplicated code as there is no way to do a 2 dimensional
array in awk that I know of.

contrib/ChangeLog:

	* community_release_update.awk: New file.
	* community_release_update.sh: New file.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
---
 contrib/community_release_update.awk | 190 +++++++++++++++++++++++++++
 contrib/community_release_update.sh  |  16 +++
 2 files changed, 206 insertions(+)
 create mode 100644 contrib/community_release_update.awk
 create mode 100755 contrib/community_release_update.sh
  

Patch

diff --git a/contrib/community_release_update.awk b/contrib/community_release_update.awk
new file mode 100644
index 00000000000..f99b7e0ba37
--- /dev/null
+++ b/contrib/community_release_update.awk
@@ -0,0 +1,190 @@ 
+BEGIN {
+  filemaps["all"]=@//
+  filemaps["middle"]=@/gcc\/([^\/]*\.opt|[^\/]*\.pd|[^\/]*\.cc|[^\/]*\.[ch]|[^\/]*\.opt|rtl-ssa)/
+  filemaps["aarch64"]=@/gcc\/config\/aarch64|gcc\/common\/config\/aarc64|libgcc\/config\/aarch64/
+  filemaps["riscv"]=@/gcc\/config\/riscv|gcc\/common\/config\/riscv|libgcc\/config\/riscv/
+  filemaps["x86"]=@/gcc\/config\/i386|gcc\/common\/config\/i386|libgcc\/config\/i386/
+  
+  filemaps["ppc"]=@/gcc\/config\/rs6000|gcc\/common\/config\/rs6000|libgcc\/config\/rs6000/
+  filemaps["arm"]=@/gcc\/config\/arm|gcc\/common\/config\/arm|libgcc\/config\/arm/
+  
+  filemaps["cp"]=@/gcc\/(cp|c-family|c)\/|libstdc\+\+|libcpp/
+  filemaps["fortran"]=@/gcc\/fortran|libgfortran/
+  filemaps["rust"]=@/gcc\/rust|libgrust/
+  for(x in filemaps)
+  {
+    seen[x] = 0
+  }
+  
+}
+
+/^commit / {
+  for(x in filemaps)
+  {
+# Skip GCC Administrator
+    if (current_author == "GCC Administrator")
+    {
+    } else if (seen[x] == 1)
+    {
+      if (x == "all")
+      {
+        author_all[current_author]++
+	commits++
+      } else if (x == "middle")
+      {
+        author_middle[current_author]++
+	commits_middle++
+      } else if (x == "cp")
+      {
+        author_cp[current_author]++
+	commits_cp++
+      } else if (x == "rust")
+      {
+        author_rust[current_author]++
+	commits_rust++
+      } else if (x == "fortran")
+      {
+        author_fortran[current_author]++
+	commits_fortran++
+      } else if (x == "aarch64")
+      {
+        author_aarch64[current_author]++
+	commits_aarch64++
+      } else if (x == "riscv")
+      {
+        author_riscv[current_author]++
+	commits_riscv++
+      } else if (x == "x86")
+      {
+        author_x86[current_author]++
+	commits_x86++
+      } else if (x == "ppc")
+      {
+        author_ppc[current_author]++
+	commits_ppc++
+      } else if (x == "arm")
+      {
+        author_arm[current_author]++
+	commits_arm++
+      }
+    }
+  }
+  for(x in filemaps)
+  {
+    seen[x] = 0
+  }
+  current_author=""
+}
+
+/^Author:/ {
+  #print $0
+  split($0, a, "[:<]")
+  t= substr(a[2], 6, length(a[2])-6)
+#  print ""
+  #  author_all[t]++
+    current_author=t
+}
+/Co-authored-by:/ {
+  #print $0
+  split($0, a, "[:<]")
+  t= substr(a[2], 2)
+  coauthor[t]++
+}
+/^Commit:/ {
+  #print $0
+  split($0, a, "[:<]")
+  t= substr(a[2], 6)
+#  print ""
+    committor_all[t]++
+}
+
+/^[a-z][^[:space:]]+$/ {
+  filename=$0
+ for (x in filemaps) {
+   if (seen[x] == 0) {
+     if (filename ~ filemaps[x]) {
+     #print current_author " " x " " $0
+       seen[x] = 1
+     }
+   }
+ }
+}
+
+#
+# {
+#    if ($2 != "gccadmin") { sum+=$1; count+=1 }
+#    if ($1 < 20) { bucket1+=1 }
+#    else if ($1 < 40) { bucket2+=1 }
+#    else if ($1 < 60) { bucket3+=1 }
+#    else if ($1 < 80) { bucket4+=1 }
+#    else if ($1 < 100) { bucket5+=1 }
+#    else if ($1 < 200) { bucket6+=1 }
+#    else  { bucket7+=1 }
+#  }
+# */
+END {
+  authors=0
+  for (x in author_all)
+  {
+      authors++;
+  }
+  for (x in author_middle)
+  {
+      authors_middle++;
+  }
+  for (x in author_cp)
+  {
+      authors_cp++;
+  }
+  for (x in author_rust)
+  {
+      authors_rust++;
+  }
+  for (x in author_fortran)
+  {
+      authors_fortran++;
+  }
+  for (x in author_aarch64)
+  {
+      authors_aarch64++;
+  }
+  for (x in author_riscv)
+  {
+      authors_riscv++;
+  }
+  for (x in author_x86)
+  {
+      authors_x86++;
+  }
+  for (x in author_ppc)
+  {
+      authors_ppc++;
+  }
+  for (x in author_arm)
+  {
+      authors_arm++;
+  }
+  printf "%d\t%d\t%.0f\t", commits, authors, (commits/authors)
+ # printf "%d\t%d\t%.0f\t", commits_middle, authors_middle, (commits_middle/authors_middle)
+#  printf "%d\t%d\t%.0f\t", commits_x86, authors_x86, (commits_x86/authors_x86)
+#  printf "%d\t%d\t%.0f\t", commits_arm, authors_arm, (commits_arm/authors_arm)
+#  printf "%d\t%d\t%.0f\t", commits_ppc, authors_ppc, (commits_ppc/authors_ppc)
+ # printf "%d\t%d\t%.0f\t", commits_aarch64, authors_aarch64, (commits_aarch64/authors_aarch64)
+  
+  
+  printf "%d\t%d\t%.0f\t", commits_cp, authors_cp, (commits_cp/authors_cp)
+  printf "%d\t%d\t%.0f\t", commits_fortran, authors_fortran, (commits_fortran/authors_fortran)
+  if (authors_riscv != 0) {
+#    printf "%d\t%d\t%.0f\t", commits_riscv, authors_riscv, (commits_riscv/authors_riscv)
+  }
+  
+  if (authors_rust != 0) {
+    printf "%d\t%d\t%.0f\t", commits_rust, authors_rust, (commits_rust/authors_rust)
+  }
+#  printf "\t%d\t%d\t%d\t%d\t%d\t%d\t%d",
+#	 bucket1, bucket2, bucket3, bucket4, bucket5, bucket6, bucket7
+ # printf "\t%.0f\t%.0f\t%.0f\t%.0f\t%.0f\t%.0f\t%.0f",
+#	 (bucket1/count) *100, (bucket2/count)*100, (bucket3/count)*100, 
+#	 (bucket4/count)*100, (bucket5/count)*100, (bucket6/count)*100, (bucket7/count)*100
+  printf "\n"
+ }
diff --git a/contrib/community_release_update.sh b/contrib/community_release_update.sh
new file mode 100755
index 00000000000..f806e0ededc
--- /dev/null
+++ b/contrib/community_release_update.sh
@@ -0,0 +1,16 @@ 
+#!/bin/bash
+
+for i in {5..16};
+do
+  file=/tmp/co_$$_$i.txt
+  start_rev=basepoints/gcc-${i}
+  end_rev=releases/gcc-${i}.1.0
+  if ! git tag | grep -q $end_rev ; then
+    end_rev=origin/trunk
+  fi
+  printf "%d\t" $i
+  git log --format=fuller --name-only ${start_rev}...${end_rev} > $file
+  
+  awk -f community_release_update.awk $file
+  rm -f $file
+done