File:  [LON-CAPA] / loncom / build / Makefile.cvs
Revision 1.1: download - view: text, annotated - select for diffs
Mon Jan 7 22:12:59 2002 UTC (22 years, 5 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
CVS-specific targets; generate a weekly report of changes; create
also coding metric graphs

    1: # The LearningOnline Network with CAPA
    2: 
    3: # Scott Harrison
    4: # $Id: Makefile.cvs,v 1.1 2002/01/07 22:12:59 harris41 Exp $
    5: 
    6: STATDIR="loncom/build/cvsstats"
    7: STATSUBDIR="cvsstats"
    8: 
    9: help:
   10: 	@echo "*** You need to specify a valid target ***"
   11: 	@echo "cvsreport: look at the latest changes over the last week"
   12: 	@echo "cvscommit: look at the number of commits since the origin of"
   13: 	@echo "           LON-CAPA archiving"
   14: 	@echo "linesofcode: look at the number of unique lines of code since"
   15: 	@echo "           LON-CAPA archiving"
   16: 	@echo "Information is placed inside CVS:loncom/build/cvsstats"
   17: 
   18: cvsreport:
   19: 	# Header
   20: 	echo "<h1>Automatically generated CVS report</h1>" > \
   21: 	../../doc/build/cvsreport.html
   22: 	# General Date Info
   23: 	echo "<h1>LON-CAPA Software Changes from `date --date='7 days ago' \
   24: 	+\"%Y-%m-%d\"` to `date +\"%Y-%m-%d\"`</h1>" >> \
   25: 	../../doc/build/cvsreport.html
   26: 	# General Alteration Info
   27: 	echo "<p>Number of altered files:" >> ../../doc/build/cvsreport.html
   28: 	cd ../..; cvs log -d ">`date --date='8 days ago' +\"%Y-%m-%d\"`" \
   29: 	loncom CAPA doc packaging 2>/dev/null | perl \
   30: 	loncom/build/cvsfilter.pl | grep '^Working file:' | cut -b15- | \
   31: 	wc -l >> doc/build/cvsreport.html
   32: 	# Listing of Altered Files
   33: 	echo "</p><p>Altered files:</p><p><pre>" >> \
   34: 	../../doc/build/cvsreport.html
   35: 	cd ../..; cvs log -d ">`date --date='8 days ago' +\"%Y-%m-%d\"`" \
   36: 	loncom CAPA doc packaging 2>/dev/null | \
   37: 	perl loncom/build/cvsfilter.pl | grep '^Working file:' | cut -b15- \
   38: 	>> doc/build/cvsreport.html
   39: 	# Log entries for loncom
   40: 	echo "</pre></p><p>Log entries for <b>loncom</b>:</p><pre>" >> \
   41: 	../../doc/build/cvsreport.html
   42: 	cd ../../loncom; cvs log -d ">`date --date='8 days ago' \
   43: 	+\"%Y-%m-%d\"`" . 2>/dev/null | perl ../loncom/build/cvsfilter.pl >> \
   44: 	../doc/build/cvsreport.html
   45: 	# Log entries for CAPA
   46: 	echo "</pre></p><p>Log entries for <b>CAPA</b>:</p><pre>" >> \
   47: 	../../doc/build/cvsreport.html
   48: 	cd ../../CAPA; cvs log -d ">`date --date='8 days ago' \
   49: 	+\"%Y-%m-%d\"`" . 2>/dev/null | perl ../loncom/build/cvsfilter.pl >> \
   50: 	../doc/build/cvsreport.html
   51: 	# Log entries for doc
   52: 	echo "</pre></p><p>Log entries for <b>doc</b>:</p><pre>" >> \
   53: 	../../doc/build/cvsreport.html
   54: 	cd ../../doc; cvs log -d ">`date --date='8 days ago' \
   55: 	+\"%Y-%m-%d\"`" . 2>/dev/null | perl ../loncom/build/cvsfilter.pl >> \
   56: 	../doc/build/cvsreport.html
   57: 	# Log entries for packaging
   58: 	echo "</pre></p><p>Log entries for <b>packaging</b>:</p><pre>" >> \
   59: 	../../doc/build/cvsreport.html
   60: 	cd ../../packaging; cvs log -d ">`date --date='8 days ago' \
   61: 	+\"%Y-%m-%d\"`" . 2>/dev/null | perl ../loncom/build/cvsfilter.pl >> \
   62: 	../doc/build/cvsreport.html
   63: 	echo "</pre></p>" >> ../../doc/build/cvsreport.html
   64: 
   65: statpage:
   66: 	install -d cvsstats
   67: 	echo '<html><title>LON-CAPA Coding Metrics</title>' > $(STATSUBDIR)/index.html
   68: 	echo '<body bgcolor="#ffffff">' >> $(STATSUBDIR)/index.html
   69: 	echo '<h1>LON-CAPA Coding Metrics</h1>' >> $(STATSUBDIR)/index.html
   70: 	echo '<br />Compiled as of ' >> $(STATSUBDIR)/index.html
   71: 	date >> $(STATSUBDIR)/index.html
   72: 	echo '<p>&nbsp;</p>'
   73: 	echo '<br />Lines of Code; unique changes per month' >> $(STATSUBDIR)/index.html
   74: 	echo '<br />Lines of Code; unique changes (*.pm only) per month' >> $(STATSUBDIR)/index.html
   75: 	echo '<br />Lines of Code; aggregating sum of unique changes per month' >> $(STATSUBDIR)/index.html
   76: 	echo '<br />Lines of Code; aggregating sum of unique changes (*.pm only) per month' >> $(STATSUBDIR)/index.html
   77: 	echo '<br />Number of commits to software repository per month' >> $(STATSUBDIR)/index.html
   78: 	echo '<br />Number of commits to software repository (*.pm only) per month' >> $(STATSUBDIR)/index.html
   79: 	echo '<br />Aggregating sum of number of commits to software repository per month' >> $(STATSUBDIR)/index.html
   80: 	echo '<br />Aggregating sum of number of commits to software repository (*.pm only) per month' >> $(STATSUBDIR)/index.html
   81: 	echo '<br /><img src="loc.png" alt="lines of code" />' >> $(STATSUBDIR)/index.html
   82: 	echo '<br /><img src="locpm.png" alt="lines of code, perl modules" />' >> $(STATSUBDIR)/index.html
   83: 	echo '<br /><img src="locsum.png" alt="aggregate lines of code" />' >> $(STATSUBDIR)/index.html
   84: 	echo '<br /><img src="locpmsum.png" alt="aggregate lines of code, perl modules" />' >> $(STATSUBDIR)/index.html
   85: 	echo '<br /><img src="commit.png" alt="number of commits" />' >> $(STATSUBDIR)/index.html
   86: 	echo '<br /><img src="commitpm.png" alt="number of commits, perl modules" />' >> $(STATSUBDIR)/index.html
   87: 	echo '<br /><img src="commitsum.png" alt="aggregate number of commits" />' >> $(STATSUBDIR)/index.html
   88: 	echo '<br /><img src="commitpmsum.png" alt="aggregate number of commits, perl modules" />' >> $(STATSUBDIR)/index.html
   89: 	echo '</body>' >> $(STATSUBDIR)/index.html
   90: 	echo '</html>' >> $(STATSUBDIR)/index.html
   91: 
   92: linesofcode:
   93: 	install -d cvsstats
   94: 	# for all, and for .pm
   95: 	# get date array
   96: 	cd ../..; perl -e ' \
   97: ($$begindate,$$enddate)=@ARGV;\
   98: ($$by,$$bm,$$bd)=($$begindate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
   99: ($$ey,$$em,$$ed)=($$enddate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
  100: for ($$y=$$by; $$y<=$$ey; $$y++) {\
  101:     if ($$y==$$by) {$$m=$$bm;} else {$$m=1;}\
  102:     if ($$y==$$ey) {$$m2=$$em;} else {$$m2=12;}\
  103:     for ($$m; $$m<=$$m2; $$m++) {\
  104: 	printf("$$odate\t%4.4d%2.2d%2.2d\n",$$y,$$m,$$bd) if $$odate; \
  105: 	$$odate=sprintf("%4.4d%2.2d%2.2d",$$y,$$m,$$bd);\
  106:     }\
  107: }' 20000101 `date +"%Y%m%d"` |\
  108: perl -nle '($$d1,$$d2)=split(/\t/);$$loc=`cvs -q diff -D$$d1 -D$$d2 -b -B -N | egrep \"^> .*[^ \t]\" | sed \"s/^> //g\" | sort | uniq | wc -l`;chomp $$loc;$$locsum+=$$loc;print "$$d2\t$$loc\t$$locsum";' > $(STATDIR)/table.txt
  109: 	echo -e 'set xdata time\nset timefmt "%Y%m%d"\nset format x "%b %y"\nset xlabel "time"\nset ylabel "lines of code"\nset nokey\nset title "Lines of Code\\nUnique changes per month"\nset output "cvsstats/loc.png"\nset term png color\nplot "cvsstats/table.txt" using 1:2 with lines' | gnuplot
  110: 	echo -e 'set xdata time\nset timefmt "%Y%m%d"\nset format x "%b %y"\nset xlabel "time"\nset ylabel "lines of code"\nset nokey\nset title "Lines of Code\\nUnique changes per month"\nset output "cvsstats/locsum.png"\nset term png color\nplot "cvsstats/table.txt" using 1:3 with lines' | gnuplot
  111: 	cd ../..; perl -e ' \
  112: ($$begindate,$$enddate)=@ARGV;\
  113: ($$by,$$bm,$$bd)=($$begindate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
  114: ($$ey,$$em,$$ed)=($$enddate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
  115: for ($$y=$$by; $$y<=$$ey; $$y++) {\
  116:     if ($$y==$$by) {$$m=$$bm;} else {$$m=1;}\
  117:     if ($$y==$$ey) {$$m2=$$em;} else {$$m2=12;}\
  118:     for ($$m; $$m<=$$m2; $$m++) {\
  119: 	printf("$$odate\t%4.4d%2.2d%2.2d\n",$$y,$$m,$$bd) if $$odate; \
  120: 	$$odate=sprintf("%4.4d%2.2d%2.2d",$$y,$$m,$$bd);\
  121:     }\
  122: }' 20000101 `date +"%Y%m%d"` |\
  123: perl -nle '($$d1,$$d2)=split(/\t/);$$loc=`cvs -q diff -D$$d1 -D$$d2 -b -B -N |\
  124: perl -e "\@flag=(1);while(<>){if (/RCS file:/) {\@flag=(); pop \@flag; \@flag=(1) if /^RCS file: .*\.pm\,v/;} print if \@flag;}" |\
  125:  egrep \"^> .*[^ \t]\" | sed \"s/^> //g\" | sort | uniq | wc -l`;chomp $$loc;$$locsum+=$$loc;print "$$d2\t$$loc\t$$locsum";' > $(STATDIR)/tablepm.txt
  126: # process counts, generate table
  127: 	# pass table to gnuplot
  128: 	echo -e 'set xdata time\nset timefmt "%Y%m%d"\nset format x "%b %y"\nset xlabel "time"\nset ylabel "lines of code"\nset nokey\nset title "Lines of Code\\nUnique changes per month"\nset output "cvsstats/locpm.png"\nset term png color\nplot "cvsstats/tablepm.txt" using 1:2 with lines' | gnuplot
  129: 	echo -e 'set xdata time\nset timefmt "%Y%m%d"\nset format x "%b %y"\nset xlabel "time"\nset ylabel "lines of code"\nset nokey\nset title "Lines of Code\\nUnique changes per month"\nset output "cvsstats/locpmsum.png"\nset term png color\nplot "cvsstats/tablepm.txt" using 1:3 with lines' | gnuplot
  130: 
  131: cvscommit:
  132: 	# for all, and for .pm
  133: 	# get date array
  134: 	# process counts, generate table
  135: 	# pass table to gnuplot
  136: 
  137: clean:
  138: 	rm -Rf cvsstats
  139: 
  140: 
  141: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>