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