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