Initial commit
[clearscm.git] / web / sysadm / env / index.php
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2    "http://www.w3.org/TR/html4/strict.dtd">
3 <html>
4 <head>
5   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6   <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
7
8   <title>ClearSCM: Environment</title>
9
10   <link rel="stylesheet" type="text/css" media="screen" href="/css/Article.css">
11   <link rel="stylesheet" type="text/css" media="screen" href="/css/Code.css">
12   <link rel="stylesheet" type="text/css" media="print"  href="/css/Print.css">
13   <link rel="SHORTCUT ICON" href="http://clearscm.com/favicon.ico" type="image/png">
14
15   <!-- Google Analytics
16   <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
17   </script>
18   <script type="text/javascript">
19     _uacct = "UA-89317-1";
20     urchinTracker ();
21   </script>
22   Google Analytics -->
23
24   <?php
25   include "php/clearscm.php";
26   menu_css ();
27   ?>
28 </head>
29
30 <body>
31
32 <?php heading ();?>
33
34 <div id="page">
35   <div id="content">
36
37 <h2>Your Environment Can Make or Break You</h2>
38
39 <p>It's often no wonder that mere morals shudder at the site of a
40 command prompt and scream bloody murder when asked to drop into the
41 command line. It's a baren and unfamilar place for most people filled
42 with all the potential pitfalls of actually getting work done! But it
43 doesn't have to be that way.</p>
44
45 <p>Indeed the basic shell presented by Unix, and Windows for that
46 matter, is pretty bleak, harsh and forboding configured with default
47 settings. But shells and shell languages are wonderfully configureable
48 and customizable as well as extremely powerful. Often error messages
49 come out in command line executions that are never caught by the GUIs
50 and displayed. And you can often get and manipulate a lot of
51 information given the rich set of commands and piping techniques
52 afforded by most modern shells. Nevermind you can easily set up quick
53 loops to itterate through the information in ways that will quite
54 frankly dazzle your friends... well your geek friends at least.</p>
55
56 <p>All that said this document is to describe a set of start up
57 scripts that I've developed over the years that I find extremely
58 useful. The environment is easily installable yet quite sophisticated
59 at the same time.</p>
60
61 <blockquote><b>Note:</b> For Windows I use Cygwin as it provides a
62 full, Linux like environment such that most stuff runs the same on
63 Unix, FreeBSD, Solaris, Linux and Windows without change. There are
64 additional <a href="#Cygwin Tweaks">Cygwin Tweaks</a> to be described
65 later that make the Windows environment further normalized and make
66 productived.</blockquote>
67
68 <h3>The Package</h3>
69
70 <p>For quite some time now I have packaged up my stuff to reside under
71 ~/.rc. This allows me to easily grep for the occurances of things in
72 one convienent place. I've even places my XEmacs customizations under
73 ~/.rc too. All of this is in CVS on my corporate site and I keep
74 things up to date and documented there. You can obtain the package as
75 a tarball <a href="/clearenv.tar.gz">clearenv.tar.gz</a>. Unpack the
76 tar image and simply run ~/.rc/setup_rc:</p>
77
78 <div class="code">$ cd ~
79 $ tar -zxf rc.tar.gz
80 $ .rc/setup_rc
81 $
82 </div>
83
84 <h3>History</h3>
85
86 <p>Full version history can be viewed <a
87 href="http://clearscm.com/viewvc/clearscm.com/rc/">here</a>.</p>
88
89 <p>I now have separated out client customizations, i.e. startup
90 functionality particular to different clients or employers, into the
91 ~/.rc/client_scripts directory. The start up scripts will source all
92 executable scripts under that directory.</p>
93
94 <p>A set of Clearcase functions exist under ~/.rc/clearcase and a set
95 of Multisite scripts under ~/.rc/multisite. By and large these serve
96 to set up the Clearcase environment and mostly change common Clearcase
97 commands from cleartool lsview to simply lsview. Where appropriate
98 additional functionality has been added such as lsview &lt;part of
99 view name&gt; which effectively does a cleartool lsview piped to grep
100 to find views with &lt;part of view name&gt; in their names. An lsview
101 by itself will do cleartool lsview piped to your $PAGER and lsviews
102 will generate a list of views useful in constructs such as:</p>
103
104 <div class="code">$ for view in $(lsviews); do
105 >   echo "Processing view $view"
106 >   # Do some thing with $view
107 > done
108 </div>
109
110 <p>Other functions are provided like cm (an alias for cleartool -
111 stands for configuration management), cdiff (do a clearcase diff),
112 clist (list all checkouts), etc. Note this has been named cm because
113 I'm starting to integrate other CM systems such as CVS. So a cdiff
114 does a cleartool diff if we are on a machine that has Clearcase
115 whereas if we are in a diretory that has a CVS directory a cvs diff
116 will be done instead. Similarly clist works for both CM systems
117 too. Further development of this is ongoing.</p>
118
119 <p>Finally there are some environment variables that are available for
120 handy reference such as $RGY which points to where the Clearcase
121 registry files are, etc.</p>
122
123 <h3>Functions</h3>
124
125 <p>Most shell functions are defined in ~/.rc/functions. Most of these
126 functions deal with setting it up such that the title bar of the
127 terminal contains an indication of whether or not you are in a view or
128 a cvs work area, what portion of the vob or directory you are
129 currently in and whether or not you are root (called Wizard). These
130 functions seek to maintain the proper titlebar such that if you say
131 ssh'ed to another machine the titlebar would change - if you exit that
132 ssh session the titlebar should change back.</p>
133
134 <p>Another handy function is sj - stands for Show Job. It's basically
135 a ps -ef | grep -i &lt;str&gr;. How many times to do you that? Why not
136 make it shorter? There is also user and group functions which
137 essentially do ypcat [passwd|group] | grep -i &lt;str&gt;. This allows
138 you to easily search the passwd and group NIS maps (Note I have not
139 implemented this for Windows yet but the thought would be to make it
140 function the same).</p>
141
142 <h3>bash_login</h3>
143
144 <p>This whole start up environment is oriented for the bash(1)
145 shell. It used to be ksh(1) but I've moved on to bash. As such the
146 ~/.rc/base_login is where most stuff gets sourced and set up. It also
147 mitigates some of the differences between the various supported OSes
148 as well as sets up aliases, etc.</p>
149
150 <h3>set_path</h3>
151
152 <p>This script sets up the PATH from scratch. The idea was if your
153 PATH ever gets hosed you can get it all back with
154 ~/.rc/set_path. There is a list of paths to places where applications
155 may or may not exist. These are fed into a function that appends to
156 the PATH variable but only if the directory actually exists. So while
157 you might see /usr/local/mysql/bin but not have mysql installed, the
158 append_to_path function will recognize that /usr/local/mysql/bin does
159 not exist and not append it to the path.</p>
160
161 <a name="Cygwin Tweaks"></a><h3>Cygwin Tweaks</h3>
162
163 <p>In order to help out the start up scripts I mount the Clearcase
164 view drive (by default M) to /view. Now /view/&lt;viewname&gt; is the
165 same between Unix and Cygwin. Also I mount C:\Program Files ->
166 /apps. Just makes more sense and is easier to type.</p>
167
168 <h2>Clearcase Functions</h2>
169
170 <h3>General function - scm = cleartool</h3>
171
172 <p>The scm function calls cleartool (and possibly cvs). It also gets
173 rid of the problem with Clearcase under Windows sending extra carriage
174 returns. If you wish to do a Clearcase cleartool command and it is not
175 short circuted then you can use scm instead. Short circuted commands
176 are basically cleartool command that you don't need to even specify scm
177 for. Examples include lsview, lsstream, pwv, etc.</p>
178
179 <p><b>Note:</b> The ct command has been aliased to the scm command.</p>
180
181 <p>Clearcase commands, using either the scm function of the familiar scm
182 function, also provide full command line completion! This means that if
183 you do scm lsview ad and then type tab, bash will complete your ad string
184 to expand to all of the views that start with the letters "ad". In other
185 words, bash completion for Clearcase commands means that hitting tab
186 in scm commands will complete the command line much like file name 
187 completion currently works in bash, except it's smart in that if the
188 context of the scm command calls for a view name here then bash 
189 completes view names. If the context of a scm command calls for a vob name
190 then completion will complete vob names, or baselines or labels, etc.
191 Even options are completed (type scm lsview - then tab) or even command
192 names themselves (type scm &lt;space&gt; then tab twice and you'll be 
193 given a list of all Clearcase commands!</p>
194
195 <h3>ci</h3>
196
197 <p>The ci short circut stands for check in. This will use your
198 ~/.clearcase_profile to specify the -nc if that is your default. So
199 then the common action of check in goes from cleartool checkin ->
200 ci</p>
201
202 <h3>co</h3>
203
204 <p>Same as ci but stands for checkout.</p>
205
206 <h3>unco</h3>
207
208 <p>Undo checkout</p>
209
210 <h3>Setview</h3>
211
212 <p>This is the regular setview command for Unix. Setview is not
213 supported under Windows but we fake it by doing a startview then
214 mounting /view/&lt;viewname&gt; to /vobs and start a new bash
215 shell. We are attempting to emulate the setview of Unix but we can't
216 fully because in Unix you are chrooted and /view is what is called a
217 <i>super root</i>. when we exit the setview under Windows we then
218 umount /vobs. The problem here is that we can only have one view set
219 on the system because the /vobs mount point contains that view's
220 name. So if terminal 1 setview view1 and terminal 2 setview view2,
221 terminal 1 would see things as of the last mount of /vob which is
222 view2. Further if either terminal exists the mount is unmounted and
223 the other terminal now has no current working directory. This is a
224 known bug and... I'm working on it!</p>
225
226 <h3>startview</h3>
227
228 <p>Stgarts a view then cd's the /view/&lt;viewname&gt;</p>
229
230 <h3>endview</h3>
231
232 <p>Does cm endview</p>
233
234 <h3>killview</h3>
235
236 <p>Does endview with -server</p>
237
238 <h3>mkview</h3>
239
240 <p>Short circut of cm mkview</p>
241
242 <h3>makeview (experimental)</h3>
243
244 <p>Attempts to create or reuse a view. It takes one parameter - the
245 stream. The stream you say? Yes! This is UCM. It takes the stream name
246 and attempts create a view on that stream. First it checks to see if
247 that view has already been made and if so it does a setview. If not it
248 attempts to make the view. If it's unsuccessful it tries to do an
249 lsstream by first lopping off a few characters of the stream name and
250 searching for that hoping that the stream name you provided was
251 "close".</p>
252
253 <p><b>Note:</b> The view tag composed will be ${USER}_$STREAM.</p>
254
255 <h3>rmview</h3>
256
257 <p>Short circut for cm rmview</p>
258
259 <h3>lsview</h3>
260
261 <p>Lists views. If no parameters are given then it does an cm lsview
262 -short | $PAGER. This lists all viewnames and pages it. If you give it
263 one parameter then it pipes the output to grep, grepping for that
264 string case insensitive. If you give it more parameters it just short
265 circuts to cm lsview &lt;parms&gt;.</p>
266
267 <h3>myviews</h3>
268
269 <p>Lists views that have $USER in them assuming they are UCM oriented
270 and getting the headline of UCM activity set in the view, if any. Note
271 that this is a little slow to talk to UCM to get the headlines. If you
272 just want to see what views are yours (i.e. have your userid in their
273 names) then do lsview $USER.</p>
274
275 <h3>llview</h3>
276
277 <p>One of the "ll" commands. When you see ll think "list long". This
278 does a cm lsview -l.</p>
279
280 <h3>lsviews</h3>
281
282 <p>Easy way to get a list of all views (remember lsview by itself will
283 use $PAGER). Useful for loops.</p>
284
285 <h3>lsvob</h3>
286
287 <p>Short circut for cm lsvob. Functions like lsview (pages, searches, etc).
288
289 <h3>llvob</h3>
290
291 <p>Long vob listing</p>
292
293 <h3>setcs</h3>
294
295 <p>Short circut for cm setsc</p>
296
297 <h3>edcs</h3>
298
299 <p>Short circut for cm edsc</p>
300
301 <h3>catcs</h3>
302
303 <p>Short circut for cm catsc</p>
304
305 <h3>pwv</h3>
306
307 <p>Prints the current view (-short)</p>
308
309 <h3>rmtag</h3>
310
311 <p>Short circut for cm rmtag</p>
312
313 <h3>mktag</h3>
314
315 <p>Short circut for cm mktag</p>
316
317 <h3>describe</h3>
318
319 <p>Short circut for cm describe</p>
320
321 <h3>vtree</h3>
322
323 <p>Display version tree (cm lsvtree -g)</p>
324
325 <h3>merge</h3>
326
327 <p>Short circut for cm merge</p>
328
329 <h3>cdiff</h3>
330
331 <p>Performs graphical diff for Clearcase or with two non-Clearcase
332 files or does a cvs diff if in CVS mode.</p>
333
334 <h3>space</h3>
335
336 <p>Short circut of cm space</p>
337
338 <h3>register</h3>
339
340 <p>Short circut of cm register</p>
341
342 <h3>unregister</h3>
343
344 <p>Short circut of cm unregister</p>
345
346 <h3>hostinfo</h3>
347
348 <p>Short circut of cm hostinfo</p>
349
350 <h3>lstrig</h3>
351
352 <p>Lists the trigger type if two parms are given (trtype and pvob)
353 otherwise alias for cm lstype -kind trtype | $PAGER.</p>
354
355 <h3>lltrig</h3>
356
357 <p>Lists long the trigger type if two parms are given (trtype and pvob)
358 otherwise alias for cm lstype -long -kind trtype | $PAGER.</p>
359
360 <h3>lsbr</h3>
361
362 <p>Lists lbtype's</p>
363
364 <h3>lsstream</h3>
365
366 <p>Lists all streams to $PAGER to alias for cm lsstream if parameters
367 are specified.</p>
368
369 <h3>llstream</h3>
370
371 <p>Lists long all streams to $PAGER to alias for cm lsstream -lif
372 parameters are specified.</p>
373
374 <h3>rebase</h3>
375
376 <p>Short circut for cm rebase.</p>
377
378 <h3>deliver</h3>
379
380 <p>Short circut for cm deliver.</p>
381
382 <h3>lsbl</h3>
383
384 <p>Short circut for cm lsbl.</p>
385
386 <h3>lsproject</h3>
387
388 <p>Lists all projects to your $PAGER or alias for cm lsproject.</p>
389
390 <h3>llproject</h3>
391
392 <p>Lists long all projects to your $PAGER or alias for cm lsproject -long.</p>
393
394 <h3>lsstgloc</h3>
395
396 <p>Lists all stglocs to your $PAGER or alias for cm lsstgloc.</p>
397
398 <h3>llstgloc</h3>
399
400 <p>Lists long all stglocs to your $PAGER or alias for cm lsstgloc -long.</p>
401
402 <h3>lsstream</h3>
403
404 <p>Lists all streams to your $PAGER or alias for cm lsstream.</p>
405
406 <h3>llstream</h3>
407
408 <p>Lists long all streams to your $PAGER or alias for cm lsstream -long.</p>
409
410 <h3>lsact</h3>
411
412 <p>Lists all activities to your $PAGER or alias for cm lsactivity.</p>
413
414 <h3>llact</h3>
415
416 <p>Lists long all activities to your $PAGER or alias for cm lsactivity -long.</p>
417
418 <h3>setact</h3>
419
420 <p>Short circut for cm setactivity</p>
421
422 <h3>clist</h3>
423
424 <p>Lists all currently checked out elements or locally modified cvs entries.</p>
425
426 <h3>ciwork</h3>
427
428 <p>Check in all checked out work.</p>
429   </div> <!-- content -->
430
431   <?php copyright ();?>
432 </div>
433
434 <script language="JavaScript" src="/JavaScript/Menus.js" type="text/javascript"></script>
435
436 </body>
437 </html>