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