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

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

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