Annotation of loncom/build/Makefile.cvs, revision 1.4

1.1       harris41    1: # The LearningOnline Network with CAPA
                      2: 
                      3: # Scott Harrison
1.4     ! harris41    4: # $Id: Makefile.cvs,v 1.3 2002/02/11 06:28:11 harris41 Exp $
1.1       harris41    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\"`" \
1.4     ! harris41   29: 	loncom CAPA doc 2>/dev/null | perl \
1.1       harris41   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\"`" \
1.4     ! harris41   36: 	loncom CAPA doc 2>/dev/null | \
1.1       harris41   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: 	echo "</pre></p>" >> ../../doc/build/cvsreport.html
                     58: 
                     59: statpage:
1.3       harris41   60: 	install -d $(STATSUBDIR)
1.1       harris41   61: 	echo '<html><title>LON-CAPA Coding Metrics</title>' > $(STATSUBDIR)/index.html
                     62: 	echo '<body bgcolor="#ffffff">' >> $(STATSUBDIR)/index.html
                     63: 	echo '<h1>LON-CAPA Coding Metrics</h1>' >> $(STATSUBDIR)/index.html
                     64: 	echo '<br />Compiled as of ' >> $(STATSUBDIR)/index.html
                     65: 	date >> $(STATSUBDIR)/index.html
1.2       harris41   66: 	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
                     67: 	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
                     68: 	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
                     69: 	echo '<br /><a href="#loc">Lines of Code; unique changes per month</a>' >> $(STATSUBDIR)/index.html
                     70: 	echo '<br /><a href="#locsum">Lines of Code; aggregate sum of unique changes per month</a>' >> $(STATSUBDIR)/index.html
                     71: 	echo '<br /><a href="#commit">Number of commits to software repository per month</a>' >> $(STATSUBDIR)/index.html
                     72: 	echo '<br /><a href="#commitsum">Aggregate sum of number of commits to software repository per month</a>' >> $(STATSUBDIR)/index.html
                     73: 	echo '<hr /><a name="loc"><h3>Lines of Code</h3>' >> $(STATSUBDIR)/index.html
                     74: 	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
1.1       harris41   75: 	echo '<br /><img src="loc.png" alt="lines of code" />' >> $(STATSUBDIR)/index.html
                     76: 	echo '<br /><img src="locpm.png" alt="lines of code, perl modules" />' >> $(STATSUBDIR)/index.html
1.2       harris41   77: 	echo '<hr /><a name="locsum"><h3>Aggregate Lines of Code</h3>' >> $(STATSUBDIR)/index.html
                     78: 	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
1.1       harris41   79: 	echo '<br /><img src="locsum.png" alt="aggregate lines of code" />' >> $(STATSUBDIR)/index.html
                     80: 	echo '<br /><img src="locpmsum.png" alt="aggregate lines of code, perl modules" />' >> $(STATSUBDIR)/index.html
1.2       harris41   81: 	echo '<hr /><a name="commit"><h3>Commits to Repository</h3>' >> $(STATSUBDIR)/index.html
                     82: 	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
1.1       harris41   83: 	echo '<br /><img src="commit.png" alt="number of commits" />' >> $(STATSUBDIR)/index.html
                     84: 	echo '<br /><img src="commitpm.png" alt="number of commits, perl modules" />' >> $(STATSUBDIR)/index.html
1.2       harris41   85: 	echo '<hr /><a name="commitsum"><h3>Aggregate Commits to Repository</h3>' >> $(STATSUBDIR)/index.html
                     86: 	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
1.1       harris41   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
1.2       harris41  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\\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
1.1       harris41  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
1.2       harris41  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, 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
                    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, 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
1.1       harris41  130: 
                    131: cvscommit:
1.2       harris41  132: 	install -d cvsstats
1.1       harris41  133: 	# for all, and for .pm
                    134: 	# get date array
1.2       harris41  135: 	cd ../..; perl -e ' \
                    136: ($$begindate,$$enddate)=@ARGV;\
                    137: ($$by,$$bm,$$bd)=($$begindate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
                    138: ($$ey,$$em,$$ed)=($$enddate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
                    139: for ($$y=$$by; $$y<=$$ey; $$y++) {\
                    140:     if ($$y==$$by) {$$m=$$bm;} else {$$m=1;}\
                    141:     if ($$y==$$ey) {$$m2=$$em;} else {$$m2=12;}\
                    142:     for ($$m; $$m<=$$m2; $$m++) {\
                    143: 	printf("$$odate\t%4.4d%2.2d%2.2d\n",$$y,$$m,$$bd) if $$odate; \
                    144: 	$$odate=sprintf("%4.4d%2.2d%2.2d",$$y,$$m,$$bd);\
                    145:     }\
                    146: }' 20000101 `date +"%Y%m%d"` |\
                    147: 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
                    148: 	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
                    149: 	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
                    150: 	cd ../..; perl -e ' \
                    151: ($$begindate,$$enddate)=@ARGV;\
                    152: ($$by,$$bm,$$bd)=($$begindate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
                    153: ($$ey,$$em,$$ed)=($$enddate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
                    154: for ($$y=$$by; $$y<=$$ey; $$y++) {\
                    155:     if ($$y==$$by) {$$m=$$bm;} else {$$m=1;}\
                    156:     if ($$y==$$ey) {$$m2=$$em;} else {$$m2=12;}\
                    157:     for ($$m; $$m<=$$m2; $$m++) {\
                    158: 	printf("$$odate\t%4.4d%2.2d%2.2d\n",$$y,$$m,$$bd) if $$odate; \
                    159: 	$$odate=sprintf("%4.4d%2.2d%2.2d",$$y,$$m,$$bd);\
                    160:     }\
                    161: }' 20000101 `date +"%Y%m%d"` |\
                    162: 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
                    163: # process counts, generate table
1.1       harris41  164: 	# pass table to gnuplot
1.2       harris41  165: 	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
                    166: 	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
1.1       harris41  167: 
                    168: clean:
                    169: 	rm -Rf cvsstats
                    170: 
                    171: 
                    172: 

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