1: # The LearningOnline Network with CAPA
2:
3: # Scott Harrison
4: # $Id: Makefile.cvs,v 1.8 2002/06/02 04:39:34 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 "statpage: an HTML formatted presentation of cvscommit and"
18: @echo " linesofcode"
19: @echo "Information is placed inside CVS:loncom/build/cvsstats"
20:
21: cvsreport:
22: # Header
23: echo "<h1>Automatically generated CVS report</h1>" > \
24: ../../doc/build/cvsreport.html
25: # General Date Info
26: echo "<h1>LON-CAPA Software Changes from \
27: `date --date='$(TIMEAGO) days ago' \
28: +\"%Y-%m-%d\"` to `date +\"%Y-%m-%d\"`</h1>" >> \
29: ../../doc/build/cvsreport.html
30: # General Alteration Info
31: echo "<p>Number of altered files:" >> ../../doc/build/cvsreport.html
32: cd ../..; cvs log \
33: -d ">`date --date='$(TIMEAGO) days ago' +\"%Y-%m-%d\"`" \
34: loncom CAPA doc 2>/dev/null | perl \
35: loncom/build/cvsfilter.pl | grep '^Working file:' | cut -b15- | \
36: wc -l >> doc/build/cvsreport.html
37: # Listing of Altered Files
38: echo "</p><p>Altered files:</p><p><pre>" >> \
39: ../../doc/build/cvsreport.html
40: cd ../..; cvs log \
41: -d ">`date --date='$(TIMEAGO) days ago' +\"%Y-%m-%d\"`" \
42: loncom CAPA doc 2>/dev/null | \
43: perl loncom/build/cvsfilter.pl | grep '^Working file:' | cut -b15- \
44: >> doc/build/cvsreport.html
45: echo "</pre></p>" >> ../../doc/build/cvsreport.html
46: make -f Makefile.cvs COMPONENT=loncom logentries
47: make -f Makefile.cvs COMPONENT=CAPA logentries
48: make -f Makefile.cvs COMPONENT=doc logentries
49:
50: logentries:
51: # Log entries for $(COMPONENT)
52: echo "<p>Log entries for <b>$(COMPONENT)</b>:</p><pre>" >>\
53: ../../doc/build/cvsreport.html
54: cd ../../$(COMPONENT); cvs log -d ">`date --date='$(TIMEAGO) 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:
60: install -d $(STATSUBDIR)
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
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> </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> </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
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
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
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
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
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
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
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
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
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
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
130:
131: cvscommit:
132: install -d cvsstats
133: # for all, and for .pm
134: # get date array
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
164: # pass table to 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\\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
167:
168: clean:
169: rm -Rf cvsstats
170:
171:
172:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>