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