michael@428: ## michael@428: ## OpenPKG Software Stack Generation Utility michael@428: ## Copyright (c) 2012 OpenPKG GmbH michael@428: ## michael@428: ## This software is property of the OpenPKG GmbH, DE MUC HRB 160208. michael@428: ## All rights reserved. Licenses which grant limited permission to use, michael@428: ## copy, modify and distribute this software are available from the michael@428: ## OpenPKG GmbH. michael@428: ## michael@428: ## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED michael@428: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@428: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@428: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@428: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@428: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@428: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@428: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@428: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@428: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@428: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@428: ## SUCH DAMAGE. michael@428: ## michael@428: michael@428: =pod michael@428: michael@428: =head1 NAME michael@428: michael@428: B - B michael@428: michael@428: =head1 SYNOPSIS michael@428: michael@428: B michael@428: [B<-h>|B<--help>] michael@428: [B<-v>|B<--verbose> I] michael@428: [B<-o>|B<--output> I] michael@428: [B<-D>|B<--define> I=I ...] michael@428: [B<-u>|B<--unversioned>] michael@428: [B<-q>|B<--query>] michael@428: F.stk> michael@428: michael@428: =head1 DESCRIPTION michael@428: michael@428: The B command reads a OpenPKG software stack definition michael@428: F.stk>, generates a OpenPKG software stack deployment script michael@428: F[-I-I].sh>, determines, downloads and michael@428: stores all required corresponding OpenPKG source packages under michael@428: F[-I-I].src.d/*.src.{sh,rpm}>. michael@428: michael@428: On executing the generated OpenPKG software stack deployment michael@428: script F[-I-I].sh>, an OpenPKG michael@428: instance is created (or reused if existing), all packages michael@428: built and installed in topologically correct dependency order michael@428: and the resulting OpenPKG binary packages stored as michael@428: F[-I-I].I-I.d/*.{sh,rpm}>. michael@428: michael@428: The main design decisions and intentions of OpenPKG software stacks are: michael@428: michael@428: =over 4 michael@428: michael@428: =item 1. michael@428: michael@428: OpenPKG software stacks can be centrally defined in a single file michael@428: F.stk>, similar to the definition of OpenPKG software packages in michael@428: F.spec> files. This definition includes both OpenPKG framework michael@428: bootstrap parameters, OpenPKG package build parameters and OpenPKG michael@428: software stack specific deployment-time prolog and epilog scripts. michael@428: michael@428: =item 2. michael@428: michael@428: OpenPKG software stacks depend on particular OpenPKG software packages michael@428: (and perhaps even their particular versions) and by downloading and michael@428: locally storing all relevant OpenPKG software packages an OpenPKG michael@428: software stack remains stable and self-contained -- even if new versions michael@428: of OpenPKG software packages are released. michael@428: michael@428: =item 3. michael@428: michael@428: For generating the OpenPKG software stack files, an OpenPKG instance michael@428: and its B command is required, but executing the OpenPKG michael@428: software stack deployment script does NOT require any pre-existing michael@428: OpenPKG instances. michael@428: michael@428: =item 4. michael@428: michael@428: By wrapping F[-I-I].sh> and michael@428: F[-I-I].src.d/> into a I F[-I-I].src.sh> with the B command, you can provide a single self-contained file for building michael@428: and installing an OpenPKG software stack from OpenPKG source packages. michael@428: michael@428: =item 5. michael@428: michael@428: By wrapping F[-I-I].sh> and michael@428: F[-I-I].I-I.d/> michael@428: into a I michael@428: F[-I-I].I-I.sh> with the michael@428: B command, you can provide a single self-contained file for michael@428: installing an OpenPKG software stack from OpenPKG binary packages. michael@428: michael@428: =back michael@428: michael@428: =head1 COMMAND-LINE OPTIONS AND ARGUMENTS michael@428: michael@428: =over 4 michael@428: michael@428: =item B<-h>|B<--help> michael@428: michael@428: Just shows a short usage information for the B command. michael@428: michael@428: =item B<-v>|B<--verbose> I michael@428: michael@428: Sets the verbosity level for outputs, from C<0> (no output at all) to 4 michael@428: (all possible outputs). The default is C<4>. michael@428: michael@428: =item B<-o>|B<--output> I michael@428: michael@428: The output directory for the OpenPKG software stack files. michael@428: The default is the current directory (F<.>). michael@428: michael@428: =item [B<-D>|B<--define> I=I ...] michael@428: michael@428: On-the-fly overrides the value of option macro C<%{I}> with michael@428: I. Use this to generate a variant of an OpenPKG software stack michael@428: without modifying the software stack definition file. michael@428: michael@428: =item [B<-u>|B<--unversioned>] michael@428: michael@428: By default B creates the file michael@428: C-I-I.sh> (deployment script) and the michael@428: directory C-I-I.src.d/> (source packages). michael@428: With this option the names are C.sh> and C.src.d/> only. michael@428: michael@428: =item [B<-q>|B<--query>] michael@428: michael@428: Forces a different operation mode where a shell script is output michael@428: on F containing variable definitions in the format michael@428: C="I";> with information about the software stack michael@428: definition. The provided variable names are C, C, michael@428: C, C and C for the corresponding headers, michael@428: plus variables for all defined software stack options (see C<%option> michael@428: section below). michael@428: michael@428: =item IF<.stk> michael@428: michael@428: The mandatory OpenPKG software stack definition file. michael@428: See below under B for details. michael@428: michael@428: =back michael@428: michael@428: =head1 SOFTWARE STACK DEFINITION michael@428: michael@428: An OpenPKG software stack is defined by a configuration file michael@428: containing headers (C) and sections (<%foo>). michael@428: michael@428: =head2 Configuration Headers michael@428: michael@428: =over 4 michael@428: michael@428: =item B michael@428: michael@428: The name of the OpenPKG software stack. Also used as a prefix for many michael@428: files. Should match the regular expression C<^[a-z][a-zA-Z0-9]+>, michael@428: although this is not enforced. Example: C. michael@428: michael@428: =item B michael@428: michael@428: A single line, shortly summarizing the purpose of the OpenPKG software michael@428: stack. Example: C. michael@428: michael@428: =item B michael@428: michael@428: Name of the packager of the OpenPKG software software stack. michael@428: Example: C. michael@428: michael@428: =item B michael@428: michael@428: Version identifier of the OpenPKG software stack. Describes the michael@428: I revision of the software stack definition. Should match the michael@428: regular expression C<^[0-9]+\.[0-9]\.[0-9]+$>, although this is not michael@428: enforced. Example: C. michael@428: michael@428: =item B michael@428: michael@428: Release identifier of the OpenPKG software stack. Describes the michael@428: I revision of the stack definition. Should be in the format michael@428: C and hence match the regular expression C<^[0-9]{8}$>, michael@428: although this is not enforced. Example: C. michael@428: michael@428: =back michael@428: michael@428: =head2 Configuration Sections michael@428: michael@428: =over 4 michael@428: michael@428: =item B<%options> michael@428: michael@428: Zero or more options for the OpenPKG software stack, one per line, in michael@428: the format "I I". Options can be overridden on michael@428: the command-line with B<-D>I=I. Example: C. michael@428: Option values can be expanded in all headers and sections through the michael@428: following constructs: michael@428: michael@428: =over 4 michael@428: michael@428: =item C<%{I}> michael@428: michael@428: Expand to the value of option I. michael@428: michael@428: =item C<%{?I:I}> michael@428: michael@428: Expand to I if option I is defined. michael@428: michael@428: =item C<%{!?I:I}> michael@428: michael@428: Expand to I if option I is NOT defined. michael@428: michael@428: =back michael@428: michael@428: =item B<%description> michael@428: michael@428: A single textual paragraph describing the purpose of the OpenPKG michael@428: software stack in more detail than header C. michael@428: michael@428: =item B<%framework> michael@428: michael@428: The command-line parameters passed to the OpenPKG framework michael@428: bootstrap source shell package F. Usually at michael@428: least the parameters B<--prefix=>I, B<--user=>I, michael@428: B<--group=>I and B<--tag=>I are given here. In order michael@428: to allow an OpenPKG software stack to be easily reused one creates michael@428: the options (see C<%option> above) named C, C, C michael@428: and C and then use C<--prefix=%{prefix}>, C<--user=%{user}>, michael@428: C<--group=%{group}> and C<--tag=%{tag}> in this C<%framework> section. michael@428: michael@428: =item B<%packages> michael@428: michael@428: The packages to build and install for the OpenPKG software stack, in michael@428: the format of "B<-DI::I