openpkg/stack.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 ##  OpenPKG Software Stack Generation Utility
     3 ##  Copyright (c) 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 stack> - B<OpenPKG Software Stack Generation>
    30 =head1 SYNOPSIS
    32 B<openpkg stack>
    33 [B<-h>|B<--help>]
    34 [B<-v>|B<--verbose> I<level>]
    35 [B<-o>|B<--output> I<dir>]
    36 [B<-D>|B<--define> I<name>=I<value> ...]
    37 [B<-u>|B<--unversioned>]
    38 [B<-q>|B<--query>]
    39 F<I<name>.stk>
    41 =head1 DESCRIPTION
    43 The B<openpkg stack> command reads a OpenPKG software stack definition
    44 F<I<name>.stk>, generates a OpenPKG software stack deployment script
    45 F<I<name>[-I<version>-I<release>].sh>, determines, downloads and
    46 stores all required corresponding OpenPKG source packages under
    47 F<I<name>[-I<version>-I<release>].src.d/*.src.{sh,rpm}>.
    49 On executing the generated OpenPKG software stack deployment
    50 script F<I<name>[-I<version>-I<release>].sh>, an OpenPKG
    51 instance is created (or reused if existing), all packages
    52 built and installed in topologically correct dependency order
    53 and the resulting OpenPKG binary packages stored as
    54 F<I<name>[-I<version>-I<release>].I<platform>-I<tag>.d/*.{sh,rpm}>.
    56 The main design decisions and intentions of OpenPKG software stacks are:
    58 =over 4
    60 =item 1.
    62 OpenPKG software stacks can be centrally defined in a single file
    63 F<I<name>.stk>, similar to the definition of OpenPKG software packages in
    64 F<I<name>.spec> files. This definition includes both OpenPKG framework
    65 bootstrap parameters, OpenPKG package build parameters and OpenPKG
    66 software stack specific deployment-time prolog and epilog scripts.
    68 =item 2.
    70 OpenPKG software stacks depend on particular OpenPKG software packages
    71 (and perhaps even their particular versions) and by downloading and
    72 locally storing all relevant OpenPKG software packages an OpenPKG
    73 software stack remains stable and self-contained -- even if new versions
    74 of OpenPKG software packages are released.
    76 =item 3.
    78 For generating the OpenPKG software stack files, an OpenPKG instance
    79 and its B<openpkg stack> command is required, but executing the OpenPKG
    80 software stack deployment script does NOT require any pre-existing
    81 OpenPKG instances.
    83 =item 4.
    85 By wrapping F<I<name>[-I<version>-I<release>].sh> and
    86 F<I<name>[-I<version>-I<release>].src.d/> into a I<Shell Execution
    87 Archive> F<I<name>[-I<version>-I<release>].src.sh> with the B<openpkg
    88 sea> command, you can provide a single self-contained file for building
    89 and installing an OpenPKG software stack from OpenPKG source packages.
    91 =item 5.
    93 By wrapping F<I<name>[-I<version>-I<release>].sh> and
    94 F<I<name>[-I<version>-I<release>].I<platform>-I<tag>.d/>
    95 into a I<Shell Execution Archive>
    96 F<I<name>[-I<version>-I<release>].I<platform>-I<tag>.sh> with the
    97 B<openpkg sea> command, you can provide a single self-contained file for
    98 installing an OpenPKG software stack from OpenPKG binary packages.
   100 =back
   102 =head1 COMMAND-LINE OPTIONS AND ARGUMENTS
   104 =over 4
   106 =item B<-h>|B<--help>
   108 Just shows a short usage information for the B<openpkg stack> command.
   110 =item B<-v>|B<--verbose> I<level>
   112 Sets the verbosity level for outputs, from C<0> (no output at all) to 4
   113 (all possible outputs). The default is C<4>.
   115 =item B<-o>|B<--output> I<dir>
   117 The output directory for the OpenPKG software stack files.
   118 The default is the current directory (F<.>).
   120 =item [B<-D>|B<--define> I<name>=I<value> ...]
   122 On-the-fly overrides the value of option macro C<%{I<name>}> with
   123 I<value>. Use this to generate a variant of an OpenPKG software stack
   124 without modifying the software stack definition file.
   126 =item [B<-u>|B<--unversioned>]
   128 By default B<openpkg stack> creates the file
   129 C<I<name>-I<version>-I<release>.sh> (deployment script) and the
   130 directory C<I<name>-I<version>-I<release>.src.d/> (source packages).
   131 With this option the names are C<I<name>.sh> and C<I<name>.src.d/> only.
   133 =item [B<-q>|B<--query>]
   135 Forces a different operation mode where a shell script is output
   136 on F<stdout> containing variable definitions in the format
   137 C<I<name>="I<value>";> with information about the software stack
   138 definition. The provided variable names are C<name>, C<summary>,
   139 C<packager>, C<version> and C<release> for the corresponding headers,
   140 plus variables for all defined software stack options (see C<%option>
   141 section below).
   143 =item I<name>F<.stk>
   145 The mandatory OpenPKG software stack definition file.
   146 See below under B<SOFTWARE STACK DEFINITION> for details.
   148 =back
   150 =head1 SOFTWARE STACK DEFINITION
   152 An OpenPKG software stack is defined by a configuration file
   153 containing headers (C<Foo:>) and sections (<%foo>).
   155 =head2 Configuration Headers
   157 =over 4
   159 =item B<Name>
   161 The name of the OpenPKG software stack. Also used as a prefix for many
   162 files. Should match the regular expression C<^[a-z][a-zA-Z0-9]+>,
   163 although this is not enforced. Example: C<Name: example>.
   165 =item B<Summary>
   167 A single line, shortly summarizing the purpose of the OpenPKG software
   168 stack. Example: C<Summary: Example Stack>.
   170 =item B<Packager>
   172 Name of the packager of the OpenPKG software software stack.
   173 Example: C<Packager: OpenPKG GmbH>.
   175 =item B<Version>
   177 Version identifier of the OpenPKG software stack. Describes the
   178 I<logical> revision of the software stack definition. Should match the
   179 regular expression C<^[0-9]+\.[0-9]\.[0-9]+$>, although this is not
   180 enforced. Example: C<Version: 1.0.0>.
   182 =item B<Release>
   184 Release identifier of the OpenPKG software stack. Describes the
   185 I<physical> revision of the stack definition. Should be in the format
   186 C<YYYYMMDD> and hence match the regular expression C<^[0-9]{8}$>,
   187 although this is not enforced. Example: C<Release: 20120101>.
   189 =back
   191 =head2 Configuration Sections
   193 =over 4
   195 =item B<%options>
   197 Zero or more options for the OpenPKG software stack, one per line, in
   198 the format "I<name> I<default-value>". Options can be overridden on
   199 the command-line with B<-D>I<name>=I<value>. Example: C<with_ssl yes>.
   200 Option values can be expanded in all headers and sections through the
   201 following constructs:
   203 =over 4
   205 =item C<%{I<name>}>
   207 Expand to the value of option I<name>.
   209 =item C<%{?I<name>:I<value>}>
   211 Expand to I<value> if option I<name> is defined.
   213 =item C<%{!?I<name>:I<value>}>
   215 Expand to I<value> if option I<name> is NOT defined.
   217 =back
   219 =item B<%description>
   221 A single textual paragraph describing the purpose of the OpenPKG
   222 software stack in more detail than header C<Summary>.
   224 =item B<%framework>
   226 The command-line parameters passed to the OpenPKG framework
   227 bootstrap source shell package F<openpkg-*.src.sh>. Usually at
   228 least the parameters B<--prefix=>I<path>, B<--user=>I<username>,
   229 B<--group=>I<groupname> and B<--tag=>I<tagname> are given here. In order
   230 to allow an OpenPKG software stack to be easily reused one creates
   231 the options (see C<%option> above) named C<prefix>, C<user>, C<group>
   232 and C<tag> and then use C<--prefix=%{prefix}>, C<--user=%{user}>,
   233 C<--group=%{group}> and C<--tag=%{tag}> in this C<%framework> section.
   235 =item B<%packages>
   237 The packages to build and install for the OpenPKG software stack, in
   238 the format of "B<-DI<package>::I<option>=I<value>>" and "I<package>"
   239 specifications as understood by the C<openpkg build> tool. Example:
   240 C<-Dapache::with_mod_ssl=yes -Dapache-php::with_json=yes apache
   241 apache-php>.
   243 =item B<%prolog>
   245 A shell script executed before installation of all packages.
   246 The variable C<$prefix> is available to access the
   247 OpenPKG software stack without having to hard-code a path.
   249 =item B<%epilog>
   251 A shell script executed after installation of all packages. This
   252 is usually used for applying OpenPKG software stack specific
   253 configurations. The variable C<$prefix> is available to access the
   254 OpenPKG software stack without having to hard-code a path. Example:
   255 C<echo "openldap_enable=no" E<gt>E<gt>$prefix/etc/rc.conf>.
   257 =back
   259 =head1 EXAMPLES
   261  $ cat xamp.stk
   263  Name:         xamp
   264  Summary:      Apache-MySQL-PHP Server
   265  Packager:     OpenPKG GmbH
   266  Version:      1.0.0
   267  Release:      20120407
   269  %description
   270      This software stack contains a so-called xAMP web stack, consisting
   271      of the major components Apache, MySQL and PHP.
   273  %options
   274      repo      http://download.openpkg.org/stacks/current/source/
   275      prefix    /xamp
   276      user      xamp
   277      group     xamp
   278      tag       xamp
   279      with_ldap no
   280      with_ssl  no
   281      addr      127.0.0.1
   283  %repository
   284      %{repo}
   286  %framework
   287      --prefix=%{prefix}
   288      --user=%{user}
   289      --group=%{group}
   290      --tag=%{tag}
   292  %packages
   293      -D apache::with_mod_dav=yes
   294      -D apache::with_mod_deflate=yes
   295      -D apache::with_mod_ldap=%{with_ldap}
   296      -D apache::with_mod_proxy=yes
   297      -D apache::with_mod_ssl=%{with_ssl}
   298      -D apache-php::with_curl=yes
   299      -D apache-php::with_freetype=yes
   300      -D apache-php::with_gd=yes
   301      -D apache-php::with_iconv=yes
   302      -D apache-php::with_json=yes
   303      -D apache-php::with_mbregex=yes
   304      -D apache-php::with_mbstring=yes
   305      -D apache-php::with_mysql=yes
   306      -D apache-php::with_openldap=%{with_ldap}
   307      -D apache-php::with_session=yes
   308      -D apache-php::with_simplexml=yes
   309      -D apache-php::with_sqlite=yes
   310      -D apache-php::with_ssl=%{with_ssl}
   311      -D apache-php::with_xml=yes
   312      -D apache-php::with_zlib=yes
   313      apache
   314      apache-php
   315      mysql
   317  %epilog
   318      shtool subst \
   319          -e 's;127\.0\.0\.1:%{addr};g' \
   320          %{prefix}/etc/apache/apache.conf
   321      if [ ".%{with_ldap}" = .yes ]; then
   322          echo "openldap_enable=\"no\"" >>%{prefix}/etc/rc.conf
   323      fi
   325  $ openpkg stack -v4 \
   326    -Dprefix=/v/xamp -Duser=xamp-sw -Dgroup=xamp-sw \
   327    --unversioned xamp.stk
   329  $ openpkg sea -o xamp.src.sh xamp.sh xamp.src.d/
   331  $ sh xamp.src.sh -v4 -S sudo
   333  $ openpkg sea -o xamp.bin.sh xamp.sh xamp.*-*.d/
   335 =head1 HISTORY
   337 The B<openpkg stack> command was implemented in April 2012 by I<Ralf S. Engelschall>
   338 E<lt>rse@engelschall.comE<gt> for the OpenPKG Framework of the OpenPKG GmbH. 
   340 =cut

mercurial