diff -r 71503088f51b -r f880f219c566 openpkg/dev.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/openpkg/dev.pod Tue Jul 31 12:23:42 2012 +0200
@@ -0,0 +1,543 @@
+##
+## openpkg dev -- OpenPKG Package Development Tool
+## Copyright (c) 2008-2012 OpenPKG GmbH
+##
+## This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
+## All rights reserved. Licenses which grant limited permission to use,
+## copy, modify and distribute this software are available from the
+## OpenPKG GmbH.
+##
+## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
+## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+## SUCH DAMAGE.
+##
+
+=pod
+
+B - OpenPKG Package Development Tool
+
+=head1 DESCRIPTION
+
+B is a package development tool for B.
+
+=head2 SOURCE PACKAGE HANDLING
+
+=over 4
+
+=item B
+[C<-l> I]
+[C<-b> I]
+[C<-s>]
+[C<-d>]
+IC<->IC<->IC<.src.rpm>
+
+Unpacks an OpenPKG source RPM package
+IC<->IC<->IC<.src.rpm> into I
+(default is IC<->IC<->I)
+using I (default is I).
+Additionally,
+I
+configuration file is generated where
+C<-s> enables shared mode and
+C<-d> enables debug mode, see I.
+
+=back
+
+=head2 SOURCE PACKAGE DEVELOPMENT
+
+=over 4
+
+=item B
+
+This is a convenience command which enters an interactive B
+shell which provides the following work environment:
+
+=over 4
+
+=item B
+
+ OPENPKG_PREFIX ""
+ PS1 "\\[\\e[31;1m\\]\\u\\[\\e[0m\\]@\\h:\\w [OPENPKG_PREFIX=$OPENPKG_PREFIX]\n\\\$ "
+ T %{_tmppath}
+ S %{_specdir}
+ D %{_sourcedir}
+
+=item B
+
+ openpkg "${OPENPKG_PREFIX}/bin/openpkg"
+ opd "${OPENPKG_PREFIX}/bin/openpkg dev"
+
+=item B
+
+ ESC+x "opd unpack\n"
+ ESC+v "opd edit\n"
+ ESC+t "opd build -s track\n"
+ ESC+f "opd build -s fetch\n"
+ ESC+b "opd build\n"
+ ESC+1 "opd build -s prep\n"
+ ESC+2 "opd build -s compile\n"
+ ESC+3 "opd build -s install\n"
+ ESC+4 "opd build -s binary\n"
+ ESC+s "opd build -s source\n"
+ ESC+p "opd peek\n"
+ ESC+d "opd diff\n"
+ ESC+i "opd install\n"
+ ESC+e "opd erase\n"
+ ESC+l "opd lint\n"
+ ESC+r "opd release\n"
+
+=back
+
+If option C<-s> is passed to B and screen(1) is
+available in C<$PATH>, the interactive development shell is started up
+in a convenient virtual screen environment.
+
+=item B
+
+Load spec file into editor.
+
+=over 4
+
+=item B
+
+ EDITOR "vi"
+
+=back
+
+=item B
+[C<-s> I]
+[C<-D> I[=I]]
+[C<-w> I]
+
+Builds package steps. Default I is C. Option C<-D> translated
+into "C<--define 'I I'>" while option C<-w> translated
+into "C<--with> I". The I arguments translate into the
+following RPM options:
+
+ track: -bt
+ fetch: -bf
+ prep: -bp
+ compile: -bc --short-circuit
+ install: -bi --short-circuit
+ binary: -bb --short-circuit
+ source: -bs
+ all: -ba
+
+=item B
+
+Peeks file list from package and tags configuration and documentation files.
+
+=item B
+
+Shows modifications with the help of a possibly underlying Version
+Control System (VCS) like CVS, Subversion, Monotone, Git, Mercurial or
+(as a fallback ) OSSP svs.
+
+=item B
+[C<-f>]
+[C<-o>]
+[C<-n>]
+[C<-s>]
+
+Installs package.
+Option
+C<-f> adds C<--force>,
+C<-n> adds C<--nodeps> and
+C<-o> adds C<--oldpackage>
+to the underlying C call.
+Option C<-s> prefixes the command with sudo(1).
+
+=item B
+[C<-f>]
+[C<-o>]
+[C<-a>]
+[C<-s>]
+
+Erases package.
+Option
+C<-f> adds C<--force>,
+C<-n> adds C<--nodeps> and
+C<-a> adds C<--allmatches>
+to the underlying C call.
+Option C<-s> prefixes the command with sudo(1).
+
+=item B
+[C<-v>]
+[C<-b>]
+
+Lints package sources C<*.spec>, C, C and binary package files.
+Option C<-v> enables verboseness.
+Option C<-b> disables the linting of an existing binary package file.
+
+=item B
+[C<-m> I]
+[C<-n>]
+
+Releases package specification to the repository. Unlike previous
+incarnations of "openpkg dev" this one is not tied to any repository or
+structure. The default message is created using the difference between
+the previous and current version of the package specification. In order
+to grab the previous version, the working directory and three levels
+towards root are checked for signs of CVS, Subversion, Monotone, Git,
+Mercurial or SVS information, in that order. The appropriate command is
+then executed to retrieve the data and the VCS found is passed to the
+actual release command.
+
+Finally, the command specified by the environment variable
+C or, if omitted, specified by the rpm macro
+C<%{openpkg_dev_release}> is run and passed the following positional
+arguments:
+
+=over 4
+
+ openpkg-prefix
+ spec-dir
+ source-dir
+ binary-rpm-file
+ source-rpm-file
+ package-name
+ package-version
+ package-release
+ package-version-old
+ package-release-old
+ commit-message
+ vcs
+
+=back
+
+For a dry run, set C<$OPENPKG_DEV_RELEASE> to "echo" or use option "C<-n>".
+
+=back
+
+=head1 UNPACKED SOURCE RPM PACKAGE FILESYSTEM LAYOUT
+
+When an OpenPKG source RPM package
+IC<->IC<->IC<.src.rpm> is unpacked to the
+filesystem, the following distinct filesystem layouts are known:
+
+=over 4
+
+=item B
+
+=over 4
+
+=item ICIC
+
+=item ICIC>IC<.spec>
+
+=item ICIC>I
+
+=item ICIC>I
+
+=item ICI
+
+=item ICI
+
+=item ICI
+
+=back
+
+This is just the "simple" filesystem layout (see below) with the
+I set to IC.
+
+This is the filesystem layout used by default for building OpenPKG
+packages during C or the underlying C commands.
+
+=item B
+
+=over 4
+
+=item IC
+
+=item IC>IC<.spec>
+
+=item IC>I
+
+=item IC>I
+
+=item IC>I
+
+=item IC>I
+
+=item IC>I
+
+=back
+
+This puts everything into one directory.
+
+=item B
+
+=over 4
+
+=item IC>IC
+
+=item IC>IC>IC<.spec>
+
+=item IC>IC>I
+
+=item IC>IC>I
+
+=item IC>I
+
+=item IC>I
+
+=item I<$TMPDIR>CI
+
+=back
+
+This is the simple filesystem layout of an unpacked
+OpenPKG package. All files are simply put into a sub-directory with the
+I of the package.
+
+This is the filesystem layout used for the quick patching of a single
+OpenPKG package in a stand-alone environment.
+
+=item B
+
+=over 4
+
+=item IC>IC
+
+=item IC>ICIC<.spec>
+
+=item IC>ICI
+
+=item IC>ICI
+
+=item IC>IC[C]I
+
+=item IC>IC[C]I
+
+=item IC>ICI
+
+=back
+
+This is the structured (and default) filesystem layout of an unpacked
+OpenPKG package. A top-level sub-directory with the I of the
+package is created. There the package specification and all packaging
+source files are put into the sub-directory I and all the
+third-party distribution files are put into the sub-directory I.
+
+This is the filesystem layout used for the development of a single
+OpenPKG package in a stand-alone environment.
+
+=item B
+
+=over 4
+
+=item IC>C<.openpkg/rpmmacros>
+
+=item IC>CIC>IC<.spec>
+
+=item IC>CIC>I
+
+=item IC>CIC>I
+
+=item IC>C[C]I
+
+=item IC>C[C]I
+
+=item IC>CI
+
+=back
+
+This is the distributed filesystem layout of an unpacked OpenPKG
+package. It is similar to the structured filesystem layout but the
+C and C directories and the I directory are swapped,
+mainly with the intention of bundling together all third-party
+distribution files of a large number of packages.
+
+This is the filesystem layout used for regular OpenPKG package
+development.
+
+=back
+
+
+=head1 LOCAL RPM MACROS FILE (.openpkg/rpmmacros)
+
+OpenPKG supports local RPM macros files F<.openpkg/rpmmacros> which
+can be used to configure RPM in a local scope. This is especially
+interesting to configure a local (even per-package) build environment
+with the help of the C<%openpkg_layout> macro.
+
+C<%openpkg_layout>
+[CI]
+[CI]
+[CI]
+[CI]
+[CI]
+[CI]
+[CI]
+[CI]
+[CI]
+[CI]
+
+=over 4
+
+=item CI
+
+Absolute file path of the C<.openpkg/rpmmacros> file where this
+C<%openpkg_layout> macro is defined. Usually, the intended usage is to
+leverage from OpenPKG RPM's special C<%{macrosfile}> macro by simply
+using C. This parameter is important as
+the default C is derived from it.
+
+=item CI
+
+Absolute directory path where the C<.openpkg/rpmmacros> file is
+located under. Usually, the intended usage is to not explicitly
+set this parameter but let it be determined indirectly via
+C. The effective default value is equal to a value like
+C<%{realpath:%{dirname:%{realpath:%{macrosfile}}}/..}> This parameter is
+important as all standard filesystem layouts (see parameter C)
+are always at least partially based on this base directory in order
+to provide absolute-path-independent flexible filesystem layouts.
+
+=item CI
+
+The name of the filesystem layout type to use. The following standard
+filesystem layout types are pre-defined: C, C, C,
+C (default) and C.
+
+ global macrosdir /etc/openpkg
+ global macrosfile /etc/openpkg/rpmmacros
+ global specdir /RPM/SRC/$name
+ global sourcedir /RPM/SRC/$name
+ global builddir /RPM/TMP
+ global tmpdir /RPM/TMP
+ global binrpmdir /RPM/PKG
+ global srcrpmdir /RPM/PKG
+
+ local macrosdir /.openpkg
+ local macrosfile /.openpkg/rpmmacros
+ local specdir
+ local sourcedir
+ local builddir
+ local tmpdir
+ local binrpmdir
+ local srcrpmdir
+
+ simple macrosdir /.openpkg
+ simple macrosfile /.openpkg/rpmmacros
+ simple specdir
+ simple sourcedir
+ simple builddir
+ simple tmpdir
+ simple binrpmdir /..
+ simple srcrpmdir /..
+
+ structured macrosdir /.openpkg
+ structured macrosfile /.openpkg/rpmmacros
+ structured specdir /src
+ structured sourcedir /dst
+ structured builddir /tmp
+ structured tmpdir /tmp
+ structured binrpmdir /pkg/bin
+ structured srcrpmdir /pkg/src
+
+ distributed macrosdir /.openpkg
+ distributed macrosfile /.openpkg/rpmmacros
+ distributed specdir /src/
+ distributed sourcedir /dst/
+ distributed builddir /tmp
+ distributed tmpdir /tmp
+ distributed binrpmdir /pkg/bin
+ distributed srcrpmdir /pkg/src
+
+
+=item CI
+
+=item CI
+
+=item CI
+
+=item CI
+
+=item CI
+
+=item CI
+
+These parameters correspond to the six individual directories provided
+by a standard layout and allow you to selectively adjust parts of a
+standard layout to local needs and without having to define a full
+standard layout yourself.
+
+The I is a whitespace-separated list of
+I[C<:>[C<+>]I] specifications which are
+"first-match" searched for existence. The last directory in the list
+is always taken as the fallback and if it is not existing it is
+even created on-the-fly. The IC<:>I
+syntax variant allows the existence test to use I,
+but expands to I (replace mode). The
+IC<:+>I syntax variant allows
+the existence test to use I, but expands to
+II (append mode). For instance
+C will first check for ~/tmp (and then use
+~/tmp/openpkg), then for $TMPDIR (and use $TMPDIR/openpkg) and finally
+it will use /tmp/$LOGNAME/openpkg at last resort.
+
+Paths are usually assembled by using RPM macros like
+C<%{l_prefix}> (the instance prefix), C<%{__openpkg_basename}> (the
+I parameter), C<%{realpath:} (path resolution),
+C<%{dirname:} (directory name extraction), C<%{basename:}
+(file name extraction), etc.
+
+=item CI
+
+This enables the I components in the standard filesystem
+layouts by setting it to an automatically generated sub-directory named
+IC<->I-I. This allows one to build the same OpenPKG
+package in parallel on multiple hosts in a shared environment (usually
+on an NFS based filesystem).
+
+=item CI
+
+This enables debug outputs which shows the effectively used directory
+paths.
+
+=back
+
+The generated C<.openpkg/rpmmacros> file contains the generic filesystem
+layout glue configuration for the particular filesystem I.
+
+=over 1
+
+=item C<%openpkg_layout macrosfile=%{macrosfile} layout=>I
+
+=back
+
+=head1 CONFIGURATION
+
+=over 4
+
+ OPENPKG_NAME="Ralf S. Engelschall"
+ OPENPKG_MAIL="rse@openpkg.net"
+ OPENPKG_MODE="developer"
+
+ OPENPKG_PREFIX="/openpkg"
+ OPENPKG_TMPDIR="${TMPDIR-/tmp}/openpkg"
+
+ OPENPKG_VCS="cvs ci -m '' ."
+ OPENPKG_UPLD="scp openpkg-ftp@ftp.openpkg.org:/current/SRC/00UPLOAD/"
+
+=back
+
+=head1 ABOUT
+
+OpenPKG B is Ralf S. Engelschall's Perl-based clean-room partial
+re-implementation of 2008 for OpenPKG 4.0 of Thomas Lotterer's original
+OpenPKG B Bash-based shell from 2002.
+
+=cut
+