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