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.

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

mercurial