File:  [LON-CAPA] / loncom / build / Makefile.cvs
Revision 1.7: download - view: text, annotated - select for diffs
Sat May 4 21:26:54 2002 UTC (22 years, 1 month ago) by harris41
Branches: MAIN
CVS tags: HEAD
some bad directory navigation related to logentries and cvsreport
targets is fixed; BUG 336

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

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