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