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