Sweep with ispell and fix some typos.
[sw-tools] / sw.1
1 .\" -*-nroff-*-
2 .\"
3 .\" $Id: sw.1,v 1.6 1999/07/30 08:18:23 mdw Exp $
4 .\"
5 .\" Manual page for `sw'
6 .\"
7 .\" (c) 1999 EBI
8 .\"
9 .
10 .\"----- Licensing notice ---------------------------------------------------
11 .\"
12 .\" This file is part of sw-tools.
13 .\"
14 .\" sw-tools is free software; you can redistribute it and/or modify
15 .\" it under the terms of the GNU General Public License as published by
16 .\" the Free Software Foundation; either version 2 of the License, or
17 .\" (at your option) any later version.
18 .\"
19 .\" sw-tools is distributed in the hope that it will be useful,
20 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
21 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 .\" GNU General Public License for more details.
23 .\"
24 .\" You should have received a copy of the GNU General Public License
25 .\" along with sw-tools; if not, write to the Free Software Foundation,
26 .\" Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 .
28 .\"----- Revision history ---------------------------------------------------
29 .\"
30 .\" $Log: sw.1,v $
31 .\" Revision 1.6 1999/07/30 08:18:23 mdw
32 .\" Sweep with ispell and fix some typos.
33 .\"
34 .\" Revision 1.5 1999/07/16 12:45:37 mdw
35 .\" Internal formatting improvements.
36 .\"
37 .\" Revision 1.4 1999/06/24 15:52:12 mdw
38 .\" Add documentation for the `sw-precommit' script.
39 .\"
40 .\" Revision 1.3 1999/06/18 18:58:25 mdw
41 .\" Various tidyings.
42 .\"
43 .\" Revision 1.2 1999/06/04 13:56:09 mdw
44 .\" Changes, extensions, polishings, spelling fixes...
45 .\"
46 .\" Revision 1.1.1.1 1999/06/02 16:53:33 mdw
47 .\" Initial import.
48 .\"
49 .
50 .\"----- Style hacking ------------------------------------------------------
51 .
52 .de VS \" Start a sort-of verbatim block
53 .sp 1
54 .in +5n
55 .nf
56 .ft B
57 ..
58 .de VE \" Stop a sort-of verbatim block
59 .ft R
60 .fi
61 .in -5n
62 .sp 1
63 ..
64 .de hP \" Start an indented paragraph with a bold right-aligned label
65 .IP
66 \fB\h'-\w'\\$1\ 'u'\\$1\ \fP\c
67 ..
68 .
69 .ie \n(.g \{\
70 . fam P
71 . ds mw \fR[\f(BImdw\fR]
72 .\}
73 .el .ds mw \fR[\fBmdw\fR]
74 .ie t .ds o \(bu
75 .el .ds o o
76 .ds sw \fBsw\fP
77 .
78 .\"----- Main manual text ---------------------------------------------------
79 .
80 .TH sw 1 "25 May 1999" "EBI tools"
81 .PD 1
82 .
83 .\"--------------------------------------------------------------------------
84 .
85 .SH NAME
86 .
87 sw \- tool for convenient software installation
88 .
89 .\"--------------------------------------------------------------------------
90 .
91 .SH SYNOPSIS
92 .
93 .nf
94 \fBsw \-\-help
95 \fBsw \-\-help-full
96 \fBsw \-\-version
97 \fBsw \-\-archname
98 \fBsw \-\-remote \fIcommand
99
100 \fBsw all\-arch
101 \fBsw arch
102 \fBsw commit
103 \fBsw \fR[\fB\-fbi\fR] [\fB\-a \fIarch\fB,\fIarch\fR...] [\fB\-o \fIstyle\fR] \fBconfigure \fR[\fIconfigure-arg\fR...]
104 \fBsw host \fIarch
105 \fBsw \fR[\fB\-f\fR] [\fB\-a \fIarch\fB,\fIarch\fR...] \fBlinktree
106 \fBsw listarch
107 \fBsw \fR[\fB\-fbi\fR] [\fB\-a \fIarch\fB,\fIarch\fR...] [\fB\-o \fIstyle\fR] \fBmake \fR[\fImake-arg\fR...]
108 \fBsw only\-arch \fIarch \fR[\fIarch\fR...]
109 \fBsw reset
110 \fBsw rsh \fIhost\fR|\fIarch \fR[\fIcommand \fR[\fIargument\fR...]]
111 \fBsw \fR[\fB\-fbi\fR] [\fB\-a \fIarch\fB,\fIarch\fR...] [\fB\-o \fIstyle\fR] \fBrun \fIcommand \fR[\fIargument\fR...]
112 \fBsw setup \fIpackage version \fR[\fImaintainer\fR]
113 \fBsw \fR[\fB\-f\fR] [\fB\-a \fIarch\fB,\fIarch\fR...] \fBsnaplink \fIfile \fR[\fIfile\fR...]
114 \fBsw status
115 .ft R
116 .fi
117 .
118 .\"--------------------------------------------------------------------------
119 .
120 .SH "INTRODUCTION"
121 .
122 The \*(sw tool attempts to take a lot of the work out of building and
123 installing source packages across multiple architectures. This section
124 will describe how to use \*(sw's features to best advantage in a number
125 of common situations.
126 .PP
127 To keep things concrete, I'll describe how things are done at the EBI,
128 although there's nothing EBI-specific about the \*(sw program itself.
129 For details about how we handle software at EBI, see the
130 .B Local quirks
131 section below.
132 .PP
133 By the way, this is quite a large manual. I recommend that you print a
134 copy onto paper and peruse it in a leisurely fashion, rather than
135 squinting at a monitor.
136 .
137 .\"--------------------------------------------------------------------------
138 .
139 .SH "SUMMARY OF BUILDING PACKAGES"
140 .
141 First, the
142 .B Autoconf
143 case:
144 .VS
145 .BI "sw setup " "package version"
146 .B "sw only \c"
147 .IR "arch " [ arch ...]
148 .ft B
149 sw configure
150 sw make
151 sw \-i make install
152 sw commit
153 .VE
154 Secondly, the
155 .RB non- Autoconf
156 case:
157 .VS
158 .BI "sw setup " "package version"
159 .B "sw only \c"
160 .IR "arch " [ arch ...]
161 .B "sw linktree"
162 .BI "sw snaplink \c"
163 .IR "file " [ file ...]
164 .I [edit the appropriate files]
165 .ft B
166 sw make
167 sw \-i make install
168 sw commit
169 .VE
170 .
171 .\"--------------------------------------------------------------------------
172 .
173 .SH "8 STEPS TO INSTALLING A PACKAGE"
174 .
175 The following steps will guide you through your first (and maybe second)
176 package installations. In the description, I'll use
177 .RI ` package '
178 to refer to the package's name, and
179 .RI ` version '
180 to refer to its version number.
181 .PP
182 Not all the important features and options are described in this part of
183 the manual. View it more as a taster for the sorts of things \*(sw can
184 do, and a suggestion
185 .SS "1. Download the source distribution"
186 Download the package's source distribution. This will normally be in an
187 archive called something like
188 .IB package - version .tar.gz\c
189 \&. At EBI, we put source archive files in
190 .BR /sw/common/tr .
191 .SS "2. Unpack the source tree"
192 Unpack the source tree into the standard source directory. Each source
193 tree should have its own directory. Most well-packaged source
194 distributions unpack themselves into a neat directory, but less
195 fastidious programmers make archives which scatter files all over the
196 current directory.
197 .PP
198 At EBI, we put the source trees in
199 .BR /sw/common/src ,
200 so unpacking a well-formed source distribution looks like:
201 .VS
202 cd /sw/common/src
203 .BI "gzip \-dc ../tr/" package \- version ".tar.gz | tar xfv \-"
204 .VE
205 Ill-formed source distributions involve making the directory for the
206 package first, changing into it, and then unpacking into the current
207 directory:
208 .VS
209 cd /sw/common/src
210 .BI "mkdir " package \- version
211 .BI "cd " package \- version
212 .BI "gzip \-dc ../../tr/" package - version ".tar.gz | tar xfv \-"
213 .VE
214 When you've finished unpacking, make sure that your current directory is
215 the top level directory of the source tree you unpacked.
216 .SS "3. Tell \\*(sw what you're up to"
217 Now you need to tell \*(sw what you're working on. It will keep track of
218 this and other bits of information in a little file and refer to it
219 every now and then. It will also whinge at you and refuse to cooperate
220 if it can't find its little file, so it's as well to oblige.
221 .PP
222 To tell \*(sw to create this little file and initialize it with sensible
223 values, you just need to say
224 .VS
225 .BI "sw setup " "package version"
226 .VE
227 What could be easier?
228 .SS "4. Restrict the build to particular architectures"
229 Some packages don't work on all architectures, either because the author
230 wasn't sufficiently good at writing portable software, or because the
231 program's doing inherently nonportable things.
232 .PP
233 If that's the case, then you need to tell \*(sw to only build on the
234 architectures that really work. Do this with the
235 .RB ` "sw only" '
236 command. For example, if your package only works on Linux and Solaris,
237 say:
238 .VS
239 sw only i386-linux sparc-solaris
240 .VE
241 You can get a list of the architecture names that \*(sw understands by
242 typing
243 .VS
244 sw listarch
245 .VE
246 With a little bit of luck, these names ought to be self-explanatory.
247 .PP
248 If your package is properly portable and works everywhere then you don't
249 need to do anything for this step. Skip on to the next one.
250 .SS "5. Configure the package"
251 Now it gets complicated. If the package you're building uses
252 .B Autoconf
253 to configure itself for its current environment then you're in luck.
254 You can tell an
255 .B Autoconf
256 package because there's a script called
257 .B configure
258 in the top source directory, and a file called
259 .BR Makefile.in .
260 If it
261 .I does
262 use
263 .B Autoconf
264 then run
265 .VS
266 sw configure
267 .VE
268 to configure the package on all the platforms it's meant to be built
269 for. When you've done that, move onto the next step.
270 .PP
271 If the package
272 .I doesn't
273 use
274 .B Autoconf
275 then all is not lost (although it may be worthwhile complaining at the
276 package's author or maintainers). You need to make a collection of
277 .IR "link trees" ,
278 one for each architecture. These link trees are little replicas of the
279 main source tree but with symbolic links instead of the real source
280 files. To make the link trees, run
281 .VS
282 sw linktree
283 .VE
284 Now, that's not actually quite what you wanted. It's made a link for
285 .I every
286 file in the source tree. Unfortunately, there are some files you'll
287 (probably) have to modify for each architecture in order to configure
288 the package to build properly. You can turn links in the link trees
289 into real independently editable files by
290 .I snapping
291 the links. Say for example that
292 .B Makefile
293 and
294 .B config.h
295 need to be modified for each architecture. Running the command
296 .VS
297 sw snaplink Makefile config.h
298 .VE
299 is sufficient to do the right thing.
300 .PP
301 Now you must edit the snapped files to configure the package. Make sure
302 that the install directories are correctly set. At EBI, all the
303 software should be configured so that architecture neutral files end up
304 under
305 .B /sw/common
306 and architecture-specific files end up under
307 .BI /sw/common/arch/ arch\c
308 \&.
309 .SS "6. Build the package"
310 Now you've laid the groundwork, everything ought to be easy. Making the
311 program ought to involve simply typing
312 .VS
313 sw make
314 .VE
315 and waiting for a while. If you had the
316 .B curses
317 library available when \*(sw was built, then your terminal will split
318 itself into little independently scrolling windows showing you the
319 progress for each architecture. If you're not privileged enough to have
320 .B curses
321 then you get the output appropriately tagged with architecture names,
322 which is unfortunately fairly hard to read.
323 .SS "7. Install the package"
324 Most source packages (and almost certainly all
325 .B Autoconf
326 ones) have a
327 .B make
328 target
329 .RB ` install '
330 which installs the program correctly. You can run this from \*(sw by
331 saying
332 .VS
333 sw \-i make install
334 .VE
335 The little
336 .RB ` \-i '
337 option there tells \*(sw that this is the
338 .IR "install step" .
339 When an architecture completes this step correctly, it's marked as being
340 properly installed, and \*(sw doesn't bother thinking about it again.
341 .PP
342 If you
343 .I don't
344 have an
345 .RB ` install '
346 makefile target, then you have to install things manually. That's not
347 much fun, so moan at the package's author. When you've finished
348 fiddling with installation, run
349 .VS
350 sw -i run true
351 .VE
352 just to tell \*(sw that you've installed everything OK. (This is a bit
353 of a kludge.)
354 .SS "8. Update the index"
355 Now that everything's built and installed, there's just one more command
356 to type:
357 .VS
358 sw commit
359 .VE
360 This makes \*(sw update its main index of installed packages, telling it
361 which architectures packages are installed on, and who did it.
362 .
363 .\"--------------------------------------------------------------------------
364 .
365 .SH "REFERENCE INTRODUCTION"
366 .
367 That was a gentle introduction. This section contains the complete
368 reference to
369 .BR sw :
370 far more detail that you probably want. If that's really the case, try
371 running
372 .VS
373 sw \-\-help\-full
374 .VE
375 to read the available help text. There's quite a lot of it, and it
376 ought to keep you occupied for a while.
377 .PP
378 The basic \*(sw command line looks a bit like:
379 .sp 1
380 .RS 5
381 .B sw
382 .RI [ options ]
383 .RI [ command
384 .RI [ argument ...]]
385 .RE
386 .sp 1
387 If you just say
388 .VS
389 sw
390 .VE
391 at the shell prompt, \*(sw gives you an extremely terse usage summary
392 and quits. You have to tell it to do
393 .IR something .
394 Most of the time you do this by giving \*(sw a
395 .IR command ,
396 like
397 .RB ` setup '
398 or
399 .RB ` make '
400 so that it knows what to do. There are some strange command line
401 options which cause \*(sw to do more exotic things, though.
402 .
403 .\"--------------------------------------------------------------------------
404 .
405 .SH "IMPLEMENTATION ODDITIES"
406 .
407 The \*(sw program that users use is really a small architecture-neutral
408 shell script, which works out the current architecture and executes the
409 appropriate architecture-specific main program. It's done this way so
410 that \*(sw knows that it can use the shell script to start itself up on
411 a remote host with a different architecture, something which it does
412 quite a lot. The only feature provided by the front-end shell script is
413 the
414 .B \-\-archname
415 command line option, which shouldn't be used by anyone except \*(sw's build procedure anyway.
416 .
417 .\"--------------------------------------------------------------------------
418 .
419 .SH "COMMAND LINE OPTION REFERENCE"
420 .
421 Any \*(sw command line options can be put in the
422 .B SW
423 environment variable. The \*(sw program will read space-separated
424 options from this variable before it reads the command line itself.
425 .PP
426 The \*(sw program usually understands two different names for each
427 option: a traditional Unix single-character name, and a long GNU-style
428 name. The short options behave in the normal Unix way: you can join
429 them together into single words with a
430 .RB ` \- '
431 at the front, for example. The long names are always preceded by a
432 double dash. You can abbreviate long names as much as you like, as long
433 as the resulting abbreviation is unambiguous. In the descriptions
434 below, both the short and long names of the options are shown, but for
435 reasons of brevity required arguments are only shown for the long form.
436 .PP
437 There are conceptually two types of \*(sw command line options: those
438 which, usually for reasons of consistency with other programs, cause
439 \*(sw to do something immediately; and those which store some settings
440 for particular commands. The latter type are generally more useful.
441 It's worth bearing in mind, though, that the options are only used by a
442 few commands. The command reference describes exactly which commands
443 use which options.
444 .PP
445 The complete list of command line options understood by the current
446 version of \*(sw is as follows:
447 .TP
448 .B "\-h, \-\-help"
449 Writes a fairly brief summary of \*(sw's command line options and a usage line for each of \*(sw's commands to standard output, and exits successfully.
450 .TP
451 .B "\-H, \-\-help\-full"
452 Writes a summary of \*(sw's command line options and a full paragraph of description for each of \*(sw's commands to standard output, and exits successfully. There's a lot of
453 text generated by this option. I recommend you pipe it through a pager
454 so that you can actually read it.
455 .TP
456 .B "\-v, \-\-version"
457 Writes \*(sw's version number to standard output and exits successfully. This is handy
458 when trying to decide whether your version of \*(sw has a particular feature, for example.
459 .TP
460 .B "\-u, \-\-usage"
461 Writes a usage message so terse as to be nearly useless to standard
462 output and exits successfully. This is different from just running
463 .RB ` sw '
464 because although both print the same useless message, running \*(sw without any arguments is considered an error, so the message is sent to
465 standard error and \*(sw will exit unsuccessfully.
466 .TP
467 .BI "\-a, \-\-arch " arch , arch\fR...
468 For commands which affect multiple architectures: only affect the
469 architectures specified. The architecture names may be separated by
470 commas, spaces or both, although clearly commas are most convenient on
471 the command line. Architecture names may be abbreviated as long as the
472 abbreviation is not ambiguous.
473 .IP
474 This option overrides any other decisions that \*(sw might make about which architectures to process based on the
475 .B only\-arch
476 list and the list of correctly built architectures for the current
477 package.
478 .TP
479 .B "\-f, \-\-force"
480 For commands which affect multiple architectures: affect even
481 architectures that have been successfully built. This has no effect if
482 there's a
483 .RB ` \-a '
484 option in force.
485 .TP
486 .B "\-i, \-\-install"
487 For build commands: this is the final install step, so label architectures
488 which successfully complete it as having been completely built. It's
489 normal to specify this option on the
490 .RB ` "make install" '
491 build command.
492 .TP
493 .BI "\-o, \-\-output " style
494 For build commands: select a style for the build output to be displayed
495 in. See the section
496 .B "Build commands"
497 for more details on output styles.
498 .TP
499 .B "\-b, \-\-beep"
500 For build commands: make a beep noise when the build finishes. This
501 provides a handy reminder if you're getting on with something else while
502 waiting for a long build.
503 .PP
504 The remaining options aren't really intended for users. They're helpful
505 for \*(sw's own purposes, though, and described here for completeness' sake. They
506 don't have standard Unix short name equivalents, because they're not
507 usually useful for users.
508 .TP
509 .B "\-\-archname"
510 Writes the \*(sw architecture name of the current host to standard output. This is used
511 by \*(sw's configuration script to determine the current architecture name. This
512 option is actually handled by a small shell script rather than by being
513 passed on to the main program. You shouldn't use this option yourself:
514 use the
515 .RB ` arch '
516 command instead. Because this option is handled by the shell script,
517 and the script isn't very clever, you can't abbreviate
518 .B \-\-archname
519 on the command line, and it doesn't conflict with the similarly named
520 but completely different
521 .B \-\-arch
522 option, which you can still abbreviate all the way down to just
523 .RB ` \-\-a '.
524 .TP
525 .BI "\-\-me " name
526 Sets \*(sw's idea of its program name to
527 .IR name .
528 This is intended for use by \*(sw's front-end shell script, but isn't
529 actually needed at the moment. I can't see why you'd want to play with
530 this option, but it shouldn't do any harm.
531 .TP
532 .BI "\-\-remote " remote-command
533 Used by \*(sw when running commands on remote hosts. Don't use this yourself: it puts \*(sw into a very unfriendly mode and requires that you communicate with it
534 using a bizarre binary packet protocol. If you really must know more
535 about this, see the source code: it's quite well documented, really.
536 .
537 .\"--------------------------------------------------------------------------
538 .
539 .SH TERMINOLOGY
540 .
541 The descriptions below make use of some technical terms:
542 .TP
543 .B "architecture restriction"
544 A state created by the
545 .B only\-arch
546 command, restricting the
547 .I "default build architectures"
548 to those listed as arguments to the command. An architecture
549 restriction may be cleared by
550 .B all\-arch
551 command.
552 .TP
553 .B "build architectures"
554 The architectures which a
555 .I "build command"
556 will process. If the
557 .RB ` \-a '
558 option is specified on the command line, then its argument specifies the
559 build architectures for this command; otherwise, the
560 .I "default build architectures"
561 are used.
562 .TP
563 .B "build command"
564 A command which executes a process on multiple hosts simultaneously and
565 reports the results. The processes executed usually perform some part
566 of the building of a package. Currently, the build commands are
567 .B run
568 and its derivatives
569 .B configure
570 and
571 .BR make .
572 .TP
573 .B "default build architectures"
574 The architectures which, in the absence of a
575 .RB ` \-a '
576 command line option, are affected by a
577 .IR "build command" .
578 To determine the default build architectures, \*(sw reads the list of all architectures from the
579 .B archtab
580 file, and filters it: if the
581 .RB ` \-f '
582 command line option is
583 .I not
584 specified, then architectures marked as
585 .I "successfully built"
586 are removed from the list; if there is an
587 .I "architecture restriction"
588 in force, then the list is further filtered according to the
589 restriction.
590 .TP
591 .B "successfully built"
592 A package is considered to be successfully built on a given architecture
593 if a build command given the
594 .RB ` \-i '
595 command-line option succeeds on a host of that architecture. The list
596 of successfully built architectures can be cleared by the
597 .B reset
598 command. The
599 .RB ` \-f '
600 option causes \*(sw to ignore whether architectures have been successfully built when
601 determining the
602 .IR "default build architectures" .
603 .
604 .\"--------------------------------------------------------------------------
605 .
606 .SH "COMMAND REFERENCE"
607 .
608 This section describes all of the available \*(sw commands, in alphabetical order.
609 .
610 .SS all\-arch
611 Clears an architecture restriction set by
612 .RB ` only\-arch '.
613 Subsequent build commands will run across all known architectures not
614 yet successfully built, unless overridden by the
615 .RB ` \-a '
616 command-line option, or a later
617 .RB ` only\-arch '
618 command.
619 .
620 .SS arch
621 Writes the name of the local host's architecture to standard output.
622 The architecture name is built into \*(sw at compile time.
623 .SS commit
624 Writes information from the
625 .B .sw\-info
626 file to the installed packages index file
627 .IB prefix /sw-index\fR.
628 .PP
629 \*(sw performs some checks before committing information to the index
630 file. Firstly, all the expected architectures must be successfully
631 built. Secondly, the script
632 .IB prefix /share/sw-precommit\fR
633 is run, if it exists. This script must exit successfully if the commit
634 is to proceed. The script can be configured to enforce local policy
635 requirements on installed software.
636 .PP
637 The
638 .B sw-precommit
639 script is passed a single argument, which is the package name to be
640 committed. Other useful information is passed in the environment:
641 .TP
642 .B SW_PACKAGE
643 The package name (again).
644 .TP
645 .B SW_VERSION
646 The package version number.
647 .TP
648 .B SW_MAINTAINER
649 The package's maintainer.
650 .TP
651 .B SW_DATE
652 The last date on which the package was modified.
653 .TP
654 .B SW_ARCHLIST
655 The list of architectures on which the package has been built (separated
656 by spaces or commas).
657 .TP
658 .B SW_PREFIX
659 The installation prefix with which \*(sw was configured.
660 .PP
661 The script should report any errors it finds to its standard error
662 stream.
663 .
664 .SS configure \fR[\fIconfigure-arg\fR...]
665 Equivalent to the command
666 .VS
667 .BI "run ../configure \-\-prefix=" prefix " " configure-arg\fR...
668 .VE
669 where
670 .I prefix
671 is the installation prefix with which \*(sw itself was configured. If you want to specify a different prefix, pass
672 your own
673 .B \-\-prefix
674 argument.
675 .PP
676 It is expected that administrators will set up a file
677 .IB prefix /share/config.site
678 which sets up other Autoconf parameters once the prefix has been
679 chosen. See the Autoconf manual for more information.
680 .
681 .SS host \fIarch\fR
682 Writes to standard output the name of a host with requested architecture
683 .IR arch .
684 The hostname is read from the
685 .B archtab
686 file.
687 .
688 .SS linktree
689 Builds symbolic link trees. For each of the build architectures, a
690 directory with the architecture's name is created containing a symbolic
691 link corresponding to each file in the main source tree. Thus, a `make'
692 in the link tree will fetch the source files correctly, but place the
693 objects in the link tree rather than the main source tree, so that
694 object files from different architectures don't interfere with each
695 other.
696 .PP
697 If the link trees already exist, then rerunning
698 .B linktree
699 will update the links. This might be useful if the links somehow become
700 invalid.
701 .PP
702 To turn some of the links in the link trees into real files, use the
703 .B snaplink
704 command.
705 .
706 .SS listarch
707 Writes a list of all known architecture names to standard output. The
708 list is obtained by reading the
709 .B archtab
710 file.
711 .
712 .SS make \fR[\fImake-arg\fR...]
713 Equivalent to
714 .VS
715 .BI "run make " make-arg\fR...
716 .VE
717 in all respects.
718 .
719 .SS only\-arch \fIarch arch\fR...
720 Imposes an architecture restriction. Until cancelled by a later
721 .B only\-arch
722 or
723 .B all\-arch
724 command, the default build architectures will be limited to the
725 architectures listed on the command line. Architecture names may be
726 abbreviated as long as the abbreviation is not ambiguous.
727 .
728 .SS reset
729 Clears the
730 .I "successfully built"
731 status of all architectures.
732 .
733 .SS rsh \fIhost\fR|\fIarch \fR[\fIcommand \fR[\fIargument\fR...]]
734 Runs
735 .I command
736 on a remote host, passing it the list of
737 .IR argument s.
738 The
739 .B "sw rsh"
740 command is unlike the standard
741 .B rsh
742 program and its replacements:
743 .hP \*o
744 The
745 .I command
746 and
747 .IR argument s
748 are not subjected to further shell expansion on the remote host.
749 .hP \*o
750 The command is run with the remote current directory the same as the
751 local current directory, rather than the remote user's home directory.
752 .hP \*o
753 The command is passed an environment constructed from the local
754 environment, the default remote environment, and
755 .B sw\-env
756 files, as described in the section
757 .B "Remote environment"
758 below.
759 .hP \*o
760 The remote command is run with standard input attached to
761 .BR /dev/null :
762 there is no way of running an interactive remote command through
763 .BR sw.
764 .PP
765 The host on which to run the remote command may be specified as one of:
766 a standard host name (or IP address), an architecture name (which may
767 .I not
768 be abbreviated) signifying a host of the appropriate architecture, or
769 the special name
770 .RB ` \- '
771 signifying the current host. (This last option may not sound useful,
772 but it's handy for testing.)
773 .
774 .SS run \fIcommand \fR[\fIargument\fR...]
775 Runs a command on all build architectures.
776 .PP
777 For each build architecture
778 .IR arch ,
779 \*(sw finds a host with the appropriate architecture, by choosing either
780 the local host or reading the hostname from the
781 .B archtab
782 file. It then performs the following actions on that host:
783 .hP 1.
784 Sets the current directory to be the subdirectory named
785 .I arch
786 of the directory from which the command was issued. This directory is
787 created if it doesn't already exist.
788 .hP 2.
789 Sets up an environment constructed from the environment prevailing when
790 the command was issued, the default environment set up by
791 .B rsh
792 (or whatever equivalent remote execution program was actually used), and
793 the
794 .B sw\-env
795 files, as described in the section
796 .B "Remote environment"
797 below.
798 .hP 3.
799 Executes the program named
800 .I command
801 passing it the given
802 .IR argument s.
803 .PP
804 Output from the command is both appended to the file
805 .IB arch/.build-log
806 and output in some
807 .IR "output style" ,
808 as specified by the
809 .RB ` \-o '
810 command-line option. See the section
811 .B "Output styles"
812 below for more details.
813 .PP
814 If the
815 .RB ` \-i '
816 option was given on the command line, each architecture on which the
817 command succeeds (i.e., reports a zero exit code) is marked as
818 .IR "successfully built" ,
819 and further build commands will not affect it unless the
820 .RB ` \-f '
821 command line option is passed, until a
822 .B reset
823 command is performed.
824 .
825 .SS setup \fIpackage version \fR[\fImaintainer\fR]
826 Sets up various pieces of information required by \*(sw. The
827 information here will be added into the main index file by a
828 .B commit
829 command. The information is maintained in a file named
830 .B .sw\-info
831 in the current directory.
832 .PP
833 The
834 .I package
835 should be the basic name of the package, with versioning information
836 stripped off, e.g.,
837 .RB ` emacs '
838 or
839 .RB ` perl ',
840 not
841 .RB ` emacs\-19.34 '.
842 The
843 .I version
844 should be the version number of the package. The
845 .I maintainer
846 should be the name of the person principally responsible for maintaining
847 the package's local installation. If this isn't specified, the calling
848 user's name is used as the maintainer.
849 .PP
850 The
851 .B setup
852 command must be run before any build command.
853 .
854 .SS snaplink \fIfile \fR[\fIfile\fR...]
855 Creates architecture-specific versions of a file. Every
856 .I file
857 named on the command line is copied to
858 .IB arch / file
859 for every build architecture
860 .IR arch ,
861 overwriting any existing file or symbolic link of that name. If
862 .I file
863 contains leading directories then destination directories are created as
864 necessary for the output files. Note that the `snap' operation doesn't
865 actually need to follow creation of link trees.
866 .
867 .\"--------------------------------------------------------------------------
868 .
869 .SH "OUTPUT STYLES"
870 .
871 Output from a build command is presented in one of a number of named
872 .IR "output styles" .
873 The style name
874 .RB ` plain '
875 is always defined: it simply prefixes each line of output with the
876 name of the architecture which generated the line, which isn't actually
877 particularly easy to read. Other output styles may have been configured
878 into \*(sw when it was compiled.
879 .PP
880 The set of output styles supported by \*(sw varies according to how it
881 was configured. In any particular \*(sw program, you might have some of
882 the following:
883 .TP
884 .B plain
885 Simply prefixes each output line with the name of the architecture it
886 came from. This is quite hard to read, but it doesn't require any
887 special operating system support or clever terminal.
888 .TP
889 .B curses
890 Splits the terminal into independently scrolling areas, one for each
891 architecture, with a status line for each. Waits for a keypress when
892 all architectures are finished building.
893 .PP
894 The
895 .RB ` plain '
896 style is used when the selected style doesn't work (for example, you
897 don't have a sufficiently capable terminal for curses output).
898 .PP
899 Output style names can be abbreviated as long as the abbreviation is
900 unambiguous. You can find the list of available output styles by
901 executing the command
902 .VS
903 sw \-o help run
904 .VE
905 (which is a little counter-intuitive, I know).
906 .PP
907 The author has plans to implement an X-based output style, but hasn't
908 got around to it yet.
909 .
910 .\"--------------------------------------------------------------------------
911 .
912 .SH "REMOTE ENVIRONMENT"
913 .
914 The environment for a remote command (executed either through the
915 .B rsh
916 command, or a build command) is set up as follows:
917 .hP \*o
918 The complete environment passed to \*(sw is used as a basis.
919 .hP \*o
920 Any environment variables defined by the remote execution program
921 (usually
922 .BR rsh )
923 override corresponding variables in the basis environment.
924 .hP \*o
925 The
926 .B SW_ARCH
927 variable is set to the name of the remote host's architecture.
928 .hP \*o
929 Variable assignments are read from the global
930 .IB prefix /share/sw\-env
931 file. This makes some assignments which are useful everywhere, and will
932 then usually include the file
933 .B .sw\-env
934 in the current directory.
935 .PP
936 The format of the
937 .B sw\-env
938 files is documented separately in
939 .BR sw\-env (5).
940 .
941 .\"--------------------------------------------------------------------------
942 .
943 .SH LOCAL QUIRKS
944 .
945 This section describes how non-vendor software works at EBI. Chances
946 are that other sites will work differently. This description is here as
947 an example setup for \*(sw.
948 .PP
949 All the non-vendor software gets put in one big shared filesystem, and
950 is exported from our main fileserver. The filesystem is mounted on all
951 clients as
952 .BR /sw/common .
953 Architecture-neutral files are then
954 placed in the conventional subdirectories off
955 .B /sw/common
956 (e.g.,
957 .BR /sw/common/share,
958 or
959 .BR /sw/common/info ).
960 Architecture specific files are stored in subdirectories off
961 .BR /sw/common/arch .
962 For example, Linux binaries go in
963 .BR /sw/common/arch/i386-linux/bin ,
964 and Solaris libraries in
965 .BR /sw/common/arch/sparc-solaris/lib .
966 Additionally, each architecture-specific subtree has a symbolic link
967 back up to
968 .B /sw/common
969 for each of the architecture-neutral subdirectories.
970 .PP
971 There is a symbolic link on every client, from
972 .B /sw/arch
973 to
974 .BI /sw/common/arch/ arch\fR,
975 where
976 .I arch
977 is the architecture of that client. Thus, every client has two
978 .I views
979 of the software repository: the `common' view where every host sees
980 exactly the same mapping between filenames and files, and the `arch'
981 view where every host sees the same mapping between filenames and
982 programs which do the same job.
983 .PP
984 And that's just about it.
985 .
986 .\"--------------------------------------------------------------------------
987 .
988 .SH ENVIRONMENT
989 .
990 The following environment variables are of interest to
991 .BR sw :
992 .TP
993 .B SW
994 Contains a space-separated list of default command-line options. These
995 are read before, and overridden by, the actual arguments given on the
996 command-line.
997 .TP
998 .B SW_MAKE
999 The name of the command to use to run a `make'. This is resolved on the
1000 local host once, rather than one for each build host, which is probably
1001 a misfeature. To do something more clever, point
1002 .B SW_MAKE
1003 at a shell script which then picks out the right architecture-specific
1004 .RB ` make '
1005 program from the remote environment.
1006 .TP
1007 .B SW_RSH
1008 The name of the remote-shell program to use. By default, something
1009 similar to
1010 .B rsh
1011 is chosen. I recommend using the excellent
1012 .B ssh
1013 program instead.
1014 .
1015 .\"--------------------------------------------------------------------------
1016 .
1017 .SH FILES
1018 .
1019 The following files are of interest to
1020 .BR sw :
1021 .TP
1022 .IB prefix /sw\-index
1023 The main index file, containing the list of which packages have been
1024 installed for which architectures. See
1025 .BR sw-info (5)
1026 for file format details.
1027 .TP
1028 .IB prefix /share/archtab
1029 The architecture-to-host mapping file. See
1030 .BR archtab (5)
1031 for file format details.
1032 .TP
1033 .IB prefix /share/sw\-env
1034 Contains global environment variable settings. See
1035 .BR sw-env (5)
1036 for file format details.
1037 .TP
1038 .IB prefix /share/sw\-precommit
1039 Optional script used to approve commit requests. See the
1040 .B commit
1041 command above for calling details.
1042 .BR sw-env (5)
1043 for file format details.
1044 .TP
1045 .IB package /.sw\-info
1046 Contains the persistent information about a particular package's build
1047 status. See
1048 .BR sw-info (5)
1049 for file format details.
1050 .TP
1051 .IB package /.sw\-env
1052 Contains package-specific environment variable settings. See
1053 .BR sw-env (5)
1054 for file format details.
1055 .TP
1056 .IB package / arch /.build\-log
1057 Contains all the build output for a particular architecture. Usually
1058 not very interesting, but might be handy one day.
1059 .
1060 .\"--------------------------------------------------------------------------
1061 .
1062 .SH BUGS
1063 .
1064 There are no bugs in
1065 .BR sw ,
1066 merely unexpected behaviour modes. Silly you for thinking otherwise.
1067 .
1068 .SH AUTHOR
1069 .
1070 The \*(sw program, and this manual, are \*(mw productions, in association
1071 with the European Bioinformatics Institute. They were written by Mark
1072 Wooding <mdw@nsict.org>. Go and ask him if you have problems.
1073 .
1074 .\"----- That's all, folks --------------------------------------------------