File:  [LON-CAPA] / loncom / build / Makefile.cvs
Revision 1.3: download - view: text, annotated - select for diffs
Mon Feb 11 06:28:11 2002 UTC (22 years, 4 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
making the metric directory target variable

    1: # The LearningOnline Network with CAPA
    2: 
    3: # Scott Harrison
    4: # $Id: Makefile.cvs,v 1.3 2002/02/11 06:28:11 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 $(STATSUBDIR)
   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>The general algorithm for counting lines of code (this excludes blank lines) is <blockquote>cvs -q diff -D'start-date' -D'end-date' -b -B -N | egrep '^> .*[^ \t]' | sed 's/^> //g' | sort | uniq | wc -l</blockquote>&nbsp;</p>" >> $(STATSUBDIR)/index.html
   73: 	echo "<p>The general algorithm for counting the number of CVS repository commits (includes additions, deletions, and modifications) is: <blockquote>cvs history -D'start-date' -a -xMAR | wc -l</blockquote>&nbsp;</p>" >> $(STATSUBDIR)/index.html
   74: 	echo "<p>Each listing contains two graphs.  One graph relates to the entire LON-CAPA repository.  The other graph relates solely to the *.pm files (perl modules including Apache handlers).</p>" >> $(STATSUBDIR)/index.html
   75: 	echo '<br /><a href="#loc">Lines of Code; unique changes per month</a>' >> $(STATSUBDIR)/index.html
   76: 	echo '<br /><a href="#locsum">Lines of Code; aggregate sum of unique changes per month</a>' >> $(STATSUBDIR)/index.html
   77: 	echo '<br /><a href="#commit">Number of commits to software repository per month</a>' >> $(STATSUBDIR)/index.html
   78: 	echo '<br /><a href="#commitsum">Aggregate sum of number of commits to software repository per month</a>' >> $(STATSUBDIR)/index.html
   79: 	echo '<hr /><a name="loc"><h3>Lines of Code</h3>' >> $(STATSUBDIR)/index.html
   80: 	echo 'The first graph displays the number of unique line changes made in the CVS repository per month.  The second graphs displays the number of unique line changes made to *.pm files in the CVS repository 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 '<hr /><a name="locsum"><h3>Aggregate Lines of Code</h3>' >> $(STATSUBDIR)/index.html
   84: 	echo 'The first graph displays the aggregate number of unique line changes made in the CVS repository per month.  The second graphs displays the aggregate number of unique line changes made to *.pm files in the CVS repository per month.' >> $(STATSUBDIR)/index.html
   85: 	echo '<br /><img src="locsum.png" alt="aggregate lines of code" />' >> $(STATSUBDIR)/index.html
   86: 	echo '<br /><img src="locpmsum.png" alt="aggregate lines of code, perl modules" />' >> $(STATSUBDIR)/index.html
   87: 	echo '<hr /><a name="commit"><h3>Commits to Repository</h3>' >> $(STATSUBDIR)/index.html
   88: 	echo 'The first graph displays the number of repository commits (additions, deletions, and modifications) made in the CVS repository per month.  The second graphs displays the number of repository commits involving *.pm files made in the CVS repository per month.' >> $(STATSUBDIR)/index.html
   89: 	echo '<br /><img src="commit.png" alt="number of commits" />' >> $(STATSUBDIR)/index.html
   90: 	echo '<br /><img src="commitpm.png" alt="number of commits, perl modules" />' >> $(STATSUBDIR)/index.html
   91: 	echo '<hr /><a name="commitsum"><h3>Aggregate Commits to Repository</h3>' >> $(STATSUBDIR)/index.html
   92: 	echo 'The first graph displays the aggregate number of repository commits (additions, deletions, and modifications) made in the CVS repository per month.  The second graphs displays the aggregate number of repository commits involving *.pm files made in the CVS repository per month.' >> $(STATSUBDIR)/index.html
   93: 	echo '<br /><img src="commitsum.png" alt="aggregate number of commits" />' >> $(STATSUBDIR)/index.html
   94: 	echo '<br /><img src="commitpmsum.png" alt="aggregate number of commits, perl modules" />' >> $(STATSUBDIR)/index.html
   95: 	echo '</body>' >> $(STATSUBDIR)/index.html
   96: 	echo '</html>' >> $(STATSUBDIR)/index.html
   97: 
   98: linesofcode:
   99: 	install -d cvsstats
  100: 	# for all, and for .pm
  101: 	# get date array
  102: 	cd ../..; perl -e ' \
  103: ($$begindate,$$enddate)=@ARGV;\
  104: ($$by,$$bm,$$bd)=($$begindate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
  105: ($$ey,$$em,$$ed)=($$enddate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
  106: for ($$y=$$by; $$y<=$$ey; $$y++) {\
  107:     if ($$y==$$by) {$$m=$$bm;} else {$$m=1;}\
  108:     if ($$y==$$ey) {$$m2=$$em;} else {$$m2=12;}\
  109:     for ($$m; $$m<=$$m2; $$m++) {\
  110: 	printf("$$odate\t%4.4d%2.2d%2.2d\n",$$y,$$m,$$bd) if $$odate; \
  111: 	$$odate=sprintf("%4.4d%2.2d%2.2d",$$y,$$m,$$bd);\
  112:     }\
  113: }' 20000101 `date +"%Y%m%d"` |\
  114: 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
  115: 	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
  116: 	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\\nAggregate count; Unique changes per month"\nset output "cvsstats/locsum.png"\nset term png color\nplot "cvsstats/table.txt" using 1:3 with lines' | gnuplot
  117: 	cd ../..; perl -e ' \
  118: ($$begindate,$$enddate)=@ARGV;\
  119: ($$by,$$bm,$$bd)=($$begindate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
  120: ($$ey,$$em,$$ed)=($$enddate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
  121: for ($$y=$$by; $$y<=$$ey; $$y++) {\
  122:     if ($$y==$$by) {$$m=$$bm;} else {$$m=1;}\
  123:     if ($$y==$$ey) {$$m2=$$em;} else {$$m2=12;}\
  124:     for ($$m; $$m<=$$m2; $$m++) {\
  125: 	printf("$$odate\t%4.4d%2.2d%2.2d\n",$$y,$$m,$$bd) if $$odate; \
  126: 	$$odate=sprintf("%4.4d%2.2d%2.2d",$$y,$$m,$$bd);\
  127:     }\
  128: }' 20000101 `date +"%Y%m%d"` |\
  129: perl -nle '($$d1,$$d2)=split(/\t/);$$loc=`cvs -q diff -D$$d1 -D$$d2 -b -B -N |\
  130: perl -e "\@flag=(1);while(<>){if (/RCS file:/) {\@flag=(); pop \@flag; \@flag=(1) if /^RCS file: .*\.pm\,v/;} print if \@flag;}" |\
  131:  egrep \"^> .*[^ \t]\" | sed \"s/^> //g\" | sort | uniq | wc -l`;chomp $$loc;$$locsum+=$$loc;print "$$d2\t$$loc\t$$locsum";' > $(STATDIR)/tablepm.txt
  132: # process counts, generate table
  133: 	# pass table to gnuplot
  134: 	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, perl modules\\nUnique changes per month"\nset output "cvsstats/locpm.png"\nset term png color\nplot "cvsstats/tablepm.txt" using 1:2 with lines' | gnuplot
  135: 	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, perl modules\\nAggregate count; Unique changes per month"\nset output "cvsstats/locpmsum.png"\nset term png color\nplot "cvsstats/tablepm.txt" using 1:3 with lines' | gnuplot
  136: 
  137: cvscommit:
  138: 	install -d cvsstats
  139: 	# for all, and for .pm
  140: 	# get date array
  141: 	cd ../..; perl -e ' \
  142: ($$begindate,$$enddate)=@ARGV;\
  143: ($$by,$$bm,$$bd)=($$begindate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
  144: ($$ey,$$em,$$ed)=($$enddate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
  145: for ($$y=$$by; $$y<=$$ey; $$y++) {\
  146:     if ($$y==$$by) {$$m=$$bm;} else {$$m=1;}\
  147:     if ($$y==$$ey) {$$m2=$$em;} else {$$m2=12;}\
  148:     for ($$m; $$m<=$$m2; $$m++) {\
  149: 	printf("$$odate\t%4.4d%2.2d%2.2d\n",$$y,$$m,$$bd) if $$odate; \
  150: 	$$odate=sprintf("%4.4d%2.2d%2.2d",$$y,$$m,$$bd);\
  151:     }\
  152: }' 20000101 `date +"%Y%m%d"` |\
  153: perl -nle '($$d1,$$d2)=split(/\t/);$$cmt1=`cvs history -D$$d1 -a -xMAR | wc -l`;chomp $$cmt1;$$cmt2=`cvs history -D$$d2 -a -xMAR | wc -l`;chomp $$cmt2;$$cmt=$$cmt1-$$cmt2;$$cmtsum+=$$cmt;print "$$d2\t$$cmt\t$$cmtsum";' > $(STATDIR)/ctable.txt
  154: 	echo -e 'set xdata time\nset timefmt "%Y%m%d"\nset format x "%b %y"\nset xlabel "time"\nset ylabel "commits"\nset nokey\nset title "Commits\\n(Additions, Deletions, and Modifications)"\nset output "cvsstats/commit.png"\nset term png color\nplot "cvsstats/ctable.txt" using 1:2 with lines' | gnuplot
  155: 	echo -e 'set xdata time\nset timefmt "%Y%m%d"\nset format x "%b %y"\nset xlabel "time"\nset ylabel "commits"\nset nokey\nset title "Commits\\nAggregate count (Additions, Deletions, and Modifications"\nset output "cvsstats/commitsum.png"\nset term png color\nplot "cvsstats/ctable.txt" using 1:3 with lines' | gnuplot
  156: 	cd ../..; perl -e ' \
  157: ($$begindate,$$enddate)=@ARGV;\
  158: ($$by,$$bm,$$bd)=($$begindate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
  159: ($$ey,$$em,$$ed)=($$enddate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
  160: for ($$y=$$by; $$y<=$$ey; $$y++) {\
  161:     if ($$y==$$by) {$$m=$$bm;} else {$$m=1;}\
  162:     if ($$y==$$ey) {$$m2=$$em;} else {$$m2=12;}\
  163:     for ($$m; $$m<=$$m2; $$m++) {\
  164: 	printf("$$odate\t%4.4d%2.2d%2.2d\n",$$y,$$m,$$bd) if $$odate; \
  165: 	$$odate=sprintf("%4.4d%2.2d%2.2d",$$y,$$m,$$bd);\
  166:     }\
  167: }' 20000101 `date +"%Y%m%d"` |\
  168: perl -nle '($$d1,$$d2)=split(/\t/);$$cmt1=`cvs history -D$$d1 -a -xMAR | grep "\.pm[[:space:]]" | wc -l`;chomp $$cmt1;$$cmt2=`cvs history -D$$d2 -a -xMAR | grep "\.pm[[:space:]]" | wc -l`;chomp $$cmt2;$$cmt=$$cmt1-$$cmt2;$$cmtsum+=$$cmt;print "$$d2\t$$cmt\t$$cmtsum";' > $(STATDIR)/ctablepm.txt
  169: # process counts, generate table
  170: 	# pass table to gnuplot
  171: 	echo -e 'set xdata time\nset timefmt "%Y%m%d"\nset format x "%b %y"\nset xlabel "time"\nset ylabel "commits"\nset nokey\nset title "Commits, perl modules\\n(Additions, Deletions, and Modifications)"\nset output "cvsstats/commitpm.png"\nset term png color\nplot "cvsstats/ctablepm.txt" using 1:2 with lines' | gnuplot
  172: 	echo -e 'set xdata time\nset timefmt "%Y%m%d"\nset format x "%b %y"\nset xlabel "time"\nset ylabel "commits"\nset nokey\nset title "Commits, perl modules\\nAggregate count (Additions, Deletions, and Modifications)"\nset output "cvsstats/commitpmsum.png"\nset term png color\nplot "cvsstats/ctablepm.txt" using 1:3 with lines' | gnuplot
  173: 
  174: clean:
  175: 	rm -Rf cvsstats
  176: 
  177: 
  178: 

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