Manual page added.
[sw-tools] / sw.1
CommitLineData
3315e8b3 1.\" -*-nroff-*-
2.\"
d7c27db6 3.\" $Id: sw.1,v 1.6 1999/07/30 08:18:23 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 $
d7c27db6 31.\" Revision 1.6 1999/07/30 08:18:23 mdw
32.\" Sweep with ispell and fix some typos.
33.\"
be07bee0 34.\" Revision 1.5 1999/07/16 12:45:37 mdw
35.\" Internal formatting improvements.
36.\"
4f71fd6c 37.\" Revision 1.4 1999/06/24 15:52:12 mdw
38.\" Add documentation for the `sw-precommit' script.
39.\"
e0465a2b 40.\" Revision 1.3 1999/06/18 18:58:25 mdw
41.\" Various tidyings.
42.\"
91f52355 43.\" Revision 1.2 1999/06/04 13:56:09 mdw
44.\" Changes, extensions, polishings, spelling fixes...
45.\"
46.\" Revision 1.1.1.1 1999/06/02 16:53:33 mdw
47.\" Initial import.
3315e8b3 48.\"
be07bee0 49.
50.\"----- Style hacking ------------------------------------------------------
51.
91f52355 52.de VS \" Start a sort-of verbatim block
3315e8b3 53.sp 1
54.in +5n
55.nf
56.ft B
57..
91f52355 58.de VE \" Stop a sort-of verbatim block
3315e8b3 59.ft R
60.fi
61.in -5n
62.sp 1
63..
be07bee0 64.de hP \" Start an indented paragraph with a bold right-aligned label
91f52355 65.IP
66\fB\h'-\w'\\$1\ 'u'\\$1\ \fP\c
67..
be07bee0 68.
3315e8b3 69.ie \n(.g \{\
be07bee0 70. fam P
71. ds mw \fR[\f(BImdw\fR]
3315e8b3 72.\}
be07bee0 73.el .ds mw \fR[\fBmdw\fR]
74.ie t .ds o \(bu
75.el .ds o o
91f52355 76.ds sw \fBsw\fP
be07bee0 77.
78.\"----- Main manual text ---------------------------------------------------
79.
3315e8b3 80.TH sw 1 "25 May 1999" "EBI tools"
81.PD 1
be07bee0 82.
83.\"--------------------------------------------------------------------------
84.
3315e8b3 85.SH NAME
be07bee0 86.
3315e8b3 87sw \- tool for convenient software installation
be07bee0 88.
89.\"--------------------------------------------------------------------------
90.
3315e8b3 91.SH SYNOPSIS
be07bee0 92.
3315e8b3 93.nf
91f52355 94\fBsw \-\-help
95\fBsw \-\-help-full
96\fBsw \-\-version
97\fBsw \-\-archname
98\fBsw \-\-remote \fIcommand
3315e8b3 99
91f52355 100\fBsw all\-arch
3315e8b3 101\fBsw arch
91f52355 102\fBsw commit
103\fBsw \fR[\fB\-fbi\fR] [\fB\-a \fIarch\fB,\fIarch\fR...] [\fB\-o \fIstyle\fR] \fBconfigure \fR[\fIconfigure-arg\fR...]
3315e8b3 104\fBsw host \fIarch
105\fBsw \fR[\fB\-f\fR] [\fB\-a \fIarch\fB,\fIarch\fR...] \fBlinktree
106\fBsw listarch
107\fBsw \fR[\fB\-fbi\fR] [\fB\-a \fIarch\fB,\fIarch\fR...] [\fB\-o \fIstyle\fR] \fBmake \fR[\fImake-arg\fR...]
91f52355 108\fBsw only\-arch \fIarch \fR[\fIarch\fR...]
3315e8b3 109\fBsw reset
110\fBsw rsh \fIhost\fR|\fIarch \fR[\fIcommand \fR[\fIargument\fR...]]
111\fBsw \fR[\fB\-fbi\fR] [\fB\-a \fIarch\fB,\fIarch\fR...] [\fB\-o \fIstyle\fR] \fBrun \fIcommand \fR[\fIargument\fR...]
112\fBsw setup \fIpackage version \fR[\fImaintainer\fR]
113\fBsw \fR[\fB\-f\fR] [\fB\-a \fIarch\fB,\fIarch\fR...] \fBsnaplink \fIfile \fR[\fIfile\fR...]
114\fBsw status
115.ft R
116.fi
be07bee0 117.
118.\"--------------------------------------------------------------------------
119.
3315e8b3 120.SH "INTRODUCTION"
be07bee0 121.
91f52355 122The \*(sw tool attempts to take a lot of the work out of building and
123installing source packages across multiple architectures. This section
124will describe how to use \*(sw's features to best advantage in a number
125of common situations.
3315e8b3 126.PP
127To keep things concrete, I'll describe how things are done at the EBI,
91f52355 128although there's nothing EBI-specific about the \*(sw program itself.
129For details about how we handle software at EBI, see the
3315e8b3 130.B Local quirks
131section below.
132.PP
133By the way, this is quite a large manual. I recommend that you print a
134copy onto paper and peruse it in a leisurely fashion, rather than
135squinting at a monitor.
be07bee0 136.
137.\"--------------------------------------------------------------------------
138.
3315e8b3 139.SH "SUMMARY OF BUILDING PACKAGES"
be07bee0 140.
3315e8b3 141First, the
91f52355 142.B Autoconf
3315e8b3 143case:
144.VS
145.BI "sw setup " "package version"
146.B "sw only \c"
147.IR "arch " [ arch ...]
148.ft B
149sw configure
150sw make
151sw \-i make install
152sw commit
153.VE
154Secondly, the
91f52355 155.RB non- Autoconf
3315e8b3 156case:
157.VS
158.BI "sw setup " "package version"
159.B "sw only \c"
160.IR "arch " [ arch ...]
161.B "sw linktree"
162.BI "sw snaplink \c"
163.IR "file " [ file ...]
164.I [edit the appropriate files]
165.ft B
166sw make
167sw \-i make install
168sw commit
169.VE
be07bee0 170.
171.\"--------------------------------------------------------------------------
172.
3315e8b3 173.SH "8 STEPS TO INSTALLING A PACKAGE"
be07bee0 174.
3315e8b3 175The following steps will guide you through your first (and maybe second)
176package installations. In the description, I'll use
177.RI ` package '
178to refer to the package's name, and
179.RI ` version '
180to refer to its version number.
181.PP
182Not all the important features and options are described in this part of
91f52355 183the manual. View it more as a taster for the sorts of things \*(sw can
184do, and a suggestion
3315e8b3 185.SS "1. Download the source distribution"
186Download the package's source distribution. This will normally be in an
187archive called something like
188.IB package - version .tar.gz\c
189\&. At EBI, we put source archive files in
190.BR /sw/common/tr .
191.SS "2. Unpack the source tree"
192Unpack the source tree into the standard source directory. Each source
193tree should have its own directory. Most well-packaged source
194distributions unpack themselves into a neat directory, but less
195fastidious programmers make archives which scatter files all over the
196current directory.
197.PP
198At EBI, we put the source trees in
199.BR /sw/common/src ,
200so unpacking a well-formed source distribution looks like:
201.VS
202cd /sw/common/src
203.BI "gzip \-dc ../tr/" package \- version ".tar.gz | tar xfv \-"
204.VE
205Ill-formed source distributions involve making the directory for the
206package first, changing into it, and then unpacking into the current
207directory:
208.VS
209cd /sw/common/src
210.BI "mkdir " package \- version
211.BI "cd " package \- version
212.BI "gzip \-dc ../../tr/" package - version ".tar.gz | tar xfv \-"
213.VE
214When you've finished unpacking, make sure that your current directory is
215the top level directory of the source tree you unpacked.
91f52355 216.SS "3. Tell \\*(sw what you're up to"
217Now you need to tell \*(sw what you're working on. It will keep track of
218this and other bits of information in a little file and refer to it
219every now and then. It will also whinge at you and refuse to cooperate
220if it can't find its little file, so it's as well to oblige.
3315e8b3 221.PP
91f52355 222To tell \*(sw to create this little file and initialize it with sensible
223values, you just need to say
3315e8b3 224.VS
225.BI "sw setup " "package version"
226.VE
227What could be easier?
228.SS "4. Restrict the build to particular architectures"
229Some packages don't work on all architectures, either because the author
230wasn't sufficiently good at writing portable software, or because the
231program's doing inherently nonportable things.
232.PP
91f52355 233If that's the case, then you need to tell \*(sw to only build on the
234architectures that really work. Do this with the
3315e8b3 235.RB ` "sw only" '
236command. For example, if your package only works on Linux and Solaris,
237say:
238.VS
239sw only i386-linux sparc-solaris
240.VE
91f52355 241You can get a list of the architecture names that \*(sw understands by
242typing
3315e8b3 243.VS
244sw listarch
245.VE
246With a little bit of luck, these names ought to be self-explanatory.
247.PP
248If your package is properly portable and works everywhere then you don't
249need to do anything for this step. Skip on to the next one.
250.SS "5. Configure the package"
251Now it gets complicated. If the package you're building uses
91f52355 252.B Autoconf
3315e8b3 253to configure itself for its current environment then you're in luck.
254You can tell an
91f52355 255.B Autoconf
3315e8b3 256package because there's a script called
257.B configure
258in the top source directory, and a file called
259.BR Makefile.in .
260If it
261.I does
262use
91f52355 263.B Autoconf
3315e8b3 264then run
265.VS
266sw configure
267.VE
268to configure the package on all the platforms it's meant to be built
269for. When you've done that, move onto the next step.
270.PP
271If the package
272.I doesn't
273use
91f52355 274.B Autoconf
3315e8b3 275then all is not lost (although it may be worthwhile complaining at the
276package's author or maintainers). You need to make a collection of
277.IR "link trees" ,
278one for each architecture. These link trees are little replicas of the
279main source tree but with symbolic links instead of the real source
280files. To make the link trees, run
281.VS
282sw linktree
283.VE
284Now, that's not actually quite what you wanted. It's made a link for
285.I every
286file in the source tree. Unfortunately, there are some files you'll
287(probably) have to modify for each architecture in order to configure
288the package to build properly. You can turn links in the link trees
289into real independently editable files by
290.I snapping
291the links. Say for example that
292.B Makefile
293and
294.B config.h
295need to be modified for each architecture. Running the command
296.VS
297sw snaplink Makefile config.h
298.VE
299is sufficient to do the right thing.
300.PP
301Now you must edit the snapped files to configure the package. Make sure
302that the install directories are correctly set. At EBI, all the
303software should be configured so that architecture neutral files end up
304under
305.B /sw/common
306and architecture-specific files end up under
307.BI /sw/common/arch/ arch\c
308\&.
309.SS "6. Build the package"
310Now you've laid the groundwork, everything ought to be easy. Making the
311program ought to involve simply typing
312.VS
313sw make
314.VE
315and waiting for a while. If you had the
316.B curses
91f52355 317library available when \*(sw was built, then your terminal will split
318itself into little independently scrolling windows showing you the
319progress for each architecture. If you're not privileged enough to have
3315e8b3 320.B curses
321then you get the output appropriately tagged with architecture names,
322which is unfortunately fairly hard to read.
323.SS "7. Install the package"
324Most source packages (and almost certainly all
91f52355 325.B Autoconf
3315e8b3 326ones) have a
327.B make
328target
329.RB ` install '
91f52355 330which installs the program correctly. You can run this from \*(sw by
331saying
3315e8b3 332.VS
333sw \-i make install
334.VE
335The little
336.RB ` \-i '
91f52355 337option there tells \*(sw that this is the
3315e8b3 338.IR "install step" .
339When an architecture completes this step correctly, it's marked as being
91f52355 340properly installed, and \*(sw doesn't bother thinking about it again.
3315e8b3 341.PP
342If you
343.I don't
344have an
345.RB ` install '
346makefile target, then you have to install things manually. That's not
347much fun, so moan at the package's author. When you've finished
348fiddling with installation, run
349.VS
350sw -i run true
351.VE
91f52355 352just to tell \*(sw that you've installed everything OK. (This is a bit
353of a kludge.)
3315e8b3 354.SS "8. Update the index"
355Now that everything's built and installed, there's just one more command
356to type:
357.VS
358sw commit
359.VE
91f52355 360This makes \*(sw update its main index of installed packages, telling it
361which architectures packages are installed on, and who did it.
be07bee0 362.
363.\"--------------------------------------------------------------------------
364.
3315e8b3 365.SH "REFERENCE INTRODUCTION"
be07bee0 366.
3315e8b3 367That was a gentle introduction. This section contains the complete
368reference to
369.BR sw :
370far more detail that you probably want. If that's really the case, try
371running
372.VS
373sw \-\-help\-full
374.VE
375to read the available help text. There's quite a lot of it, and it
376ought to keep you occupied for a while.
377.PP
91f52355 378The basic \*(sw command line looks a bit like:
3315e8b3 379.sp 1
91f52355 380.RS 5
381.B sw
3315e8b3 382.RI [ options ]
383.RI [ command
384.RI [ argument ...]]
385.RE
386.sp 1
387If you just say
388.VS
389sw
390.VE
91f52355 391at the shell prompt, \*(sw gives you an extremely terse usage summary
392and quits. You have to tell it to do
3315e8b3 393.IR something .
91f52355 394Most of the time you do this by giving \*(sw a
3315e8b3 395.IR command ,
396like
397.RB ` setup '
398or
399.RB ` make '
400so that it knows what to do. There are some strange command line
91f52355 401options which cause \*(sw to do more exotic things, though.
be07bee0 402.
403.\"--------------------------------------------------------------------------
404.
3315e8b3 405.SH "IMPLEMENTATION ODDITIES"
be07bee0 406.
91f52355 407The \*(sw program that users use is really a small architecture-neutral
408shell script, which works out the current architecture and executes the
3315e8b3 409appropriate architecture-specific main program. It's done this way so
91f52355 410that \*(sw knows that it can use the shell script to start itself up on
411a remote host with a different architecture, something which it does
412quite a lot. The only feature provided by the front-end shell script is
413the
3315e8b3 414.B \-\-archname
91f52355 415command line option, which shouldn't be used by anyone except \*(sw's build procedure anyway.
be07bee0 416.
417.\"--------------------------------------------------------------------------
418.
3315e8b3 419.SH "COMMAND LINE OPTION REFERENCE"
be07bee0 420.
91f52355 421Any \*(sw command line options can be put in the
3315e8b3 422.B SW
91f52355 423environment variable. The \*(sw program will read space-separated
424options from this variable before it reads the command line itself.
3315e8b3 425.PP
91f52355 426The \*(sw program usually understands two different names for each
427option: a traditional Unix single-character name, and a long GNU-style
428name. The short options behave in the normal Unix way: you can join
429them together into single words with a
3315e8b3 430.RB ` \- '
431at the front, for example. The long names are always preceded by a
432double dash. You can abbreviate long names as much as you like, as long
433as the resulting abbreviation is unambiguous. In the descriptions
434below, both the short and long names of the options are shown, but for
435reasons of brevity required arguments are only shown for the long form.
436.PP
91f52355 437There are conceptually two types of \*(sw command line options: those
438which, usually for reasons of consistency with other programs, cause
439\*(sw to do something immediately; and those which store some settings
440for particular commands. The latter type are generally more useful.
441It's worth bearing in mind, though, that the options are only used by a
442few commands. The command reference describes exactly which commands
443use which options.
3315e8b3 444.PP
445The complete list of command line options understood by the current
91f52355 446version of \*(sw is as follows:
3315e8b3 447.TP
448.B "\-h, \-\-help"
91f52355 449Writes 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 450.TP
451.B "\-H, \-\-help\-full"
91f52355 452Writes 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 453text generated by this option. I recommend you pipe it through a pager
454so that you can actually read it.
455.TP
456.B "\-v, \-\-version"
91f52355 457Writes \*(sw's version number to standard output and exits successfully. This is handy
458when trying to decide whether your version of \*(sw has a particular feature, for example.
3315e8b3 459.TP
460.B "\-u, \-\-usage"
461Writes a usage message so terse as to be nearly useless to standard
462output and exits successfully. This is different from just running
463.RB ` sw '
91f52355 464because although both print the same useless message, running \*(sw without any arguments is considered an error, so the message is sent to
465standard error and \*(sw will exit unsuccessfully.
3315e8b3 466.TP
467.BI "\-a, \-\-arch " arch , arch\fR...
468For commands which affect multiple architectures: only affect the
469architectures specified. The architecture names may be separated by
470commas, spaces or both, although clearly commas are most convenient on
91f52355 471the command line. Architecture names may be abbreviated as long as the
472abbreviation is not ambiguous.
473.IP
474This option overrides any other decisions that \*(sw might make about which architectures to process based on the
475.B only\-arch
3315e8b3 476list and the list of correctly built architectures for the current
477package.
478.TP
479.B "\-f, \-\-force"
480For commands which affect multiple architectures: affect even
481architectures that have been successfully built. This has no effect if
482there's a
483.RB ` \-a '
484option in force.
485.TP
486.B "\-i, \-\-install"
487For build commands: this is the final install step, so label architectures
488which successfully complete it as having been completely built. It's
489normal to specify this option on the
490.RB ` "make install" '
491build command.
492.TP
493.BI "\-o, \-\-output " style
494For build commands: select a style for the build output to be displayed
495in. See the section
496.B "Build commands"
497for more details on output styles.
498.TP
499.B "\-b, \-\-beep"
500For build commands: make a beep noise when the build finishes. This
501provides a handy reminder if you're getting on with something else while
502waiting for a long build.
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.
91f52355 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
804Output from the command is both appended to the file
805.IB arch/.build-log
806and output in some
807.IR "output style" ,
808as specified by the
809.RB ` \-o '
810command-line option. See the section
811.B "Output styles"
812below for more details.
813.PP
814If the
815.RB ` \-i '
816option was given on the command line, each architecture on which the
817command succeeds (i.e., reports a zero exit code) is marked as
818.IR "successfully built" ,
819and further build commands will not affect it unless the
820.RB ` \-f '
821command line option is passed, until a
822.B reset
823command is performed.
be07bee0 824.
3315e8b3 825.SS setup \fIpackage version \fR[\fImaintainer\fR]
91f52355 826Sets up various pieces of information required by \*(sw. The
827information here will be added into the main index file by a
828.B commit
829command. The information is maintained in a file named
830.B .sw\-info
831in the current directory.
832.PP
833The
834.I package
835should be the basic name of the package, with versioning information
836stripped off, e.g.,
837.RB ` emacs '
838or
839.RB ` perl ',
840not
841.RB ` emacs\-19.34 '.
842The
843.I version
844should be the version number of the package. The
845.I maintainer
846should be the name of the person principally responsible for maintaining
847the package's local installation. If this isn't specified, the calling
848user's name is used as the maintainer.
849.PP
850The
851.B setup
852command must be run before any build command.
be07bee0 853.
3315e8b3 854.SS snaplink \fIfile \fR[\fIfile\fR...]
91f52355 855Creates architecture-specific versions of a file. Every
856.I file
857named on the command line is copied to
858.IB arch / file
859for every build architecture
860.IR arch ,
861overwriting any existing file or symbolic link of that name. If
862.I file
863contains leading directories then destination directories are created as
864necessary for the output files. Note that the `snap' operation doesn't
865actually need to follow creation of link trees.
be07bee0 866.
867.\"--------------------------------------------------------------------------
868.
91f52355 869.SH "OUTPUT STYLES"
be07bee0 870.
91f52355 871Output from a build command is presented in one of a number of named
872.IR "output styles" .
3315e8b3 873The style name
874.RB ` plain '
875is always defined: it simply prefixes each line of output with the
876name of the architecture which generated the line, which isn't actually
877particularly easy to read. Other output styles may have been configured
91f52355 878into \*(sw when it was compiled.
3315e8b3 879.PP
91f52355 880The set of output styles supported by \*(sw varies according to how it
881was configured. In any particular \*(sw program, you might have some of
882the following:
3315e8b3 883.TP
884.B plain
885Simply prefixes each output line with the name of the architecture it
886came from. This is quite hard to read, but it doesn't require any
887special operating system support or clever terminal.
888.TP
889.B curses
890Splits the terminal into independently scrolling areas, one for each
891architecture, with a status line for each. Waits for a keypress when
892all architectures are finished building.
893.PP
894The
895.RB ` plain '
91f52355 896style is used when the selected style doesn't work (for example, you
897don't have a sufficiently capable terminal for curses output).
3315e8b3 898.PP
899Output style names can be abbreviated as long as the abbreviation is
91f52355 900unambiguous. You can find the list of available output styles by
901executing the command
902.VS
903sw \-o help run
904.VE
905(which is a little counter-intuitive, I know).
3315e8b3 906.PP
907The author has plans to implement an X-based output style, but hasn't
908got around to it yet.
be07bee0 909.
910.\"--------------------------------------------------------------------------
911.
91f52355 912.SH "REMOTE ENVIRONMENT"
be07bee0 913.
91f52355 914The environment for a remote command (executed either through the
915.B rsh
916command, or a build command) is set up as follows:
be07bee0 917.hP \*o
91f52355 918The complete environment passed to \*(sw is used as a basis.
be07bee0 919.hP \*o
91f52355 920Any environment variables defined by the remote execution program
921(usually
922.BR rsh )
923override corresponding variables in the basis environment.
be07bee0 924.hP \*o
e0465a2b 925The
926.B SW_ARCH
927variable is set to the name of the remote host's architecture.
be07bee0 928.hP \*o
91f52355 929Variable assignments are read from the global
930.IB prefix /share/sw\-env
931file. This makes some assignments which are useful everywhere, and will
932then usually include the file
933.B .sw\-env
934in the current directory.
935.PP
936The format of the
937.B sw\-env
938files is documented separately in
939.BR sw\-env (5).
be07bee0 940.
941.\"--------------------------------------------------------------------------
942.
e0465a2b 943.SH LOCAL QUIRKS
be07bee0 944.
e0465a2b 945This section describes how non-vendor software works at EBI. Chances
946are that other sites will work differently. This description is here as
947an example setup for \*(sw.
948.PP
949All the non-vendor software gets put in one big shared filesystem, and
950is exported from our main fileserver. The filesystem is mounted on all
951clients as
952.BR /sw/common .
953Architecture-neutral files are then
954placed in the conventional subdirectories off
955.B /sw/common
956(e.g.,
957.BR /sw/common/share,
958or
959.BR /sw/common/info ).
960Architecture specific files are stored in subdirectories off
961.BR /sw/common/arch .
962For example, Linux binaries go in
963.BR /sw/common/arch/i386-linux/bin ,
964and Solaris libraries in
965.BR /sw/common/arch/sparc-solaris/lib .
966Additionally, each architecture-specific subtree has a symbolic link
967back up to
968.B /sw/common
969for each of the architecture-neutral subdirectories.
970.PP
971There is a symbolic link on every client, from
972.B /sw/arch
973to
974.BI /sw/common/arch/ arch\fR,
975where
976.I arch
977is the architecture of that client. Thus, every client has two
978.I views
979of the software repository: the `common' view where every host sees
980exactly the same mapping between filenames and files, and the `arch'
981view where every host sees the same mapping between filenames and
982programs which do the same job.
983.PP
984And that's just about it.
be07bee0 985.
986.\"--------------------------------------------------------------------------
987.
3315e8b3 988.SH ENVIRONMENT
be07bee0 989.
3315e8b3 990The following environment variables are of interest to
991.BR sw :
992.TP
993.B SW
994Contains a space-separated list of default command-line options. These
995are read before, and overridden by, the actual arguments given on the
996command-line.
997.TP
91f52355 998.B SW_MAKE
999The name of the command to use to run a `make'. This is resolved on the
1000local host once, rather than one for each build host, which is probably
1001a misfeature. To do something more clever, point
1002.B SW_MAKE
1003at a shell script which then picks out the right architecture-specific
1004.RB ` make '
1005program from the remote environment.
1006.TP
3315e8b3 1007.B SW_RSH
1008The name of the remote-shell program to use. By default, something
1009similar to
1010.B rsh
1011is chosen. I recommend using the excellent
1012.B ssh
1013program instead.
be07bee0 1014.
1015.\"--------------------------------------------------------------------------
1016.
3315e8b3 1017.SH FILES
be07bee0 1018.
3315e8b3 1019The following files are of interest to
1020.BR sw :
1021.TP
91f52355 1022.IB prefix /sw\-index
3315e8b3 1023The main index file, containing the list of which packages have been
1024installed for which architectures. See
1025.BR sw-info (5)
1026for file format details.
1027.TP
1028.IB prefix /share/archtab
1029The architecture-to-host mapping file. See
1030.BR archtab (5)
1031for file format details.
1032.TP
91f52355 1033.IB prefix /share/sw\-env
3315e8b3 1034Contains global environment variable settings. See
1035.BR sw-env (5)
1036for file format details.
1037.TP
4f71fd6c 1038.IB prefix /share/sw\-precommit
1039Optional script used to approve commit requests. See the
1040.B commit
1041command above for calling details.
1042.BR sw-env (5)
1043for file format details.
1044.TP
91f52355 1045.IB package /.sw\-info
3315e8b3 1046Contains the persistent information about a particular package's build
1047status. See
1048.BR sw-info (5)
1049for file format details.
1050.TP
91f52355 1051.IB package /.sw\-env
3315e8b3 1052Contains package-specific environment variable settings. See
1053.BR sw-env (5)
1054for file format details.
1055.TP
91f52355 1056.IB package / arch /.build\-log
3315e8b3 1057Contains all the build output for a particular architecture. Usually
1058not very interesting, but might be handy one day.
be07bee0 1059.
1060.\"--------------------------------------------------------------------------
1061.
3315e8b3 1062.SH BUGS
be07bee0 1063.
3315e8b3 1064There are no bugs in
1065.BR sw ,
1066merely unexpected behaviour modes. Silly you for thinking otherwise.
be07bee0 1067.
3315e8b3 1068.SH AUTHOR
be07bee0 1069.
91f52355 1070The \*(sw program, and this manual, are \*(mw productions, in association
1071with the European Bioinformatics Institute. They were written by Mark
3315e8b3 1072Wooding <mdw@nsict.org>. Go and ask him if you have problems.
be07bee0 1073.
3315e8b3 1074.\"----- That's all, folks --------------------------------------------------