File:  [LON-CAPA] / loncom / build / Makefile.cvs
Revision 1.5: download - view: text, annotated - select for diffs
Mon Apr 29 19:15:41 2002 UTC (22 years, 2 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
modularization and configurability... TIMEAGO flag now supported

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

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