rtc: Fix Unix epoch conversion from RTC time.
[pintos-anon] / doc / localcvsinstructions.texi
1 @c
2 @c Instructions on how to set up a group environment, permissions, 
3 @c CVS repository, dealing with local locking issues etc.
4 @c
5 @c While some of the discussion may apply to more than one environment,
6 @c no attempt was made to untangle and split the discussion.
7 @c
8
9 @menu
10 * Setting Up CVS::              
11 * Using CVS::                   
12 * CVS Locking::                 
13 @end menu
14
15 @node Setting Up CVS
16 @subsection Setting Up CVS
17
18 To set up CVS for use with Pintos on the Leland machines, start by
19 choosing one group member as the keeper of the CVS repository.
20 Everyone in the group will be able to use the CVS repository, but the
21 keeper will actually create the repository, keep its files in his or
22 her home directory, and maintain permissions for its contents.
23
24 The keeper has to perform several steps to set up the repository.
25 First, create a new AFS group for the repository by executing
26 @samp{pts creategroup @var{keeper}:pintos-cvs}, where @var{keeper} is
27 the keeper's Leland username.  Then, add each group member to the new
28 group by repeatedly using the command @samp{pts adduser -user
29 @var{username} -group @var{keeper}:pintos-cvs}, where @var{username}
30 is the name of a group member.  After the group is created and its
31 members added, @samp{pts membership @var{keeper}:pintos-cvs} should
32 report that each group member is a member of the
33 @samp{@var{keeper}:pintos-cvs} group.
34
35 The keeper now creates the repository directory and gives the group
36 members access to it.  We will assume that the repository will be in a
37 directory called @file{cvs} in the keeper's home directory.  First
38 create this directory with @samp{mkdir $HOME/cvs}, then give group
39 members access to it with @samp{fs setacl -dir $HOME/cvs -acl
40 @var{keeper}:pintos-cvs write}.  Group members also need to be able to
41 look up the @file{cvs} directory in the keeper's home directory, which
42 can be enabled via @samp{fs setacl -dir $HOME -acl
43 @var{keeper}:pintos-cvs l} (that's letter ``ell,'' not digit
44 ``one.'').@footnote{This command will allow group members to list the
45 files in your home directory, but not read or write them.  It should not
46 create a security risk unless the names of files in your home directory
47 are secret.}
48
49 Now initialize the repository.
50 To initialize the repository, execute @samp{cvs -d $HOME/cvs init}.
51
52 Finally, import the Pintos sources into the newly initialized
53 repository.  If you have an existing set of Pintos sources you want to
54 add to the repository, @samp{cd} to its @samp{pintos} directory now.
55 Otherwise, to import the base Pintos source tree, @samp{cd} to
56 @file{/usr/class/cs140/pintos/pintos} (note the doubled
57 @samp{pintos}).  After changing the current directory, execute this
58 command:
59 @example
60 cvs -d $HOME/cvs import -m "Imported sources" pintos foobar start
61 @end example
62
63 Here is a summary of the commands you have now executed:
64
65 @example
66 pts creategroup @var{keeper}:pintos-cvs
67 pts adduser -user @var{username} -group @var{keeper}:pintos-cvs
68 mkdir $HOME/cvs
69 fs setacl -dir $HOME/cvs -acl @var{keeper}:pintos-cvs write
70 fs setacl -dir $HOME -acl @var{keeper}:pintos-cvs l
71 cvs -d $HOME/cvs init
72 cd /usr/class/cs140/pintos/pintos
73 cvs -d $HOME/cvs import -m "Imported sources" pintos foobar start
74 @end example
75
76 The repository is now ready for use by any group member, as described
77 below.  Keep in mind that the repository should only be accessed
78 using CVS commands---it is not generally useful to examine them by
79 hand, and you should definitely not modify them yourself.
80
81 @node Using CVS
82 @subsection Using CVS
83
84 To use CVS, start by check out a working copy of the contents of the
85 CVS repository into a directory named @file{@var{dir}}.  To do so, execute
86 @samp{cvs -d ~@var{keeper}/cvs checkout -d @var{dir} pintos}, where
87 @var{keeper} is the CVS keeper's Leland username.
88
89 (If this fails due to some kind of permission problem, then run
90 @command{aklog} and try again.  If it still doesn't work, log out and
91 back in.  If that still doesn't fix the problem, the CVS repository may
92 not be initialized properly.)
93
94 At this point, you can modify any of the files in the working copy.
95 You can see the changes you've made with @samp{cvs diff -u}.  If you
96 want to commit these changes back to the repository, making them
97 visible to the other group members, you can use the CVS commit
98 command.  Within the @file{pintos} directory, execute @samp{cvs
99 commit}.  This will figure out the files that have been changed and
100 fire up a text editor for you to describe the changes.  By default,
101 this editor is @file{vi}, but you can select a different editor by
102 setting the @env{CVSEDITOR} environment variable, e.g.@: with
103 @samp{setenv CVSEDITOR emacs} (add this line to your @file{.cvsrc} to
104 make it permanent).
105
106 Suppose another group member has committed changes.  You can see the
107 changes committed to the repository since the time you checked it out
108 (or updated from it) with @samp{cvs diff -u -r BASE -r HEAD}.  You can
109 merge those change into your working copy using @samp{cvs update}.  If
110 any of your local changes conflict with the committed changes, the CVS
111 command output should tell you.  In that case, edit the files that
112 contain conflicts, looking for @samp{<<<} and @samp{>>>} that denote
113 the conflicts, and fix the problem.
114
115 You can view the history of @var{file} in your working directory,
116 including the log messages, with @samp{cvs log @var{file}}.
117
118 You can give a particular set of file versions a name called a
119 @dfn{tag}.  First @samp{cd} to the root of the working copy, then
120 execute @samp{cvs tag @var{name}}.  It's best to have no local changes
121 in the working copy when you do this, because the tag will not include
122 uncommitted changes.  To recover the tagged repository later, use the
123 @samp{checkout} command in the form @samp{cvs -d ~@var{keeper}/cvs
124 checkout -r @var{tag} -d @var{dir} pintos}, where @var{keeper} is the
125 username of the CVS keeper and @var{dir} is the directory to put the
126 tagged repository into.
127
128 If you add a new file to the source tree, you'll need to add it to the
129 repository with @samp{cvs add @var{file}}.  This command does not have
130 lasting effect until the file is committed later with @samp{cvs
131 commit}.
132
133 To remove a file from the source tree, first remove it from the file
134 system with @command{rm}, then tell CVS with @samp{cvs remove
135 @var{file}}.  Again, only @samp{cvs commit} will make the change
136 permanent.
137
138 To discard your local changes for a given file, without committing
139 them, use @samp{cvs update -C @var{file}}.
140
141 To check out a version of your repository as of a particular date, use
142 the command @samp{cvs -d ~@var{keeper}/cvs checkout -D '@var{date}' -d
143 @var{dir} pintos}, where @var{keeper} is the username of the CVS
144 keeper and @var{dir} is the directory to put the tagged repository
145 into..  A typical format for @var{date} is @samp{YYYY-MM-DD HH:MM},
146 but CVS accepts several formats, even something like @samp{1 hour
147 ago}.
148
149 For more information, visit the @uref{https://www.cvshome.org/, , CVS
150 home page}.
151
152 @node CVS Locking
153 @subsection CVS Locking
154
155 You might occasionally see a message like this while using CVS:
156
157 @example
158 waiting for blp's lock in /afs/ir/users/b/l/blp/cvs
159 @end example
160
161 This normally means that more than one user is accessing the repository
162 at the same time.  CVS should automatically retry after 30 seconds, at
163 which time the operation should normally be able to continue.
164
165 If you encounter a long wait for a lock, of more than a minute or so, it
166 may indicate that a CVS command did not complete properly and failed to
167 remove its locks.  If you think that this is the case, ask the user in
168 question about it.  If it appears that an operation did go awry, then
169 you (or the named user) can delete files whose names start with
170 @file{#cvs.rfl}, @file{#cvs.wfl}, or @file{#cvs.lock} in the directory
171 mentioned in the message.  Doing so should allow your operation to
172 proceed.  Do not delete or modify other files.