openpkg/build.pod

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

michael@428 1 ##
michael@428 2 ## build.pod -- OpenPKG Package Building and Installing
michael@428 3 ## Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
michael@428 4 ##
michael@428 5 ## This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
michael@428 6 ## All rights reserved. Licenses which grant limited permission to use,
michael@428 7 ## copy, modify and distribute this software are available from the
michael@428 8 ## OpenPKG GmbH.
michael@428 9 ##
michael@428 10 ## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
michael@428 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@428 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@428 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@428 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@428 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@428 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@428 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@428 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@428 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@428 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@428 21 ## SUCH DAMAGE.
michael@428 22 ##
michael@428 23
michael@428 24 =pod
michael@428 25
michael@428 26 =head1 NAME
michael@428 27
michael@428 28 B<openpkg build> - B<OpenPKG> Package Building and Installing
michael@428 29
michael@428 30 =head1 SYNOPSIS
michael@428 31
michael@428 32 B<openpkg>
michael@428 33 B<build>
michael@428 34 [B<-R> I<rpm>]
michael@428 35 [B<-r> I<repository>]
michael@428 36 [B<-f> I<index.rdf>]
michael@428 37 [B<-u>]
michael@428 38 [B<-U>]
michael@428 39 [B<-z>]
michael@428 40 [B<-Z>]
michael@428 41 [B<-i>]
michael@428 42 [B<-q>]
michael@428 43 [B<-s>]
michael@428 44 [B<-S>]
michael@428 45 [B<-M>]
michael@428 46 [B<-L>]
michael@428 47 [B<-W>]
michael@428 48 [B<-X>]
michael@428 49 [B<-K>]
michael@428 50 [B<-k>]
michael@428 51 [B<-e>]
michael@428 52 [B<-b>]
michael@428 53 [B<-B>]
michael@428 54 [B<-G>]
michael@428 55 [B<-P> I<priv-cmd>]
michael@428 56 [B<-N> I<non-priv-cmd>]
michael@428 57 [B<-p> I<platform>]
michael@428 58 [B<-D> I<var>=I<val> ...]
michael@428 59 [B<-E> I<name> ...]
michael@428 60 [B<-H> I<name> ...]
michael@428 61 ([B<-a>] [B<-A>] | I<pattern> ...)
michael@428 62
michael@428 63 =head1 DESCRIPTION
michael@428 64
michael@428 65 The B<openpkg build> tool provides automated recursive from-scratch
michael@428 66 installation of packages and the updating and upgrading of installed
michael@428 67 packages.
michael@428 68
michael@428 69 It generates a Bourne-Shell script on standard output (F<stdout>)
michael@428 70 that can be executed to perform the package installation or
michael@428 71 updating/upgrading procedure for all requested packages and their
michael@428 72 dependencies.
michael@428 73
michael@428 74 Packages that are upgraded automatically trigger rebuilds of all
michael@428 75 packages that depend on the upgraded package ("reverse dependencies").
michael@428 76 The dependency information is read from an XML/RDF index generated by
michael@428 77 the companion tool B<openpkg index>.
michael@428 78
michael@428 79 =head1 ARGUMENTS
michael@428 80
michael@428 81 Packages are selected by providing a list of name patterns. Each
michael@428 82 pattern is either a package name or a name prefix followed by a 'F<*>'
michael@428 83 character. Additionally, in order to resolve ambiguous dependencies, you
michael@428 84 can append a discrimination prefix separated by a comma that matches
michael@428 85 against the full "I<name>-I<version>-I<revision>" string of a package.
michael@428 86
michael@428 87 =head1 OPTIONS
michael@428 88
michael@428 89 The following command line options exist:
michael@428 90
michael@428 91 =over 4
michael@428 92
michael@428 93 =item B<-R> I<command>
michael@428 94
michael@428 95 Specify the "B<openpkg rpm>" command with fully qualified path.
michael@428 96 Several other internal paths are deduced from the I<command> path,
michael@428 97 so this has to be something like "I<prefix>C</bin/openpkg rpm>".
michael@428 98
michael@428 99 =item B<-r> I<repository>
michael@428 100
michael@428 101 Specify the path to an OpenPKG RPM package repository.
michael@428 102 This can be a URL (including "file://") to download packages from or
michael@428 103 an absolute directory path (identified by leading "/") or
michael@428 104 a relative directory path (identified by leading "./") to access packages directly.
michael@428 105 The name of the package file is appended to this path.
michael@428 106 The default is to use a URL pointing to the B<OpenPKG> download service
michael@428 107 as determined by the "B<openpkg release>" command.
michael@428 108
michael@428 109 =item B<-f> I<index.rdf>
michael@428 110
michael@428 111 Specify the path to the primary XML/RDF index. This can be a URL or a
michael@428 112 file path. If the index contains references to other indices, these
michael@428 113 are recursively included automatically. The default is to use a URL
michael@428 114 pointing to the B<OpenPKG> FTP server as as determined by the "B<openpkg
michael@428 115 release>" command.
michael@428 116
michael@428 117 =item B<-u>
michael@428 118
michael@428 119 The generated script will ignore binary RPMs that are stored on
michael@428 120 your system. Instead it will either fetch binary RPMs or rebuild
michael@428 121 from source RPMs fetched from the repository.
michael@428 122
michael@428 123 =item B<-U>
michael@428 124
michael@428 125 The generated script will try to upgrade all selected packages
michael@428 126 including their dependencies to the most recent version. Use
michael@428 127 this for usual upgrade tasks in combination with option "B<-a>".
michael@428 128
michael@428 129 =item B<-z>
michael@428 130
michael@428 131 The generated script will rebuild all selected packages
michael@428 132 including their dependencies even when the most recent version
michael@428 133 is already installed.
michael@428 134
michael@428 135 =item B<-Z>
michael@428 136
michael@428 137 B<openpkg build> ignores all installed packages, the
michael@428 138 generated script will rebuild all selected packages from scratch.
michael@428 139
michael@428 140 =item B<-i>
michael@428 141
michael@428 142 The generated script will ignore run-time errors.
michael@428 143
michael@428 144 =item B<-q>
michael@428 145
michael@428 146 Ignore all reverse dependencies. This means that all packages which are
michael@428 147 rebuild do I<not> trigger a rebuild of packages which depend on them.
michael@428 148 I<ATTENTION: this might break already installed packages and has to be
michael@428 149 used with care! You should really know what you are doing.>
michael@428 150
michael@428 151 =item B<-s>
michael@428 152
michael@428 153 Generate a status map instead of the shell script. The map consists
michael@428 154 of 3 columns: I<old>, I<tag> and I<new>. The I<old> column shows
michael@428 155 the installed version of a package (I<name>-I<version>-I<release>)
michael@428 156 or just the package name (I<name>) if no package of that name
michael@428 157 is installed and the I<new> column shows the repository version
michael@428 158 (I<name>-I<version>-I<release>) of a package if it is considered for
michael@428 159 installation. The I<tag> column shows the following possible values:
michael@428 160
michael@428 161 =over 10
michael@428 162
michael@428 163 =item OK
michael@428 164
michael@428 165 The installed package is suitable and will not be touched.
michael@428 166
michael@428 167 =item ADD
michael@428 168
michael@428 169 There is no installed package yet.
michael@428 170
michael@428 171 =item UPGRADE
michael@428 172
michael@428 173 The installed package is outdated and requires an update.
michael@428 174
michael@428 175 =item DEPEND
michael@428 176
michael@428 177 The installed package needs rebuilding because one of its
michael@428 178 dependencies is rebuild.
michael@428 179
michael@428 180 =item MISMATCH
michael@428 181
michael@428 182 The installed package needs rebuilding because it was build
michael@428 183 with different parameters.
michael@428 184
michael@428 185 =item CONFLICT
michael@428 186
michael@428 187 The required new package cannot be installed because it
michael@428 188 conflicts with some already installed package.
michael@428 189
michael@428 190 =item UNDEF
michael@428 191
michael@428 192 The package has an invalid or ambiguous dependency.
michael@428 193
michael@428 194 =back
michael@428 195
michael@428 196 =item B<-S>
michael@428 197
michael@428 198 Similar to option "B<-s>" but also lists the newest versions in the
michael@428 199 repository. The following I<tag> might appear in the map:
michael@428 200
michael@428 201 =over 10
michael@428 202
michael@428 203 =item NEW
michael@428 204
michael@428 205 The package exists in the repository but is not required yet.
michael@428 206
michael@428 207 =back
michael@428 208
michael@428 209 =item B<-M>
michael@428 210
michael@428 211 Similar to option "B<-s>" but print a short dependency map.
michael@428 212
michael@428 213 =item B<-L>
michael@428 214
michael@428 215 Print a list of packages in the repository that depend on the target.
michael@428 216
michael@428 217 =item B<-W>
michael@428 218
michael@428 219 Include all conditional dependencies as if all possible configuration
michael@428 220 options had been switched on. This has little use in practice except for
michael@428 221 generating an all-inclusive list with option "B<-L>". I<ATTENTION: Even
michael@428 222 mutually exclusive options are evaluated to be 'on', building packages
michael@428 223 with option "-W" therefore might fail or cause unusable results!>
michael@428 224
michael@428 225 =item B<-X>
michael@428 226
michael@428 227 Use the slower but more robust external Perl XML parser module
michael@428 228 XML::Simple instead of the simple internal XML/RDF parser.
michael@428 229
michael@428 230 =item B<-K>
michael@428 231
michael@428 232 Keep packages that were installed temporarily during the build process.
michael@428 233 Without this option those packages are removed.
michael@428 234
michael@428 235 =item B<-k>
michael@428 236
michael@428 237 Keep packages that were downloaded temporarily for installation or building.
michael@428 238 Without this option those packages are removed.
michael@428 239
michael@428 240 =item B<-e>
michael@428 241
michael@428 242 Rebuild exact version of a package from repository even when you have
michael@428 243 installed a newer version from another repository.
michael@428 244
michael@428 245 =item B<-b>
michael@428 246
michael@428 247 Wrap package rebuilding commands with script execution-time checks for
michael@428 248 existing binary packages if the package is rebuild as a dependency. Wrap
michael@428 249 package install commands with script execution-time checks for different
michael@428 250 MD5 signature checksums of binary packages and installed packages. This
michael@428 251 is best to use with option "B<-u>" to defer all such checks until script
michael@428 252 execution-time.
michael@428 253
michael@428 254 =item B<-B>
michael@428 255
michael@428 256 Same as option "B<-b>" but also check all explicit target packages for
michael@428 257 existing binary packages at script execution-time.
michael@428 258
michael@428 259 =item B<-g>
michael@428 260
michael@428 261 The generated script will rebuild all packages selected even when the
michael@428 262 most recent version is already installed. Dependencies are not affected.
michael@428 263 Use this especially for updating a package with different build options
michael@428 264 (see option "B<-D>").
michael@428 265
michael@428 266 =item B<-P> I<priv-cmd>
michael@428 267
michael@428 268 Command prefix to use for generated script commands that require
michael@428 269 elevated privileges (like "B<openpkg rpm -Uvh>"). The most common tool
michael@428 270 for this is sudo(8). If I<priv-cmd> starts with a dash it will be run
michael@428 271 without the dash and the command line it should execute is passed as
michael@428 272 a single quoted string. Use this option for upgrading privileges. For
michael@428 273 instance, if you are running the C<openpkg build>" command as the
michael@428 274 management user, use "C<-P sudo>" to make sure that the "B<openpkg rpm
michael@428 275 -Uvh>" commands in the generated script execute with necessary elevated
michael@428 276 privileges.
michael@428 277
michael@428 278 =item B<-N> I<non-priv-cmd>
michael@428 279
michael@428 280 Command prefix to use for generated script commands that do I<not>
michael@428 281 require elevated privileges (like "B<openpkg rpm --rebuild>"). The most
michael@428 282 common tool for this is su(8). If I<non-priv-cmd> starts with a dash
michael@428 283 it will be run without the dash and the command line it should execute
michael@428 284 is passed as a single quoted string. Use this option for downgrading
michael@428 285 privileges. For instance, if you are running the C<openpkg build>"
michael@428 286 command as the B<root> user, use "C<-N '-su - >I<musr>C< -c'>" to make
michael@428 287 sure that the non-privileged commands in the generated script execute
michael@428 288 with privileges of the management user I<musr>.
michael@428 289
michael@428 290 =item B<-p> I<platform>
michael@428 291
michael@428 292 The platform string that is matched against the XML/RDF index for binary
michael@428 293 packages. The default is an empty I<platform> string so that no binary
michael@428 294 packages are matched at all.
michael@428 295
michael@428 296 =item B<-D> I<var>=I<val>
michael@428 297
michael@428 298 Specify build options for selected packages. This can be either
michael@428 299 "B<-D> I<with_xxx>=I<yyy>" or just "B<-D> I<with_xxx>". The latter is
michael@428 300 equivalent to a "B<-D> I<with_xxx>=I<yes>". The parameters are matched
michael@428 301 against selected packages that are already installed. If they do
michael@428 302 indicate a change, the package is rebuild. There can be multiple "B<-D>"
michael@428 303 options.
michael@428 304
michael@428 305 If the option name is prefixed with a package name followed by
michael@428 306 two colons then it applies only to the specified package, e.g.,
michael@428 307 "B<-D>I<foo::with_bar>".
michael@428 308
michael@428 309 =item B<-E> I<name>
michael@428 310
michael@428 311 Ignore a package with the specified I<name>. This can be used to avoid
michael@428 312 upgrading to a broken package in the repository or to skip a package
michael@428 313 upgrade temporarily. If you use a wildcard pattern or the options
michael@428 314 "B<-a>" or "B<-A>" then I<name> will be excluded. There can be multiple
michael@428 315 "B<-E>" options.
michael@428 316
michael@428 317 =item B<-H> I<name>
michael@428 318
michael@428 319 Hint about packages that should be preferred when more than one fits
michael@428 320 a requirement. There can be multiple "B<-H>" options.
michael@428 321
michael@428 322 =item B<-a>
michael@428 323
michael@428 324 Select all installed packages. You cannot specify a pattern list together
michael@428 325 with the "B<-a>" option.
michael@428 326
michael@428 327 =item B<-A>
michael@428 328
michael@428 329 Select all packages in the repository. You cannot specify a pattern list
michael@428 330 together with the "B<-A>" option.
michael@428 331
michael@428 332 =back
michael@428 333
michael@428 334 =head1 ARGUMENTS
michael@428 335
michael@428 336 In case neither option B<-a> nor option B<-A> are specified,
michael@428 337 the command line has to contain one or more package I<pattern>
michael@428 338 arguments. Each I<pattern> can have the following forms:
michael@428 339
michael@428 340 =over 4
michael@428 341
michael@428 342 =item I<name>
michael@428 343
michael@428 344 A regular package name.
michael@428 345
michael@428 346 =item I<name>B<*>
michael@428 347
michael@428 348 A package name wildcard pattern.
michael@428 349
michael@428 350 =item I<name>B<,>I<name>[B<->I<version>[B<->I<release>]]
michael@428 351
michael@428 352 A regular package name followed by a constraint
michael@428 353 which particular package should be chosen.
michael@428 354
michael@428 355 =back
michael@428 356
michael@428 357 =head1 CONFIGURATION
michael@428 358
michael@428 359 B<openpkg build> reads the configuration file F<$HOME/.openpkg/build>.
michael@428 360 The file lists default options, one option per line and section tags
michael@428 361 of the form C<[>I<prefix>C<]>. Options following such a tag are only
michael@428 362 evaluated for the particular B<OpenPKG> instance so that you can
michael@428 363 define default options for multiple B<OpenPKG> instances.
michael@428 364
michael@428 365 Example:
michael@428 366
michael@428 367 # global options
michael@428 368 -X
michael@428 369
michael@428 370 [/openpkg/current]
michael@428 371 # options for CURRENT stack only
michael@428 372 -r http://download.openpkg.org/stacks/current/source/
michael@428 373
michael@428 374 [/openpkg/foo]
michael@428 375 # options for a FOO stack only
michael@428 376 -r http://download.openpkg.org/stacks/foo/source/
michael@428 377
michael@428 378 =head1 EXAMPLES
michael@428 379
michael@428 380 The following shows a few typical OpenPKG instance
michael@428 381 maintenance tasks which involve the B<openpkg build> command:
michael@428 382
michael@428 383 =head2 Installation
michael@428 384
michael@428 385 The following examples shows how to initially install an OpenPKG
michael@428 386 instance under F</openpkg> with Apache/PHP & MySQL:
michael@428 387
michael@428 388 # bootstrap the OpenPKG instance
michael@428 389 $ curl -L -O http://openpkg.org/go/download/openpkg.src.sh
michael@428 390 $ sh openpkg-*-*.src.sh --prefix=/openpkg \
michael@428 391 --user=openpkg --group=openpkg --tag=openpkg
michael@428 392 $ sh openpkg-*-*.*-*-openpkg.sh
michael@428 393
michael@428 394 # install Apache/PHP & MySQL
michael@428 395 $ /openpkg/bin/openpkg build \
michael@428 396 -D apache-php::with_mysql=yes \
michael@428 397 apache apache-php mysql | sh
michael@428 398
michael@428 399 =head2 Reinstallation
michael@428 400
michael@428 401 The following example shows how to rebuild and reinstall the already
michael@428 402 installed package "foo":
michael@428 403
michael@428 404 # rebuild and reinstall package
michael@428 405 $ /openpkg/bin/openpkg build -g -u foo | sh
michael@428 406
michael@428 407 =head2 Change
michael@428 408
michael@428 409 The following fictive example shows how to change the already
michael@428 410 installed package "foo" by rebuilding and reinstalling it with the
michael@428 411 "C<foo::with_bar>" build-time option enabled.
michael@428 412
michael@428 413 # change a package
michael@428 414 $ /openpkg/bin/openpkg build -g -D with_bar=yes foo | sh
michael@428 415
michael@428 416 =head2 Update
michael@428 417
michael@428 418 The following example shows how to update (no major
michael@428 419 OpenPKG version change) an OpenPKG instance under F</openpkg>:
michael@428 420
michael@428 421 # update all packages to their latest version
michael@428 422 $ /openpkg/bin/openpkg build -Ua | sh
michael@428 423
michael@428 424 =head2 Upgrade
michael@428 425
michael@428 426 The following examples shows a complete procedure for upgrading (major
michael@428 427 OpenPKG version change) the instance under F</openpkg> to OpenPKG
michael@428 428 4.X:
michael@428 429
michael@428 430 # upgrade the bootstrap package
michael@428 431 $ /openpkg/bin/openpkg build \
michael@428 432 -r http://download.openpkg.org/stacks/current/source/ openpkg | sh
michael@428 433
michael@428 434 # upgrade the whole OpenPKG instance, in correct dependency
michael@428 435 # order and by keeping all chosen build-time options.
michael@428 436 $ /openpkg/bin/openpkg build -ZaKB | sh
michael@428 437
michael@428 438 =head2 Deinstallation
michael@428 439
michael@428 440 The following example shows how to deinstall
michael@428 441 an entire OpenPKG intance under F</openpkg>:
michael@428 442
michael@428 443 # remove all packages and the instance itself
michael@428 444 $ /openpkg/bin/openpkg rpm -e \
michael@428 445 `/openpkg/bin/openpkg rpm -qa`
michael@428 446
michael@428 447 =head1 CAVEATS
michael@428 448
michael@428 449 Parallel execution of B<openpkg build> causes undefined effects.
michael@428 450
michael@428 451 =head1 HISTORY
michael@428 452
michael@428 453 The B<openpkg build> command was invented in November 2002 by I<Michael
michael@428 454 van Elst> E<lt>mlelstv@serpens.deE<gt> under contract with I<Cable
michael@428 455 & Wireless> E<lt>http://www.cw.com/E<gt> for use inside the B<OpenPKG>
michael@428 456 project E<lt>http://www.openpkg.org/E<gt>. It was then further
michael@428 457 refined by the B<OpenPKG Foundation e.V.> as part of the OpenPKG Tool Chain.
michael@428 458
michael@428 459 =cut
michael@428 460

mercurial