File:  [LON-CAPA] / loncom / build / Makefile.cvs
Revision 1.1: download - view: text, annotated - select for diffs
Mon Jan 7 22:12:59 2002 UTC (22 years, 4 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
CVS-specific targets; generate a weekly report of changes; create
also coding metric graphs

# The LearningOnline Network with CAPA

# Scott Harrison
# $Id: Makefile.cvs,v 1.1 2002/01/07 22:12:59 harris41 Exp $

STATDIR="loncom/build/cvsstats"
STATSUBDIR="cvsstats"

help:
	@echo "*** You need to specify a valid target ***"
	@echo "cvsreport: look at the latest changes over the last week"
	@echo "cvscommit: look at the number of commits since the origin of"
	@echo "           LON-CAPA archiving"
	@echo "linesofcode: look at the number of unique lines of code since"
	@echo "           LON-CAPA archiving"
	@echo "Information is placed inside CVS:loncom/build/cvsstats"

cvsreport:
	# Header
	echo "<h1>Automatically generated CVS report</h1>" > \
	../../doc/build/cvsreport.html
	# General Date Info
	echo "<h1>LON-CAPA Software Changes from `date --date='7 days ago' \
	+\"%Y-%m-%d\"` to `date +\"%Y-%m-%d\"`</h1>" >> \
	../../doc/build/cvsreport.html
	# General Alteration Info
	echo "<p>Number of altered files:" >> ../../doc/build/cvsreport.html
	cd ../..; cvs log -d ">`date --date='8 days ago' +\"%Y-%m-%d\"`" \
	loncom CAPA doc packaging 2>/dev/null | perl \
	loncom/build/cvsfilter.pl | grep '^Working file:' | cut -b15- | \
	wc -l >> doc/build/cvsreport.html
	# Listing of Altered Files
	echo "</p><p>Altered files:</p><p><pre>" >> \
	../../doc/build/cvsreport.html
	cd ../..; cvs log -d ">`date --date='8 days ago' +\"%Y-%m-%d\"`" \
	loncom CAPA doc packaging 2>/dev/null | \
	perl loncom/build/cvsfilter.pl | grep '^Working file:' | cut -b15- \
	>> doc/build/cvsreport.html
	# Log entries for loncom
	echo "</pre></p><p>Log entries for <b>loncom</b>:</p><pre>" >> \
	../../doc/build/cvsreport.html
	cd ../../loncom; cvs log -d ">`date --date='8 days ago' \
	+\"%Y-%m-%d\"`" . 2>/dev/null | perl ../loncom/build/cvsfilter.pl >> \
	../doc/build/cvsreport.html
	# Log entries for CAPA
	echo "</pre></p><p>Log entries for <b>CAPA</b>:</p><pre>" >> \
	../../doc/build/cvsreport.html
	cd ../../CAPA; cvs log -d ">`date --date='8 days ago' \
	+\"%Y-%m-%d\"`" . 2>/dev/null | perl ../loncom/build/cvsfilter.pl >> \
	../doc/build/cvsreport.html
	# Log entries for doc
	echo "</pre></p><p>Log entries for <b>doc</b>:</p><pre>" >> \
	../../doc/build/cvsreport.html
	cd ../../doc; cvs log -d ">`date --date='8 days ago' \
	+\"%Y-%m-%d\"`" . 2>/dev/null | perl ../loncom/build/cvsfilter.pl >> \
	../doc/build/cvsreport.html
	# Log entries for packaging
	echo "</pre></p><p>Log entries for <b>packaging</b>:</p><pre>" >> \
	../../doc/build/cvsreport.html
	cd ../../packaging; cvs log -d ">`date --date='8 days ago' \
	+\"%Y-%m-%d\"`" . 2>/dev/null | perl ../loncom/build/cvsfilter.pl >> \
	../doc/build/cvsreport.html
	echo "</pre></p>" >> ../../doc/build/cvsreport.html

statpage:
	install -d cvsstats
	echo '<html><title>LON-CAPA Coding Metrics</title>' > $(STATSUBDIR)/index.html
	echo '<body bgcolor="#ffffff">' >> $(STATSUBDIR)/index.html
	echo '<h1>LON-CAPA Coding Metrics</h1>' >> $(STATSUBDIR)/index.html
	echo '<br />Compiled as of ' >> $(STATSUBDIR)/index.html
	date >> $(STATSUBDIR)/index.html
	echo '<p>&nbsp;</p>'
	echo '<br />Lines of Code; unique changes per month' >> $(STATSUBDIR)/index.html
	echo '<br />Lines of Code; unique changes (*.pm only) per month' >> $(STATSUBDIR)/index.html
	echo '<br />Lines of Code; aggregating sum of unique changes per month' >> $(STATSUBDIR)/index.html
	echo '<br />Lines of Code; aggregating sum of unique changes (*.pm only) per month' >> $(STATSUBDIR)/index.html
	echo '<br />Number of commits to software repository per month' >> $(STATSUBDIR)/index.html
	echo '<br />Number of commits to software repository (*.pm only) per month' >> $(STATSUBDIR)/index.html
	echo '<br />Aggregating sum of number of commits to software repository per month' >> $(STATSUBDIR)/index.html
	echo '<br />Aggregating sum of number of commits to software repository (*.pm only) per month' >> $(STATSUBDIR)/index.html
	echo '<br /><img src="loc.png" alt="lines of code" />' >> $(STATSUBDIR)/index.html
	echo '<br /><img src="locpm.png" alt="lines of code, perl modules" />' >> $(STATSUBDIR)/index.html
	echo '<br /><img src="locsum.png" alt="aggregate lines of code" />' >> $(STATSUBDIR)/index.html
	echo '<br /><img src="locpmsum.png" alt="aggregate lines of code, perl modules" />' >> $(STATSUBDIR)/index.html
	echo '<br /><img src="commit.png" alt="number of commits" />' >> $(STATSUBDIR)/index.html
	echo '<br /><img src="commitpm.png" alt="number of commits, perl modules" />' >> $(STATSUBDIR)/index.html
	echo '<br /><img src="commitsum.png" alt="aggregate number of commits" />' >> $(STATSUBDIR)/index.html
	echo '<br /><img src="commitpmsum.png" alt="aggregate number of commits, perl modules" />' >> $(STATSUBDIR)/index.html
	echo '</body>' >> $(STATSUBDIR)/index.html
	echo '</html>' >> $(STATSUBDIR)/index.html

linesofcode:
	install -d cvsstats
	# for all, and for .pm
	# get date array
	cd ../..; perl -e ' \
($$begindate,$$enddate)=@ARGV;\
($$by,$$bm,$$bd)=($$begindate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
($$ey,$$em,$$ed)=($$enddate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
for ($$y=$$by; $$y<=$$ey; $$y++) {\
    if ($$y==$$by) {$$m=$$bm;} else {$$m=1;}\
    if ($$y==$$ey) {$$m2=$$em;} else {$$m2=12;}\
    for ($$m; $$m<=$$m2; $$m++) {\
	printf("$$odate\t%4.4d%2.2d%2.2d\n",$$y,$$m,$$bd) if $$odate; \
	$$odate=sprintf("%4.4d%2.2d%2.2d",$$y,$$m,$$bd);\
    }\
}' 20000101 `date +"%Y%m%d"` |\
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
	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
	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/locsum.png"\nset term png color\nplot "cvsstats/table.txt" using 1:3 with lines' | gnuplot
	cd ../..; perl -e ' \
($$begindate,$$enddate)=@ARGV;\
($$by,$$bm,$$bd)=($$begindate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
($$ey,$$em,$$ed)=($$enddate=~/(\d{4,4})(\d{2,2})(\d{2,2})/);\
for ($$y=$$by; $$y<=$$ey; $$y++) {\
    if ($$y==$$by) {$$m=$$bm;} else {$$m=1;}\
    if ($$y==$$ey) {$$m2=$$em;} else {$$m2=12;}\
    for ($$m; $$m<=$$m2; $$m++) {\
	printf("$$odate\t%4.4d%2.2d%2.2d\n",$$y,$$m,$$bd) if $$odate; \
	$$odate=sprintf("%4.4d%2.2d%2.2d",$$y,$$m,$$bd);\
    }\
}' 20000101 `date +"%Y%m%d"` |\
perl -nle '($$d1,$$d2)=split(/\t/);$$loc=`cvs -q diff -D$$d1 -D$$d2 -b -B -N |\
perl -e "\@flag=(1);while(<>){if (/RCS file:/) {\@flag=(); pop \@flag; \@flag=(1) if /^RCS file: .*\.pm\,v/;} print if \@flag;}" |\
 egrep \"^> .*[^ \t]\" | sed \"s/^> //g\" | sort | uniq | wc -l`;chomp $$loc;$$locsum+=$$loc;print "$$d2\t$$loc\t$$locsum";' > $(STATDIR)/tablepm.txt
# process counts, generate table
	# pass table to gnuplot
	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/locpm.png"\nset term png color\nplot "cvsstats/tablepm.txt" using 1:2 with lines' | gnuplot
	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/locpmsum.png"\nset term png color\nplot "cvsstats/tablepm.txt" using 1:3 with lines' | gnuplot

cvscommit:
	# for all, and for .pm
	# get date array
	# process counts, generate table
	# pass table to gnuplot

clean:
	rm -Rf cvsstats




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