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