/[polypkg]/trunk/DOC
ViewVC logotype

Contents of /trunk/DOC

Parent Directory Parent Directory | Revision Log Revision Log


Revision 222 - (show annotations)
Thu Jun 18 00:13:04 2009 UTC (5 months ago) by tperciva
File size: 21591 byte(s)
Allow packager to make service installation optional

This changes the default, where on platforms that support it
(Solaris, others?) the user would be prompted whether to install
each service. Services are now installed automatically without
asking unless the packager specifies optional=yes in the spec file.

Inspired by part of QAS r892.
1
2 PolyPackage - a distributable cross-platform packaging system
3
4 This document describes the generic packaging interface.
5
6 Features
7
8 - redistributable for source packages
9 - assumes simple common case
10 - based on Bourne Shell; embeddable shell
11 - provides signal-based native 'service' integration
12 - uses notion of 'components' (runtime, debugging, development, doc)
13
14 Examples
15
16 1. Simple binary tool package
17
18 %set
19 name="hello"
20 description="Hello, world"
21
22 %files run
23 /usr/bin/*
24
25 2. Service example
26
27 %set
28 name="hellod"
29 description="Hello, world service"
30
31 %files run
32 /usr/libexec/*
33
34 %service hellod
35
36 3. Library example
37
38 %set
39 name="libhello"
40 description="Hello, world library"
41
42 %files run
43 /usr/lib/libhello.%so
44
45 %files dev
46 /usr/lib/libhello.a
47 /usr/include/hello.h
48
49 4. Diagnostic example
50
51 %set
52 name="hello"
53 description="Hello tool"
54
55 %files run
56 /usr/bin/hello
57
58 %files dbg
59 /usr/bin/hello-dump
60
61 Invocation
62
63 pp [options] [input-file] [var=value...]
64
65 -d --debug -- write copious info to stderr
66 --destdir=path -- defaults to $DESTDIR
67 -i --install-script=path -- create a helper install script
68 -l --list -- write package filenames to stdout
69 --no-clean -- don't remove files in wrkdir
70 --no-package -- do everything but create packages
71 --only-front -- only perform front-end actions
72 -p --platform=platform -- defaults to local platform
73 --probe -- print host identifier and exit
74 --wrkdir=path -- defaults to $TMPDIR or /tmp
75 --vas-platforms -- print VAS platform equivalent IDs
76 -v --verbose -- write info to stderr
77 --version -- write version and exit
78
79 input-file -- defaults to '-', meaning stdin
80
81 Platforms
82
83 PolyPackage determines the platform type by invoking 'uname -s'.
84
85 PolyPackage is a shell script that runs on most versions of the
86 Bourne or Korn shell. For file globbing on Solaris, ksh must be
87 used instead of sh. The following tests are used to determine if
88 the current shell is sufficient or if another shell should
89 be executed to run the pp script.
90
91 echo /{usr,bin} - {}-mode, no re-execute
92 echo /@(usr|bin) - @()-mode, no re-execute
93 ksh -c 'echo /{usr,bin}' - re-execute
94 ksh -c 'echo /@(usr|bin)' - re-execute
95 bash -c 'echo /{usr,bin}' - re-execute
96 bash -c 'echo /@(usr|bin)' - re-execute
97
98 Helper install script
99
100 The --install-script option directs pp to generate a helper shell
101 script that provides a uniform interface to the platform's packaging
102 tool.
103
104 The helper script takes one of the following as command arguments:
105
106 list-services -- lists services defined in the pkg
107 list-components -- lists components defined in the pkg
108 list-files {cpt...|all} -- lists package files containing cpts
109 install {cpt...|all} -- installs pkgs containig cpts
110 uninstall {cpt...|all} -- uninstalls pkgs containing cpts
111 start {svc...} -- starts the service
112 stop {svc...} -- stops the service
113 print-platform -- prints lowest platform for pkg
114
115 The 'install' command performs an upgrade if another version of
116 the software is already installed. Even if you are installing an
117 older version, this command will still succeed.
118
119 The following options are understood before the script command argument:
120
121 -q -- quiet mode: do not show package tool invocations
122
123 Sections
124
125 Sections are introduced by %-directives. These directives are
126 on a line by themselves. The first character the line must be a '%'.
127 Whitespace after the first '%' is always removed. e.g.:
128
129 %foo
130 % bar
131
132 A line that starts with '%%' is be treated as if it were a
133 literal line and the first '%' and following whitespace
134 will be removed.
135
136 %% this line will not be interpreted as a %-directive
137
138 Conditionals
139
140 The special %-directives %if, %else and %endif are processed
141 before sections. The argument to %if and %else is given to the
142 shell's "test" builtin.
143
144 %if $name = "foo"
145 % ignore
146 some lines for the foo package only
147 %endif
148
149 There is no %elif. Use nested %if instead.
150
151 If the argument to the %if directive starts with '[' then it
152 is interpreted as a platform qualifier. A platform qualifier
153 is a comma-separated list of platform names enclosed in square
154 brackets. No whitespace is permitted within the brackets.
155
156 %if [solaris,rpm]
157 some lines for solaris and rpm systems only
158 %endif
159
160 %if [!sd]
161 some lines for non-hpux systems
162 %endif
163
164 If a line begins with a [platform] qualifier then it applies to
165 that line only. For example:
166
167 %files run
168 /etc/foo
169 [aix] /etc/aix/bar
170 [!aix] /etc/bar
171
172 If a line starts in column 1 with the '#' character, then the
173 line is disabled as if it had started with '[!]'.
174
175 Many sections directives (e.g. %files, described below) take
176 an optional 'qualifier' argument which selectively enables or
177 disables the entire section.
178
179 To prevent a line from being treated specially, either as
180 a section directive, or as prefixed with a qualifier, you must
181 start the line with the two characters '%\'. The '%\' is removed
182 and the rest of the line is treated as an unqualified non-directive.
183
184 The %set section
185
186 The %set section directive causes successive lines to
187 be interpreted as literal shell code. The section body is stored
188 in a text file and then sourced with the shell's '.' operator at
189 the end of the section.
190
191 %set
192 name="foo"
193 version="1.0"
194
195 Variables expected to be declared in this section are:
196
197 name - simple identifier name of the package
198 version - version identifier: must start with
199 a digit, and consist of only digits and
200 periods. At most three periods are
201 permitted.
202 summary - summary of package, limit 40 characters
203 [defaults to "no summary"]
204 description - A paragraph describing the package.
205 Can be placed in quotes where newlines
206 will be replaced by spaces.
207 [defaults to "No description"]
208 copyright - copyright message, limit 40 characters
209 [default is "(c) YYYY, Quest Software..."]
210
211 The %set section is *not* subject to %{} or %() expansion.
212
213 Output of a %set section:
214
215 Each %set section generates a temporary file, whose contents
216 are sourced by the driver shell script at the end of seeing the
217 section. The temporary file is then immediately deleted. The
218 variables are then available to the rest of the script. Variable
219 names starting with $pp_ are private to polypackage.
220
221 The %files sections
222
223 The files comprising the various components of the package
224 are listed in the %files sections.
225
226 The %files section directive must be followed by one of the
227 four standard component names: run dev doc dbg. If the component
228 is missing, 'run' is assumed.
229
230 %files [component]
231
232 The section body ignores blank lines and lines starting with '#'.
233 Whitespace at the beginning of lines is ignored. The format
234 of body lines is as follows:
235
236 path-glob [octal-mode] [[owner]:[group]] [flags] [target]
237
238 'Path-glob' is an absolute pathname which may contain the wildcard
239 and pattern metacharacters *,?,[,],{,}.
240
241 Impl note: {,}-patterns are converted into /@(|)-patterns
242 for some shells. This is automatically detected and performed.
243
244 If the path-glob is of the form 'path/**' then it is converted
245 into a list of all files and directories under (but not including)
246 the directories matched by path. If you want to include the
247 parent directory as well as all children, you must list the
248 directory separately:
249
250 /path/to/dir/
251 /path/to/dir/**
252
253 If the path-glob ends with %so then it is replaced with
254 platform's native shared library suffix pattern.
255 On HP-UX this is .sl*, and on other platforms it is .so*.
256 For AIX, .a is used.
257
258 /usr/lib/libfoo.%so
259
260 Source files matching the path-glob must exist in a directory
261 rooted under $DESTDIR unless the 'optional' flag is supplied.
262 If the path-glob refers to a directory, it *must* end with a
263 trailing slash.
264
265 The octal-mode argument must start with a digit or be
266 the special word '=' meaning to use the mode of the
267 source file.
268
269 The owner:group argument must contain a ':'. Either or both
270 of the owner or group paths are optional, or can be specified
271 as '=' meaning to use the mode of the source file.
272
273 The defaults for unspecified mode, owner and group depend on the
274 platform, path prefix, and the file type. Generally, if the
275 path is a directory, the default mode will be 755. For normal
276 files the default mode is generally 644.
277
278 If the source file is a symlink, then the package will include
279 a symlink. If the target of the source symlink begins with $DESTDIR,
280 then it is stripped. If a target is specified in flags, then
281 the source file is ignored. Symlink modes are ignored.
282
283 'Flags' is a comma-delimited list of flags. Valid flags are:
284 volatile - uninstall will ignore changes in the file
285 optional - ignore if the path-glob matches nothing
286 symlink - The file must be packaged as a symlink
287 ignore - ignore this file (don't package it)
288 ignore-others - ignore all other mentions of this file
289 (useful for wildcards)
290
291 If the 'symlink' flag is given, a symlink target should be
292 given.
293
294 /etc/foo.conf volatile,optional
295
296 The %files section is not subjected to %() or %{} expansion.
297 However, paths are expanded using shell globbing, so shell
298 metacharacters are interpreted.
299
300 Output of %files sections:
301
302 The result of processing all the %files sections is a collection
303 of 'expanded' per-component %files lists, called "%files.run", etc.
304 Each line of these files is of the form
305
306 [d|f] mode owner group flags path
307 s mode owner group flags path target
308
309 Where d,f,s indicate directory, file or symbolic link.
310 The v field indicates volatility, or '-' for a placeholder.
311 The mode of symbolic links is ignored but written as 777.
312
313 The %fixup stage may be used to edit the %files components.
314
315 The %post and %preun sections
316
317 The %post and %preun sections define shell scripts that
318 are executed after file components are installed, and before
319 file components are uninstalled.
320
321 %post [component] [qualifier]
322 %preun [component] [qualifier]
323
324 The body of these sections is treated as shell script, but
325 %{} and %() expansion takes place. The shell script body is
326 appended to any previous %post/%preun scripts for that component.
327
328 %{} and %() expansion
329
330 Because most sections (%set being an exception) are deferred
331 until later for exection, it is sometimes useful to be able
332 to perform variable expansion early. Otherwise, later %set
333 sections may change variables, and variable used in the
334 other sections will be different when they eventually get run.
335
336 Subtrings of the form "%{FOO}" are replaced by the content of
337 the shell variable $FOO. (Other shell variable forms such as
338 "%{FOO:-default}" are possible: the '%' is replaced by a '$'
339 and then evaluated up to the '}'.
340
341 Substrings of the form %() are expanded using the shell's
342 backquote. e.g. "%(echo hello; echo there)" becomes "hello there".
343
344 %{} and %() expressions must not contain the characters '}', ')'
345 or newlines. If you must include those characters, create
346 them in variables in an earlier %set section, or put them in
347 an external file and use %(cat file).
348
349 Output of %post or %preun sections
350
351 The result of processing the %post or %preun sections are files such as
352 "%post.run" or "%preun.dbg". The platform-specific code ensures
353 that these scripts are invoked at the right times during
354 installation.
355
356 Exit codes
357
358 The %post, %preun, and %check scripts are automatically appended
359 with an 'exit 0' statement. For a script to terminate installation,
360 it must explicitly invoke 'exit 1'.
361
362 The %service section
363
364 A %service section consists of the directive %service followed
365 by a simple service identifier. If omitted, the simple name of the
366 package is used.
367
368 %service [name] [qualifier]
369
370 The body of a %service section consists of shell text. It is
371 expected to set some simple shell variables, and is effectively
372 treated much like a %set section.
373
374 The service sections assume the common case of a daemon process
375 started at boot time and controlled by native platform service
376 management tools.
377
378 A service is assumed to be started as invocation of an executable
379 file with some arguments. Two flavours of service are assumed
380
381 the program forks, becomes a daemon, the parent writes
382 the child's PID to a well-known path and exits true.
383
384 the program does not fork or become a daemon. No PID file
385 is written.
386
387 The first style is selected by providing a 'pidfile' variable,
388 where the second style is selected by setting the pidfile variable
389 to the empty string (the default for each %service section).
390
391 Platform-independent variables expected to be set are:
392
393 cmd Shell command to execute
394 pidfile Path to a file containing the PID as
395 the first word on the first line.
396 stop_signal Signal number that gracefully stops
397 the process [default 15]
398 user User to run the service as [default root]
399 group Insert into a virtual service group which
400 will shutdown/startup all member services.
401 optional Whether the user will be asked if he wants
402 to install the service at installation time
403 (where supported). Default: no
404 enable Whether to enable the service during postinst
405 (installation time). Default: yes
406
407 Other platform-specific variables may be provided in this
408 section and are treated differently.
409
410 The %service section, like other non-%set sections is subject to
411 immediate %{} and %() expansion.
412
413 Output of a %service section:
414
415 The result of processing a %service section is to create or
416 append to a file called %service.name, where 'name' is the
417 name given to the service. The file will contains the shell
418 text. The shell text is sourced and then platform-specific
419 changes are made to the other output files before %fixup
420
421 The %require section
422
423 * UNIMPLEMENTED *
424
425 The dependency section lists the names of interfaces that
426 a component requires in order to function.
427
428 Backends will generate most of a package's requirements
429 automatically. This section is provided only for requirements
430 which polypkg fails to detect.
431
432 The %require directive is followed by a component name; 'run'
433 is assumed if it is omitted.
434
435 %require [component] [qualifier]
436
437 The body of a require section consists of interface names
438 as describe below under 'Interface names'. Blank lines,
439 or lines starting with '#' are ignored. The lines can
440 contain shell variable expansion.
441
442 Lines starting with "+" indicate platform-specific dependency
443 information. See the platform backend documentation for details.
444
445 The %require section, like other non-%set sections is subject to
446 immediate %{} and %() expansion.
447
448 Multiple %require sections for a component are concatenated
449 together. Lines beginning with # and blank lines are removed.
450 Whitespace at the beginning of lines is ignored.
451
452 Output of a %require section
453
454 The result of processing all the %require and %file sections results
455 in files called %require.run etc which contain lines of either
456 of the forms
457
458 kind:interface
459 + text
460
461 The %provide section
462
463 * UNIMPLEMENTED *
464
465 This optional section is a counterpart to %require.
466 It is used to indicate interfaces provided by the package.
467 You only need to use this section for provided interfaces that
468 polypkg was unable to discover.
469
470 It is most useful for specifying virtual packages.
471
472 Like the %require section, lines starting with '+' are passed
473 through to the backend, which may ignore them.
474
475 Output of a %provide section
476
477 The result of processing all the %provide and %files sections
478 results in files called %provide.run, etc. which contain lines of
479 either of the forms
480
481 kind:interfaces
482 + text
483
484 The %check section
485
486 The check section body contains a shell script that
487 is executed on the target host to ensure that dependencies
488 are met. It is processed in a manner very similar to %post
489 or %preun.
490
491 If the script calls 'exit 1', installation will be
492 cancelled. The script *must* write an explanation
493 to the standard output before calling 'exit 1'.
494
495 %check [component]
496
497 The check section must not be interactive.
498
499 The check script might not be executed on some platforms.
500
501
502 The %fixup section
503
504 The fixup section body contains shell text that is run
505 immediately before the platform packaging tools are executed.
506 It is processed in a manner similar to %set.
507
508 %fixup [qualifier]
509
510 The %fixup directive is not followed by any component identifier.
511 This is really only intended as a last-resort place to hold
512 any horrible hackery required. It is a last chance to perform
513 changes before the active backend creates its package files.
514
515 Output of a %fixup section
516
517 The bodies of fixup sections are concatenated together
518 into a temporary file, and executed together.
519
520 The %pp section
521
522 This optional section has no body. It specifies a version of
523 the PolyPackage API that the file expects to use. This
524 document descibes version 1.0.
525
526 %pp 1.0
527
528 This section can be specified early to make use of
529 particular features of an older interface.
530
531 The %ignore section
532
533 These sections contain text that is always ignored by
534 polypkg. This could be useful for comments.
535
536 %ignore
537
538 The %depend section
539
540 The package's dependencies as they will appear verbatim in the
541 package's control file. A component can be specified, otherwise
542 the "run" component is assumed.
543
544 Dependencies are specified in the %depend section up until the
545 next section. Dependencies should be specified on a single line,
546 but may be split - each line is simply concatenated *without*
547 adding any separator characters (such as ",").
548
549 At time of writing only the deb backend implements this kind of
550 explicit dependency. Its syntax is subject to change. See
551 http://www.debian.org/doc/debian-policy/ch-relationships.html#s-depsyntax
552 for the syntax.
553
554
555 Output filenames
556
557 The output from polypkg is one or more package files, and optionally
558 a helper script (inst) that can be used to manipulate the package file(s)
559 through a uniform interface.
560
561 Package filenames default to the following:
562
563 rpm <name>[-<cpt>]-<version>-1.<arch>.rpm
564 deb <name>[-<cpt>]_<version>-1_<arch>.deb
565 aix <name>.<version>.bff
566 sd <name>-<version>.depot
567 solaris <name>-<version>.pkg
568 macos <name>-<version>.dmg
569
570
571 Interface names
572
573 * UNIMPLEMENTED *
574
575 polypkg can compute the full canonical dependency list of a package,
576 and record it in the helper script.
577
578 Dependencies (and provisions) are specified as a set of interfaces names.
579 All interface names are of the form as:
580
581 <kind>:<identifier>
582
583 Examples of 'primitive' interface names are:
584
585 isa:sparc.1 - Processor executes Sparc1 instructions
586 isa:x86_64 - Processor executes AMD64/EM64T instrs
587 exe:elf32.EM_386 - OS loads ELF32 exes with e_type=EM_386
588 exe:elf64.EM_X86_64 - OS loads ELF64 exes with e_type=EM_X86_64
589 ld:libc.so.1 - Dynamic loader that can load libc.so.1
590 file:/bin/sh - The file /bin/sh
591 pkg:rpm:openssl-0.9.8g - Particular openSSL RPM package
592
593 Interfaces normally have no linear order. That is, you can't express
594 "versions after x.y.z". All version info must be explicit and match
595 exactly. Expressed interfaces are not optional. Disjunction is not
596 supported.
597
598 Polypkg will scan the files in %files to generate a list of required
599 interfaces. The list can be supplemented by entries in the %depend
600 section, or explicit checks can be added to the %check section.
601
602 Virtual interfaces are of the form virtual:<identifier> and are not
603 checked by polypkg. However, you
604
605 Polypkg will generate package metadata that tests for the existence
606 of all dependencies. Usually this is created as an extra %check script,
607 but it may be split between the %check script and the packaging system,
608 should it be capable of testing for some of the native dependencies.
609
610 Polypkg's helper script can be run in a mode to list all the primitive
611 interfaces required by the package, and all the interfaces provided,
612 should the package be installed.
613
614 inst.sh --required-interfaces > ifc.list
615 inst.sh --provided-interfaces > ifc.list
616
617 Polypkg can be run in a mode where it can check for all the interfaces
618 supplied on standard input. Any missing interfaces are printed to standard
619 output, and cause the script to exit with an error at the end.
620
621 pp --check-interfaces < ifc.list
622
623

Ted.Percival@quest.com
ViewVC Help
Powered by ViewVC 1.1.2