[project @ 2000-10-12 15:33:47 by rrt]
[ghc-hetmet.git] / docs / cvs-cheat-sheet.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <html>
3
4 <head>
5 <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
6 <meta NAME="GENERATOR" CONTENT="Microsoft FrontPage 3.0">
7 <title>Access To The GHC CVS Repository</title>
8 </head>
9
10 <body TEXT="#2C3361" BGCOLOR="#FFFFFF" ALINK="#11BBFF">
11
12 <h1><b>FP Tools CVS Cheat Sheet</b></h1>
13
14 <p>We use CVS (Concurrent Version System) to keep track of our sources for various
15 software projects. CVS lets several people work on the same software at the same time,
16 allowing changes to be checked in incrementally. </p>
17
18 <p>Information on using CVS can be obtained from <a HREF="http://www.cyclic.com">Cyclic
19 Software</a>. </p>
20
21 <p>This note is supposed to be a set of guidelines for how to use our CVS repository, and
22 will probably evolve in time. The main thing to remember is that most mistakes can be
23 undone, but if there's anything you're not sure about feel free to bug the local CVS
24 meister (namely <a HREF="mailto:jlewis@cse.ogi.edu">Jeff Lewis</a>). </p>
25
26 <p><b>Contents</b> 
27
28 <ul>
29   <li><a HREF="#read-only">Read-only remote access</a></li>
30   <li><a HREF="#read-write">Read-write remote access</a></li>
31   <li><a HREF="#first">Using CVS for the first time</a></li>
32   <li><a HREF="#checkout">Checking out a source tree</a></li>
33   <li><a HREF="#commit">Committing changes</a></li>
34   <li><a HREF="#update">Updating your source tree</a></li>
35   <li><a HREF="#hints">General Hints</a></li>
36 </ul>
37
38 <h2><a NAME="read-only"></a><b>Remote Read-only CVS Access</b></h2>
39
40 <p>Read-only access is available to anyone - there's no need to ask us first. To get
41 read-only access to our repository:
42
43 <ul>
44   <li>set your CVSROOT environment variable to <tt>:pserver:anoncvs@glass.cse.ogi.edu:/cvs</tt></li>
45   <li>The first time you access the repository, you'll need to do <tt>cvs login</tt>.&nbsp;
46     The password is simply <tt>cvs</tt>.&nbsp; This sets up a file in your home directory
47     called <tt>.cvspass</tt>, which squirrels away the dummy password, so you only need to do
48     this step one time.</li>
49   <li>Now, you can check out a source tree using normal CVS commands. For example:</li>
50   <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ cvs checkout fpconfig
51 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ cd fptools
52 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ cvs checkout ghc</pre>
53   <p>gets a brand spanking new set of GHC sources.</p>
54 </ul>
55
56 <p>The layout of our CVS repository is described below, under <a HREF="#first">Using CVS
57 for the first time</a>. </p>
58
59 <p>With read-only CVS access you can do anything except commit changes to the repository.
60 You can make changes to your local tree, and still use CVS's merge facility to keep your
61 tree up to date, and you can generate patches using 'cvs diff' in order to send to us for
62 inclusion. </p>
63
64 <h2><a NAME="read-write"></a><b>Remote Read-Write CVS Access</b></h2>
65
66 <p>We generally supply read-write access to folk doing serious development on some part of
67 the source tree, when going through us would be a pain. If you're developing some feature,
68 or think you have the time and inclination to fix bugs in our sources, feel free to ask
69 for read-write access. There is a certain amount of responsibility that goes with commit
70 privileges; we are more likely to grant you access if you've demonstrated your competence
71 by sending us patches via mail in the past. </p>
72
73 <p>To use remote CVS, you need to supply me with a username and
74 encrypted password. Once you've done that and the account on
75 cvs.haskell.org has been set up, you need to install <a
76 HREF="http://www.ssh.fi/">ssh</a>, which is relatively painless.  Log
77 in to cvs.haskell.org, and set up your <tt>.ssh/authorized_keys</tt>
78 file to allow logins from your local machine without a password (the
79 ssh documentation has details on how to do this).  Then, just
80
81 <ul>
82   <li> set your <tt>CVSROOT</tt> environment variable to <tt>:ext:&lt;username&gt;@cvs.haskell.org:/home/cvs/root</tt>.
83   </li>
84   <li>set your<tt> CVS_RSH </tt>environment variable to <tt>ssh</tt>.</li>
85 </ul>
86
87 <p>The <tt>CVSROOT</tt> environment variable will be recorded in the checked-out tree, so
88 you don't need to set this every time either. Ignore the instructions for setting <tt>CVSROOT</tt>
89 below. </p>
90 <b>
91
92 <p>Caveats:</b> 
93
94 <ul>
95   <li>Setting your <tt>CVS_RSH</tt> to <tt>ssh</tt> assumes that your CVS client understands
96     how to execute shell script (&quot;#!&quot;s,really), which is what <tt>ssh</tt> is. This
97     may not be the case on some platforms (read: Win32), so in that case set <tt>CVS_RSH</tt>
98     to <tt>ssh1</tt>.</li>
99 </ul>
100
101 <h2><a NAME="first"></a><b>Using CVS for the First Time</b></h2>
102
103 <ul>
104   <li>(ok, everybody now...) Firstly, identify which areas of the source tree you'll be
105     working on. The directory structure looks like this:</li>
106   <div align="center"><center><table>
107     <tr>
108       <td>fptools/ghc&nbsp;</td>
109       <td>GHC</td>
110     </tr>
111     <tr>
112       <td>fptools/happy&nbsp;</td>
113       <td>Happy</td>
114     </tr>
115     <tr>
116       <td>fptools/green-card&nbsp;</td>
117       <td>Green Card</td>
118     </tr>
119     <tr>
120       <td>fptools/nofib&nbsp;</td>
121       <td>Nofib test suite</td>
122     </tr>
123     <tr>
124       <td>fptools/hdirect&nbsp;</td>
125       <td>IDL-to-Haskell compiler</td>
126     </tr>
127   </table>
128   </center></div><p>For each directory, there's a mailing list: <tt>cvs-ghc</tt>, <tt>cvs-nofib</tt>
129   etc. Everyone on the mailing list is sent a message automatically by CVS whenever someone
130   checks in a change, this helps to keep track of what's going on when several people are
131   working on related stuff. To join any of these mailing lists, mail <a
132   href="mailto:majordomo@haskell.org">majordomo@haskell.org</a>. </p>
133   <li>Create a .cvsrc file. Mine looks like this:</li>
134   <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; checkout -P
135 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; release -d
136 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; update -P
137 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; diff -c</pre>
138   <p>It just gives default flags for some of the CVS commands. For instance, the -P flag to
139   'checkout' says prune empty directories, which is normally what you want.</p>
140 </ul>
141
142 <h2><a NAME="checkout"></a><b>Checking Out a Source Tree</b></h2>
143
144 <ul>
145   <li>Check out your sources. Make sure you set your <tt>CVSROOT</tt> environment variable
146     according to either of the remote methods above. The Approved Way (at least by me) to
147     check out a source tree is as follows:</li>
148   <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ cvs checkout fpconfig</pre>
149   <p>At this point you have a new directory called 'fptools' which contains the basic stuff
150   for the fptools suite - including the configuration files and some other junk. </p>
151   <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ mv fptools &lt;directory&gt;</pre>
152   <p>You can call the fptools directory whatever you like, CVS won't mind. </p>
153   <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ cd &lt;directory&gt;
154 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ cvs checkout ghc happy</pre>
155   <p>The second command here checks out the relevant modules you want to work on. For a GHC
156   build, for instance, you need at least the <tt>ghc</tt> module (in fact you can get away
157   with just that).</p>
158 </ul>
159
160 <h2><a NAME="commit"></a><b>Committing Your Changes</b></h2>
161
162 <p>This is only if you have read-write access to the repository. For anoncvs users, CVS
163 will issue a &quot;read-only repository&quot; error if you try to commit changes. 
164
165 <ul>
166   <li>Build the software, if necessary. Unless you're just working on documentation, you'll
167     probably want to build the software in order to test any changes you make. For GHC,
168     instructions can be found in the GHC installation guide.</li>
169   <li>Make changes. Preferably small ones first.</li>
170   <li>Test them. You can see exactly what changes you've made by using the <tt>cvs diff</tt>
171     command. For example, <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ cvs diff</pre>
172     <p>lists all the changes (using the <tt>diff</tt> command) in and below the current
173     directory. In emacs, C-c C-v C-= runs <tt>cvs diff</tt> on the current buffer and shows
174     you the results.</p>
175   </li>
176   <li>Before checking in a change, you need to update your source tree:</li>
177   <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ cd fptools
178 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ cvs update</pre>
179   <p>This pulls in any changes that other people have made, and merges them with yours. If
180   there are any conflicts, CVS will tell you, and you'll have to resolve them before you can
181   check your changes in. The documentation describes what to do in the event of a conflict. </p>
182   <p>It's not always necessary to do a full cvs update before checking in a change, since
183   CVS will always tell you if you try to check in a file that someone else has changed.
184   However, you should still update at regular intervals to avoid making changes that don't
185   work in conjuction with changes that someone else made. Keeping an eye on what goes by on
186   the mailing list can help here. <br>
187   &nbsp; <br>
188   &nbsp; </p>
189   <li>When you're happy that your change isn't going to break anything, check it in. For a
190     one-file change:</li>
191   <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ cvs commit &lt;filename&gt;</pre>
192   <p>CVS will then pop up an editor for you to enter a &quot;commit message&quot;, this is
193   just a short description of what your change does, and will be kept in the history of the
194   file. </p>
195   <p>If you're using emacs, simply load up the file into a buffer and type C-x C-q, and
196   emacs will prompt for a commit message and then check in the file for you. </p>
197   <p>For a multiple-file change, things are a bit trickier. There are several ways to do
198   this, but this is the way I find easiest. First type the commit message into a temporary
199   file. Then either </p>
200   <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ cvs commit -F &lt;commit-message&gt; &lt;file_1&gt; .... &lt;file_n&gt;</pre>
201   <p>or, if nothing else has changed in this part of the source tree, </p>
202   <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ cvs commit -F &lt;commit-message&gt; &lt;directory&gt;</pre>
203   <p>where &lt;directory&gt; is a common parent directory for all your changes, and
204   &lt;commit-message&gt; is the name of the file containing the commit message. </p>
205   <p>Shortly afterwards, you'll get some mail from the relevant mailing list saying which
206   files changed, and giving the commit message. For a multiple-file change, you should still
207   get only *one* message.</p>
208 </ul>
209
210 <h2><a NAME="update"></a><b>Updating Your Source Tree</b></h2>
211
212 <p>It can be tempting to cvs update just part of a source tree to bring in some changes
213 that someone else has made, or before committing your own changes. This is NOT
214 RECOMMENDED! Quite often changes in one part of the tree are dependent on changes in
215 another part of the tree (the <tt>mk/*.mk</tt> files are a good example where problems
216 crop up quite often). Having an inconsistent tree is a major cause of headaches. </p>
217
218 <p>So, to avoid a lot of hassle, follow this recipe for updating your tree: </p>
219
220 <pre>$ cd fptools
221 $ cvs update -Pd 2&gt;&amp;1 | tee log</pre>
222
223 <p>Look at the log file, and fix any conflicts (denoted by a 'C' in the first column). If
224 you're using multiple build trees, then for every build tree you have pointing at this
225 source tree, you need to update the links in case any new files have appeared: </p>
226
227 <pre>$ cd &lt;build-tree&gt;
228 $ lndir &lt;source-tree&gt;</pre>
229
230 <p>Some files might have been removed, so you need to remove the links pointing to these
231 non-existent files: </p>
232
233 <pre>$ find . -xtype l -exec rm '{}' \;</pre>
234
235 <p>And finally, re-configure to take into accound any changes in mk/config.mk.in. </p>
236
237 <pre>$ ./configure</pre>
238
239 <p>To be *really* safe, you should do </p>
240
241 <pre>$ gmake boot &amp;&amp; gmake all</pre>
242
243 <p>from the top-level, to update the dependencies and build any changed files. </p>
244
245 <h2><a NAME="tags"></a><b>GHC Tag Policy</b></h2>
246
247 If you want to check out a particular version of GHC, you'll need to
248 know how we tag versions in the repository.  The policy (as of 4.04)
249 is:
250
251 <ul>
252    <li> The tree is branched before every major release.  The branch
253    tag is <tt>ghc-x-xx-branch</tt>, where <tt>x-xx</tt> is the version
254    number of the release with the <tt>'.'</tt> replaced by a
255    <tt>'-'</tt>.  For example, the 4.04 release lives on
256    <tt>ghc-4-04-branch</tt>.</li>
257
258    <li> The release itself is tagged with <tt>ghc-x-xx</tt> (on the
259    branch).  eg. 4.06 is called <tt>ghc-4-06</tt>.</li>
260
261    <li> We didn't always follow these guidelines, so to see what tags
262    there are for previous versions, do <tt>cvs log</tt> on a file
263    that's been around for a while (like <tt>fptools/ghc/README</tt>).
264 </ul>
265
266 So, to check out a fresh GHC 4.06 tree you would do:
267
268 <pre>
269      $ cvs co -r ghc-4-06 fpconfig
270      $ cd fptools
271      $ cvs co -r ghc-4-06 ghc hslibs
272 </pre>
273
274
275 <h2><a NAME="hints"></a><b>General Hints</b></h2>
276
277 <ul>
278   <li>As a general rule: commit changes in small units, preferably addressing one issue or
279     implementing a single feature. Provide a descriptive log message so that the repository
280     records exactly which changes were required to implement a given feature/fix a bug. I've
281     found this *very* useful in the past for finding out when a particular bug was introduced:
282     you can just wind back the CVS tree until the bug disappears.</li>
283   <li>Keep the sources at least *buildable* at any given time. No doubt bugs will creep in,
284     but it's quite easy to ensure that any change made at least leaves the tree in a buildable
285     state. We do nightly builds of GHC to keep an eye on what things work/don't work each day
286     and how we're doing in relation to previous verions. This idea is truely wrecked if the
287     compiler won't build in the first place!</li>
288   <li>To check out extra bits into an already-checked-out tree, use the following procedure.
289     Suppose you have a checked-out fptools tree containing just ghc, and you want to add nofib
290     to it:</li>
291   <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cd fptools
292 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cvs checkout nofib</pre>
293   <p>or: </p>
294   <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cd fptools
295 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cvs update -d nofib</pre>
296   <p>(the -d flag tells update to create a new directory). If you just want part of the
297   nofib suite, you can do </p>
298   <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cd fptools
299 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cvs checkout nofib/spectral</pre>
300   <p>This works because <tt>nofib</tt> is a module in its own right, and spectral is a
301   subdirectory of the nofib module. The path argument to checkout must always start with a
302   module name. There's no equivalent form of this command using <tt>update</tt>.</p>
303 </ul>
304
305 <h2>Reporting Bugs in the CVS sources</h2>
306
307 <p> If you are reporting a bug or infelicity in the CVS version of
308 GHC, please send your message to </p>
309
310 <table align="center">
311 <tr><td>
312         <a href="mailto:cvs-ghc@haskell.org">cvs-ghc@haskell.org</a><td></td>
313 </td></tr>
314 <tr><td>
315         <a href="mailto:cvs-hslibs@haskell.org">cvs-hslibs@haskell.org</a> 
316         <td>(for hslibs/ stuff)</td>
317 </td></tr>
318 <tr><td>
319         <a href="mailto:cvs-nofib@haskell.org">cvs-nofib@haskell.org</a>
320         <td>(for nofib/ stuff)</td>
321 </td></tr>
322 </table>
323
324 <p>(not to glasgow-haskell-bugs).   Two reasons:</p>
325
326 <ul>
327 <li> Readers of glasgow-haskell-bugs will get less junk mail</li>
328
329 <li> I'm a little worried that ghc-bugs readers are beginning to think
330   "is ghc really this unreliable?"!    The checked-in-last-night version
331   of GHC just isn't going to be solid.  No one expects it to be.  But
332   a casual reader might not distinguish.</li>
333 </ul>
334
335 <p>Please don't stop sending bug reports though.  They are really useful.</p>
336
337 <hr>
338
339 <p>Ok, that'll do for now. If there's anything else you'd like to see
340 in this file, just let us know. </p>
341
342 <table>
343   <tr>
344     <td><a HREF="mailto:jlewis@cse.ogi.edu">Jeff Lewis</a> </td>
345   </tr>
346   <tr>
347     <td><a HREF="mailto:simonm@dcs.gla.ac.uk">Simon Marlow</a> </td>
348   </tr>
349 </table>
350 </body>
351 </html>