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