| 1 |
<?xml version='1.0'?>
|
| 2 |
<?xml-stylesheet
|
| 3 |
href="/usr/share/xml/docbook/stylesheet/css/current/driver.css"
|
| 4 |
type="text/css"?>
|
| 5 |
|
| 6 |
<book>
|
| 7 |
<title>PolyPackage</title>
|
| 8 |
<subtitle>A distributable cross-platform packaging system</subtitle>
|
| 9 |
|
| 10 |
<bookinfo>
|
| 11 |
<author><firstname>David</firstname>
|
| 12 |
<surname>Leonard</surname></author>
|
| 13 |
<copyright><year>2006</year>
|
| 14 |
<holder>Quest Software, Inc.</holder></copyright>
|
| 15 |
</bookinfo>
|
| 16 |
|
| 17 |
<preface>
|
| 18 |
<title>About this document</title>
|
| 19 |
<para>This document covers the PolyPackage system.</para>
|
| 20 |
</preface>
|
| 21 |
|
| 22 |
<chapter>
|
| 23 |
<title>Introduction</title>
|
| 24 |
|
| 25 |
|
| 26 |
<section>
|
| 27 |
<title>Features</title>
|
| 28 |
<para>
|
| 29 |
PolyPackage has various features that make it more useful
|
| 30 |
than RPM or EPM:
|
| 31 |
</para>
|
| 32 |
|
| 33 |
<itemizedlist>
|
| 34 |
<listitem>self-contained and redistributable in source packages</listitem>
|
| 35 |
<listitem>based on Bourne Shell and POSIX environment</listitem>
|
| 36 |
<listitem>platform-specific backends independent of each other</listitem>
|
| 37 |
<listitem>assumes simple common packaging case</listitem>
|
| 38 |
<listitem>provides native 'service' integration</listitem>
|
| 39 |
<listitem>provides fixed 'component' or sub-package abstractions
|
| 40 |
that map to platform-specific forms
|
| 41 |
(runtime, debugging, development, doc)</listitem>
|
| 42 |
</itemizedlist>
|
| 43 |
</section>
|
| 44 |
|
| 45 |
|
| 46 |
<section>
|
| 47 |
<title>Example packaging descriptions</title>
|
| 48 |
|
| 49 |
<para>Here are some simple, but complete, package description examples
|
| 50 |
to demonstrate what PolyPackage can do.</para>
|
| 51 |
|
| 52 |
<example>
|
| 53 |
<title>Simple binary tool package</title>
|
| 54 |
<programlisting>
|
| 55 |
<![CDATA[%set
|
| 56 |
name="hello"
|
| 57 |
description="Hello, world"
|
| 58 |
|
| 59 |
%files run
|
| 60 |
/usr/bin/*]]>
|
| 61 |
</programlisting>
|
| 62 |
</example>
|
| 63 |
|
| 64 |
<example>
|
| 65 |
<title>Service example</title>
|
| 66 |
<programlisting>
|
| 67 |
<![CDATA[%set
|
| 68 |
name="hellod"
|
| 69 |
description="Hello, world service"
|
| 70 |
|
| 71 |
%files run
|
| 72 |
/usr/libexec/*
|
| 73 |
|
| 74 |
%service hellod]]>
|
| 75 |
</programlisting>
|
| 76 |
</example>
|
| 77 |
|
| 78 |
<example>
|
| 79 |
<title>Library example</title>
|
| 80 |
<programlisting>
|
| 81 |
<![CDATA[%set
|
| 82 |
name="libhello"
|
| 83 |
description="Hello, world library"
|
| 84 |
|
| 85 |
%files run
|
| 86 |
/usr/lib/libhello.%so
|
| 87 |
|
| 88 |
%files dev
|
| 89 |
/usr/lib/libhello.a
|
| 90 |
/usr/include/hello.h]]>
|
| 91 |
</programlisting>
|
| 92 |
</example>
|
| 93 |
|
| 94 |
<example>
|
| 95 |
<title>Diagnostic example</title>
|
| 96 |
<programlisting>
|
| 97 |
<![CDATA[%set
|
| 98 |
name="hello"
|
| 99 |
description="Hello tool"
|
| 100 |
|
| 101 |
%files run
|
| 102 |
/usr/bin/hello
|
| 103 |
|
| 104 |
%files dbg
|
| 105 |
/usr/bin/hello-dump]]>
|
| 106 |
</programlisting>
|
| 107 |
</example>
|
| 108 |
</section>
|
| 109 |
|
| 110 |
</chapter>
|
| 111 |
|
| 112 |
<chapter>
|
| 113 |
<title>Reference</title>
|
| 114 |
|
| 115 |
<section>
|
| 116 |
<title>Invoking the pp script</title>
|
| 117 |
|
| 118 |
<cmdsynopsis>
|
| 119 |
<title>Synopsis</title>
|
| 120 |
<command>pp</command>
|
| 121 |
<arg>--debug</arg>
|
| 122 |
<arg>--destdir <replaceable>path</replaceable></arg>
|
| 123 |
<arg>--install</arg>
|
| 124 |
<arg>--list</arg>
|
| 125 |
<arg>--no-package</arg>
|
| 126 |
<arg>--only-front</arg>
|
| 127 |
<arg>--platform</arg>
|
| 128 |
<arg>--wrkdir <replaceable>path</replaceable></arg>
|
| 129 |
<arg>--verbose</arg>
|
| 130 |
<arg choice="plain"><replaceable>input-file</replaceable></arg>
|
| 131 |
</cmdsynopsis>
|
| 132 |
|
| 133 |
<variablelist>
|
| 134 |
<title>Options</title>
|
| 135 |
<varlistentry>
|
| 136 |
<term><arg>-d</arg> <arg>--debug</arg></term>
|
| 137 |
<listitem>write copious info to stderr</listitem>
|
| 138 |
|
| 139 |
<term><arg>--destdir <replaceable>path</replaceable></arg></term>
|
| 140 |
<listitem>defaults to $DESTDIR</listitem>
|
| 141 |
|
| 142 |
<term><arg>--install</arg></term>
|
| 143 |
<listitem>install the resulting package(s)</listitem>
|
| 144 |
|
| 145 |
<term><arg>-l</arg> <arg>--list</arg></term>
|
| 146 |
<listitem>write package filenames to standard output</listitem>
|
| 147 |
|
| 148 |
<term><arg>--no-clean</arg></term>
|
| 149 |
<listitem>do not remove wrkdir</listitem>
|
| 150 |
|
| 151 |
<term><arg>--no-package</arg></term>
|
| 152 |
<listitem>do everything but create packages</listitem>
|
| 153 |
|
| 154 |
<term><arg>-p</arg> <arg>--platform <replaceable>platform-name</replaceable></arg></term>
|
| 155 |
<listitem>select the platform-specific packager backend</listitem>
|
| 156 |
|
| 157 |
<term><arg>--wrkdir <replaceable>path</replaceable></arg></term>
|
| 158 |
<listitem>specifies directory to put working files</listitem>
|
| 159 |
|
| 160 |
<term><arg>-v</arg> <arg>--verbose</arg></term>
|
| 161 |
<listitem>write additional information to standard error</listitem>
|
| 162 |
|
| 163 |
<term><arg><replaceable>input-file</replaceable></arg></term>
|
| 164 |
<listitem>package description file; defaults to <quote>-</quote>
|
| 165 |
meaning standard input</listitem>
|
| 166 |
|
| 167 |
</varlistentry>
|
| 168 |
</variablelist>
|
| 169 |
|
| 170 |
|
| 171 |
</section>
|
| 172 |
</chapter>
|
| 173 |
|
| 174 |
<chapter>
|
| 175 |
<title>Platforms and portability</title>
|
| 176 |
|
| 177 |
<para>
|
| 178 |
PolyPackage determines the current platform type by invoking
|
| 179 |
'uname -s' and finding a backends which understands it.
|
| 180 |
</para>
|
| 181 |
|
| 182 |
<section>
|
| 183 |
<title>Bourne shell requirements</title>
|
| 184 |
|
| 185 |
<para>
|
| 186 |
PolyPackage is a shell script that runs on most versions of the
|
| 187 |
Bourne or Korn shell. One of the problematic features of
|
| 188 |
PolyPakcage is that it uses the shell's interpretation of
|
| 189 |
braces for filename generation or 'globbing'.
|
| 190 |
</para>
|
| 191 |
|
| 192 |
<para>
|
| 193 |
PolyPackage will detect if the Bourne Shell has this featured,
|
| 194 |
and if not it will find a suitable shell that does. On Solaris,
|
| 195 |
this usally means an invocation of the Korn shell.
|
| 196 |
</para>
|
| 197 |
</section>
|
| 198 |
</chapter>
|
| 199 |
|
| 200 |
<chapter>
|
| 201 |
<title>Description file format</title>
|
| 202 |
|
| 203 |
<section>
|
| 204 |
<title>Sections</title>
|
| 205 |
<para>
|
| 206 |
Sections are introduced by %-directives. A line that starts with '%%'
|
| 207 |
will be treated as if it were a literal line and the first '%' will
|
| 208 |
be removed.
|
| 209 |
</para>
|
| 210 |
<example>
|
| 211 |
<![CDATA[%% this line will not be interpreted as a %-directive]]>
|
| 212 |
</example>
|
| 213 |
</section>
|
| 214 |
|
| 215 |
<section>
|
| 216 |
<title>Conditionals</title>
|
| 217 |
<para>
|
| 218 |
The special %-directives %if, %else and %endif are processed
|
| 219 |
before sections. The argument to %if and %else is a shell command
|
| 220 |
whose standard output is discarded. Note that '!' is understood by
|
| 221 |
the shell to invert the exit code of the command.
|
| 222 |
</para>
|
| 223 |
<example>
|
| 224 |
<![CDATA[%if [ $platform = aix ]
|
| 225 |
some lines
|
| 226 |
%endif]]>
|
| 227 |
</example>
|
| 228 |
</section>
|
| 229 |
|
| 230 |
<section>
|
| 231 |
<title>The %set section</title>
|
| 232 |
<para>
|
| 233 |
The %set section directive causes successive lines to
|
| 234 |
be interpreted as literal shell code. The section body is stored
|
| 235 |
in a text file and then sourced with the '.' operator at the
|
| 236 |
end of the section.
|
| 237 |
</para>
|
| 238 |
<example><![CDATA[%set
|
| 239 |
name="foo"
|
| 240 |
version="1.0"]]>
|
| 241 |
</example>
|
| 242 |
|
| 243 |
<para>
|
| 244 |
Variables expected to be declared in this section are:
|
| 245 |
<variablelist>
|
| 246 |
<varlistentry>
|
| 247 |
<term>name</term>
|
| 248 |
<listitem>simple identifier name of the package</listitem>
|
| 249 |
<term>version</term>
|
| 250 |
<listitem>version identifier: must start with a digit,
|
| 251 |
and consist of only digits and periods. At most three
|
| 252 |
periods are permitted.</listitem>
|
| 253 |
<term>summary</term>
|
| 254 |
<listitem>summary of the package, limit 40 characters.
|
| 255 |
Defaults to "no summary"</listitem>
|
| 256 |
<term>description</term>
|
| 257 |
<listitem>A paragraph describing the package. Can be placed
|
| 258 |
in quotes where newlines will be replaced by spaces.
|
| 259 |
Defaults to "No description".</listitem>
|
| 260 |
<term>copyright</term>
|
| 261 |
<listitem>copyright message, limit 40 characters.
|
| 262 |
Default is "(c) YYYY, Quest Software..."</listitem>
|
| 263 |
</varlistentry>
|
| 264 |
</variablelist>
|
| 265 |
</para>
|
| 266 |
|
| 267 |
<section>
|
| 268 |
<title>Output of a %set section:</title>
|
| 269 |
<para>
|
| 270 |
Each %set section generates a temporary file, whose contents
|
| 271 |
are sourced by the driver shell script at the end of seeing the
|
| 272 |
section. The temporary file is then immediately deleted. The
|
| 273 |
variables are then available to the rest of the script. Variable
|
| 274 |
names starting with $pp_ are private to polypackage.
|
| 275 |
</para>
|
| 276 |
</section>
|
| 277 |
</section>
|
| 278 |
|
| 279 |
<section>
|
| 280 |
<title>The %files sections</title>
|
| 281 |
<para>
|
| 282 |
The files comprising the various components of the package
|
| 283 |
are listed in the %files sections.
|
| 284 |
</para>
|
| 285 |
<para>
|
| 286 |
The %files section directive must be followed by one of the
|
| 287 |
four standard component names: run dev doc dbg. If the component
|
| 288 |
is missing, 'run' is assumed.
|
| 289 |
</para>
|
| 290 |
|
| 291 |
<cmdsynopsis>
|
| 292 |
<command>%files</command>
|
| 293 |
<arg><replaceable>component</replaceable></arg>
|
| 294 |
</cmdsynopsis>
|
| 295 |
|
| 296 |
<para>
|
| 297 |
The section body ignores blank lines and lines starting with '#'.
|
| 298 |
Whitespace at the beginning of lines is ignored. The format
|
| 299 |
of body lines is as follows:
|
| 300 |
|
| 301 |
path-glob [octal-mode] [[owner]:[group]] [flags] [target]
|
| 302 |
</para>
|
| 303 |
</section>
|
| 304 |
</chapter>
|
| 305 |
</book>
|
| 306 |
|
| 307 |
<!-- TO BE COMPLETED -->
|
| 308 |
|
| 309 |
<!--
|
| 310 |
'Path-glob' is an absolute pathname which may contain the wildcard
|
| 311 |
and pattern metacharacters *,?,[,],{,}.
|
| 312 |
|
| 313 |
Impl note: {,}-patterns may be converted into /@(|)-patterns
|
| 314 |
|
| 315 |
If the path-glob ends with %so then it is replaced with
|
| 316 |
platform's native shared library suffix pattern.
|
| 317 |
On HP-UX this is .sl*, and on other platforms it is .so*.
|
| 318 |
For AIX, .a is used.
|
| 319 |
|
| 320 |
/usr/lib/libfoo.%so
|
| 321 |
|
| 322 |
Source files matching the path-glob must exist in a directory
|
| 323 |
rooted under $DESTDIR unless the 'optional' flag is supplied.
|
| 324 |
If the path-glob refers to a directory, it *must* end with a
|
| 325 |
trailing slash.
|
| 326 |
|
| 327 |
The octal-mode argument must start with a digit or be
|
| 328 |
the special word '=' meaning to use the mode of the
|
| 329 |
source file.
|
| 330 |
|
| 331 |
The owner:group argument must contain a ':'. Either or both
|
| 332 |
of the owner or group paths are optional, or can be specified
|
| 333 |
as '=' meaning to use the mode of the source file.
|
| 334 |
|
| 335 |
The defaults for unspecified mode, owner and group depend on the
|
| 336 |
platform, path prefix, and the file type. Generally, if the
|
| 337 |
path is a directory, the default mode will be 755. For normal
|
| 338 |
files the default mode is generally 644.
|
| 339 |
|
| 340 |
If the source file is a symlink, then the package will include
|
| 341 |
a symlink. If the target of the source symlink begins with $DESTDIR,
|
| 342 |
then it is stripped. If a target is specified in flags, then
|
| 343 |
the source file is ignored. Symlink modes are ignored.
|
| 344 |
|
| 345 |
'Flags' is a comma-delimited list of flags. Valid flags are:
|
| 346 |
volatile - uninstall will ignore changes in the file
|
| 347 |
optional - ignore if the path-glob matches nothing
|
| 348 |
symlink - a symlink target follows
|
| 349 |
|
| 350 |
Output of %files sections:
|
| 351 |
|
| 352 |
The result of processing all the %files sections is a collection
|
| 353 |
of 'expanded' per-component %files lists, called "%files.run", etc.
|
| 354 |
Each line of these files is of the form
|
| 355 |
|
| 356 |
[d|f] mode owner group flags path
|
| 357 |
s mode owner group flags path target
|
| 358 |
|
| 359 |
Where d,f,s indicate directory, file or symbolic link.
|
| 360 |
The v field indicates volatility, or '-' for a placeholder.
|
| 361 |
The mode of symbolic links is ignored but written as 777.
|
| 362 |
|
| 363 |
The %fixup stage may be used to edit the %files components.
|
| 364 |
|
| 365 |
The %post and %preun sections
|
| 366 |
|
| 367 |
The %post and %preun sections define shell scripts that
|
| 368 |
are executed after file components are installed, and before
|
| 369 |
file components are uninstalled.
|
| 370 |
|
| 371 |
%post [component]
|
| 372 |
%preun [component]
|
| 373 |
|
| 374 |
The body of these sections is treated as shell script, but
|
| 375 |
%{} and %() expansion takes place. The shell script body is
|
| 376 |
appended to any previous %post/%preun scripts for that component.
|
| 377 |
|
| 378 |
Output of %post or %preun sections
|
| 379 |
|
| 380 |
The result of processing these sections are files such as
|
| 381 |
"%post.run" or "%preun.dbg". The platform-specific code ensures
|
| 382 |
that these scripts are invoked at the right times during
|
| 383 |
installation.
|
| 384 |
|
| 385 |
The %service section
|
| 386 |
|
| 387 |
A %service section consists of the directive %service followed
|
| 388 |
by a simple service identifier. If omitted, the simple name of the
|
| 389 |
package is used.
|
| 390 |
|
| 391 |
%service [name]
|
| 392 |
|
| 393 |
The body of a %service section consists of shell text. It is
|
| 394 |
expected to set some simple shell variables, and is effectively
|
| 395 |
treated much like a %set section.
|
| 396 |
|
| 397 |
The service sections assume the common case of a daemon process
|
| 398 |
started at boot time and controlled by native platform service
|
| 399 |
management tools.
|
| 400 |
|
| 401 |
A service is assumed to be started as invocation of an executable
|
| 402 |
file with some arguments. Two flavours of service are assumed
|
| 403 |
|
| 404 |
the program forks, becomes a daemon, the parent writes
|
| 405 |
the child's PID to a well-known path and exits true.
|
| 406 |
|
| 407 |
the program does not fork or become a daemon. No PID file
|
| 408 |
is written.
|
| 409 |
|
| 410 |
The first style is selected by providing a 'pidfile' variable,
|
| 411 |
where the second style is selected by setting the pidfile variable
|
| 412 |
to the empty string (the default for each %service section).
|
| 413 |
|
| 414 |
Platform-independent variables expected to be set are:
|
| 415 |
|
| 416 |
cmd Shell command to execute
|
| 417 |
pidfile Path to the file containing the PID as
|
| 418 |
the first word on the first line.
|
| 419 |
stop_signal Signal number that gracefully stops
|
| 420 |
the process [default 15]
|
| 421 |
user User to run the service as [default root]
|
| 422 |
|
| 423 |
Other platform-specific variables may be provided in this
|
| 424 |
section and are treated differently.
|
| 425 |
|
| 426 |
Output of a %service section:
|
| 427 |
|
| 428 |
The result of processing a %service section is to create or
|
| 429 |
append to a file called %service.name, where 'name' is the
|
| 430 |
name given to the service. The file will contains the shell
|
| 431 |
text. The shell text is sourced and then platform-specific
|
| 432 |
changes are made to the other output files before %fixup
|
| 433 |
|
| 434 |
The %depend section
|
| 435 |
|
| 436 |
The dependency section lists the names of packages that
|
| 437 |
a component will depend on. The %depend directive is followed
|
| 438 |
by a component name ('run' is assumed if it is omitted).
|
| 439 |
|
| 440 |
%depend [component]
|
| 441 |
|
| 442 |
The body of a depend section consists of names and
|
| 443 |
minimum version numbers of (other PolyPackage) packages.
|
| 444 |
Blank lines, or lines start starting with '#' are ignored.
|
| 445 |
The lines can contain shell variable expansion.
|
| 446 |
|
| 447 |
name version
|
| 448 |
|
| 449 |
Lines starting with a the special symbol "+" indicate
|
| 450 |
platform-specific dependency information.
|
| 451 |
|
| 452 |
Output of a %depend section
|
| 453 |
|
| 454 |
The result of processing all the %depend sections results
|
| 455 |
in file called %depend.run etc which contain lines of either
|
| 456 |
of the forms
|
| 457 |
|
| 458 |
name version
|
| 459 |
+ text
|
| 460 |
|
| 461 |
Multiple %depend sections for a component are concatenated
|
| 462 |
together. Lines beginning with # and blank lines are removed.
|
| 463 |
Whitespace at the beginning of lines is ignored.
|
| 464 |
|
| 465 |
Note that some %depend.* files are created regardless of whether
|
| 466 |
a %depend section has been specified for them or not. If the
|
| 467 |
components doc, dbg and dev have been named in a %files
|
| 468 |
section, then the following %depend sections declarations are
|
| 469 |
implied:
|
| 470 |
|
| 471 |
%depend doc
|
| 472 |
$name $version
|
| 473 |
|
| 474 |
%depend dbg
|
| 475 |
$name $version
|
| 476 |
|
| 477 |
%depend dev
|
| 478 |
$name $version
|
| 479 |
|
| 480 |
|
| 481 |
The %fixup section
|
| 482 |
|
| 483 |
The fixup section body contains shell text that is run
|
| 484 |
immediately before the platform packaging tools are executed.
|
| 485 |
|
| 486 |
The %fixup directive is not followed by any identifier.
|
| 487 |
This is really only intended as a last-resort place to hold
|
| 488 |
any horrible hackery required.
|
| 489 |
|
| 490 |
Output of a %fixup section
|
| 491 |
|
| 492 |
The bodies of fixup sections are concatenated together
|
| 493 |
into a temporary file.
|
| 494 |
|
| 495 |
The %pp section
|
| 496 |
|
| 497 |
This optional section has no body. It specifies a version of
|
| 498 |
the PolyPackage API that the script was written to use. This
|
| 499 |
document descibes version 1.0.
|
| 500 |
|
| 501 |
%pp 1.0
|
| 502 |
-->
|
| 503 |
|