<html>
<head>
<title>Software Review</title>
</head>
<body>
<h1>Submitting software patches</h1>
<p>
The system works, yet there remains much tweaking to do.
</p>
<p>
<img src='sharetweaks.gif' />
</p>
<h3>General Guidelines</h3>
<ol>
<li>submit patches to <tt>albertel@msu.edu</tt></li>
<li>patches must be a unified diff format (-u)</li>
<li>should be against a specific CVS tag (like HEAD, or when we get to
releases, the most recent *_RELEASE tag)</li>
<li>should contain a description of bugs they fix or functionality they
add</li>
<li>try to make each patch as _targetted_ as possible. (Fix 1 bug, or
add 1 feature) to make it easier to see what is going on.</li>
<li>Large functionality changes should probably get some discussion on
the mailing list before being submitted.</li>
</ol>
<h3>Example Scenario</h3>
<table border=1><tr><td>
<p>
<b>Large functionality changes should probably get some discussion on
the mailing list before being submitted.</b>
</p>
<p>
A fictional Dr. Sherbert is writing a handler to display web statistics
(information present in /var/log/httpd/access.log). Here is
a list of e-mails and commands which take place.
</p>
<p>
Dr. Sherbert e-mails the list with his idea
<pre>
<b>sherbert %></b> mail lon-capa@hobbes.lite.msu.edu
Hi,
I want to create a handler to show web statistics (hits
per hour, IP addresses, most popular URLs, hits per day,
etc). This would provide data I can show the
administration as well as helping me better monitor
how adequately my server cluster is performing.
I plan on calling this handler lonapachestat.pm, associating
with apachestat, and available only to those with roles (see
roles.tab and rolesplain.tab) of "gan=generating anonymous
statistics". I would make appropriate changes to
/etc/httpd/conf/srm.conf
-Bert
</pre>
</p>
<p>
Two others respond on the mailing list.
<pre>
<b>gwynne %></b> mail lon-capa@hobbes.lite.msu.edu
Bert,
I like that idea, but don't you think that this is
better handled as a batch-cron job? Why not have
these statistics compiled every day? I think
SOURCE="loncom/cron/loncapa" TARGET="etc/cron.d/loncapa"
handles this. Also, I assume you mean associating
with the location http://MACHINENAME/adm/lonapachestat.
Gwynne
<b>godfried %></b> mail lon-capa@hobbes.lite.msu.edu
Bert,
This would be of immense help to some questions I have.
I want to be able to "play-back" what each user session
is doing for my course. Also, if a student e-mails me,
I want to be able to see where in the course sequence
the student was working. I would need the statistics calculated
dynamically as opposed to a batch process.
Godfried
</pre>
</p>
<p>
After more discussion, Dr. Sherbert's idea is accepted.
</p>
</td></tr></table>
<p>
</p>
<table border=1><tr><td>
<p>
<b>PATCHING /etc/httpd/conf/srm.conf</b>
</p>
<p>
<b>submit patches to <tt>albertel@msu.edu</tt></b>
<br /><b>patches must be a unified diff format (-u)</b>
<br /><b>should be against a specific CVS tag (like HEAD, or when we get to
releases, the most recent *_RELEASE tag)</b>
<br /><b>should contain a description of bugs they fix or functionality they
add</b>
<br /><b>try to make each patch as _targetted_ as possible. (Fix 1 bug, or
add 1 feature) to make it easier to see what is going on.</b>
</p>
<p>
Dr. Sherbert wants to alter the web server configuration so that
whenever http://MACHINENAME/apachestat is requested, the lonapachestat.pm
handler is called.
</p>
<p>
To do this, he needs to alter srm.conf. After setting up CVS
and checking out LON-CAPA (cvs co loncapa), he needs to find srm.conf
in the CVS source repository.
</p>
<pre>
[sherbert@morphy1 loncapa]$ find . -type f | grep srm.conf
./loncom/srm.conf
[sherbert@morphy1 loncapa]$
</pre>
<p>
Dr. Sherbert sees the following section of code in srm.conf.
<pre>
# -------------------------------------------------------------- Admin Programs
<Location /adm/roles>
PerlAccessHandler Apache::lonacc
SetHandler perl-script
PerlHandler Apache::lonroles
ErrorDocument 403 /adm/login
ErrorDocument 500 /adm/errorhandler
</Location>
<Location /adm/login>
SetHandler perl-script
PerlHandler Apache::lonlogin
</Location>
<Location /adm/logout>
PerlAccessHandler Apache::lonacc
SetHandler perl-script
PerlHandler Apache::lonlogout
ErrorDocument 403 /adm/login
</Location>
</pre>
</p>
<p>
Dr. Sherbert then adds in his handler.
</p>
<pre>
# -------------------------------------------------------------- Admin Programs
<Location /adm/apachestat>
PerlAccessHandler Apache::lonacc
SetHandler perl-script
PerlHandler Apache::lonapachestat
ErrorDocument 403 /adm/login
ErrorDocument 500 /adm/errorhandler
</Location>
<Location /adm/roles>
PerlAccessHandler Apache::lonacc
SetHandler perl-script
PerlHandler Apache::lonroles
ErrorDocument 403 /adm/login
ErrorDocument 500 /adm/errorhandler
</Location>
<Location /adm/login>
SetHandler perl-script
PerlHandler Apache::lonlogin
</Location>
<Location /adm/logout>
PerlAccessHandler Apache::lonacc
SetHandler perl-script
PerlHandler Apache::lonlogout
ErrorDocument 403 /adm/login
</Location>
</pre>
<p>
Dr. Sherbert then creates a unified diff format of his changes
against the HEAD (current) release.
<pre>
[sherbert@morphy1]$ cd loncapa/loncom
[sherbert@morphy1]$ cvs diff -U 3 -r HEAD srm.conf
Index: srm.conf
===================================================================
RCS file: /home/cvs/loncom/srm.conf,v
retrieving revision 1.14
diff -U3 -r1.14 srm.conf
--- srm.conf 2001/05/15 12:35:07 1.14
+++ srm.conf 2001/05/19 13:14:53
@@ -353,6 +353,14 @@
# -------------------------------------------------------------- Admin Programs
+<Location /adm/apachestat>
+PerlAccessHandler Apache::lonacc
+SetHandler perl-script
+PerlHandler Apache::lonapachestat
+ErrorDocument 403 /adm/login
+ErrorDocument 500 /adm/errorhandler
+</Location>
+
<Location /adm/roles>
PerlAccessHandler Apache::lonacc
SetHandler perl-script
</pre>
</p>
<p>
Dr. Sherbert e-mails his patch to Guy.
<pre>
[sherbert@morphy1]$ cvs diff -U 3 -r HEAD srm.conf | mail -s 'patch to\
srm.conf to add adm/apachestat handling with lonapachestat.pm'\
albertel@msu.edu
</pre>
</p>
<p>
Guy responds
<pre>
Bert,
Your change was checked into the LON-CAPA system. Thanks!
-Guy
</pre>
</p>
Dr. Sherbert did the following right things.
<ul>
<li>he described the fix in his mail message
<br>patch to srm.conf to add adm/apachestat handling with lonapachestat.pm</li>
<li>his submitted change fixed 1 bug/feature</li>
<li>he created a unified diff format for his patch</li>
</ul>
</pre>
</p>
</td></tr></table>
</body>
</html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>