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