File:  [LON-CAPA] / loncom / build / Makefile.cvs
Revision 1.9: download - view: text, annotated - select for diffs
Mon Feb 3 18:03:52 2003 UTC (21 years, 10 months ago) by harris41
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_99_0, version_2_9_1, version_2_9_0, version_2_8_X, version_2_8_99_1, version_2_8_99_0, version_2_8_2, version_2_8_1, version_2_8_0, version_2_7_X, version_2_7_99_1, version_2_7_99_0, version_2_7_1, version_2_7_0, version_2_6_X, version_2_6_99_1, version_2_6_99_0, version_2_6_3, version_2_6_2, version_2_6_1, version_2_6_0, version_2_5_X, version_2_5_99_1, version_2_5_99_0, version_2_5_2, version_2_5_1, version_2_5_0, version_2_4_X, version_2_4_99_0, version_2_4_2, version_2_4_1, version_2_4_0, version_2_3_X, version_2_3_99_0, version_2_3_2, version_2_3_1, version_2_3_0, version_2_2_X, version_2_2_99_1, version_2_2_99_0, version_2_2_2, version_2_2_1, version_2_2_0, version_2_1_X, version_2_1_99_3, version_2_1_99_2, version_2_1_99_1, version_2_1_99_0, version_2_1_3, version_2_1_2, version_2_1_1, version_2_1_0, version_2_12_X, version_2_11_X, version_2_11_5_msu, version_2_11_5, version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4, version_2_11_3_uiuc, version_2_11_3_msu, version_2_11_3, version_2_11_2_uiuc, version_2_11_2_msu, version_2_11_2_educog, version_2_11_2, version_2_11_1, version_2_11_0_RC3, version_2_11_0_RC2, version_2_11_0_RC1, version_2_11_0, version_2_10_X, version_2_10_1, version_2_10_0_RC2, version_2_10_0_RC1, version_2_10_0, version_2_0_X, version_2_0_99_1, version_2_0_2, version_2_0_1, version_2_0_0, version_1_99_3, version_1_99_2, version_1_99_1_tmcc, version_1_99_1, version_1_99_0_tmcc, version_1_99_0, version_1_3_X, version_1_3_3, version_1_3_2, version_1_3_1, version_1_3_0, version_1_2_X, version_1_2_99_1, version_1_2_99_0, version_1_2_1, version_1_2_0, version_1_1_X, version_1_1_99_5, version_1_1_99_4, version_1_1_99_3, version_1_1_99_2, version_1_1_99_1, version_1_1_99_0, version_1_1_3, version_1_1_2, version_1_1_1, version_1_1_0, version_1_0_99_3, version_1_0_99_2, version_1_0_99_1, version_1_0_99, version_1_0_3, version_1_0_2, version_1_0_1, version_1_0_0, version_0_99_5, version_0_99_4, version_0_99_3, version_0_99_2, version_0_99_1, version_0_99_0, loncapaMITrelate_1, language_hyphenation_merge, language_hyphenation, conference_2003, bz6209-base, bz6209, bz5969, bz5610, bz2851, PRINT_INCOMPLETE_base, PRINT_INCOMPLETE, HEAD, GCI_3, GCI_2, GCI_1, BZ5971-printing-apage, BZ5434-fox, BZ4492-merge, BZ4492-feature_horizontal_radioresponse, BZ4492-feature_Support_horizontal_radioresponse, BZ4492-Support_horizontal_radioresponse
best wishes to all.

# The LearningOnline Network with CAPA

# $Id: Makefile.cvs,v 1.9 2003/02/03 18:03:52 harris41 Exp $

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

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 "statpage: an HTML formatted presentation of cvscommit and"
	@echo "          linesofcode"
	@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='$(TIMEAGO) 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='$(TIMEAGO) days ago' +\"%Y-%m-%d\"`" \
	loncom CAPA doc 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='$(TIMEAGO) days ago' +\"%Y-%m-%d\"`" \
	loncom CAPA doc 2>/dev/null | \
	perl loncom/build/cvsfilter.pl | grep '^Working file:' | cut -b15- \
	>> doc/build/cvsreport.html
	echo "</pre></p>" >> ../../doc/build/cvsreport.html
	make -f Makefile.cvs COMPONENT=loncom logentries
	make -f Makefile.cvs COMPONENT=CAPA logentries
	make -f Makefile.cvs COMPONENT=doc logentries

logentries:
	# Log entries for $(COMPONENT)
	echo "<p>Log entries for <b>$(COMPONENT)</b>:</p><pre>" >>\
	../../doc/build/cvsreport.html
	cd ../../$(COMPONENT); cvs log -d ">`date --date='$(TIMEAGO) 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 $(STATSUBDIR)
	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>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
	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
	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
	echo '<br /><a href="#loc">Lines of Code; unique changes per month</a>' >> $(STATSUBDIR)/index.html
	echo '<br /><a href="#locsum">Lines of Code; aggregate sum of unique changes per month</a>' >> $(STATSUBDIR)/index.html
	echo '<br /><a href="#commit">Number of commits to software repository per month</a>' >> $(STATSUBDIR)/index.html
	echo '<br /><a href="#commitsum">Aggregate sum of number of commits to software repository per month</a>' >> $(STATSUBDIR)/index.html
	echo '<hr /><a name="loc"><h3>Lines of Code</h3>' >> $(STATSUBDIR)/index.html
	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
	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 '<hr /><a name="locsum"><h3>Aggregate Lines of Code</h3>' >> $(STATSUBDIR)/index.html
	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
	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 '<hr /><a name="commit"><h3>Commits to Repository</h3>' >> $(STATSUBDIR)/index.html
	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
	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 '<hr /><a name="commitsum"><h3>Aggregate Commits to Repository</h3>' >> $(STATSUBDIR)/index.html
	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
	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\\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
	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, 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
	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

cvscommit:
	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/);$$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
	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
	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
	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/);$$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
# 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 "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
	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

clean:
	rm -Rf cvsstats




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