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