Resynchronize with upstream package maintainer version.

Tue, 31 Jul 2012 12:23:42 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 31 Jul 2012 12:23:42 +0200
changeset 428
f880f219c566
parent 427
71503088f51b
child 429
b363f8ef6dcb

Resynchronize with upstream package maintainer version.

openpkg/Makefile file | annotate | diff | comparison | revisions
openpkg/README file | annotate | diff | comparison | revisions
openpkg/bash.patch file | annotate | diff | comparison | revisions
openpkg/bash.patch.vendor file | annotate | diff | comparison | revisions
openpkg/beecrypt.patch file | annotate | diff | comparison | revisions
openpkg/build.8 file | annotate | diff | comparison | revisions
openpkg/build.pl file | annotate | diff | comparison | revisions
openpkg/build.pod file | annotate | diff | comparison | revisions
openpkg/curl.patch file | annotate | diff | comparison | revisions
openpkg/curl.sh file | annotate | diff | comparison | revisions
openpkg/dev.8 file | annotate | diff | comparison | revisions
openpkg/dev.pl file | annotate | diff | comparison | revisions
openpkg/dev.pod file | annotate | diff | comparison | revisions
openpkg/diffutils.patch file | annotate | diff | comparison | revisions
openpkg/dot.bash_login file | annotate | diff | comparison | revisions
openpkg/etc.prereq.sh file | annotate | diff | comparison | revisions
openpkg/etc.usrgrp.sh file | annotate | diff | comparison | revisions
openpkg/etc.wrapbin.sh file | annotate | diff | comparison | revisions
openpkg/etc.wrapsrc.sh file | annotate | diff | comparison | revisions
openpkg/index.8 file | annotate | diff | comparison | revisions
openpkg/index.pl file | annotate | diff | comparison | revisions
openpkg/index.pod file | annotate | diff | comparison | revisions
openpkg/libarchive.patch file | annotate | diff | comparison | revisions
openpkg/license-BOOT.txt file | annotate | diff | comparison | revisions
openpkg/license-COMMUNITY.txt file | annotate | diff | comparison | revisions
openpkg/license-EVAL.txt file | annotate | diff | comparison | revisions
openpkg/license-EXAMPLE.txt file | annotate | diff | comparison | revisions
openpkg/license-PROMO.txt file | annotate | diff | comparison | revisions
openpkg/license-RECOVERY.txt file | annotate | diff | comparison | revisions
openpkg/license.8 file | annotate | diff | comparison | revisions
openpkg/license.lua file | annotate | diff | comparison | revisions
openpkg/license.pod file | annotate | diff | comparison | revisions
openpkg/license.sh file | annotate | diff | comparison | revisions
openpkg/lint-fsl.pl file | annotate | diff | comparison | revisions
openpkg/lint-rc.pl file | annotate | diff | comparison | revisions
openpkg/lint-rpm.pl file | annotate | diff | comparison | revisions
openpkg/lint-spec.pl file | annotate | diff | comparison | revisions
openpkg/local.README file | annotate | diff | comparison | revisions
openpkg/lsync file | annotate | diff | comparison | revisions
openpkg/lsync.8 file | annotate | diff | comparison | revisions
openpkg/lsync.pod file | annotate | diff | comparison | revisions
openpkg/make.patch file | annotate | diff | comparison | revisions
openpkg/makeproxy.8 file | annotate | diff | comparison | revisions
openpkg/makeproxy.pl file | annotate | diff | comparison | revisions
openpkg/man.sh file | annotate | diff | comparison | revisions
openpkg/mirror.8 file | annotate | diff | comparison | revisions
openpkg/mirror.pl file | annotate | diff | comparison | revisions
openpkg/mirror.pod file | annotate | diff | comparison | revisions
openpkg/mutex.c file | annotate | diff | comparison | revisions
openpkg/mutex.mk file | annotate | diff | comparison | revisions
openpkg/openpkg.1 file | annotate | diff | comparison | revisions
openpkg/openpkg.boot file | annotate | diff | comparison | revisions
openpkg/openpkg.c file | annotate | diff | comparison | revisions
openpkg/openpkg.mk file | annotate | diff | comparison | revisions
openpkg/openpkg.pod file | annotate | diff | comparison | revisions
openpkg/openpkg.sh file | annotate | diff | comparison | revisions
openpkg/openpkg.spec file | annotate | diff | comparison | revisions
openpkg/openssl.patch file | annotate | diff | comparison | revisions
openpkg/patch.Makefile.in file | annotate | diff | comparison | revisions
openpkg/patch.strnlen.c file | annotate | diff | comparison | revisions
openpkg/pcre.patch file | annotate | diff | comparison | revisions
openpkg/perl.patch file | annotate | diff | comparison | revisions
openpkg/popt.patch file | annotate | diff | comparison | revisions
openpkg/rc file | annotate | diff | comparison | revisions
openpkg/rc.8 file | annotate | diff | comparison | revisions
openpkg/rc.conf file | annotate | diff | comparison | revisions
openpkg/rc.func file | annotate | diff | comparison | revisions
openpkg/rc.openpkg file | annotate | diff | comparison | revisions
openpkg/rc.pod file | annotate | diff | comparison | revisions
openpkg/register.8 file | annotate | diff | comparison | revisions
openpkg/register.pod file | annotate | diff | comparison | revisions
openpkg/register.sh file | annotate | diff | comparison | revisions
openpkg/release.8 file | annotate | diff | comparison | revisions
openpkg/release.pod file | annotate | diff | comparison | revisions
openpkg/release.sh file | annotate | diff | comparison | revisions
openpkg/root.README file | annotate | diff | comparison | revisions
openpkg/rpm-config.8 file | annotate | diff | comparison | revisions
openpkg/rpm-config.pod file | annotate | diff | comparison | revisions
openpkg/rpm-config.sh file | annotate | diff | comparison | revisions
openpkg/rpm.patch file | annotate | diff | comparison | revisions
openpkg/rpm.sh file | annotate | diff | comparison | revisions
openpkg/rpmdb file | annotate | diff | comparison | revisions
openpkg/rpmlua file | annotate | diff | comparison | revisions
openpkg/rpmmacros file | annotate | diff | comparison | revisions
openpkg/rpmpopt file | annotate | diff | comparison | revisions
openpkg/rpmtool file | annotate | diff | comparison | revisions
openpkg/rpmtool.8 file | annotate | diff | comparison | revisions
openpkg/rpmtool.pod file | annotate | diff | comparison | revisions
openpkg/sea.8 file | annotate | diff | comparison | revisions
openpkg/sea.pod file | annotate | diff | comparison | revisions
openpkg/sea.sh file | annotate | diff | comparison | revisions
openpkg/search.8 file | annotate | diff | comparison | revisions
openpkg/search.pl file | annotate | diff | comparison | revisions
openpkg/search.pod file | annotate | diff | comparison | revisions
openpkg/shtool file | annotate | diff | comparison | revisions
openpkg/shtool.sh file | annotate | diff | comparison | revisions
openpkg/sqlite.patch file | annotate | diff | comparison | revisions
openpkg/stack.8 file | annotate | diff | comparison | revisions
openpkg/stack.pod file | annotate | diff | comparison | revisions
openpkg/stack.sh file | annotate | diff | comparison | revisions
openpkg/tar.patch file | annotate | diff | comparison | revisions
openpkg/uuid.8 file | annotate | diff | comparison | revisions
openpkg/uuid.pod file | annotate | diff | comparison | revisions
openpkg/uuid.sh file | annotate | diff | comparison | revisions
openpkg/xz.patch file | annotate | diff | comparison | revisions
openpkg/zlib.patch file | annotate | diff | comparison | revisions
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/openpkg/Makefile	Tue Jul 31 12:23:42 2012 +0200
     1.3 @@ -0,0 +1,177 @@
     1.4 +##
     1.5 +##  Makefile -- OpenPKG Framework Developer Procedures
     1.6 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
     1.7 +##
     1.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
     1.9 +##  All rights reserved. Licenses which grant limited permission to use,
    1.10 +##  copy, modify and distribute this software are available from the
    1.11 +##  OpenPKG GmbH.
    1.12 +##
    1.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
    1.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.24 +##  SUCH DAMAGE.
    1.25 +##
    1.26 +
    1.27 +PATH      = /usr/opkg/bin:/usr/opkg/sbin:/bin:/sbin:/usr/bin:/usr/sbin
    1.28 +PREFIX    = /openpkg
    1.29 +USER      = openpkg
    1.30 +GROUP     = openpkg
    1.31 +TAG       = openpkg
    1.32 +
    1.33 +SH        = /bin/sh
    1.34 +RPM       = $(PREFIX)/bin/openpkg rpm
    1.35 +SUDO      = sudo
    1.36 +SCP       = scp
    1.37 +RSYNC     = rsync
    1.38 +RSYNC_REM = /v/openpkg/sw/bin/rsync
    1.39 +MTN       = mtn
    1.40 +
    1.41 +UPLOAD1   = openpkg@experimental.openpkg.org:/v/openpkg/download/data/framework/release/source/
    1.42 +UPLOAD2   = openpkg@experimental.openpkg.org:/v/openpkg/download/data/components/cache/openpkg/
    1.43 +
    1.44 +all:
    1.45 +	@echo "Individual Steps:"
    1.46 +	@echo "  $(MAKE) fetch-sh         fetch third-party distribution files (standalone)"
    1.47 +	@echo "  $(MAKE) fetch-rpm        fetch third-party distribution files (requires $(PREFIX))"
    1.48 +	@echo "  $(MAKE) build-src-sh     build   SOURCE SHELL package (standalone)"
    1.49 +	@echo "  $(MAKE) build-bin-sh     build   BINARY SHELL package (standalone)"
    1.50 +	@echo "  $(MAKE) build-src-rpm    build   SOURCE RPM   package (requires $(PREFIX))"
    1.51 +	@echo "  $(MAKE) build-bin-rpm    build   BINARY RPM   package (requires $(PREFIX))"
    1.52 +	@echo "  $(MAKE) install-bin-sh   install BINARY SHELL package (requires $(PREFIX))"
    1.53 +	@echo "  $(MAKE) install-bin-rpm  install BINARY RPM   package (requires $(PREFIX))"
    1.54 +	@echo "  $(MAKE) uninstall        uninstall entire instance under $(PREFIX)"
    1.55 +	@echo "  $(MAKE) upload-dst       upload latest DISTRIBUTION files"
    1.56 +	@echo "  $(MAKE) upload-pkg       upload latest SOURCE SHELL+RPM packages"
    1.57 +	@echo "  $(MAKE) upload-src       upload latest SOURCE repository revisions"
    1.58 +	@echo "  $(MAKE) clean            remove temporary files"
    1.59 +	@echo ""
    1.60 +	@echo "All-In-One Steps:"
    1.61 +	@echo "  $(MAKE) bootstrap        BOOTSTRAP instance under $(PREFIX) from scratch"
    1.62 +	@echo "  $(MAKE) update           UPDATE    instance under $(PREFIX)"
    1.63 +	@echo "  $(MAKE) upload           upload all results"
    1.64 +
    1.65 +##
    1.66 +##  Individual Steps
    1.67 +##
    1.68 +
    1.69 +fetch-sh:
    1.70 +	@echo "++ fetching third-party distribution files (manually)"; \
    1.71 +	eval `egrep '^%define *V_.*' openpkg.spec | \
    1.72 +	    sed -e 's%^.*\(V_[a-z][a-zA-Z0-9_]*\) *\([^ ][^ ]*\).*$$%\1="\2";%'`; \
    1.73 +	for url in \
    1.74 +	    `egrep '^Source[0-9][0-9]*: *(http|ftp)://' openpkg.spec | \
    1.75 +	    sed -e 's;^Source[0-9][0-9]*: *;;' -e 's;%{\(V_[a-z][a-zA-Z0-9_]*\)};$${\1};g'`; do \
    1.76 +	    eval "url=\"$$url\""; \
    1.77 +	    file=`echo "$$url" | sed -e 's;^.*/\([^/]*\)$$;../dst/\1;'`; \
    1.78 +	    if [ ! -f $$file ]; then \
    1.79 +			echo "-- downloading $$url"; \
    1.80 +			if [ ".`(which curl) 2>/dev/null | egrep '^/'`" != . ]; then \
    1.81 +				curl -s -L -o "$$file" "$$url" || true; \
    1.82 +			elif [ ".`(which wget) 2>/dev/null | egrep '^/'`" != . ]; then \
    1.83 +				wget -q -O "$$file" "$$url" || true; \
    1.84 +			elif [ ".`(which fetch) 2>/dev/null | egrep '^/'`" != . ]; then \
    1.85 +				fetch -o "$$file" "$$url" || true; \
    1.86 +			elif [ ".`(which lwp-download) 2>/dev/null | egrep '^/'`" != . ]; then \
    1.87 +				lwp-download "$$url" "$$file" || true; \
    1.88 +			else \
    1.89 +				echo "ERROR: sorry, no download tool found in \$$PATH (\"curl\", \"wget\", \"fetch\", \"lwp-download\")" 1>&2; \
    1.90 +				exit 1; \
    1.91 +			fi; \
    1.92 +			if [ ! -f "$$file" ]; then \
    1.93 +				echo "ERROR: failed to download \"$$url\"" 1>&2; \
    1.94 +				exit 1; \
    1.95 +			fi; \
    1.96 +	    fi; \
    1.97 +	done
    1.98 +
    1.99 +fetch-rpm:
   1.100 +	@echo "++ fetching third-party distribution files (via RPM)"; \
   1.101 +	PATH="$(PATH)" $(RPM) -bf *.spec
   1.102 +
   1.103 +build-src-sh:
   1.104 +	@echo "++ building SOURCE SHELL package"; \
   1.105 +	PATH="$(PATH)" $(SH) openpkg.boot -s
   1.106 +
   1.107 +build-bin-sh:
   1.108 +	@echo "++ building BINARY SHELL package"; \
   1.109 +	cd ../pkg && TMPDIR="`cd ../tmp && pwd`" && export TMPDIR && \
   1.110 +	PATH="$(PATH)" $(SH) openpkg-*-`date '+%Y%m%d'`.src.sh \
   1.111 +	    --prefix=$(PREFIX) \
   1.112 +	    --user=$(USER) \
   1.113 +	    --group=$(GROUP) \
   1.114 +	    --tag=$(TAG)
   1.115 +
   1.116 +build-src-rpm:
   1.117 +	@echo "++ building SOURCE RPM package"; \
   1.118 +	PATH="$(PATH)" $(RPM) -bs openpkg.spec
   1.119 +
   1.120 +build-bin-rpm:
   1.121 +	@echo "++ building BINARY RPM package"; \
   1.122 +	PATH="$(PATH)" $(RPM) -bb openpkg.spec
   1.123 +
   1.124 +install-bin-sh:
   1.125 +	@echo "++ installing BINARY SHELL package"; \
   1.126 +	d=`cd ../pkg && pwd` && cd / && PATH="$(PATH)" $(SUDO) $(SH) $$d/openpkg-*-`date '+%Y%m%d'`.*-*-*.sh
   1.127 +
   1.128 +install-bin-rpm:
   1.129 +	@echo "++ installing BINARY RPM package"; \
   1.130 +	d=`cd ../pkg && pwd` && cd / && PATH="$(PATH)" $(SUDO) $(RPM) -Uvh --replacepkgs $$d/openpkg-*-`date '+%Y%m%d'`.*-*-*.rpm
   1.131 +
   1.132 +uninstall:
   1.133 +	-@echo "++ uninstalling ENTIRE instance"; \
   1.134 +	cd /; $(RPM) -qa | grep -v '^openpkg-[0-9]' | xargs $(SUDO) $(RPM) -e; \
   1.135 +	$(SUDO) $(RPM) -e openpkg
   1.136 +
   1.137 +upload-dst:
   1.138 +	@echo "++ uploading vendor DISTRIBUTION files:"; \
   1.139 +	$(RSYNC) -raH --delete -v --progress --rsync-path=$(RSYNC_REM) ../dst/ $(UPLOAD2)
   1.140 +
   1.141 +upload-pkg:
   1.142 +	@echo "++ uploading SOURCE SHELL/RPM package(s):"; \
   1.143 +	$(RSYNC) -raH --delete -v --progress --rsync-path=$(RSYNC_REM) ../pkg/*.src.* $(UPLOAD1)
   1.144 +
   1.145 +upload-src:
   1.146 +	@echo "++ uploading SOURCE repository revision(s):"; \
   1.147 +	$(MTN) sync
   1.148 +
   1.149 +clean:
   1.150 +	-rm -rf ../tmp/*
   1.151 +
   1.152 +pod2man:
   1.153 +	pod2man --section=1 --center="OpenPKG" --release="OPENPKG(8)"    --date="OpenPKG" --quotes=none openpkg.pod    >openpkg.1
   1.154 +	pod2man --section=8 --center="OpenPKG" --release="RC(8)"         --date="OpenPKG" --quotes=none rc.pod         >rc.8
   1.155 +	pod2man --section=8 --center="OpenPKG" --release="RPMTOOL(8)"    --date="OpenPKG" --quotes=none rpmtool.pod    >rpmtool.8
   1.156 +	pod2man --section=8 --center="OpenPKG" --release="LSYNC(8)"      --date="OpenPKG" --quotes=none lsync.pod      >lsync.8
   1.157 +	pod2man --section=8 --center="OpenPKG" --release="RPM-CONFIG(8)" --date="OpenPKG" --quotes=none rpm-config.pod >rpm-config.8
   1.158 +	pod2man --section=8 --center="OpenPKG" --release="UUID(8)"       --date="OpenPKG" --quotes=none uuid.pod       >uuid.8
   1.159 +	pod2man --section=8 --center="OpenPKG" --release="RELEASE(8)"    --date="OpenPKG" --quotes=none release.pod    >release.8
   1.160 +	pod2man --section=8 --center="OpenPKG" --release="BUILD(8)"      --date="OpenPKG" --quotes=none build.pod      >build.8
   1.161 +	pod2man --section=8 --center="OpenPKG" --release="INDEX(8)"      --date="OpenPKG" --quotes=none index.pod      >index.8
   1.162 +	pod2man --section=8 --center="OpenPKG" --release="SEARCH(8)"     --date="OpenPKG" --quotes=none search.pod     >search.8
   1.163 +	pod2man --section=8 --center="OpenPKG" --release="MIRROR(8)"     --date="OpenPKG" --quotes=none mirror.pod     >mirror.8
   1.164 +	pod2man --section=8 --center="OpenPKG" --release="MAKEPROXY(8)"  --date="OpenPKG" --quotes=none makeproxy.pod  >makeproxy.8
   1.165 +	pod2man --section=8 --center="OpenPKG" --release="REGISTER(8)"   --date="OpenPKG" --quotes=none register.pod   >register.8
   1.166 +	pod2man --section=8 --center="OpenPKG" --release="LICENSE(8)"    --date="OpenPKG" --quotes=none license.pod    >license.8
   1.167 +	pod2man --section=8 --center="OpenPKG" --release="DEV(8)"        --date="OpenPKG" --quotes=none dev.pod        >dev.8
   1.168 +	pod2man --section=8 --center="OpenPKG" --release="SEA(8)"        --date="OpenPKG" --quotes=none sea.pod        >sea.8
   1.169 +	pod2man --section=8 --center="OpenPKG" --release="STACK(8)"      --date="OpenPKG" --quotes=none stack.pod      >stack.8
   1.170 +
   1.171 +##
   1.172 +##  All-In-One Steps
   1.173 +##
   1.174 +
   1.175 +bootstrap: build-src-sh build-bin-sh install-bin-sh
   1.176 +
   1.177 +update: build-bin-rpm install-bin-rpm
   1.178 +
   1.179 +upload: build-src-sh build-src-rpm upload-pkg upload-src
   1.180 +
     2.1 --- a/openpkg/README	Tue Jul 31 12:12:54 2012 +0200
     2.2 +++ b/openpkg/README	Tue Jul 31 12:23:42 2012 +0200
     2.3 @@ -1,52 +1,60 @@
     2.4  
     2.5 -  OpenPKG Boostrap Package Source Tree
     2.6 -  ====================================
     2.7 +  OpenPKG Framework Bootstrap Package, Source Tree
     2.8 +  ================================================
     2.9  
    2.10 -  This is the source code tree for the OpenPKG bootstrap package. What
    2.11 -  you find here is rather complex and tricky stuff, so don't be confused
    2.12 -  if you don't understand everything immediately.
    2.13 +  This is the source tree for the OpenPKG Framework "bootstrap" package.
    2.14 +  What you find here is rather complex and tricky stuff, so don't be
    2.15 +  confused if you don't understand everything immediately.
    2.16  
    2.17    The Files
    2.18    ---------
    2.19  
    2.20    README .................. this file ;-)
    2.21 -  HISTORY ................. change history tracking of this package
    2.22  
    2.23    openpkg.spec ............ the regular build procedure
    2.24    openpkg.boot ............ the bootstrapping procedure
    2.25  
    2.26 -  gzip-*.tar .............. untouched distribution tarball of the GNU gzip tool
    2.27 -  make-*.tar.gz ........... untouched distribution tarball of the GNU make tool
    2.28    patch-*.tar.gz .......... untouched distribution tarball of the GNU patch tool
    2.29    bash-*.tar.gz ........... untouched distribution tarball of the GNU bash tool
    2.30 +  make-*.tar.gz ........... untouched distribution tarball of the GNU make tool
    2.31    tar-*.tar.gz ............ untouched distribution tarball of the GNU tar tool
    2.32 +  config-*.tar.gz ......... untouched distribution tarball of the GNU config scripts
    2.33 +  gzip-*.tar .............. pre-unpacked distribution tarball of the GNU gzip tool
    2.34 +  gzip-*-openpkg-r*.tar ... pre-patched distribution files of the GNU gzip tool
    2.35 +  perl-*-mini.tar.gz ...... stripped down distribution tarball of the Perl tool
    2.36 +  rpm-*.tar.gz ............ untouched distribution tarball of the RPM tool
    2.37 +  openssl-*.tar.gz ........ untouched distribution tarball of the OpenSSL toolkit
    2.38    uuid-*.tar.gz ........... untouched distribution tarball of the OSSP uuid tool
    2.39    curl-*.tar.gz ........... untouched distribution tarball of the cURL tool
    2.40 +  beecrypt-*.tar.gz ....... untouched distribution tarball of the BeeCrypt library
    2.41    bzip2-*.tar.gz .......... untouched distribution tarball of the BZIP2 library
    2.42    zlib-*.tar.gz ........... untouched distribution tarball of the ZLIB library
    2.43 -  beecrypt-*.tar.gz ....... untouched distribution tarball of the BeeCrypt library
    2.44 -  rpm-*.tar.gz ............ untouched distribution tarball of the RPM tool
    2.45 -  config-*.tar.gz ......... untouched distribution tarball of the GNU config scripts
    2.46 -  openpkg-registry-*.tar.gz untouched distribution tarball of the OpenPKG Registry
    2.47 -  openpkg-tools-*.tar.gz .. untouched distribution tarball of the OpenPKG Tool Chain
    2.48 -  openssl-*.tar.gz ........ untouched distribution tarball of the OpenSSL toolkit
    2.49 -  perl-*-mini.tar.gz ...... stripped down distribution tarball of the Perl tool
    2.50 +  popt-*.tar.gz ........... untouched distribution tarball of the POPT library
    2.51 +  sqlite-*.tar.gz ......... untouched distribution tarball of the SQLite library
    2.52 +  pcre-*.tar.gz ........... untouched distribution tarball of the SQLite library
    2.53 +  diffutils-*.tar.gz ...... untouched distribution tarball of the GNU diffutils toolkit
    2.54 +  svs-*.tar.gz ............ untouched distribution tarball of the OSSP svs tool
    2.55 +  xz-*.tar.gz ............. untouched distribution tarball of the XZ tool
    2.56  
    2.57 -  make.patch .............. patch for GNU make
    2.58 -  bash.patch .............. patch for GNU bash
    2.59 -  tar.patch ............... patch for GNU tar
    2.60 -  beecrypt.patch .......... patch for BeeCrypt
    2.61 -  openssl.patch ........... patch for OpenSSL
    2.62 -  perl.patch .............. patch for Perl
    2.63 -  gzip.c .................. replacement file for GNU gzip
    2.64 -  rpm.patch.bugfix ........ patch for RPM (bugfixing parts)
    2.65 -  rpm.patch.feature ....... patch for RPM (new features parts)
    2.66 -  rpm.patch.porting ....... patch for RPM (portability enhancement parts)
    2.67 -  rpm.patch.regen ......... patch for RPM (re-generated files parts)
    2.68 +  bash.patch .............. patch for GNU bash tool
    2.69 +  bash.patch.vendor ....... patch for GNU bash tool (upstream vendor only)
    2.70 +  bash.patch.vendor.sh .... patch for GNU bash tool (generation utility, NOT BUNDLED)
    2.71 +  beecrypt.patch .......... patch for BeeCrypt library
    2.72 +  make.patch .............. patch for GNU make tool
    2.73 +  openssl.patch ........... patch for OpenSSL toolkit
    2.74 +  perl.patch .............. patch for Perl tool
    2.75 +  tar.patch ............... patch for GNU tar tool
    2.76 +  rpm.patch ............... patch for RPM tool
    2.77 +  popt.patch .............. patch for POPT library
    2.78 +  sqlite.patch ............ patch for SQLite library
    2.79 +  curl.patch .............. patch for cURL library
    2.80 +  diffutils.patch ......... patch for GNU diffutils tool
    2.81 +  libarchive.patch ........ patch for BSD libarchive tool
    2.82 +  pcre.patch .............. patch for PCRE library
    2.83 +  xz.patch ................ patch for XZ tool
    2.84  
    2.85    rpmpopt ................. replacements/extensions for RPM's POPT configuration
    2.86    rpmmacros ............... replacements/extensions for RPM's macros
    2.87 -  rpmrc ................... replacements for RPM's run-command configuration
    2.88  
    2.89    root.README ............. the source for installed <prefix>/README
    2.90    local.README ............ the source for installed <prefix>/local/README
    2.91 @@ -55,6 +63,7 @@
    2.92    dot.lsyncrc ............. the source for installed <prefix>/local/.lsyncrc
    2.93  
    2.94    openpkg.c ............... the OpenPKG frontend (set-uid wrapper)
    2.95 +  openpkg.mk .............. the OpenPKG frontend (build procedure)
    2.96    openpkg.sh .............. the OpenPKG frontend (main script)
    2.97    openpkg.pod ............. the OpenPKG frontend manual page (source)
    2.98    openpkg.1 ............... the OpenPKG frontend manual page (pre-generated output)
    2.99 @@ -89,31 +98,74 @@
   2.100    lsync.8 ................. the lsync tool (manual page)
   2.101    lsync.pod ............... the lsync tool (manual page source)
   2.102  
   2.103 -  aux.usrgrp.sh ........... user/group name/id determination script
   2.104 -  aux.prereq.sh ........... prerequisite checking script
   2.105 -  aux.wrapsrc.sh .......... wrapper script for generating openpkg-V-R.src.sh
   2.106 -  aux.wrapbin.sh .......... wrapper script for generating openpkg-V-R.P-L.sh
   2.107 +  etc.usrgrp.sh ........... user/group name/id determination script
   2.108 +  etc.prereq.sh ........... prerequisite checking script
   2.109 +  etc.wrapsrc.sh .......... wrapper script for generating openpkg-V-R.src.sh
   2.110 +  etc.wrapbin.sh .......... wrapper script for generating openpkg-V-R.P-L.sh
   2.111  
   2.112 -  pod2man.sh .............. helper script for pre-generating manual page outputs
   2.113    man.sh .................. helper script for "openpkg man" command
   2.114 -  install.sh .............. helper script for "openpkg install" command
   2.115 +
   2.116 +  rpm.sh .................. wrapper for RPM
   2.117 +  curl.sh ................. wrapper for cURL
   2.118 +
   2.119 +  dev.pl .................. the OpenPKG package development utility script
   2.120 +  dev.pod ................. the OpenPKG package development utility manual page (source)
   2.121 +  dev.8 ................... the OpenPKG package development utility manual page (pre-generated output)
   2.122 +
   2.123 +  index.pl ................ the OpenPKG package indexing utility script
   2.124 +  index.pod ............... the OpenPKG package indexing utility manual page (source)
   2.125 +  index.8 ................. the OpenPKG package indexing utility manual page (pre-generated output)
   2.126 +
   2.127 +  search.pl ............... the OpenPKG package searching utility script
   2.128 +  search.pod .............. the OpenPKG package searching utility manual page (source)
   2.129 +  search.8 ................ the OpenPKG package searching utility manual page (pre-generated output)
   2.130 +
   2.131 +  sea.sh .................. the OpenPKG shell execution archive utility script
   2.132 +  sea.pod ................. the OpenPKG shell execution archive utility manual page (source)
   2.133 +  sea.8 ................... the OpenPKG shell execution archive utility manual page (pre-generated output)
   2.134 +
   2.135 +  mirror.pl ............... the OpenPKG package mirroing utility script
   2.136 +  mirror.pod .............. the OpenPKG package mirroing utility manual page (source)
   2.137 +  mirror.8 ................ the OpenPKG package mirroing utility manual page (pre-generated output)
   2.138 +
   2.139 +  build.pl ................ the OpenPKG package building utility script
   2.140 +  build.pod ............... the OpenPKG package building utility manual page (source)
   2.141 +  build.8 ................. the OpenPKG package building utility manual page (pre-generated output)
   2.142 +
   2.143 +  makeproxy.pl ............ the OpenPKG proxy package building utility script
   2.144 +  makeproxy.pod ........... the OpenPKG proxy package building utility manual page (source)
   2.145 +  makeproxy.8 ............. the OpenPKG proxy package building utility manual page (pre-generated output)
   2.146  
   2.147    openpkg.org.pgp ......... the OpenPGP public key "OpenPKG <openpkg@openpkg.org>"
   2.148    openpkg.com.pgp ......... the OpenPGP public key "OpenPKG GmbH <openpkg@openpkg.com>"
   2.149    openpkg.net.pgp ......... the OpenPGP public key "OpenPKG Foundation e.V. <openpkg@openpkg.net>"
   2.150  
   2.151 +  license.sh .............. the OpenPKG license management utility script
   2.152 +  license.pod ............. the OpenPKG license management utility manual page (source)
   2.153 +  license.8 ............... the OpenPKG license management utility manual page (pre-generated output)
   2.154 +  license-BOOT.txt ........ the OpenPKG Framework Bootstrapping License
   2.155 +  license-COMMUNITY.txt ... the OpenPKG Framework Community License
   2.156 +  license-EVAL.txt ........ the OpenPKG Framework Evaluation License
   2.157 +  license-EXAMPLE.txt ..... the OpenPKG Framework Example License
   2.158 +  license-PROMO.txt ....... the OpenPKG Framework Promotion License
   2.159 +  license-RECOVERY.txt .... the OpenPKG Framework Recovery License
   2.160 +  license.lua ............. the OpenPKG Framework license processor script
   2.161 +
   2.162 +  Makefile ................ development build procedures
   2.163 +
   2.164    The Bootstrapping Procedure
   2.165    ---------------------------
   2.166  
   2.167    The complexity of this OpenPKG RPM package results from the fact that
   2.168    we force us to treat this bootstrapping package equal to every other
   2.169    regular OpenPKG RPM package. First, this implies that the packaging
   2.170 -  tool RPM is packaged with itself as an OpenPKG RPM package (means: its
   2.171 -  build procedure is a real RPM .spec file and it can be installed and
   2.172 -  upgraded through a binary or source RPM). Second, RPM is installed
   2.173 -  into the same filesystem hierarchy as all other packages. Third, RPM
   2.174 -  manages its own files. The reason for this approach should be obvious:
   2.175 -  100% consistency for the whole OpenPKG software packaging facility!
   2.176 +  tool RPM is packaged with itself as an OpenPKG RPM package -- which
   2.177 +  means that its build procedure is a real RPM .spec file and it can be
   2.178 +  installed and upgraded through a binary or source RPM. Second, RPM is
   2.179 +  installed into the same filesystem hierarchy as all other packages.
   2.180 +  Third, RPM manages its own files. The reason for this approach should
   2.181 +  be obvious: 100% consistency for the whole OpenPKG software packaging
   2.182 +  facility!
   2.183  
   2.184    The drawback is that this package requires a very tricky bootstrapping
   2.185    procedure which had cost a lot of time to figure out and establish. If
   2.186 @@ -137,17 +189,17 @@
   2.187    scripts of "openpkg.spec", there is a fresh version of the target
   2.188    filesystem hierarchy staying under a temporary "build root". The
   2.189    "openpkg.boot" script then creates a very special temporary "openpkg
   2.190 -  rpm" command which allows the installed "openpkg rpm" command inside
   2.191 -  the "build root" to work (although it is built for the final target
   2.192 -  filesystem path). Then the $RPM_BOOT variable is set and the package
   2.193 -  is _again_ build via "openpkg.spec" -- but this time with the real
   2.194 -  OpenPKG RPM. To avoid unneccessary re-compilation, the "openpkg.spec"
   2.195 -  skips "%prep", "%build" and "%install" sections if $RPM_BOOT is
   2.196 -  defined. So, on this second build phase, only the "%files" section is
   2.197 -  executed, i.e., a binary OpenPKG RPM package "openpkg-V-R.P-T.rpm"
   2.198 -  is rolled from the files in the "build root". Additionally, a source
   2.199 -  OpenPKG RPM package "openpkg-V-R.src.rpm" is rolled for consistency
   2.200 -  reasons.
   2.201 +  rpm" command which allows the installed "openpkg rpm" command
   2.202 +  inside the "build root" to work (although it is built for the
   2.203 +  final target filesystem path). Then the $OPENPKG_BOOT variable
   2.204 +  is set and the package is _again_ build via "openpkg.spec" --
   2.205 +  but this time with the real OpenPKG RPM. To avoid unneccessary
   2.206 +  re-compilation, the "openpkg.spec" skips "%prep", "%build" and
   2.207 +  "%install" sections if $OPENPKG_BOOT is defined. So, on this second
   2.208 +  build phase, only the "%files" section is effectively executed, i.e.,
   2.209 +  a binary OpenPKG RPM package "openpkg-V-R.P-T.rpm" is rolled from the
   2.210 +  files in the "build root". Additionally, a source OpenPKG RPM package
   2.211 +  "openpkg-V-R.src.rpm" is rolled for consistency reasons, too.
   2.212  
   2.213    Finally, we override the installation in the "build root"
   2.214    again by installing the now rolled binary OpenPKG RPM package
   2.215 @@ -169,14 +221,14 @@
   2.216    is packed into a "tarball", compressed, again wrapped into another
   2.217    tarball together with the uncompression tools ("bzip2" and "tar"),
   2.218    and finally wrapped into a self-extracting shell script by appending
   2.219 -  "aux.wrapbin.sh" (padded to 64KB for easier unpacking of the attached
   2.220 +  "etc.wrapbin.sh" (padded to 64KB for easier unpacking of the attached
   2.221    tarball) to its front.
   2.222  
   2.223    The result is the binary bootstrap script "openpkg-V-R.P-T.sh" which
   2.224 -  can be used to install the target hierarchy from scratch without any
   2.225 -  pre-installed OpenPKG RPM. Nevetheless, the installed target hierarchy
   2.226 -  looks _exactly_ as it would have been installed with OpenPKG RPM.
   2.227 -  If one later wants to upgrade this hierarchy one can just use the
   2.228 +  can be used to install the target hierarchy from scratch without
   2.229 +  any pre-installed OpenPKG RPM. Nevertheless, the installed target
   2.230 +  hierarchy looks _exactly_ as it would have been installed with OpenPKG
   2.231 +  RPM. If one later wants to upgrade this hierarchy one can just use the
   2.232    generated (or a newer) "openpkg-V-R.P-T.rpm".
   2.233  
   2.234    To allow one to easily repeat this from-source bootstrapping procedure
     3.1 --- a/openpkg/bash.patch	Tue Jul 31 12:12:54 2012 +0200
     3.2 +++ b/openpkg/bash.patch	Tue Jul 31 12:23:42 2012 +0200
     3.3 @@ -2,9 +2,9 @@
     3.4  line options "-v" and "-x". It is derived from Debian GNU/Linux.
     3.5  
     3.6  Index: doc/bash.1
     3.7 ---- doc/bash.1.orig	2004-07-12 17:27:08 +0200
     3.8 -+++ doc/bash.1	2004-07-27 19:47:10 +0200
     3.9 -@@ -116,6 +116,12 @@
    3.10 +--- doc/bash.1.orig	2011-01-16 21:31:39.000000000 +0100
    3.11 ++++ doc/bash.1	2011-02-21 18:56:01.000000000 +0100
    3.12 +@@ -117,6 +117,12 @@
    3.13   This option allows the positional parameters to be set
    3.14   when invoking an interactive shell.
    3.15   .TP
    3.16 @@ -23,9 +23,9 @@
    3.17  Port to HP-UX 11i and similar less smart platforms.
    3.18  
    3.19  Index: configure
    3.20 ---- configure.orig	2004-07-21 22:18:56 +0200
    3.21 -+++ configure	2004-07-27 19:47:10 +0200
    3.22 -@@ -1517,6 +1517,7 @@
    3.23 +--- configure.orig	2011-02-07 23:03:22.000000000 +0100
    3.24 ++++ configure	2011-02-21 18:56:01.000000000 +0100
    3.25 +@@ -2202,6 +2202,7 @@
    3.26   *-beos*)	opt_bash_malloc=no ;;	# they say it's suitable
    3.27   *-cygwin*)	opt_bash_malloc=no ;;	# Cygnus's CYGWIN environment
    3.28   *-opennt*|*-interix*)	opt_bash_malloc=no ;;	# Interix, now owned by Microsoft
    3.29 @@ -33,7 +33,7 @@
    3.30   esac
    3.31   
    3.32   # memory scrambling on free()
    3.33 -@@ -1662,7 +1663,7 @@
    3.34 +@@ -2270,7 +2271,7 @@
    3.35   
    3.36   else
    3.37   	MALLOC_LIB=
    3.38 @@ -43,8 +43,8 @@
    3.39   	MALLOC_DEP=
    3.40   fi
    3.41  Index: syntax.h
    3.42 ---- syntax.h.orig	2004-04-15 05:19:36 +0200
    3.43 -+++ syntax.h	2004-07-27 19:47:10 +0200
    3.44 +--- syntax.h.orig	2009-01-04 20:32:42.000000000 +0100
    3.45 ++++ syntax.h	2011-02-21 18:56:01.000000000 +0100
    3.46  @@ -21,6 +21,8 @@
    3.47   #ifndef _SYNTAX_H_
    3.48   #define _SYNTAX_H_
    3.49 @@ -60,303 +60,70 @@
    3.50  This adds the OpenPKG packaging brand.
    3.51  
    3.52  Index: version.c
    3.53 ---- version.c.orig	2003-12-19 22:34:02 +0100
    3.54 -+++ version.c	2004-07-27 19:47:10 +0200
    3.55 -@@ -77,7 +77,7 @@
    3.56 +--- version.c.orig	2011-01-28 17:32:36.000000000 +0100
    3.57 ++++ version.c	2011-02-21 18:56:01.000000000 +0100
    3.58 +@@ -83,7 +83,7 @@
    3.59   show_shell_version (extended)
    3.60        int extended;
    3.61   {
    3.62 --  printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE);
    3.63 -+  printf ("GNU bash, version %s (%s) [@l_openpkg_release@]\n", shell_version_string (), MACHTYPE);
    3.64 +-  printf (_("GNU bash, version %s (%s)\n"), shell_version_string (), MACHTYPE);
    3.65 ++  printf (_("GNU bash, version %s (%s) [@l_openpkg_release@]\n"), shell_version_string (), MACHTYPE);
    3.66     if (extended)
    3.67 -     printf (_("Copyright (C) 2005 Free Software Foundation, Inc.\n"));
    3.68 - }
    3.69 +     {
    3.70 +       printf ("%s\n", _(bash_copyright));
    3.71  
    3.72  -----------------------------------------------------------------------------
    3.73  
    3.74 -Accumulated vendor patches Bash 3.2 001-005
    3.75 +Ensure that Autoconf and friends are not run.
    3.76  
    3.77 -Generated via:
    3.78 -
    3.79 -$ gunzip <bash-3.2.tar.gz | tar xf -
    3.80 -$ pushd bash-3.2
    3.81 -$ cat bash32-[0-9]* | patch -p0 -Vt -b
    3.82 -$ shtool move -e '*.~1~' '%1.orig'
    3.83 -$ pushd /tmp
    3.84 -$ curl -O ftp://ftp.gnu.org/gnu/bison/bison-1.28.tar.gz
    3.85 -$ cd bison-1.28
    3.86 -$ ./configure --prefix=/tmp/bison
    3.87 -$ make
    3.88 -$ make install
    3.89 -$ popd
    3.90 -$ mv y.tab.c y.tab.c.orig
    3.91 -$ mv y.tab.h y.tab.h.orig
    3.92 -$ /tmp/bison/bin/bison -y -d parse.y
    3.93 -$ rm -rf /tmp/bison /tmp/bison-1.28 /tmp/bison-1.28.tar.gz
    3.94 -$ shtool subst -b.dummy \
    3.95 -  -e 's;parse\.y;/Users/chet/src/bash/src/parse.y;g' \
    3.96 -  -e 's;/tmp/bison/share/bison\.simple;/usr/share/bison.simple;g' y.tab.c
    3.97 -$ svs diff >/tmp/bash.patch
    3.98 -$ popd
    3.99 -$ rm -rf bash-3.2
   3.100 -
   3.101 -Index: parse.y
   3.102 ---- parse.y.orig	2006-09-19 22:37:21 +0200
   3.103 -+++ parse.y	2006-12-06 13:32:45 +0100
   3.104 -@@ -1029,6 +1029,7 @@
   3.105 - #define PST_CMDTOKEN	0x1000		/* command token OK - unused */
   3.106 - #define PST_COMPASSIGN	0x2000		/* parsing x=(...) compound assignment */
   3.107 - #define PST_ASSIGNOK	0x4000		/* assignment statement ok in this context */
   3.108 -+#define PST_REGEXP	0x8000		/* parsing an ERE/BRE as a single word */
   3.109 +Index: Makefile.in
   3.110 +--- Makefile.in.orig	2010-12-01 01:22:42.000000000 +0100
   3.111 ++++ Makefile.in	2011-02-21 18:56:01.000000000 +0100
   3.112 +@@ -711,7 +711,6 @@
   3.113   
   3.114 - /* Initial size to allocate for tokens, and the
   3.115 -    amount to grow them by. */
   3.116 -@@ -2591,6 +2592,9 @@
   3.117 -       return (character);
   3.118 -     }
   3.119 + # comment out for distribution
   3.120 + $(srcdir)/configure:	$(srcdir)/configure.in $(srcdir)/aclocal.m4 $(srcdir)/config.h.in
   3.121 +-	cd $(srcdir) && autoconf
   3.122   
   3.123 -+  if (parser_state & PST_REGEXP)
   3.124 -+    goto tokword;
   3.125 -+
   3.126 -   /* Shell meta-characters. */
   3.127 -   if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0))
   3.128 -     {
   3.129 -@@ -2698,6 +2702,7 @@
   3.130 -   if MBTEST(character == '-' && (last_read_token == LESS_AND || last_read_token == GREATER_AND))
   3.131 -     return (character);
   3.132 - 
   3.133 -+tokword:
   3.134 -   /* Okay, if we got this far, we have to read a word.  Read one,
   3.135 -      and then check it against the known ones. */
   3.136 -   result = read_token_word (character);
   3.137 -@@ -2735,7 +2740,7 @@
   3.138 - /* itrace("parse_matched_pair: open = %c close = %c", open, close); */
   3.139 -   count = 1;
   3.140 -   pass_next_character = backq_backslash = was_dollar = in_comment = 0;
   3.141 --  check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
   3.142 -+  check_comment = (flags & P_COMMAND) && qc != '`' && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
   3.143 - 
   3.144 -   /* RFLAGS is the set of flags we want to pass to recursive calls. */
   3.145 -   rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE);
   3.146 -@@ -3202,8 +3207,11 @@
   3.147 -       if (tok == WORD && test_binop (yylval.word->word))
   3.148 - 	op = yylval.word;
   3.149 - #if defined (COND_REGEXP)
   3.150 --      else if (tok == WORD && STREQ (yylval.word->word,"=~"))
   3.151 --	op = yylval.word;
   3.152 -+      else if (tok == WORD && STREQ (yylval.word->word, "=~"))
   3.153 -+	{
   3.154 -+	  op = yylval.word;
   3.155 -+	  parser_state |= PST_REGEXP;
   3.156 -+	}
   3.157 - #endif
   3.158 -       else if (tok == '<' || tok == '>')
   3.159 - 	op = make_word_from_token (tok);  /* ( */
   3.160 -@@ -3234,6 +3242,7 @@
   3.161 - 
   3.162 -       /* rhs */
   3.163 -       tok = read_token (READ);
   3.164 -+      parser_state &= ~PST_REGEXP;
   3.165 -       if (tok == WORD)
   3.166 - 	{
   3.167 - 	  tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL);
   3.168 -@@ -3419,9 +3428,34 @@
   3.169 - 	  goto next_character;
   3.170 - 	}
   3.171 - 
   3.172 -+#ifdef COND_REGEXP
   3.173 -+      /* When parsing a regexp as a single word inside a conditional command,
   3.174 -+	 we need to special-case characters special to both the shell and
   3.175 -+	 regular expressions.  Right now, that is only '(' and '|'. */ /*)*/
   3.176 -+      if MBTEST((parser_state & PST_REGEXP) && (character == '(' || character == '|'))		/*)*/
   3.177 -+        {
   3.178 -+          if (character == '|')
   3.179 -+            goto got_character;
   3.180 -+
   3.181 -+	  push_delimiter (dstack, character);
   3.182 -+	  ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
   3.183 -+	  pop_delimiter (dstack);
   3.184 -+	  if (ttok == &matched_pair_error)
   3.185 -+	    return -1;		/* Bail immediately. */
   3.186 -+	  RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2,
   3.187 -+				  token_buffer_size, TOKEN_DEFAULT_GROW_SIZE);
   3.188 -+	  token[token_index++] = character;
   3.189 -+	  strcpy (token + token_index, ttok);
   3.190 -+	  token_index += ttoklen;
   3.191 -+	  FREE (ttok);
   3.192 -+	  dollar_present = all_digit_token = 0;
   3.193 -+	  goto next_character;
   3.194 -+        }
   3.195 -+#endif /* COND_REGEXP */
   3.196 -+
   3.197 - #ifdef EXTENDED_GLOB
   3.198 -       /* Parse a ksh-style extended pattern matching specification. */
   3.199 --      if (extended_glob && PATTERN_CHAR (character))
   3.200 -+      if MBTEST(extended_glob && PATTERN_CHAR (character))
   3.201 - 	{
   3.202 - 	  peek_char = shell_getc (1);
   3.203 - 	  if MBTEST(peek_char == '(')		/* ) */
   3.204 -Index: patchlevel.h
   3.205 ---- patchlevel.h.orig	2006-04-13 14:31:04 +0200
   3.206 -+++ patchlevel.h	2006-12-06 13:32:45 +0100
   3.207 -@@ -25,6 +25,6 @@
   3.208 -    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
   3.209 -    looks for to find the patch level (for the sccs version string). */
   3.210 - 
   3.211 --#define PATCHLEVEL 0
   3.212 -+#define PATCHLEVEL 5
   3.213 - 
   3.214 - #endif /* _PATCHLEVEL_H_ */
   3.215 -Index: subst.c
   3.216 ---- subst.c.orig	2006-09-19 14:35:09 +0200
   3.217 -+++ subst.c	2006-12-06 13:32:45 +0100
   3.218 -@@ -5707,6 +5707,11 @@
   3.219 -   vtype &= ~VT_STARSUB;
   3.220 - 
   3.221 -   mflags = 0;
   3.222 -+  if (patsub && *patsub == '/')
   3.223 -+    {
   3.224 -+      mflags |= MATCH_GLOBREP;
   3.225 -+      patsub++;
   3.226 -+    }
   3.227 - 
   3.228 -   /* Malloc this because expand_string_if_necessary or one of the expansion
   3.229 -      functions in its call chain may free it on a substitution error. */
   3.230 -@@ -5741,13 +5746,12 @@
   3.231 -     }
   3.232 - 
   3.233 -   /* ksh93 doesn't allow the match specifier to be a part of the expanded
   3.234 --     pattern.  This is an extension. */
   3.235 -+     pattern.  This is an extension.  Make sure we don't anchor the pattern
   3.236 -+     at the beginning or end of the string if we're doing global replacement,
   3.237 -+     though. */
   3.238 -   p = pat;
   3.239 --  if (pat && pat[0] == '/')
   3.240 --    {
   3.241 --      mflags |= MATCH_GLOBREP|MATCH_ANY;
   3.242 --      p++;
   3.243 --    }
   3.244 -+  if (mflags & MATCH_GLOBREP)
   3.245 -+    mflags |= MATCH_ANY;
   3.246 -   else if (pat && pat[0] == '#')
   3.247 -     {
   3.248 -       mflags |= MATCH_BEG;
   3.249 -Index: y.tab.c
   3.250 ---- y.tab.c.orig	2006-09-25 14:15:16 +0200
   3.251 -+++ y.tab.c	2006-12-06 13:39:36 +0100
   3.252 -@@ -2359,6 +2359,7 @@
   3.253 - #define PST_CMDTOKEN	0x1000		/* command token OK - unused */
   3.254 - #define PST_COMPASSIGN	0x2000		/* parsing x=(...) compound assignment */
   3.255 - #define PST_ASSIGNOK	0x4000		/* assignment statement ok in this context */
   3.256 -+#define PST_REGEXP	0x8000		/* parsing an ERE/BRE as a single word */
   3.257 - 
   3.258 - /* Initial size to allocate for tokens, and the
   3.259 -    amount to grow them by. */
   3.260 -@@ -3921,6 +3922,9 @@
   3.261 -       return (character);
   3.262 -     }
   3.263 - 
   3.264 -+  if (parser_state & PST_REGEXP)
   3.265 -+    goto tokword;
   3.266 -+
   3.267 -   /* Shell meta-characters. */
   3.268 -   if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0))
   3.269 -     {
   3.270 -@@ -4028,6 +4032,7 @@
   3.271 -   if MBTEST(character == '-' && (last_read_token == LESS_AND || last_read_token == GREATER_AND))
   3.272 -     return (character);
   3.273 - 
   3.274 -+tokword:
   3.275 -   /* Okay, if we got this far, we have to read a word.  Read one,
   3.276 -      and then check it against the known ones. */
   3.277 -   result = read_token_word (character);
   3.278 -@@ -4065,7 +4070,7 @@
   3.279 - /* itrace("parse_matched_pair: open = %c close = %c", open, close); */
   3.280 -   count = 1;
   3.281 -   pass_next_character = backq_backslash = was_dollar = in_comment = 0;
   3.282 --  check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
   3.283 -+  check_comment = (flags & P_COMMAND) && qc != '`' && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
   3.284 - 
   3.285 -   /* RFLAGS is the set of flags we want to pass to recursive calls. */
   3.286 -   rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE);
   3.287 -@@ -4532,8 +4537,11 @@
   3.288 -       if (tok == WORD && test_binop (yylval.word->word))
   3.289 - 	op = yylval.word;
   3.290 - #if defined (COND_REGEXP)
   3.291 --      else if (tok == WORD && STREQ (yylval.word->word,"=~"))
   3.292 --	op = yylval.word;
   3.293 -+      else if (tok == WORD && STREQ (yylval.word->word, "=~"))
   3.294 -+	{
   3.295 -+	  op = yylval.word;
   3.296 -+	  parser_state |= PST_REGEXP;
   3.297 -+	}
   3.298 - #endif
   3.299 -       else if (tok == '<' || tok == '>')
   3.300 - 	op = make_word_from_token (tok);  /* ( */
   3.301 -@@ -4564,6 +4572,7 @@
   3.302 - 
   3.303 -       /* rhs */
   3.304 -       tok = read_token (READ);
   3.305 -+      parser_state &= ~PST_REGEXP;
   3.306 -       if (tok == WORD)
   3.307 - 	{
   3.308 - 	  tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL);
   3.309 -@@ -4749,9 +4758,34 @@
   3.310 - 	  goto next_character;
   3.311 - 	}
   3.312 - 
   3.313 -+#ifdef COND_REGEXP
   3.314 -+      /* When parsing a regexp as a single word inside a conditional command,
   3.315 -+	 we need to special-case characters special to both the shell and
   3.316 -+	 regular expressions.  Right now, that is only '(' and '|'. */ /*)*/
   3.317 -+      if MBTEST((parser_state & PST_REGEXP) && (character == '(' || character == '|'))		/*)*/
   3.318 -+        {
   3.319 -+          if (character == '|')
   3.320 -+            goto got_character;
   3.321 -+
   3.322 -+	  push_delimiter (dstack, character);
   3.323 -+	  ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
   3.324 -+	  pop_delimiter (dstack);
   3.325 -+	  if (ttok == &matched_pair_error)
   3.326 -+	    return -1;		/* Bail immediately. */
   3.327 -+	  RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2,
   3.328 -+				  token_buffer_size, TOKEN_DEFAULT_GROW_SIZE);
   3.329 -+	  token[token_index++] = character;
   3.330 -+	  strcpy (token + token_index, ttok);
   3.331 -+	  token_index += ttoklen;
   3.332 -+	  FREE (ttok);
   3.333 -+	  dollar_present = all_digit_token = 0;
   3.334 -+	  goto next_character;
   3.335 -+        }
   3.336 -+#endif /* COND_REGEXP */
   3.337 -+
   3.338 - #ifdef EXTENDED_GLOB
   3.339 -       /* Parse a ksh-style extended pattern matching specification. */
   3.340 --      if (extended_glob && PATTERN_CHAR (character))
   3.341 -+      if MBTEST(extended_glob && PATTERN_CHAR (character))
   3.342 - 	{
   3.343 - 	  peek_char = shell_getc (1);
   3.344 - 	  if MBTEST(peek_char == '(')		/* ) */
   3.345 + # for chet
   3.346 + reconfig: force
   3.347  
   3.348  -----------------------------------------------------------------------------
   3.349  
   3.350 -Do not require autoconf. Fixes build on Solaris 10 8/07 u4 on sparc64
   3.351 +Fix Bash getcwd(3) run-time issue seen on Solaris where size argument
   3.352 +of 0 does not malloc buffer as expected by Bash code.
   3.353  
   3.354 -Index: Makefile.in
   3.355 ---- Makefile.in.orig	2006-08-17 20:03:35 +0200
   3.356 -+++ Makefile.in	2007-10-15 13:00:34 +0200
   3.357 -@@ -682,13 +682,9 @@
   3.358 - stamp-h:	config.status $(srcdir)/config.h.in $(srcdir)/config-top.h $(srcdir)/config-bot.h
   3.359 - 	CONFIG_FILES= CONFIG_HEADERS=config.h $(SHELL) ./config.status
   3.360 +Index: builtins/common.c
   3.361 +--- builtins/common.c.orig	2011-01-05 23:51:26.000000000 +0100
   3.362 ++++ builtins/common.c	2011-02-21 18:56:01.000000000 +0100
   3.363 +@@ -553,10 +553,11 @@
   3.364   
   3.365 --config.status:	$(srcdir)/configure
   3.366 -+config.status:
   3.367 - 	$(SHELL) ./config.status --recheck
   3.368 +   if (the_current_working_directory == 0)
   3.369 +     {
   3.370 ++      char *t = xmalloc(PATH_MAX);
   3.371 + #if defined (GETCWD_BROKEN)
   3.372 +-      the_current_working_directory = getcwd (0, PATH_MAX);
   3.373 ++      the_current_working_directory = getcwd (t, PATH_MAX);
   3.374 + #else
   3.375 +-      the_current_working_directory = getcwd (0, 0);
   3.376 ++      the_current_working_directory = getcwd (t, PATH_MAX);
   3.377 + #endif
   3.378 +       if (the_current_working_directory == 0)
   3.379 + 	{
   3.380 +
   3.381 +-----------------------------------------------------------------------------
   3.382 +
   3.383 +Fix building under Linux.
   3.384 +
   3.385 +Index: externs.h
   3.386 +--- externs.h.orig	2010-11-30 02:59:20.000000000 +0100
   3.387 ++++ externs.h	2011-02-21 18:56:01.000000000 +0100
   3.388 +@@ -25,6 +25,7 @@
   3.389 + #  define _EXTERNS_H_
   3.390   
   3.391 --# comment out for distribution
   3.392 --$(srcdir)/configure:	$(srcdir)/configure.in $(srcdir)/aclocal.m4 $(srcdir)/config.h.in
   3.393 --	cd $(srcdir) && autoconf
   3.394 --
   3.395 - # for chet
   3.396 - reconfig: force
   3.397 - 	sh $(srcdir)/configure -C
   3.398 + #include "stdc.h"
   3.399 ++#include <stdio.h>
   3.400 + 
   3.401 + /* Functions from expr.c. */
   3.402 + extern intmax_t evalexp __P((char *, int *));
   3.403 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/openpkg/bash.patch.vendor	Tue Jul 31 12:23:42 2012 +0200
     4.3 @@ -0,0 +1,1507 @@
     4.4 +Index: assoc.c
     4.5 +--- assoc.c.orig	2009-08-06 02:19:40.000000000 +0200
     4.6 ++++ assoc.c	2012-06-27 10:31:02.000000000 +0200
     4.7 +@@ -77,6 +77,11 @@
     4.8 +   b = hash_search (key, hash, HASH_CREATE);
     4.9 +   if (b == 0)
    4.10 +     return -1;
    4.11 ++  /* If we are overwriting an existing element's value, we're not going to
    4.12 ++     use the key.  Nothing in the array assignment code path frees the key
    4.13 ++     string, so we can free it here to avoid a memory leak. */
    4.14 ++  if (b->key != key)
    4.15 ++    free (key);
    4.16 +   FREE (b->data);
    4.17 +   b->data = value ? savestring (value) : (char *)0;
    4.18 +   return (0);
    4.19 +Index: bashline.c
    4.20 +--- bashline.c.orig	2011-01-16 21:32:47.000000000 +0100
    4.21 ++++ bashline.c	2012-06-27 10:31:03.000000000 +0200
    4.22 +@@ -121,6 +121,9 @@
    4.23 + static int filename_completion_ignore __P((char **));
    4.24 + static int bash_push_line __P((void));
    4.25 + 
    4.26 ++static rl_icppfunc_t *save_directory_hook __P((void));
    4.27 ++static void reset_directory_hook __P((rl_icppfunc_t *));
    4.28 ++
    4.29 + static void cleanup_expansion_error __P((void));
    4.30 + static void maybe_make_readline_line __P((char *));
    4.31 + static void set_up_new_line __P((char *));
    4.32 +@@ -243,10 +246,17 @@
    4.33 + /* Perform spelling correction on directory names during word completion */
    4.34 + int dircomplete_spelling = 0;
    4.35 + 
    4.36 ++/* Expand directory names during word/filename completion. */
    4.37 ++int dircomplete_expand = 0;
    4.38 ++int dircomplete_expand_relpath = 0;
    4.39 ++
    4.40 + static char *bash_completer_word_break_characters = " \t\n\"'@><=;|&(:";
    4.41 + static char *bash_nohostname_word_break_characters = " \t\n\"'><=;|&(:";
    4.42 + /* )) */
    4.43 + 
    4.44 ++static const char *default_filename_quote_characters = " \t\n\\\"'@<>=;|&()#$`?*[!:{~";	/*}*/
    4.45 ++static char *custom_filename_quote_characters = 0;
    4.46 ++
    4.47 + static rl_hook_func_t *old_rl_startup_hook = (rl_hook_func_t *)NULL;
    4.48 + 
    4.49 + static int dot_in_path = 0;
    4.50 +@@ -501,7 +511,7 @@
    4.51 + 
    4.52 +   /* Tell the completer that we might want to follow symbolic links or
    4.53 +      do other expansion on directory names. */
    4.54 +-  rl_directory_rewrite_hook = bash_directory_completion_hook;
    4.55 ++  set_directory_hook ();
    4.56 + 
    4.57 +   rl_filename_rewrite_hook = bash_filename_rewrite_hook;
    4.58 + 
    4.59 +@@ -529,7 +539,7 @@
    4.60 +   enable_hostname_completion (perform_hostname_completion);
    4.61 + 
    4.62 +   /* characters that need to be quoted when appearing in filenames. */
    4.63 +-  rl_filename_quote_characters = " \t\n\\\"'@<>=;|&()#$`?*[!:{~";	/*}*/
    4.64 ++  rl_filename_quote_characters = default_filename_quote_characters;
    4.65 + 
    4.66 +   rl_filename_quoting_function = bash_quote_filename;
    4.67 +   rl_filename_dequoting_function = bash_dequote_filename;
    4.68 +@@ -564,8 +574,10 @@
    4.69 +   tilde_initialize ();
    4.70 +   rl_attempted_completion_function = attempt_shell_completion;
    4.71 +   rl_completion_entry_function = NULL;
    4.72 +-  rl_directory_rewrite_hook = bash_directory_completion_hook;
    4.73 +   rl_ignore_some_completions_function = filename_completion_ignore;
    4.74 ++  rl_filename_quote_characters = default_filename_quote_characters;
    4.75 ++
    4.76 ++  set_directory_hook ();
    4.77 + }
    4.78 + 
    4.79 + /* Contains the line to push into readline. */
    4.80 +@@ -1279,6 +1291,9 @@
    4.81 +   matches = (char **)NULL;
    4.82 +   rl_ignore_some_completions_function = filename_completion_ignore;
    4.83 + 
    4.84 ++  rl_filename_quote_characters = default_filename_quote_characters;
    4.85 ++  set_directory_hook ();
    4.86 ++
    4.87 +   /* Determine if this could be a command word.  It is if it appears at
    4.88 +      the start of the line (ignoring preceding whitespace), or if it
    4.89 +      appears after a character that separates commands.  It cannot be a
    4.90 +@@ -1591,6 +1606,12 @@
    4.91 + 	    }
    4.92 + 	  else
    4.93 + 	    {
    4.94 ++	     if (dircomplete_expand && dot_or_dotdot (filename_hint))
    4.95 ++		{
    4.96 ++		  dircomplete_expand = 0;
    4.97 ++		  set_directory_hook ();
    4.98 ++		  dircomplete_expand = 1;
    4.99 ++		}
   4.100 + 	      mapping_over = 4;
   4.101 + 	      goto inner;
   4.102 + 	    }
   4.103 +@@ -1791,6 +1812,9 @@
   4.104 + 
   4.105 +  inner:
   4.106 +   val = rl_filename_completion_function (filename_hint, istate);
   4.107 ++  if (mapping_over == 4 && dircomplete_expand)
   4.108 ++    set_directory_hook ();
   4.109 ++
   4.110 +   istate = 1;
   4.111 + 
   4.112 +   if (val == 0)
   4.113 +@@ -2693,6 +2717,52 @@
   4.114 +   return conv;
   4.115 + }
   4.116 + 
   4.117 ++/* Functions to save and restore the appropriate directory hook */
   4.118 ++/* This is not static so the shopt code can call it */
   4.119 ++void
   4.120 ++set_directory_hook ()
   4.121 ++{
   4.122 ++  if (dircomplete_expand)
   4.123 ++    {
   4.124 ++      rl_directory_completion_hook = bash_directory_completion_hook;
   4.125 ++      rl_directory_rewrite_hook = (rl_icppfunc_t *)0;
   4.126 ++    }
   4.127 ++  else
   4.128 ++    {
   4.129 ++      rl_directory_rewrite_hook = bash_directory_completion_hook;
   4.130 ++      rl_directory_completion_hook = (rl_icppfunc_t *)0;
   4.131 ++    }
   4.132 ++}
   4.133 ++
   4.134 ++static rl_icppfunc_t *
   4.135 ++save_directory_hook ()
   4.136 ++{
   4.137 ++  rl_icppfunc_t *ret;
   4.138 ++
   4.139 ++  if (dircomplete_expand)
   4.140 ++    {
   4.141 ++      ret = rl_directory_completion_hook;
   4.142 ++      rl_directory_completion_hook = (rl_icppfunc_t *)NULL;
   4.143 ++    }
   4.144 ++  else
   4.145 ++    {
   4.146 ++      ret = rl_directory_rewrite_hook;
   4.147 ++      rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL;
   4.148 ++    }
   4.149 ++
   4.150 ++  return ret;
   4.151 ++}
   4.152 ++
   4.153 ++static void
   4.154 ++restore_directory_hook (hookf)
   4.155 ++     rl_icppfunc_t *hookf;
   4.156 ++{
   4.157 ++  if (dircomplete_expand)
   4.158 ++    rl_directory_completion_hook = hookf;
   4.159 ++  else
   4.160 ++    rl_directory_rewrite_hook = hookf;
   4.161 ++}
   4.162 ++
   4.163 + /* Handle symbolic link references and other directory name
   4.164 +    expansions while hacking completion.  This should return 1 if it modifies
   4.165 +    the DIRNAME argument, 0 otherwise.  It should make sure not to modify
   4.166 +@@ -2702,20 +2772,31 @@
   4.167 +      char **dirname;
   4.168 + {
   4.169 +   char *local_dirname, *new_dirname, *t;
   4.170 +-  int return_value, should_expand_dirname;
   4.171 ++  int return_value, should_expand_dirname, nextch, closer;
   4.172 +   WORD_LIST *wl;
   4.173 +   struct stat sb;
   4.174 + 
   4.175 +-  return_value = should_expand_dirname = 0;
   4.176 ++  return_value = should_expand_dirname = nextch = closer = 0;
   4.177 +   local_dirname = *dirname;
   4.178 + 
   4.179 +-  if (mbschr (local_dirname, '$'))
   4.180 +-    should_expand_dirname = 1;
   4.181 ++  if (t = mbschr (local_dirname, '$'))
   4.182 ++    {
   4.183 ++      should_expand_dirname = '$';
   4.184 ++      nextch = t[1];
   4.185 ++      /* Deliberately does not handle the deprecated $[...] arithmetic
   4.186 ++	 expansion syntax */
   4.187 ++      if (nextch == '(')
   4.188 ++	closer = ')';
   4.189 ++      else if (nextch == '{')
   4.190 ++	closer = '}';
   4.191 ++      else
   4.192 ++	nextch = 0;
   4.193 ++    }
   4.194 +   else
   4.195 +     {
   4.196 +       t = mbschr (local_dirname, '`');
   4.197 +       if (t && unclosed_pair (local_dirname, strlen (local_dirname), "`") == 0)
   4.198 +-	should_expand_dirname = 1;
   4.199 ++	should_expand_dirname = '`';
   4.200 +     }
   4.201 + 
   4.202 + #if defined (HAVE_LSTAT)
   4.203 +@@ -2739,6 +2820,23 @@
   4.204 + 	  free (new_dirname);
   4.205 + 	  dispose_words (wl);
   4.206 + 	  local_dirname = *dirname;
   4.207 ++	  /* XXX - change rl_filename_quote_characters here based on
   4.208 ++	     should_expand_dirname/nextch/closer.  This is the only place
   4.209 ++	     custom_filename_quote_characters is modified. */
   4.210 ++	  if (rl_filename_quote_characters && *rl_filename_quote_characters)
   4.211 ++	    {
   4.212 ++	      int i, j, c;
   4.213 ++	      i = strlen (default_filename_quote_characters);
   4.214 ++	      custom_filename_quote_characters = xrealloc (custom_filename_quote_characters, i+1);
   4.215 ++	      for (i = j = 0; c = default_filename_quote_characters[i]; i++)
   4.216 ++		{
   4.217 ++		  if (c == should_expand_dirname || c == nextch || c == closer)
   4.218 ++		    continue;
   4.219 ++		  custom_filename_quote_characters[j++] = c;
   4.220 ++		}
   4.221 ++	      custom_filename_quote_characters[j] = '\0';
   4.222 ++	      rl_filename_quote_characters = custom_filename_quote_characters;
   4.223 ++	    }
   4.224 + 	}
   4.225 +       else
   4.226 + 	{
   4.227 +@@ -2758,11 +2856,31 @@
   4.228 +       local_dirname = *dirname = new_dirname;
   4.229 +     }
   4.230 + 
   4.231 ++  /* no_symbolic_links == 0 -> use (default) logical view of the file system.
   4.232 ++     local_dirname[0] == '.' && local_dirname[1] == '/' means files in the
   4.233 ++     current directory (./).
   4.234 ++     local_dirname[0] == '.' && local_dirname[1] == 0 means relative pathnames
   4.235 ++     in the current directory (e.g., lib/sh).
   4.236 ++     XXX - should we do spelling correction on these? */
   4.237 ++
   4.238 ++  /* This is test as it was in bash-4.2: skip relative pathnames in current
   4.239 ++     directory.  Change test to
   4.240 ++      (local_dirname[0] != '.' || (local_dirname[1] && local_dirname[1] != '/'))
   4.241 ++     if we want to skip paths beginning with ./ also. */
   4.242 +   if (no_symbolic_links == 0 && (local_dirname[0] != '.' || local_dirname[1]))
   4.243 +     {
   4.244 +       char *temp1, *temp2;
   4.245 +       int len1, len2;
   4.246 + 
   4.247 ++      /* If we have a relative path
   4.248 ++      		(local_dirname[0] != '/' && local_dirname[0] != '.')
   4.249 ++	 that is canonical after appending it to the current directory, then
   4.250 ++	 	temp1 = temp2+'/'
   4.251 ++	 That is,
   4.252 ++	 	strcmp (temp1, temp2) == 0
   4.253 ++	 after adding a slash to temp2 below.  It should be safe to not
   4.254 ++	 change those.
   4.255 ++      */
   4.256 +       t = get_working_directory ("symlink-hook");
   4.257 +       temp1 = make_absolute (local_dirname, t);
   4.258 +       free (t);
   4.259 +@@ -2797,7 +2915,15 @@
   4.260 + 	      temp2[len2 + 1] = '\0';
   4.261 + 	    }
   4.262 + 	}
   4.263 +-      return_value |= STREQ (local_dirname, temp2) == 0;
   4.264 ++
   4.265 ++      /* dircomplete_expand_relpath == 0 means we want to leave relative
   4.266 ++	 pathnames that are unchanged by canonicalization alone.
   4.267 ++	 *local_dirname != '/' && *local_dirname != '.' == relative pathname
   4.268 ++	 (consistent with general.c:absolute_pathname())
   4.269 ++	 temp1 == temp2 (after appending a slash to temp2) means the pathname
   4.270 ++	 is not changed by canonicalization as described above. */
   4.271 ++      if (dircomplete_expand_relpath || ((local_dirname[0] != '/' && local_dirname[0] != '.') && STREQ (temp1, temp2) == 0))
   4.272 ++	return_value |= STREQ (local_dirname, temp2) == 0;
   4.273 +       free (local_dirname);
   4.274 +       *dirname = temp2;
   4.275 +       free (temp1);
   4.276 +@@ -3002,12 +3128,13 @@
   4.277 + 
   4.278 +   orig_func = rl_completion_entry_function;
   4.279 +   orig_attempt_func = rl_attempted_completion_function;
   4.280 +-  orig_dir_func = rl_directory_rewrite_hook;
   4.281 +   orig_ignore_func = rl_ignore_some_completions_function;
   4.282 +   orig_rl_completer_word_break_characters = rl_completer_word_break_characters;
   4.283 ++
   4.284 ++  orig_dir_func = save_directory_hook ();
   4.285 ++
   4.286 +   rl_completion_entry_function = rl_filename_completion_function;
   4.287 +   rl_attempted_completion_function = (rl_completion_func_t *)NULL;
   4.288 +-  rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL;
   4.289 +   rl_ignore_some_completions_function = filename_completion_ignore;
   4.290 +   rl_completer_word_break_characters = " \t\n\"\'";
   4.291 + 
   4.292 +@@ -3015,10 +3142,11 @@
   4.293 + 
   4.294 +   rl_completion_entry_function = orig_func;
   4.295 +   rl_attempted_completion_function = orig_attempt_func;
   4.296 +-  rl_directory_rewrite_hook = orig_dir_func;
   4.297 +   rl_ignore_some_completions_function = orig_ignore_func;
   4.298 +   rl_completer_word_break_characters = orig_rl_completer_word_break_characters;
   4.299 + 
   4.300 ++  restore_directory_hook (orig_dir_func);
   4.301 ++
   4.302 +   return r;
   4.303 + }
   4.304 + 
   4.305 +Index: bashline.h
   4.306 +--- bashline.h.orig	2009-01-04 20:32:22.000000000 +0100
   4.307 ++++ bashline.h	2012-06-27 10:31:03.000000000 +0200
   4.308 +@@ -33,10 +33,15 @@
   4.309 + extern void bashline_reinitialize __P((void));
   4.310 + extern int bash_re_edit __P((char *));
   4.311 + 
   4.312 ++extern void bashline_set_event_hook __P((void));
   4.313 ++extern void bashline_reset_event_hook __P((void));
   4.314 ++
   4.315 + extern int bind_keyseq_to_unix_command __P((char *));
   4.316 + 
   4.317 + extern char **bash_default_completion __P((const char *, int, int, int, int));
   4.318 + 
   4.319 ++void set_directory_hook __P((void));
   4.320 ++
   4.321 + /* Used by programmable completion code. */
   4.322 + extern char *command_word_completion_function __P((const char *, int));
   4.323 + extern char *bash_groupname_completion_function __P((const char *, int));
   4.324 +Index: builtins/declare.def
   4.325 +--- builtins/declare.def.orig	2010-05-31 00:25:21.000000000 +0200
   4.326 ++++ builtins/declare.def	2012-06-27 10:31:02.000000000 +0200
   4.327 +@@ -513,6 +513,11 @@
   4.328 + 	      *subscript_start = '[';	/* ] */
   4.329 + 	      var = assign_array_element (name, value, 0);	/* XXX - not aflags */
   4.330 + 	      *subscript_start = '\0';
   4.331 ++	      if (var == 0)	/* some kind of assignment error */
   4.332 ++		{
   4.333 ++		  assign_error++;
   4.334 ++		  NEXT_VARIABLE ();
   4.335 ++		}
   4.336 + 	    }
   4.337 + 	  else if (simple_array_assign)
   4.338 + 	    {
   4.339 +Index: builtins/fc.def
   4.340 +--- builtins/fc.def.orig	2010-05-31 00:25:38.000000000 +0200
   4.341 ++++ builtins/fc.def	2012-06-27 10:31:02.000000000 +0200
   4.342 +@@ -304,7 +304,7 @@
   4.343 +   last_hist = i - rh - hist_last_line_added;
   4.344 + 
   4.345 +   /* XXX */
   4.346 +-  if (saved_command_line_count > 0 && i == last_hist && hlist[last_hist] == 0)
   4.347 ++  if (i == last_hist && hlist[last_hist] == 0)
   4.348 +     while (last_hist >= 0 && hlist[last_hist] == 0)
   4.349 +       last_hist--;
   4.350 +   if (last_hist < 0)
   4.351 +@@ -475,7 +475,7 @@
   4.352 +      HIST_ENTRY **hlist;
   4.353 + {
   4.354 +   int sign, n, clen, rh;
   4.355 +-  register int i, j;
   4.356 ++  register int i, j, last_hist;
   4.357 +   register char *s;
   4.358 + 
   4.359 +   sign = 1;
   4.360 +@@ -495,7 +495,15 @@
   4.361 +      has been enabled (interactive or not) should use it in the last_hist
   4.362 +      calculation as if it were on. */
   4.363 +   rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
   4.364 +-  i -= rh + hist_last_line_added;
   4.365 ++  last_hist = i - rh - hist_last_line_added;
   4.366 ++
   4.367 ++  if (i == last_hist && hlist[last_hist] == 0)
   4.368 ++    while (last_hist >= 0 && hlist[last_hist] == 0)
   4.369 ++      last_hist--;
   4.370 ++  if (last_hist < 0)
   4.371 ++    return (-1);
   4.372 ++
   4.373 ++  i = last_hist;
   4.374 + 
   4.375 +   /* No specification defaults to most recent command. */
   4.376 +   if (command == NULL)
   4.377 +Index: builtins/printf.def
   4.378 +--- builtins/printf.def.orig	2010-11-23 16:02:55.000000000 +0100
   4.379 ++++ builtins/printf.def	2012-06-27 10:31:02.000000000 +0200
   4.380 +@@ -255,6 +255,8 @@
   4.381 + #endif
   4.382 + 	    {
   4.383 + 	      vflag = 1;
   4.384 ++	      if (vbsize == 0)
   4.385 ++		vbuf = xmalloc (vbsize = 16);
   4.386 + 	      vblen = 0;
   4.387 + 	      if (vbuf)
   4.388 + 		vbuf[0] = 0;
   4.389 +@@ -465,6 +467,9 @@
   4.390 + 		  secs = shell_start_time;	/* roughly $SECONDS */
   4.391 + 		else
   4.392 + 		  secs = arg;
   4.393 ++#if defined (HAVE_TZSET)
   4.394 ++		sv_tz ("TZ");		/* XXX -- just make sure */
   4.395 ++#endif
   4.396 + 		tm = localtime (&secs);
   4.397 + 		n = strftime (timebuf, sizeof (timebuf), timefmt, tm);
   4.398 + 		free (timefmt);
   4.399 +Index: builtins/read.def
   4.400 +--- builtins/read.def.orig	2011-01-04 17:43:36.000000000 +0100
   4.401 ++++ builtins/read.def	2012-06-27 10:31:02.000000000 +0200
   4.402 +@@ -642,6 +642,12 @@
   4.403 + 	  xfree (input_string);
   4.404 + 	  return EXECUTION_FAILURE;	/* readonly or noassign */
   4.405 + 	}
   4.406 ++      if (assoc_p (var))
   4.407 ++	{
   4.408 ++          builtin_error (_("%s: cannot convert associative to indexed array"), arrayname);
   4.409 ++	  xfree (input_string);
   4.410 ++	  return EXECUTION_FAILURE;	/* existing associative array */
   4.411 ++	}
   4.412 +       array_flush (array_cell (var));
   4.413 + 
   4.414 +       alist = list_string (input_string, ifs_chars, 0);
   4.415 +@@ -731,7 +737,7 @@
   4.416 + 	      xfree (t1);
   4.417 + 	    }
   4.418 + 	  else
   4.419 +-	    var = bind_read_variable (varname, t);
   4.420 ++	    var = bind_read_variable (varname, t ? t : "");
   4.421 + 	}
   4.422 +       else
   4.423 + 	{
   4.424 +@@ -792,7 +798,7 @@
   4.425 +       xfree (t);
   4.426 +     }
   4.427 +   else
   4.428 +-    var = bind_read_variable (list->word->word, input_string);
   4.429 ++    var = bind_read_variable (list->word->word, input_string ? input_string : "");
   4.430 + 
   4.431 +   if (var)
   4.432 +     {
   4.433 +Index: builtins/shopt.def
   4.434 +--- builtins/shopt.def.orig	2010-07-03 04:42:44.000000000 +0200
   4.435 ++++ builtins/shopt.def	2012-06-27 10:31:03.000000000 +0200
   4.436 +@@ -61,6 +61,10 @@
   4.437 + #include "common.h"
   4.438 + #include "bashgetopt.h"
   4.439 + 
   4.440 ++#if defined (READLINE)
   4.441 ++#  include "../bashline.h"
   4.442 ++#endif
   4.443 ++
   4.444 + #if defined (HISTORY)
   4.445 + #  include "../bashhist.h"
   4.446 + #endif
   4.447 +@@ -94,7 +98,7 @@
   4.448 + extern int hist_verify, history_reediting, perform_hostname_completion;
   4.449 + extern int no_empty_command_completion;
   4.450 + extern int force_fignore;
   4.451 +-extern int dircomplete_spelling;
   4.452 ++extern int dircomplete_spelling, dircomplete_expand;
   4.453 + 
   4.454 + extern int enable_hostname_completion __P((int));
   4.455 + #endif
   4.456 +@@ -121,6 +125,10 @@
   4.457 + static int set_restricted_shell __P((char *, int));
   4.458 + #endif
   4.459 + 
   4.460 ++#if defined (READLINE)
   4.461 ++static int shopt_set_complete_direxpand __P((char *, int));
   4.462 ++#endif
   4.463 ++
   4.464 + static int shopt_login_shell;
   4.465 + static int shopt_compat31;
   4.466 + static int shopt_compat32;
   4.467 +@@ -150,6 +158,7 @@
   4.468 +   { "compat40", &shopt_compat40, set_compatibility_level },
   4.469 +   { "compat41", &shopt_compat41, set_compatibility_level },
   4.470 + #if defined (READLINE)
   4.471 ++  { "direxpand", &dircomplete_expand, shopt_set_complete_direxpand },
   4.472 +   { "dirspell", &dircomplete_spelling, (shopt_set_func_t *)NULL },
   4.473 + #endif
   4.474 +   { "dotglob", &glob_dot_filenames, (shopt_set_func_t *)NULL },
   4.475 +@@ -535,6 +544,17 @@
   4.476 +   return 0;
   4.477 + }
   4.478 + 
   4.479 ++#if defined (READLINE)
   4.480 ++static int
   4.481 ++shopt_set_complete_direxpand (option_name, mode)
   4.482 ++     char *option_name;
   4.483 ++     int mode;
   4.484 ++{
   4.485 ++  set_directory_hook ();
   4.486 ++  return 0;
   4.487 ++}
   4.488 ++#endif
   4.489 ++
   4.490 + #if defined (RESTRICTED_SHELL)
   4.491 + /* Don't allow the value of restricted_shell to be modified. */
   4.492 + 
   4.493 +Index: command.h
   4.494 +--- command.h.orig	2010-08-03 01:36:51.000000000 +0200
   4.495 ++++ command.h	2012-06-27 10:31:02.000000000 +0200
   4.496 +@@ -97,6 +97,7 @@
   4.497 + #define W_HASCTLESC	0x200000	/* word contains literal CTLESC characters */
   4.498 + #define W_ASSIGNASSOC	0x400000	/* word looks like associative array assignment */
   4.499 + #define W_ARRAYIND	0x800000	/* word is an array index being expanded */
   4.500 ++#define W_ASSNGLOBAL	0x1000000	/* word is a global assignment to declare (declare/typeset -g) */
   4.501 + 
   4.502 + /* Possible values for subshell_environment */
   4.503 + #define SUBSHELL_ASYNC	0x01	/* subshell caused by `command &' */
   4.504 +Index: doc/bash.1
   4.505 +--- doc/bash.1.orig	2011-01-16 21:31:39.000000000 +0100
   4.506 ++++ doc/bash.1	2012-06-27 10:31:03.000000000 +0200
   4.507 +@@ -8948,6 +8948,16 @@
   4.508 + quoted.  This is the behavior of posix mode through version 4.1.
   4.509 + The default bash behavior remains as in previous versions.
   4.510 + .TP 8
   4.511 ++.B direxpand
   4.512 ++If set,
   4.513 ++.B bash
   4.514 ++replaces directory names with the results of word expansion when performing
   4.515 ++filename completion.  This changes the contents of the readline editing
   4.516 ++buffer.
   4.517 ++If not set,
   4.518 ++.B bash
   4.519 ++attempts to preserve what the user typed.
   4.520 ++.TP 8
   4.521 + .B dirspell
   4.522 + If set,
   4.523 + .B bash
   4.524 +Index: doc/bashref.texi
   4.525 +--- doc/bashref.texi.orig	2011-01-16 21:31:57.000000000 +0100
   4.526 ++++ doc/bashref.texi	2012-06-27 10:31:03.000000000 +0200
   4.527 +@@ -4535,6 +4535,13 @@
   4.528 + quoted.  This is the behavior of @sc{posix} mode through version 4.1.
   4.529 + The default Bash behavior remains as in previous versions.
   4.530 + 
   4.531 ++@item direxpand
   4.532 ++If set, Bash
   4.533 ++replaces directory names with the results of word expansion when performing
   4.534 ++filename completion.  This changes the contents of the readline editing
   4.535 ++buffer.
   4.536 ++If not set, Bash attempts to preserve what the user typed.
   4.537 ++
   4.538 + @item dirspell
   4.539 + If set, Bash
   4.540 + attempts spelling correction on directory names during word completion 
   4.541 +Index: error.c
   4.542 +--- error.c.orig	2009-08-22 04:31:31.000000000 +0200
   4.543 ++++ error.c	2012-06-27 10:31:02.000000000 +0200
   4.544 +@@ -200,7 +200,11 @@
   4.545 + 
   4.546 +   va_end (args);
   4.547 +   if (exit_immediately_on_error)
   4.548 +-    exit_shell (1);
   4.549 ++    {
   4.550 ++      if (last_command_exit_value == 0)
   4.551 ++	last_command_exit_value = 1;
   4.552 ++      exit_shell (last_command_exit_value);
   4.553 ++    }
   4.554 + }
   4.555 + 
   4.556 + void
   4.557 +Index: execute_cmd.c
   4.558 +--- execute_cmd.c.orig	2011-02-09 23:32:25.000000000 +0100
   4.559 ++++ execute_cmd.c	2012-06-27 10:31:03.000000000 +0200
   4.560 +@@ -2196,6 +2196,7 @@
   4.561 +   if (ignore_return && cmd)
   4.562 +     cmd->flags |= CMD_IGNORE_RETURN;
   4.563 + 
   4.564 ++#if defined (JOB_CONTROL)
   4.565 +   lastpipe_flag = 0;
   4.566 +   begin_unwind_frame ("lastpipe-exec");
   4.567 +   lstdin = -1;
   4.568 +@@ -2204,7 +2205,7 @@
   4.569 +      current shell environment. */
   4.570 +   if (lastpipe_opt && job_control == 0 && asynchronous == 0 && pipe_out == NO_PIPE && prev > 0)
   4.571 +     {
   4.572 +-      lstdin = move_to_high_fd (0, 0, 255);
   4.573 ++      lstdin = move_to_high_fd (0, 1, -1);
   4.574 +       if (lstdin > 0)
   4.575 + 	{
   4.576 + 	  do_piping (prev, pipe_out);
   4.577 +@@ -2215,15 +2216,19 @@
   4.578 + 	  lastpipe_jid = stop_pipeline (0, (COMMAND *)NULL);	/* XXX */
   4.579 + 	  add_unwind_protect (lastpipe_cleanup, lastpipe_jid);
   4.580 + 	}
   4.581 +-      cmd->flags |= CMD_LASTPIPE;
   4.582 ++      if (cmd)
   4.583 ++	cmd->flags |= CMD_LASTPIPE;
   4.584 +     }	  
   4.585 +   if (prev >= 0)
   4.586 +     add_unwind_protect (close, prev);
   4.587 ++#endif
   4.588 + 
   4.589 +   exec_result = execute_command_internal (cmd, asynchronous, prev, pipe_out, fds_to_close);
   4.590 + 
   4.591 ++#if defined (JOB_CONTROL)
   4.592 +   if (lstdin > 0)
   4.593 +     restore_stdin (lstdin);
   4.594 ++#endif
   4.595 + 
   4.596 +   if (prev >= 0)
   4.597 +     close (prev);
   4.598 +@@ -2246,7 +2251,9 @@
   4.599 +       unfreeze_jobs_list ();
   4.600 +     }
   4.601 + 
   4.602 ++#if defined (JOB_CONTROL)
   4.603 +   discard_unwind_frame ("lastpipe-exec");
   4.604 ++#endif
   4.605 + 
   4.606 +   return (exec_result);
   4.607 + }
   4.608 +@@ -3575,13 +3582,13 @@
   4.609 + {
   4.610 +   WORD_LIST *w;
   4.611 +   struct builtin *b;
   4.612 +-  int assoc;
   4.613 ++  int assoc, global;
   4.614 + 
   4.615 +   if (words == 0)
   4.616 +     return;
   4.617 + 
   4.618 +   b = 0;
   4.619 +-  assoc = 0;
   4.620 ++  assoc = global = 0;
   4.621 + 
   4.622 +   for (w = words; w; w = w->next)
   4.623 +     if (w->word->flags & W_ASSIGNMENT)
   4.624 +@@ -3598,12 +3605,17 @@
   4.625 + #if defined (ARRAY_VARS)
   4.626 + 	if (assoc)
   4.627 + 	  w->word->flags |= W_ASSIGNASSOC;
   4.628 ++	if (global)
   4.629 ++	  w->word->flags |= W_ASSNGLOBAL;
   4.630 + #endif
   4.631 +       }
   4.632 + #if defined (ARRAY_VARS)
   4.633 +     /* Note that we saw an associative array option to a builtin that takes
   4.634 +        assignment statements.  This is a bit of a kludge. */
   4.635 +-    else if (w->word->word[0] == '-' && strchr (w->word->word, 'A'))
   4.636 ++    else if (w->word->word[0] == '-' && (strchr (w->word->word+1, 'A') || strchr (w->word->word+1, 'g')))
   4.637 ++#else
   4.638 ++    else if (w->word->word[0] == '-' && strchr (w->word->word+1, 'g'))
   4.639 ++#endif
   4.640 +       {
   4.641 + 	if (b == 0)
   4.642 + 	  {
   4.643 +@@ -3613,10 +3625,11 @@
   4.644 + 	    else if (b && (b->flags & ASSIGNMENT_BUILTIN))
   4.645 + 	      words->word->flags |= W_ASSNBLTIN;
   4.646 + 	  }
   4.647 +-	if (words->word->flags & W_ASSNBLTIN)
   4.648 ++	if ((words->word->flags & W_ASSNBLTIN) && strchr (w->word->word+1, 'A'))
   4.649 + 	  assoc = 1;
   4.650 ++	if ((words->word->flags & W_ASSNBLTIN) && strchr (w->word->word+1, 'g'))
   4.651 ++	  global = 1;
   4.652 +       }
   4.653 +-#endif
   4.654 + }
   4.655 + 
   4.656 + /* Return 1 if the file found by searching $PATH for PATHNAME, defaulting
   4.657 +Index: expr.c
   4.658 +--- expr.c.orig	2010-12-21 17:12:13.000000000 +0100
   4.659 ++++ expr.c	2012-06-27 10:31:02.000000000 +0200
   4.660 +@@ -476,19 +476,23 @@
   4.661 + 
   4.662 +       if (special)
   4.663 + 	{
   4.664 ++	  if ((op == DIV || op == MOD) && value == 0)
   4.665 ++	    {
   4.666 ++	      if (noeval == 0)
   4.667 ++		evalerror (_("division by 0"));
   4.668 ++	      else
   4.669 ++	        value = 1;
   4.670 ++	    }
   4.671 ++
   4.672 + 	  switch (op)
   4.673 + 	    {
   4.674 + 	    case MUL:
   4.675 + 	      lvalue *= value;
   4.676 + 	      break;
   4.677 + 	    case DIV:
   4.678 +-	      if (value == 0)
   4.679 +-		evalerror (_("division by 0"));
   4.680 + 	      lvalue /= value;
   4.681 + 	      break;
   4.682 + 	    case MOD:
   4.683 +-	      if (value == 0)
   4.684 +-		evalerror (_("division by 0"));
   4.685 + 	      lvalue %= value;
   4.686 + 	      break;
   4.687 + 	    case PLUS:
   4.688 +@@ -804,7 +808,12 @@
   4.689 +       val2 = exppower ();
   4.690 + 
   4.691 +       if (((op == DIV) || (op == MOD)) && (val2 == 0))
   4.692 +-	evalerror (_("division by 0"));
   4.693 ++	{
   4.694 ++	  if (noeval == 0)
   4.695 ++	    evalerror (_("division by 0"));
   4.696 ++	  else
   4.697 ++	    val2 = 1;
   4.698 ++	}
   4.699 + 
   4.700 +       if (op == MUL)
   4.701 + 	val1 *= val2;
   4.702 +Index: lib/glob/gmisc.c
   4.703 +--- lib/glob/gmisc.c.orig	2011-02-05 22:11:17.000000000 +0100
   4.704 ++++ lib/glob/gmisc.c	2012-06-27 10:31:02.000000000 +0200
   4.705 +@@ -77,8 +77,8 @@
   4.706 +      wchar_t *wpat;
   4.707 +      size_t wmax;
   4.708 + {
   4.709 +-  wchar_t wc, *wbrack;
   4.710 +-  int matlen, t, in_cclass, in_collsym, in_equiv;
   4.711 ++  wchar_t wc;
   4.712 ++  int matlen, bracklen, t, in_cclass, in_collsym, in_equiv;
   4.713 + 
   4.714 +   if (*wpat == 0)
   4.715 +     return (0);
   4.716 +@@ -118,58 +118,80 @@
   4.717 + 	  break;
   4.718 + 	case L'[':
   4.719 + 	  /* scan for ending `]', skipping over embedded [:...:] */
   4.720 +-	  wbrack = wpat;
   4.721 ++	  bracklen = 1;
   4.722 + 	  wc = *wpat++;
   4.723 + 	  do
   4.724 + 	    {
   4.725 + 	      if (wc == 0)
   4.726 + 		{
   4.727 +-	          matlen += wpat - wbrack - 1;	/* incremented below */
   4.728 +-	          break;
   4.729 ++		  wpat--;			/* back up to NUL */
   4.730 ++	          matlen += bracklen;
   4.731 ++	          goto bad_bracket;
   4.732 + 	        }
   4.733 + 	      else if (wc == L'\\')
   4.734 + 		{
   4.735 +-		  wc = *wpat++;
   4.736 +-		  if (*wpat == 0)
   4.737 +-		    break;
   4.738 ++		  /* *wpat == backslash-escaped character */
   4.739 ++		  bracklen++;
   4.740 ++		  /* If the backslash or backslash-escape ends the string,
   4.741 ++		     bail.  The ++wpat skips over the backslash escape */
   4.742 ++		  if (*wpat == 0 || *++wpat == 0)
   4.743 ++		    {
   4.744 ++		      matlen += bracklen;
   4.745 ++		      goto bad_bracket;
   4.746 ++		    }
   4.747 + 		}
   4.748 + 	      else if (wc == L'[' && *wpat == L':')	/* character class */
   4.749 + 		{
   4.750 + 		  wpat++;
   4.751 ++		  bracklen++;
   4.752 + 		  in_cclass = 1;
   4.753 + 		}
   4.754 + 	      else if (in_cclass && wc == L':' && *wpat == L']')
   4.755 + 		{
   4.756 + 		  wpat++;
   4.757 ++		  bracklen++;
   4.758 + 		  in_cclass = 0;
   4.759 + 		}
   4.760 + 	      else if (wc == L'[' && *wpat == L'.')	/* collating symbol */
   4.761 + 		{
   4.762 + 		  wpat++;
   4.763 ++		  bracklen++;
   4.764 + 		  if (*wpat == L']')	/* right bracket can appear as collating symbol */
   4.765 +-		    wpat++;
   4.766 ++		    {
   4.767 ++		      wpat++;
   4.768 ++		      bracklen++;
   4.769 ++		    }
   4.770 + 		  in_collsym = 1;
   4.771 + 		}
   4.772 + 	      else if (in_collsym && wc == L'.' && *wpat == L']')
   4.773 + 		{
   4.774 + 		  wpat++;
   4.775 ++		  bracklen++;
   4.776 + 		  in_collsym = 0;
   4.777 + 		}
   4.778 + 	      else if (wc == L'[' && *wpat == L'=')	/* equivalence class */
   4.779 + 		{
   4.780 + 		  wpat++;
   4.781 ++		  bracklen++;
   4.782 + 		  if (*wpat == L']')	/* right bracket can appear as equivalence class */
   4.783 +-		    wpat++;
   4.784 ++		    {
   4.785 ++		      wpat++;
   4.786 ++		      bracklen++;
   4.787 ++		    }
   4.788 + 		  in_equiv = 1;
   4.789 + 		}
   4.790 + 	      else if (in_equiv && wc == L'=' && *wpat == L']')
   4.791 + 		{
   4.792 + 		  wpat++;
   4.793 ++		  bracklen++;
   4.794 + 		  in_equiv = 0;
   4.795 + 		}
   4.796 ++	      else
   4.797 ++		bracklen++;
   4.798 + 	    }
   4.799 + 	  while ((wc = *wpat++) != L']');
   4.800 + 	  matlen++;		/* bracket expression can only match one char */
   4.801 ++bad_bracket:
   4.802 + 	  break;
   4.803 + 	}
   4.804 +     }
   4.805 +@@ -213,8 +235,8 @@
   4.806 +      char *pat;
   4.807 +      size_t max;
   4.808 + {
   4.809 +-  char c, *brack;
   4.810 +-  int matlen, t, in_cclass, in_collsym, in_equiv;
   4.811 ++  char c;
   4.812 ++  int matlen, bracklen, t, in_cclass, in_collsym, in_equiv;
   4.813 + 
   4.814 +   if (*pat == 0)
   4.815 +     return (0);
   4.816 +@@ -254,58 +276,80 @@
   4.817 + 	  break;
   4.818 + 	case '[':
   4.819 + 	  /* scan for ending `]', skipping over embedded [:...:] */
   4.820 +-	  brack = pat;
   4.821 ++	  bracklen = 1;
   4.822 + 	  c = *pat++;
   4.823 + 	  do
   4.824 + 	    {
   4.825 + 	      if (c == 0)
   4.826 + 		{
   4.827 +-	          matlen += pat - brack - 1;	/* incremented below */
   4.828 +-	          break;
   4.829 ++		  pat--;			/* back up to NUL */
   4.830 ++		  matlen += bracklen;
   4.831 ++		  goto bad_bracket;
   4.832 + 	        }
   4.833 + 	      else if (c == '\\')
   4.834 + 		{
   4.835 +-		  c = *pat++;
   4.836 +-		  if (*pat == 0)
   4.837 +-		    break;
   4.838 ++		  /* *pat == backslash-escaped character */
   4.839 ++		  bracklen++;
   4.840 ++		  /* If the backslash or backslash-escape ends the string,
   4.841 ++		     bail.  The ++pat skips over the backslash escape */
   4.842 ++		  if (*pat == 0 || *++pat == 0)
   4.843 ++		    {
   4.844 ++		      matlen += bracklen;
   4.845 ++		      goto bad_bracket;
   4.846 ++		    }
   4.847 + 		}
   4.848 + 	      else if (c == '[' && *pat == ':')	/* character class */
   4.849 + 		{
   4.850 + 		  pat++;
   4.851 ++		  bracklen++;
   4.852 + 		  in_cclass = 1;
   4.853 + 		}
   4.854 + 	      else if (in_cclass && c == ':' && *pat == ']')
   4.855 + 		{
   4.856 + 		  pat++;
   4.857 ++		  bracklen++;
   4.858 + 		  in_cclass = 0;
   4.859 + 		}
   4.860 + 	      else if (c == '[' && *pat == '.')	/* collating symbol */
   4.861 + 		{
   4.862 + 		  pat++;
   4.863 ++		  bracklen++;
   4.864 + 		  if (*pat == ']')	/* right bracket can appear as collating symbol */
   4.865 +-		    pat++;
   4.866 ++		    {
   4.867 ++		      pat++;
   4.868 ++		      bracklen++;
   4.869 ++		    }
   4.870 + 		  in_collsym = 1;
   4.871 + 		}
   4.872 + 	      else if (in_collsym && c == '.' && *pat == ']')
   4.873 + 		{
   4.874 + 		  pat++;
   4.875 ++		  bracklen++;
   4.876 + 		  in_collsym = 0;
   4.877 + 		}
   4.878 + 	      else if (c == '[' && *pat == '=')	/* equivalence class */
   4.879 + 		{
   4.880 + 		  pat++;
   4.881 ++		  bracklen++;
   4.882 + 		  if (*pat == ']')	/* right bracket can appear as equivalence class */
   4.883 +-		    pat++;
   4.884 ++		    {
   4.885 ++		      pat++;
   4.886 ++		      bracklen++;
   4.887 ++		    }
   4.888 + 		  in_equiv = 1;
   4.889 + 		}
   4.890 + 	      else if (in_equiv && c == '=' && *pat == ']')
   4.891 + 		{
   4.892 + 		  pat++;
   4.893 ++		  bracklen++;
   4.894 + 		  in_equiv = 0;
   4.895 + 		}
   4.896 ++	      else
   4.897 ++		bracklen++;
   4.898 + 	    }
   4.899 + 	  while ((c = *pat++) != ']');
   4.900 + 	  matlen++;		/* bracket expression can only match one char */
   4.901 ++bad_bracket:
   4.902 + 	  break;
   4.903 + 	}
   4.904 +     }
   4.905 +Index: lib/readline/callback.c
   4.906 +--- lib/readline/callback.c.orig	2010-06-06 18:18:58.000000000 +0200
   4.907 ++++ lib/readline/callback.c	2012-06-27 10:31:02.000000000 +0200
   4.908 +@@ -148,6 +148,9 @@
   4.909 + 	  eof = _rl_vi_domove_callback (_rl_vimvcxt);
   4.910 + 	  /* Should handle everything, including cleanup, numeric arguments,
   4.911 + 	     and turning off RL_STATE_VIMOTION */
   4.912 ++	  if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)
   4.913 ++	    _rl_internal_char_cleanup ();
   4.914 ++
   4.915 + 	  return;
   4.916 + 	}
   4.917 + #endif
   4.918 +Index: lib/readline/vi_mode.c
   4.919 +--- lib/readline/vi_mode.c.orig	2010-11-21 01:51:39.000000000 +0100
   4.920 ++++ lib/readline/vi_mode.c	2012-06-27 10:31:02.000000000 +0200
   4.921 +@@ -1114,7 +1114,7 @@
   4.922 +       rl_beg_of_line (1, c);
   4.923 +       _rl_vi_last_motion = c;
   4.924 +       RL_UNSETSTATE (RL_STATE_VIMOTION);
   4.925 +-      return (0);
   4.926 ++      return (vidomove_dispatch (m));
   4.927 +     }
   4.928 + #if defined (READLINE_CALLBACKS)
   4.929 +   /* XXX - these need to handle rl_universal_argument bindings */
   4.930 +Index: lib/sh/zread.c
   4.931 +--- lib/sh/zread.c.orig	2009-03-02 14:54:45.000000000 +0100
   4.932 ++++ lib/sh/zread.c	2012-06-27 10:31:02.000000000 +0200
   4.933 +@@ -160,14 +160,13 @@
   4.934 + zsyncfd (fd)
   4.935 +      int fd;
   4.936 + {
   4.937 +-  off_t off;
   4.938 +-  int r;
   4.939 ++  off_t off, r;
   4.940 + 
   4.941 +   off = lused - lind;
   4.942 +   r = 0;
   4.943 +   if (off > 0)
   4.944 +     r = lseek (fd, -off, SEEK_CUR);
   4.945 + 
   4.946 +-  if (r >= 0)
   4.947 ++  if (r != -1)
   4.948 +     lused = lind = 0;
   4.949 + }
   4.950 +Index: parse.y
   4.951 +--- parse.y.orig	2011-01-02 21:48:11.000000000 +0100
   4.952 ++++ parse.y	2012-06-27 10:31:02.000000000 +0200
   4.953 +@@ -2499,7 +2499,7 @@
   4.954 + 	 We do this only if it is time to do so. Notice that only here
   4.955 + 	 is the mail alarm reset; nothing takes place in check_mail ()
   4.956 + 	 except the checking of mail.  Please don't change this. */
   4.957 +-      if (prompt_is_ps1 && time_to_check_mail ())
   4.958 ++      if (prompt_is_ps1 && parse_and_execute_level == 0 && time_to_check_mail ())
   4.959 + 	{
   4.960 + 	  check_mail ();
   4.961 + 	  reset_mail_timer ();
   4.962 +@@ -3842,6 +3842,7 @@
   4.963 +      int flags;
   4.964 + {
   4.965 +   sh_parser_state_t ps;
   4.966 ++  sh_input_line_state_t ls;
   4.967 +   int orig_ind, nc, sflags;
   4.968 +   char *ret, *s, *ep, *ostring;
   4.969 + 
   4.970 +@@ -3849,10 +3850,12 @@
   4.971 +   orig_ind = *indp;
   4.972 +   ostring = string;
   4.973 + 
   4.974 ++/*itrace("xparse_dolparen: size = %d shell_input_line = `%s'", shell_input_line_size, shell_input_line);*/
   4.975 +   sflags = SEVAL_NONINT|SEVAL_NOHIST|SEVAL_NOFREE;
   4.976 +   if (flags & SX_NOLONGJMP)
   4.977 +     sflags |= SEVAL_NOLONGJMP;
   4.978 +   save_parser_state (&ps);
   4.979 ++  save_input_line_state (&ls);
   4.980 + 
   4.981 +   /*(*/
   4.982 +   parser_state |= PST_CMDSUBST|PST_EOFTOKEN;	/* allow instant ')' */ /*(*/
   4.983 +@@ -3861,6 +3864,8 @@
   4.984 + 
   4.985 +   restore_parser_state (&ps);
   4.986 +   reset_parser ();
   4.987 ++  /* reset_parser clears shell_input_line and associated variables */
   4.988 ++  restore_input_line_state (&ls);
   4.989 +   if (interactive)
   4.990 +     token_to_read = 0;
   4.991 + 
   4.992 +@@ -5135,6 +5140,9 @@
   4.993 + 	    case 'A':
   4.994 + 	      /* Make the current time/date into a string. */
   4.995 + 	      (void) time (&the_time);
   4.996 ++#if defined (HAVE_TZSET)
   4.997 ++	      sv_tz ("TZ");		/* XXX -- just make sure */
   4.998 ++#endif
   4.999 + 	      tm = localtime (&the_time);
  4.1000 + 
  4.1001 + 	      if (c == 'd')
  4.1002 +@@ -5905,6 +5913,12 @@
  4.1003 +   ps->expand_aliases = expand_aliases;
  4.1004 +   ps->echo_input_at_read = echo_input_at_read;
  4.1005 + 
  4.1006 ++  ps->token = token;
  4.1007 ++  ps->token_buffer_size = token_buffer_size;
  4.1008 ++  /* Force reallocation on next call to read_token_word */
  4.1009 ++  token = 0;
  4.1010 ++  token_buffer_size = 0;
  4.1011 ++
  4.1012 +   return (ps);
  4.1013 + }
  4.1014 + 
  4.1015 +@@ -5946,6 +5960,42 @@
  4.1016 + 
  4.1017 +   expand_aliases = ps->expand_aliases;
  4.1018 +   echo_input_at_read = ps->echo_input_at_read;
  4.1019 ++
  4.1020 ++  FREE (token);
  4.1021 ++  token = ps->token;
  4.1022 ++  token_buffer_size = ps->token_buffer_size;
  4.1023 ++}
  4.1024 ++
  4.1025 ++sh_input_line_state_t *
  4.1026 ++save_input_line_state (ls)
  4.1027 ++     sh_input_line_state_t *ls;
  4.1028 ++{
  4.1029 ++  if (ls == 0)
  4.1030 ++    ls = (sh_input_line_state_t *)xmalloc (sizeof (sh_input_line_state_t));
  4.1031 ++  if (ls == 0)
  4.1032 ++    return ((sh_input_line_state_t *)NULL);
  4.1033 ++
  4.1034 ++  ls->input_line = shell_input_line;
  4.1035 ++  ls->input_line_size = shell_input_line_size;
  4.1036 ++  ls->input_line_len = shell_input_line_len;
  4.1037 ++  ls->input_line_index = shell_input_line_index;
  4.1038 ++
  4.1039 ++  /* force reallocation */
  4.1040 ++  shell_input_line = 0;
  4.1041 ++  shell_input_line_size = shell_input_line_len = shell_input_line_index = 0;
  4.1042 ++}
  4.1043 ++
  4.1044 ++void
  4.1045 ++restore_input_line_state (ls)
  4.1046 ++     sh_input_line_state_t *ls;
  4.1047 ++{
  4.1048 ++  FREE (shell_input_line);
  4.1049 ++  shell_input_line = ls->input_line;
  4.1050 ++  shell_input_line_size = ls->input_line_size;
  4.1051 ++  shell_input_line_len = ls->input_line_len;
  4.1052 ++  shell_input_line_index = ls->input_line_index;
  4.1053 ++
  4.1054 ++  set_line_mbstate ();
  4.1055 + }
  4.1056 + 
  4.1057 + /************************************************
  4.1058 +Index: patchlevel.h
  4.1059 +--- patchlevel.h.orig	2010-06-13 02:14:48.000000000 +0200
  4.1060 ++++ patchlevel.h	2012-06-27 10:31:03.000000000 +0200
  4.1061 +@@ -25,6 +25,6 @@
  4.1062 +    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
  4.1063 +    looks for to find the patch level (for the sccs version string). */
  4.1064 + 
  4.1065 +-#define PATCHLEVEL 0
  4.1066 ++#define PATCHLEVEL 29
  4.1067 + 
  4.1068 + #endif /* _PATCHLEVEL_H_ */
  4.1069 +Index: pathexp.c
  4.1070 +--- pathexp.c.orig	2010-08-14 05:21:57.000000000 +0200
  4.1071 ++++ pathexp.c	2012-06-27 10:31:02.000000000 +0200
  4.1072 +@@ -196,7 +196,7 @@
  4.1073 + 	{
  4.1074 + 	  if ((qflags & QGLOB_FILENAME) && pathname[i+1] == '/')
  4.1075 + 	    continue;
  4.1076 +-	  if ((qflags & QGLOB_REGEXP) && ere_char (pathname[i+1]) == 0)
  4.1077 ++	  if (pathname[i+1] != CTLESC && (qflags & QGLOB_REGEXP) && ere_char (pathname[i+1]) == 0)
  4.1078 + 	    continue;
  4.1079 + 	  temp[j++] = '\\';
  4.1080 + 	  i++;
  4.1081 +Index: print_cmd.c
  4.1082 +--- print_cmd.c.orig	2010-05-31 00:34:08.000000000 +0200
  4.1083 ++++ print_cmd.c	2012-06-27 10:31:02.000000000 +0200
  4.1084 +@@ -315,6 +315,7 @@
  4.1085 + 	  cprintf ("( ");
  4.1086 + 	  skip_this_indent++;
  4.1087 + 	  make_command_string_internal (command->value.Subshell->command);
  4.1088 ++	  PRINT_DEFERRED_HEREDOCS ("");
  4.1089 + 	  cprintf (" )");
  4.1090 + 	  break;
  4.1091 + 
  4.1092 +@@ -592,6 +593,7 @@
  4.1093 +   newline ("do\n");
  4.1094 +   indentation += indentation_amount;
  4.1095 +   make_command_string_internal (arith_for_command->action);
  4.1096 ++  PRINT_DEFERRED_HEREDOCS ("");
  4.1097 +   semicolon ();
  4.1098 +   indentation -= indentation_amount;
  4.1099 +   newline ("done");
  4.1100 +@@ -653,6 +655,7 @@
  4.1101 +     }
  4.1102 + 
  4.1103 +   make_command_string_internal (group_command->command);
  4.1104 ++  PRINT_DEFERRED_HEREDOCS ("");
  4.1105 + 
  4.1106 +   if (inside_function_def)
  4.1107 +     {
  4.1108 +Index: shell.h
  4.1109 +--- shell.h.orig	2011-01-07 04:16:55.000000000 +0100
  4.1110 ++++ shell.h	2012-06-27 10:31:02.000000000 +0200
  4.1111 +@@ -136,6 +136,9 @@
  4.1112 +   int parser_state;
  4.1113 +   int *token_state;
  4.1114 + 
  4.1115 ++  char *token;
  4.1116 ++  int token_buffer_size;
  4.1117 ++
  4.1118 +   /* input line state -- line number saved elsewhere */
  4.1119 +   int input_line_terminator;
  4.1120 +   int eof_encountered;
  4.1121 +@@ -166,6 +169,16 @@
  4.1122 +   
  4.1123 + } sh_parser_state_t;
  4.1124 + 
  4.1125 ++typedef struct _sh_input_line_state_t {
  4.1126 ++  char *input_line;
  4.1127 ++  int input_line_index;
  4.1128 ++  int input_line_size;
  4.1129 ++  int input_line_len;
  4.1130 ++} sh_input_line_state_t;
  4.1131 ++
  4.1132 + /* Let's try declaring these here. */
  4.1133 + extern sh_parser_state_t *save_parser_state __P((sh_parser_state_t *));
  4.1134 + extern void restore_parser_state __P((sh_parser_state_t *));
  4.1135 ++
  4.1136 ++extern sh_input_line_state_t *save_input_line_state __P((sh_input_line_state_t *));
  4.1137 ++extern void restore_input_line_state __P((sh_input_line_state_t *));
  4.1138 +Index: sig.c
  4.1139 +--- sig.c.orig	2010-11-23 14:21:22.000000000 +0100
  4.1140 ++++ sig.c	2012-06-27 10:31:02.000000000 +0200
  4.1141 +@@ -46,6 +46,7 @@
  4.1142 + 
  4.1143 + #if defined (READLINE)
  4.1144 + #  include "bashline.h"
  4.1145 ++#  include <readline/readline.h>
  4.1146 + #endif
  4.1147 + 
  4.1148 + #if defined (HISTORY)
  4.1149 +@@ -62,6 +63,7 @@
  4.1150 + #if defined (HISTORY)
  4.1151 + extern int history_lines_this_session;
  4.1152 + #endif
  4.1153 ++extern int no_line_editing;
  4.1154 + 
  4.1155 + extern void initialize_siglist ();
  4.1156 + 
  4.1157 +@@ -505,7 +507,10 @@
  4.1158 +     {
  4.1159 + #if defined (HISTORY)
  4.1160 +       /* XXX - will inhibit history file being written */
  4.1161 +-      history_lines_this_session = 0;
  4.1162 ++#  if defined (READLINE)
  4.1163 ++      if (interactive_shell == 0 || interactive == 0 || (sig != SIGHUP && sig != SIGTERM) || no_line_editing || (RL_ISSTATE (RL_STATE_READCMD) == 0))
  4.1164 ++#  endif
  4.1165 ++        history_lines_this_session = 0;
  4.1166 + #endif
  4.1167 +       terminate_immediately = 0;
  4.1168 +       termsig_handler (sig);
  4.1169 +Index: subst.c
  4.1170 +--- subst.c.orig	2011-01-02 22:12:51.000000000 +0100
  4.1171 ++++ subst.c	2012-06-27 10:31:03.000000000 +0200
  4.1172 +@@ -366,6 +366,11 @@
  4.1173 +       f &= ~W_ASSNBLTIN;
  4.1174 +       fprintf (stderr, "W_ASSNBLTIN%s", f ? "|" : "");
  4.1175 +     }
  4.1176 ++  if (f & W_ASSNGLOBAL)
  4.1177 ++    {
  4.1178 ++      f &= ~W_ASSNGLOBAL;
  4.1179 ++      fprintf (stderr, "W_ASSNGLOBAL%s", f ? "|" : "");
  4.1180 ++    }
  4.1181 +   if (f & W_COMPASSIGN)
  4.1182 +     {
  4.1183 +       f &= ~W_COMPASSIGN;
  4.1184 +@@ -1379,10 +1384,12 @@
  4.1185 +   slen = strlen (string + *sindex) + *sindex;
  4.1186 + 
  4.1187 +   /* The handling of dolbrace_state needs to agree with the code in parse.y:
  4.1188 +-     parse_matched_pair() */
  4.1189 +-  dolbrace_state = 0;
  4.1190 +-  if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
  4.1191 +-    dolbrace_state = (flags & SX_POSIXEXP) ? DOLBRACE_QUOTE : DOLBRACE_PARAM;
  4.1192 ++     parse_matched_pair().  The different initial value is to handle the
  4.1193 ++     case where this function is called to parse the word in
  4.1194 ++     ${param op word} (SX_WORD). */
  4.1195 ++  dolbrace_state = (flags & SX_WORD) ? DOLBRACE_WORD : DOLBRACE_PARAM;
  4.1196 ++  if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && (flags & SX_POSIXEXP))
  4.1197 ++    dolbrace_state = DOLBRACE_QUOTE;
  4.1198 + 
  4.1199 +   i = *sindex;
  4.1200 +   while (c = string[i])
  4.1201 +@@ -2801,7 +2808,7 @@
  4.1202 +     }
  4.1203 +   else if (assign_list)
  4.1204 +     {
  4.1205 +-      if (word->flags & W_ASSIGNARG)
  4.1206 ++      if ((word->flags & W_ASSIGNARG) && (word->flags & W_ASSNGLOBAL) == 0)
  4.1207 + 	aflags |= ASS_MKLOCAL;
  4.1208 +       if (word->flags & W_ASSIGNASSOC)
  4.1209 + 	aflags |= ASS_MKASSOC;
  4.1210 +@@ -3371,7 +3378,7 @@
  4.1211 +   if (string == 0 || *string == '\0')
  4.1212 +     return (WORD_LIST *)NULL;
  4.1213 + 
  4.1214 +-  td.flags = 0;
  4.1215 ++  td.flags = W_NOSPLIT2;		/* no splitting, remove "" and '' */
  4.1216 +   td.word = string;
  4.1217 +   tresult = call_expand_word_internal (&td, quoted, 1, dollar_at_p, has_dollar_at);
  4.1218 +   return (tresult);
  4.1219 +@@ -3704,7 +3711,10 @@
  4.1220 + 	    break;
  4.1221 + 	}
  4.1222 +       else if (string[i] == CTLNUL)
  4.1223 +-	i++;
  4.1224 ++	{
  4.1225 ++	  i++;
  4.1226 ++	  continue;
  4.1227 ++	}
  4.1228 + 
  4.1229 +       prev_i = i;
  4.1230 +       ADVANCE_CHAR (string, slen, i);
  4.1231 +@@ -4156,7 +4166,7 @@
  4.1232 +   simple = (wpat[0] != L'\\' && wpat[0] != L'*' && wpat[0] != L'?' && wpat[0] != L'[');
  4.1233 + #if defined (EXTENDED_GLOB)
  4.1234 +   if (extended_glob)
  4.1235 +-    simple |= (wpat[1] != L'(' || (wpat[0] != L'*' && wpat[0] != L'?' && wpat[0] != L'+' && wpat[0] != L'!' && wpat[0] != L'@')); /*)*/
  4.1236 ++    simple &= (wpat[1] != L'(' || (wpat[0] != L'*' && wpat[0] != L'?' && wpat[0] != L'+' && wpat[0] != L'!' && wpat[0] != L'@')); /*)*/
  4.1237 + #endif
  4.1238 + 
  4.1239 +   /* If the pattern doesn't match anywhere in the string, go ahead and
  4.1240 +@@ -4607,6 +4617,7 @@
  4.1241 +   if (ifs_firstc == 0)
  4.1242 + #endif
  4.1243 +     word->flags |= W_NOSPLIT;
  4.1244 ++  word->flags |= W_NOSPLIT2;
  4.1245 +   result = call_expand_word_internal (word, quoted, 0, (int *)NULL, (int *)NULL);
  4.1246 +   expand_no_split_dollar_star = 0;
  4.1247 + 
  4.1248 +@@ -5798,6 +5809,16 @@
  4.1249 + 	 is the only expansion that creates more than one word. */
  4.1250 +       if (qdollaratp && ((hasdol && quoted) || l->next))
  4.1251 + 	*qdollaratp = 1;
  4.1252 ++      /* If we have a quoted null result (QUOTED_NULL(temp)) and the word is
  4.1253 ++	 a quoted null (l->next == 0 && QUOTED_NULL(l->word->word)), the
  4.1254 ++	 flags indicate it (l->word->flags & W_HASQUOTEDNULL), and the
  4.1255 ++	 expansion is quoted (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
  4.1256 ++	 (which is more paranoia than anything else), we need to return the
  4.1257 ++	 quoted null string and set the flags to indicate it. */
  4.1258 ++      if (l->next == 0 && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && QUOTED_NULL(temp) && QUOTED_NULL(l->word->word) && (l->word->flags & W_HASQUOTEDNULL))
  4.1259 ++	{
  4.1260 ++	  w->flags |= W_HASQUOTEDNULL;
  4.1261 ++	}
  4.1262 +       dispose_words (l);
  4.1263 +     }
  4.1264 +   else if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && hasdol)
  4.1265 +@@ -7176,7 +7197,7 @@
  4.1266 +     {
  4.1267 +       /* Extract the contents of the ${ ... } expansion
  4.1268 + 	 according to the Posix.2 rules. */
  4.1269 +-      value = extract_dollar_brace_string (string, &sindex, quoted, (c == '%' || c == '#') ? SX_POSIXEXP : 0);
  4.1270 ++      value = extract_dollar_brace_string (string, &sindex, quoted, (c == '%' || c == '#' || c =='/' || c == '^' || c == ',' || c ==':') ? SX_POSIXEXP|SX_WORD : SX_WORD);
  4.1271 +       if (string[sindex] == RBRACE)
  4.1272 + 	sindex++;
  4.1273 +       else
  4.1274 +@@ -7268,6 +7289,7 @@
  4.1275 +     default:
  4.1276 +     case '\0':
  4.1277 +     bad_substitution:
  4.1278 ++      last_command_exit_value = EXECUTION_FAILURE;
  4.1279 +       report_error (_("%s: bad substitution"), string ? string : "??");
  4.1280 +       FREE (value);
  4.1281 +       FREE (temp);
  4.1282 +Index: subst.h
  4.1283 +--- subst.h.orig	2010-12-03 02:21:29.000000000 +0100
  4.1284 ++++ subst.h	2012-06-27 10:31:02.000000000 +0200
  4.1285 +@@ -56,6 +56,7 @@
  4.1286 + #define SX_NOLONGJMP	0x0040	/* don't longjmp on fatal error */
  4.1287 + #define SX_ARITHSUB	0x0080	/* extracting $(( ... )) (currently unused) */
  4.1288 + #define SX_POSIXEXP	0x0100	/* extracting new Posix pattern removal expansions in extract_dollar_brace_string */
  4.1289 ++#define SX_WORD		0x0200	/* extracting word in ${param op word} */
  4.1290 + 
  4.1291 + /* Remove backslashes which are quoting backquotes from STRING.  Modifies
  4.1292 +    STRING, and returns a pointer to it. */
  4.1293 +Index: support/shobj-conf
  4.1294 +--- support/shobj-conf.orig	2009-10-28 14:20:21.000000000 +0100
  4.1295 ++++ support/shobj-conf	2012-06-27 10:31:02.000000000 +0200
  4.1296 +@@ -157,7 +157,7 @@
  4.1297 + 	;;
  4.1298 + 
  4.1299 + # Darwin/MacOS X
  4.1300 +-darwin[89]*|darwin10*)
  4.1301 ++darwin[89]*|darwin1[012]*)
  4.1302 + 	SHOBJ_STATUS=supported
  4.1303 + 	SHLIB_STATUS=supported
  4.1304 + 	
  4.1305 +@@ -186,7 +186,7 @@
  4.1306 + 	SHLIB_LIBSUFF='dylib'
  4.1307 + 
  4.1308 + 	case "${host_os}" in
  4.1309 +-	darwin[789]*|darwin10*)	SHOBJ_LDFLAGS=''
  4.1310 ++	darwin[789]*|darwin1[012]*)	SHOBJ_LDFLAGS=''
  4.1311 + 			SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
  4.1312 + 			;;
  4.1313 + 	*)		SHOBJ_LDFLAGS='-dynamic'
  4.1314 +Index: tests/shopt.right
  4.1315 +--- tests/shopt.right.orig	2010-07-03 05:36:30.000000000 +0200
  4.1316 ++++ tests/shopt.right	2012-06-27 10:31:03.000000000 +0200
  4.1317 +@@ -12,6 +12,7 @@
  4.1318 + shopt -u compat32
  4.1319 + shopt -u compat40
  4.1320 + shopt -u compat41
  4.1321 ++shopt -u direxpand
  4.1322 + shopt -u dirspell
  4.1323 + shopt -u dotglob
  4.1324 + shopt -u execfail
  4.1325 +@@ -68,6 +69,7 @@
  4.1326 + shopt -u compat32
  4.1327 + shopt -u compat40
  4.1328 + shopt -u compat41
  4.1329 ++shopt -u direxpand
  4.1330 + shopt -u dirspell
  4.1331 + shopt -u dotglob
  4.1332 + shopt -u execfail
  4.1333 +@@ -101,6 +103,7 @@
  4.1334 + compat32       	off
  4.1335 + compat40       	off
  4.1336 + compat41       	off
  4.1337 ++direxpand      	off
  4.1338 + dirspell       	off
  4.1339 + dotglob        	off
  4.1340 + execfail       	off
  4.1341 +Index: variables.c
  4.1342 +--- variables.c.orig	2011-01-25 02:07:48.000000000 +0100
  4.1343 ++++ variables.c	2012-06-27 10:31:02.000000000 +0200
  4.1344 +@@ -3653,6 +3653,22 @@
  4.1345 +   return n;
  4.1346 + }
  4.1347 + 
  4.1348 ++int
  4.1349 ++chkexport (name)
  4.1350 ++     char *name;
  4.1351 ++{
  4.1352 ++  SHELL_VAR *v;
  4.1353 ++
  4.1354 ++  v = find_variable (name);
  4.1355 ++  if (v && exported_p (v))
  4.1356 ++    {
  4.1357 ++      array_needs_making = 1;
  4.1358 ++      maybe_make_export_env ();
  4.1359 ++      return 1;
  4.1360 ++    }
  4.1361 ++  return 0;
  4.1362 ++}
  4.1363 ++
  4.1364 + void
  4.1365 + maybe_make_export_env ()
  4.1366 + {
  4.1367 +@@ -4214,7 +4230,7 @@
  4.1368 +   { "TEXTDOMAIN", sv_locale },
  4.1369 +   { "TEXTDOMAINDIR", sv_locale },
  4.1370 + 
  4.1371 +-#if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
  4.1372 ++#if defined (HAVE_TZSET)
  4.1373 +   { "TZ", sv_tz },
  4.1374 + #endif
  4.1375 + 
  4.1376 +@@ -4558,12 +4574,13 @@
  4.1377 + }
  4.1378 + #endif /* HISTORY */
  4.1379 + 
  4.1380 +-#if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
  4.1381 ++#if defined (HAVE_TZSET)
  4.1382 + void
  4.1383 + sv_tz (name)
  4.1384 +      char *name;
  4.1385 + {
  4.1386 +-  tzset ();
  4.1387 ++  if (chkexport (name))
  4.1388 ++    tzset ();
  4.1389 + }
  4.1390 + #endif
  4.1391 + 
  4.1392 +Index: variables.h
  4.1393 +--- variables.h.orig	2010-12-03 02:22:01.000000000 +0100
  4.1394 ++++ variables.h	2012-06-27 10:31:02.000000000 +0200
  4.1395 +@@ -313,6 +313,7 @@
  4.1396 + 
  4.1397 + extern void sort_variables __P((SHELL_VAR **));
  4.1398 + 
  4.1399 ++extern int chkexport __P((char *));
  4.1400 + extern void maybe_make_export_env __P((void));
  4.1401 + extern void update_export_env_inplace __P((char *, int, char *));
  4.1402 + extern void put_command_name_into_env __P((char *));
  4.1403 +Index: y.tab.c
  4.1404 +--- y.tab.c.orig	2011-01-04 15:57:56.000000000 +0100
  4.1405 ++++ y.tab.c	2012-06-27 10:31:03.000000000 +0200
  4.1406 +@@ -4811,7 +4811,7 @@
  4.1407 + 	 We do this only if it is time to do so. Notice that only here
  4.1408 + 	 is the mail alarm reset; nothing takes place in check_mail ()
  4.1409 + 	 except the checking of mail.  Please don't change this. */
  4.1410 +-      if (prompt_is_ps1 && time_to_check_mail ())
  4.1411 ++      if (prompt_is_ps1 && parse_and_execute_level == 0 && time_to_check_mail ())
  4.1412 + 	{
  4.1413 + 	  check_mail ();
  4.1414 + 	  reset_mail_timer ();
  4.1415 +@@ -6154,6 +6154,7 @@
  4.1416 +      int flags;
  4.1417 + {
  4.1418 +   sh_parser_state_t ps;
  4.1419 ++  sh_input_line_state_t ls;
  4.1420 +   int orig_ind, nc, sflags;
  4.1421 +   char *ret, *s, *ep, *ostring;
  4.1422 + 
  4.1423 +@@ -6161,10 +6162,12 @@
  4.1424 +   orig_ind = *indp;
  4.1425 +   ostring = string;
  4.1426 + 
  4.1427 ++/*itrace("xparse_dolparen: size = %d shell_input_line = `%s'", shell_input_line_size, shell_input_line);*/
  4.1428 +   sflags = SEVAL_NONINT|SEVAL_NOHIST|SEVAL_NOFREE;
  4.1429 +   if (flags & SX_NOLONGJMP)
  4.1430 +     sflags |= SEVAL_NOLONGJMP;
  4.1431 +   save_parser_state (&ps);
  4.1432 ++  save_input_line_state (&ls);
  4.1433 + 
  4.1434 +   /*(*/
  4.1435 +   parser_state |= PST_CMDSUBST|PST_EOFTOKEN;	/* allow instant ')' */ /*(*/
  4.1436 +@@ -6173,6 +6176,8 @@
  4.1437 + 
  4.1438 +   restore_parser_state (&ps);
  4.1439 +   reset_parser ();
  4.1440 ++  /* reset_parser clears shell_input_line and associated variables */
  4.1441 ++  restore_input_line_state (&ls);
  4.1442 +   if (interactive)
  4.1443 +     token_to_read = 0;
  4.1444 + 
  4.1445 +@@ -7447,6 +7452,9 @@
  4.1446 + 	    case 'A':
  4.1447 + 	      /* Make the current time/date into a string. */
  4.1448 + 	      (void) time (&the_time);
  4.1449 ++#if defined (HAVE_TZSET)
  4.1450 ++	      sv_tz ("TZ");		/* XXX -- just make sure */
  4.1451 ++#endif
  4.1452 + 	      tm = localtime (&the_time);
  4.1453 + 
  4.1454 + 	      if (c == 'd')
  4.1455 +@@ -8217,6 +8225,12 @@
  4.1456 +   ps->expand_aliases = expand_aliases;
  4.1457 +   ps->echo_input_at_read = echo_input_at_read;
  4.1458 + 
  4.1459 ++  ps->token = token;
  4.1460 ++  ps->token_buffer_size = token_buffer_size;
  4.1461 ++  /* Force reallocation on next call to read_token_word */
  4.1462 ++  token = 0;
  4.1463 ++  token_buffer_size = 0;
  4.1464 ++
  4.1465 +   return (ps);
  4.1466 + }
  4.1467 + 
  4.1468 +@@ -8258,6 +8272,42 @@
  4.1469 + 
  4.1470 +   expand_aliases = ps->expand_aliases;
  4.1471 +   echo_input_at_read = ps->echo_input_at_read;
  4.1472 ++
  4.1473 ++  FREE (token);
  4.1474 ++  token = ps->token;
  4.1475 ++  token_buffer_size = ps->token_buffer_size;
  4.1476 ++}
  4.1477 ++
  4.1478 ++sh_input_line_state_t *
  4.1479 ++save_input_line_state (ls)
  4.1480 ++     sh_input_line_state_t *ls;
  4.1481 ++{
  4.1482 ++  if (ls == 0)
  4.1483 ++    ls = (sh_input_line_state_t *)xmalloc (sizeof (sh_input_line_state_t));
  4.1484 ++  if (ls == 0)
  4.1485 ++    return ((sh_input_line_state_t *)NULL);
  4.1486 ++
  4.1487 ++  ls->input_line = shell_input_line;
  4.1488 ++  ls->input_line_size = shell_input_line_size;
  4.1489 ++  ls->input_line_len = shell_input_line_len;
  4.1490 ++  ls->input_line_index = shell_input_line_index;
  4.1491 ++
  4.1492 ++  /* force reallocation */
  4.1493 ++  shell_input_line = 0;
  4.1494 ++  shell_input_line_size = shell_input_line_len = shell_input_line_index = 0;
  4.1495 ++}
  4.1496 ++
  4.1497 ++void
  4.1498 ++restore_input_line_state (ls)
  4.1499 ++     sh_input_line_state_t *ls;
  4.1500 ++{
  4.1501 ++  FREE (shell_input_line);
  4.1502 ++  shell_input_line = ls->input_line;
  4.1503 ++  shell_input_line_size = ls->input_line_size;
  4.1504 ++  shell_input_line_len = ls->input_line_len;
  4.1505 ++  shell_input_line_index = ls->input_line_index;
  4.1506 ++
  4.1507 ++  set_line_mbstate ();
  4.1508 + }
  4.1509 + 
  4.1510 + /************************************************
     5.1 --- a/openpkg/beecrypt.patch	Tue Jul 31 12:12:54 2012 +0200
     5.2 +++ b/openpkg/beecrypt.patch	Tue Jul 31 12:23:42 2012 +0200
     5.3 @@ -1,50 +1,64 @@
     5.4 -Index: gas/aesopt.x86.m4
     5.5 ---- gas/aesopt.x86.m4.orig	2004-06-13 13:37:23 +0200
     5.6 -+++ gas/aesopt.x86.m4	2004-07-28 20:02:07 +0200
     5.7 -@@ -134,6 +134,9 @@
     5.8 - 	pxor 6144(%esi,%edx,8),s0
     5.9 - ')
    5.10 +Index: configure
    5.11 +--- configure.orig	2009-07-12 09:19:15 +0200
    5.12 ++++ configure	2010-01-07 18:10:28 +0100
    5.13 +@@ -2821,7 +2821,7 @@
    5.14 + # Check whether --enable-expert-mode was given.
    5.15 + if test "${enable_expert_mode+set}" = set; then
    5.16 +   enableval=$enable_expert_mode;
    5.17 +-  ac_enable_expert_mode=yes
    5.18 ++  ac_enable_expert_mode=$enableval
    5.19   
    5.20 -+')
    5.21 -+ifdef(`USE_MMX',`
    5.22 -+
    5.23 - define(`elr',`
    5.24 - 	movd  0(%ebp),s0
    5.25 - 	movd t0,%eax
    5.26 -@@ -253,6 +256,9 @@
    5.27 - ')
    5.28 + else
    5.29   
    5.30 +@@ -4502,13 +4502,7 @@
    5.31 + if $ac_preproc_ok; then
    5.32 +   :
    5.33 + else
    5.34 +-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
    5.35 +-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
    5.36 +-{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
    5.37 +-See \`config.log' for more details." >&5
    5.38 +-$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
    5.39 +-See \`config.log' for more details." >&2;}
    5.40 +-   { (exit 1); exit 1; }; }; }
    5.41 ++  :
    5.42 + fi
    5.43   
    5.44 -+')
    5.45 -+ifdef(`USE_MMX',`
    5.46 -+
    5.47 - C_FUNCTION_BEGIN(aesEncrypt)
    5.48 - 	pushl %edi
    5.49 - 	pushl %esi
    5.50 -@@ -364,6 +370,9 @@
    5.51 - 	pxor 6144(%esi,%edx,8),t2
    5.52 - ')
    5.53 + ac_ext=c
    5.54 +@@ -6170,13 +6164,7 @@
    5.55 + if $ac_preproc_ok; then
    5.56 +   :
    5.57 + else
    5.58 +-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
    5.59 +-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
    5.60 +-{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
    5.61 +-See \`config.log' for more details." >&5
    5.62 +-$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
    5.63 +-See \`config.log' for more details." >&2;}
    5.64 +-   { (exit 1); exit 1; }; }; }
    5.65 ++  :
    5.66 + fi
    5.67   
    5.68 -+')
    5.69 -+ifdef(`USE_MMX',`
    5.70 -+
    5.71 - define(`dsft',`
    5.72 - 	movd $1+ 0(%ebp),s0
    5.73 - 	movd t0,%eax
    5.74 -@@ -490,6 +499,9 @@
    5.75 - 	pxor t3,s2
    5.76 - ')
    5.77 + ac_ext=c
    5.78 +@@ -6901,13 +6889,7 @@
    5.79 + if $ac_preproc_ok; then
    5.80 +   :
    5.81 + else
    5.82 +-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
    5.83 +-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
    5.84 +-{ { $as_echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
    5.85 +-See \`config.log' for more details." >&5
    5.86 +-$as_echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
    5.87 +-See \`config.log' for more details." >&2;}
    5.88 +-   { (exit 1); exit 1; }; }; }
    5.89 ++  :
    5.90 + fi
    5.91   
    5.92 -+')
    5.93 -+ifdef(`USE_MMX',`
    5.94 -+
    5.95 - define(`dblock',`
    5.96 - 	sxrk
    5.97 - 
    5.98 + ac_ext=c
    5.99  Index: gnu.h.in
   5.100 ---- gnu.h.in.orig	2004-12-19 21:18:48 +0100
   5.101 -+++ gnu.h.in	2005-03-08 19:34:03 +0100
   5.102 -@@ -48,15 +48,6 @@
   5.103 +--- gnu.h.in.orig	2009-06-18 21:56:25 +0200
   5.104 ++++ gnu.h.in	2010-01-07 18:10:08 +0100
   5.105 +@@ -59,15 +59,6 @@
   5.106   @TYPEDEF_UINT32_T@
   5.107   @TYPEDEF_UINT64_T@
   5.108   
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/openpkg/build.8	Tue Jul 31 12:23:42 2012 +0200
     6.3 @@ -0,0 +1,513 @@
     6.4 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
     6.5 +.\"
     6.6 +.\" Standard preamble:
     6.7 +.\" ========================================================================
     6.8 +.de Sp \" Vertical space (when we can't use .PP)
     6.9 +.if t .sp .5v
    6.10 +.if n .sp
    6.11 +..
    6.12 +.de Vb \" Begin verbatim text
    6.13 +.ft CW
    6.14 +.nf
    6.15 +.ne \\$1
    6.16 +..
    6.17 +.de Ve \" End verbatim text
    6.18 +.ft R
    6.19 +.fi
    6.20 +..
    6.21 +.\" Set up some character translations and predefined strings.  \*(-- will
    6.22 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
    6.23 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
    6.24 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
    6.25 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
    6.26 +.\" nothing in troff, for use with C<>.
    6.27 +.tr \(*W-
    6.28 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
    6.29 +.ie n \{\
    6.30 +.    ds -- \(*W-
    6.31 +.    ds PI pi
    6.32 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
    6.33 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
    6.34 +.    ds L" ""
    6.35 +.    ds R" ""
    6.36 +.    ds C` 
    6.37 +.    ds C' 
    6.38 +'br\}
    6.39 +.el\{\
    6.40 +.    ds -- \|\(em\|
    6.41 +.    ds PI \(*p
    6.42 +.    ds L" ``
    6.43 +.    ds R" ''
    6.44 +'br\}
    6.45 +.\"
    6.46 +.\" Escape single quotes in literal strings from groff's Unicode transform.
    6.47 +.ie \n(.g .ds Aq \(aq
    6.48 +.el       .ds Aq '
    6.49 +.\"
    6.50 +.\" If the F register is turned on, we'll generate index entries on stderr for
    6.51 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
    6.52 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
    6.53 +.\" output yourself in some meaningful fashion.
    6.54 +.ie \nF \{\
    6.55 +.    de IX
    6.56 +.    tm Index:\\$1\t\\n%\t"\\$2"
    6.57 +..
    6.58 +.    nr % 0
    6.59 +.    rr F
    6.60 +.\}
    6.61 +.el \{\
    6.62 +.    de IX
    6.63 +..
    6.64 +.\}
    6.65 +.\"
    6.66 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
    6.67 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
    6.68 +.    \" fudge factors for nroff and troff
    6.69 +.if n \{\
    6.70 +.    ds #H 0
    6.71 +.    ds #V .8m
    6.72 +.    ds #F .3m
    6.73 +.    ds #[ \f1
    6.74 +.    ds #] \fP
    6.75 +.\}
    6.76 +.if t \{\
    6.77 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
    6.78 +.    ds #V .6m
    6.79 +.    ds #F 0
    6.80 +.    ds #[ \&
    6.81 +.    ds #] \&
    6.82 +.\}
    6.83 +.    \" simple accents for nroff and troff
    6.84 +.if n \{\
    6.85 +.    ds ' \&
    6.86 +.    ds ` \&
    6.87 +.    ds ^ \&
    6.88 +.    ds , \&
    6.89 +.    ds ~ ~
    6.90 +.    ds /
    6.91 +.\}
    6.92 +.if t \{\
    6.93 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
    6.94 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
    6.95 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
    6.96 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
    6.97 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
    6.98 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
    6.99 +.\}
   6.100 +.    \" troff and (daisy-wheel) nroff accents
   6.101 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
   6.102 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
   6.103 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
   6.104 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
   6.105 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
   6.106 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
   6.107 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
   6.108 +.ds ae a\h'-(\w'a'u*4/10)'e
   6.109 +.ds Ae A\h'-(\w'A'u*4/10)'E
   6.110 +.    \" corrections for vroff
   6.111 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
   6.112 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
   6.113 +.    \" for low resolution devices (crt and lpr)
   6.114 +.if \n(.H>23 .if \n(.V>19 \
   6.115 +\{\
   6.116 +.    ds : e
   6.117 +.    ds 8 ss
   6.118 +.    ds o a
   6.119 +.    ds d- d\h'-1'\(ga
   6.120 +.    ds D- D\h'-1'\(hy
   6.121 +.    ds th \o'bp'
   6.122 +.    ds Th \o'LP'
   6.123 +.    ds ae ae
   6.124 +.    ds Ae AE
   6.125 +.\}
   6.126 +.rm #[ #] #H #V #F C
   6.127 +.\" ========================================================================
   6.128 +.\"
   6.129 +.IX Title "BUILD 8"
   6.130 +.TH BUILD 8 "OpenPKG" "BUILD(8)" "OpenPKG"
   6.131 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   6.132 +.\" way too many mistakes in technical documents.
   6.133 +.if n .ad l
   6.134 +.nh
   6.135 +.SH "NAME"
   6.136 +openpkg build \- OpenPKG Package Building and Installing
   6.137 +.SH "SYNOPSIS"
   6.138 +.IX Header "SYNOPSIS"
   6.139 +\&\fBopenpkg\fR
   6.140 +\&\fBbuild\fR
   6.141 +[\fB\-R\fR \fIrpm\fR]
   6.142 +[\fB\-r\fR \fIrepository\fR]
   6.143 +[\fB\-f\fR \fIindex.rdf\fR]
   6.144 +[\fB\-u\fR]
   6.145 +[\fB\-U\fR]
   6.146 +[\fB\-z\fR]
   6.147 +[\fB\-Z\fR]
   6.148 +[\fB\-i\fR]
   6.149 +[\fB\-q\fR]
   6.150 +[\fB\-s\fR]
   6.151 +[\fB\-S\fR]
   6.152 +[\fB\-M\fR]
   6.153 +[\fB\-L\fR]
   6.154 +[\fB\-W\fR]
   6.155 +[\fB\-X\fR]
   6.156 +[\fB\-K\fR]
   6.157 +[\fB\-k\fR]
   6.158 +[\fB\-e\fR]
   6.159 +[\fB\-b\fR]
   6.160 +[\fB\-B\fR]
   6.161 +[\fB\-G\fR]
   6.162 +[\fB\-P\fR \fIpriv-cmd\fR]
   6.163 +[\fB\-N\fR \fInon-priv-cmd\fR]
   6.164 +[\fB\-p\fR \fIplatform\fR]
   6.165 +[\fB\-D\fR \fIvar\fR=\fIval\fR ...]
   6.166 +[\fB\-E\fR \fIname\fR ...]
   6.167 +[\fB\-H\fR \fIname\fR ...]
   6.168 +([\fB\-a\fR] [\fB\-A\fR] | \fIpattern\fR ...)
   6.169 +.SH "DESCRIPTION"
   6.170 +.IX Header "DESCRIPTION"
   6.171 +The \fBopenpkg build\fR tool provides automated recursive from-scratch
   6.172 +installation of packages and the updating and upgrading of installed
   6.173 +packages.
   6.174 +.PP
   6.175 +It generates a Bourne-Shell script on standard output (\fIstdout\fR)
   6.176 +that can be executed to perform the package installation or
   6.177 +updating/upgrading procedure for all requested packages and their
   6.178 +dependencies.
   6.179 +.PP
   6.180 +Packages that are upgraded automatically trigger rebuilds of all
   6.181 +packages that depend on the upgraded package (\*(L"reverse dependencies\*(R").
   6.182 +The dependency information is read from an \s-1XML/RDF\s0 index generated by
   6.183 +the companion tool \fBopenpkg index\fR.
   6.184 +.SH "ARGUMENTS"
   6.185 +.IX Header "ARGUMENTS"
   6.186 +Packages are selected by providing a list of name patterns. Each
   6.187 +pattern is either a package name or a name prefix followed by a '\fI*\fR'
   6.188 +character. Additionally, in order to resolve ambiguous dependencies, you
   6.189 +can append a discrimination prefix separated by a comma that matches
   6.190 +against the full "\fIname\fR\-\fIversion\fR\-\fIrevision\fR" string of a package.
   6.191 +.SH "OPTIONS"
   6.192 +.IX Header "OPTIONS"
   6.193 +The following command line options exist:
   6.194 +.IP "\fB\-R\fR \fIcommand\fR" 4
   6.195 +.IX Item "-R command"
   6.196 +Specify the "\fBopenpkg rpm\fR" command with fully qualified path.
   6.197 +Several other internal paths are deduced from the \fIcommand\fR path,
   6.198 +so this has to be something like "\fIprefix\fR\f(CW\*(C`/bin/openpkg rpm\*(C'\fR".
   6.199 +.IP "\fB\-r\fR \fIrepository\fR" 4
   6.200 +.IX Item "-r repository"
   6.201 +Specify the path to an OpenPKG \s-1RPM\s0 package repository.
   6.202 +This can be a \s-1URL\s0 (including \*(L"file://\*(R") to download packages from or
   6.203 +an absolute directory path (identified by leading \*(L"/\*(R") or
   6.204 +a relative directory path (identified by leading \*(L"./\*(R") to access packages directly.
   6.205 +The name of the package file is appended to this path.
   6.206 +The default is to use a \s-1URL\s0 pointing to the \fBOpenPKG\fR download service
   6.207 +as determined by the "\fBopenpkg release\fR" command.
   6.208 +.IP "\fB\-f\fR \fIindex.rdf\fR" 4
   6.209 +.IX Item "-f index.rdf"
   6.210 +Specify the path to the primary \s-1XML/RDF\s0 index. This can be a \s-1URL\s0 or a
   6.211 +file path. If the index contains references to other indices, these
   6.212 +are recursively included automatically. The default is to use a \s-1URL\s0
   6.213 +pointing to the \fBOpenPKG\fR \s-1FTP\s0 server as as determined by the "\fBopenpkg
   6.214 +release\fR" command.
   6.215 +.IP "\fB\-u\fR" 4
   6.216 +.IX Item "-u"
   6.217 +The generated script will ignore binary RPMs that are stored on
   6.218 +your system. Instead it will either fetch binary RPMs or rebuild
   6.219 +from source RPMs fetched from the repository.
   6.220 +.IP "\fB\-U\fR" 4
   6.221 +.IX Item "-U"
   6.222 +The generated script will try to upgrade all selected packages
   6.223 +including their dependencies to the most recent version. Use
   6.224 +this for usual upgrade tasks in combination with option "\fB\-a\fR".
   6.225 +.IP "\fB\-z\fR" 4
   6.226 +.IX Item "-z"
   6.227 +The generated script will rebuild all selected packages
   6.228 +including their dependencies even when the most recent version
   6.229 +is already installed.
   6.230 +.IP "\fB\-Z\fR" 4
   6.231 +.IX Item "-Z"
   6.232 +\&\fBopenpkg build\fR ignores all installed packages, the
   6.233 +generated script will rebuild all selected packages from scratch.
   6.234 +.IP "\fB\-i\fR" 4
   6.235 +.IX Item "-i"
   6.236 +The generated script will ignore run-time errors.
   6.237 +.IP "\fB\-q\fR" 4
   6.238 +.IX Item "-q"
   6.239 +Ignore all reverse dependencies. This means that all packages which are
   6.240 +rebuild do \fInot\fR trigger a rebuild of packages which depend on them.
   6.241 +\&\fI\s-1ATTENTION:\s0 this might break already installed packages and has to be
   6.242 +used with care! You should really know what you are doing.\fR
   6.243 +.IP "\fB\-s\fR" 4
   6.244 +.IX Item "-s"
   6.245 +Generate a status map instead of the shell script. The map consists
   6.246 +of 3 columns: \fIold\fR, \fItag\fR and \fInew\fR. The \fIold\fR column shows
   6.247 +the installed version of a package (\fIname\fR\-\fIversion\fR\-\fIrelease\fR)
   6.248 +or just the package name (\fIname\fR) if no package of that name
   6.249 +is installed and the \fInew\fR column shows the repository version
   6.250 +(\fIname\fR\-\fIversion\fR\-\fIrelease\fR) of a package if it is considered for
   6.251 +installation. The \fItag\fR column shows the following possible values:
   6.252 +.RS 4
   6.253 +.IP "\s-1OK\s0" 10
   6.254 +.IX Item "OK"
   6.255 +The installed package is suitable and will not be touched.
   6.256 +.IP "\s-1ADD\s0" 10
   6.257 +.IX Item "ADD"
   6.258 +There is no installed package yet.
   6.259 +.IP "\s-1UPGRADE\s0" 10
   6.260 +.IX Item "UPGRADE"
   6.261 +The installed package is outdated and requires an update.
   6.262 +.IP "\s-1DEPEND\s0" 10
   6.263 +.IX Item "DEPEND"
   6.264 +The installed package needs rebuilding because one of its
   6.265 +dependencies is rebuild.
   6.266 +.IP "\s-1MISMATCH\s0" 10
   6.267 +.IX Item "MISMATCH"
   6.268 +The installed package needs rebuilding because it was build
   6.269 +with different parameters.
   6.270 +.IP "\s-1CONFLICT\s0" 10
   6.271 +.IX Item "CONFLICT"
   6.272 +The required new package cannot be installed because it
   6.273 +conflicts with some already installed package.
   6.274 +.IP "\s-1UNDEF\s0" 10
   6.275 +.IX Item "UNDEF"
   6.276 +The package has an invalid or ambiguous dependency.
   6.277 +.RE
   6.278 +.RS 4
   6.279 +.RE
   6.280 +.IP "\fB\-S\fR" 4
   6.281 +.IX Item "-S"
   6.282 +Similar to option "\fB\-s\fR" but also lists the newest versions in the
   6.283 +repository. The following \fItag\fR might appear in the map:
   6.284 +.RS 4
   6.285 +.IP "\s-1NEW\s0" 10
   6.286 +.IX Item "NEW"
   6.287 +The package exists in the repository but is not required yet.
   6.288 +.RE
   6.289 +.RS 4
   6.290 +.RE
   6.291 +.IP "\fB\-M\fR" 4
   6.292 +.IX Item "-M"
   6.293 +Similar to option "\fB\-s\fR" but print a short dependency map.
   6.294 +.IP "\fB\-L\fR" 4
   6.295 +.IX Item "-L"
   6.296 +Print a list of packages in the repository that depend on the target.
   6.297 +.IP "\fB\-W\fR" 4
   6.298 +.IX Item "-W"
   6.299 +Include all conditional dependencies as if all possible configuration
   6.300 +options had been switched on. This has little use in practice except for
   6.301 +generating an all-inclusive list with option "\fB\-L\fR". \fI\s-1ATTENTION:\s0 Even
   6.302 +mutually exclusive options are evaluated to be 'on', building packages
   6.303 +with option \*(L"\-W\*(R" therefore might fail or cause unusable results!\fR
   6.304 +.IP "\fB\-X\fR" 4
   6.305 +.IX Item "-X"
   6.306 +Use the slower but more robust external Perl \s-1XML\s0 parser module
   6.307 +XML::Simple instead of the simple internal \s-1XML/RDF\s0 parser.
   6.308 +.IP "\fB\-K\fR" 4
   6.309 +.IX Item "-K"
   6.310 +Keep packages that were installed temporarily during the build process.
   6.311 +Without this option those packages are removed.
   6.312 +.IP "\fB\-k\fR" 4
   6.313 +.IX Item "-k"
   6.314 +Keep packages that were downloaded temporarily for installation or building.
   6.315 +Without this option those packages are removed.
   6.316 +.IP "\fB\-e\fR" 4
   6.317 +.IX Item "-e"
   6.318 +Rebuild exact version of a package from repository even when you have
   6.319 +installed a newer version from another repository.
   6.320 +.IP "\fB\-b\fR" 4
   6.321 +.IX Item "-b"
   6.322 +Wrap package rebuilding commands with script execution-time checks for
   6.323 +existing binary packages if the package is rebuild as a dependency. Wrap
   6.324 +package install commands with script execution-time checks for different
   6.325 +\&\s-1MD5\s0 signature checksums of binary packages and installed packages. This
   6.326 +is best to use with option "\fB\-u\fR" to defer all such checks until script
   6.327 +execution-time.
   6.328 +.IP "\fB\-B\fR" 4
   6.329 +.IX Item "-B"
   6.330 +Same as option "\fB\-b\fR" but also check all explicit target packages for
   6.331 +existing binary packages at script execution-time.
   6.332 +.IP "\fB\-g\fR" 4
   6.333 +.IX Item "-g"
   6.334 +The generated script will rebuild all packages selected even when the
   6.335 +most recent version is already installed. Dependencies are not affected.
   6.336 +Use this especially for updating a package with different build options
   6.337 +(see option "\fB\-D\fR").
   6.338 +.IP "\fB\-P\fR \fIpriv-cmd\fR" 4
   6.339 +.IX Item "-P priv-cmd"
   6.340 +Command prefix to use for generated script commands that require
   6.341 +elevated privileges (like "\fBopenpkg rpm \-Uvh\fR"). The most common tool
   6.342 +for this is \fIsudo\fR\|(8). If \fIpriv-cmd\fR starts with a dash it will be run
   6.343 +without the dash and the command line it should execute is passed as
   6.344 +a single quoted string. Use this option for upgrading privileges. For
   6.345 +instance, if you are running the \f(CW\*(C`openpkg build\*(C'\fR\*(L" command as the
   6.346 +management user, use \*(R"\f(CW\*(C`\-P sudo\*(C'\fR\*(L" to make sure that the \*(R"\fBopenpkg rpm
   6.347 +\&\-Uvh\fR" commands in the generated script execute with necessary elevated
   6.348 +privileges.
   6.349 +.IP "\fB\-N\fR \fInon-priv-cmd\fR" 4
   6.350 +.IX Item "-N non-priv-cmd"
   6.351 +Command prefix to use for generated script commands that do \fInot\fR
   6.352 +require elevated privileges (like "\fBopenpkg rpm \-\-rebuild\fR"). The most
   6.353 +common tool for this is \fIsu\fR\|(8). If \fInon-priv-cmd\fR starts with a dash
   6.354 +it will be run without the dash and the command line it should execute
   6.355 +is passed as a single quoted string. Use this option for downgrading
   6.356 +privileges. For instance, if you are running the \f(CW\*(C`openpkg build\*(C'\fR"
   6.357 +command as the \fBroot\fR user, use "\f(CW\*(C`\-N \*(Aq\-su \- \*(C'\fR\fImusr\fR\f(CW\*(C` \-c\*(Aq\*(C'\fR" to make
   6.358 +sure that the non-privileged commands in the generated script execute
   6.359 +with privileges of the management user \fImusr\fR.
   6.360 +.IP "\fB\-p\fR \fIplatform\fR" 4
   6.361 +.IX Item "-p platform"
   6.362 +The platform string that is matched against the \s-1XML/RDF\s0 index for binary
   6.363 +packages. The default is an empty \fIplatform\fR string so that no binary
   6.364 +packages are matched at all.
   6.365 +.IP "\fB\-D\fR \fIvar\fR=\fIval\fR" 4
   6.366 +.IX Item "-D var=val"
   6.367 +Specify build options for selected packages. This can be either
   6.368 +"\fB\-D\fR \fIwith_xxx\fR=\fIyyy\fR\*(L" or just \*(R"\fB\-D\fR \fIwith_xxx\fR\*(L". The latter is
   6.369 +equivalent to a \*(R"\fB\-D\fR \fIwith_xxx\fR=\fIyes\fR\*(L". The parameters are matched
   6.370 +against selected packages that are already installed. If they do
   6.371 +indicate a change, the package is rebuild. There can be multiple \*(R"\fB\-D\fR"
   6.372 +options.
   6.373 +.Sp
   6.374 +If the option name is prefixed with a package name followed by
   6.375 +two colons then it applies only to the specified package, e.g.,
   6.376 +"\fB\-D\fR\fIfoo::with_bar\fR".
   6.377 +.IP "\fB\-E\fR \fIname\fR" 4
   6.378 +.IX Item "-E name"
   6.379 +Ignore a package with the specified \fIname\fR. This can be used to avoid
   6.380 +upgrading to a broken package in the repository or to skip a package
   6.381 +upgrade temporarily. If you use a wildcard pattern or the options
   6.382 +"\fB\-a\fR\*(L" or \*(R"\fB\-A\fR" then \fIname\fR will be excluded. There can be multiple
   6.383 +"\fB\-E\fR" options.
   6.384 +.IP "\fB\-H\fR \fIname\fR" 4
   6.385 +.IX Item "-H name"
   6.386 +Hint about packages that should be preferred when more than one fits
   6.387 +a requirement. There can be multiple "\fB\-H\fR" options.
   6.388 +.IP "\fB\-a\fR" 4
   6.389 +.IX Item "-a"
   6.390 +Select all installed packages. You cannot specify a pattern list together
   6.391 +with the "\fB\-a\fR" option.
   6.392 +.IP "\fB\-A\fR" 4
   6.393 +.IX Item "-A"
   6.394 +Select all packages in the repository. You cannot specify a pattern list
   6.395 +together with the "\fB\-A\fR" option.
   6.396 +.SH "ARGUMENTS"
   6.397 +.IX Header "ARGUMENTS"
   6.398 +In case neither option \fB\-a\fR nor option \fB\-A\fR are specified,
   6.399 +the command line has to contain one or more package \fIpattern\fR
   6.400 +arguments. Each \fIpattern\fR can have the following forms:
   6.401 +.IP "\fIname\fR" 4
   6.402 +.IX Item "name"
   6.403 +A regular package name.
   6.404 +.IP "\fIname\fR\fB*\fR" 4
   6.405 +.IX Item "name*"
   6.406 +A package name wildcard pattern.
   6.407 +.IP "\fIname\fR\fB,\fR\fIname\fR[\fB\-\fR\fIversion\fR[\fB\-\fR\fIrelease\fR]]" 4
   6.408 +.IX Item "name,name[-version[-release]]"
   6.409 +A regular package name followed by a constraint
   6.410 +which particular package should be chosen.
   6.411 +.SH "CONFIGURATION"
   6.412 +.IX Header "CONFIGURATION"
   6.413 +\&\fBopenpkg build\fR reads the configuration file \fI\f(CI$HOME\fI/.openpkg/build\fR.
   6.414 +The file lists default options, one option per line and section tags
   6.415 +of the form \f(CW\*(C`[\*(C'\fR\fIprefix\fR\f(CW\*(C`]\*(C'\fR. Options following such a tag are only
   6.416 +evaluated for the particular \fBOpenPKG\fR instance so that you can
   6.417 +define default options for multiple \fBOpenPKG\fR instances.
   6.418 +.PP
   6.419 +Example:
   6.420 +.PP
   6.421 +.Vb 2
   6.422 +\& # global options
   6.423 +\& \-X
   6.424 +\&
   6.425 +\& [/openpkg/current]
   6.426 +\& # options for CURRENT stack only
   6.427 +\& \-r http://download.openpkg.org/stacks/current/source/
   6.428 +\&
   6.429 +\& [/openpkg/foo]
   6.430 +\& # options for a FOO stack only
   6.431 +\& \-r http://download.openpkg.org/stacks/foo/source/
   6.432 +.Ve
   6.433 +.SH "EXAMPLES"
   6.434 +.IX Header "EXAMPLES"
   6.435 +The following shows a few typical OpenPKG instance
   6.436 +maintenance tasks which involve the \fBopenpkg build\fR command:
   6.437 +.SS "Installation"
   6.438 +.IX Subsection "Installation"
   6.439 +The following examples shows how to initially install an OpenPKG
   6.440 +instance under \fI/openpkg\fR with Apache/PHP & MySQL:
   6.441 +.PP
   6.442 +.Vb 5
   6.443 +\& # bootstrap the OpenPKG instance
   6.444 +\& $ curl \-L \-O http://openpkg.org/go/download/openpkg.src.sh
   6.445 +\& $ sh openpkg\-*\-*.src.sh \-\-prefix=/openpkg \e
   6.446 +\&   \-\-user=openpkg \-\-group=openpkg \-\-tag=openpkg
   6.447 +\& $ sh openpkg\-*\-*.*\-*\-openpkg.sh
   6.448 +\&
   6.449 +\& # install Apache/PHP & MySQL
   6.450 +\& $ /openpkg/bin/openpkg build \e
   6.451 +\&   \-D apache\-php::with_mysql=yes \e
   6.452 +\&   apache apache\-php mysql | sh
   6.453 +.Ve
   6.454 +.SS "Reinstallation"
   6.455 +.IX Subsection "Reinstallation"
   6.456 +The following example shows how to rebuild and reinstall the already
   6.457 +installed package \*(L"foo\*(R":
   6.458 +.PP
   6.459 +.Vb 2
   6.460 +\& # rebuild and reinstall package
   6.461 +\& $ /openpkg/bin/openpkg build \-g \-u foo | sh
   6.462 +.Ve
   6.463 +.SS "Change"
   6.464 +.IX Subsection "Change"
   6.465 +The following fictive example shows how to change the already
   6.466 +installed package \*(L"foo\*(R" by rebuilding and reinstalling it with the
   6.467 +"\f(CW\*(C`foo::with_bar\*(C'\fR" build-time option enabled.
   6.468 +.PP
   6.469 +.Vb 2
   6.470 +\& # change a package
   6.471 +\& $ /openpkg/bin/openpkg build \-g \-D with_bar=yes foo | sh
   6.472 +.Ve
   6.473 +.SS "Update"
   6.474 +.IX Subsection "Update"
   6.475 +The following example shows how to update (no major
   6.476 +OpenPKG version change) an OpenPKG instance under \fI/openpkg\fR:
   6.477 +.PP
   6.478 +.Vb 2
   6.479 +\& # update all packages to their latest version
   6.480 +\& $ /openpkg/bin/openpkg build \-Ua | sh
   6.481 +.Ve
   6.482 +.SS "Upgrade"
   6.483 +.IX Subsection "Upgrade"
   6.484 +The following examples shows a complete procedure for upgrading (major
   6.485 +OpenPKG version change) the instance under \fI/openpkg\fR to OpenPKG
   6.486 +4.X:
   6.487 +.PP
   6.488 +.Vb 3
   6.489 +\& # upgrade the bootstrap package
   6.490 +\& $ /openpkg/bin/openpkg build \e
   6.491 +\&   \-r http://download.openpkg.org/stacks/current/source/ openpkg | sh
   6.492 +\&
   6.493 +\& # upgrade the whole OpenPKG instance, in correct dependency
   6.494 +\& # order and by keeping all chosen build\-time options.
   6.495 +\& $ /openpkg/bin/openpkg build \-ZaKB | sh
   6.496 +.Ve
   6.497 +.SS "Deinstallation"
   6.498 +.IX Subsection "Deinstallation"
   6.499 +The following example shows how to deinstall
   6.500 +an entire OpenPKG intance under \fI/openpkg\fR:
   6.501 +.PP
   6.502 +.Vb 3
   6.503 +\& # remove all packages and the instance itself
   6.504 +\& $ /openpkg/bin/openpkg rpm \-e \e
   6.505 +\&   \`/openpkg/bin/openpkg rpm \-qa\`
   6.506 +.Ve
   6.507 +.SH "CAVEATS"
   6.508 +.IX Header "CAVEATS"
   6.509 +Parallel execution of \fBopenpkg build\fR causes undefined effects.
   6.510 +.SH "HISTORY"
   6.511 +.IX Header "HISTORY"
   6.512 +The \fBopenpkg build\fR command was invented in November 2002 by \fIMichael
   6.513 +van Elst\fR <mlelstv@serpens.de> under contract with \fICable
   6.514 +& Wireless\fR <http://www.cw.com/> for use inside the \fBOpenPKG\fR
   6.515 +project <http://www.openpkg.org/>. It was then further
   6.516 +refined by the \fBOpenPKG Foundation e.V.\fR as part of the OpenPKG Tool Chain.
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/openpkg/build.pl	Tue Jul 31 12:23:42 2012 +0200
     7.3 @@ -0,0 +1,2603 @@
     7.4 +##
     7.5 +##  build.pl -- OpenPKG Package Building and Installing
     7.6 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
     7.7 +##
     7.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
     7.9 +##  All rights reserved. Licenses which grant limited permission to use,
    7.10 +##  copy, modify and distribute this software are available from the
    7.11 +##  OpenPKG GmbH.
    7.12 +##
    7.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
    7.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    7.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    7.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    7.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    7.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    7.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    7.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    7.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    7.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    7.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    7.24 +##  SUCH DAMAGE.
    7.25 +##
    7.26 +
    7.27 +#############################################################################
    7.28 +##
    7.29 +##  MAIN PROCEDURE
    7.30 +##
    7.31 +#############################################################################
    7.32 +
    7.33 +require 5;
    7.34 +#use strict;
    7.35 +my (
    7.36 +   $opt_h,
    7.37 +   $opt_R, $opt_r, $opt_f, $opt_u, $opt_U, $opt_a, $opt_A,
    7.38 +   $opt_z, $opt_Z, $opt_P, $opt_N, $opt_E, $opt_H, $opt_i,
    7.39 +   $opt_D, $opt_p, $opt_q, $opt_s, $opt_S, $opt_X, $opt_M,
    7.40 +   $opt_L, $opt_W, $opt_K, $opt_e, $opt_b, $opt_B, $opt_g,
    7.41 +   $opt_k
    7.42 +);
    7.43 +
    7.44 +#   global context variables
    7.45 +my $prg = "openpkg build";
    7.46 +my %env = ('' => {});
    7.47 +
    7.48 +##
    7.49 +##  OPTION PARSING
    7.50 +##
    7.51 +
    7.52 +#   parse command line options
    7.53 +my $getopts = 'hR:r:f:uUaAzZP:N:E:H:iD:p:qsSXMLWKebBgk';
    7.54 +getopts($getopts);
    7.55 +
    7.56 +#   parse configuration script options
    7.57 +if (open(FH, "<$ENV{'HOME'}/.openpkg/build")) {
    7.58 +    my ($env) = $env{''};
    7.59 +    my ($go) = $getopts;
    7.60 +    $go =~ s/[^a-zA-Z]//g;
    7.61 +    while (my $line = <FH>) {
    7.62 +        if ($line =~ m/^\s*\[([^\]]*)\]/) {
    7.63 +            $env{$1} = {} unless ($env{$1});
    7.64 +            $env = $env{$1};
    7.65 +        } elsif (my ($opt, $val) = ($line =~ m/^\-([$go])\s*(.*?)\s*$/)) {
    7.66 +            $val = 1 unless (defined($val));
    7.67 +            if (exists($env->{$opt})) {
    7.68 +                $env->{$opt} .= " " . $val;
    7.69 +            } else {
    7.70 +                $env->{$opt} = $val;
    7.71 +            }
    7.72 +        }
    7.73 +    }
    7.74 +    close(FH);
    7.75 +}
    7.76 +
    7.77 +#   usage sanity check and usage help
    7.78 +sub usage {
    7.79 +    my ($rc) = @_;
    7.80 +    my $usage =
    7.81 +        "openpkg:build:USAGE: $prg [options] [pattern ...]\n" .
    7.82 +        " -a                operate on all installed packages\n" .
    7.83 +        " -A                operate on all repository packages\n" .
    7.84 +        " -R <rpm>          path to \"openpkg rpm\" command\n" .
    7.85 +        " -r <repository>   URL to package repository directory\n" .
    7.86 +        " -f <index.rdf>    URL to package repository index file\n" .
    7.87 +        " -u                ignore local binary RPMs\n" .
    7.88 +        " -U                upgrade all selected packages including dependencies\n" .
    7.89 +        " -z                rebuild from zero all selected installed packages\n" .
    7.90 +        " -Z                rebuild from zero all selected available packages\n" .
    7.91 +        " -i                ignore errors in the generated script\n" .
    7.92 +        " -q                ignore all reverse dependencies\n" .
    7.93 +        " -s                generate status map instead of shell script\n" .
    7.94 +        " -S                generate status map instead of shell script (including new)\n" .
    7.95 +        " -X                use external XML/RDF parser instead of internal one\n" .
    7.96 +        " -M                generate short dependency map instead of shell script\n" .
    7.97 +        " -L                generate list of packages in repository depending on target\n" .
    7.98 +        " -W                include dependencies as if all build options are enabled\n" .
    7.99 +        " -K                keep temporarily installed packages\n" .
   7.100 +        " -k                keep temporarily downloaded packages\n" .
   7.101 +        " -e                rebuild exact version of a package from repository\n" .
   7.102 +        " -b                build-time check existing binaries for dependencies only\n" .
   7.103 +        " -B                build-time check existing binaries for dependencies and target\n" .
   7.104 +        " -g                rebuild packages even when most recent version is installed\n" .
   7.105 +        " -P <priv-cmd>     command prefix for privileged commands\n" .
   7.106 +        " -N <non-priv-cmd> command prefix for non-privileged commands\n" .
   7.107 +        " -p <platform>     match platform against repository index for binary packages\n" .
   7.108 +        " -E <name>         exclude package\n" .
   7.109 +        " -H <name>         hint about packages to resolve ambiquity\n" .
   7.110 +        " -D <name>[=<val>] set build option for packages\n";
   7.111 +    if ($rc == 0) {
   7.112 +        print STDOUT $usage;
   7.113 +    }
   7.114 +    else {
   7.115 +        print STDERR $usage;
   7.116 +    }
   7.117 +    exit($rc);
   7.118 +}
   7.119 +if ($opt_h) {
   7.120 +    usage(0);
   7.121 +}
   7.122 +if (not (   ($#ARGV >= 0  && !($opt_a || $opt_A))
   7.123 +         || ($#ARGV == -1 &&  ($opt_a || $opt_A)))) {
   7.124 +    usage(1);
   7.125 +};
   7.126 +
   7.127 +#   determine RPM run-time information
   7.128 +my $config = rpm_runtime_info();
   7.129 +
   7.130 +#   override command line options with configuration script options
   7.131 +#   now that the effectively used OpenPKG RPM command is known
   7.132 +foreach my $env (sort { $a cmp $b } grep {
   7.133 +       $config->{"rpm"}    =~ m/^\Q$_\E/ # compatibility
   7.134 +    or $config->{"prefix"} =~ m/^\Q$_\E/ # regular
   7.135 +} keys %env) {
   7.136 +    while (my ($opt, $val) = each(%{$env{$env}})) {
   7.137 +        eval "\$opt_$opt = '$val' unless defined \$opt_$opt;";
   7.138 +    }
   7.139 +}
   7.140 +
   7.141 +##
   7.142 +##  OPTION POST-PROCESSING
   7.143 +##
   7.144 +
   7.145 +my ($url, $repository, $installed, $env, $list, $bonly, $clist);
   7.146 +my ($pattern, %with, %exclude, %hint);
   7.147 +
   7.148 +#   determine package goal pattern
   7.149 +if ($opt_a) {
   7.150 +    $pattern = undef;
   7.151 +} else {
   7.152 +    $pattern = join(' ', @ARGV);
   7.153 +}
   7.154 +if ($opt_A) {
   7.155 +    $pattern = '*';
   7.156 +}
   7.157 +
   7.158 +#   parse build options
   7.159 +%with = map {
   7.160 +      m/([^\s=]+)(?:\=(\S+))?/
   7.161 +    ? ($1 => (defined($2) ? $2 : 'yes'))
   7.162 +    : ()
   7.163 +} split(/\s+/, $opt_D);
   7.164 +
   7.165 +#   split accumulated option values
   7.166 +%exclude = map { $_ => 1 } split(/\s+/, $opt_E);
   7.167 +%hint    = map { $_ => 1 } split(/\s+/, $opt_H);
   7.168 +
   7.169 +if (defined($opt_p)) {
   7.170 +    $config->{platform} = $opt_p;
   7.171 +}
   7.172 +
   7.173 +#   determine RPM package repository information
   7.174 +if (defined $opt_r) {
   7.175 +    $url = $opt_r;
   7.176 +    $url .= '/' unless $url =~ m/\/$/;
   7.177 +} else {
   7.178 +    $url = rpm_release_url();
   7.179 +}
   7.180 +#   if we read the index from a file we can no longer deduce
   7.181 +#   repository paths from index paths. For now lets assume
   7.182 +#   that everything is below SRC/ to be compatible with
   7.183 +#   existing file indexes.
   7.184 +if (defined($opt_f) and not defined($opt_r)) {
   7.185 +    $url .= 'SRC/';
   7.186 +}
   7.187 +
   7.188 +#   determine information about INSTALLED packages (virtual and regular),
   7.189 +#   including their options, provides and requirements
   7.190 +my $installed = get_installed();
   7.191 +
   7.192 +#   SPECIAL CASE post-processing for
   7.193 +#   -Z (ignore installed packages)
   7.194 +#   -a (operate for all installed packages)
   7.195 +if ($opt_a and $opt_Z) {
   7.196 +    #   This allows one to correctly upgrade an existing OpenPKG
   7.197 +    #   instance to a newer major version by querying all installed
   7.198 +    #   packages and their options (-a) but then ignore them (-Z) during
   7.199 +    #   the later processing and instead perform more or less a fresh
   7.200 +    #   rebuild from scratch. This ensures that during the process the
   7.201 +    #   installed packages are effectively picked up as dependencies
   7.202 +    #   only after they in turn were already updated.
   7.203 +    foreach my $package (keys(%{$installed})) {
   7.204 +        next if ($package =~ m/::/);
   7.205 +        if (exists($installed->{$package}->{""})) {
   7.206 +            #   virtual package
   7.207 +            $hint{$installed->{$package}->{""}->[0]->{"name"}} = 1
   7.208 +                if (exists($installed->{$package}->{""}->[0]->{"name"}));
   7.209 +        }
   7.210 +        else {
   7.211 +            #   regular package
   7.212 +            $pattern .= " $package";
   7.213 +            foreach my $version (keys(%{$installed->{$package}})) {
   7.214 +                foreach my $rec (@{$installed->{$package}->{$version}}) {
   7.215 +                    if (defined($rec->{"OPTIONS"})) {
   7.216 +                        my $options = $rec->{"OPTIONS"};
   7.217 +                        foreach my $option (keys(%{$options})) {
   7.218 +                            $with{$package."::".$option} = $options->{$option};
   7.219 +                        }
   7.220 +                    }
   7.221 +                }
   7.222 +            }
   7.223 +        }
   7.224 +    }
   7.225 +}
   7.226 +if ($opt_Z) {
   7.227 +    $installed = {};
   7.228 +}
   7.229 +
   7.230 +#   determine information about AVAILABLE packages
   7.231 +#   by fetching and parsing a package repository XML/RDF index
   7.232 +$repository = get_index(
   7.233 +    $url . '00INDEX.rdf',
   7.234 +    $opt_f,
   7.235 +    $opt_X,
   7.236 +    $config->{platform},
   7.237 +    $installed
   7.238 +);
   7.239 +
   7.240 +#   assemble together all determined environment information
   7.241 +$env = {
   7.242 +    config     => $config,
   7.243 +    installed  => $installed,
   7.244 +    repository => $repository,
   7.245 +    built      => {},
   7.246 +    revdep     => undef,
   7.247 +    with       => \%with,
   7.248 +    exclude    => \%exclude,
   7.249 +    hint       => \%hint,
   7.250 +    upgrade    => ($opt_a || $opt_U),
   7.251 +    zero       => ($opt_z || $opt_Z),
   7.252 +    exact      => $opt_e,
   7.253 +    quick      => ($opt_q || $opt_z || $opt_Z),
   7.254 +    status     => ($opt_s || $opt_S),
   7.255 +    fatal      => [],
   7.256 +    goals      => $opt_g,
   7.257 +    sourceonly => ($opt_u || $opt_U || $opt_z || $opt_Z)
   7.258 +};
   7.259 +
   7.260 +##
   7.261 +##  PERFORM REQUESTED OPERATION
   7.262 +##
   7.263 +
   7.264 +if ($opt_L) {
   7.265 +    #   case 1: calculate dependencies only and
   7.266 +    #           print packages depending on target
   7.267 +    ($list) = build_deps($pattern, $env);
   7.268 +    print_deps($list);
   7.269 +} else {
   7.270 +    #   case 2: calculate build commands and
   7.271 +    #           print results in different formats
   7.272 +    ($list, $bonly, $clist) = build_list($pattern, $env);
   7.273 +    die "openpkg:build:FATAL: cannot find package\n" if (not defined($list));
   7.274 +    if ($opt_M) {
   7.275 +        print_map($installed, $repository, $list, $bonly, $clist);
   7.276 +    } elsif ($opt_S) {
   7.277 +        print_status($installed, $repository, $list, $bonly, $clist);
   7.278 +    } elsif ($opt_s) {
   7.279 +        print_status($installed, {}, $list, $bonly, $clist);
   7.280 +    } else {
   7.281 +        if (@{$env->{fatal}}) {
   7.282 +            die "openpkg:build:FATAL: errors occured while building:\n", @{$env->{fatal}}, "\n";
   7.283 +        }
   7.284 +        print_list1($list, $config, $opt_a || $opt_u || $opt_U, $env->{with}, $opt_i, $opt_b, $opt_B);
   7.285 +        print_list2($bonly, $config) if (not $opt_K);
   7.286 +    }
   7.287 +}
   7.288 +
   7.289 +#   die gracefully
   7.290 +exit(0);
   7.291 +
   7.292 +#############################################################################
   7.293 +##
   7.294 +##  FUNCTIONS: PARSING & RUN-TIME INFORMATION
   7.295 +##
   7.296 +#############################################################################
   7.297 +
   7.298 +#   home-brewn getopt(3) style option parser
   7.299 +sub getopts ($) {
   7.300 +    my ($opts) = @_;
   7.301 +    my (%optf) = map { m/(\w)/; $1 => $_ } $opts =~ m/(\w:|\w)/g;
   7.302 +    my (%opts, @argv, $optarg);
   7.303 +
   7.304 +    foreach (@ARGV) {
   7.305 +        if (@argv) {
   7.306 +            push @argv, $_;
   7.307 +        } elsif (defined $optarg) {
   7.308 +            if (exists $opts{$optarg}) {
   7.309 +                $opts{$optarg} .= " $_";
   7.310 +            } else {
   7.311 +                $opts{$optarg} = $_;
   7.312 +            }
   7.313 +            $optarg = undef;
   7.314 +        } elsif (!/^[-]/) {
   7.315 +            push @argv, $_;
   7.316 +        } else {
   7.317 +            while (/^\-(\w)(.*)/) {
   7.318 +                if (exists $optf{$1}) {
   7.319 +                    if (length($optf{$1}) > 1) {
   7.320 +                        if ($2 ne '') {
   7.321 +                            if (exists $opts{$1}) {
   7.322 +                                $opts{$1} .= " $2";
   7.323 +                            } else {
   7.324 +                                $opts{$1} = $2;
   7.325 +                            }
   7.326 +                        } else {
   7.327 +                            $optarg = $1;
   7.328 +                        }
   7.329 +                        last;
   7.330 +                    } else {
   7.331 +                        $opts{$1} = 1;
   7.332 +                    }
   7.333 +                } else {
   7.334 +                    warn "openpkg:build:WARNING: unknown option $_\n";
   7.335 +                }
   7.336 +                $_ = "-$2";
   7.337 +            }
   7.338 +        }
   7.339 +    }
   7.340 +    if (defined $optarg) {
   7.341 +        warn "openpkg:build:WARNING: option $optarg requires an argument\n";
   7.342 +    }
   7.343 +    foreach (keys %opts) {
   7.344 +        eval '$opt_'.$_.' = "'.quotemeta($opts{$_}).'";';
   7.345 +    }
   7.346 +    @ARGV = @argv;
   7.347 +}
   7.348 +
   7.349 +#   determine RPM run-time information
   7.350 +sub rpm_runtime_info () {
   7.351 +    #   determine OpenPKG instance prefix via
   7.352 +    #   1. the environment of the "openpkg build" framework
   7.353 +    #   2. the installation path of the script
   7.354 +    #   3. the installation path of the Perl interpreter
   7.355 +    #   4. the path of the "openpkg" command in $PATH
   7.356 +    my $l_prefix = $ENV{'OPENPKG_PREFIX'};
   7.357 +    if (not $l_prefix) {
   7.358 +        ($l_prefix) = ($0 =~ m/^(.+)\/lib(exec)?\/openpkg(-tools)?\/build(\.pl)?$/);
   7.359 +    }
   7.360 +    if (not $l_prefix) {
   7.361 +        ($l_prefix) = ($^X =~ m/^(.+)\/bin\/perl.*$/);
   7.362 +    }
   7.363 +    if (not $l_prefix) {
   7.364 +        $l_prefix = (`(which openpkg) 2>/dev/null` =~ m/^(.+)\/bin\/openpkg$/);
   7.365 +    }
   7.366 +    if (not -x "$l_prefix/bin/openpkg") {
   7.367 +        die "openpkg:build:FATAL: cannot determine OpenPKG instance prefix";
   7.368 +    }
   7.369 +    print "# operating with OpenPKG instance $l_prefix\n";
   7.370 +
   7.371 +    #   determine OpenPKG RPM command
   7.372 +    my $rpm = $opt_R || $env{''}->{'R'} ||
   7.373 +        ((-f "$l_prefix/bin/openpkg" && -f "$l_prefix/libexec/openpkg/rpm") ?
   7.374 +        "$l_prefix/bin/openpkg rpm" : "$l_prefix/bin/rpm");
   7.375 +    $rpm = (`(which $rpm) 2>/dev/null` =~ m{^(/.*)})[0] if ($rpm !~ m|^/|);
   7.376 +    die "openpkg:build:FATAL: cannot locate OpenPKG RPM in path" unless ($rpm =~ m{^/});
   7.377 +    print "# operating with OpenPKG RPM $rpm\n";
   7.378 +
   7.379 +    #   determine additional tools
   7.380 +    my $mkp = "$l_prefix/bin/openpkg makeproxy";
   7.381 +    my $rel = "$l_prefix/bin/openpkg release";
   7.382 +    my $bzip2 = $rpm;
   7.383 +    $bzip2 =~ s/\/bin\/openpkg rpm$/\/lib\/openpkg\/bzip2/;
   7.384 +    my $curl = $rpm;
   7.385 +    $curl =~ s/\/bin\/openpkg rpm$/\/lib\/openpkg\/curl/;
   7.386 +    $curl = "$l_prefix/bin/openpkg curl" if (system("$l_prefix/bin/openpkg curl file://$l_prefix/etc/openpkg/platform >/dev/null 2>&1") == 0);
   7.387 +
   7.388 +    #   expand RPM macros holding information
   7.389 +    my $c = run("$rpm --eval '%{_rpmdir} %{_rpmfilename} %{_target_os} %{_target_cpu} %{_srcrpmdir}'");
   7.390 +
   7.391 +    #   parse and post-process information
   7.392 +    chomp($c);
   7.393 +    my (@q) = split(/\s+/, $c);
   7.394 +    $q[1] =~ s/%{OS}/$q[2]/;
   7.395 +    $q[1] =~ s/%{ARCH}/$q[3]/;
   7.396 +
   7.397 +    #   expand RPM rc information about tools
   7.398 +    $c = run("$rpm --showrc");
   7.399 +    my @g = ($c =~ m/\%\{l_tool_locate\s+([^\s\}]+)/g);
   7.400 +
   7.401 +    #   return accumulated information
   7.402 +    return {
   7.403 +        rpm      => $rpm,
   7.404 +        mkp      => $mkp,
   7.405 +        rel      => $rel,
   7.406 +        bzip2    => $bzip2,
   7.407 +        curl     => $curl,
   7.408 +        rpmdir   => $q[0],
   7.409 +        srcrpmdir=> $q[4],
   7.410 +        template => $q[1],
   7.411 +        platform => '',
   7.412 +        prefix   => $l_prefix,
   7.413 +        optreg   => '(?:'. join('|', map { "\Quse_$_\E" } @g) .')'
   7.414 +    };
   7.415 +}
   7.416 +
   7.417 +#   determine RPM release URL
   7.418 +sub rpm_release_url ($$) {
   7.419 +    my ($rel, $url);
   7.420 +
   7.421 +    #   determine the release URL the newer way
   7.422 +    $url = run("(".$config->{"rel"}." --fmt='%u') 2>/dev/null || true") || "";
   7.423 +    $url =~ s/^\s+//s;
   7.424 +    $url =~ s/\s+$//s;
   7.425 +
   7.426 +    #   use a local jumpstart RDF
   7.427 +    if (-f $config->{"prefix"}."/etc/openpkg/build.rdf") {
   7.428 +        $url = "file://".$config->{"prefix"}."/etc/openpkg/build.rdf"
   7.429 +    }
   7.430 +
   7.431 +    return $url;
   7.432 +}
   7.433 +
   7.434 +#############################################################################
   7.435 +##
   7.436 +##  FUNCTIONS: VERSION STRING HANDLING
   7.437 +##
   7.438 +#############################################################################
   7.439 +
   7.440 +#   compare two package versions
   7.441 +#   - "openpkg rpm":
   7.442 +#     splits according to !isalnum(3) ([a-zA-Z0-9])
   7.443 +#     and between isdigit(3) ([0-9]) and isalpha(3) ([a-zA-Z])
   7.444 +#   - "openpkg build" (this):
   7.445 +#     splits on "." characters
   7.446 +sub vcmp_version ($$) {
   7.447 +    my ($a, $b) = @_;
   7.448 +    my (@a, @b, $c);
   7.449 +    my ($ax, $bx);
   7.450 +
   7.451 +    #   split according to dots
   7.452 +    @a = split(/\./, $a);
   7.453 +    @b = split(/\./, $b);
   7.454 +
   7.455 +    #   compare as long as components exist
   7.456 +    while (@a && @b) {
   7.457 +        if ($a[0] =~ m/^\d+$/ && $b[0] =~ m/^\d+$/) {
   7.458 +            #   numerical comparison
   7.459 +            $c = $a[0] <=> $b[0];
   7.460 +        } elsif ((($a, $ax) = $a[0] =~ m/^(\d+)(.*)$/) &&
   7.461 +                 (($b, $bx) = $b[0] =~ m/^(\d+)(.*)$/)) {
   7.462 +            #   numerical comparison for prefix,
   7.463 +            #   string comparison for remainder
   7.464 +            $c = $a <=> $b;
   7.465 +            $c = $ax cmp $bx unless ($c);
   7.466 +        } else {
   7.467 +            #   string comparison
   7.468 +            $c = $a[0] cmp $b[0];
   7.469 +        }
   7.470 +
   7.471 +        #   stop comparison if components already mismatched
   7.472 +        return $c if ($c != 0);
   7.473 +
   7.474 +        #   else reduce by one component level
   7.475 +        shift(@a);
   7.476 +        shift(@b);
   7.477 +    }
   7.478 +
   7.479 +    #   finally compare number of remaining components
   7.480 +    #   (in case one is more specific)
   7.481 +    $c = (scalar(@a) <=> scalar(@b));
   7.482 +    return $c;
   7.483 +}
   7.484 +
   7.485 +#   compare two package releases
   7.486 +#   - "openpkg rpm":
   7.487 +#     uses "vcmp_version" semantics 1:1 again
   7.488 +#   - "openpkg build" (this):
   7.489 +#     uses "vcmp_version" semantics 1:1 again (>= 20060719)
   7.490 +#     trivial string comparison               (<= 20060719)
   7.491 +sub vcmp_release ($$) {
   7.492 +    my ($a, $b) = @_;
   7.493 +
   7.494 +    return vcmp_version($a, $b);
   7.495 +}
   7.496 +
   7.497 +#   compare two package "version" or "version-release" strings
   7.498 +#   - "openpkg rpm":
   7.499 +#     compares "epoch", "version", "release" (in this order)
   7.500 +#   - "openpkg build" (this):
   7.501 +#     compares "release", "version", (in this order)
   7.502 +sub vcmp ($$) {
   7.503 +    my ($a, $b) = @_;
   7.504 +    my ($c);
   7.505 +
   7.506 +    #   short-circuit comparison for simple case
   7.507 +    return 0 if ($a eq $b);
   7.508 +
   7.509 +    #   split into "version" and "release"
   7.510 +    my ($av, $ar) = ($a =~ m/^(.*?)(?:\-([\d\.]+))?$/);
   7.511 +    my ($bv, $br) = ($b =~ m/^(.*?)(?:\-([\d\.]+))?$/);
   7.512 +
   7.513 +    #   compare "release"
   7.514 +    if (defined($ar) and defined($br)) {
   7.515 +        $c = vcmp_release($ar, $br);
   7.516 +        return $c if ($c); # short-circuit
   7.517 +    }
   7.518 +
   7.519 +    #   compare "version"
   7.520 +    if (defined($av) && defined($bv)) {
   7.521 +        $c = vcmp_version($av, $bv);
   7.522 +        return $c if ($c); # short-circuit
   7.523 +    }
   7.524 +
   7.525 +    #   equality
   7.526 +    return 0;
   7.527 +}
   7.528 +
   7.529 +#   create "version" or "version-release" string
   7.530 +#   from a provide object (see parse_provides)
   7.531 +sub vs ($) {
   7.532 +    my ($t) = @_;
   7.533 +    return (
   7.534 +          defined($t->{release})
   7.535 +        ? "$t->{version}-$t->{release}"
   7.536 +        : $t->{version}
   7.537 +    );
   7.538 +}
   7.539 +
   7.540 +#   create "name-version" or "name-version-release" string
   7.541 +#   from a provide object (see parse_provides)
   7.542 +sub vsn ($) {
   7.543 +    my ($t) = @_;
   7.544 +    return "$t->{name}-".vs($t);
   7.545 +}
   7.546 +
   7.547 +#############################################################################
   7.548 +##
   7.549 +##  FUNCTIONS: INSTALLATION INFORMATION
   7.550 +##
   7.551 +#############################################################################
   7.552 +
   7.553 +#   parse OpenPKG RPM 'provide' string
   7.554 +#   "<virtual-name>"               (virtual package)
   7.555 +#   "<name> = <version>-<release>" (regular package)
   7.556 +#   "<name>::<option> = <value>"   (regular package build option)
   7.557 +sub parse_provides ($) {
   7.558 +    my ($s) = @_;
   7.559 +    my ($nam, $val, $pre, $with, $pxy, $ver, $rel);
   7.560 +
   7.561 +    ($nam, $val) = ($s =~ m/^([^\s\(]+(?:\([^\)]*\))?)\s*(?:=\s*(\S*?))?$/);
   7.562 +    if (($pre, $with) = ($nam =~ m/^(\S+?)::(\S*)$/)) {
   7.563 +        #   build option
   7.564 +        $val =~ s/(?:\%([0-9a-fA-F][0-9a-fA-F]))/chr(hex($1))/eg; # hex decode
   7.565 +        ($ver, $rel, $pxy) = ($val, undef, undef);
   7.566 +    } else {
   7.567 +        #   virtual or real package
   7.568 +        ($ver, $rel, $pxy) = ($val =~ m/^([^\s\-]+)-([^\s\+]+)(\+PROXY)?$/);
   7.569 +    }
   7.570 +
   7.571 +    #   return accumulated information
   7.572 +    return {
   7.573 +        name    => $nam,     # the full name of the resource
   7.574 +        version => $ver,     # the version        (or value)
   7.575 +        release => $rel,     # and release number (or undef)
   7.576 +        proxy   => $pxy,     # whether the resource is a PROXY resource (or undef)
   7.577 +        prefix  => $pre,     # the packagename (if resource is an option)
   7.578 +        with    => $with     # the buildoption (if resource is an option)
   7.579 +    };
   7.580 +}
   7.581 +
   7.582 +#   parse option from RPM 'provides' list
   7.583 +sub parse_provideslist ($) {
   7.584 +    my ($l) = @_;
   7.585 +    my ($p);
   7.586 +    my ($nam, $val, %opts);
   7.587 +
   7.588 +    foreach (@$l) {
   7.589 +        $p = parse_provides($_);
   7.590 +        next if (not (defined $p->{with} && defined $p->{prefix}));
   7.591 +        $opts{$p->{with}} = $p->{version};
   7.592 +    }
   7.593 +    return \%opts;
   7.594 +}
   7.595 +
   7.596 +#   translate dependency object into provides object
   7.597 +sub depends2provides ($) {
   7.598 +    my ($dep) = @_;
   7.599 +    my ($ver, $rel, $pxy, $pre, $with);
   7.600 +
   7.601 +    ($ver, $rel, $pxy) = ($dep->{val} =~ m/^([^\s\-]+)-([^\s\+]+)(\+PROXY)?$/);
   7.602 +    ($pre, $with) = ($dep->{name} =~ m/^(\S+?)::(\S*)$/);
   7.603 +
   7.604 +    return {
   7.605 +        name    => $dep->{name},
   7.606 +        version => (defined $ver ? $ver : $dep->{val}),
   7.607 +        release => $rel,
   7.608 +        proxy   => $pxy,
   7.609 +        prefix  => $pre,
   7.610 +        with    => $with
   7.611 +    }
   7.612 +}
   7.613 +
   7.614 +#   parse OpenPKG RPM 'require' string
   7.615 +#   "<virtual-name>"                              (virtual package)
   7.616 +#   "<name> =|<|<=|>|>= <version>[-<release>]"    (regular package)
   7.617 +#   "<name>::<option> =|<|<=|>|>= <value>"        (regular package build option)
   7.618 +sub parse_depends ($) {
   7.619 +    my ($dep) = @_;
   7.620 +    my ($name, $op, $val);
   7.621 +
   7.622 +    if (ref($dep)) {
   7.623 +        #   dependency from new index stored as a node
   7.624 +        #   - content of the node is the name
   7.625 +        #   - certain attributes denote the comparison operator
   7.626 +        #   - the value of such an attribute is the comparison operand
   7.627 +        #   - the operator (and operand) are optional and there can only be one
   7.628 +        $name = $dep->{content};
   7.629 +        $op = undef;
   7.630 +        $op = 'equ' if (exists($dep->{equ}));
   7.631 +        $op = 'geq' if (exists($dep->{geq}));
   7.632 +        $op = 'leq' if (exists($dep->{leq}));
   7.633 +        $op = 'gt'  if (exists($dep->{gt}));
   7.634 +        $op = 'lt'  if (exists($dep->{lt}));
   7.635 +        if (defined($op)) {
   7.636 +            $val = $dep->{$op};
   7.637 +        }
   7.638 +    } elsif ($dep =~ m/\S/) {
   7.639 +        #   dependency from old index stored as text string
   7.640 +        #   "name operator operand" or "name"
   7.641 +        ($name, $op, $val) = ($dep =~ m/(\S+)\s*(?:(\S+)\s*(\S+))?\s*$/);
   7.642 +        if (defined($op)) {
   7.643 +            $op = {
   7.644 +                '=='  => 'equ', '='   => 'equ',
   7.645 +                '>='  => 'geq', '=>'  => 'geq',
   7.646 +                '<='  => 'leq', '=<'  => 'leq',
   7.647 +                '>'   => 'gt',  '<'   => 'lt'
   7.648 +            }->{$op};
   7.649 +            if (not defined($op)) {
   7.650 +                print "# don't know how to handle dependency: $dep (invalid operator)\n";
   7.651 +                return;
   7.652 +            }
   7.653 +        }
   7.654 +    }
   7.655 +    return {
   7.656 +        name => $name,
   7.657 +        op   => $op,
   7.658 +        val  => $val
   7.659 +    };
   7.660 +}
   7.661 +
   7.662 +#   retrieve the local installed package base.
   7.663 +#   for packages that provide option resources (packagename::buildoption)
   7.664 +#   the options are parsed into the OPTIONS hash.
   7.665 +#   other packages will query options on demand.
   7.666 +sub get_installed () {
   7.667 +    my (%map);
   7.668 +    my (@l, $p);
   7.669 +    my ($nam, $val, %options);
   7.670 +    my ($vs, $rec, @list);
   7.671 +    my ($name, $version, $release);
   7.672 +    my ($req);
   7.673 +
   7.674 +    #   generated total result:
   7.675 +    #   $map = {
   7.676 +    #       #   regular package
   7.677 +    #       "<package-name>" <foo> => {
   7.678 +    #            "<version>-<release>" <1.2.3-20060622> => [
   7.679 +    #                <<1>{
   7.680 +    #                    "name"    => $name,
   7.681 +    #                    "version" => $version,
   7.682 +    #                    "release" => $release,
   7.683 +    #                    "PROXY"   => $proxy,
   7.684 +    #                    "depends" => [
   7.685 +    #                          <<3>>{
   7.686 +    #                              "cond"  => '',
   7.687 +    #                              "value" => {
   7.688 +    #                                  name => $name,
   7.689 +    #                                  op   => $op,
   7.690 +    #                                  val  => $val
   7.691 +    #                              },
   7.692 +    #                          },
   7.693 +    #                          ...
   7.694 +    #                    ],
   7.695 +    #                    "keeps" => [
   7.696 +    #                          \<<3>
   7.697 +    #                          ...
   7.698 +    #                    ],
   7.699 +    #                    "OPTIONS" => {
   7.700 +    #                        "<option>" => "<value>",
   7.701 +    #                        "<option>" => "<value>",
   7.702 +    #                        ...
   7.703 +    #                    },
   7.704 +    #                },
   7.705 +    #                ...
   7.706 +    #            ],
   7.707 +    #       },
   7.708 +    #       #   build option
   7.709 +    #       "<package-name>::<option>" <foo::with_baz> => {
   7.710 +    #            "<value>" <yes> => [
   7.711 +    #                \<<1>>
   7.712 +    #                ...
   7.713 +    #            ],
   7.714 +    #       },
   7.715 +    #       #   virtual package
   7.716 +    #       "<package-name>" <BAR> => {
   7.717 +    #            "" => [
   7.718 +    #                \<<1>>,
   7.719 +    #                ...
   7.720 +    #            ],
   7.721 +    #       },
   7.722 +    #       ...
   7.723 +    #   };
   7.724 +
   7.725 +    #   query and parse all provides of all packages
   7.726 +    #   HINT: We assume(!) that OpenPKG RPM outputs "provides" in order:
   7.727 +    #         1. virtual package & build option
   7.728 +    #         2. regular package
   7.729 +    #   FIXME: The better long-term solution for all this fiddling would be something like:
   7.730 +    #          "openpkg rpm -qa -qf '%{NAME} %{VERSION} %{RELEASE}[ .%{PROVIDENAME} .%{PROVIDEFLAGS:depflags} .%{PROVIDEVERSION}]\\n'"
   7.731 +    @l = run($config->{"rpm"}. " --provides -qa");
   7.732 +    @list = ();
   7.733 +    foreach (@l) {
   7.734 +        #   parse into provide object
   7.735 +        $p = parse_provides($_) or next;
   7.736 +
   7.737 +        #   short-circuit processing for RPM special case
   7.738 +        next if ($p->{name} =~ m/^gpg\(/);
   7.739 +
   7.740 +        #   is this an option?
   7.741 +        if (defined($p->{with})) {
   7.742 +            $options{$p->{prefix}}->{$p->{with}} = $p->{version};
   7.743 +            push(@list, $p);
   7.744 +            next;
   7.745 +        }
   7.746 +
   7.747 +        #   is this a virtual target?
   7.748 +        $vs = vs($p);
   7.749 +        if ($vs eq '') {
   7.750 +            push(@list, $p);
   7.751 +            next;
   7.752 +        }
   7.753 +
   7.754 +        #   assemble package details
   7.755 +        $name    = $p->{name};
   7.756 +        $version = defined($p->{version}) ? $p->{version} : '*';
   7.757 +        $release = defined($p->{release}) ? $p->{release} : '*';
   7.758 +        push(@list, {
   7.759 +            name    => $name,
   7.760 +            version => $version,
   7.761 +            release => $release
   7.762 +        });
   7.763 +
   7.764 +        #   create target record
   7.765 +        $rec = {
   7.766 +            name       => $name,
   7.767 +            version    => $version,
   7.768 +            release    => $release,
   7.769 +            PROXY      => $p->{proxy},
   7.770 +            depends    => [],
   7.771 +            keeps      => []
   7.772 +        };
   7.773 +        foreach (@list) {
   7.774 +            push(@{$map{$_->{name}}->{vs($_)}}, $rec);
   7.775 +        }
   7.776 +
   7.777 +        #   remove assembled details
   7.778 +        @list = ();
   7.779 +    }
   7.780 +    if (@list) {
   7.781 +        print "# ATTENTION: ", scalar(@list), " froods (unassignable RPM 'provides') left\n";
   7.782 +    }
   7.783 +
   7.784 +    #   options are provided for a package,
   7.785 +    #   apply them to all instances of the package
   7.786 +    #   FIXME: duplicate copying because record exists multiple times (but harmless)
   7.787 +    #   FIXME: merges all "provides" of all package instances together -- which might be wrong
   7.788 +    foreach $nam (keys(%options)) {
   7.789 +        foreach $val (keys(%{$map{$nam}})) {
   7.790 +            foreach (@{$map{$nam}->{$val}}) {
   7.791 +                $_->{OPTIONS} = $options{$nam};
   7.792 +            }
   7.793 +        }
   7.794 +    }
   7.795 +
   7.796 +    #   query all 'requires' of all installed packages
   7.797 +    #   to determine the package dependencies
   7.798 +    @l = run($config->{"rpm"} . " --qf '%{NAME}:::%{VERSION}:::%{RELEASE}[ :::%{REQUIRENAME}:::%{REQUIREFLAGS:depflags}:::%{REQUIREVERSION}:::]\\n' -qa");
   7.799 +    @list = ();
   7.800 +    foreach (@l) {
   7.801 +        ($name, $version, $release, $req) = m/^([^:]+):::([^:]+):::([^:]+)(.*?)$/;
   7.802 +        next if ($name eq 'gpg-pubkey');
   7.803 +        $release =~ s/\+PROXY$//;
   7.804 +        #   for each requirement triple...
   7.805 +        while ($req =~ m/\s+:::(.+?):::\s*(.*?)\s*:::(.*?):::/g) {
   7.806 +            $p = parse_depends("$1 $2 $3");
   7.807 +            next if ($p->{name} =~ m/^(rpmlib|gpg)\(/);
   7.808 +            $vs = vs({ version => $version, release => $release });
   7.809 +            $p = { cond => '', value => $p };
   7.810 +            foreach $rec (@{$map{$name}->{$vs}}) {
   7.811 +                push(@{$rec->{depends}}, $p);
   7.812 +                push(@{$rec->{keeps}},   $p);
   7.813 +            }
   7.814 +        }
   7.815 +    }
   7.816 +    if (@list) {
   7.817 +        print "# ATTENTION: ",scalar(@list)," fnords (unassignable RPM 'requires') left\n";
   7.818 +    }
   7.819 +
   7.820 +    #   return final result
   7.821 +    return \%map;
   7.822 +}
   7.823 +
   7.824 +#############################################################################
   7.825 +##
   7.826 +##  FUNCTIONS: REPOSITORY INDEX INFORMATION
   7.827 +##
   7.828 +#############################################################################
   7.829 +
   7.830 +#   fetch XML/RDF index from file or URL
   7.831 +#   (recursively fetches sub-indexes, too)
   7.832 +sub get_index ($$$$$) {
   7.833 +    my ($url, $fn, $xml, $pfmatch, $installed) = @_;
   7.834 +    my (%map, $include);
   7.835 +    my ($fetch, $bzip2, $path);
   7.836 +    my ($parser);
   7.837 +
   7.838 +    #   determine command/path to fetch/open index
   7.839 +    $bzip2 = $config->{"bzip2"};
   7.840 +    $fetch = defined($fn) ? $fn : $url;
   7.841 +    $fetch !~ m/\.bz2$/ || -x $bzip2
   7.842 +        or die "openpkg:build:FATAL: $bzip2 not found\n";
   7.843 +    if ($fetch =~ m/^\w+:/) {
   7.844 +        #   looks like URL scheme
   7.845 +        print "# fetching XML/RDF index from URL $fetch\n";
   7.846 +        $path = $config->{"curl"} . " -s -o - \"$fetch\" |";
   7.847 +        $path .= "$bzip2 -dc |" if ($fetch =~ m/\.bz2$/);
   7.848 +    } else {
   7.849 +        print "# reading XML/RDF index from file $fetch\n";
   7.850 +        if ($fetch =~ m/\.bz2$/) {
   7.851 +            $path = "$bzip2 -dc $fetch |";
   7.852 +        } else {
   7.853 +            $path = "<$fetch";
   7.854 +        }
   7.855 +    }
   7.856 +
   7.857 +    #   open index
   7.858 +    open(RFH, $path) or
   7.859 +        die "openpkg:build:FATAL: cannot open '$fetch' ($!)\n";
   7.860 +
   7.861 +    #   if XML parser can be used, try to lazy-load it
   7.862 +    if ($xml) {
   7.863 +        eval { require XML::Simple; };
   7.864 +        $xml = 0 if ($@);
   7.865 +    }
   7.866 +
   7.867 +    #   determine and run XML parser
   7.868 +    #   (returns contained index includes)
   7.869 +    $parser = ($xml ? \&xml_parser : \&simple_text_parser);
   7.870 +    $include = $parser->(\*RFH, $url, \%map, $pfmatch, $installed);
   7.871 +
   7.872 +    #   close index
   7.873 +    close(RFH)
   7.874 +        or die "openpkg:build:FATAL: an I/O error occured\n";
   7.875 +
   7.876 +    #   cannot do real recursions on file handles, so we simply append
   7.877 +    #   (instead of inserting at the correct position) all sub-RDFs, as
   7.878 +    #   the result is flattend into a big hash anyway
   7.879 +    foreach (@$include) {
   7.880 +        my ($submap);
   7.881 +        my ($suburl, $subfn) = relurl($url, $fn, $_);
   7.882 +        $submap = get_index($suburl, $subfn, $xml, $pfmatch, $installed); # RECURSION
   7.883 +        while (my ($name, $vmap) = each(%$submap)) {
   7.884 +            while (my ($vs, $recs) = each(%$vmap)) {
   7.885 +                push(@{$map{$name}->{$vs}}, @$recs);
   7.886 +            }
   7.887 +        }
   7.888 +    }
   7.889 +
   7.890 +    #   return final result
   7.891 +    #   $map = {
   7.892 +    #       <package-name> => {
   7.893 +    #           "<version>-<release>" => {
   7.894 +    #                href      => ...,
   7.895 +    #                name      => ...,
   7.896 +    #                version   => ...,
   7.897 +    #                release   => ...,
   7.898 +    #                platform  => ...,
   7.899 +    #                prefix    => ...,
   7.900 +    #                depends   => [ ... ],
   7.901 +    #                keeps     => [ ... ],
   7.902 +    #                conflicts => [ ... ],
   7.903 +    #                source    => ...,
   7.904 +    #                nosource  => ...,
   7.905 +    #                desc      => $desc,
   7.906 +    #                OPTIONS   => $options,
   7.907 +    #                DEFOPTS   => { %$options },
   7.908 +    #           };
   7.909 +    #       };
   7.910 +    #   };
   7.911 +    return \%map;
   7.912 +}
   7.913 +
   7.914 +#   compute absolute paths
   7.915 +#   - (url, fn) point to a base document
   7.916 +#     the location is the file path fn if fn is
   7.917 +#     defined, otherwise it is url.
   7.918 +#   - augment the pointer with suburl
   7.919 +#   - suburl can be an absolute url
   7.920 +#     then the new pointer is (suburl, undef)
   7.921 +#   - suburl can be a absolute file path
   7.922 +#     then the new pointer is (suburl, suburl)
   7.923 +#   - suburl can be a relative path
   7.924 +#     then it augments url or fn accordingly
   7.925 +sub relurl ($$$) {
   7.926 +    my ($url, $fn, $suburl) = @_;
   7.927 +    my ($subfn);
   7.928 +
   7.929 +    if ($suburl =~ m/^\w+:\/\//) {
   7.930 +        # NOP
   7.931 +    } elsif ($suburl =~ m/^\//) {
   7.932 +        $subfn = $suburl;
   7.933 +    } else {
   7.934 +        if (defined($fn)) {
   7.935 +            $subfn = $fn;
   7.936 +            $subfn =~ s/(\/)?\/*[^\/]*$/$1$suburl/;
   7.937 +            $suburl = $subfn;
   7.938 +        } else {
   7.939 +            $subfn = $url;
   7.940 +            $subfn =~ s/(\/)?\/*[^\/]*$/$1$suburl/;
   7.941 +            $suburl = $subfn;
   7.942 +            $subfn  = undef;
   7.943 +        }
   7.944 +    }
   7.945 +    1 while ($suburl =~ s/\/\.\//\//s);
   7.946 +    1 while ($suburl =~ s/\/[^\/]+\/\.\.\//\//s);
   7.947 +    return ($suburl, $subfn);
   7.948 +}
   7.949 +
   7.950 +#   XML/RDF parser (simple way)
   7.951 +sub simple_text_parser ($$$$$) {
   7.952 +    my ($fh, $url, $map, $pfmatch, $installed) = @_;
   7.953 +    my (@include);
   7.954 +    my ($section);
   7.955 +    my ($name, $version);
   7.956 +    my ($href, $release, $desc, $bags);
   7.957 +    my (%options, @provides);
   7.958 +    my ($platform, $prefix);
   7.959 +    my ($rec);
   7.960 +    my ($tag, $cond, $attrname, $attrval, $body);
   7.961 +    my ($usecond);
   7.962 +    my ($options);
   7.963 +
   7.964 +    print "# using internal XML/RDF parser\n";
   7.965 +
   7.966 +    #   read XML/RDF line-wise as we know that our
   7.967 +    #   OpenPKG XML/RDF indices follow a strict formatting
   7.968 +    while (<$fh>) {
   7.969 +        #   unescape some XML entities
   7.970 +        s/&gt;/>/g;
   7.971 +        s/&lt;/</g;
   7.972 +
   7.973 +        if (!(defined($href)) && m/<rdf:Description.*?href="([^"]*)"/) {
   7.974 +            #   start of new package description
   7.975 +            $href      = $1;
   7.976 +            $section   = undef;
   7.977 +            $name      = undef;
   7.978 +            $release   = undef;
   7.979 +            $desc      = '';
   7.980 +            $platform  = undef;
   7.981 +            $prefix    = undef;
   7.982 +            $bags      = {};
   7.983 +            @provides  = ();
   7.984 +        }
   7.985 +
   7.986 +        if (!(defined($href)) && m/<Repository.*?href="([^"]*)"(?:\s*platform="([^"]*)")?/) {
   7.987 +            #   external XML/RDF index reference for particular binary platform
   7.988 +            if (goodpf($2, $pfmatch)) {
   7.989 +                push(@include, $1);
   7.990 +            }
   7.991 +            next;
   7.992 +        }
   7.993 +
   7.994 +        #   skip content unless referenced piece was found
   7.995 +        next if (not defined($href));
   7.996 +
   7.997 +        #   parse XML/RDF element into components
   7.998 +        ($tag, $cond, $attrname, $attrval, $body) = m{
   7.999 +            <                      # start delimiter
  7.1000 +            (\/?[\w:]+)            # begin element name
  7.1001 +            \s*                    # optional space before attributes
  7.1002 +            (?:cond="([^"]+)")?    # known attribute
  7.1003 +            (?:(\w+)="([^"]+)")?   # unknown attribute
  7.1004 +            >                      # end delimiter
  7.1005 +            (.*?)                  # optional element body
  7.1006 +            (?:<\/\1>)?            # optional end tag
  7.1007 +            $                      # end of string
  7.1008 +        }mx;
  7.1009 +
  7.1010 +        #   recognize the various XML/RDF elements
  7.1011 +        if ($tag eq 'Description') {
  7.1012 +            $usecond = $cond;
  7.1013 +            $section = 'description';
  7.1014 +        } elsif ($tag eq '/Description') {
  7.1015 +            $usecond = $cond;
  7.1016 +            $section = undef;
  7.1017 +        } elsif ($section eq 'description') {
  7.1018 +            $desc .= $_;
  7.1019 +        } elsif ($tag eq 'PreReq') {
  7.1020 +            $usecond = $cond;
  7.1021 +            $section = 'prereq';
  7.1022 +        } elsif ($tag eq '/PreReq') {
  7.1023 +            $usecond = undef;
  7.1024 +            $section = undef;
  7.1025 +        } elsif ($tag eq 'BuildPreReq') {
  7.1026 +            $usecond = $cond;
  7.1027 +            $section = 'bprereq';
  7.1028 +        } elsif ($tag eq '/BuildPreReq') {
  7.1029 +            $usecond = undef;
  7.1030 +            $section = undef;
  7.1031 +        } elsif ($tag eq 'Provides') {
  7.1032 +            $usecond = $cond;
  7.1033 +            $section = 'provides';
  7.1034 +        } elsif ($tag eq '/Provides') {
  7.1035 +            $usecond = undef;
  7.1036 +            $section = undef;
  7.1037 +        } elsif ($tag eq 'Conflicts') {
  7.1038 +            $usecond = $cond;
  7.1039 +            $section = 'conflicts';
  7.1040 +        } elsif ($tag eq '/Conflicts') {
  7.1041 +            $usecond = undef;
  7.1042 +            $section = undef;
  7.1043 +        } elsif ($tag eq 'NoSource') {
  7.1044 +            $usecond = $cond;
  7.1045 +            $section = 'nosource';
  7.1046 +        } elsif ($tag eq '/NoSource') {
  7.1047 +            $usecond = undef;
  7.1048 +            $section = undef;
  7.1049 +        } elsif ($tag eq 'Source') {
  7.1050 +            $usecond = $cond;
  7.1051 +            $section = 'source';
  7.1052 +        } elsif ($tag eq '/Source') {
  7.1053 +            $usecond = undef;
  7.1054 +            $section = undef;
  7.1055 +        } elsif ($tag eq 'Name') {
  7.1056 +            $name = $body;
  7.1057 +        } elsif ($tag eq 'Version') {
  7.1058 +            $version = $body;
  7.1059 +        } elsif ($tag eq 'Release') {
  7.1060 +            $release = $body;
  7.1061 +        } elsif ($tag eq 'Platform') {
  7.1062 +            $platform = $body;
  7.1063 +        } elsif ($tag eq 'Prefixes') {
  7.1064 +            $prefix = $body;
  7.1065 +        } elsif ($tag eq 'rdf:li' || $tag eq 'resource') {
  7.1066 +            if (defined($attrname)) {
  7.1067 +                $body = {
  7.1068 +                    $attrname => $attrval,
  7.1069 +                    content   => $body
  7.1070 +                };
  7.1071 +            }
  7.1072 +            if ($section eq 'provides') {
  7.1073 +                push(@provides, $body) if (!defined($usecond));
  7.1074 +            } elsif ($section ne '') {
  7.1075 +                push(@{$bags->{"$usecond"}->{$section}}, $body);
  7.1076 +            }
  7.1077 +        } elsif ($tag eq '/rdf:Description') {
  7.1078 +            if (   defined($href)
  7.1079 +                && defined($name)
  7.1080 +                && defined($version)
  7.1081 +                && defined($release)) {
  7.1082 +                #   process the accumulated package information
  7.1083 +                @provides = map {
  7.1084 +                    depends2provides(parse_depends($_))
  7.1085 +                } @provides;
  7.1086 +                %options = map {
  7.1087 +                    ($_->{with} => $_->{version})
  7.1088 +                } grep {
  7.1089 +                    defined($_->{with})
  7.1090 +                } @provides;
  7.1091 +                push(@provides, {
  7.1092 +                    name    => $name,
  7.1093 +                    version => $version,
  7.1094 +                    release => $release
  7.1095 +                });
  7.1096 +                $options =
  7.1097 +                      %options
  7.1098 +                    ? { %options }
  7.1099 +                    : parse_options($desc);
  7.1100 +                if ($options) {
  7.1101 +                    my (@t) = get_targets($installed->{$name}, sub { 1; });
  7.1102 +                }
  7.1103 +                #   store accumulated package information
  7.1104 +                eval {
  7.1105 +                    $rec = {
  7.1106 +                        href      => (relurl($url, undef, $href))[0],
  7.1107 +                        name      => $name,
  7.1108 +                        version   => $version,
  7.1109 +                        release   => $release,
  7.1110 +                        depends   => depend_list(swith($bags, 'bprereq')),
  7.1111 +                        keeps     => depend_list(swith($bags, 'prereq')),
  7.1112 +                        conflicts => swith($bags, 'conflicts'),
  7.1113 +                        source    => swith($bags, 'source'),
  7.1114 +                        nosource  => swith($bags, 'nosource'),
  7.1115 +                        desc      => $desc,
  7.1116 +                        platform  => $platform,
  7.1117 +                        prefix    => $prefix,
  7.1118 +                        OPTIONS   => $options,
  7.1119 +                        DEFOPTS   => { %$options }
  7.1120 +                    };
  7.1121 +                };
  7.1122 +                if ($@) {
  7.1123 +                    die "openpkg:build:FATAL: when reading entry '$name':\n" . $@;
  7.1124 +                }
  7.1125 +                foreach (@provides) {
  7.1126 +                    push(@{$map->{$_->{name}}->{vs($_)}}, $rec);
  7.1127 +                }
  7.1128 +            }
  7.1129 +            #   prepare to recognize next package
  7.1130 +            $href = undef;
  7.1131 +        }
  7.1132 +    }
  7.1133 +
  7.1134 +    #   return contained XML/RDF indices
  7.1135 +    return \@include;
  7.1136 +}
  7.1137 +
  7.1138 +#   XML/RDF parser (usual way)
  7.1139 +sub xml_parser ($$$$$) {
  7.1140 +    my ($fh, $url, $map, $pfmatch, $installed) = @_;
  7.1141 +    my (@include);
  7.1142 +    my ($xml, $rep, $sub);
  7.1143 +    my (@provides, %options, $rec);
  7.1144 +    my ($href, $name, $version, $release, $desc);
  7.1145 +    my ($options);
  7.1146 +
  7.1147 +    print "# using external XML/RDF parser\n";
  7.1148 +
  7.1149 +    #   parse XML/RDF with XML::Simple parser
  7.1150 +    $xml = XML::Simple::XMLin($fh, forcearray => 1);
  7.1151 +    $rep = $xml->{'Repository'}->[0]->{'rdf:Description'};
  7.1152 +    $sub = $xml->{'Repository'}->[0]->{'Repository'};
  7.1153 +
  7.1154 +    #   iterate over all package descriptions
  7.1155 +    foreach (@$rep) {
  7.1156 +        #   fetch package information
  7.1157 +        $href    = $_->{'href'};
  7.1158 +        $name    = xel($_->{'Name'});
  7.1159 +        $version = xel($_->{'Version'});
  7.1160 +        $release = xel($_->{'Release'});
  7.1161 +        next if (not (
  7.1162 +               defined($href)
  7.1163 +            && defined($name)
  7.1164 +            && defined($version)
  7.1165 +            && defined($release)
  7.1166 +        ));
  7.1167 +
  7.1168 +        #   determine package "provides"
  7.1169 +        @provides = ();
  7.1170 +        if ($_->{'Provides'}) {
  7.1171 +            @provides = map {
  7.1172 +                $_ = $_->{'rdf:bag'}->[0];
  7.1173 +                $_ = $_->{'rdf:li'} ? $_->{'rdf:li'} : $_->{'resource'};
  7.1174 +                @$_;
  7.1175 +            } grep {
  7.1176 +                !exists $_->{'cond'}
  7.1177 +            } @{$_->{'Provides'}};
  7.1178 +        }
  7.1179 +        @provides = map {
  7.1180 +            depends2provides(parse_depends($_))
  7.1181 +        } @provides;
  7.1182 +        %options = map {
  7.1183 +            ($_->{with} => $_->{version})
  7.1184 +        } grep {
  7.1185 +            defined $_->{with}
  7.1186 +        } @provides;
  7.1187 +        push(@provides, {
  7.1188 +            name    => $name,
  7.1189 +            version => $version,
  7.1190 +            release => $release
  7.1191 +        });
  7.1192 +
  7.1193 +        #   determine targets
  7.1194 +        $desc = xel($_->{'Description'});
  7.1195 +        $options =
  7.1196 +              %options
  7.1197 +            ? { %options }
  7.1198 +            : parse_options($desc);
  7.1199 +        if ($options) {
  7.1200 +            my (@t) = get_targets($installed->{$name}, sub { 1; });
  7.1201 +        }
  7.1202 +
  7.1203 +        #   store accumulated package information
  7.1204 +        eval {
  7.1205 +            $rec = {
  7.1206 +                href      => (relurl($url, undef, $href))[0],
  7.1207 +                name      => $name,
  7.1208 +                version   => $version,
  7.1209 +                release   => $release,
  7.1210 +                platform  => xel($_->{'Platform'}),
  7.1211 +                prefix    => xel($_->{'Prefixes'}),
  7.1212 +                depends   => depend_list(xwith($_->{'BuildPreReq'})),
  7.1213 +                keeps     => depend_list(xwith($_->{'PreReq'})),
  7.1214 +                conflicts => xwith($_->{'Conflicts'}),
  7.1215 +                source    => xwith($_->{'Source'}),
  7.1216 +                nosource  => xwith($_->{'NoSource'}),
  7.1217 +                desc      => $desc,
  7.1218 +                OPTIONS   => $options,
  7.1219 +                DEFOPTS   => { %$options }
  7.1220 +            };
  7.1221 +        };
  7.1222 +        if ($@) {
  7.1223 +            die "openpkg:build:FATAL: when reading entry '$name'\n".$@;
  7.1224 +        }
  7.1225 +        foreach (@provides) {
  7.1226 +            push(@{$map->{$_->{name}}->{vs($_)}}, $rec);
  7.1227 +        }
  7.1228 +    }
  7.1229 +
  7.1230 +    #   determine contained XML/RDF indices
  7.1231 +    if ($sub) {
  7.1232 +        @include = map {
  7.1233 +            goodpf($_->{platform}, $pfmatch)
  7.1234 +            ? ( $_->{href} )
  7.1235 +            : ( )
  7.1236 +        } @$sub;
  7.1237 +    }
  7.1238 +
  7.1239 +    #   return contained XML/RDF indices
  7.1240 +    return \@include;
  7.1241 +}
  7.1242 +
  7.1243 +#   convert XML parser output to dependency records
  7.1244 +sub depend_list ($) {
  7.1245 +    my ($dl) = @_;
  7.1246 +    foreach (@$dl) {
  7.1247 +        $_->{value} = parse_depends($_->{value});
  7.1248 +    }
  7.1249 +    return $dl;
  7.1250 +}
  7.1251 +
  7.1252 +#   convert simple XML parser Bag into flat list
  7.1253 +sub swith ($$) {
  7.1254 +    my ($bags,$name) = @_;
  7.1255 +    my ($cond);
  7.1256 +    my (@out);
  7.1257 +
  7.1258 +    foreach $cond (keys %$bags) {
  7.1259 +        foreach (@{$bags->{$cond}->{$name}}) {
  7.1260 +            push @out, {
  7.1261 +                cond  => $cond,
  7.1262 +                value => $_
  7.1263 +            };
  7.1264 +        }
  7.1265 +    }
  7.1266 +    return \@out;
  7.1267 +}
  7.1268 +
  7.1269 +#   convert (conditional) XML/RDF Bag into flat list
  7.1270 +sub xwith ($) {
  7.1271 +    my ($bags) = @_;
  7.1272 +    my ($bag, $li, $el);
  7.1273 +    my (@out);
  7.1274 +
  7.1275 +    foreach $bag (@$bags) {
  7.1276 +        foreach $li (@{$bag->{'rdf:bag'}}) {
  7.1277 +            $el = $li->{'resource'} || $li->{'rdf:li'};
  7.1278 +            foreach (@$el) {
  7.1279 +                push @out, {
  7.1280 +                    cond   => $bag->{'cond'},
  7.1281 +                    value  => $_
  7.1282 +                };
  7.1283 +            }
  7.1284 +        }
  7.1285 +    }
  7.1286 +    return \@out;
  7.1287 +}
  7.1288 +
  7.1289 +#   return node value from XML parser
  7.1290 +sub xel($) {
  7.1291 +    my ($a) = @_;
  7.1292 +    my ($l) = $a->[0];
  7.1293 +    return '' if ref($l);
  7.1294 +    return $l;
  7.1295 +}
  7.1296 +
  7.1297 +#   is the platform a good one?
  7.1298 +sub goodpf ($$) {
  7.1299 +    my ($l, $p) = @_;
  7.1300 +    return 1 if $l eq '';
  7.1301 +    return ($l =~ m/(?:^|\s)\Q$p\E(?:\s|$)/);
  7.1302 +}
  7.1303 +
  7.1304 +
  7.1305 +#############################################################################
  7.1306 +##
  7.1307 +##  FUNCTIONS: HELPER FUNCTIONS FOR XML PARSING & DEPENDENCY PROCESSING
  7.1308 +##
  7.1309 +#############################################################################
  7.1310 +
  7.1311 +#   parse option from RPM output
  7.1312 +#   < "%option with_foo bar"
  7.1313 +#   > $with{"with_foo"} = "bar"
  7.1314 +sub parse_options ($) {
  7.1315 +    my ($l) = @_;
  7.1316 +    $l = join("\n", @$l) if (ref($l));
  7.1317 +    return {} if ($l !~ m/(--define|\%option\s+)/s);
  7.1318 +    my $with = {};
  7.1319 +    $l =~ s/--define\s*'(\S+)\s+(\S+?)'/$with->{$1} = $2, ''/sge;  # before openpkg-20021230
  7.1320 +    $l =~ s/\%option\s+(\S+)\s+(\S+)/$with->{$1} = $2, ''/sge;     # after  openpkg-20021230
  7.1321 +    return $with;
  7.1322 +}
  7.1323 +
  7.1324 +#   fetch targets of a name that satisfy a condition and sort by target
  7.1325 +#   version. Input is a hash of versions(?) on which the condition has
  7.1326 +#   to be true and which points to an array of records with package
  7.1327 +#   version information. Output is the list of version sorted package
  7.1328 +#   version information records.
  7.1329 +sub get_targets ($$) {
  7.1330 +    my ($relmap, $cond) = @_;
  7.1331 +    return (
  7.1332 +        sort {
  7.1333 +            vcmp(vs($a), vs($b));
  7.1334 +        } map {
  7.1335 +            @{$relmap->{$_}}
  7.1336 +        } grep {
  7.1337 +            $cond->($_);
  7.1338 +        } keys %$relmap
  7.1339 +   );
  7.1340 +}
  7.1341 +
  7.1342 +#############################################################################
  7.1343 +##
  7.1344 +##  FUNCTIONS: DEPENDENCY PROCESSING
  7.1345 +##
  7.1346 +#############################################################################
  7.1347 +
  7.1348 +#   search environment for packages that match a pattern
  7.1349 +sub search_pattern ($$) {
  7.1350 +    my ($pattern, $env) = @_;
  7.1351 +    my (@todo);
  7.1352 +
  7.1353 +    if (defined($pattern)) {
  7.1354 +        #   explicitly given package pattern
  7.1355 +        @todo = map {
  7.1356 +            my ($p) = $_;
  7.1357 +            my ($s, $iswildcard);
  7.1358 +            $s = $1 if ($p =~ s/(,[^\s,]+)$//);
  7.1359 +            if ($p =~ s/\*+$//) {
  7.1360 +                $p = '^'.quotemeta($p).'';
  7.1361 +                $iswildcard = 1;
  7.1362 +            } else {
  7.1363 +                $p = '^'.quotemeta($p).'$';
  7.1364 +            }
  7.1365 +            map { "$_$s" }
  7.1366 +                grep { m/$p/ && !($iswildcard && exists($env->{exclude}->{$_})) }
  7.1367 +                    keys %{$env->{repository}}
  7.1368 +        } split(/\s+/, $pattern);
  7.1369 +    } else {
  7.1370 +        #   undefined pattern means "-a" option that selects
  7.1371 +        #   all packages from repository that are installed
  7.1372 +        #   and not explicitly excluded on command line
  7.1373 +        @todo = grep {
  7.1374 +            my ($n) = $_;
  7.1375 +               (ref($env->{installed}->{$n}))
  7.1376 +            && !exists($env->{exclude}->{$n})
  7.1377 +            && grep { $_ ne '-' } keys %{$env->{installed}->{$n}}
  7.1378 +        } keys(%{$env->{repository}});
  7.1379 +    }
  7.1380 +    return \@todo;
  7.1381 +}
  7.1382 +
  7.1383 +#   pull in OPTIONS for a package or an RPM file
  7.1384 +my $get_with_cache = {};
  7.1385 +sub get_with ($;$) {
  7.1386 +    my ($t, $fn) = @_;
  7.1387 +    my (@l, %with);
  7.1388 +    my ($optmap, $opt);
  7.1389 +
  7.1390 +    if ($t->{OPTIONS}) {
  7.1391 +        $opt = $t->{OPTIONS};
  7.1392 +    } else {
  7.1393 +        if (defined($fn)) {
  7.1394 +            @l = run($config->{"rpm"} . " -q --provides -p $fn");
  7.1395 +        } else {
  7.1396 +            if (not exists($get_with_cache->{-provides})) {
  7.1397 +                #   pre-cache the "provides" query for all(!) packages at once for speedup
  7.1398 +                my @c = run($config->{"rpm"} . " -qa --qf " .
  7.1399 +                    '\'%{NAME}[ :::%{PROVIDENAME}:::%{PROVIDEFLAGS:depflags}:::%{PROVIDEVERSION}:::]\n\'');
  7.1400 +                $get_with_cache->{-provides} = {};
  7.1401 +                foreach my $c (@c) {
  7.1402 +                    if ($c =~ m/^(\S+)(.*)$/s) {
  7.1403 +                        my ($name, $provides) = ($1, $2);
  7.1404 +                        while ($provides =~ m/\s+:::(.+?):::\s*(.*?)\s*:::(.*?):::/g) {
  7.1405 +                            $get_with_cache->{-provides}->{$name} = [] if (not exists($get_with_cache->{-provides}->{$name}));
  7.1406 +                            push(@{$get_with_cache->{-provides}->{$name}}, "$1 $2 $3");
  7.1407 +                        }
  7.1408 +                    }
  7.1409 +                }
  7.1410 +            }
  7.1411 +            @l = $get_with_cache->{-provides}->{$t->{name}};
  7.1412 +            if (not @l) {
  7.1413 +                #   (should not happen in practice, but anyway)
  7.1414 +                @l = run($config->{"rpm"} . " -q --provides $t->{name}");
  7.1415 +                $get_with_cache->{-provides}->{$t->{name}} = [ @l ];
  7.1416 +            }
  7.1417 +        }
  7.1418 +        $opt = parse_provideslist(\@l);
  7.1419 +        if (scalar(keys(%$opt)) == 0) {
  7.1420 +            if (defined($fn)) {
  7.1421 +                @l = run($config->{"rpm"} . " -qi -p $fn");
  7.1422 +            } else {
  7.1423 +                if (not exists($get_with_cache->{-infos})) {
  7.1424 +                    #   pre-cache the "infos" query for all(!) packages at once for speedup
  7.1425 +                    my @c = run($config->{"rpm"} . " -qi -a");
  7.1426 +                    my $p = "";
  7.1427 +                    $get_with_cache->{-infos} = {};
  7.1428 +                    foreach my $c (@c) {
  7.1429 +                        $p = $1 if ($c =~ m/^Name:\s+(\S+)/s);
  7.1430 +                        $get_with_cache->{-infos}->{$p} = [] if (not exists($get_with_cache->{-infos}->{$p}));
  7.1431 +                        push(@{$get_with_cache->{-infos}->{$p}}, $c);
  7.1432 +                    }
  7.1433 +                }
  7.1434 +                @l = $get_with_cache->{-infos}->{$t->{name}};
  7.1435 +                if (not @l) {
  7.1436 +                    #   (should not happen in practice, but anyway)
  7.1437 +                    @l = run($config->{"rpm"} . " -qi $t->{name}");
  7.1438 +                    $get_with_cache->{-infos}->{$t->{name}} = [ @l ];
  7.1439 +                }
  7.1440 +            }
  7.1441 +            $opt = parse_options(\@l);
  7.1442 +        }
  7.1443 +        $t->{OPTIONS} = $opt;
  7.1444 +    }
  7.1445 +    return $opt;
  7.1446 +}
  7.1447 +
  7.1448 +#   copy options from new to old
  7.1449 +#   where option already exists in old or option key
  7.1450 +#   matches regular expression
  7.1451 +sub override_options ($$$) {
  7.1452 +    my ($old, $new, $reg) = @_;
  7.1453 +    my ($k);
  7.1454 +
  7.1455 +    foreach $k (keys(%$new)) {
  7.1456 +        if ((exists($old->{$k}) && $old->{$k} ne $new->{$k}) || $k =~ m/^$reg$/) {
  7.1457 +            $old->{$k} = $new->{$k};
  7.1458 +        }
  7.1459 +    }
  7.1460 +}
  7.1461 +
  7.1462 +#   filter package options
  7.1463 +sub filter_name_with ($$$) {
  7.1464 +    my ($name, $with, $global) = @_;
  7.1465 +    my (@keys);
  7.1466 +
  7.1467 +    if ($global) {
  7.1468 +        push(@keys, grep { !/::/ } keys %$with);
  7.1469 +    }
  7.1470 +    push(@keys, grep { m/::/ } keys %$with);
  7.1471 +    return {
  7.1472 +        map {
  7.1473 +            my ($k) = $_;
  7.1474 +              $k !~ m/::/ || $k =~ s/^\Q$name\E:://
  7.1475 +            ? ( $k => $with->{$_} )
  7.1476 +            : ( )
  7.1477 +        } @keys
  7.1478 +    };
  7.1479 +}
  7.1480 +
  7.1481 +#   filter out package relevant options
  7.1482 +sub name_with ($$) {
  7.1483 +    filter_name_with($_[0], $_[1], 1);
  7.1484 +}
  7.1485 +
  7.1486 +#   filter out package specific options
  7.1487 +sub name_only_with ($$) {
  7.1488 +    filter_name_with($_[0], $_[1], 0);
  7.1489 +}
  7.1490 +
  7.1491 +#   evaluate a condition attribute from an option set
  7.1492 +sub conditional ($$) {
  7.1493 +    my ($cond, $with) = @_;
  7.1494 +    my (@s, $res);
  7.1495 +
  7.1496 +    return 1 if ($cond eq '' || !defined($with));
  7.1497 +    foreach (split(/\s+/,$cond)) {
  7.1498 +        if ($_ eq '+') {
  7.1499 +            die "openpkg:build:FATAL: stack underflow in: $cond\n" if scalar(@s) < 2;
  7.1500 +            my ($a) = pop(@s);
  7.1501 +            my ($b) = pop(@s);
  7.1502 +            push(@s, $a && $b);
  7.1503 +        } elsif ($_ eq '|') {
  7.1504 +            die "openpkg:build:FATAL: stack underflow in: $cond\n" if scalar(@s) < 2;
  7.1505 +            my ($a) = pop(@s);
  7.1506 +            my ($b) = pop(@s);
  7.1507 +            push(@s, $a || $b);
  7.1508 +        } elsif ($_ eq '!') {
  7.1509 +            die "openpkg:build:FATAL: stack underflow in: $cond\n" if scalar(@s) < 1;
  7.1510 +            my ($a) = pop(@s);
  7.1511 +            push(@s, !$a);
  7.1512 +        } else {
  7.1513 +            push(@s, ($with->{$_} eq 'yes') ? 1 : 0);
  7.1514 +        }
  7.1515 +    }
  7.1516 +    die "openpkg:build:FATAL: stack underflow in: $cond\n" if scalar(@s) < 1;
  7.1517 +    $res = pop(@s);
  7.1518 +
  7.1519 +    die "openpkg:build:FATAL: stack not empty in: $cond\n" if scalar(@s) > 0;
  7.1520 +    return $res;
  7.1521 +}
  7.1522 +
  7.1523 +#   retrieve conditional target attributes in map
  7.1524 +sub target_attribute ($$$;$) {
  7.1525 +    my ($target, $env, $attr, $with) = @_;
  7.1526 +    my ($optreg) = $env->{config}->{optreg};
  7.1527 +    my ($name, @out);
  7.1528 +
  7.1529 +    return if (not $target);
  7.1530 +    $name = $target->{name};
  7.1531 +
  7.1532 +    my ($mywith) = ($with ? $with : get_with($target));
  7.1533 +    override_options($mywith, name_with($name, $env->{with}), $optreg);
  7.1534 +
  7.1535 +    foreach (@{$target->{$attr}}) {
  7.1536 +        next if (not conditional($_->{'cond'}, $mywith));
  7.1537 +        push(@out, $_->{'value'});
  7.1538 +    }
  7.1539 +    return \@out;
  7.1540 +}
  7.1541 +
  7.1542 +#   see whether target is in map
  7.1543 +sub target_exists ($$) {
  7.1544 +    my ($target, $map) = @_;
  7.1545 +    my ($vmap) = $map->{$target->{name}};
  7.1546 +    return if (not $vmap);
  7.1547 +    return (
  7.1548 +           !defined $target->{version}
  7.1549 +        || defined $vmap->{vs($target)}
  7.1550 +    );
  7.1551 +}
  7.1552 +
  7.1553 +#   see whether target has conflicts
  7.1554 +sub target_conflicts ($$) {
  7.1555 +    my ($target, $env) = @_;
  7.1556 +    return target_attribute($target, $env, 'conflicts');
  7.1557 +}
  7.1558 +
  7.1559 +#   retrieve build dependencies for target
  7.1560 +sub target_depends ($$) {
  7.1561 +    my ($target, $env) = @_;
  7.1562 +    return target_attribute($target, $env, 'depends');
  7.1563 +}
  7.1564 +
  7.1565 +#   retrieve runtime dependencies for target
  7.1566 +sub target_keeps ($$) {
  7.1567 +    my ($target, $env) = @_;
  7.1568 +    return target_attribute($target, $env, 'keeps');
  7.1569 +}
  7.1570 +
  7.1571 +#   retrieve source list for target
  7.1572 +sub target_source ($$) {
  7.1573 +    my ($target, $env) = @_;
  7.1574 +    return target_attribute($target, $env, 'source');
  7.1575 +}
  7.1576 +
  7.1577 +#   retrieve nosource list for target
  7.1578 +sub target_nosource ($$) {
  7.1579 +    my ($target, $env) = @_;
  7.1580 +    return target_attribute($target, $env, 'nosource');
  7.1581 +}
  7.1582 +
  7.1583 +#   check whether target conflicts against map
  7.1584 +sub target_has_conflicts ($$$) {
  7.1585 +    my ($target, $map, $env) = @_;
  7.1586 +    my ($conflicts, $t);
  7.1587 +
  7.1588 +    $conflicts = target_conflicts($target, $env);
  7.1589 +    foreach (@$conflicts) {
  7.1590 +        my ($t) = find_target($_, $map, 0);
  7.1591 +        return $t if $t;
  7.1592 +    }
  7.1593 +    return;
  7.1594 +}
  7.1595 +
  7.1596 +#   record target status
  7.1597 +sub target_setstatus ($$$) {
  7.1598 +    my ($target, $status, $pri) = @_;
  7.1599 +
  7.1600 +    if ($pri > $target->{STATUSPRI}) {
  7.1601 +        $target->{STATUSPRI} = $pri;
  7.1602 +        $target->{STATUS}    = $status;
  7.1603 +    }
  7.1604 +}
  7.1605 +
  7.1606 +#   strip doubles from depend/keep lists
  7.1607 +#   and return a map name => depend/keep
  7.1608 +sub unique_map {
  7.1609 +    my (%out);
  7.1610 +    foreach (@_) {
  7.1611 +        foreach (@$_) {
  7.1612 +            $out{$_->{name}} = $_;
  7.1613 +        }
  7.1614 +    }
  7.1615 +    return %out;
  7.1616 +}
  7.1617 +
  7.1618 +#   check whether installed package matches build options. If default
  7.1619 +#   = 1 then options which are not required must be identical to the
  7.1620 +#   DEFOPTS.
  7.1621 +sub target_suitable ($$$) {
  7.1622 +    my ($target, $with, $default) = @_;
  7.1623 +    my ($iwith, $dwith);
  7.1624 +    my ($k, $v);
  7.1625 +
  7.1626 +    if ($target->{GOAL}) {
  7.1627 +        $with = name_with($target->{name}, $with);
  7.1628 +    } else {
  7.1629 +        $with = name_only_with($target->{name}, $with);
  7.1630 +    }
  7.1631 +    $iwith = $target->{OPTIONS};
  7.1632 +    $dwith = $target->{DEFOPTS};
  7.1633 +    while (($k,$v) = each(%$iwith)) {
  7.1634 +        if (exists($with->{$k})) {
  7.1635 +            return 0 if ($iwith->{$k} ne $with->{$k});
  7.1636 +        } elsif ($default) {
  7.1637 +            return 0 if ($iwith->{$k} ne $dwith->{$k});
  7.1638 +        }
  7.1639 +    }
  7.1640 +    return 1;
  7.1641 +}
  7.1642 +
  7.1643 +#   determine whether target should be rebuild
  7.1644 +sub target_better ($$$) {
  7.1645 +    my ($env, $target, $map) = @_;
  7.1646 +    my ($vs) = vs($target);
  7.1647 +    my ($vmap) = $map->{$target->{name}};
  7.1648 +
  7.1649 +    #   rebuild if target isn't installed
  7.1650 +    return 'new' unless $vmap;
  7.1651 +
  7.1652 +    #   if "-e" then
  7.1653 +    #   always update if installed version is different from repository
  7.1654 +    if ($env->{exact} && !grep { vcmp($vs, $_) == 0; } keys(%$vmap)) {
  7.1655 +        return 'exact';
  7.1656 +    }
  7.1657 +
  7.1658 +    #   if target is goal
  7.1659 +    #   always update if installed version is older than repository
  7.1660 +    if ($target->{GOAL} && !grep { vcmp($vs, $_) <= 0; } keys(%$vmap)) {
  7.1661 +        return 'goal';
  7.1662 +    }
  7.1663 +
  7.1664 +    #   if -U then
  7.1665 +    #   always update if installed version is older than repository
  7.1666 +    if ($env->{upgrade} && !grep { vcmp($vs, $_) <= 0; } keys(%$vmap)) {
  7.1667 +        return 'upgrade';
  7.1668 +    }
  7.1669 +
  7.1670 +    #   if -z/-Z then
  7.1671 +    #   always update if installed version is equal or older than repository
  7.1672 +    if ($env->{zero} && grep { vcmp($vs, $_) >= 0; } keys(%$vmap)) {
  7.1673 +        return 'zero';
  7.1674 +    }
  7.1675 +
  7.1676 +    #   keep installed target
  7.1677 +    return;
  7.1678 +}
  7.1679 +
  7.1680 +#   check if target record describes a source package
  7.1681 +sub is_source ($) {
  7.1682 +    my ($t) = @_;
  7.1683 +    return !(defined $t->{'prefix'});
  7.1684 +}
  7.1685 +
  7.1686 +#   there can be multiple sources for a target release
  7.1687 +sub chose_source ($$$$$) {
  7.1688 +    my ($env, $name, $select, $vmap, $cond) = @_;
  7.1689 +    my (@targ, @recs, @nrecs, $rec, %nam);
  7.1690 +
  7.1691 +    #   resolve name into a list of versions
  7.1692 +    #   for virtual targets this resolves to a list
  7.1693 +    #   of real targets that provide the virtual target
  7.1694 +    @targ = get_targets($vmap, sub { 1; });
  7.1695 +    return unless @targ;
  7.1696 +
  7.1697 +    #   find usable binary targets add all source targets
  7.1698 +    @recs = (
  7.1699 +        ( grep {
  7.1700 +               !$env->{sourceonly}
  7.1701 +            && !is_source($_)
  7.1702 +            && $_->{'platform'} eq $env->{config}->{platform}
  7.1703 +            && $_->{'prefix'} eq $env->{config}->{prefix}
  7.1704 +        } get_targets($vmap, $cond) ),
  7.1705 +        ( grep {
  7.1706 +            is_source($_)
  7.1707 +        } @targ )
  7.1708 +    );
  7.1709 +    return if (not @recs);
  7.1710 +
  7.1711 +    #   limit list to exact matches if provided by "-e"
  7.1712 +    if (defined($select)) {
  7.1713 +        @recs = grep {
  7.1714 +            vsn($_) =~ m/^\Q$select\E/
  7.1715 +        } @recs;
  7.1716 +    }
  7.1717 +
  7.1718 +    #   try to resolve ambiguity against installed targets
  7.1719 +    #   and targets previously selected
  7.1720 +    if (scalar(@recs) > 1) {
  7.1721 +        @nrecs = grep {
  7.1722 +               $env->{built}->{$_->{name}}
  7.1723 +            || $env->{installed}->{$_->{name}}
  7.1724 +        } @recs;
  7.1725 +        @recs = @nrecs if (@nrecs);
  7.1726 +    }
  7.1727 +
  7.1728 +    #   try to resolve ambiguity against hints
  7.1729 +    if ($env->{hint}) {
  7.1730 +        @nrecs = grep {
  7.1731 +            exists($env->{hint}->{$_->{name}})
  7.1732 +        } @recs;
  7.1733 +        @recs = @nrecs if (@nrecs);
  7.1734 +    }
  7.1735 +
  7.1736 +    #   try to resolve ambiguity against targets that match
  7.1737 +    #   the exact name
  7.1738 +    if (scalar(@recs) > 1) {
  7.1739 +        @nrecs = grep {
  7.1740 +            $name eq $_->{name}
  7.1741 +        } @recs;
  7.1742 +        @recs = @nrecs if (@nrecs);
  7.1743 +    }
  7.1744 +
  7.1745 +    #   try to resolve ambiguity by preferring binaries
  7.1746 +    if (scalar(@recs) > 1 && !$env->{sourceonly}) {
  7.1747 +        @nrecs = grep {
  7.1748 +            defined($_->{'platform'})
  7.1749 +        } @recs;
  7.1750 +        @recs = @nrecs if (@nrecs);
  7.1751 +    }
  7.1752 +
  7.1753 +    #   if we still have non-unique targets, complain
  7.1754 +    if (scalar(@recs) > 1) {
  7.1755 +        %nam = map { $_->{name} => 1 } @recs;
  7.1756 +        if (scalar(keys(%nam)) > 1) {
  7.1757 +            print "# ambigous sources for $name\n";
  7.1758 +            my ($i) = 0;
  7.1759 +            foreach (@recs) {
  7.1760 +                print "# $i: ".vsn($_)." = $_->{href}\n";
  7.1761 +                $i++;
  7.1762 +            }
  7.1763 +            return;
  7.1764 +        }
  7.1765 +    }
  7.1766 +
  7.1767 +    #   prefer full-source packages
  7.1768 +    if (scalar(@recs) > 1) {
  7.1769 +        @nrecs = grep {
  7.1770 +               ! $_->{nosource}
  7.1771 +            || ! @{$_->{nosource}}
  7.1772 +        } @recs;
  7.1773 +        unless (@nrecs) {
  7.1774 +            @nrecs = grep {
  7.1775 +                $_->{href} !~ m/\.nosrc.rpm$/
  7.1776 +            } @recs;
  7.1777 +        }
  7.1778 +        @recs = @nrecs if (@nrecs);
  7.1779 +    }
  7.1780 +
  7.1781 +    #   nothing left -> exit
  7.1782 +    return if (scalar(@recs) == 0);
  7.1783 +
  7.1784 +    #   chose last (= max version) in list of targets
  7.1785 +    $rec = $recs[-1];
  7.1786 +    print "# source for $name is ".vsn($rec)."\n";
  7.1787 +    return $rec;
  7.1788 +}
  7.1789 +
  7.1790 +#   locate target for a dependency
  7.1791 +sub dep2target ($$$) {
  7.1792 +    my ($dep, $env, $source) = @_;
  7.1793 +    my ($name, $op, @targ);
  7.1794 +    my ($i, $r, $b, $cond, $version);
  7.1795 +    my ($t, $tdef, $why);
  7.1796 +
  7.1797 +    ($name, $op, $version) = ($dep->{name}, $dep->{op}, $dep->{val});
  7.1798 +
  7.1799 +    $i = $env->{installed}->{$name};
  7.1800 +    $r = $env->{repository}->{$name};
  7.1801 +    $b = $env->{built}->{$name};
  7.1802 +
  7.1803 +    return if (not ($i || $r || $b));
  7.1804 +
  7.1805 +    if (!defined($op)) {
  7.1806 +        $cond = sub { 1; };
  7.1807 +    } elsif ($op eq 'geq') {
  7.1808 +        $cond = sub { vcmp($_[0],$version) >= 0; };
  7.1809 +    } elsif ($op eq 'leq') {
  7.1810 +        $cond = sub { vcmp($_[0],$version) <= 0; };
  7.1811 +    } elsif ($op eq 'gt') {
  7.1812 +        $cond = sub { vcmp($_[0],$version) >  0; };
  7.1813 +    } elsif ($op eq 'lt') {
  7.1814 +        $cond = sub { vcmp($_[0],$version) <  0; };
  7.1815 +    } elsif ($op eq 'equ') {
  7.1816 +        $cond = sub { vcmp($_[0],$version) == 0; };
  7.1817 +    } else {
  7.1818 +        die "openpkg:build:FATAL: internal error in dep2target\n";
  7.1819 +    }
  7.1820 +
  7.1821 +    $tdef = undef;
  7.1822 +
  7.1823 +    #   search installed target that matches requirement
  7.1824 +    #   use it if we are not upgrading (no -U and no -z/-Z)
  7.1825 +    if ($i && (@targ = get_targets($i, $cond))) {
  7.1826 +        foreach $t (@targ) {
  7.1827 +            get_with($t);
  7.1828 +            if (target_suitable($t, $env->{with}, 0)) {
  7.1829 +                $tdef = $t;
  7.1830 +                if (not ($env->{upgrade} || $env->{zero} || $source)) {
  7.1831 +                    return ($t, 1);
  7.1832 +                }
  7.1833 +            }
  7.1834 +        }
  7.1835 +    }
  7.1836 +
  7.1837 +    #   search target in current build list that matches requirement
  7.1838 +    #   use it if it exists
  7.1839 +    if ($b && (@targ = get_targets($b, $cond))) {
  7.1840 +        $t = $targ[0];
  7.1841 +        return ($t, 1);
  7.1842 +    }
  7.1843 +
  7.1844 +    #   search target in repository and install it, if it is newer than
  7.1845 +    #   corresponding installed versions avoid repository packages that
  7.1846 +    #   would install 'new' (i.e. are not an upgrade of an existing
  7.1847 +    #   package)
  7.1848 +    $t = chose_source($env, $name, undef, $r, $cond);
  7.1849 +    if ($t) {
  7.1850 +        if (!$tdef || (
  7.1851 +            ($why = target_better($env, $t, $env->{installed})) &&
  7.1852 +            $why ne 'new'
  7.1853 +            ) || $source) {
  7.1854 +            return ($t, 0);
  7.1855 +        }
  7.1856 +    }
  7.1857 +
  7.1858 +    #   if nothing is suitable in repository then fall back to
  7.1859 +    #   anything we already have installed but that we skipped
  7.1860 +    #   above to look for upgrades.
  7.1861 +    if ($tdef) {
  7.1862 +        return ($tdef, 1);
  7.1863 +    }
  7.1864 +
  7.1865 +    return;
  7.1866 +}
  7.1867 +
  7.1868 +#   compute reverse dependency map
  7.1869 +sub get_revdep ($) {
  7.1870 +    my ($env) = @_;
  7.1871 +    my ($i) = $env->{'installed'};
  7.1872 +    my ($r) = $env->{'repository'};
  7.1873 +    my ($pkg, %dep, %dlist, %rev);
  7.1874 +    my (@targ, $t, $t1, $t2, $with, $name, $vmap);
  7.1875 +    my ($d, $k, %d, $old, %name, %pkg);
  7.1876 +
  7.1877 +    print "# computing reverse dependencies\n";
  7.1878 +
  7.1879 +    #   iterate over all installed packages
  7.1880 +    foreach $pkg (keys(%$i)) {
  7.1881 +        $vmap = $r->{$pkg};
  7.1882 +        if (not $vmap) {
  7.1883 +            print "# ATTENTION: $pkg has no upgrade path (installed package not found in repository)\n";
  7.1884 +            next;
  7.1885 +        }
  7.1886 +
  7.1887 +        #   get forward dependencies from installed packages
  7.1888 +        #   dep{a}{b} is true if b depends directly on a
  7.1889 +        #   dlist{a}  is list of packages that depend on a
  7.1890 +        @targ = get_targets($i->{$pkg}, sub { 1; });
  7.1891 +        foreach $t (@targ) {
  7.1892 +            $with = get_with($t);
  7.1893 +            $d = target_attribute($t, $env, 'depends', $with);
  7.1894 +            $k = target_attribute($t, $env, 'keeps', $with);
  7.1895 +            next if (not (@$d || @$k));
  7.1896 +            %d = unique_map($d,$k);
  7.1897 +
  7.1898 +            #   resolve package
  7.1899 +            if (not exists($pkg{$pkg})) {
  7.1900 +                ($t2, $old) = dep2target({ name => $pkg }, $env, 1);
  7.1901 +                $t2 = undef if ($old);
  7.1902 +                $pkg{$pkg} = $t2;
  7.1903 +            }
  7.1904 +            $t2 = $pkg{$pkg};
  7.1905 +            next if (not $t2);
  7.1906 +            foreach (keys(%d)) {
  7.1907 +                next if ($_ eq 'OpenPKG');
  7.1908 +                #   resolve target
  7.1909 +                unless (exists($name{$_})) {
  7.1910 +                    ($t1, $old) = dep2target($d{$_}, $env, 0);
  7.1911 +                    $name{$_} = ($t1 ? $t1->{name} : $_);
  7.1912 +                }
  7.1913 +                $name = $name{$_};
  7.1914 +                if (not $dep{$name}{$t->{name}}) {
  7.1915 +                    $dep{$name}{$t->{name}} = 1;
  7.1916 +                    push(@{$dlist{$name}}, $t2);
  7.1917 +                }
  7.1918 +            }
  7.1919 +        }
  7.1920 +    }
  7.1921 +
  7.1922 +    #   sort reverse dependencies
  7.1923 +    foreach $pkg (keys(%dep)) {
  7.1924 +        $rev{$pkg} = [
  7.1925 +            sort {
  7.1926 +                   $dep{$b->{name}}{$a->{name}}
  7.1927 +                || -$dep{$a->{name}}{$b->{name}}
  7.1928 +                || $a->{name} cmp $b->{name}
  7.1929 +            } @{$dlist{$pkg}}
  7.1930 +        ];
  7.1931 +    }
  7.1932 +
  7.1933 +    #   return hash of package reverse dependencies
  7.1934 +    return \%rev;
  7.1935 +}
  7.1936 +
  7.1937 +#   build package dependencies
  7.1938 +#   (all input and output is passed in 'env' hash)
  7.1939 +sub build_deps ($$) {
  7.1940 +    my ($pattern, $env) = @_;
  7.1941 +    my ($todo, @list, $list, @out);
  7.1942 +
  7.1943 +    #   determine all packages which match the pattern
  7.1944 +    $todo = search_pattern($pattern, $env);
  7.1945 +
  7.1946 +    #   unfold target names into all(!) real targets names
  7.1947 +    @list =
  7.1948 +    map {
  7.1949 +        map {
  7.1950 +            map {
  7.1951 +                $_->{name}
  7.1952 +            } @$_
  7.1953 +        } values(%{$env->{repository}->{$_}})
  7.1954 +    } @$todo;
  7.1955 +
  7.1956 +    #   also add target name
  7.1957 +    push @list, @$todo;
  7.1958 +
  7.1959 +    #   strip duplicate names
  7.1960 +    @list = keys %{ { map { $_ => 1 } @list } };
  7.1961 +
  7.1962 +    #   cache reverse dependencies
  7.1963 +    if (not $env->{revdep}) {
  7.1964 +        $env->{revdep} = get_revdep($env);
  7.1965 +    }
  7.1966 +
  7.1967 +    #   map targets into list of dependency names
  7.1968 +    @list = map {
  7.1969 +          $env->{revdep}->{$_}
  7.1970 +        ? (@{$env->{revdep}->{$_}})
  7.1971 +        : ()
  7.1972 +    } @list;
  7.1973 +
  7.1974 +    #   iterate over dependencies
  7.1975 +    foreach (@list) {
  7.1976 +        #   avoiding cycles
  7.1977 +        next if ($env->{builddeps}->{$_->{name}});
  7.1978 +        $env->{builddeps}->{$_->{name}} = 1;
  7.1979 +
  7.1980 +        #   generate result
  7.1981 +        push(@out, $_);
  7.1982 +
  7.1983 +        #   generate result recursively
  7.1984 +        $list = build_deps($_->{name}, $env); # RECURSION
  7.1985 +        push(@out, @$list);
  7.1986 +    }
  7.1987 +
  7.1988 +    #   return final results
  7.1989 +    return \@out;
  7.1990 +}
  7.1991 +
  7.1992 +#   report options that are not used for
  7.1993 +sub warn_about_options ($$$) {
  7.1994 +    my ($target, $with, $c) = @_;
  7.1995 +    my ($iwith) = $target->{OPTIONS};
  7.1996 +    my ($k, $v);
  7.1997 +
  7.1998 +    return if (not defined($iwith));
  7.1999 +    $with = name_with($target->{name}, $with);
  7.2000 +    while (($k,$v) = each %$with) {
  7.2001 +        if (not ($k =~ m/^$c->{optreg}$/ || exists $iwith->{$k})) {
  7.2002 +            print "# ATTENTION: $target->{name} ignores option '$k'\n";
  7.2003 +        }
  7.2004 +    }
  7.2005 +}
  7.2006 +
  7.2007 +#   find target in map
  7.2008 +sub find_target ($$$) {
  7.2009 +    my ($name, $map, $pos) = @_;
  7.2010 +    my ($vmap) = $map->{$name};
  7.2011 +    my (@vs);
  7.2012 +
  7.2013 +    return if (not $vmap);
  7.2014 +    @vs = sort { vcmp($b,$a) } keys(%$vmap);
  7.2015 +    return $vmap->{$vs[$pos]}->[-1];
  7.2016 +}
  7.2017 +
  7.2018 +#   add dependency as build option
  7.2019 +sub depend_option ($$$) {
  7.2020 +    my ($target, $dep, $env) = @_;
  7.2021 +    my ($with, $opt, $relmap, @t, $t);
  7.2022 +    my ($pro) = depends2provides($dep);
  7.2023 +    my ($conflict) = 0;
  7.2024 +
  7.2025 +    return 1 if (not defined($pro->{with}));
  7.2026 +
  7.2027 +    my ($val) = defined($pro->{version}) ? $pro->{version} : 'yes';
  7.2028 +
  7.2029 +    $with = $env->{with};
  7.2030 +    $opt  = $pro->{prefix}.'::'.$pro->{with};
  7.2031 +    if (defined($with->{$opt}) && $with->{$opt} ne $val) {
  7.2032 +        print "# ", vsn($target), " has conflicting requirement $opt = $with->{$opt} != $val\n";
  7.2033 +        $conflict = 1;
  7.2034 +    }
  7.2035 +
  7.2036 +    $relmap = $env->{built}->{$pro->{prefix}};
  7.2037 +    @t = get_targets($relmap, sub { 1; });
  7.2038 +    foreach $t (@t) {
  7.2039 +        $with = $t->{OPTIONS};
  7.2040 +        $opt  = $pro->{with};
  7.2041 +        if (defined($with->{$opt}) && $with->{$opt} ne $val) {
  7.2042 +            print "# ", vsn($t), " has conflicting requirement $opt = $with->{$opt} != $val\n";
  7.2043 +            $conflict = 1;
  7.2044 +        }
  7.2045 +    }
  7.2046 +
  7.2047 +    return 0 if ($conflict);
  7.2048 +
  7.2049 +    print "# ", vsn($target), " adds option $opt = $val\n";
  7.2050 +    $with->{$opt} = $val;
  7.2051 +    return 1;
  7.2052 +}
  7.2053 +
  7.2054 +#   remember fatal error
  7.2055 +sub pusherr ($$$) {
  7.2056 +    my ($env, $target, $mess) = @_;
  7.2057 +    print "# $mess\n";
  7.2058 +    push(@{$env->{fatal}}, vsn($target).": $mess\n");
  7.2059 +}
  7.2060 +
  7.2061 +#   generate dependencies
  7.2062 +sub make_dep ($$$$$$$) {
  7.2063 +    my ($who, $target, $depth, $env, $list, $blist, $clist) = @_;
  7.2064 +    my ($d, $k, %d, %k, $t, $old);
  7.2065 +    my (@deps, $conflict, $why);
  7.2066 +
  7.2067 +    #   check whether target is already in list of to be build packages
  7.2068 +    if (target_exists($target, $env->{built})) {
  7.2069 +        print "# $target->{name} is already in list\n";
  7.2070 +        return;
  7.2071 +    }
  7.2072 +
  7.2073 +    #   check whether target is in conflict with already installed package
  7.2074 +    if ($t = target_has_conflicts($target, $env->{installed}, $env)) {
  7.2075 +        target_setstatus($target, 'CONFLICT', 4);
  7.2076 +        push(@$clist, $target);
  7.2077 +        pusherr($env, $target, "$target->{name} conflicts with ".vsn($t));
  7.2078 +        return;
  7.2079 +    }
  7.2080 +
  7.2081 +    #   check whether target is in conflict with to be build package
  7.2082 +    if ($t = target_has_conflicts($target, $env->{built}, $env)) {
  7.2083 +        target_setstatus($target, 'CONFLICT', 4);
  7.2084 +        push(@$clist, $target);
  7.2085 +        pusherr($env, $target, "$target->{name} conflicts with ".vsn($t));
  7.2086 +        return;
  7.2087 +    }
  7.2088 +
  7.2089 +    #   see if a target is already installed and requires a rebuild
  7.2090 +    if ($t = find_target($target->{name}, $env->{installed}, -1)) {
  7.2091 +        if (exists($env->{exclude}->{$target->{name}})) {
  7.2092 +            print "# excluding $target->{name} (no upgrade allowed)\n";
  7.2093 +            return;
  7.2094 +        }
  7.2095 +
  7.2096 +        #   pull in options (for status report)
  7.2097 +        if ($target->{REBUILD}) {
  7.2098 +            target_setstatus($target, 'DEPEND', 1);
  7.2099 +            print "# rebuilding $target->{name} (dependency)\n";
  7.2100 +        } elsif ($env->{zero}) {
  7.2101 +            target_setstatus($target, 'ZERO', 1);
  7.2102 +            print "# rebuilding $target->{name} (zero)\n";
  7.2103 +        } elsif (vs($target) ne vs($t)) {
  7.2104 +            target_setstatus($target, 'UPDATE', 3);
  7.2105 +            print "# rebuilding $target->{name} (update)\n";
  7.2106 +        } elsif (!target_suitable($t, $env->{with}, 0)) {
  7.2107 +            target_setstatus($target, 'MISMATCH', 2);
  7.2108 +            print "# rebuilding $target->{name} (parameter mismatch)\n";
  7.2109 +        } elsif ($env->{goals} && $target->{GOAL}) {
  7.2110 +            target_setstatus($target, 'GOAL', 3);
  7.2111 +            print "# rebuilding $target->{name} (goal)\n";
  7.2112 +        } else {
  7.2113 +            print "# $target->{name} is already installed\n";
  7.2114 +            return;
  7.2115 +        }
  7.2116 +
  7.2117 +        #   use options from installed base
  7.2118 +        override_options(get_with($target), get_with($t), $env->{config}->{optreg});
  7.2119 +
  7.2120 +        #   remember this is a rebuild for a proxy package
  7.2121 +        $target->{PROXY} = $t->{PROXY};
  7.2122 +        $target->{REBUILD} = 1;
  7.2123 +    } else {
  7.2124 +        print "# creating $target->{name}\n";
  7.2125 +        target_setstatus($target, 'ADD', 3);
  7.2126 +    }
  7.2127 +
  7.2128 +    if (exists($env->{exclude}->{$target->{name}})) {
  7.2129 +        die "openpkg:build:FATAL: target ".vsn($target)." is forbidden\n";
  7.2130 +    }
  7.2131 +
  7.2132 +    #   mark this as a target before reverse dependencies trigger it again
  7.2133 +    push(@{$env->{built}->{$target->{name}}->{vs($target)}}, $target);
  7.2134 +    $target->{LIMBO} = 1;
  7.2135 +
  7.2136 +    #   recurse over dependencies
  7.2137 +    $d = target_depends($target, $env);
  7.2138 +    $k = target_keeps($target, $env);
  7.2139 +    if (@$d || @$k) {
  7.2140 +        %d = unique_map($d, $k);
  7.2141 +        %k = unique_map($k);
  7.2142 +        @deps     = ();
  7.2143 +        $conflict = 0;
  7.2144 +        foreach (keys %d) {
  7.2145 +            #   old index misses a OpenPKG provider in the index... skip it
  7.2146 +            next if ($_ eq 'OpenPKG');
  7.2147 +            ($t, $old) = dep2target($d{$_}, $env, 0);
  7.2148 +            if ($t) {
  7.2149 +                if ($old) {
  7.2150 +                    print "# $target->{name} uses ".vsn($t)." for $_\n";
  7.2151 +                    if ($t->{LIMBO}) {
  7.2152 +                        print "# ATTENTION: ".vsn($t)." is in LIMBO\n";
  7.2153 +                    }
  7.2154 +                    next;
  7.2155 +                }
  7.2156 +                if (not depend_option($t, $d{$_}, $env)) {
  7.2157 +                    push(@$clist, $target);
  7.2158 +                    pusherr($env, $target, "$target->{name} has conflicting requirement");
  7.2159 +                    target_setstatus($target, 'UNDEF', 4);
  7.2160 +                    $conflict = 1;
  7.2161 +                    next;
  7.2162 +                }
  7.2163 +                if ($k{$_}) {
  7.2164 +                    push(@$blist, $t);
  7.2165 +                    print "# $target->{name} installs ".vsn($t)." for $_\n";
  7.2166 +                } else {
  7.2167 +                    print "# $target->{name} requires ".vsn($t)." for $_\n";
  7.2168 +                }
  7.2169 +                push(@deps, $t);
  7.2170 +            } else {
  7.2171 +                push(@$clist, $target);
  7.2172 +                pusherr($env, $target, "$target->{name} searches a frood called '$_'");
  7.2173 +                target_setstatus($target, 'UNDEF', 4);
  7.2174 +                $conflict = 1;
  7.2175 +            }
  7.2176 +        }
  7.2177 +        if (not $conflict) {
  7.2178 +            foreach $t (@deps) {
  7.2179 +                make_dep($target, $t, $depth+1, $env, $list, $blist, $clist); # RECURSION
  7.2180 +            }
  7.2181 +        }
  7.2182 +    }
  7.2183 +
  7.2184 +    print "# adding ".vsn($target)." to list\n";
  7.2185 +    $target->{WHO} = $who;
  7.2186 +    $target->{WHY} = $target->{STATUS};
  7.2187 +    push(@$list, $target);
  7.2188 +
  7.2189 +    #   remember new options
  7.2190 +    override_options(get_with($target), name_with($target->{name}, $env->{with}), '');
  7.2191 +
  7.2192 +    #   moan about non-source packages
  7.2193 +    foreach (@{target_nosource($target, $env)}) {
  7.2194 +        my ($p) = target_source($target, $env)->[$_];
  7.2195 +        $p =~ s/.*\///;
  7.2196 +        print "# ATTENTION: unpackaged source $_: $p\n";
  7.2197 +    }
  7.2198 +
  7.2199 +    #   cleanup limbo
  7.2200 +    $target->{LIMBO} = 0;
  7.2201 +
  7.2202 +    #   a dependency could not be resolved, don't bother with reverse
  7.2203 +    #   dependencies for this target
  7.2204 +    return if ($conflict);
  7.2205 +
  7.2206 +    if (!$env->{quick} && $target->{name} ne 'openpkg' ) {
  7.2207 +        if (not $env->{revdep}) {
  7.2208 +            $env->{revdep} = get_revdep($env);
  7.2209 +        }
  7.2210 +        foreach $t (@{$env->{revdep}->{$target->{name}}}) {
  7.2211 +            #   this is a rebuild, triggering further revdeps
  7.2212 +            $t->{REBUILD} = 1;
  7.2213 +
  7.2214 +            #   this is a rebuild, keep this installed
  7.2215 +            push(@$blist, $t);
  7.2216 +
  7.2217 +            print "# rebuilding reverse dependency ".vsn($t)."\n";
  7.2218 +            make_dep($target, $t, $depth+1, $env, $list, $blist, $clist); # RECURSION
  7.2219 +        }
  7.2220 +    }
  7.2221 +}
  7.2222 +
  7.2223 +#   generate build lists for targets matched by pattern
  7.2224 +#   (all input and output is passed in 'env' hash)
  7.2225 +sub build_list ($$) {
  7.2226 +    my ($pattern, $env) = @_;
  7.2227 +    my (@goals, @targets, @keeps, @conflicts, @bonly, $t);
  7.2228 +    my ($name, $select, $r, $i);
  7.2229 +    my ($todo, %keep);
  7.2230 +
  7.2231 +    #   determine all packages which match the pattern
  7.2232 +    $todo = search_pattern($pattern, $env);
  7.2233 +
  7.2234 +    #   chose sources for goals from repository
  7.2235 +    foreach $name (@$todo) {
  7.2236 +        $select = undef;
  7.2237 +        $select = $1 if ($name =~ s/,([^\s,]+)$//);
  7.2238 +        $t = undef;
  7.2239 +
  7.2240 +        #   keeping installed packages for goals is ugly
  7.2241 +        #   - we currently do not support installed source RPMs
  7.2242 +        #   - source RPMs might already have expired from repository
  7.2243 +        #   consequence:
  7.2244 +        #   - goals are always upgraded to repository versions
  7.2245 +        #if (not $env->{upgrade}) {
  7.2246 +        #    $i = $env->{installed}->{$name};
  7.2247 +        #    $t = chose_source($env, $name, $select, $i, sub { 1; });
  7.2248 +        #}
  7.2249 +        if (not $t) {
  7.2250 +            $r = $env->{repository}->{$name};
  7.2251 +            $t = chose_source($env, $name, $select, $r, sub { 1; });
  7.2252 +        }
  7.2253 +
  7.2254 +        if ($t) {
  7.2255 +            warn_about_options($t, $env->{with}, $env->{config});
  7.2256 +            $t->{GOAL} = 1;
  7.2257 +            push @goals, $t;
  7.2258 +        } else {
  7.2259 +            #   error
  7.2260 +            if ($env->{status}) {
  7.2261 +                print "# dropping goal '$name'\n";
  7.2262 +            } else {
  7.2263 +                die "openpkg:build:FATAL: cannot find source for '$name'\n";
  7.2264 +            }
  7.2265 +        }
  7.2266 +    }
  7.2267 +    return if (not @goals);
  7.2268 +
  7.2269 +    #   recurse over dependencies
  7.2270 +    @targets = ();
  7.2271 +    @keeps   = @goals;
  7.2272 +    foreach $t (@goals) {
  7.2273 +        print "# recursing over dependencies for ".vsn($t)."\n";
  7.2274 +        make_dep(undef, $t, 0, $env, \@targets, \@keeps, \@conflicts);
  7.2275 +    }
  7.2276 +
  7.2277 +    #   determine "binary only" packages which should be not kept
  7.2278 +    #   as they were not installed and are used temporarily only.
  7.2279 +    %keep = map { $_ => 1 } @keeps;
  7.2280 +    @bonly = reverse grep {
  7.2281 +        !$keep{$_} && !$env->{installed}->{$_->{name}}
  7.2282 +    } @targets;
  7.2283 +
  7.2284 +    #   return results
  7.2285 +    return (\@targets, \@bonly, \@conflicts);
  7.2286 +}
  7.2287 +
  7.2288 +
  7.2289 +#############################################################################
  7.2290 +##
  7.2291 +##  FUNCTIONS: RESULT PRINTING
  7.2292 +##
  7.2293 +#############################################################################
  7.2294 +
  7.2295 +#   determine execution command
  7.2296 +sub cmd ($$) {
  7.2297 +    my ($w,$s) = @_;
  7.2298 +    if (!defined($w)) {
  7.2299 +        return $s;
  7.2300 +    } elsif ($w =~ m/^-(.*)/) {
  7.2301 +        return "$1 \"$s\"";
  7.2302 +    } else {
  7.2303 +        return "$w $s";
  7.2304 +    }
  7.2305 +}
  7.2306 +sub priv  ($) { cmd($opt_P, $_[0]); }
  7.2307 +sub npriv ($) { cmd($opt_N, $_[0]); }
  7.2308 +
  7.2309 +#   execute a command
  7.2310 +my $run_cache = {};
  7.2311 +sub run ($) {
  7.2312 +    my $cmd = cmd($opt_N, $_[0]);
  7.2313 +    my $out = $run_cache->{$cmd};
  7.2314 +    if (not defined($out)) {
  7.2315 +        my @out = `$cmd`;
  7.2316 +        $out = [ @out ];
  7.2317 +        $run_cache->{$cmd} = $out;
  7.2318 +    }
  7.2319 +    return (wantarray ? @{$out} : join(//, @{$out}));
  7.2320 +}
  7.2321 +
  7.2322 +#   print dependency list
  7.2323 +sub print_deps ($) {
  7.2324 +    my ($list) = @_;
  7.2325 +
  7.2326 +    print join("\n", sort map { vsn($_) } @$list), "\n";
  7.2327 +}
  7.2328 +
  7.2329 +#   print dependency map
  7.2330 +sub print_map ($$$$$) {
  7.2331 +    my ($installed, $repository, $list, $bonly, $clist) = @_;
  7.2332 +    my (%dep);
  7.2333 +
  7.2334 +    foreach (@$bonly) {
  7.2335 +        $_->{status} = 'TEMP';
  7.2336 +    }
  7.2337 +    foreach (reverse(@$list)) {
  7.2338 +        printf("%-35s %-8s %s\n",
  7.2339 +            $_->{WHO} ? vsn($_->{WHO}) : "GOAL",
  7.2340 +            $_->{WHY} ? $_->{WHY} : '???',
  7.2341 +            vsn($_)
  7.2342 +        );
  7.2343 +    }
  7.2344 +}
  7.2345 +
  7.2346 +#   instead of printing a command list, print a status map
  7.2347 +#   that shows all packages and how the build process would
  7.2348 +#   change their status
  7.2349 +sub print_status ($$$$$) {
  7.2350 +    my ($installed, $repository, $list, $bonly, $clist) = @_;
  7.2351 +    my (%bonly) = map { $_ => 1 } @$bonly;
  7.2352 +    my (%map, $n, @names, $t);
  7.2353 +    my ($old, $tag, $new);
  7.2354 +
  7.2355 +    #   augment map with additional information
  7.2356 +    #   about conflicting and binary only (temporary) packages
  7.2357 +    foreach (@$list, @$clist) {
  7.2358 +        next if (not $_->{release} =~ m/\S/);
  7.2359 +        $map{$_->{name}} = {
  7.2360 +            rel    => "$_->{version}-$_->{release}",
  7.2361 +            status => $_->{STATUS}
  7.2362 +        };
  7.2363 +    }
  7.2364 +    foreach (@$bonly) {
  7.2365 +        next if (not $_->{release} =~ m/\S/);
  7.2366 +        $map{$_->{name}} = {
  7.2367 +            rel    => "$_->{version}-$_->{release}",
  7.2368 +            status => 'TEMP'
  7.2369 +        };
  7.2370 +    }
  7.2371 +
  7.2372 +    #   augment map with additional information
  7.2373 +    #   about up-to-date and new packages
  7.2374 +    @names = keys(%map);
  7.2375 +    foreach $n (keys(%$installed)) {
  7.2376 +        next if ($n =~ m/::/);
  7.2377 +        next if (exists($map{$n}));
  7.2378 +        next if (not (grep { $_ ne '' } keys(%{$installed->{$n}})));
  7.2379 +        $map{$n}->{'status'} = 'OK';
  7.2380 +        push(@names, $n);
  7.2381 +    }
  7.2382 +    foreach $n (keys(%$repository)) {
  7.2383 +        next if ($n =~ m/::/);
  7.2384 +        next if (exists($map{$n}));
  7.2385 +        next if (not (grep { $_ ne '' } keys(%{$repository->{$n}})));
  7.2386 +        $t = find_target($n, $repository, 0);
  7.2387 +        $map{$n}->{'status'} = 'NEW';
  7.2388 +        $map{$n}->{'rel'}    = vs($t);
  7.2389 +        push(@names, $n);
  7.2390 +    }
  7.2391 +
  7.2392 +    #   generate status output
  7.2393 +    foreach $n (sort(@names)) {
  7.2394 +        $old = join(',',
  7.2395 +            map { "$n-$_" }
  7.2396 +            sort
  7.2397 +            grep { $_ ne '-' }
  7.2398 +            keys(%{$installed->{$n}})
  7.2399 +        );
  7.2400 +        $old = $n if ($old eq '');
  7.2401 +        $tag = $map{$n}->{status};
  7.2402 +        $new = defined($map{$n}->{rel}) ? " $n-$map{$n}->{rel}" : '';
  7.2403 +        printf("%-35s %-8s%s\n", $old, $tag, $new);
  7.2404 +    }
  7.2405 +}
  7.2406 +
  7.2407 +#   compute path to source RPM from rpm config and target data
  7.2408 +sub target2srcrpm ($$) {
  7.2409 +    my ($target, $c) = @_;
  7.2410 +    return $c->{srcrpmdir}.'/'.$target->{name}.'-'.$target->{version}.'-'.$target->{release}.'.src.rpm';
  7.2411 +}
  7.2412 +
  7.2413 +#   compute path to binary RPM from rpm config and target data
  7.2414 +sub target2rpm ($$) {
  7.2415 +    my ($target, $c) = @_;
  7.2416 +    my ($tmpl) = $c->{template};
  7.2417 +    my ($popt) = $target->{PROXY} ? '+PROXY' : '';
  7.2418 +
  7.2419 +    $tmpl =~ s/%{NAME}/$target->{name}/;
  7.2420 +    $tmpl =~ s/%{VERSION}/$target->{version}/;
  7.2421 +    $tmpl =~ s/%{RELEASE}/$target->{release}$popt/;
  7.2422 +
  7.2423 +    return $c->{rpmdir}.'/'.$tmpl;
  7.2424 +}
  7.2425 +
  7.2426 +#   merge parameters from installed package
  7.2427 +#   with new parameter set and global parameters
  7.2428 +#   from configuration
  7.2429 +#   then map the result to --define command line arguments
  7.2430 +#   suitable for rpm
  7.2431 +sub make_defines ($$$$) {
  7.2432 +    my ($old, $new, $def, $c) = @_;
  7.2433 +    my ($with);
  7.2434 +
  7.2435 +    $old = {} unless $old;
  7.2436 +    $def = {} unless $def;
  7.2437 +
  7.2438 +    #   override old parameters with new parameters
  7.2439 +    #   drop new parameters that do not exist in old set
  7.2440 +    $old = { %$old };
  7.2441 +    override_options($old, $new, $c->{optreg});
  7.2442 +
  7.2443 +    #   convert parameters to --define command line options
  7.2444 +    #   skip parameter templates from index
  7.2445 +    #   skip parameters that are identical to defaults
  7.2446 +    $with = join(' ',
  7.2447 +        map { "--define '$_ $old->{$_}'" }
  7.2448 +        sort grep {
  7.2449 +            $old->{$_} =~ m/\S/ &&
  7.2450 +            $old->{$_} !~ m/^%/ &&
  7.2451 +            $old->{$_} ne $def->{$_}
  7.2452 +        } keys %$old
  7.2453 +    );
  7.2454 +
  7.2455 +    $with = ' '.$with if ($with ne '');
  7.2456 +
  7.2457 +    return $with;
  7.2458 +}
  7.2459 +
  7.2460 +#   compute new target based on old target augmented with options from
  7.2461 +#   a binary RPM file
  7.2462 +sub binary_target ($$) {
  7.2463 +    my ($t, $fn) = @_;
  7.2464 +    my (%target) = %$t;
  7.2465 +
  7.2466 +    #   pull in options from binary RPM file
  7.2467 +    delete $target{'OPTIONS'};
  7.2468 +    get_with(\%target, $fn);
  7.2469 +    return \%target;
  7.2470 +}
  7.2471 +
  7.2472 +#   return path to master package for a proxy package
  7.2473 +sub find_proxy ($$) {
  7.2474 +    my ($t, $bpkg) = @_;
  7.2475 +    my (@l) = run($config->{"rpm"} . " -ql $t->{name}");
  7.2476 +    my ($link) = (grep { $_ =~ m/\/\.prefix-$t->{name}$/ } @l)[0];
  7.2477 +    return if (not defined($link));
  7.2478 +    chomp $link;
  7.2479 +    my ($prefix) = readlink($link);
  7.2480 +    return if (not defined($prefix));
  7.2481 +    $bpkg =~ s/.*\///;
  7.2482 +    $bpkg =~ s/\+PROXY(\.[^-]+-[^-]+)-[^-]+\.rpm$/$1-*.rpm/;
  7.2483 +    return (glob("$prefix/RPM/PKG/$bpkg"))[0];
  7.2484 +}
  7.2485 +
  7.2486 +#   indent text to form a block
  7.2487 +sub indent ($) {
  7.2488 +    my ($txt) = @_;
  7.2489 +    $txt =~ s/^/    /gm;
  7.2490 +    return $txt;
  7.2491 +}
  7.2492 +
  7.2493 +#   print commands from package build list
  7.2494 +#   c      -> configuration to derive paths from
  7.2495 +#   uncond -> always do the --rebuild
  7.2496 +#   with   -> parameter set passed to build tool
  7.2497 +#   ignore -> generate script that does not stop on error
  7.2498 +#   usebin -> build-time check to skip rebuild when binary exists
  7.2499 +#   allbin -> usebin also for goals
  7.2500 +sub print_list1 ($$$$$$$) {
  7.2501 +    my ($list, $c, $uncond, $with, $ignore, $usebin, $allbin) = @_;
  7.2502 +    my ($pkg, $spkg, $bpkg, $uvhpkg, $ppkg);
  7.2503 +    my ($opt);
  7.2504 +    my ($cmd1, $cmd2, $mark);
  7.2505 +    my ($cmd3, $srcpkg);
  7.2506 +
  7.2507 +    $mark = '::::';
  7.2508 +
  7.2509 +    my $err;
  7.2510 +    if ($ignore) { $err = "|| true" } else { $err = "|| exit \$?" };
  7.2511 +    foreach (@$list) {
  7.2512 +        $pkg = $_->{name};
  7.2513 +        $spkg = $_->{href};
  7.2514 +        unless ($spkg =~ m/\S/) {
  7.2515 +            die "openpkg:build:FATAL: internal error, ",vsn($_)," without source URL\n";
  7.2516 +        }
  7.2517 +        $bpkg = target2rpm($_, $c); $uvhpkg = $bpkg;
  7.2518 +        $srcpkg = target2srcrpm($_, $c);
  7.2519 +        $cmd3 = '';
  7.2520 +
  7.2521 +        #   rebuild binary package IF
  7.2522 +        #   'unconditional' option
  7.2523 +        #   OR target is tagged as rebuilding
  7.2524 +        #   OR there is no binary package
  7.2525 +        #   OR dependency check found that installed package is not suitable
  7.2526 +        #   OR existing binary package doesn't satisfy wanted options
  7.2527 +        $cmd1 = undef;
  7.2528 +        if (   $uncond
  7.2529 +            || !-f $bpkg
  7.2530 +            || !target_suitable(binary_target($_, $bpkg), $with, 1)) {
  7.2531 +
  7.2532 +            $opt = make_defines($_->{OPTIONS}, $with,
  7.2533 +                                $_->{DEFOPTS}, $c);
  7.2534 +
  7.2535 +            #   proxy packages are rebuilt from their maste
  7.2536 +            #   hierachy
  7.2537 +            #   someone preferred a binary from the repository
  7.2538 +            #   just copy it to the local store
  7.2539 +            if ($_->{PROXY}) {
  7.2540 +                $ppkg = find_proxy($_,$bpkg) or
  7.2541 +                die "openpkg:build:FATAL: proxy package ",vsn($_)," does not exist\n";
  7.2542 +
  7.2543 +                #   rpm doesn't support additional parameters to the
  7.2544 +                #   mkproxy script
  7.2545 +                #   $cmd1 = npriv($config->{"mkp"} . " $ppkg -- -o $bpkg");
  7.2546 +                $cmd1 = "( cd $c->{rpmdir} && ".
  7.2547 +                        npriv($config->{"mkp"} . " $ppkg").
  7.2548 +                        " )";
  7.2549 +            } elsif (defined $_->{prefix}) {
  7.2550 +                $cmd1 = '';
  7.2551 +                if ($spkg =~ m|^\.?/|) {
  7.2552 +                    $uvhpkg = $spkg;
  7.2553 +                }
  7.2554 +                else {
  7.2555 +                    $cmd1 .= npriv($config->{"curl"} . " -# -o $bpkg $spkg $err\n");
  7.2556 +                    $cmd3 = npriv("rm -f $bpkg >/dev/null 2>&1 $err\n") unless ($opt_k);
  7.2557 +                }
  7.2558 +            } else {
  7.2559 +                $cmd1 = '';
  7.2560 +                if ($spkg =~ m|^\.?/|) {
  7.2561 +                    $cmd1 .= npriv($config->{"rpm"} . "$opt --rebuild $spkg $err\n");
  7.2562 +                }
  7.2563 +                else {
  7.2564 +                    $cmd1 .= "if test ! -f $srcpkg; then\n";
  7.2565 +                    $cmd1 .= indent(npriv($config->{"curl"} . " -# -o $srcpkg $spkg $err\n"));
  7.2566 +                    $cmd1 .= "fi\n";
  7.2567 +                    $cmd1 .= npriv($config->{"rpm"} . "$opt --rebuild $srcpkg $err\n");
  7.2568 +                    $cmd1 .= npriv("rm -f $srcpkg >/dev/null 2>&1 $err\n") unless ($opt_k);
  7.2569 +                }
  7.2570 +            }
  7.2571 +        }
  7.2572 +
  7.2573 +        #   wrap build command with build-time check for existing
  7.2574 +        #   binary target
  7.2575 +        if (defined($cmd1) && ($allbin || ($usebin && !$_->{GOAL}))) {
  7.2576 +            $cmd1 = "if test ! -f $uvhpkg; then\n".indent($cmd1)."fi\n";
  7.2577 +        }
  7.2578 +
  7.2579 +        #   if package exist force rpm to copy over new files
  7.2580 +        #   better than erasing everything and losing configuration
  7.2581 +        #   files
  7.2582 +        $opt = ($_->{REBUILD} || ($allbin || ($usebin && !$_->{GOAL}))) ? ' --force' : '';
  7.2583 +        $cmd2 = '';
  7.2584 +        $cmd2 .= priv($config->{"rpm"} . "$opt -Uvh $uvhpkg $err\n");
  7.2585 +        if ($allbin || ($usebin && !$_->{GOAL})) {
  7.2586 +            $cmd2 = "if test \".`".$config->{"rpm"}." -q --qf '\%{SIGMD5}' $pkg`\" != \".`".$config->{"rpm"}." -qp --qf '\%{SIGMD5}' $uvhpkg`\"; then\n".indent($cmd2)."fi\n";
  7.2587 +        }
  7.2588 +        $cmd2 = $cmd1.$cmd2 if ($cmd1);
  7.2589 +        $cmd2 = $cmd2.$cmd3 if ($cmd3);
  7.2590 +        print "echo $mark $spkg $mark\n".$cmd2."echo $mark $spkg = \$? $mark\n";
  7.2591 +    }
  7.2592 +}
  7.2593 +
  7.2594 +#   print commands for the temporary package list
  7.2595 +#   temporary packages are only used for building other packages
  7.2596 +#   and are removed when everything is done
  7.2597 +sub print_list2 ($$) {
  7.2598 +    my ($list, $c) = @_;
  7.2599 +    my ($pkg);
  7.2600 +
  7.2601 +    foreach (@$list) {
  7.2602 +        $pkg = "$_->{name}-$_->{version}-$_->{release}";
  7.2603 +        print priv($config->{"rpm"} . " -e $pkg\n");
  7.2604 +    }
  7.2605 +}
  7.2606 +
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/openpkg/build.pod	Tue Jul 31 12:23:42 2012 +0200
     8.3 @@ -0,0 +1,460 @@
     8.4 +##
     8.5 +##  build.pod -- OpenPKG Package Building and Installing
     8.6 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
     8.7 +##
     8.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
     8.9 +##  All rights reserved. Licenses which grant limited permission to use,
    8.10 +##  copy, modify and distribute this software are available from the
    8.11 +##  OpenPKG GmbH.
    8.12 +##
    8.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
    8.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    8.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    8.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    8.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    8.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    8.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    8.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    8.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    8.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    8.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    8.24 +##  SUCH DAMAGE.
    8.25 +##
    8.26 +
    8.27 +=pod
    8.28 +
    8.29 +=head1 NAME
    8.30 +
    8.31 +B<openpkg build> - B<OpenPKG> Package Building and Installing
    8.32 +
    8.33 +=head1 SYNOPSIS
    8.34 +
    8.35 +B<openpkg>
    8.36 +B<build>
    8.37 +[B<-R> I<rpm>]
    8.38 +[B<-r> I<repository>]
    8.39 +[B<-f> I<index.rdf>]
    8.40 +[B<-u>]
    8.41 +[B<-U>]
    8.42 +[B<-z>]
    8.43 +[B<-Z>]
    8.44 +[B<-i>]
    8.45 +[B<-q>]
    8.46 +[B<-s>]
    8.47 +[B<-S>]
    8.48 +[B<-M>]
    8.49 +[B<-L>]
    8.50 +[B<-W>]
    8.51 +[B<-X>]
    8.52 +[B<-K>]
    8.53 +[B<-k>]
    8.54 +[B<-e>]
    8.55 +[B<-b>]
    8.56 +[B<-B>]
    8.57 +[B<-G>]
    8.58 +[B<-P> I<priv-cmd>]
    8.59 +[B<-N> I<non-priv-cmd>]
    8.60 +[B<-p> I<platform>]
    8.61 +[B<-D> I<var>=I<val> ...]
    8.62 +[B<-E> I<name> ...]
    8.63 +[B<-H> I<name> ...]
    8.64 +([B<-a>] [B<-A>] | I<pattern> ...)
    8.65 +
    8.66 +=head1 DESCRIPTION
    8.67 +
    8.68 +The B<openpkg build> tool provides automated recursive from-scratch
    8.69 +installation of packages and the updating and upgrading of installed
    8.70 +packages.
    8.71 +
    8.72 +It generates a Bourne-Shell script on standard output (F<stdout>)
    8.73 +that can be executed to perform the package installation or
    8.74 +updating/upgrading procedure for all requested packages and their
    8.75 +dependencies.
    8.76 +
    8.77 +Packages that are upgraded automatically trigger rebuilds of all
    8.78 +packages that depend on the upgraded package ("reverse dependencies").
    8.79 +The dependency information is read from an XML/RDF index generated by
    8.80 +the companion tool B<openpkg index>.
    8.81 +
    8.82 +=head1 ARGUMENTS
    8.83 +
    8.84 +Packages are selected by providing a list of name patterns. Each
    8.85 +pattern is either a package name or a name prefix followed by a 'F<*>'
    8.86 +character. Additionally, in order to resolve ambiguous dependencies, you
    8.87 +can append a discrimination prefix separated by a comma that matches
    8.88 +against the full "I<name>-I<version>-I<revision>" string of a package.
    8.89 +
    8.90 +=head1 OPTIONS
    8.91 +
    8.92 +The following command line options exist:
    8.93 +
    8.94 +=over 4
    8.95 +
    8.96 +=item B<-R> I<command>
    8.97 +
    8.98 +Specify the "B<openpkg rpm>" command with fully qualified path.
    8.99 +Several other internal paths are deduced from the I<command> path,
   8.100 +so this has to be something like "I<prefix>C</bin/openpkg rpm>".
   8.101 +
   8.102 +=item B<-r> I<repository>
   8.103 +
   8.104 +Specify the path to an OpenPKG RPM package repository.
   8.105 +This can be a URL (including "file://") to download packages from or
   8.106 +an absolute directory path (identified by leading "/") or
   8.107 +a relative directory path (identified by leading "./") to access packages directly.
   8.108 +The name of the package file is appended to this path.
   8.109 +The default is to use a URL pointing to the B<OpenPKG> download service
   8.110 +as determined by the "B<openpkg release>" command.
   8.111 +
   8.112 +=item B<-f> I<index.rdf>
   8.113 +
   8.114 +Specify the path to the primary XML/RDF index. This can be a URL or a
   8.115 +file path. If the index contains references to other indices, these
   8.116 +are recursively included automatically. The default is to use a URL
   8.117 +pointing to the B<OpenPKG> FTP server as as determined by the "B<openpkg
   8.118 +release>" command.
   8.119 +
   8.120 +=item B<-u>
   8.121 +
   8.122 +The generated script will ignore binary RPMs that are stored on
   8.123 +your system. Instead it will either fetch binary RPMs or rebuild
   8.124 +from source RPMs fetched from the repository.
   8.125 +
   8.126 +=item B<-U>
   8.127 +
   8.128 +The generated script will try to upgrade all selected packages
   8.129 +including their dependencies to the most recent version. Use
   8.130 +this for usual upgrade tasks in combination with option "B<-a>".
   8.131 +
   8.132 +=item B<-z>
   8.133 +
   8.134 +The generated script will rebuild all selected packages
   8.135 +including their dependencies even when the most recent version
   8.136 +is already installed.
   8.137 +
   8.138 +=item B<-Z>
   8.139 +
   8.140 +B<openpkg build> ignores all installed packages, the
   8.141 +generated script will rebuild all selected packages from scratch.
   8.142 +
   8.143 +=item B<-i>
   8.144 +
   8.145 +The generated script will ignore run-time errors.
   8.146 +
   8.147 +=item B<-q>
   8.148 +
   8.149 +Ignore all reverse dependencies. This means that all packages which are
   8.150 +rebuild do I<not> trigger a rebuild of packages which depend on them.
   8.151 +I<ATTENTION: this might break already installed packages and has to be
   8.152 +used with care! You should really know what you are doing.>
   8.153 +
   8.154 +=item B<-s>
   8.155 +
   8.156 +Generate a status map instead of the shell script. The map consists
   8.157 +of 3 columns: I<old>, I<tag> and I<new>. The I<old> column shows
   8.158 +the installed version of a package (I<name>-I<version>-I<release>)
   8.159 +or just the package name (I<name>) if no package of that name
   8.160 +is installed and the I<new> column shows the repository version
   8.161 +(I<name>-I<version>-I<release>) of a package if it is considered for
   8.162 +installation. The I<tag> column shows the following possible values:
   8.163 +
   8.164 +=over 10
   8.165 +
   8.166 +=item OK
   8.167 +
   8.168 +The installed package is suitable and will not be touched.
   8.169 +
   8.170 +=item ADD
   8.171 +
   8.172 +There is no installed package yet.
   8.173 +
   8.174 +=item UPGRADE
   8.175 +
   8.176 +The installed package is outdated and requires an update.
   8.177 +
   8.178 +=item DEPEND
   8.179 +
   8.180 +The installed package needs rebuilding because one of its
   8.181 +dependencies is rebuild.
   8.182 +
   8.183 +=item MISMATCH
   8.184 +
   8.185 +The installed package needs rebuilding because it was build
   8.186 +with different parameters.
   8.187 +
   8.188 +=item CONFLICT
   8.189 +
   8.190 +The required new package cannot be installed because it
   8.191 +conflicts with some already installed package.
   8.192 +
   8.193 +=item UNDEF
   8.194 +
   8.195 +The package has an invalid or ambiguous dependency.
   8.196 +
   8.197 +=back
   8.198 +
   8.199 +=item B<-S>
   8.200 +
   8.201 +Similar to option "B<-s>" but also lists the newest versions in the
   8.202 +repository. The following I<tag> might appear in the map:
   8.203 +
   8.204 +=over 10
   8.205 +
   8.206 +=item NEW
   8.207 +
   8.208 +The package exists in the repository but is not required yet.
   8.209 +
   8.210 +=back
   8.211 +
   8.212 +=item B<-M>
   8.213 +
   8.214 +Similar to option "B<-s>" but print a short dependency map.
   8.215 +
   8.216 +=item B<-L>
   8.217 +
   8.218 +Print a list of packages in the repository that depend on the target.
   8.219 +
   8.220 +=item B<-W>
   8.221 +
   8.222 +Include all conditional dependencies as if all possible configuration
   8.223 +options had been switched on. This has little use in practice except for
   8.224 +generating an all-inclusive list with option "B<-L>". I<ATTENTION: Even
   8.225 +mutually exclusive options are evaluated to be 'on', building packages
   8.226 +with option "-W" therefore might fail or cause unusable results!>
   8.227 +
   8.228 +=item B<-X>
   8.229 +
   8.230 +Use the slower but more robust external Perl XML parser module
   8.231 +XML::Simple instead of the simple internal XML/RDF parser.
   8.232 +
   8.233 +=item B<-K>
   8.234 +
   8.235 +Keep packages that were installed temporarily during the build process.
   8.236 +Without this option those packages are removed.
   8.237 +
   8.238 +=item B<-k>
   8.239 +
   8.240 +Keep packages that were downloaded temporarily for installation or building.
   8.241 +Without this option those packages are removed.
   8.242 +
   8.243 +=item B<-e>
   8.244 +
   8.245 +Rebuild exact version of a package from repository even when you have
   8.246 +installed a newer version from another repository.
   8.247 +
   8.248 +=item B<-b>
   8.249 +
   8.250 +Wrap package rebuilding commands with script execution-time checks for
   8.251 +existing binary packages if the package is rebuild as a dependency. Wrap
   8.252 +package install commands with script execution-time checks for different
   8.253 +MD5 signature checksums of binary packages and installed packages. This
   8.254 +is best to use with option "B<-u>" to defer all such checks until script
   8.255 +execution-time.
   8.256 +
   8.257 +=item B<-B>
   8.258 +
   8.259 +Same as option "B<-b>" but also check all explicit target packages for
   8.260 +existing binary packages at script execution-time.
   8.261 +
   8.262 +=item B<-g>
   8.263 +
   8.264 +The generated script will rebuild all packages selected even when the
   8.265 +most recent version is already installed. Dependencies are not affected.
   8.266 +Use this especially for updating a package with different build options
   8.267 +(see option "B<-D>").
   8.268 +
   8.269 +=item B<-P> I<priv-cmd>
   8.270 +
   8.271 +Command prefix to use for generated script commands that require
   8.272 +elevated privileges (like "B<openpkg rpm -Uvh>"). The most common tool
   8.273 +for this is sudo(8). If I<priv-cmd> starts with a dash it will be run
   8.274 +without the dash and the command line it should execute is passed as
   8.275 +a single quoted string. Use this option for upgrading privileges. For
   8.276 +instance, if you are running the C<openpkg build>" command as the
   8.277 +management user, use "C<-P sudo>" to make sure that the "B<openpkg rpm
   8.278 +-Uvh>" commands in the generated script execute with necessary elevated
   8.279 +privileges.
   8.280 +
   8.281 +=item B<-N> I<non-priv-cmd>
   8.282 +
   8.283 +Command prefix to use for generated script commands that do I<not>
   8.284 +require elevated privileges (like "B<openpkg rpm --rebuild>"). The most
   8.285 +common tool for this is su(8). If I<non-priv-cmd> starts with a dash
   8.286 +it will be run without the dash and the command line it should execute
   8.287 +is passed as a single quoted string. Use this option for downgrading
   8.288 +privileges. For instance, if you are running the C<openpkg build>"
   8.289 +command as the B<root> user, use "C<-N '-su - >I<musr>C< -c'>" to make
   8.290 +sure that the non-privileged commands in the generated script execute
   8.291 +with privileges of the management user I<musr>.
   8.292 +
   8.293 +=item B<-p> I<platform>
   8.294 +
   8.295 +The platform string that is matched against the XML/RDF index for binary
   8.296 +packages. The default is an empty I<platform> string so that no binary
   8.297 +packages are matched at all.
   8.298 +
   8.299 +=item B<-D> I<var>=I<val>
   8.300 +
   8.301 +Specify build options for selected packages. This can be either
   8.302 +"B<-D> I<with_xxx>=I<yyy>" or just "B<-D> I<with_xxx>". The latter is
   8.303 +equivalent to a "B<-D> I<with_xxx>=I<yes>". The parameters are matched
   8.304 +against selected packages that are already installed. If they do
   8.305 +indicate a change, the package is rebuild. There can be multiple "B<-D>"
   8.306 +options.
   8.307 +
   8.308 +If the option name is prefixed with a package name followed by
   8.309 +two colons then it applies only to the specified package, e.g.,
   8.310 +"B<-D>I<foo::with_bar>".
   8.311 +
   8.312 +=item B<-E> I<name>
   8.313 +
   8.314 +Ignore a package with the specified I<name>. This can be used to avoid
   8.315 +upgrading to a broken package in the repository or to skip a package
   8.316 +upgrade temporarily. If you use a wildcard pattern or the options
   8.317 +"B<-a>" or "B<-A>" then I<name> will be excluded. There can be multiple
   8.318 +"B<-E>" options.
   8.319 +
   8.320 +=item B<-H> I<name>
   8.321 +
   8.322 +Hint about packages that should be preferred when more than one fits
   8.323 +a requirement. There can be multiple "B<-H>" options.
   8.324 +
   8.325 +=item B<-a>
   8.326 +
   8.327 +Select all installed packages. You cannot specify a pattern list together
   8.328 +with the "B<-a>" option.
   8.329 +
   8.330 +=item B<-A>
   8.331 +
   8.332 +Select all packages in the repository. You cannot specify a pattern list
   8.333 +together with the "B<-A>" option.
   8.334 +
   8.335 +=back
   8.336 +
   8.337 +=head1 ARGUMENTS
   8.338 +
   8.339 +In case neither option B<-a> nor option B<-A> are specified,
   8.340 +the command line has to contain one or more package I<pattern>
   8.341 +arguments. Each I<pattern> can have the following forms:
   8.342 +
   8.343 +=over 4
   8.344 +
   8.345 +=item I<name>
   8.346 +
   8.347 +A regular package name.
   8.348 +
   8.349 +=item I<name>B<*>
   8.350 +
   8.351 +A package name wildcard pattern.
   8.352 +
   8.353 +=item I<name>B<,>I<name>[B<->I<version>[B<->I<release>]]
   8.354 +
   8.355 +A regular package name followed by a constraint
   8.356 +which particular package should be chosen.
   8.357 +
   8.358 +=back
   8.359 +
   8.360 +=head1 CONFIGURATION
   8.361 +
   8.362 +B<openpkg build> reads the configuration file F<$HOME/.openpkg/build>.
   8.363 +The file lists default options, one option per line and section tags
   8.364 +of the form C<[>I<prefix>C<]>. Options following such a tag are only
   8.365 +evaluated for the particular B<OpenPKG> instance so that you can
   8.366 +define default options for multiple B<OpenPKG> instances.
   8.367 +
   8.368 +Example:
   8.369 +
   8.370 + # global options
   8.371 + -X
   8.372 +
   8.373 + [/openpkg/current]
   8.374 + # options for CURRENT stack only
   8.375 + -r http://download.openpkg.org/stacks/current/source/
   8.376 +
   8.377 + [/openpkg/foo]
   8.378 + # options for a FOO stack only
   8.379 + -r http://download.openpkg.org/stacks/foo/source/
   8.380 +
   8.381 +=head1 EXAMPLES
   8.382 +
   8.383 +The following shows a few typical OpenPKG instance
   8.384 +maintenance tasks which involve the B<openpkg build> command:
   8.385 +
   8.386 +=head2 Installation
   8.387 +
   8.388 +The following examples shows how to initially install an OpenPKG
   8.389 +instance under F</openpkg> with Apache/PHP & MySQL:
   8.390 +
   8.391 + # bootstrap the OpenPKG instance
   8.392 + $ curl -L -O http://openpkg.org/go/download/openpkg.src.sh
   8.393 + $ sh openpkg-*-*.src.sh --prefix=/openpkg \
   8.394 +   --user=openpkg --group=openpkg --tag=openpkg
   8.395 + $ sh openpkg-*-*.*-*-openpkg.sh
   8.396 +
   8.397 + # install Apache/PHP & MySQL
   8.398 + $ /openpkg/bin/openpkg build \
   8.399 +   -D apache-php::with_mysql=yes \
   8.400 +   apache apache-php mysql | sh
   8.401 +
   8.402 +=head2 Reinstallation
   8.403 +
   8.404 +The following example shows how to rebuild and reinstall the already
   8.405 +installed package "foo":
   8.406 +
   8.407 + # rebuild and reinstall package
   8.408 + $ /openpkg/bin/openpkg build -g -u foo | sh
   8.409 +
   8.410 +=head2 Change
   8.411 +
   8.412 +The following fictive example shows how to change the already
   8.413 +installed package "foo" by rebuilding and reinstalling it with the
   8.414 +"C<foo::with_bar>" build-time option enabled.
   8.415 +
   8.416 + # change a package
   8.417 + $ /openpkg/bin/openpkg build -g -D with_bar=yes foo | sh
   8.418 +
   8.419 +=head2 Update
   8.420 +
   8.421 +The following example shows how to update (no major
   8.422 +OpenPKG version change) an OpenPKG instance under F</openpkg>:
   8.423 +
   8.424 + # update all packages to their latest version
   8.425 + $ /openpkg/bin/openpkg build -Ua | sh
   8.426 +
   8.427 +=head2 Upgrade
   8.428 +
   8.429 +The following examples shows a complete procedure for upgrading (major
   8.430 +OpenPKG version change) the instance under F</openpkg> to OpenPKG
   8.431 +4.X:
   8.432 +
   8.433 + # upgrade the bootstrap package
   8.434 + $ /openpkg/bin/openpkg build \
   8.435 +   -r http://download.openpkg.org/stacks/current/source/ openpkg | sh
   8.436 +
   8.437 + # upgrade the whole OpenPKG instance, in correct dependency
   8.438 + # order and by keeping all chosen build-time options.
   8.439 + $ /openpkg/bin/openpkg build -ZaKB | sh
   8.440 +
   8.441 +=head2 Deinstallation
   8.442 +
   8.443 +The following example shows how to deinstall
   8.444 +an entire OpenPKG intance under F</openpkg>:
   8.445 +
   8.446 + # remove all packages and the instance itself
   8.447 + $ /openpkg/bin/openpkg rpm -e \
   8.448 +   `/openpkg/bin/openpkg rpm -qa`
   8.449 +
   8.450 +=head1 CAVEATS
   8.451 +
   8.452 +Parallel execution of B<openpkg build> causes undefined effects.
   8.453 +
   8.454 +=head1 HISTORY
   8.455 +
   8.456 +The B<openpkg build> command was invented in November 2002 by I<Michael
   8.457 +van Elst> E<lt>mlelstv@serpens.deE<gt> under contract with I<Cable
   8.458 +& Wireless> E<lt>http://www.cw.com/E<gt> for use inside the B<OpenPKG>
   8.459 +project E<lt>http://www.openpkg.org/E<gt>. It was then further
   8.460 +refined by the B<OpenPKG Foundation e.V.> as part of the OpenPKG Tool Chain.
   8.461 +
   8.462 +=cut
   8.463 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/openpkg/curl.patch	Tue Jul 31 12:23:42 2012 +0200
     9.3 @@ -0,0 +1,33 @@
     9.4 +Index: configure
     9.5 +--- configure.orig	2012-05-22 23:46:41.000000000 +0200
     9.6 ++++ configure	2012-05-25 22:56:57.000000000 +0200
     9.7 +@@ -4886,10 +4886,7 @@
     9.8 + if $ac_preproc_ok; then :
     9.9 + 
    9.10 + else
    9.11 +-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
    9.12 +-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
    9.13 +-as_fn_error "C preprocessor \"$CPP\" fails sanity check
    9.14 +-See \`config.log' for more details." "$LINENO" 5; }
    9.15 ++    :
    9.16 + fi
    9.17 + 
    9.18 + ac_ext=c
    9.19 +@@ -19472,7 +19469,7 @@
    9.20 +   $as_echo_n "(cached) " >&6
    9.21 + else
    9.22 +   ac_check_lib_save_LIBS=$LIBS
    9.23 +-LIBS="-l"$LDAPLIBNAME"  $LIBS"
    9.24 ++LIBS="-l$LDAPLIBNAME $LIBS"
    9.25 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    9.26 + /* end confdefs.h.  */
    9.27 + 
    9.28 +@@ -19506,7 +19503,7 @@
    9.29 + #define `$as_echo "HAVE_LIB"$LDAPLIBNAME"" | $as_tr_cpp` 1
    9.30 + _ACEOF
    9.31 + 
    9.32 +-  LIBS="-l"$LDAPLIBNAME" $LIBS"
    9.33 ++  LIBS="-l$LDAPLIBNAME $LIBS"
    9.34 + 
    9.35 + else
    9.36 + 
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/openpkg/curl.sh	Tue Jul 31 12:23:42 2012 +0200
    10.3 @@ -0,0 +1,43 @@
    10.4 +##
    10.5 +##  curl.sh -- OpenPKG Tools "curl" command
    10.6 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    10.7 +##
    10.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    10.9 +##  All rights reserved. Licenses which grant limited permission to use,
   10.10 +##  copy, modify and distribute this software are available from the
   10.11 +##  OpenPKG GmbH.
   10.12 +##
   10.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   10.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   10.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   10.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   10.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   10.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   10.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   10.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   10.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   10.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   10.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   10.24 +##  SUCH DAMAGE.
   10.25 +##
   10.26 +
   10.27 +#   determine path to OpenPKG instance
   10.28 +PREFIX="${OPENPKG_PREFIX}"
   10.29 +
   10.30 +#   determine curl and config
   10.31 +curl="$PREFIX/lib/openpkg/curl"
   10.32 +conf="$PREFIX/etc/openpkg/curlrc"
   10.33 +
   10.34 +#   remove user supplied -q option (ignore ~/.curlrc)
   10.35 +[ ".$1" = .-q ] && shift
   10.36 +
   10.37 +#   force -q option (ignore ~/.curlrc) and -f option (error checking)
   10.38 +set -- "-q" "-f" "$@"
   10.39 +
   10.40 +#   prepend --config <file> option if conf file is readable
   10.41 +declare -a a;
   10.42 +[ -r "$conf" ] && set -- "--config" "$conf" "$@"
   10.43 +
   10.44 +#   execute underlying application
   10.45 +exec $curl "$@"
   10.46 +
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/openpkg/dev.8	Tue Jul 31 12:23:42 2012 +0200
    11.3 @@ -0,0 +1,656 @@
    11.4 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
    11.5 +.\"
    11.6 +.\" Standard preamble:
    11.7 +.\" ========================================================================
    11.8 +.de Sp \" Vertical space (when we can't use .PP)
    11.9 +.if t .sp .5v
   11.10 +.if n .sp
   11.11 +..
   11.12 +.de Vb \" Begin verbatim text
   11.13 +.ft CW
   11.14 +.nf
   11.15 +.ne \\$1
   11.16 +..
   11.17 +.de Ve \" End verbatim text
   11.18 +.ft R
   11.19 +.fi
   11.20 +..
   11.21 +.\" Set up some character translations and predefined strings.  \*(-- will
   11.22 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   11.23 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
   11.24 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
   11.25 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
   11.26 +.\" nothing in troff, for use with C<>.
   11.27 +.tr \(*W-
   11.28 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   11.29 +.ie n \{\
   11.30 +.    ds -- \(*W-
   11.31 +.    ds PI pi
   11.32 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   11.33 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   11.34 +.    ds L" ""
   11.35 +.    ds R" ""
   11.36 +.    ds C` 
   11.37 +.    ds C' 
   11.38 +'br\}
   11.39 +.el\{\
   11.40 +.    ds -- \|\(em\|
   11.41 +.    ds PI \(*p
   11.42 +.    ds L" ``
   11.43 +.    ds R" ''
   11.44 +'br\}
   11.45 +.\"
   11.46 +.\" Escape single quotes in literal strings from groff's Unicode transform.
   11.47 +.ie \n(.g .ds Aq \(aq
   11.48 +.el       .ds Aq '
   11.49 +.\"
   11.50 +.\" If the F register is turned on, we'll generate index entries on stderr for
   11.51 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
   11.52 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   11.53 +.\" output yourself in some meaningful fashion.
   11.54 +.ie \nF \{\
   11.55 +.    de IX
   11.56 +.    tm Index:\\$1\t\\n%\t"\\$2"
   11.57 +..
   11.58 +.    nr % 0
   11.59 +.    rr F
   11.60 +.\}
   11.61 +.el \{\
   11.62 +.    de IX
   11.63 +..
   11.64 +.\}
   11.65 +.\"
   11.66 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   11.67 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   11.68 +.    \" fudge factors for nroff and troff
   11.69 +.if n \{\
   11.70 +.    ds #H 0
   11.71 +.    ds #V .8m
   11.72 +.    ds #F .3m
   11.73 +.    ds #[ \f1
   11.74 +.    ds #] \fP
   11.75 +.\}
   11.76 +.if t \{\
   11.77 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   11.78 +.    ds #V .6m
   11.79 +.    ds #F 0
   11.80 +.    ds #[ \&
   11.81 +.    ds #] \&
   11.82 +.\}
   11.83 +.    \" simple accents for nroff and troff
   11.84 +.if n \{\
   11.85 +.    ds ' \&
   11.86 +.    ds ` \&
   11.87 +.    ds ^ \&
   11.88 +.    ds , \&
   11.89 +.    ds ~ ~
   11.90 +.    ds /
   11.91 +.\}
   11.92 +.if t \{\
   11.93 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   11.94 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
   11.95 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
   11.96 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
   11.97 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
   11.98 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
   11.99 +.\}
  11.100 +.    \" troff and (daisy-wheel) nroff accents
  11.101 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  11.102 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  11.103 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  11.104 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  11.105 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  11.106 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  11.107 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  11.108 +.ds ae a\h'-(\w'a'u*4/10)'e
  11.109 +.ds Ae A\h'-(\w'A'u*4/10)'E
  11.110 +.    \" corrections for vroff
  11.111 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  11.112 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  11.113 +.    \" for low resolution devices (crt and lpr)
  11.114 +.if \n(.H>23 .if \n(.V>19 \
  11.115 +\{\
  11.116 +.    ds : e
  11.117 +.    ds 8 ss
  11.118 +.    ds o a
  11.119 +.    ds d- d\h'-1'\(ga
  11.120 +.    ds D- D\h'-1'\(hy
  11.121 +.    ds th \o'bp'
  11.122 +.    ds Th \o'LP'
  11.123 +.    ds ae ae
  11.124 +.    ds Ae AE
  11.125 +.\}
  11.126 +.rm #[ #] #H #V #F C
  11.127 +.\" ========================================================================
  11.128 +.\"
  11.129 +.IX Title "DEV 8"
  11.130 +.TH DEV 8 "OpenPKG" "DEV(8)" "OpenPKG"
  11.131 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
  11.132 +.\" way too many mistakes in technical documents.
  11.133 +.if n .ad l
  11.134 +.nh
  11.135 +\&\fBopenpkg dev\fR \- OpenPKG Package Development Tool
  11.136 +.SH "DESCRIPTION"
  11.137 +.IX Header "DESCRIPTION"
  11.138 +\&\fBopenpkg dev\fR is a package development tool for \fBOpenPKG\fR.
  11.139 +.SS "\s-1SOURCE\s0 \s-1PACKAGE\s0 \s-1HANDLING\s0"
  11.140 +.IX Subsection "SOURCE PACKAGE HANDLING"
  11.141 +.ie n .IP "\fBopenpkg dev unpack\fR [\*(C`\-l\*(C' \fIlayout\fR] [\*(C`\-b\*(C' \fIbasedir\fR] [\*(C`\-s\*(C'] [\*(C`\-d\*(C'] \fIname\fR\*(C`\-\*(C'\fIversion\fR\*(C`\-\*(C'\fIrelease\fR\*(C`.src.rpm\*(C'" 4
  11.142 +.el .IP "\fBopenpkg dev unpack\fR [\f(CW\*(C`\-l\*(C'\fR \fIlayout\fR] [\f(CW\*(C`\-b\*(C'\fR \fIbasedir\fR] [\f(CW\*(C`\-s\*(C'\fR] [\f(CW\*(C`\-d\*(C'\fR] \fIname\fR\f(CW\*(C`\-\*(C'\fR\fIversion\fR\f(CW\*(C`\-\*(C'\fR\fIrelease\fR\f(CW\*(C`.src.rpm\*(C'\fR" 4
  11.143 +.IX Item "openpkg dev unpack [-l layout] [-b basedir] [-s] [-d] name-version-release.src.rpm"
  11.144 +Unpacks an OpenPKG source \s-1RPM\s0 package
  11.145 +\&\fIname\fR\f(CW\*(C`\-\*(C'\fR\fIversion\fR\f(CW\*(C`\-\*(C'\fR\fIrelease\fR\f(CW\*(C`.src.rpm\*(C'\fR into \fIbasedir\fR
  11.146 +(default is \fIname\fR\f(CW\*(C`\-\*(C'\fR\fIversion\fR\f(CW\*(C`\-\*(C'\fR\fIrelease\fR)
  11.147 +using \fIlayout\fR (default is \fIstructured\fR).
  11.148 +Additionally,
  11.149 +\&\fIfile-rpmmacros\fR
  11.150 +configuration file is generated where
  11.151 +\&\f(CW\*(C`\-s\*(C'\fR enables shared mode and
  11.152 +\&\f(CW\*(C`\-d\*(C'\fR enables debug mode, see \fIfile-rpmmacros\fR.
  11.153 +.SS "\s-1SOURCE\s0 \s-1PACKAGE\s0 \s-1DEVELOPMENT\s0"
  11.154 +.IX Subsection "SOURCE PACKAGE DEVELOPMENT"
  11.155 +.IP "\fBopenpkg dev shell\fR" 4
  11.156 +.IX Item "openpkg dev shell"
  11.157 +This is a convenience command which enters an interactive \fB\s-1GNU\s0 Bash\fR
  11.158 +shell which provides the following work environment:
  11.159 +.RS 4
  11.160 +.IP "\fBEnvironment Variables:\fR" 4
  11.161 +.IX Item "Environment Variables:"
  11.162 +.Vb 5
  11.163 +\& OPENPKG_PREFIX "<prefix>"
  11.164 +\& PS1            "\e\e[\e\ee[31;1m\e\e]\e\eu\e\e[\e\ee[0m\e\e]@\e\eh:\e\ew [OPENPKG_PREFIX=$OPENPKG_PREFIX]\en\e\e\e$ "
  11.165 +\& T              %{_tmppath}
  11.166 +\& S              %{_specdir}
  11.167 +\& D              %{_sourcedir}
  11.168 +.Ve
  11.169 +.IP "\fBCommand-Line Aliases:\fR" 4
  11.170 +.IX Item "Command-Line Aliases:"
  11.171 +.Vb 2
  11.172 +\& openpkg        "${OPENPKG_PREFIX}/bin/openpkg"
  11.173 +\& opd            "${OPENPKG_PREFIX}/bin/openpkg dev"
  11.174 +.Ve
  11.175 +.IP "\fBCommand-Line Keystrokes:\fR" 4
  11.176 +.IX Item "Command-Line Keystrokes:"
  11.177 +.Vb 10
  11.178 +\& ESC+x          "opd unpack\en"
  11.179 +\& ESC+v          "opd edit\en"
  11.180 +\& ESC+t          "opd build \-s track\en"
  11.181 +\& ESC+f          "opd build \-s fetch\en"
  11.182 +\& ESC+b          "opd build\en"
  11.183 +\& ESC+1          "opd build \-s prep\en"
  11.184 +\& ESC+2          "opd build \-s compile\en"
  11.185 +\& ESC+3          "opd build \-s install\en"
  11.186 +\& ESC+4          "opd build \-s binary\en"
  11.187 +\& ESC+s          "opd build \-s source\en"
  11.188 +\& ESC+p          "opd peek\en"
  11.189 +\& ESC+d          "opd diff\en"
  11.190 +\& ESC+i          "opd install\en"
  11.191 +\& ESC+e          "opd erase\en"
  11.192 +\& ESC+l          "opd lint\en"
  11.193 +\& ESC+r          "opd release\en"
  11.194 +.Ve
  11.195 +.RE
  11.196 +.RS 4
  11.197 +.Sp
  11.198 +If option \f(CW\*(C`\-s\*(C'\fR is passed to \fBopenpkg dev shell\fR and \fIscreen\fR\|(1) is
  11.199 +available in \f(CW$PATH\fR, the interactive development shell is started up
  11.200 +in a convenient virtual screen environment.
  11.201 +.RE
  11.202 +.IP "\fBopenpkg dev edit\fR" 4
  11.203 +.IX Item "openpkg dev edit"
  11.204 +Load spec file into editor.
  11.205 +.RS 4
  11.206 +.IP "\fBEnvironment Variables:\fR" 4
  11.207 +.IX Item "Environment Variables:"
  11.208 +.Vb 1
  11.209 +\& EDITOR "vi"
  11.210 +.Ve
  11.211 +.RE
  11.212 +.RS 4
  11.213 +.RE
  11.214 +.ie n .IP "\fBopenpkg dev build\fR [\*(C`\-s\*(C' \fIstep\fR] [\*(C`\-D\*(C' \fIdefine\fR[=\fIvalue\fR]] [\*(C`\-w\*(C' \fIvariant\fR]" 4
  11.215 +.el .IP "\fBopenpkg dev build\fR [\f(CW\*(C`\-s\*(C'\fR \fIstep\fR] [\f(CW\*(C`\-D\*(C'\fR \fIdefine\fR[=\fIvalue\fR]] [\f(CW\*(C`\-w\*(C'\fR \fIvariant\fR]" 4
  11.216 +.IX Item "openpkg dev build [-s step] [-D define[=value]] [-w variant]"
  11.217 +Builds package steps. Default \fIstep\fR is \f(CW\*(C`all\*(C'\fR. Option \f(CW\*(C`\-D\*(C'\fR translated
  11.218 +into "\f(CW\*(C`\-\-define \*(Aq\f(CIdefine\f(CW \f(CIvalue\f(CW\*(Aq\*(C'\fR" while option \f(CW\*(C`\-w\*(C'\fR translated
  11.219 +into "\f(CW\*(C`\-\-with\*(C'\fR \fIvariant\fR". The \fIstep\fR arguments translate into the
  11.220 +following \s-1RPM\s0 options:
  11.221 +.Sp
  11.222 +.Vb 8
  11.223 +\&  track:   \-bt
  11.224 +\&  fetch:   \-bf
  11.225 +\&  prep:    \-bp
  11.226 +\&  compile: \-bc \-\-short\-circuit
  11.227 +\&  install: \-bi \-\-short\-circuit
  11.228 +\&  binary:  \-bb \-\-short\-circuit
  11.229 +\&  source:  \-bs
  11.230 +\&  all:     \-ba
  11.231 +.Ve
  11.232 +.IP "\fBopenpkg dev peek\fR" 4
  11.233 +.IX Item "openpkg dev peek"
  11.234 +Peeks file list from package and tags configuration and documentation files.
  11.235 +.IP "\fBopenpkg dev diff\fR" 4
  11.236 +.IX Item "openpkg dev diff"
  11.237 +Shows modifications with the help of a possibly underlying Version
  11.238 +Control System (\s-1VCS\s0) like \s-1CVS\s0, Subversion, Monotone, Git, Mercurial or
  11.239 +(as a fallback ) \s-1OSSP\s0 svs.
  11.240 +.ie n .IP "\fBopenpkg dev install\fR [\*(C`\-f\*(C'] [\*(C`\-o\*(C'] [\*(C`\-n\*(C'] [\*(C`\-s\*(C']" 4
  11.241 +.el .IP "\fBopenpkg dev install\fR [\f(CW\*(C`\-f\*(C'\fR] [\f(CW\*(C`\-o\*(C'\fR] [\f(CW\*(C`\-n\*(C'\fR] [\f(CW\*(C`\-s\*(C'\fR]" 4
  11.242 +.IX Item "openpkg dev install [-f] [-o] [-n] [-s]"
  11.243 +Installs package.
  11.244 +Option
  11.245 +\&\f(CW\*(C`\-f\*(C'\fR adds \f(CW\*(C`\-\-force\*(C'\fR,
  11.246 +\&\f(CW\*(C`\-n\*(C'\fR adds \f(CW\*(C`\-\-nodeps\*(C'\fR and
  11.247 +\&\f(CW\*(C`\-o\*(C'\fR adds \f(CW\*(C`\-\-oldpackage\*(C'\fR
  11.248 +to the underlying \f(CW\*(C`rpm\*(C'\fR call.
  11.249 +Option \f(CW\*(C`\-s\*(C'\fR prefixes the command with \fIsudo\fR\|(1).
  11.250 +.ie n .IP "\fBopenpkg dev erase\fR [\*(C`\-f\*(C'] [\*(C`\-o\*(C'] [\*(C`\-a\*(C'] [\*(C`\-s\*(C']" 4
  11.251 +.el .IP "\fBopenpkg dev erase\fR [\f(CW\*(C`\-f\*(C'\fR] [\f(CW\*(C`\-o\*(C'\fR] [\f(CW\*(C`\-a\*(C'\fR] [\f(CW\*(C`\-s\*(C'\fR]" 4
  11.252 +.IX Item "openpkg dev erase [-f] [-o] [-a] [-s]"
  11.253 +Erases package.
  11.254 +Option
  11.255 +\&\f(CW\*(C`\-f\*(C'\fR adds \f(CW\*(C`\-\-force\*(C'\fR,
  11.256 +\&\f(CW\*(C`\-n\*(C'\fR adds \f(CW\*(C`\-\-nodeps\*(C'\fR and
  11.257 +\&\f(CW\*(C`\-a\*(C'\fR adds \f(CW\*(C`\-\-allmatches\*(C'\fR
  11.258 +to the underlying \f(CW\*(C`rpm\*(C'\fR call.
  11.259 +Option \f(CW\*(C`\-s\*(C'\fR prefixes the command with \fIsudo\fR\|(1).
  11.260 +.ie n .IP "\fBopenpkg dev lint\fR [\*(C`\-v\*(C'] [\*(C`\-b\*(C']" 4
  11.261 +.el .IP "\fBopenpkg dev lint\fR [\f(CW\*(C`\-v\*(C'\fR] [\f(CW\*(C`\-b\*(C'\fR]" 4
  11.262 +.IX Item "openpkg dev lint [-v] [-b]"
  11.263 +Lints package sources \f(CW\*(C`*.spec\*(C'\fR, \f(CW\*(C`fsl.*\*(C'\fR, \f(CW\*(C`rc.*\*(C'\fR and binary package files.
  11.264 +Option \f(CW\*(C`\-v\*(C'\fR enables verboseness.
  11.265 +Option \f(CW\*(C`\-b\*(C'\fR disables the linting of an existing binary package file.
  11.266 +.ie n .IP "\fBopenpkg dev release\fR [\*(C`\-m\*(C' \fImessage\fR] [\*(C`\-n\*(C']" 4
  11.267 +.el .IP "\fBopenpkg dev release\fR [\f(CW\*(C`\-m\*(C'\fR \fImessage\fR] [\f(CW\*(C`\-n\*(C'\fR]" 4
  11.268 +.IX Item "openpkg dev release [-m message] [-n]"
  11.269 +Releases package specification to the repository. Unlike previous
  11.270 +incarnations of \*(L"openpkg dev\*(R" this one is not tied to any repository or
  11.271 +structure. The default message is created using the difference between
  11.272 +the previous and current version of the package specification. In order
  11.273 +to grab the previous version, the working directory and three levels
  11.274 +towards root are checked for signs of \s-1CVS\s0, Subversion, Monotone, Git,
  11.275 +Mercurial or \s-1SVS\s0 information, in that order. The appropriate command is
  11.276 +then executed to retrieve the data and the \s-1VCS\s0 found is passed to the
  11.277 +actual release command.
  11.278 +.Sp
  11.279 +Finally, the command specified by the environment variable
  11.280 +\&\f(CW\*(C`OPENPKG_DEV_RELEASE\*(C'\fR or, if omitted, specified by the rpm macro
  11.281 +\&\f(CW\*(C`%{openpkg_dev_release}\*(C'\fR is run and passed the following positional
  11.282 +arguments:
  11.283 +.RS 4
  11.284 +.Sp
  11.285 +.Vb 12
  11.286 +\&        openpkg\-prefix
  11.287 +\&        spec\-dir
  11.288 +\&        source\-dir
  11.289 +\&        binary\-rpm\-file
  11.290 +\&        source\-rpm\-file
  11.291 +\&        package\-name
  11.292 +\&        package\-version
  11.293 +\&        package\-release
  11.294 +\&        package\-version\-old
  11.295 +\&        package\-release\-old
  11.296 +\&        commit\-message
  11.297 +\&        vcs
  11.298 +.Ve
  11.299 +.RE
  11.300 +.RS 4
  11.301 +.Sp
  11.302 +For a dry run, set \f(CW$OPENPKG_DEV_RELEASE\fR to \*(L"echo\*(R" or use option "\f(CW\*(C`\-n\*(C'\fR".
  11.303 +.RE
  11.304 +.SH "UNPACKED SOURCE RPM PACKAGE FILESYSTEM LAYOUT"
  11.305 +.IX Header "UNPACKED SOURCE RPM PACKAGE FILESYSTEM LAYOUT"
  11.306 +When an OpenPKG source \s-1RPM\s0 package
  11.307 +\&\fIname\fR\f(CW\*(C`\-\*(C'\fR\fIversion\fR\f(CW\*(C`\-\*(C'\fR\fIrelease\fR\f(CW\*(C`.src.rpm\*(C'\fR is unpacked to the
  11.308 +filesystem, the following distinct filesystem layouts are known:
  11.309 +.IP "\fBglobal\fR" 4
  11.310 +.IX Item "global"
  11.311 +.RS 4
  11.312 +.PD 0
  11.313 +.ie n .IP "\fIprefix\fR\*(C`/RPM/SRC/\*(C'\fIname\fR\*(C`/.openpkg/rpmmacros\*(C'" 4
  11.314 +.el .IP "\fIprefix\fR\f(CW\*(C`/RPM/SRC/\*(C'\fR\fIname\fR\f(CW\*(C`/.openpkg/rpmmacros\*(C'\fR" 4
  11.315 +.IX Item "prefix/RPM/SRC/name/.openpkg/rpmmacros"
  11.316 +.ie n .IP "\fIprefix\fR\*(C`/RPM/SRC/\*(C'\fIname\fR\*(C`/\*(C'\fIname\fR\*(C`.spec\*(C'" 4
  11.317 +.el .IP "\fIprefix\fR\f(CW\*(C`/RPM/SRC/\*(C'\fR\fIname\fR\f(CW\*(C`/\*(C'\fR\fIname\fR\f(CW\*(C`.spec\*(C'\fR" 4
  11.318 +.IX Item "prefix/RPM/SRC/name/name.spec"
  11.319 +.ie n .IP "\fIprefix\fR\*(C`/RPM/SRC/\*(C'\fIname\fR\*(C`/\*(C'\fIpackaging-source-file\fR" 4
  11.320 +.el .IP "\fIprefix\fR\f(CW\*(C`/RPM/SRC/\*(C'\fR\fIname\fR\f(CW\*(C`/\*(C'\fR\fIpackaging-source-file\fR" 4
  11.321 +.IX Item "prefix/RPM/SRC/name/packaging-source-file"
  11.322 +.ie n .IP "\fIprefix\fR\*(C`/RPM/SRC/\*(C'\fIname\fR\*(C`/\*(C'\fIthirdparty-distribution-file\fR" 4
  11.323 +.el .IP "\fIprefix\fR\f(CW\*(C`/RPM/SRC/\*(C'\fR\fIname\fR\f(CW\*(C`/\*(C'\fR\fIthirdparty-distribution-file\fR" 4
  11.324 +.IX Item "prefix/RPM/SRC/name/thirdparty-distribution-file"
  11.325 +.ie n .IP "\fIprefix\fR\*(C`/RPM/PKG/\*(C'\fIbinary-rpm-package-file\fR" 4
  11.326 +.el .IP "\fIprefix\fR\f(CW\*(C`/RPM/PKG/\*(C'\fR\fIbinary-rpm-package-file\fR" 4
  11.327 +.IX Item "prefix/RPM/PKG/binary-rpm-package-file"
  11.328 +.ie n .IP "\fIprefix\fR\*(C`/RPM/PKG/\*(C'\fIsource-rpm-package-file\fR" 4
  11.329 +.el .IP "\fIprefix\fR\f(CW\*(C`/RPM/PKG/\*(C'\fR\fIsource-rpm-package-file\fR" 4
  11.330 +.IX Item "prefix/RPM/PKG/source-rpm-package-file"
  11.331 +.ie n .IP "\fIprefix\fR\*(C`/RPM/TMP/\*(C'\fItemporary-file\fR" 4
  11.332 +.el .IP "\fIprefix\fR\f(CW\*(C`/RPM/TMP/\*(C'\fR\fItemporary-file\fR" 4
  11.333 +.IX Item "prefix/RPM/TMP/temporary-file"
  11.334 +.RE
  11.335 +.RS 4
  11.336 +.PD
  11.337 +.Sp
  11.338 +This is just the \*(L"simple\*(R" filesystem layout (see below) with the
  11.339 +\&\fIbase-dir\fR set to \fIprefix\fR\f(CW\*(C`/RPM/SRC/\*(C'\fR.
  11.340 +.Sp
  11.341 +This is the filesystem layout used by default for building OpenPKG
  11.342 +packages during \f(CW\*(C`openpkg build\*(C'\fR or the underlying \f(CW\*(C`openpkg rpm
  11.343 +\&\-\-rebuild\*(C'\fR commands.
  11.344 +.RE
  11.345 +.IP "\fBlocal\fR" 4
  11.346 +.IX Item "local"
  11.347 +.RS 4
  11.348 +.PD 0
  11.349 +.ie n .IP "\fIbase-dir\fR\*(C`/.openpkg/rpmmacros\*(C'" 4
  11.350 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/.openpkg/rpmmacros\*(C'\fR" 4
  11.351 +.IX Item "base-dir/.openpkg/rpmmacros"
  11.352 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIname\fR\*(C`.spec\*(C'" 4
  11.353 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIname\fR\f(CW\*(C`.spec\*(C'\fR" 4
  11.354 +.IX Item "base-dir/name.spec"
  11.355 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIpackaging-source-file\fR" 4
  11.356 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIpackaging-source-file\fR" 4
  11.357 +.IX Item "base-dir/packaging-source-file"
  11.358 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIthirdparty-distribution-file\fR" 4
  11.359 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIthirdparty-distribution-file\fR" 4
  11.360 +.IX Item "base-dir/thirdparty-distribution-file"
  11.361 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIbinary-rpm-package-file\fR" 4
  11.362 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIbinary-rpm-package-file\fR" 4
  11.363 +.IX Item "base-dir/binary-rpm-package-file"
  11.364 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIsource-rpm-package-file\fR" 4
  11.365 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIsource-rpm-package-file\fR" 4
  11.366 +.IX Item "base-dir/source-rpm-package-file"
  11.367 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fItemporary-file\fR" 4
  11.368 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fItemporary-file\fR" 4
  11.369 +.IX Item "base-dir/temporary-file"
  11.370 +.RE
  11.371 +.RS 4
  11.372 +.PD
  11.373 +.Sp
  11.374 +This puts everything into one directory.
  11.375 +.RE
  11.376 +.IP "\fBsimple\fR" 4
  11.377 +.IX Item "simple"
  11.378 +.RS 4
  11.379 +.PD 0
  11.380 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIname\fR\*(C`/.openpkg/rpmmacros\*(C'" 4
  11.381 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIname\fR\f(CW\*(C`/.openpkg/rpmmacros\*(C'\fR" 4
  11.382 +.IX Item "base-dir/name/.openpkg/rpmmacros"
  11.383 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIname\fR\*(C`/\*(C'\fIname\fR\*(C`.spec\*(C'" 4
  11.384 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIname\fR\f(CW\*(C`/\*(C'\fR\fIname\fR\f(CW\*(C`.spec\*(C'\fR" 4
  11.385 +.IX Item "base-dir/name/name.spec"
  11.386 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIname\fR\*(C`/\*(C'\fIpackaging-source-file\fR" 4
  11.387 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIname\fR\f(CW\*(C`/\*(C'\fR\fIpackaging-source-file\fR" 4
  11.388 +.IX Item "base-dir/name/packaging-source-file"
  11.389 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIname\fR\*(C`/\*(C'\fIthirdparty-distribution-file\fR" 4
  11.390 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIname\fR\f(CW\*(C`/\*(C'\fR\fIthirdparty-distribution-file\fR" 4
  11.391 +.IX Item "base-dir/name/thirdparty-distribution-file"
  11.392 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIbinary-rpm-package-file\fR" 4
  11.393 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIbinary-rpm-package-file\fR" 4
  11.394 +.IX Item "base-dir/binary-rpm-package-file"
  11.395 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIsource-rpm-package-file\fR" 4
  11.396 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIsource-rpm-package-file\fR" 4
  11.397 +.IX Item "base-dir/source-rpm-package-file"
  11.398 +.ie n .IP "\fI\fI$TMPDIR\fI\fR\*(C`/openpkg/\*(C'\fItemporary-file\fR" 4
  11.399 +.el .IP "\fI\f(CI$TMPDIR\fI\fR\f(CW\*(C`/openpkg/\*(C'\fR\fItemporary-file\fR" 4
  11.400 +.IX Item "$TMPDIR/openpkg/temporary-file"
  11.401 +.RE
  11.402 +.RS 4
  11.403 +.PD
  11.404 +.Sp
  11.405 +This is the simple filesystem layout of an unpacked
  11.406 +OpenPKG package. All files are simply put into a sub-directory with the
  11.407 +\&\fIname\fR of the package.
  11.408 +.Sp
  11.409 +This is the filesystem layout used for the quick patching of a single
  11.410 +OpenPKG package in a stand-alone environment.
  11.411 +.RE
  11.412 +.IP "\fBstructured\fR" 4
  11.413 +.IX Item "structured"
  11.414 +.RS 4
  11.415 +.PD 0
  11.416 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIname\fR\*(C`/.openpkg/rpmmacros\*(C'" 4
  11.417 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIname\fR\f(CW\*(C`/.openpkg/rpmmacros\*(C'\fR" 4
  11.418 +.IX Item "base-dir/name/.openpkg/rpmmacros"
  11.419 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIname\fR\*(C`/src/\*(C'\fIname\fR\*(C`.spec\*(C'" 4
  11.420 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIname\fR\f(CW\*(C`/src/\*(C'\fR\fIname\fR\f(CW\*(C`.spec\*(C'\fR" 4
  11.421 +.IX Item "base-dir/name/src/name.spec"
  11.422 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIname\fR\*(C`/src/\*(C'\fIpackaging-source-file\fR" 4
  11.423 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIname\fR\f(CW\*(C`/src/\*(C'\fR\fIpackaging-source-file\fR" 4
  11.424 +.IX Item "base-dir/name/src/packaging-source-file"
  11.425 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIname\fR\*(C`/dst/\*(C'\fIthirdparty-distribution-file\fR" 4
  11.426 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIname\fR\f(CW\*(C`/dst/\*(C'\fR\fIthirdparty-distribution-file\fR" 4
  11.427 +.IX Item "base-dir/name/dst/thirdparty-distribution-file"
  11.428 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIname\fR\*(C`/pkg/\*(C'[\*(C`bin/\*(C']\fIbinary-rpm-package-file\fR" 4
  11.429 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIname\fR\f(CW\*(C`/pkg/\*(C'\fR[\f(CW\*(C`bin/\*(C'\fR]\fIbinary-rpm-package-file\fR" 4
  11.430 +.IX Item "base-dir/name/pkg/[bin/]binary-rpm-package-file"
  11.431 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIname\fR\*(C`/pkg/\*(C'[\*(C`src/\*(C']\fIsource-rpm-package-file\fR" 4
  11.432 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIname\fR\f(CW\*(C`/pkg/\*(C'\fR[\f(CW\*(C`src/\*(C'\fR]\fIsource-rpm-package-file\fR" 4
  11.433 +.IX Item "base-dir/name/pkg/[src/]source-rpm-package-file"
  11.434 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\fIname\fR\*(C`/tmp/\*(C'\fItemporary-file\fR" 4
  11.435 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\fIname\fR\f(CW\*(C`/tmp/\*(C'\fR\fItemporary-file\fR" 4
  11.436 +.IX Item "base-dir/name/tmp/temporary-file"
  11.437 +.RE
  11.438 +.RS 4
  11.439 +.PD
  11.440 +.Sp
  11.441 +This is the structured (and default) filesystem layout of an unpacked
  11.442 +OpenPKG package. A top-level sub-directory with the \fIname\fR of the
  11.443 +package is created. There the package specification and all packaging
  11.444 +source files are put into the sub-directory \fIsrc\fR and all the
  11.445 +third-party distribution files are put into the sub-directory \fIdst\fR.
  11.446 +.Sp
  11.447 +This is the filesystem layout used for the development of a single
  11.448 +OpenPKG package in a stand-alone environment.
  11.449 +.RE
  11.450 +.IP "\fBdistributed\fR" 4
  11.451 +.IX Item "distributed"
  11.452 +.RS 4
  11.453 +.PD 0
  11.454 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\*(C`.openpkg/rpmmacros\*(C'" 4
  11.455 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\f(CW\*(C`.openpkg/rpmmacros\*(C'\fR" 4
  11.456 +.IX Item "base-dir/.openpkg/rpmmacros"
  11.457 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\*(C`src/\*(C'\fIname\fR\*(C`/\*(C'\fIname\fR\*(C`.spec\*(C'" 4
  11.458 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\f(CW\*(C`src/\*(C'\fR\fIname\fR\f(CW\*(C`/\*(C'\fR\fIname\fR\f(CW\*(C`.spec\*(C'\fR" 4
  11.459 +.IX Item "base-dir/src/name/name.spec"
  11.460 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\*(C`src/\*(C'\fIname\fR\*(C`/\*(C'\fIpackaging-source-file\fR" 4
  11.461 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\f(CW\*(C`src/\*(C'\fR\fIname\fR\f(CW\*(C`/\*(C'\fR\fIpackaging-source-file\fR" 4
  11.462 +.IX Item "base-dir/src/name/packaging-source-file"
  11.463 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\*(C`dst/\*(C'\fIname\fR\*(C`/\*(C'\fIthirdparty-distribution-file\fR" 4
  11.464 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\f(CW\*(C`dst/\*(C'\fR\fIname\fR\f(CW\*(C`/\*(C'\fR\fIthirdparty-distribution-file\fR" 4
  11.465 +.IX Item "base-dir/dst/name/thirdparty-distribution-file"
  11.466 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\*(C`pkg/\*(C'[\*(C`bin/\*(C']\fIbinary-rpm-package-file\fR" 4
  11.467 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\f(CW\*(C`pkg/\*(C'\fR[\f(CW\*(C`bin/\*(C'\fR]\fIbinary-rpm-package-file\fR" 4
  11.468 +.IX Item "base-dir/pkg/[bin/]binary-rpm-package-file"
  11.469 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\*(C`pkg/\*(C'[\*(C`src/\*(C']\fIsource-rpm-package-file\fR" 4
  11.470 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\f(CW\*(C`pkg/\*(C'\fR[\f(CW\*(C`src/\*(C'\fR]\fIsource-rpm-package-file\fR" 4
  11.471 +.IX Item "base-dir/pkg/[src/]source-rpm-package-file"
  11.472 +.ie n .IP "\fIbase-dir\fR\*(C`/\*(C'\*(C`tmp/\*(C'\fItemporary-file\fR" 4
  11.473 +.el .IP "\fIbase-dir\fR\f(CW\*(C`/\*(C'\fR\f(CW\*(C`tmp/\*(C'\fR\fItemporary-file\fR" 4
  11.474 +.IX Item "base-dir/tmp/temporary-file"
  11.475 +.RE
  11.476 +.RS 4
  11.477 +.PD
  11.478 +.Sp
  11.479 +This is the distributed filesystem layout of an unpacked OpenPKG
  11.480 +package. It is similar to the structured filesystem layout but the
  11.481 +\&\f(CW\*(C`src\*(C'\fR and \f(CW\*(C`dst\*(C'\fR directories and the \fIname\fR directory are swapped,
  11.482 +mainly with the intention of bundling together all third-party
  11.483 +distribution files of a large number of packages.
  11.484 +.Sp
  11.485 +This is the filesystem layout used for regular OpenPKG package
  11.486 +development.
  11.487 +.RE
  11.488 +.SH "LOCAL RPM MACROS FILE (.openpkg/rpmmacros)"
  11.489 +.IX Header "LOCAL RPM MACROS FILE (.openpkg/rpmmacros)"
  11.490 +OpenPKG supports local \s-1RPM\s0 macros files \fI.openpkg/rpmmacros\fR which
  11.491 +can be used to configure \s-1RPM\s0 in a local scope. This is especially
  11.492 +interesting to configure a local (even per-package) build environment
  11.493 +with the help of the \f(CW%openpkg_layout\fR macro.
  11.494 +.PP
  11.495 +\&\f(CW%openpkg_layout\fR
  11.496 +[\f(CW\*(C`macrosfile=\*(C'\fR\fIfilename\fR]
  11.497 +[\f(CW\*(C`basedir=\*(C'\fR\fIdirectory\fR]
  11.498 +[\f(CW\*(C`specdir=\*(C'\fR\fIdirectory\fR]
  11.499 +[\f(CW\*(C`sourcedir=\*(C'\fR\fIdirectory\fR]
  11.500 +[\f(CW\*(C`builddir=\*(C'\fR\fIdirectory\fR]
  11.501 +[\f(CW\*(C`tmpdir=\*(C'\fR\fIdirectory\fR]
  11.502 +[\f(CW\*(C`binrpmdir=\*(C'\fR\fIdirectory\fR]
  11.503 +[\f(CW\*(C`srcrpmdir=\*(C'\fR\fIdirectory\fR]
  11.504 +[\f(CW\*(C`shared=\*(C'\fR\fIyes-or-no\fR]
  11.505 +[\f(CW\*(C`debug=\*(C'\fR\fIyes-or-no\fR]
  11.506 +.ie n .IP "\*(C`macrosfile=\*(C'\fIfilename\fR" 4
  11.507 +.el .IP "\f(CW\*(C`macrosfile=\*(C'\fR\fIfilename\fR" 4
  11.508 +.IX Item "macrosfile=filename"
  11.509 +Absolute file path of the \f(CW\*(C`.openpkg/rpmmacros\*(C'\fR file where this
  11.510 +\&\f(CW%openpkg_layout\fR macro is defined. Usually, the intended usage is to
  11.511 +leverage from OpenPKG \s-1RPM\s0's special \f(CW\*(C`%{macrosfile}\*(C'\fR macro by simply
  11.512 +using \f(CW\*(C`macrosfile=%{macrosfile}\*(C'\fR. This parameter is important as
  11.513 +the default \f(CW\*(C`basename\*(C'\fR is derived from it.
  11.514 +.ie n .IP "\*(C`basedir=\*(C'\fIdirectory\fR" 4
  11.515 +.el .IP "\f(CW\*(C`basedir=\*(C'\fR\fIdirectory\fR" 4
  11.516 +.IX Item "basedir=directory"
  11.517 +Absolute directory path where the \f(CW\*(C`.openpkg/rpmmacros\*(C'\fR file is
  11.518 +located under. Usually, the intended usage is to not explicitly
  11.519 +set this parameter but let it be determined indirectly via
  11.520 +\&\f(CW\*(C`macrosfile\*(C'\fR. The effective default value is equal to a value like
  11.521 +\&\f(CW\*(C`%{realpath:%{dirname:%{realpath:%{macrosfile}}}/..}\*(C'\fR This parameter is
  11.522 +important as all standard filesystem layouts (see parameter \f(CW\*(C`layout\*(C'\fR)
  11.523 +are always at least partially based on this base directory in order
  11.524 +to provide absolute-path-independent flexible filesystem layouts.
  11.525 +.ie n .IP "\*(C`layout=\*(C'\fIlayout\fR" 4
  11.526 +.el .IP "\f(CW\*(C`layout=\*(C'\fR\fIlayout\fR" 4
  11.527 +.IX Item "layout=layout"
  11.528 +The name of the filesystem layout type to use. The following standard
  11.529 +filesystem layout types are pre-defined: \f(CW\*(C`global\*(C'\fR, \f(CW\*(C`local\*(C'\fR, \f(CW\*(C`simple\*(C'\fR,
  11.530 +\&\f(CW\*(C`structured\*(C'\fR (default) and \f(CW\*(C`distributed\*(C'\fR.
  11.531 +.Sp
  11.532 +.Vb 8
  11.533 +\& global      macrosdir   <openpkg_prefix>/etc/openpkg
  11.534 +\& global      macrosfile  <openpkg_prefix>/etc/openpkg/rpmmacros
  11.535 +\& global      specdir     <openpkg_prefix>/RPM/SRC/$name
  11.536 +\& global      sourcedir   <openpkg_prefix>/RPM/SRC/$name
  11.537 +\& global      builddir    <openpkg_prefix>/RPM/TMP
  11.538 +\& global      tmpdir      <openpkg_prefix>/RPM/TMP
  11.539 +\& global      binrpmdir   <openpkg_prefix>/RPM/PKG
  11.540 +\& global      srcrpmdir   <openpkg_prefix>/RPM/PKG
  11.541 +\&
  11.542 +\& local       macrosdir   <basedir>/.openpkg
  11.543 +\& local       macrosfile  <basedir>/.openpkg/rpmmacros
  11.544 +\& local       specdir     <basedir>
  11.545 +\& local       sourcedir   <basedir>
  11.546 +\& local       builddir    <basedir>
  11.547 +\& local       tmpdir      <basedir>
  11.548 +\& local       binrpmdir   <basedir>
  11.549 +\& local       srcrpmdir   <basedir>
  11.550 +\&
  11.551 +\& simple      macrosdir   <basedir>/.openpkg
  11.552 +\& simple      macrosfile  <basedir>/.openpkg/rpmmacros
  11.553 +\& simple      specdir     <basedir>
  11.554 +\& simple      sourcedir   <basedir>
  11.555 +\& simple      builddir    <tmpdir>
  11.556 +\& simple      tmpdir      <tmpdir>
  11.557 +\& simple      binrpmdir   <basedir>/..
  11.558 +\& simple      srcrpmdir   <basedir>/..
  11.559 +\&
  11.560 +\& structured  macrosdir   <basedir>/.openpkg
  11.561 +\& structured  macrosfile  <basedir>/.openpkg/rpmmacros
  11.562 +\& structured  specdir     <basedir>/src
  11.563 +\& structured  sourcedir   <basedir>/dst
  11.564 +\& structured  builddir    <basedir>/tmp
  11.565 +\& structured  tmpdir      <basedir>/tmp
  11.566 +\& structured  binrpmdir   <basedir>/pkg/bin
  11.567 +\& structured  srcrpmdir   <basedir>/pkg/src
  11.568 +\&
  11.569 +\& distributed macrosdir   <basedir>/.openpkg
  11.570 +\& distributed macrosfile  <basedir>/.openpkg/rpmmacros
  11.571 +\& distributed specdir     <basedir>/src/<name>
  11.572 +\& distributed sourcedir   <basedir>/dst/<name>
  11.573 +\& distributed builddir    <basedir>/tmp
  11.574 +\& distributed tmpdir      <basedir>/tmp
  11.575 +\& distributed binrpmdir   <basedir>/pkg/bin
  11.576 +\& distributed srcrpmdir   <basedir>/pkg/src
  11.577 +.Ve
  11.578 +.ie n .IP "\*(C`specdir=\*(C'\fIdirectory-list\fR" 4
  11.579 +.el .IP "\f(CW\*(C`specdir=\*(C'\fR\fIdirectory-list\fR" 4
  11.580 +.IX Item "specdir=directory-list"
  11.581 +.PD 0
  11.582 +.ie n .IP "\*(C`sourcedir=\*(C'\fIdirectory-list\fR" 4
  11.583 +.el .IP "\f(CW\*(C`sourcedir=\*(C'\fR\fIdirectory-list\fR" 4
  11.584 +.IX Item "sourcedir=directory-list"
  11.585 +.ie n .IP "\*(C`builddir=\*(C'\fIdirectory-list\fR" 4
  11.586 +.el .IP "\f(CW\*(C`builddir=\*(C'\fR\fIdirectory-list\fR" 4
  11.587 +.IX Item "builddir=directory-list"
  11.588 +.ie n .IP "\*(C`tmpdir=\*(C'\fIdirectory-list\fR" 4
  11.589 +.el .IP "\f(CW\*(C`tmpdir=\*(C'\fR\fIdirectory-list\fR" 4
  11.590 +.IX Item "tmpdir=directory-list"
  11.591 +.ie n .IP "\*(C`binrpmdir=\*(C'\fIdirectory-list\fR" 4
  11.592 +.el .IP "\f(CW\*(C`binrpmdir=\*(C'\fR\fIdirectory-list\fR" 4
  11.593 +.IX Item "binrpmdir=directory-list"
  11.594 +.ie n .IP "\*(C`srcrpmdir=\*(C'\fIdirectory-list\fR" 4
  11.595 +.el .IP "\f(CW\*(C`srcrpmdir=\*(C'\fR\fIdirectory-list\fR" 4
  11.596 +.IX Item "srcrpmdir=directory-list"
  11.597 +.PD
  11.598 +These parameters correspond to the six individual directories provided
  11.599 +by a standard layout and allow you to selectively adjust parts of a
  11.600 +standard layout to local needs and without having to define a full
  11.601 +standard layout yourself.
  11.602 +.Sp
  11.603 +The \fIdirectory-list\fR is a whitespace-separated list of
  11.604 +\&\fIdirectory\fR[\f(CW\*(C`:\*(C'\fR[\f(CW\*(C`+\*(C'\fR]\fIdirectory\fR] specifications which are
  11.605 +\&\*(L"first-match\*(R" searched for existence. The last directory in the list
  11.606 +is always taken as the fallback and if it is not existing it is
  11.607 +even created on-the-fly. The \fIdirectory-check\fR\f(CW\*(C`:\*(C'\fR\fIdirectory-use\fR
  11.608 +syntax variant allows the existence test to use \fIdirectory-check\fR,
  11.609 +but expands to \fIdirectory-use\fR (replace mode). The
  11.610 +\&\fIdirectory-check\fR\f(CW\*(C`:+\*(C'\fR\fIdirectory-use\fR syntax variant allows
  11.611 +the existence test to use \fIdirectory-check\fR, but expands to
  11.612 +\&\fIdirectory-check\fR\fIdirectory-use\fR (append mode). For instance
  11.613 +\&\f(CW\*(C`tmpdir="%{getenv:HOME)/tmp:+/openpkg %{getenv:TMPDIR}:+/openpkg
  11.614 +/tmp/%(echo $LOGNAME)/openpkg"\*(C'\fR will first check for ~/tmp (and then use
  11.615 +~/tmp/openpkg), then for \f(CW$TMPDIR\fR (and use \f(CW$TMPDIR\fR/openpkg) and finally
  11.616 +it will use /tmp/$LOGNAME/openpkg at last resort.
  11.617 +.Sp
  11.618 +Paths are usually assembled by using \s-1RPM\s0 macros like
  11.619 +\&\f(CW\*(C`%{l_prefix}\*(C'\fR (the instance prefix), \f(CW\*(C`%{_\|_openpkg_basename}\*(C'\fR (the
  11.620 +\&\fIbasename\fR parameter), \f(CW\*(C`%{realpath:<path\*(C'\fR} (path resolution),
  11.621 +\&\f(CW\*(C`%{dirname:<path\*(C'\fR} (directory name extraction), \f(CW\*(C`%{basename:<path\*(C'\fR}
  11.622 +(file name extraction), etc.
  11.623 +.ie n .IP "\*(C`shared=\*(C'\fIyes-or-no\fR" 4
  11.624 +.el .IP "\f(CW\*(C`shared=\*(C'\fR\fIyes-or-no\fR" 4
  11.625 +.IX Item "shared=yes-or-no"
  11.626 +This enables the \fIsubdir\fR components in the standard filesystem
  11.627 +layouts by setting it to an automatically generated sub-directory named
  11.628 +\&\fIhost\fR\f(CW\*(C`\-\*(C'\fR\fIarch\fR\-\fIos\fR. This allows one to build the same OpenPKG
  11.629 +package in parallel on multiple hosts in a shared environment (usually
  11.630 +on an \s-1NFS\s0 based filesystem).
  11.631 +.ie n .IP "\*(C`debug=\*(C'\fIyes-or-no\fR" 4
  11.632 +.el .IP "\f(CW\*(C`debug=\*(C'\fR\fIyes-or-no\fR" 4
  11.633 +.IX Item "debug=yes-or-no"
  11.634 +This enables debug outputs which shows the effectively used directory
  11.635 +paths.
  11.636 +.PP
  11.637 +The generated \f(CW\*(C`.openpkg/rpmmacros\*(C'\fR file contains the generic filesystem
  11.638 +layout glue configuration for the particular filesystem \fIlayout\fR.
  11.639 +.ie n .IP "\*(C`%openpkg_layout  macrosfile=%{macrosfile} layout=\*(C'\fItype\fR" 1
  11.640 +.el .IP "\f(CW\*(C`%openpkg_layout  macrosfile=%{macrosfile} layout=\*(C'\fR\fItype\fR" 1
  11.641 +.IX Item "%openpkg_layout  macrosfile=%{macrosfile} layout=type"
  11.642 +.SH "CONFIGURATION"
  11.643 +.IX Header "CONFIGURATION"
  11.644 +.Vb 3
  11.645 +\& OPENPKG_NAME="Ralf S. Engelschall"
  11.646 +\& OPENPKG_MAIL="rse@openpkg.net"
  11.647 +\& OPENPKG_MODE="developer"
  11.648 +\&
  11.649 +\& OPENPKG_PREFIX="/openpkg"
  11.650 +\& OPENPKG_TMPDIR="${TMPDIR\-/tmp}/openpkg"
  11.651 +\&
  11.652 +\& OPENPKG_VCS="cvs ci \-m \*(Aq<msg>\*(Aq ."
  11.653 +\& OPENPKG_UPLD="scp <srpm> openpkg\-ftp@ftp.openpkg.org:/current/SRC/00UPLOAD/"
  11.654 +.Ve
  11.655 +.SH "ABOUT"
  11.656 +.IX Header "ABOUT"
  11.657 +OpenPKG \fBdev\fR is Ralf S. Engelschall's Perl-based clean-room partial
  11.658 +re-implementation of 2008 for OpenPKG 4.0 of Thomas Lotterer's original
  11.659 +OpenPKG \fBdev\fR Bash-based shell from 2002.
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/openpkg/dev.pl	Tue Jul 31 12:23:42 2012 +0200
    12.3 @@ -0,0 +1,905 @@
    12.4 +##
    12.5 +##  openpkg dev -- OpenPKG Package Development Tool
    12.6 +##  Copyright (c) 2008-2012 OpenPKG GmbH <http://openpkg.com/>
    12.7 +##
    12.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    12.9 +##  All rights reserved. Licenses which grant limited permission to use,
   12.10 +##  copy, modify and distribute this software are available from the
   12.11 +##  OpenPKG GmbH.
   12.12 +##
   12.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   12.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   12.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   12.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   12.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   12.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   12.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   12.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   12.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   12.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   12.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   12.24 +##  SUCH DAMAGE.
   12.25 +##
   12.26 +
   12.27 +require 5;
   12.28 +
   12.29 +#   OpenPKG instance prefix and RPM
   12.30 +my $openpkg_prefix = $ENV{'OPENPKG_PREFIX'};
   12.31 +delete $ENV{'OPENPKG_PREFIX'};
   12.32 +
   12.33 +#   program identification
   12.34 +my $prog_name  = "dev";
   12.35 +my $prog_vers  = "20100111";
   12.36 +
   12.37 +#   home-brewn getopt(3) style option parser
   12.38 +sub getopts ($$@) {
   12.39 +    my ($opt_spec, $opts, @argv_orig) = @_;
   12.40 +    my (%optf) = map { m/(\w)/; $1 => $_ } $opt_spec =~ m/(\w:|\w)/g;
   12.41 +    my (@argv, $optarg);
   12.42 +
   12.43 +    foreach (@argv_orig) {
   12.44 +        if (@argv) {
   12.45 +            push @argv, $_;
   12.46 +        } elsif (defined $optarg) {
   12.47 +            if (exists $opts->{$optarg}) {
   12.48 +                $opts->{$optarg} .= " $_";
   12.49 +            } else {
   12.50 +                $opts->{$optarg} = $_;
   12.51 +            }
   12.52 +            $optarg = undef;
   12.53 +        } elsif (!/^[-]/) {
   12.54 +            push @argv, $_;
   12.55 +        } else {
   12.56 +            while (/^\-(\w)(.*)/) {
   12.57 +                if (exists $optf{$1}) {
   12.58 +                    if (length($optf{$1}) > 1) {
   12.59 +                        if ($2 ne '') {
   12.60 +                            if (exists $opts->{$1}) {
   12.61 +                                $opts->{$1} .= " $2";
   12.62 +                            } else {
   12.63 +                                $opts->{$1} = $2;
   12.64 +                            }
   12.65 +                        } else {
   12.66 +                            $optarg = $1;
   12.67 +                        }
   12.68 +                        last;
   12.69 +                    } else {
   12.70 +                        $opts->{$1} = 1;
   12.71 +                    }
   12.72 +                } else {
   12.73 +                    warn "openpkg:$prog_name:WARNING: unknown option $_\n";
   12.74 +                }
   12.75 +                $_ = "-$2";
   12.76 +            }
   12.77 +        }
   12.78 +    }
   12.79 +    if (defined $optarg) {
   12.80 +        warn "openpkg:$prog_name:WARNING: option $optarg requires an argument\n";
   12.81 +    }
   12.82 +    foreach my $opt (keys %optf) {
   12.83 +        if (not exists $opts->{$opt}) {
   12.84 +            $opts->{$opt} = (length($optf{$opt}) > 1 ? "" : 0);
   12.85 +        }
   12.86 +    }
   12.87 +    return @argv;
   12.88 +}
   12.89 +
   12.90 +#   determine reasonable temporary directory
   12.91 +my $tmpdir = ($ENV{"TMPDIR"} || "/tmp");
   12.92 +$tmpdir .= "/openpkg-$prog_name-$$";
   12.93 +my $rc = system("umask 022; $openpkg_prefix/lib/openpkg/shtool mkdir -f -p -m 755 $tmpdir || exit $?");
   12.94 +if ($rc != 0) {
   12.95 +    die "failed to create temporary directory: $tmpdir";
   12.96 +}
   12.97 +
   12.98 +#   parse command line options
   12.99 +my $opts = {};
  12.100 +@ARGV = getopts("h", $opts, @ARGV);
  12.101 +
  12.102 +#   usage sanity check and usage help
  12.103 +sub usage {
  12.104 +    my ($rc) = @_;
  12.105 +    my $usage =
  12.106 +        "openpkg:$prog_name:USAGE: openpkg dev <command> [<options>]\n";
  12.107 +    if ($rc == 0) {
  12.108 +        print STDOUT $usage;
  12.109 +    }
  12.110 +    else {
  12.111 +        print STDERR $usage;
  12.112 +    }
  12.113 +    exit($rc);
  12.114 +}
  12.115 +if ($opts->{"h"}) {
  12.116 +    usage(0);
  12.117 +}
  12.118 +if (@ARGV == 0) {
  12.119 +    usage(1);
  12.120 +}
  12.121 +
  12.122 +#   command map
  12.123 +my $map = {
  12.124 +    "unpack "            => { -alias => qr/^(up|ex)$/,   -key => "x" },
  12.125 +    "edit\n"             => { -alias => qr/^(ed|vi)$/,   -key => "v" },
  12.126 +    "build -s track\n"   => { -alias => qr/^(bt|tr)$/,   -key => "t" },
  12.127 +    "build -s fetch\n"   => { -alias => qr/^(bf|fe)$/,   -key => "f" },
  12.128 +    "build\n"            => { -alias => qr/^(ba|bu)$/,   -key => "b" },
  12.129 +    "build -s prep\n"    => { -alias => qr/^bp$/,        -key => "1" },
  12.130 +    "build -s compile\n" => { -alias => qr/^bc$/,        -key => "2" },
  12.131 +    "build -s install\n" => { -alias => qr/^bi$/,        -key => "3" },
  12.132 +    "build -s binary\n"  => { -alias => qr/^bb$/,        -key => "4" },
  12.133 +    "build -s source\n"  => { -alias => qr/^bs$/,        -key => "s" },
  12.134 +    "peek\n"             => { -alias => qr/^pe$/,        -key => "p" },
  12.135 +    "diff\n"             => { -alias => qr/^di$/,        -key => "d" },
  12.136 +    "install\n"          => { -alias => qr/^in(?:st)?$/, -key => "i" },
  12.137 +    "erase\n"            => { -alias => qr/^er$/,        -key => "e" },
  12.138 +    "lint\n"             => { -alias => qr/^li$/,        -key => "l" },
  12.139 +    "release "           => { -alias => qr/^rel?$/,      -key => "r" },
  12.140 +};
  12.141 +
  12.142 +#   dispatch command
  12.143 +my $cmd = shift(@ARGV);
  12.144 +foreach my $c (keys %{$map}) {
  12.145 +    my $a = $map->{$c}->{-alias};
  12.146 +    if ($cmd =~ $a) {
  12.147 +        $c =~ s/\n$//;
  12.148 +        my @args = split(/\s+/, $c);
  12.149 +        $cmd = shift(@args);
  12.150 +        unshift(@ARGV, @args);
  12.151 +        print STDOUT "\033[34m\$ opd $cmd " . join(" ", map {
  12.152 +            my $x = $_;
  12.153 +            $x =~ s/"/\\"/g;
  12.154 +            $x =~ s/^(.*[ \t].*)$/"$1"/;
  12.155 +            $x
  12.156 +        } @ARGV) . "\033[0m\n";
  12.157 +    }
  12.158 +}
  12.159 +my $func = "cmd_$cmd";
  12.160 +if (not defined(&$func)) {
  12.161 +    print STDERR "openpkg:$prog_name:ERROR: invalid command \"$cmd\"\n";
  12.162 +    usage(1);
  12.163 +}
  12.164 +my $rc = &$func($opts, @ARGV);
  12.165 +exit($rc);
  12.166 +
  12.167 +#   execute a shell command
  12.168 +sub run {
  12.169 +    my ($cmd) = @_;
  12.170 +    print STDOUT "\033[34m\$ $cmd\033[0m\n";
  12.171 +    my $rc = system($cmd);
  12.172 +    return $rc;
  12.173 +}
  12.174 +
  12.175 +#   determine path to package specification
  12.176 +sub specfile {
  12.177 +    my $specfile = (glob("*.spec"))[0];
  12.178 +    if (not defined $specfile) {
  12.179 +        $specfile = (glob("src/*.spec"))[0];
  12.180 +        if (not defined $specfile) {
  12.181 +            $specfile = (glob("*/*.spec"))[0];
  12.182 +            if (not defined $specfile) {
  12.183 +                print STDERR "openpkg:$prog_name:ERROR: unable to determine package specification file\n";
  12.184 +                exit(1);
  12.185 +            }
  12.186 +        }
  12.187 +    }
  12.188 +    return $specfile;
  12.189 +}
  12.190 +
  12.191 +#   command: interactive shell
  12.192 +sub cmd_shell ($@) {
  12.193 +    my ($gopts, @argv) = @_;
  12.194 +    my $rc = 0;
  12.195 +
  12.196 +    #   command line argument processing
  12.197 +    my $lopts = {};
  12.198 +    @argv = getopts("s", $lopts, @argv);
  12.199 +
  12.200 +    #   determine release
  12.201 +    my $release = `$openpkg_prefix/bin/openpkg release -F '%t'`;
  12.202 +    $release =~ s/\n$//s;
  12.203 +
  12.204 +    #   create dot files
  12.205 +    my $screenrc = "$tmpdir/dot.screenrc";
  12.206 +    my $bashsh   = "$tmpdir/bash.sh";
  12.207 +    my $bashrc   = "$tmpdir/dot.bashrc";
  12.208 +    my $inputrc  = "$tmpdir/dot.inputrc";
  12.209 +    unlink("$screenrc");
  12.210 +    unlink("$bashsh");
  12.211 +    unlink("$bashrc");
  12.212 +    unlink("$inputrc");
  12.213 +    my $title = "openpkg dev";
  12.214 +    $title .= '%? %{= rW} %n %{-}%?';
  12.215 +    $title .= ' %=%-w%{= rW}%50>%n %t%{-}%+w';
  12.216 +    my $screenrc_data = "";
  12.217 +    $screenrc_data .= "source \"$ENV{HOME}/.screenrc\"\n" if (-f "$ENV{HOME}/.screenrc");
  12.218 +    $screenrc_data .=
  12.219 +        "escape          ^Aa\n" .
  12.220 +        "startup_message off\n" .
  12.221 +        "vbell           off\n" .
  12.222 +        "defscrollback   10000\n" .
  12.223 +        "defmonitor      off\n" .
  12.224 +        "msgminwait      1\n" .
  12.225 +        "msgwait         1\n" .
  12.226 +        "hardstatus      alwayslastline \" $title \"\n" .
  12.227 +        "shell           $bashsh\n";
  12.228 +    my $bashsh_data =
  12.229 +        "##\n" .
  12.230 +        "##\  bash.sh -- \"openpkg dev shell\" GNU bash wrapper script\n" .
  12.231 +        "##\n" .
  12.232 +        "\n" .
  12.233 +        "OPENPKG_PREFIX=\"$openpkg_prefix\"\n" .
  12.234 +        "export OPENPKG_PREFIX\n" .
  12.235 +        "INPUTRC=\"$inputrc\"\n" .
  12.236 +        "export INPUTRC\n" .
  12.237 +        "SHELL=\"$openpkg_prefix/lib/openpkg/bash\"\n" .
  12.238 +        "export SHELL\n" .
  12.239 +        "eval `$openpkg_prefix/bin/openpkg rpm --eval 'T=\"\%{_tmppath}\"; S=\"\%{_specdir}\"; D=\"\%{_sourcedir}\"'`\n" .
  12.240 +        "export T S D\n" .
  12.241 +        "\$SHELL --rcfile $bashrc";
  12.242 +    my $bashrc_data =
  12.243 +        "##\n" .
  12.244 +        "##  dot.bashrc -- \"openpkg dev shell\" GNU bash configuration\n" .
  12.245 +        "##\n" .
  12.246 +        "\n" .
  12.247 +        "#   load user's standard bash run-command script\n" .
  12.248 +        "if [ -f ~/.bashrc ]; then\n" .
  12.249 +        "    . ~/.bashrc\n" .
  12.250 +        "fi\n" .
  12.251 +        "\n" .
  12.252 +        "#   configure a special command-line prompt\n" .
  12.253 +        "if [ \".\$TERM\" = .screen ]; then\n" .
  12.254 +        "    PS1=\"\\\\u@\\\\h:\\\\w [P=\\\\e[1m\\\${OPENPKG_PREFIX}\\\\e[0m]\\n\\\\\\\$ \\\\ek\\\\W\\\\e\\\\\\\\\"\n" .
  12.255 +        "else\n" .
  12.256 +        "    PS1=\"\\\\u@\\\\h:\\\\w [P=\\\\e[1m\\\${OPENPKG_PREFIX}\\\\e[0m]\\n\\\\\\\$ \"\n" .
  12.257 +        "fi\n" .
  12.258 +        "alias openpkg=\"\\\${OPENPKG_PREFIX}/bin/openpkg\"\n" .
  12.259 +        "alias opd=\"\\\${OPENPKG_PREFIX}/bin/openpkg dev\"\n" .
  12.260 +        "\n";
  12.261 +    my $inputrc_data =
  12.262 +        "##\n" .
  12.263 +        "##  dot.inputrc -- \"openpkg dev shell\" GNU readline configuration\n" .
  12.264 +        "##\n" .
  12.265 +        "\n";
  12.266 +    foreach my $c (keys %{$map}) {
  12.267 +        my $k = $map->{$c}->{-key};
  12.268 +        $c =~ s/\n/\\n/sg;
  12.269 +        $inputrc_data .= "\"\\e$k\": \"opd $c\"\n";
  12.270 +    }
  12.271 +    $inputrc_data .= "\n";
  12.272 +    open(SCREENRC, ">$screenrc");
  12.273 +    print(SCREENRC $screenrc_data);
  12.274 +    close(SCREENRC);
  12.275 +    open(BASHSH, ">$bashsh");
  12.276 +    print(BASHSH $bashsh_data);
  12.277 +    close(BASHSH);
  12.278 +    system("chmod a+x $bashsh");
  12.279 +    open(BASHRC, ">$bashrc");
  12.280 +    print(BASHRC $bashrc_data);
  12.281 +    close(BASHRC);
  12.282 +    open(INPUTRC, ">$inputrc");
  12.283 +    print(INPUTRC $inputrc_data);
  12.284 +    close(INPUTRC);
  12.285 +
  12.286 +    #   run interactive shell
  12.287 +    print STDOUT "\033[34m++ entering OpenPKG $release development shell\033[0m\n";
  12.288 +    my $rc;
  12.289 +    if ($lopts->{"s"}) {
  12.290 +        $rc = system("screen -c $screenrc -S 'openpkg-dev-shell' -d -R");
  12.291 +    }
  12.292 +    else {
  12.293 +        $rc = system("$bashsh");
  12.294 +    }
  12.295 +
  12.296 +    #   cleanup
  12.297 +    unlink("$tmpdir/dot.screenrc");
  12.298 +    unlink("$tmpdir/bash.sh");
  12.299 +    unlink("$tmpdir/dot.bashrc");
  12.300 +    unlink("$tmpdir/dot.inputrc");
  12.301 +    unlink("$tmpdir");
  12.302 +
  12.303 +    return $rc;
  12.304 +}
  12.305 +
  12.306 +#   command: unpack source RPM
  12.307 +sub cmd_unpack ($@) {
  12.308 +    my ($gopts, @argv) = @_;
  12.309 +    my $rc = 0;
  12.310 +
  12.311 +    #   command line argument processing
  12.312 +    my $lopts = {};
  12.313 +    @argv = getopts("l:b:sd", $lopts, @argv);
  12.314 +    if ($lopts->{"l"} eq "") {
  12.315 +        $lopts->{"l"} = "structured";
  12.316 +    }
  12.317 +    if ($lopts->{"l"} !~ m/^(global|local|simple|structured|distributed)$/) {
  12.318 +        die sprintf("invalid layout type \"%s\"", $lopts->{"l"});
  12.319 +    }
  12.320 +    if (@argv != 1) {
  12.321 +        die sprintf("exactly one SRPM has to be given");
  12.322 +    }
  12.323 +    my $srpm = $argv[0];
  12.324 +    if (not -f $srpm) {
  12.325 +        die sprintf("SRPM \"%s\" has to be a regular file", $srpm);
  12.326 +    }
  12.327 +    my $name = `$openpkg_prefix/bin/openpkg rpm -qp --qf '\%{NAME}' $srpm 2>/dev/null || true`;
  12.328 +    $name =~ s/\r?\n$//s;
  12.329 +    if ($name eq '') {
  12.330 +        die sprintf("unable to determine package name from SRPM \"%s\"", $srpm);
  12.331 +    }
  12.332 +    if ($lopts->{"b"} eq "") {
  12.333 +        $lopts->{"b"} = $srpm;
  12.334 +        if ($lopts->{"b"} =~ m/\.src\.rpm$/) {
  12.335 +            $lopts->{"b"} =~ s/\.src\.rpm$//;
  12.336 +        }
  12.337 +        else {
  12.338 +            my $subdir = `$openpkg_prefix/bin/openpkg rpm -qp --qf '\%{NAME}-\%{VERSION}-\%{RELEASE}' $srpm 2>/dev/null || true`;
  12.339 +            $lopts->{"b"} = $subdir;
  12.340 +        }
  12.341 +    }
  12.342 +
  12.343 +    #   determine result directory
  12.344 +    my $basedir = $lopts->{"b"};
  12.345 +    my ($macrosfile, $specdir, $sourcedir);
  12.346 +    if ($lopts->{"l"} eq "global") {
  12.347 +        $macrosdir  = "$openpkg_prefix/etc/openpkg";
  12.348 +        $macrosfile = "$openpkg_prefix/etc/openpkg/rpmmacros";
  12.349 +        $specdir    = "$openpkg_prefix/RPM/SRC/$name";
  12.350 +        $sourcedir  = "$openpkg_prefix/RPM/SRC/$name";
  12.351 +        $builddir   = "$openpkg_prefix/RPM/TMP";
  12.352 +        $tmpdir     = "$openpkg_prefix/RPM/TMP";
  12.353 +        $binrpmdir  = "$openpkg_prefix/RPM/PKG";
  12.354 +        $srcrpmdir  = "$openpkg_prefix/RPM/PKG";
  12.355 +    }
  12.356 +    elsif ($lopts->{"l"} eq "local") {
  12.357 +        $macrosdir  = "$basedir/.openpkg";
  12.358 +        $macrosfile = "$basedir/.openpkg/rpmmacros";
  12.359 +        $specdir    = "$basedir";
  12.360 +        $sourcedir  = "$basedir";
  12.361 +        $builddir   = "$basedir";
  12.362 +        $tmpdir     = "$basedir";
  12.363 +        $binrpmdir  = "$basedir";
  12.364 +        $srcrpmdir  = "$basedir";
  12.365 +    }
  12.366 +    elsif ($lopts->{"l"} eq "simple") {
  12.367 +        $macrosdir  = "$basedir/.openpkg";
  12.368 +        $macrosfile = "$basedir/.openpkg/rpmmacros";
  12.369 +        $specdir    = "$basedir";
  12.370 +        $sourcedir  = "$basedir";
  12.371 +        $builddir   = "$tmpdir";
  12.372 +        $tmpdir     = "$tmpdir";
  12.373 +        $binrpmdir  = "$basedir/..";
  12.374 +        $srcrpmdir  = "$basedir/..";
  12.375 +    }
  12.376 +    elsif ($lopts->{"l"} eq "structured") {
  12.377 +        $macrosdir  = "$basedir/.openpkg";
  12.378 +        $macrosfile = "$basedir/.openpkg/rpmmacros";
  12.379 +        $specdir    = "$basedir/src";
  12.380 +        $sourcedir  = "$basedir/dst";
  12.381 +        $builddir   = "$basedir/tmp";
  12.382 +        $tmpdir     = "$basedir/tmp";
  12.383 +        $binrpmdir  = "$basedir/pkg/bin";
  12.384 +        $srcrpmdir  = "$basedir/pkg/src";
  12.385 +    }
  12.386 +    elsif ($lopts->{"l"} eq "distributed") {
  12.387 +        $macrosdir  = "$basedir/.openpkg";
  12.388 +        $macrosfile = "$basedir/.openpkg/rpmmacros";
  12.389 +        $specdir    = "$basedir/src/$name";
  12.390 +        $sourcedir  = "$basedir/dst/$name";
  12.391 +        $builddir   = "$basedir/tmp";
  12.392 +        $tmpdir     = "$basedir/tmp";
  12.393 +        $binrpmdir  = "$basedir/pkg/bin";
  12.394 +        $srcrpmdir  = "$basedir/pkg/src";
  12.395 +    }
  12.396 +
  12.397 +    #   create still missing directories
  12.398 +    foreach my $dir ($macrosdir, $specdir, $sourcedir, $builddir, $tmpdir, $binrpmdir, $srcrpmdir) {
  12.399 +        if (not -d $dir) {
  12.400 +            print STDOUT "openpkg:$prog_name: creating directory \"$dir\"\n";
  12.401 +            system("$openpkg_prefix/lib/openpkg/shtool mkdir -f -p -m 755 $dir");
  12.402 +        }
  12.403 +    }
  12.404 +
  12.405 +    #   unpack SRPM
  12.406 +    print STDOUT "openpkg:$prog_name: unpacking source: \"$srpm\"\n";
  12.407 +    print STDOUT "openpkg:$prog_name: unpacking target: \"$specdir\"\n";
  12.408 +    print STDOUT "openpkg:$prog_name: unpacking target: \"$sourcedir\"\n";
  12.409 +    my $abs_specdir = $specdir;
  12.410 +    my $abs_sourcedir = $sourcedir;
  12.411 +    my $pwd = `pwd`; $pwd =~ s/\r?\n$//s;
  12.412 +    $abs_specdir   = "$pwd/$abs_specdir"   if ($abs_specdir   !~ m/^\//);
  12.413 +    $abs_sourcedir = "$pwd/$abs_sourcedir" if ($abs_sourcedir !~ m/^\//);
  12.414 +    my $rc = system(
  12.415 +        "$openpkg_prefix/bin/openpkg" .
  12.416 +        " --keep-privileges" .
  12.417 +        " rpm" .
  12.418 +        " -i" .
  12.419 +        " --define '_specdir $abs_specdir'" .
  12.420 +        " --define '_sourcedir $abs_sourcedir'" .
  12.421 +        " $srpm"
  12.422 +    );
  12.423 +
  12.424 +    #   fix location of files
  12.425 +    if (not -f "$specdir/$name.spec") {
  12.426 +        die sprintf("failed to install package \"%s\": file \"%s\" not found\n", $srpm, "$specdir/$name.spec");
  12.427 +    }
  12.428 +    open(SPEC, "<$specdir/$name.spec");
  12.429 +    my $spec = ""; { local $/; $spec = <SPEC>; }
  12.430 +    close(SPEC);
  12.431 +    my $src = {};
  12.432 +    $spec =~ s/^(?:Source|Patch)\d+:\s+(\S+)/$src->{$1} = 1, ''/mgei;
  12.433 +    foreach my $file (keys %{$src}) {
  12.434 +        if ($file !~ m/^(https?|ftp):\/\//) {
  12.435 +            if (not -f "$specdir/$file" and -f "$sourcedir/$file") {
  12.436 +                system("mv $sourcedir/$file $specdir/$file");
  12.437 +            }
  12.438 +        }
  12.439 +    }
  12.440 +
  12.441 +    #   create .openpkg/rpmmacros file
  12.442 +    if (not -f $macrosfile) {
  12.443 +        print STDOUT "openpkg:$prog_name: creating file: \"$macrosfile\"\n";
  12.444 +        my $rpmmacros =
  12.445 +            "##\n" .
  12.446 +            "##  .openpkg/rpmmacros -- local OpenPKG RPM macro definitions\n" .
  12.447 +            "##\n" .
  12.448 +            "\n" .
  12.449 +            "\%openpkg_layout" .
  12.450 +            " macrosfile=\%{macrosfile}" .
  12.451 +            " layout=" . $lopts->{"l"} .
  12.452 +            " shared=" . ($lopts->{"s"} ? "yes" : "no") .
  12.453 +            " debug=" . ($lopts->{"d"} ? "yes" : "no") .
  12.454 +            "\n" .
  12.455 +            "\n";
  12.456 +        open(MACROS, ">$macrosfile");
  12.457 +        print(MACROS $rpmmacros);
  12.458 +        close(MACROS);
  12.459 +    }
  12.460 +
  12.461 +    return $rc;
  12.462 +}
  12.463 +
  12.464 +#   command: edit package specification
  12.465 +sub cmd_edit ($@) {
  12.466 +    my ($gopts, @argv) = @_;
  12.467 +    my $rc = 0;
  12.468 +
  12.469 +    #   run editor
  12.470 +    my $editor = ($ENV{"EDITOR"} || "vi");
  12.471 +    my $specfile = ($argv[0] || specfile());
  12.472 +    run("$editor $specfile");
  12.473 +
  12.474 +    return $rc;
  12.475 +}
  12.476 +
  12.477 +#   command: build package
  12.478 +sub cmd_build ($@) {
  12.479 +    my ($gopts, @argv) = @_;
  12.480 +    my $rc = 0;
  12.481 +
  12.482 +    #   command line argument processing
  12.483 +    my $lopts = {};
  12.484 +    @argv = getopts("s:D:w:", $lopts, @argv);
  12.485 +    if ($lopts->{"s"} eq '') {
  12.486 +        $lopts->{"s"} = "all";
  12.487 +    }
  12.488 +    if ($lopts->{"s"} !~ m/^(track|fetch|prep|compile|install|binary|source|all)$/) {
  12.489 +        die "invalid step";
  12.490 +    }
  12.491 +
  12.492 +    #   assembly defines
  12.493 +    my $defs = "";
  12.494 +    if ($lopts->{"D"}) {
  12.495 +        foreach my $def (split(/\s+/, $lopts->{"D"})) {
  12.496 +            if ($def =~ m/^([^=]+)=(.+)$/) {
  12.497 +                $defs .= "--define '$1 $2' ";
  12.498 +            }
  12.499 +            else {
  12.500 +                $defs .= "--define '$def yes' ";
  12.501 +            }
  12.502 +        }
  12.503 +    }
  12.504 +    if ($lopts->{"w"}) {
  12.505 +        foreach my $def (split(/\s+/, $lopts->{"w"})) {
  12.506 +            $defs .= "--with $def ";
  12.507 +        }
  12.508 +    }
  12.509 +
  12.510 +    #   run build command
  12.511 +    my $specfile = ($argv[0] || specfile());
  12.512 +    if ($lopts->{"s"} eq 'track') {
  12.513 +        run("$openpkg_prefix/bin/openpkg rpm -bt $defs$specfile");
  12.514 +    }
  12.515 +    elsif ($lopts->{"s"} eq 'fetch') {
  12.516 +        run("$openpkg_prefix/bin/openpkg rpm -bf $defs$specfile");
  12.517 +    }
  12.518 +    elsif ($lopts->{"s"} eq 'prep') {
  12.519 +        run("$openpkg_prefix/bin/openpkg rpm -bp $defs$specfile");
  12.520 +    }
  12.521 +    elsif ($lopts->{"s"} eq 'compile') {
  12.522 +        run("$openpkg_prefix/bin/openpkg rpm -bc --short-circuit $defs$specfile");
  12.523 +    }
  12.524 +    elsif ($lopts->{"s"} eq 'install') {
  12.525 +        run("$openpkg_prefix/bin/openpkg rpm -bi --short-circuit $defs$specfile");
  12.526 +    }
  12.527 +    elsif ($lopts->{"s"} eq 'binary') {
  12.528 +        run("$openpkg_prefix/bin/openpkg rpm -bb --short-circuit $defs$specfile");
  12.529 +    }
  12.530 +    elsif ($lopts->{"s"} eq 'source') {
  12.531 +        run("$openpkg_prefix/bin/openpkg rpm -bs $defs$specfile");
  12.532 +    }
  12.533 +    elsif ($lopts->{"s"} eq 'all') {
  12.534 +        run("$openpkg_prefix/bin/openpkg rpm -ba $defs$specfile");
  12.535 +    }
  12.536 +
  12.537 +    return $rc;
  12.538 +}
  12.539 +
  12.540 +#   command: peek into package
  12.541 +sub cmd_peek ($@) {
  12.542 +    my ($gopts, @argv) = @_;
  12.543 +    my $rc = 0;
  12.544 +
  12.545 +    #   run query command
  12.546 +    my $template = `$openpkg_prefix/bin/openpkg rpm --eval '%{_rpmdir}/%{_rpmfilename}'`;
  12.547 +    $template =~ s/\n$//s;
  12.548 +    my $specfile = specfile();
  12.549 +    my $rpm = `$openpkg_prefix/bin/openpkg rpm -q --specfile '$specfile' --qf 'XXX$template'`;
  12.550 +    $rpm =~ s/^XXX//s;
  12.551 +    $rpm =~ s/\n$//s;
  12.552 +
  12.553 +    #   determine files
  12.554 +    print STDOUT "\033[34m++ determining configuration files\033[0m\n";
  12.555 +    my @cfgfiles = split(/\n/, `$openpkg_prefix/bin/openpkg rpm -qplc $rpm`);
  12.556 +    print STDOUT "\033[34m++ determining documentation files\033[0m\n";
  12.557 +    my @docfiles = split(/\n/, `$openpkg_prefix/bin/openpkg rpm -qpld $rpm`);
  12.558 +    print STDOUT "\033[34m++ determining all file information\033[0m\n";
  12.559 +    my @allfiles = split(/\n/, `$openpkg_prefix/bin/openpkg rpm -qplv $rpm`);
  12.560 +
  12.561 +    #   create package file listing
  12.562 +    foreach my $line (@allfiles) {
  12.563 +        $prefix = "";
  12.564 +        foreach my $docfile (@docfiles) {
  12.565 +            if ($line =~ m/\s+$docfile\b/s) {
  12.566 +                $prefix .= "D";
  12.567 +                last;
  12.568 +            }
  12.569 +        }
  12.570 +        foreach my $cfgfile (@cfgfiles) {
  12.571 +            if ($line =~ m/\s+$cfgfile\b/s) {
  12.572 +                $prefix .= "C";
  12.573 +                last;
  12.574 +            }
  12.575 +        }
  12.576 +        $prefix .= "--";
  12.577 +        $prefix = substr($prefix, 0, 2);
  12.578 +        if ($line =~ m/^d/) {
  12.579 +            $line =~ s/(\s+\/\S+)/\033[34m$1\033[0m/s;
  12.580 +        }
  12.581 +        print "$prefix $line\n";
  12.582 +    }
  12.583 +
  12.584 +    return $rc;
  12.585 +}
  12.586 +
  12.587 +#   command: show modifications via VCS
  12.588 +sub cmd_diff ($@) {
  12.589 +    my ($gopts, @argv) = @_;
  12.590 +    my $rc = 0;
  12.591 +
  12.592 +    my $vcs = "";
  12.593 +    my $cmd = "";
  12.594 +    if (-d "CVS") {
  12.595 +        $vcs = "CVS";
  12.596 +        $cmd = "cvs diff -u3";
  12.597 +    }
  12.598 +    elsif (-d ".svn") {
  12.599 +        $vcs = "Subversion";
  12.600 +        $cmd = "svn diff";
  12.601 +    }
  12.602 +    elsif (-d "_MTN"          or -d ".mtn" or
  12.603 +           -d "../_MTN"       or -d "../.mtn" or
  12.604 +           -d "../../_MTN"    or -d "../../.mtn" or
  12.605 +           -d "../../../_MTN" or -d "../../../.mtn") {
  12.606 +        $vcs = "Monotone";
  12.607 +        $cmd = "mtn diff .";
  12.608 +    }
  12.609 +    elsif (-d ".git" or
  12.610 +           -d "../.git" or
  12.611 +           -d "../../.git" or
  12.612 +           -d "../../../.git") {
  12.613 +        $vcs = "Git";
  12.614 +        $cmd = "git diff . ";
  12.615 +    }
  12.616 +    elsif (-d ".hg" or
  12.617 +           -d "../.hg" or
  12.618 +           -d "../../.hg" or
  12.619 +           -d "../../../.hg") {
  12.620 +        $vcs = "Mercurial";
  12.621 +        $cmd = "hg diff ."
  12.622 +    }
  12.623 +    else {
  12.624 +        $vcs = "OSSP svs";
  12.625 +        $cmd = "svs diff";
  12.626 +    }
  12.627 +    print STDOUT "\033[34m++ modifications as known to underlying $vcs VCS\033[0m\n";
  12.628 +    run($cmd);
  12.629 +}
  12.630 +
  12.631 +#   command: install package
  12.632 +sub cmd_install ($@) {
  12.633 +    my ($gopts, @argv) = @_;
  12.634 +    my $rc = 0;
  12.635 +
  12.636 +    #   command line argument processing
  12.637 +    my $lopts = {};
  12.638 +    @argv = getopts("fnos", $lopts, @argv);
  12.639 +
  12.640 +    #   run install command
  12.641 +    my $template = `$openpkg_prefix/bin/openpkg rpm --eval '%{_rpmdir}/%{_rpmfilename}'`;
  12.642 +    $template =~ s/\n$//s;
  12.643 +    my $specfile = specfile();
  12.644 +    my $rpm = `$openpkg_prefix/bin/openpkg rpm -q --specfile '$specfile' --qf 'XXX$template'`;
  12.645 +    $rpm =~ s/^XXX//s;
  12.646 +    $rpm =~ s/\n$//s;
  12.647 +    chdir("/");
  12.648 +    run(($lopts->{"s"} ? "sudo " : "") .
  12.649 +        "$openpkg_prefix/bin/openpkg rpm -Uvh"
  12.650 +        . ($lopts->{"f"} ? " --force" : "")
  12.651 +        . ($lopts->{"n"} ? " --nodeps" : "")
  12.652 +        . ($lopts->{"o"} ? " --oldpackage" : "")
  12.653 +        . " $rpm");
  12.654 +
  12.655 +    return $rc;
  12.656 +}
  12.657 +
  12.658 +#   command: erase package
  12.659 +sub cmd_erase ($@) {
  12.660 +    my ($gopts, @argv) = @_;
  12.661 +    my $rc = 0;
  12.662 +
  12.663 +    #   command line argument processing
  12.664 +    my $lopts = {};
  12.665 +    @argv = getopts("fnas", $lopts, @argv);
  12.666 +
  12.667 +    #   run erase command
  12.668 +    my $specfile = specfile();
  12.669 +    my $name = `$openpkg_prefix/bin/openpkg rpm -q --specfile $specfile --qf '%{NAME}'`;
  12.670 +    $name =~ s/\n$//s;
  12.671 +    chdir("/");
  12.672 +    run(($lopts->{"s"} ? "sudo " : "") .
  12.673 +        "$openpkg_prefix/bin/openpkg rpm -e"
  12.674 +        . ($lopts->{"f"} ? " --force" : "")
  12.675 +        . ($lopts->{"n"} ? " --nodeps" : "")
  12.676 +        . ($lopts->{"a"} ? " --allmatches" : "")
  12.677 +        . " $name");
  12.678 +
  12.679 +    return $rc;
  12.680 +}
  12.681 +
  12.682 +#   command: lint package
  12.683 +sub cmd_lint ($@) {
  12.684 +    my ($gopts, @argv) = @_;
  12.685 +    my $rc = 0;
  12.686 +
  12.687 +    #   command line argument processing
  12.688 +    my $lopts = {};
  12.689 +    @argv = getopts("vb", $lopts, @argv);
  12.690 +
  12.691 +    #   run source linting commands
  12.692 +    my $specfile = specfile();
  12.693 +    my $fslfile = $specfile;
  12.694 +    $fslfile =~ s/([^\/]+)\.spec$/fsl.$1/s;
  12.695 +    my $rcfile = $specfile;
  12.696 +    $rcfile =~ s/([^\/]+)\.spec$/rc.$1/s;
  12.697 +    my $name = `$openpkg_prefix/bin/openpkg rpm -q --specfile $specfile --qf '%{NAME}'`;
  12.698 +    $name =~ s/\n$//s;
  12.699 +    my $template = `$openpkg_prefix/bin/openpkg rpm --eval '%{_rpmdir}/%{_rpmfilename}'`;
  12.700 +    $template =~ s/\n$//s;
  12.701 +    my $rpm = `$openpkg_prefix/bin/openpkg rpm -q --specfile '$specfile' --qf 'XXX$template'`;
  12.702 +    $rpm =~ s/^XXX//s;
  12.703 +    $rpm =~ s/\n$//s;
  12.704 +    my $rc = 0;
  12.705 +    $rc += run("$openpkg_prefix/bin/openpkg lint-spec" . ($lopts->{"v"} ? " --verbose" : "") . " $specfile");
  12.706 +    $rc += run("$openpkg_prefix/bin/openpkg lint-fsl"  . ($lopts->{"v"} ? " --verbose" : "") . " $fslfile") if (-f $fslfile);
  12.707 +    $rc += run("$openpkg_prefix/bin/openpkg lint-rc"   . ($lopts->{"v"} ? " --verbose" : "") . " $rcfile")  if (-f $rcfile);
  12.708 +
  12.709 +    #   optionally run binary linting command
  12.710 +    run("$openpkg_prefix/bin/openpkg lint-rpm" . ($lopts->{"v"} ? " --verbose" : "") . " $rpm") if (-f $rpm and not $lopts->{"b"});
  12.711 +
  12.712 +    return $rc;
  12.713 +}
  12.714 +
  12.715 +#   command: release package
  12.716 +sub cmd_release ($@) {
  12.717 +    my ($gopts, @argv) = @_;
  12.718 +    my $rc = 0;
  12.719 +
  12.720 +    #   command line argument processing
  12.721 +    my $lopts = {};
  12.722 +    @argv = getopts("nm:f", $lopts, @argv);
  12.723 +
  12.724 +    #   implicit linting
  12.725 +    if (not $lopts->{"f"}) {
  12.726 +        my $rc = cmd_lint($gopts);
  12.727 +        if ($rc != 0 and !$lopts->{"f"}) {
  12.728 +            return $rc;
  12.729 +        }
  12.730 +    }
  12.731 +
  12.732 +    #   sanity check environment
  12.733 +    my $cmd = $ENV{"OPENPKG_DEV_RELEASE"}
  12.734 +        || `$openpkg_prefix/bin/openpkg rpm --eval '%{openpkg_dev_release}' 2>/dev/null || true` || "";
  12.735 +    $cmd =~ s/\n$//s;
  12.736 +    if ($cmd eq "") {
  12.737 +        print STDERR "openpkg:$prog_name:ERROR: no \$OPENPKG_DEV_RELEASE command defined\n";
  12.738 +        exit(1);
  12.739 +    }
  12.740 +
  12.741 +    #
  12.742 +    #   determine package information
  12.743 +    #
  12.744 +
  12.745 +    print STDOUT "\033[34m++ determining package information\033[0m\n";
  12.746 +    my $info = {};
  12.747 +    $info->{"openpkg-prefix"} = $openpkg_prefix;
  12.748 +    $info->{"option-force"} = $lopts->{"f"} ? "yes" : "no";
  12.749 +
  12.750 +    print STDOUT "-- determining package name/version/release\n";
  12.751 +    my $specfile = specfile();
  12.752 +    my $result = `$openpkg_prefix/bin/openpkg rpm -q --specfile $specfile --qf '::%{NAME}::%{VERSION}::%{RELEASE}'`;
  12.753 +    $result =~ s/\n$//s;
  12.754 +    $result =~ s/^:://s;
  12.755 +    my @result = split(/::/, $result);
  12.756 +    $info->{"package-name"}    = $result[0];
  12.757 +    $info->{"package-version"} = $result[1];
  12.758 +    $info->{"package-release"} = $result[2];
  12.759 +
  12.760 +    print STDOUT "-- determining package source and distribution location\n";
  12.761 +    my $defines = "--define '\%name " . $info->{"package-name"} . "'";
  12.762 +    $defines .= " --define '\%version " . $info->{"package-version"} . "'";
  12.763 +    $defines .= " --define '\%release " . $info->{"package-release"} . "'";
  12.764 +    my $result = `$openpkg_prefix/bin/openpkg rpm $defines --eval '%{_specdir}::%{_sourcedir}'`;
  12.765 +    $result =~ s/\n$//s;
  12.766 +    @result = split(/::/, $result);
  12.767 +    $info->{"spec-dir"}   = $result[0];
  12.768 +    $info->{"source-dir"} = $result[1];
  12.769 +
  12.770 +    print STDOUT "-- determining package source and binary RPM files\n";
  12.771 +    my $template = `$openpkg_prefix/bin/openpkg rpm --eval '%{_rpmdir}/%{l_binrpmfilename}::%{_srcrpmdir}/%{l_srcrpmfilename}'`;
  12.772 +    $template =~ s/\n$//s;
  12.773 +    $result = `$openpkg_prefix/bin/openpkg rpm -q --specfile $specfile --qf '::$template'`;
  12.774 +    $result =~ s/\n$//s;
  12.775 +    $result =~ s/^:://s;
  12.776 +    @result = split(/::/, $result);
  12.777 +    $info->{"binary-rpm-file"} = $result[0];
  12.778 +    $info->{"source-rpm-file"} = $result[1];
  12.779 +    $info->{"package-version-old"} = "";
  12.780 +    $info->{"package-release-old"} = "";
  12.781 +    $info->{"vcs"} = "none";
  12.782 +
  12.783 +    print STDOUT "-- determining previous package version/release\n";
  12.784 +    my $vcs = "";
  12.785 +    my $diff = "";
  12.786 +    my $content_old = "";
  12.787 +    my $specdir  = $info->{"spec-dir"};
  12.788 +    my $specfile = $info->{"package-name"} . ".spec";
  12.789 +    if (-f "$specdir/$specfile") {
  12.790 +        open(FP, "<$specdir/$specfile");
  12.791 +        $content_new .= $_ while (<FP>);
  12.792 +        close(FP);
  12.793 +        if ($content_new =~ m/\n\%No(?:Source|Patch)\s+/s) {
  12.794 +            $info->{"source-rpm-file"} =~ s/\.src\.rpm$/.nosrc.rpm/s;
  12.795 +        }
  12.796 +        if (-d "$specdir/CVS") {
  12.797 +            #   package is version controlled via CVS
  12.798 +            $vcs = "cvs";
  12.799 +            $diff = `(cd $specdir && cvs diff -u3 $specfile) 2>/dev/null || true`;
  12.800 +        }
  12.801 +        elsif (-d "$specdir/.svn") {
  12.802 +            #   package is version controlled via Subverson (SVN)
  12.803 +            $vcs = "svn";
  12.804 +            $diff = `(cd $specdir && svn diff $specfile) 2>/dev/null || true`;
  12.805 +        }
  12.806 +        elsif (-d "$specdir/_MTN"          or -d "$specdir/.mtn" or
  12.807 +               -d "$specdir/../_MTN"       or -d "$specdir/../.mtn" or
  12.808 +               -d "$specdir/../../_MTN"    or -d "$specdir/../../.mtn" or
  12.809 +               -d "$specdir/../../../_MTN" or -d "$specdir/../../../.mtn") {
  12.810 +            #   package is version controlled via Monotone (MTN)
  12.811 +            $vcs = "mtn";
  12.812 +            $diff = `(cd $specdir && mtn diff $specfile) 2>/dev/null || true`;
  12.813 +            $content_old = `(cd $specdir && mtn automate get_file_of -r h: $specfile) 2>/dev/null || true`;
  12.814 +        }
  12.815 +        elsif (-d "$specdir/.git" or
  12.816 +               -d "$specdir/../.git" or
  12.817 +               -d "$specdir/../../.git" or
  12.818 +               -d "$specdir/../../../.git") {
  12.819 +            #   package is version controlled via Git
  12.820 +            $vcs = "git";
  12.821 +            $diff = `(cd $specdir && git diff $specfile) 2>/dev/null || true`;
  12.822 +        }
  12.823 +        elsif (-d "$specdir/.hg" or
  12.824 +               -d "$specdir/../.hg" or
  12.825 +               -d "$specdir/../../.hg" or
  12.826 +               -d "$specdir/../../../.hg") {
  12.827 +            #   package is version controlled via Mercurial (Hg)
  12.828 +            $vcs = "hg";
  12.829 +            $diff = `(cd $specdir && hg diff $specfile) 2>/dev/null || true`;
  12.830 +        }
  12.831 +        elsif (-f "$specdir/$specfile.orig") {
  12.832 +            #   package is patched via OSSP svs
  12.833 +            $vcs = "svs";
  12.834 +            $diff = `(cd $specdir && svs diff $specfile) 2>/dev/null || true`;
  12.835 +        }
  12.836 +        if ($vcs ne '') {
  12.837 +            $info->{"vcs"} = $vcs;
  12.838 +        }
  12.839 +        if ($content_old ne '') {
  12.840 +            my $define = {};
  12.841 +            $content_old =~ s/\n\%define[ \t]+([^ \t\n]+)[ \t]+([^ \t\n]+)/$define->{$1} = $2, ''/sge;
  12.842 +            $content_old =~ s/\n([^ \t\n]+):[ \t]+([^ \t\n]+)/$define->{lc($1)} = $2, ''/sge;
  12.843 +            sub resolve {
  12.844 +                my ($define, $name) = @_;
  12.845 +                my $value = $define->{$name};
  12.846 +                $value = "" if (not defined $value);
  12.847 +                $value =~ s/\%\{(.+?)\}/resolve($define, $1)/sge;
  12.848 +                return $value;
  12.849 +            }
  12.850 +            $info->{"package-version-old"} = resolve($define, "version");
  12.851 +            $info->{"package-release-old"} = resolve($define, "release");
  12.852 +        }
  12.853 +        if ((   $info->{"package-version-old"} eq ''
  12.854 +             or $info->{"package-release-old"} eq '')
  12.855 +            and $diff ne ''                          ) {
  12.856 +            if ($info->{"package-version-old"} eq '' and $diff =~ m/\n-Version:\s+(\S+)/s) {
  12.857 +                $info->{"package-version-old"} = $1;
  12.858 +            }
  12.859 +            if ($info->{"package-release-old"} eq '' and $diff =~ m/\n-Release:\s+(\S+)/s) {
  12.860 +                $info->{"package-release-old"} = $1;
  12.861 +            }
  12.862 +        }
  12.863 +    }
  12.864 +
  12.865 +    print STDOUT "-- determining commit message\n";
  12.866 +    $info->{"commit-message"} = ($lopts->{"m"} || "");
  12.867 +    if ($info->{"commit-message"} eq "") {
  12.868 +        if ($info->{"package-version-old"} ne $info->{"package-version"}) {
  12.869 +            #   new version
  12.870 +            $info->{"commit-message"} = "upgrading package: " .
  12.871 +                $info->{"package-name"} . " " .
  12.872 +                $info->{"package-version-old"} . " -> " .
  12.873 +                $info->{"package-version"};
  12.874 +        }
  12.875 +        elsif (!$lopts->{"f"}) {
  12.876 +            print STDERR "openpkg:$prog_name:ERROR: package version not changed -- you have to manually provide a commit message\n";
  12.877 +            exit(1);
  12.878 +        }
  12.879 +    }
  12.880 +
  12.881 +    #   run external command
  12.882 +    print STDOUT "\033[34m++ executing openpkg development release program\033[0m\n";
  12.883 +    $cmd .= " %{openpkg-prefix}";
  12.884 +    $cmd .= " %{spec-dir} %{source-dir} %{binary-rpm-file} %{source-rpm-file}";
  12.885 +    $cmd .= " %{package-name} %{package-version} %{package-release} %{package-version-old} %{package-release-old}";
  12.886 +    $cmd .= " %{commit-message} %{vcs}";
  12.887 +    $cmd .= " %{option-force}";
  12.888 +    $cmd =~ s/(\%\{([a-z][a-z-]+)\})/&subst($info, $1, $2)/sge;
  12.889 +    sub subst {
  12.890 +        my ($info, $text, $name) = @_;
  12.891 +        if (exists($info->{$name})) {
  12.892 +            $text = $info->{$name};
  12.893 +            $text =~ s/'/\\'/sg;
  12.894 +            $text = "'$text'";
  12.895 +        }
  12.896 +    }
  12.897 +    if ($lopts->{"n"}) {
  12.898 +        print STDOUT "-- DRY RUN:\n";
  12.899 +        print STDOUT "-- $cmd\n";
  12.900 +        $rc = 0;
  12.901 +    }
  12.902 +    else {
  12.903 +        $rc = system($cmd);
  12.904 +    }
  12.905 +
  12.906 +    return $rc;
  12.907 +}
  12.908 +
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/openpkg/dev.pod	Tue Jul 31 12:23:42 2012 +0200
    13.3 @@ -0,0 +1,543 @@
    13.4 +##
    13.5 +##  openpkg dev -- OpenPKG Package Development Tool
    13.6 +##  Copyright (c) 2008-2012 OpenPKG GmbH <http://openpkg.com/>
    13.7 +##
    13.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    13.9 +##  All rights reserved. Licenses which grant limited permission to use,
   13.10 +##  copy, modify and distribute this software are available from the
   13.11 +##  OpenPKG GmbH.
   13.12 +##
   13.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   13.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   13.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   13.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   13.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   13.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   13.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   13.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   13.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   13.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   13.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   13.24 +##  SUCH DAMAGE.
   13.25 +##
   13.26 +
   13.27 +=pod
   13.28 +
   13.29 +B<openpkg dev> - OpenPKG Package Development Tool
   13.30 +
   13.31 +=head1 DESCRIPTION
   13.32 +
   13.33 +B<openpkg dev> is a package development tool for B<OpenPKG>.
   13.34 +
   13.35 +=head2 SOURCE PACKAGE HANDLING
   13.36 +
   13.37 +=over 4
   13.38 +
   13.39 +=item B<openpkg dev unpack>
   13.40 +[C<-l> I<layout>]
   13.41 +[C<-b> I<basedir>]
   13.42 +[C<-s>]
   13.43 +[C<-d>]
   13.44 +I<name>C<->I<version>C<->I<release>C<.src.rpm>
   13.45 +
   13.46 +Unpacks an OpenPKG source RPM package
   13.47 +I<name>C<->I<version>C<->I<release>C<.src.rpm> into I<basedir>
   13.48 +(default is I<name>C<->I<version>C<->I<release>)
   13.49 +using I<layout> (default is I<structured>).
   13.50 +Additionally,
   13.51 +I<file-rpmmacros>
   13.52 +configuration file is generated where
   13.53 +C<-s> enables shared mode and
   13.54 +C<-d> enables debug mode, see I<file-rpmmacros>.
   13.55 +
   13.56 +=back
   13.57 +
   13.58 +=head2 SOURCE PACKAGE DEVELOPMENT
   13.59 +
   13.60 +=over 4
   13.61 +
   13.62 +=item B<openpkg dev shell>
   13.63 +
   13.64 +This is a convenience command which enters an interactive B<GNU Bash>
   13.65 +shell which provides the following work environment:
   13.66 +
   13.67 +=over 4
   13.68 +
   13.69 +=item B<Environment Variables:>
   13.70 +
   13.71 + OPENPKG_PREFIX "<prefix>"
   13.72 + PS1            "\\[\\e[31;1m\\]\\u\\[\\e[0m\\]@\\h:\\w [OPENPKG_PREFIX=$OPENPKG_PREFIX]\n\\\$ "
   13.73 + T              %{_tmppath}
   13.74 + S              %{_specdir}
   13.75 + D              %{_sourcedir}
   13.76 +
   13.77 +=item B<Command-Line Aliases:>
   13.78 +
   13.79 + openpkg        "${OPENPKG_PREFIX}/bin/openpkg"
   13.80 + opd            "${OPENPKG_PREFIX}/bin/openpkg dev"
   13.81 +
   13.82 +=item B<Command-Line Keystrokes:>
   13.83 +
   13.84 + ESC+x          "opd unpack\n"
   13.85 + ESC+v          "opd edit\n"
   13.86 + ESC+t          "opd build -s track\n"
   13.87 + ESC+f          "opd build -s fetch\n"
   13.88 + ESC+b          "opd build\n"
   13.89 + ESC+1          "opd build -s prep\n"
   13.90 + ESC+2          "opd build -s compile\n"
   13.91 + ESC+3          "opd build -s install\n"
   13.92 + ESC+4          "opd build -s binary\n"
   13.93 + ESC+s          "opd build -s source\n"
   13.94 + ESC+p          "opd peek\n"
   13.95 + ESC+d          "opd diff\n"
   13.96 + ESC+i          "opd install\n"
   13.97 + ESC+e          "opd erase\n"
   13.98 + ESC+l          "opd lint\n"
   13.99 + ESC+r          "opd release\n"
  13.100 +
  13.101 +=back
  13.102 +
  13.103 +If option C<-s> is passed to B<openpkg dev shell> and screen(1) is
  13.104 +available in C<$PATH>, the interactive development shell is started up
  13.105 +in a convenient virtual screen environment.
  13.106 +
  13.107 +=item B<openpkg dev edit>
  13.108 +
  13.109 +Load spec file into editor.
  13.110 +
  13.111 +=over 4
  13.112 +
  13.113 +=item B<Environment Variables:>
  13.114 +
  13.115 + EDITOR "vi"
  13.116 +
  13.117 +=back
  13.118 +
  13.119 +=item B<openpkg dev build>
  13.120 +[C<-s> I<step>]
  13.121 +[C<-D> I<define>[=I<value>]]
  13.122 +[C<-w> I<variant>]
  13.123 +
  13.124 +Builds package steps. Default I<step> is C<all>. Option C<-D> translated
  13.125 +into "C<--define 'I<define> I<value>'>" while option C<-w> translated
  13.126 +into "C<--with> I<variant>". The I<step> arguments translate into the
  13.127 +following RPM options:
  13.128 +
  13.129 +  track:   -bt
  13.130 +  fetch:   -bf
  13.131 +  prep:    -bp
  13.132 +  compile: -bc --short-circuit
  13.133 +  install: -bi --short-circuit
  13.134 +  binary:  -bb --short-circuit
  13.135 +  source:  -bs
  13.136 +  all:     -ba
  13.137 +
  13.138 +=item B<openpkg dev peek>
  13.139 +
  13.140 +Peeks file list from package and tags configuration and documentation files.
  13.141 +
  13.142 +=item B<openpkg dev diff>
  13.143 +
  13.144 +Shows modifications with the help of a possibly underlying Version
  13.145 +Control System (VCS) like CVS, Subversion, Monotone, Git, Mercurial or
  13.146 +(as a fallback ) OSSP svs.
  13.147 +
  13.148 +=item B<openpkg dev install>
  13.149 +[C<-f>]
  13.150 +[C<-o>]
  13.151 +[C<-n>]
  13.152 +[C<-s>]
  13.153 +
  13.154 +Installs package.
  13.155 +Option
  13.156 +C<-f> adds C<--force>,
  13.157 +C<-n> adds C<--nodeps> and
  13.158 +C<-o> adds C<--oldpackage>
  13.159 +to the underlying C<rpm> call.
  13.160 +Option C<-s> prefixes the command with sudo(1).
  13.161 +
  13.162 +=item B<openpkg dev erase>
  13.163 +[C<-f>]
  13.164 +[C<-o>]
  13.165 +[C<-a>]
  13.166 +[C<-s>]
  13.167 +
  13.168 +Erases package.
  13.169 +Option
  13.170 +C<-f> adds C<--force>,
  13.171 +C<-n> adds C<--nodeps> and
  13.172 +C<-a> adds C<--allmatches>
  13.173 +to the underlying C<rpm> call.
  13.174 +Option C<-s> prefixes the command with sudo(1).
  13.175 +
  13.176 +=item B<openpkg dev lint>
  13.177 +[C<-v>]
  13.178 +[C<-b>]
  13.179 +
  13.180 +Lints package sources C<*.spec>, C<fsl.*>, C<rc.*> and binary package files.
  13.181 +Option C<-v> enables verboseness.
  13.182 +Option C<-b> disables the linting of an existing binary package file.
  13.183 +
  13.184 +=item B<openpkg dev release>
  13.185 +[C<-m> I<message>]
  13.186 +[C<-n>]
  13.187 +
  13.188 +Releases package specification to the repository. Unlike previous
  13.189 +incarnations of "openpkg dev" this one is not tied to any repository or
  13.190 +structure. The default message is created using the difference between
  13.191 +the previous and current version of the package specification. In order
  13.192 +to grab the previous version, the working directory and three levels
  13.193 +towards root are checked for signs of CVS, Subversion, Monotone, Git,
  13.194 +Mercurial or SVS information, in that order. The appropriate command is
  13.195 +then executed to retrieve the data and the VCS found is passed to the
  13.196 +actual release command.
  13.197 +
  13.198 +Finally, the command specified by the environment variable
  13.199 +C<OPENPKG_DEV_RELEASE> or, if omitted, specified by the rpm macro
  13.200 +C<%{openpkg_dev_release}> is run and passed the following positional
  13.201 +arguments:
  13.202 +
  13.203 +=over 4
  13.204 +
  13.205 +	openpkg-prefix
  13.206 +	spec-dir
  13.207 +	source-dir
  13.208 +	binary-rpm-file
  13.209 +	source-rpm-file
  13.210 +	package-name
  13.211 +	package-version
  13.212 +	package-release
  13.213 +	package-version-old
  13.214 +	package-release-old
  13.215 +	commit-message
  13.216 +	vcs
  13.217 +
  13.218 +=back
  13.219 +
  13.220 +For a dry run, set C<$OPENPKG_DEV_RELEASE> to "echo" or use option "C<-n>".
  13.221 +
  13.222 +=back
  13.223 +
  13.224 +=head1 UNPACKED SOURCE RPM PACKAGE FILESYSTEM LAYOUT
  13.225 +
  13.226 +When an OpenPKG source RPM package
  13.227 +I<name>C<->I<version>C<->I<release>C<.src.rpm> is unpacked to the
  13.228 +filesystem, the following distinct filesystem layouts are known:
  13.229 +
  13.230 +=over 4
  13.231 +
  13.232 +=item B<global>
  13.233 +
  13.234 +=over 4
  13.235 +
  13.236 +=item I<prefix>C</RPM/SRC/>I<name>C</.openpkg/rpmmacros>
  13.237 +
  13.238 +=item I<prefix>C</RPM/SRC/>I<name>C</>I<name>C<.spec>
  13.239 +
  13.240 +=item I<prefix>C</RPM/SRC/>I<name>C</>I<packaging-source-file>
  13.241 +
  13.242 +=item I<prefix>C</RPM/SRC/>I<name>C</>I<thirdparty-distribution-file>
  13.243 +
  13.244 +=item I<prefix>C</RPM/PKG/>I<binary-rpm-package-file>
  13.245 +
  13.246 +=item I<prefix>C</RPM/PKG/>I<source-rpm-package-file>
  13.247 +
  13.248 +=item I<prefix>C</RPM/TMP/>I<temporary-file>
  13.249 +
  13.250 +=back
  13.251 +
  13.252 +This is just the "simple" filesystem layout (see below) with the
  13.253 +I<base-dir> set to I<prefix>C</RPM/SRC/>.
  13.254 +
  13.255 +This is the filesystem layout used by default for building OpenPKG
  13.256 +packages during C<openpkg build> or the underlying C<openpkg rpm
  13.257 +--rebuild> commands.
  13.258 +
  13.259 +=item B<local>
  13.260 +
  13.261 +=over 4
  13.262 +
  13.263 +=item I<base-dir>C</.openpkg/rpmmacros>
  13.264 +
  13.265 +=item I<base-dir>C</>I<name>C<.spec>
  13.266 +
  13.267 +=item I<base-dir>C</>I<packaging-source-file>
  13.268 +
  13.269 +=item I<base-dir>C</>I<thirdparty-distribution-file>
  13.270 +
  13.271 +=item I<base-dir>C</>I<binary-rpm-package-file>
  13.272 +
  13.273 +=item I<base-dir>C</>I<source-rpm-package-file>
  13.274 +
  13.275 +=item I<base-dir>C</>I<temporary-file>
  13.276 +
  13.277 +=back
  13.278 +
  13.279 +This puts everything into one directory.
  13.280 +
  13.281 +=item B<simple>
  13.282 +
  13.283 +=over 4
  13.284 +
  13.285 +=item I<base-dir>C</>I<name>C</.openpkg/rpmmacros>
  13.286 +
  13.287 +=item I<base-dir>C</>I<name>C</>I<name>C<.spec>
  13.288 +
  13.289 +=item I<base-dir>C</>I<name>C</>I<packaging-source-file>
  13.290 +
  13.291 +=item I<base-dir>C</>I<name>C</>I<thirdparty-distribution-file>
  13.292 +
  13.293 +=item I<base-dir>C</>I<binary-rpm-package-file>
  13.294 +
  13.295 +=item I<base-dir>C</>I<source-rpm-package-file>
  13.296 +
  13.297 +=item I<$TMPDIR>C</openpkg/>I<temporary-file>
  13.298 +
  13.299 +=back
  13.300 +
  13.301 +This is the simple filesystem layout of an unpacked
  13.302 +OpenPKG package. All files are simply put into a sub-directory with the
  13.303 +I<name> of the package.
  13.304 +
  13.305 +This is the filesystem layout used for the quick patching of a single
  13.306 +OpenPKG package in a stand-alone environment.
  13.307 +
  13.308 +=item B<structured>
  13.309 +
  13.310 +=over 4
  13.311 +
  13.312 +=item I<base-dir>C</>I<name>C</.openpkg/rpmmacros>
  13.313 +
  13.314 +=item I<base-dir>C</>I<name>C</src/>I<name>C<.spec>
  13.315 +
  13.316 +=item I<base-dir>C</>I<name>C</src/>I<packaging-source-file>
  13.317 +
  13.318 +=item I<base-dir>C</>I<name>C</dst/>I<thirdparty-distribution-file>
  13.319 +
  13.320 +=item I<base-dir>C</>I<name>C</pkg/>[C<bin/>]I<binary-rpm-package-file>
  13.321 +
  13.322 +=item I<base-dir>C</>I<name>C</pkg/>[C<src/>]I<source-rpm-package-file>
  13.323 +
  13.324 +=item I<base-dir>C</>I<name>C</tmp/>I<temporary-file>
  13.325 +
  13.326 +=back
  13.327 +
  13.328 +This is the structured (and default) filesystem layout of an unpacked
  13.329 +OpenPKG package. A top-level sub-directory with the I<name> of the
  13.330 +package is created. There the package specification and all packaging
  13.331 +source files are put into the sub-directory I<src> and all the
  13.332 +third-party distribution files are put into the sub-directory I<dst>.
  13.333 +
  13.334 +This is the filesystem layout used for the development of a single
  13.335 +OpenPKG package in a stand-alone environment.
  13.336 +
  13.337 +=item B<distributed>
  13.338 +
  13.339 +=over 4
  13.340 +
  13.341 +=item I<base-dir>C</>C<.openpkg/rpmmacros>
  13.342 +
  13.343 +=item I<base-dir>C</>C<src/>I<name>C</>I<name>C<.spec>
  13.344 +
  13.345 +=item I<base-dir>C</>C<src/>I<name>C</>I<packaging-source-file>
  13.346 +
  13.347 +=item I<base-dir>C</>C<dst/>I<name>C</>I<thirdparty-distribution-file>
  13.348 +
  13.349 +=item I<base-dir>C</>C<pkg/>[C<bin/>]I<binary-rpm-package-file>
  13.350 +
  13.351 +=item I<base-dir>C</>C<pkg/>[C<src/>]I<source-rpm-package-file>
  13.352 +
  13.353 +=item I<base-dir>C</>C<tmp/>I<temporary-file>
  13.354 +
  13.355 +=back
  13.356 +
  13.357 +This is the distributed filesystem layout of an unpacked OpenPKG
  13.358 +package. It is similar to the structured filesystem layout but the
  13.359 +C<src> and C<dst> directories and the I<name> directory are swapped,
  13.360 +mainly with the intention of bundling together all third-party
  13.361 +distribution files of a large number of packages.
  13.362 +
  13.363 +This is the filesystem layout used for regular OpenPKG package
  13.364 +development.
  13.365 +
  13.366 +=back
  13.367 +
  13.368 +
  13.369 +=head1 LOCAL RPM MACROS FILE (.openpkg/rpmmacros)
  13.370 +
  13.371 +OpenPKG supports local RPM macros files F<.openpkg/rpmmacros> which
  13.372 +can be used to configure RPM in a local scope. This is especially
  13.373 +interesting to configure a local (even per-package) build environment
  13.374 +with the help of the C<%openpkg_layout> macro.
  13.375 +
  13.376 +C<%openpkg_layout>
  13.377 +[C<macrosfile=>I<filename>]
  13.378 +[C<basedir=>I<directory>]
  13.379 +[C<specdir=>I<directory>]
  13.380 +[C<sourcedir=>I<directory>]
  13.381 +[C<builddir=>I<directory>]
  13.382 +[C<tmpdir=>I<directory>]
  13.383 +[C<binrpmdir=>I<directory>]
  13.384 +[C<srcrpmdir=>I<directory>]
  13.385 +[C<shared=>I<yes-or-no>]
  13.386 +[C<debug=>I<yes-or-no>]
  13.387 +
  13.388 +=over 4
  13.389 +
  13.390 +=item C<macrosfile=>I<filename>
  13.391 +
  13.392 +Absolute file path of the C<.openpkg/rpmmacros> file where this
  13.393 +C<%openpkg_layout> macro is defined. Usually, the intended usage is to
  13.394 +leverage from OpenPKG RPM's special C<%{macrosfile}> macro by simply
  13.395 +using C<macrosfile=%{macrosfile}>. This parameter is important as
  13.396 +the default C<basename> is derived from it.
  13.397 +
  13.398 +=item C<basedir=>I<directory>
  13.399 +
  13.400 +Absolute directory path where the C<.openpkg/rpmmacros> file is
  13.401 +located under. Usually, the intended usage is to not explicitly
  13.402 +set this parameter but let it be determined indirectly via
  13.403 +C<macrosfile>. The effective default value is equal to a value like
  13.404 +C<%{realpath:%{dirname:%{realpath:%{macrosfile}}}/..}> This parameter is
  13.405 +important as all standard filesystem layouts (see parameter C<layout>)
  13.406 +are always at least partially based on this base directory in order
  13.407 +to provide absolute-path-independent flexible filesystem layouts.
  13.408 +
  13.409 +=item C<layout=>I<layout>
  13.410 +
  13.411 +The name of the filesystem layout type to use. The following standard
  13.412 +filesystem layout types are pre-defined: C<global>, C<local>, C<simple>,
  13.413 +C<structured> (default) and C<distributed>.
  13.414 +
  13.415 + global      macrosdir   <openpkg_prefix>/etc/openpkg
  13.416 + global      macrosfile  <openpkg_prefix>/etc/openpkg/rpmmacros
  13.417 + global      specdir     <openpkg_prefix>/RPM/SRC/$name
  13.418 + global      sourcedir   <openpkg_prefix>/RPM/SRC/$name
  13.419 + global      builddir    <openpkg_prefix>/RPM/TMP
  13.420 + global      tmpdir      <openpkg_prefix>/RPM/TMP
  13.421 + global      binrpmdir   <openpkg_prefix>/RPM/PKG
  13.422 + global      srcrpmdir   <openpkg_prefix>/RPM/PKG
  13.423 +
  13.424 + local       macrosdir   <basedir>/.openpkg
  13.425 + local       macrosfile  <basedir>/.openpkg/rpmmacros
  13.426 + local       specdir     <basedir>
  13.427 + local       sourcedir   <basedir>
  13.428 + local       builddir    <basedir>
  13.429 + local       tmpdir      <basedir>
  13.430 + local       binrpmdir   <basedir>
  13.431 + local       srcrpmdir   <basedir>
  13.432 +
  13.433 + simple      macrosdir   <basedir>/.openpkg
  13.434 + simple      macrosfile  <basedir>/.openpkg/rpmmacros
  13.435 + simple      specdir     <basedir>
  13.436 + simple      sourcedir   <basedir>
  13.437 + simple      builddir    <tmpdir>
  13.438 + simple      tmpdir      <tmpdir>
  13.439 + simple      binrpmdir   <basedir>/..
  13.440 + simple      srcrpmdir   <basedir>/..
  13.441 +
  13.442 + structured  macrosdir   <basedir>/.openpkg
  13.443 + structured  macrosfile  <basedir>/.openpkg/rpmmacros
  13.444 + structured  specdir     <basedir>/src
  13.445 + structured  sourcedir   <basedir>/dst
  13.446 + structured  builddir    <basedir>/tmp
  13.447 + structured  tmpdir      <basedir>/tmp
  13.448 + structured  binrpmdir   <basedir>/pkg/bin
  13.449 + structured  srcrpmdir   <basedir>/pkg/src
  13.450 +
  13.451 + distributed macrosdir   <basedir>/.openpkg
  13.452 + distributed macrosfile  <basedir>/.openpkg/rpmmacros
  13.453 + distributed specdir     <basedir>/src/<name>
  13.454 + distributed sourcedir   <basedir>/dst/<name>
  13.455 + distributed builddir    <basedir>/tmp
  13.456 + distributed tmpdir      <basedir>/tmp
  13.457 + distributed binrpmdir   <basedir>/pkg/bin
  13.458 + distributed srcrpmdir   <basedir>/pkg/src
  13.459 +
  13.460 +
  13.461 +=item C<specdir=>I<directory-list>
  13.462 +
  13.463 +=item C<sourcedir=>I<directory-list>
  13.464 +
  13.465 +=item C<builddir=>I<directory-list>
  13.466 +
  13.467 +=item C<tmpdir=>I<directory-list>
  13.468 +
  13.469 +=item C<binrpmdir=>I<directory-list>
  13.470 +
  13.471 +=item C<srcrpmdir=>I<directory-list>
  13.472 +
  13.473 +These parameters correspond to the six individual directories provided
  13.474 +by a standard layout and allow you to selectively adjust parts of a
  13.475 +standard layout to local needs and without having to define a full
  13.476 +standard layout yourself.
  13.477 +
  13.478 +The I<directory-list> is a whitespace-separated list of
  13.479 +I<directory>[C<:>[C<+>]I<directory>] specifications which are
  13.480 +"first-match" searched for existence. The last directory in the list
  13.481 +is always taken as the fallback and if it is not existing it is
  13.482 +even created on-the-fly. The I<directory-check>C<:>I<directory-use>
  13.483 +syntax variant allows the existence test to use I<directory-check>,
  13.484 +but expands to I<directory-use> (replace mode). The
  13.485 +I<directory-check>C<:+>I<directory-use> syntax variant allows
  13.486 +the existence test to use I<directory-check>, but expands to
  13.487 +I<directory-check>I<directory-use> (append mode). For instance
  13.488 +C<tmpdir="%{getenv:HOME)/tmp:+/openpkg %{getenv:TMPDIR}:+/openpkg
  13.489 +/tmp/%(echo $LOGNAME)/openpkg"> will first check for ~/tmp (and then use
  13.490 +~/tmp/openpkg), then for $TMPDIR (and use $TMPDIR/openpkg) and finally
  13.491 +it will use /tmp/$LOGNAME/openpkg at last resort.
  13.492 +
  13.493 +Paths are usually assembled by using RPM macros like
  13.494 +C<%{l_prefix}> (the instance prefix), C<%{__openpkg_basename}> (the
  13.495 +I<basename> parameter), C<%{realpath:<path>} (path resolution),
  13.496 +C<%{dirname:<path>} (directory name extraction), C<%{basename:<path>}
  13.497 +(file name extraction), etc.
  13.498 +
  13.499 +=item C<shared=>I<yes-or-no>
  13.500 +
  13.501 +This enables the I<subdir> components in the standard filesystem
  13.502 +layouts by setting it to an automatically generated sub-directory named
  13.503 +I<host>C<->I<arch>-I<os>. This allows one to build the same OpenPKG
  13.504 +package in parallel on multiple hosts in a shared environment (usually
  13.505 +on an NFS based filesystem).
  13.506 +
  13.507 +=item C<debug=>I<yes-or-no>
  13.508 +
  13.509 +This enables debug outputs which shows the effectively used directory
  13.510 +paths.
  13.511 +
  13.512 +=back
  13.513 +
  13.514 +The generated C<.openpkg/rpmmacros> file contains the generic filesystem
  13.515 +layout glue configuration for the particular filesystem I<layout>.
  13.516 +
  13.517 +=over 1
  13.518 +
  13.519 +=item C<%openpkg_layout  macrosfile=%{macrosfile} layout=>I<type>
  13.520 +
  13.521 +=back
  13.522 +
  13.523 +=head1 CONFIGURATION
  13.524 +
  13.525 +=over 4
  13.526 +
  13.527 + OPENPKG_NAME="Ralf S. Engelschall"
  13.528 + OPENPKG_MAIL="rse@openpkg.net"
  13.529 + OPENPKG_MODE="developer"
  13.530 +
  13.531 + OPENPKG_PREFIX="/openpkg"
  13.532 + OPENPKG_TMPDIR="${TMPDIR-/tmp}/openpkg"
  13.533 +
  13.534 + OPENPKG_VCS="cvs ci -m '<msg>' ."
  13.535 + OPENPKG_UPLD="scp <srpm> openpkg-ftp@ftp.openpkg.org:/current/SRC/00UPLOAD/"
  13.536 +
  13.537 +=back
  13.538 +
  13.539 +=head1 ABOUT
  13.540 +
  13.541 +OpenPKG B<dev> is Ralf S. Engelschall's Perl-based clean-room partial
  13.542 +re-implementation of 2008 for OpenPKG 4.0 of Thomas Lotterer's original
  13.543 +OpenPKG B<dev> Bash-based shell from 2002.
  13.544 +
  13.545 +=cut
  13.546 +
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/openpkg/diffutils.patch	Tue Jul 31 12:23:42 2012 +0200
    14.3 @@ -0,0 +1,77 @@
    14.4 +Index: lib/c-stack.c
    14.5 +--- lib/c-stack.c.orig	2011-08-28 13:55:52.000000000 +0200
    14.6 ++++ lib/c-stack.c	2012-05-12 10:06:32.000000000 +0200
    14.7 +@@ -35,6 +35,10 @@
    14.8 + 
    14.9 + #include <config.h>
   14.10 + 
   14.11 ++#if defined(__FreeBSD__)
   14.12 ++#include <sys/types.h>
   14.13 ++#endif
   14.14 ++
   14.15 + #ifndef __attribute__
   14.16 + # if __GNUC__ < 3
   14.17 + #  define __attribute__(x)
   14.18 +Index: man/diff3.1
   14.19 +--- man/diff3.1.orig	2011-09-02 17:19:12.000000000 +0200
   14.20 ++++ man/diff3.1	2012-05-12 10:06:32.000000000 +0200
   14.21 +@@ -39,6 +39,9 @@
   14.22 + \fB\-a\fR, \fB\-\-text\fR
   14.23 + treat all files as text
   14.24 + .TP
   14.25 ++\fB\-O\fR
   14.26 ++Always show content of OLDFILE in bracketing output of unmerged changes. (OpenPKG only)
   14.27 ++.TP
   14.28 + \fB\-\-strip\-trailing\-cr\fR
   14.29 + strip trailing carriage return on input
   14.30 + .TP
   14.31 +Index: src/diff3.c
   14.32 +--- src/diff3.c.orig	2011-07-03 22:42:54.000000000 +0200
   14.33 ++++ src/diff3.c	2012-05-12 10:06:32.000000000 +0200
   14.34 +@@ -158,6 +158,9 @@
   14.35 + /* If nonzero, show information for DIFF_2ND diffs.  */
   14.36 + static bool show_2nd;
   14.37 + 
   14.38 ++/* If nonzero, show information for DIFF_2ND on overlaps, too. */
   14.39 ++static bool show_2nd_on_overlap;
   14.40 ++
   14.41 + /* If nonzero, include `:wq' at the end of the script
   14.42 +    to write out the file being edited.   */
   14.43 + static bool finalwrite;
   14.44 +@@ -237,7 +240,7 @@
   14.45 +   textdomain (PACKAGE);
   14.46 +   c_stack_action (0);
   14.47 + 
   14.48 +-  while ((c = getopt_long (argc, argv, "aeimvx3AEL:TX", longopts, 0)) != -1)
   14.49 ++  while ((c = getopt_long (argc, argv, "aeimvx3AEL:TXO", longopts, 0)) != -1)
   14.50 +     {
   14.51 +       switch (c)
   14.52 + 	{
   14.53 +@@ -272,6 +275,9 @@
   14.54 + 	case 'e':
   14.55 + 	  incompat++;
   14.56 + 	  break;
   14.57 ++	case 'O':
   14.58 ++	  show_2nd_on_overlap = true;
   14.59 ++	  break;
   14.60 + 	case 'T':
   14.61 + 	  initial_tab = true;
   14.62 + 	  break;
   14.63 +@@ -1547,7 +1553,7 @@
   14.64 + 	  leading_dot = false;
   14.65 + 	  if (type == DIFF_ALL)
   14.66 + 	    {
   14.67 +-	      if (show_2nd)
   14.68 ++	      if (show_2nd || show_2nd_on_overlap)
   14.69 + 		{
   14.70 + 		  /* Append lines from FILE1.  */
   14.71 + 		  fprintf (outputfile, "||||||| %s\n", file1);
   14.72 +@@ -1686,7 +1692,7 @@
   14.73 + 			D_RELLEN (b, mapping[FILE0], i), outputfile);
   14.74 + 	    }
   14.75 + 
   14.76 +-	  if (show_2nd)
   14.77 ++	  if (show_2nd || show_2nd_on_overlap)
   14.78 + 	    {
   14.79 + 	      /* Put in lines from FILE1 with bracket.  */
   14.80 + 	      fprintf (outputfile, format_2nd, file1);
    15.1 --- a/openpkg/dot.bash_login	Tue Jul 31 12:12:54 2012 +0200
    15.2 +++ b/openpkg/dot.bash_login	Tue Jul 31 12:23:42 2012 +0200
    15.3 @@ -1,5 +1,24 @@
    15.4  ##
    15.5  ##  @l_prefix@/.bash_login -- Local Bash Login Script
    15.6 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    15.7 +##
    15.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    15.9 +##  All rights reserved. Licenses which grant limited permission to use,
   15.10 +##  copy, modify and distribute this software are available from the
   15.11 +##  OpenPKG GmbH.
   15.12 +##
   15.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   15.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   15.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   15.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   15.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   15.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   15.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   15.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   15.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   15.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   15.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   15.24 +##  SUCH DAMAGE.
   15.25  ##
   15.26  
   15.27  #   provide user and host information in default prompt
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/openpkg/etc.prereq.sh	Tue Jul 31 12:23:42 2012 +0200
    16.3 @@ -0,0 +1,86 @@
    16.4 +#!/bin/sh
    16.5 +##
    16.6 +##  etc.prereq.sh -- Platform Pre-Requisite Checks
    16.7 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    16.8 +##
    16.9 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   16.10 +##  All rights reserved. Licenses which grant limited permission to use,
   16.11 +##  copy, modify and distribute this software are available from the
   16.12 +##  OpenPKG GmbH.
   16.13 +##
   16.14 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   16.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   16.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   16.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   16.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   16.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   16.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   16.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   16.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   16.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   16.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   16.25 +##  SUCH DAMAGE.
   16.26 +##
   16.27 +##  Usage: etc.prereq.sh source|binary
   16.28 +##
   16.29 +
   16.30 +mode="$1"
   16.31 +
   16.32 +#   CHECK: determine platform ids
   16.33 +platform_prod=`sh ./shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"`
   16.34 +platform_tech=`sh ./shtool platform -n -L -S "" -C "+" -F "%<at>-%<st>"`
   16.35 +echo "++ platform product:    $platform_prod"
   16.36 +echo "++ platform technology: $platform_tech"
   16.37 +
   16.38 +#
   16.39 +#   CHECK: diskspace requirement
   16.40 +#
   16.41 +if [ ".$mode" = .source ]; then
   16.42 +    fs_path="${TMPDIR-/tmp}"
   16.43 +    fs_need=150000
   16.44 +else
   16.45 +    fs_path="" # FIXME
   16.46 +    fs_need=0  # FIXME
   16.47 +fi
   16.48 +fs_free=""
   16.49 +case "$platform_tech" in
   16.50 +    *-freebsd* | *-netbsd* | *-linux* | *-sunos* )
   16.51 +       fs_free=`cd $fs_path && /bin/df -k . | sed -n -e '$p' | sed -e 's;^[^ ]*;;' -e 's; *;;' | awk '{ print $3; }'`
   16.52 +       ;;
   16.53 +esac
   16.54 +if [ ".$fs_free" != . ]; then
   16.55 +    if [ $fs_free -lt $fs_need ]; then
   16.56 +        if [ ".$mode" = .source ]; then
   16.57 +            echo "ERROR: temporary directory \"$fs_path\" has to reside on a partition" 1>&2
   16.58 +            echo "       with at least $fs_need KB of free disk space. Set \$TMPDIR to" 1>&2
   16.59 +            echo "       a directory on a partition with enough free disk space, please." 1>&2
   16.60 +        else
   16.61 +            echo "ERROR: installation directory \"$fs_path\" has to reside on a partition" 1>&2
   16.62 +            echo "       with at least $fs_need KB of free disk space. Make \"$fs_path\" a" 1>&2
   16.63 +            echo "       symbolic link to a directory on a partition with enough free" 1>&2
   16.64 +            echo "       disk space, please." 1>&2
   16.65 +        fi
   16.66 +        exit 1
   16.67 +    fi
   16.68 +fi
   16.69 +
   16.70 +#
   16.71 +#   CHECK: available vendor packages
   16.72 +#
   16.73 +#   ...FIXME...
   16.74 +
   16.75 +#
   16.76 +#   CHECK: available tools in $PATH
   16.77 +#
   16.78 +#   ...FIXME...
   16.79 +
   16.80 +#
   16.81 +#   CHECK: available devices /dev/random, etc.
   16.82 +#
   16.83 +#   ...FIXME...
   16.84 +
   16.85 +#
   16.86 +#   CHECK: consistency check for /prefix (symlink!)
   16.87 +#
   16.88 +#   ...FIXME...
   16.89 +
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/openpkg/etc.usrgrp.sh	Tue Jul 31 12:23:42 2012 +0200
    17.3 @@ -0,0 +1,221 @@
    17.4 +#!/bin/sh
    17.5 +##
    17.6 +##  etc.usrgrp.sh -- user/group name/id determination
    17.7 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    17.8 +##
    17.9 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   17.10 +##  All rights reserved. Licenses which grant limited permission to use,
   17.11 +##  copy, modify and distribute this software are available from the
   17.12 +##  OpenPKG GmbH.
   17.13 +##
   17.14 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   17.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   17.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   17.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   17.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   17.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   17.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   17.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   17.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   17.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   17.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   17.25 +##  SUCH DAMAGE.
   17.26 +##
   17.27 +
   17.28 +#   command line parameters (defaults)
   17.29 +help=0
   17.30 +usr='';  grp=''
   17.31 +susr=''; sgrp=''
   17.32 +musr=''; mgrp=''
   17.33 +rusr=''; rgrp=''
   17.34 +nusr=''; ngrp=''
   17.35 +suid=''; sgid=''
   17.36 +muid=''; mgid=''
   17.37 +ruid=''; rgid=''
   17.38 +nuid=''; ngid=''
   17.39 +
   17.40 +#   parse command line options
   17.41 +for opt
   17.42 +do
   17.43 +    case $opt in
   17.44 +        -*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;;
   17.45 +           *) arg='' ;;
   17.46 +    esac
   17.47 +    case $opt in
   17.48 +        -h | --help          ) help=1      ;;
   17.49 +        --usr=* | --user=*   ) usr=$arg    ;;
   17.50 +        --grp=* | --group=*  ) grp=$arg    ;;
   17.51 +        --susr=*             ) susr=$arg   ;;
   17.52 +        --sgrp=*             ) sgrp=$arg   ;;
   17.53 +        --musr=*             ) musr=$arg   ;;
   17.54 +        --mgrp=*             ) mgrp=$arg   ;;
   17.55 +        --rusr=*             ) rusr=$arg   ;;
   17.56 +        --rgrp=*             ) rgrp=$arg   ;;
   17.57 +        --nusr=*             ) nusr=$arg   ;;
   17.58 +        --ngrp=*             ) ngrp=$arg   ;;
   17.59 +        --suid=*             ) suid=$arg   ;;
   17.60 +        --sgid=*             ) sgid=$arg   ;;
   17.61 +        --muid=*             ) muid=$arg   ;;
   17.62 +        --mgid=*             ) mgid=$arg   ;;
   17.63 +        --ruid=*             ) ruid=$arg   ;;
   17.64 +        --rgid=*             ) rgid=$arg   ;;
   17.65 +        --nuid=*             ) nuid=$arg   ;;
   17.66 +        --ngid=*             ) ngid=$arg   ;;
   17.67 +        *                    ) help=1      ;;
   17.68 +    esac
   17.69 +done
   17.70 +if [ ".$help" = .1 ]; then
   17.71 +    echo "Usage: sh $0 [-h|--help]" 2>&1
   17.72 +    echo "             [--[smrn]?usr=<usr>] [--[smrn]?grp=<usr>]" 2>&1
   17.73 +    echo "             [--[smrn]uid=<uid>] [--[smrn]gid=<gid>]" 2>&1
   17.74 +    exit 1
   17.75 +fi
   17.76 +
   17.77 +#   determine cusr/cgrp
   17.78 +cusr=`(id -un) 2>/dev/null ||\
   17.79 +      (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
   17.80 +      (whoami) 2>/dev/null ||\
   17.81 +      (who am i | cut "-d " -f1) 2>/dev/null ||\
   17.82 +      echo $LOGNAME`
   17.83 +cgid=`(id -g $cusr) 2>/dev/null ||\
   17.84 +      ((getent passwd "${cusr}"; grep "^${cusr}:" /etc/passwd; ypmatch "${cusr}" passwd; nismatch "${cusr}" passwd; nidump passwd . | grep "^${cusr}:") 2>/dev/null |\
   17.85 +       sed -n -e '1p' | awk -F: '{ print $4; }')`
   17.86 +cgrp=`(id -gn $cusr) 2>/dev/null ||\
   17.87 +      ((getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null | grep "^[^:]*:[^:]*:${cgid}:" |\
   17.88 +       sed -n -e '1p' | awk -F: '{ print $1; }')`
   17.89 +[ ".$cgrp" = . ] && cgrp="$cusr"
   17.90 +
   17.91 +#   determine OpenPKG susr/sgrp
   17.92 +if [ ".$susr" = . ]; then
   17.93 +    if [ ".$usr" = . ]; then
   17.94 +        susr="$cusr"
   17.95 +    else
   17.96 +        susr="root"
   17.97 +    fi
   17.98 +fi
   17.99 +if [ ".$sgrp" = . ]; then
  17.100 +    sgrp=`(id -gn $susr) 2>/dev/null`
  17.101 +    if [ ".$sgrp" = . ]; then
  17.102 +        tgid=`(getent passwd "${susr}"; grep "^${susr}:" /etc/passwd; ypmatch "${susr}" passwd; nismatch "${susr}" passwd; nidump passwd . | grep "^${susr}:") 2>/dev/null |\
  17.103 +              sed -n -e '1p' | awk -F: '{ print $4; }'`
  17.104 +        if [ ".$tgid" != . ]; then
  17.105 +            sgid="${tgid}"
  17.106 +            sgrp=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
  17.107 +                  grep "^[^:]*:[^:]*:${sgid}:" | sed -n -e '1p' | awk -F: '{ print $1; }'`
  17.108 +        fi
  17.109 +        if [ ".$sgrp" = . ]; then
  17.110 +            sgrp="wheel"
  17.111 +        fi
  17.112 +    fi
  17.113 +fi
  17.114 +
  17.115 +#   determine OpenPKG musr/mgrp
  17.116 +if [ ".$musr" = . ]; then
  17.117 +    musr="$usr"
  17.118 +fi
  17.119 +if [ ".$musr" = . ]; then
  17.120 +    musr="$cusr"
  17.121 +fi
  17.122 +if [ ".$mgrp" = . ]; then
  17.123 +    mgrp=`(id -gn $musr) 2>/dev/null`
  17.124 +    if [ ".$mgrp" = . ]; then
  17.125 +        tgid=`(getent passwd "${musr}"; grep "^${musr}:" /etc/passwd; ypmatch "${musr}" passwd; nismatch "${musr}" passwd; nidump passwd . | grep "^${musr}:") 2>/dev/null |\
  17.126 +              sed -n -e '1p' | awk -F: '{ print $4; }'`
  17.127 +        if [ ".$tgid" != . ]; then
  17.128 +            mgid="${tgid}"
  17.129 +            mgrp=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
  17.130 +                  grep "^[^:]*:[^:]*:${mgid}:" | sed -n -e '1p' | awk -F: '{ print $1; }'`
  17.131 +        fi
  17.132 +        if [ ".$mgrp" = . ]; then
  17.133 +            mgrp="$grp"
  17.134 +        fi
  17.135 +        if [ ".$mgrp" = . ]; then
  17.136 +            mgrp="$cgrp"
  17.137 +        fi
  17.138 +    fi
  17.139 +fi
  17.140 +
  17.141 +#   determine OpenPKG rusr/rgrp
  17.142 +if [ ".$rusr" = . ]; then
  17.143 +    rusr="${usr}-r"
  17.144 +fi
  17.145 +if [ ".$rusr" = ".-r" ]; then
  17.146 +    rusr="$cusr"
  17.147 +fi
  17.148 +if [ ".$rgrp" = . ]; then
  17.149 +    rgrp=`(id -gn $rusr) 2>/dev/null`
  17.150 +    if [ ".$rgrp" = . ]; then
  17.151 +        tgid=`(getent passwd "${rusr}"; grep "^${rusr}:" /etc/passwd; ypmatch "${rusr}" passwd; nismatch "${rusr}" passwd; nidump passwd . | grep "^${rusr}:") 2>/dev/null |\
  17.152 +              sed -n -e '1p' | awk -F: '{ print $4; }'`
  17.153 +        if [ ".$tgid" != . ]; then
  17.154 +            rgid="${tgid}"
  17.155 +            rgrp=`(getent group; cat /etc/group; ypcat group; nismatch group; nidump group .) 2>/dev/null |\
  17.156 +                  grep "^[^:]*:[^:]*:${rgid}:" | sed -n -e '1p' | awk -F: '{ print $1; }'`
  17.157 +        fi
  17.158 +        if [ ".$rgrp" = . ]; then
  17.159 +            rgrp="${grp}-r"
  17.160 +        fi
  17.161 +        if [ ".$rgrp" = ".-r" ]; then
  17.162 +            rgrp="$cgrp"
  17.163 +        fi
  17.164 +    fi
  17.165 +fi
  17.166 +
  17.167 +#   determine OpenPKG nusr/ngrp
  17.168 +if [ ".$nusr" = . ]; then
  17.169 +    nusr="${usr}-n"
  17.170 +fi
  17.171 +if [ ".$nusr" = ".-n" ]; then
  17.172 +    nusr="$cusr"
  17.173 +fi
  17.174 +if [ ".$ngrp" = . ]; then
  17.175 +    ngrp=`(id -gn $nusr) 2>/dev/null`
  17.176 +    if [ ".$ngrp" = . ]; then
  17.177 +        tgid=`(getent passwd "${nusr}"; grep "^${nusr}:" /etc/passwd; ypmatch "${nusr}" passwd; nismatch "${nusr}" passwd; nidump passwd . | grep "^${nusr}:") 2>/dev/null |\
  17.178 +              sed -n -e '1p' | awk -F: '{ print $4; }'`
  17.179 +        if [ ".$tgid" != . ]; then
  17.180 +            ngid="${tgid}"
  17.181 +            ngrp=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
  17.182 +                  grep "^[^:]*:[^:]*:${ngid}:" | sed -n -e '1p' | awk -F: '{ print $1; }'`
  17.183 +        fi
  17.184 +        if [ ".$ngrp" = . ]; then
  17.185 +            ngrp="${grp}-n"
  17.186 +        fi
  17.187 +        if [ ".$ngrp" = ".-n" ]; then
  17.188 +            ngrp="$cgrp"
  17.189 +        fi
  17.190 +    fi
  17.191 +fi
  17.192 +
  17.193 +#   determine OpenPKG suid/sgid
  17.194 +#   (currently not necessary)
  17.195 +
  17.196 +#   determine OpenPKG muid/mgid
  17.197 +#   (currently not necessary)
  17.198 +
  17.199 +#   determine OpenPKG ruid/rgid
  17.200 +#   (currently not necessary)
  17.201 +
  17.202 +#   determine OpenPKG nuid/ngid
  17.203 +#   (currently not necessary)
  17.204 +
  17.205 +#   print results
  17.206 +output=""
  17.207 +for var in \
  17.208 +    susr sgrp \
  17.209 +    musr mgrp \
  17.210 +    rusr rgrp \
  17.211 +    nusr ngrp \
  17.212 +    suid sgid \
  17.213 +    muid mgid \
  17.214 +    ruid rgid \
  17.215 +    nuid ngid; do
  17.216 +    eval "val=\"\$$var\""
  17.217 +    if [ ".$output" = . ]; then
  17.218 +        output="$var=\"$val\""
  17.219 +    else
  17.220 +        output="$output; $var=\"$val\""
  17.221 +    fi
  17.222 +done
  17.223 +echo $output
  17.224 +
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/openpkg/etc.wrapbin.sh	Tue Jul 31 12:23:42 2012 +0200
    18.3 @@ -0,0 +1,267 @@
    18.4 +#!/bin/sh
    18.5 +#![OpenPKG]
    18.6 +##
    18.7 +##  OpenPKG Binary Bootstrap Package (self-extracting shell script)
    18.8 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    18.9 +##
   18.10 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   18.11 +##  All rights reserved. Licenses which grant limited permission to use,
   18.12 +##  copy, modify and distribute this software are available from the
   18.13 +##  OpenPKG GmbH.
   18.14 +##
   18.15 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   18.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   18.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   18.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   18.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   18.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   18.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   18.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   18.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   18.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   18.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   18.26 +##  SUCH DAMAGE.
   18.27 +##
   18.28 +
   18.29 +#   configuration
   18.30 +l_me="$0"
   18.31 +o_help=no
   18.32 +o_version=no
   18.33 +o_tar=no
   18.34 +l_prefix='@l_prefix@'
   18.35 +l_musr='@MUSR@'
   18.36 +l_mgrp='@MGRP@'
   18.37 +l_platform="@l_platform@"
   18.38 +l_release="@l_release@"
   18.39 +l_version="@l_version@"
   18.40 +l_unprivileged="@l_unprivileged@"
   18.41 +
   18.42 +#   establish standard environment
   18.43 +PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin"
   18.44 +LC_CTYPE=C
   18.45 +export LC_CTYPE
   18.46 +umask 022
   18.47 +
   18.48 +#   parse command line options
   18.49 +for opt
   18.50 +do
   18.51 +    case $opt in
   18.52 +        -*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;;
   18.53 +           *) arg='' ;;
   18.54 +    esac
   18.55 +    case $opt in
   18.56 +        -h | --help    ) o_help=yes     ;;
   18.57 +        -v | --version ) o_version=yes  ;;
   18.58 +        -t | --tar     ) o_tar=yes      ;;
   18.59 +        --prefix=*     ) l_prefix=$arg  ;;
   18.60 +        *              ) o_help=yes     ;;
   18.61 +    esac
   18.62 +done
   18.63 +if [ ".$o_version" = .no -a ".$l_prefix" = . ]; then
   18.64 +    o_help=yes
   18.65 +fi
   18.66 +if [ ".$o_help" = .yes ]; then
   18.67 +    echo "Usage: sh $l_me" 2>&1
   18.68 +    echo "       [--prefix=<prefix>] [-t|--tar]" 2>&1
   18.69 +    echo "       [-h|--help] [-v|--version]" 2>&1
   18.70 +    exit 1
   18.71 +fi
   18.72 +
   18.73 +#   make sure all essential installation tools are available
   18.74 +for tool in sed mkdir dd tar chown chgrp; do
   18.75 +    found=no
   18.76 +    case $tool in
   18.77 +        /* )
   18.78 +            if [ -f $tool ]; then
   18.79 +                found=yes
   18.80 +            fi
   18.81 +            ;;
   18.82 +        * )
   18.83 +            for p in `IFS=:; echo $PATH`; do
   18.84 +                if [ -f "$p/$tool" ]; then
   18.85 +                    found=yes
   18.86 +                    break
   18.87 +                fi
   18.88 +            done
   18.89 +            ;;
   18.90 +    esac
   18.91 +    if [ ".$found" = .no ]; then
   18.92 +        echo "$l_me:ERROR: unable to find installation tool \"$tool\"" 1>&2
   18.93 +        exit 1
   18.94 +    fi
   18.95 +done
   18.96 +
   18.97 +#   optionally extract the embedded tarball only
   18.98 +if [ ".$o_tar" = .yes ]; then
   18.99 +    tmpdir="${TMPDIR-/tmp}/openpkg.$$"
  18.100 +    ( umask 077 && mkdir $tmpdir) || exit 1
  18.101 +    dd if=$l_me bs=8192 skip=8 2>/dev/null |\
  18.102 +    ( cd $tmpdir || exit 1
  18.103 +      tar xf - 2>/dev/null || exit 1
  18.104 +      ./openpkg.bzip2 -d -c openpkg.tar.bz2
  18.105 +    ) || exit 1
  18.106 +    rm -rf $tmpdir
  18.107 +    exit 0
  18.108 +fi
  18.109 +
  18.110 +#   display version and copyright header
  18.111 +echo "OpenPKG ${l_release} Binary Bootstrap Package, version ${l_version}"
  18.112 +echo "Built for prefix ${l_prefix} on target platform ${l_platform}"
  18.113 +if [ ".$o_version" = .yes ]; then
  18.114 +    exit 0
  18.115 +fi
  18.116 +
  18.117 +#   determine current username
  18.118 +cusr=`(id -un) 2>/dev/null ||\
  18.119 +      (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
  18.120 +      (whoami) 2>/dev/null ||\
  18.121 +      (who am i | cut "-d " -f1) 2>/dev/null ||\
  18.122 +      echo ${LOGNAME-"NN"}`
  18.123 +
  18.124 +#   running the embedded %pre script for hooking into the system environment
  18.125 +echo "++ hooking OpenPKG instance into system environment"
  18.126 +prefix="$l_prefix"
  18.127 +susr='@SUSR@'; sgrp='@SGRP@'
  18.128 +musr='@MUSR@'; mgrp='@MGRP@'
  18.129 +rusr='@RUSR@'; rgrp='@RGRP@'
  18.130 +nusr='@NUSR@'; ngrp='@NGRP@'
  18.131 +suid='@SUID@'; sgid='@SGID@'
  18.132 +muid='@MUID@'; mgid='@MGID@'
  18.133 +ruid='@RUID@'; rgid='@RGID@'
  18.134 +nuid='@NUID@'; ngid='@NGID@'
  18.135 +unprivileged="$l_unprivileged"
  18.136 +set -- 1 # emulate RPM's $1 when executing scripts
  18.137 +#   ---- BEGIN EMBEDDED %pre SCRIPT ----
  18.138 +@PRE@
  18.139 +#   ---- END EMBEDDED %pre SCRIPT ----
  18.140 +
  18.141 +#   make sure prefix/root directory exists
  18.142 +#   and has correct permissions and owner/group
  18.143 +if [ ! -d $l_prefix ]; then
  18.144 +    #   create prefix/root directory from scratch
  18.145 +    echo "++ creating OpenPKG instance root directory \"$l_prefix\""
  18.146 +    d=''
  18.147 +    for c in `IFS=/; echo $l_prefix`; do
  18.148 +        d="$d/$c"
  18.149 +        if [ ! -d $d ]; then
  18.150 +            mkdir $d || exit 1
  18.151 +            chmod 755 $d || exit 1
  18.152 +            if [ ".$cusr" = .root ]; then
  18.153 +                chown $musr $d >/dev/null 2>&1 || true
  18.154 +                chgrp $mgrp $d >/dev/null 2>&1 || true
  18.155 +            fi
  18.156 +        fi
  18.157 +    done
  18.158 +else
  18.159 +    #   adjust already existing prefix/root directory
  18.160 +    echo "++ fixating OpenPKG instance root directory \"$l_prefix\""
  18.161 +    ( cd $l_prefix || exit 1
  18.162 +      chmod 755 . || exit 1
  18.163 +      if [ ".$cusr" = .root ]; then
  18.164 +          chown $musr . >/dev/null 2>&1 || true
  18.165 +          chgrp $mgrp . >/dev/null 2>&1 || true
  18.166 +      fi
  18.167 +    ) || exit 1
  18.168 +fi
  18.169 +
  18.170 +#   extract and install binary distribution files
  18.171 +echo "++ extracting OpenPKG binary distribution"
  18.172 +dd if=$l_me bs=8192 skip=8 2>/dev/null |\
  18.173 +    (cd $l_prefix; tar xf - 2>/dev/null)
  18.174 +echo "++ installing OpenPKG binary distribution"
  18.175 +( cd $l_prefix || exit 1
  18.176 +  ./openpkg.bzip2 -d -c openpkg.tar.bz2 | ./openpkg.tar xf - 2>/dev/null
  18.177 +  rm -f openpkg.tar openpkg.bzip2 openpkg.tar.bz2 >/dev/null 2>&1 || true
  18.178 +) || exit 1
  18.179 +
  18.180 +#   immediately activate BOOT license to let the
  18.181 +#   following early RPM usage already work correctly
  18.182 +echo "BOOT" >$l_prefix/etc/openpkg/license
  18.183 +
  18.184 +#   fixate installation files
  18.185 +#   (ATTENTION: order of chgrp/chown and chmod is important because of "set-UID" bits)
  18.186 +echo "++ fixating OpenPKG instance filesystem hierarchy"
  18.187 +( echo 'fixate () {'
  18.188 +  echo '    chgrp "$3" "$4"'
  18.189 +  echo '    chown "$2" "$4"'
  18.190 +  echo '    chmod "$1" "$4"'
  18.191 +  echo '}'
  18.192 +  cd / && $l_prefix/bin/openpkg --keep-privileges rpm -q openpkg \
  18.193 +      --qf '[fixate %7.7{FILEMODES:octal} %{FILEUSERNAME:shescape} %{FILEGROUPNAME:shescape} ::%{FILENAMES:shescape}\n]' |\
  18.194 +      grep -v '(none)' | sed 's/^fixate .../fixate /' | sed -e "s; ::\\(.\\)@l_prefix@; \\1$l_prefix;"
  18.195 +) | sh 2>/dev/null || true
  18.196 +
  18.197 +#   running the embedded %post script
  18.198 +echo "++ post-processing OpenPKG bootstrap installation"
  18.199 +prefix="$l_prefix"
  18.200 +susr='@SUSR@'; sgrp='@SGRP@'
  18.201 +musr='@MUSR@'; mgrp='@MGRP@'
  18.202 +rusr='@RUSR@'; rgrp='@RGRP@'
  18.203 +nusr='@NUSR@'; ngrp='@NGRP@'
  18.204 +suid='@SUID@'; sgid='@SGID@'
  18.205 +muid='@MUID@'; mgid='@MGID@'
  18.206 +ruid='@RUID@'; rgid='@RGID@'
  18.207 +nuid='@NUID@'; ngid='@NGID@'
  18.208 +unprivileged="$l_unprivileged"
  18.209 +set -- 1 # emulate RPM's $1 when executing scripts
  18.210 +#   ---- BEGIN EMBEDDED %post SCRIPT ----
  18.211 +@POST@
  18.212 +#   ---- END EMBEDDED %post SCRIPT ----
  18.213 +
  18.214 +#   display final information
  18.215 +( echo "Congratulations!"
  18.216 +  echo ""
  18.217 +  echo "You have successfully installed an OpenPKG ${l_release} instance"
  18.218 +  echo "under prefix ${l_prefix} on target platform ${l_platform}."
  18.219 +  echo ""
  18.220 +  echo "For details about this OpenPKG instance, run any of the"
  18.221 +  echo "following typical OpenPKG RPM query commands:"
  18.222 +  echo ""
  18.223 +  echo "    \$ ${l_prefix}/bin/openpkg rpm -qa"
  18.224 +  echo "    \$ ${l_prefix}/bin/openpkg rpm -qi  openpkg"
  18.225 +  echo "    \$ ${l_prefix}/bin/openpkg rpm -qlv openpkg"
  18.226 +  echo ""
  18.227 +  echo "To check the integrity of the entire OpenPKG instance,"
  18.228 +  echo "run the following OpenPKG RPM verify command:"
  18.229 +  echo ""
  18.230 +  echo "    \$ ${l_prefix}/bin/openpkg rpm -Va"
  18.231 +  echo ""
  18.232 +  echo "To install software packages into this OpenPKG instance, run"
  18.233 +  echo "the following two OpenPKG RPM build commands for each package:"
  18.234 +  echo ""
  18.235 +  echo "    \$ ${l_prefix}/bin/openpkg rpm --rebuild /path/to/foo-*.src.rpm"
  18.236 +  echo "    \$ ${l_prefix}/bin/openpkg rpm -Uvh ${l_prefix}/RPM/PKG/foo-*.rpm"
  18.237 +  echo ""
  18.238 +  echo "To leverage from remote indexes on download.openpkg.org and"
  18.239 +  echo "conveniently generate a shell script for all-in-one downloading"
  18.240 +  echo "(openpkg curl), building (openpkg rpm --rebuild) and installing"
  18.241 +  echo "(openpkg rpm -Uvh) one or more OpenPKG RPM packages, including all"
  18.242 +  echo "their transitive dependencies, in topologically correct order:"
  18.243 +  echo ""
  18.244 +  echo "    \$ ${l_prefix}/bin/openpkg build foo bar quux | sh"
  18.245 +  echo ""
  18.246 +  echo "To remove a software package later, just run:"
  18.247 +  echo ""
  18.248 +  echo "    \$ ${l_prefix}/bin/openpkg rpm -e foo"
  18.249 +  echo ""
  18.250 +  echo "To remove the whole OpenPKG instance under prefix ${l_prefix},"
  18.251 +  echo "just remove every package as shown above. As you finally"
  18.252 +  echo "remove the package \"openpkg\", the OpenPKG instance itself"
  18.253 +  echo "will be unlinked from the system and removed as well."
  18.254 +  echo ""
  18.255 +  echo "Thank you for flying OpenPKG..."
  18.256 +  echo "                                        Ralf S. Engelschall"
  18.257 +  echo "                                        OpenPKG GmbH"
  18.258 +  echo "                                        openpkg.com"
  18.259 +) | $l_prefix/lib/openpkg/rpmtool msg -b -t info
  18.260 +
  18.261 +#   die explicitly just before the shell would discover
  18.262 +#   that we carry mega-bytes of data with us... ;-)
  18.263 +exit 0
  18.264 +
  18.265 +#   the distribution tarball is appended in raw format directly to the
  18.266 +#   end of this script, just leaded by padding whitespaces which make
  18.267 +#   sure that the tarball data starts at the pre-defined offset of 64KB.
  18.268 +#   This allows us to unpack the tarball by just skipping the leading
  18.269 +#   64KB (= 8192*8, see above).
  18.270 +
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/openpkg/etc.wrapsrc.sh	Tue Jul 31 12:23:42 2012 +0200
    19.3 @@ -0,0 +1,157 @@
    19.4 +#!/bin/sh
    19.5 +#![OpenPKG]
    19.6 +##
    19.7 +##  OpenPKG Source Bootstrap Package (self-extracting shell script)
    19.8 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    19.9 +##
   19.10 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   19.11 +##  All rights reserved. Licenses which grant limited permission to use,
   19.12 +##  copy, modify and distribute this software are available from the
   19.13 +##  OpenPKG GmbH.
   19.14 +##
   19.15 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   19.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   19.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   19.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   19.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   19.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   19.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   19.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   19.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   19.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   19.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   19.26 +##  SUCH DAMAGE.
   19.27 +##
   19.28 +
   19.29 +#   configuration
   19.30 +l_me="$0"
   19.31 +o_help=no
   19.32 +o_version=no
   19.33 +o_tar=no
   19.34 +l_prefix='/openpkg'
   19.35 +l_dir='@l_dir@'
   19.36 +l_release="@l_release@"
   19.37 +l_version="@l_version@"
   19.38 +
   19.39 +#   establish standard environment
   19.40 +PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin"
   19.41 +LC_CTYPE=C
   19.42 +export LC_CTYPE
   19.43 +umask 022
   19.44 +
   19.45 +#   pre-parse command line options
   19.46 +for opt
   19.47 +do
   19.48 +    case $opt in
   19.49 +        -*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;;
   19.50 +           *) arg='' ;;
   19.51 +    esac
   19.52 +    case $opt in
   19.53 +        -h | --help     ) o_help=yes    ;;
   19.54 +        -v | --version  ) o_version=yes ;;
   19.55 +        -t | --tar      ) o_tar=yes     ;;
   19.56 +        --prefix=*      ) l_prefix=$arg ;;
   19.57 +    esac
   19.58 +done
   19.59 +if [ ".$o_help" = .yes ]; then
   19.60 +    echo "Usage: sh $l_me" 2>&1
   19.61 +    echo "       [--prefix=<prefix>] [--tag=<str>]" 2>&1
   19.62 +    echo "       [--stack=<name-or-url>] [--unprivileged]" 2>&1
   19.63 +    echo "       [--user=<usr>] [--group=<grp>]" 2>&1
   19.64 +    echo "       [--{s,m,r,n}usr=<usr>] [--{s,m,r,n}grp=<grp>]" 2>&1
   19.65 +    echo "       [--{s,m,r,n}uid=<uid>] [--{s,m,r,n}gid=<gid>]" 2>&1
   19.66 +    echo "       [--use_tar=<tar>] [--use_make=<make>] [--use_cc=<cc>]" 2>&1
   19.67 +    echo "       [--use_ar=<ar>] [--use_ld=<ld>] [--use_as=<as>] [--use_strip=<strip>]" 2>&1
   19.68 +    echo "       [-t|--tar] [-h|--help] [-v|--version]" 2>&1
   19.69 +    exit 1
   19.70 +fi
   19.71 +
   19.72 +#   make sure all essential unpacking tools are available
   19.73 +#   (the build tools are checked later from within openpkg.spec)
   19.74 +for tool in /bin/sh mkdir cat tar rm chown chgrp sed dd; do
   19.75 +    found=no
   19.76 +    case $tool in
   19.77 +        /* )
   19.78 +            if [ -f $tool ]; then
   19.79 +                found=yes
   19.80 +            fi
   19.81 +            ;;
   19.82 +        * )
   19.83 +            for p in `IFS=:; echo $PATH`; do
   19.84 +                if [ -f "$p/$tool" ]; then
   19.85 +                    found=yes
   19.86 +                    break
   19.87 +                fi
   19.88 +            done
   19.89 +            ;;
   19.90 +    esac
   19.91 +    if [ ".$found" = .no ]; then
   19.92 +        echo "$l_me:ERROR: unable to find bootstrap tool \"$tool\"" 1>&2
   19.93 +        exit 1
   19.94 +    fi
   19.95 +done
   19.96 +
   19.97 +#   optionally extract the embedded tarball only
   19.98 +if [ ".$o_tar" = .yes ]; then
   19.99 +    dd if=$l_me bs=8192 skip=8 2>/dev/null
  19.100 +    exit 0
  19.101 +fi
  19.102 +
  19.103 +#   display version and copyright header
  19.104 +echo "OpenPKG ${l_release} Source Bootstrap Package, version ${l_version}"
  19.105 +if [ ".$o_version" = .yes ]; then
  19.106 +    exit 0
  19.107 +fi
  19.108 +echo "Building for prefix ${l_prefix} on current platform"
  19.109 +
  19.110 +#   determine current user/group
  19.111 +cusr=`(id -un) 2>/dev/null ||\
  19.112 +      (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
  19.113 +      (whoami) 2>/dev/null ||\
  19.114 +      (who am i | cut "-d " -f1) 2>/dev/null ||\
  19.115 +      echo $LOGNAME`
  19.116 +cgid=`(id -g $cusr) 2>/dev/null ||\
  19.117 +      ((getent passwd "${cusr}"; grep "^${cusr}:" /etc/passwd; ypmatch "${cusr}" passwd; nismatch "${cusr}" passwd; nidump passwd . | grep "^${cusr}:") 2>/dev/null |\
  19.118 +      sed -e 'q' | awk -F: '{ print $4; }')`
  19.119 +cgrp=`(id -gn $cusr) 2>/dev/null ||\
  19.120 +      ((getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null | grep "^[^:]*:[^:]*:${cgid}:" |\
  19.121 +      sed -e 'q' | awk -F: '{ print $1; }')`
  19.122 +if [ ".$cgrp" = . ]; then
  19.123 +    cgrp="$cusr"
  19.124 +fi
  19.125 +
  19.126 +#   extract the source distribution files
  19.127 +echo "++ extracting OpenPKG source distribution"
  19.128 +rm -rf $l_dir >/dev/null 2>&1
  19.129 +mkdir $l_dir || exit 1
  19.130 +dd if=$l_me bs=8192 skip=8 2>/dev/null | (cd $l_dir; tar xf - 2>/dev/null)
  19.131 +if [ ".$cusr" = .root ]; then
  19.132 +    ( cd $l_dir || exit 1
  19.133 +      chown -R -h $cusr . >/dev/null 2>&1 || true
  19.134 +      chgrp -R -h $cgrp . >/dev/null 2>&1 || true
  19.135 +    ) || exit 1
  19.136 +fi
  19.137 +if [ ! -f $l_dir/openpkg.boot ]; then
  19.138 +    echo "$l_me:ERROR: failed to unpack into directory \"$l_dir\"" 1>&2
  19.139 +    exit 1
  19.140 +fi
  19.141 +
  19.142 +#   perform bootstrap procedure
  19.143 +echo "++ building OpenPKG binary distribution"
  19.144 +( cd $l_dir || exit 1
  19.145 +  sh ./openpkg.boot ${1+"$@"} || exit 1
  19.146 +) || exit 1
  19.147 +
  19.148 +#   cleanup
  19.149 +rm -rf $l_dir >/dev/null 2>&1
  19.150 +
  19.151 +#   die explicitly just before the shell would discover
  19.152 +#   that we carry mega-bytes of data with us...
  19.153 +exit 0
  19.154 +
  19.155 +#   the distribution tarball is appended in raw format directly to the
  19.156 +#   end of this script, just leaded by padding whitespaces which make
  19.157 +#   sure that the tarball data starts at the pre-defined offset of 64KB.
  19.158 +#   This allows us to unpack the tarball by just skipping the leading
  19.159 +#   64KB (= 8192*8, see above).
  19.160 +
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/openpkg/index.8	Tue Jul 31 12:23:42 2012 +0200
    20.3 @@ -0,0 +1,218 @@
    20.4 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
    20.5 +.\"
    20.6 +.\" Standard preamble:
    20.7 +.\" ========================================================================
    20.8 +.de Sp \" Vertical space (when we can't use .PP)
    20.9 +.if t .sp .5v
   20.10 +.if n .sp
   20.11 +..
   20.12 +.de Vb \" Begin verbatim text
   20.13 +.ft CW
   20.14 +.nf
   20.15 +.ne \\$1
   20.16 +..
   20.17 +.de Ve \" End verbatim text
   20.18 +.ft R
   20.19 +.fi
   20.20 +..
   20.21 +.\" Set up some character translations and predefined strings.  \*(-- will
   20.22 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   20.23 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
   20.24 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
   20.25 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
   20.26 +.\" nothing in troff, for use with C<>.
   20.27 +.tr \(*W-
   20.28 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   20.29 +.ie n \{\
   20.30 +.    ds -- \(*W-
   20.31 +.    ds PI pi
   20.32 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   20.33 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   20.34 +.    ds L" ""
   20.35 +.    ds R" ""
   20.36 +.    ds C` 
   20.37 +.    ds C' 
   20.38 +'br\}
   20.39 +.el\{\
   20.40 +.    ds -- \|\(em\|
   20.41 +.    ds PI \(*p
   20.42 +.    ds L" ``
   20.43 +.    ds R" ''
   20.44 +'br\}
   20.45 +.\"
   20.46 +.\" Escape single quotes in literal strings from groff's Unicode transform.
   20.47 +.ie \n(.g .ds Aq \(aq
   20.48 +.el       .ds Aq '
   20.49 +.\"
   20.50 +.\" If the F register is turned on, we'll generate index entries on stderr for
   20.51 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
   20.52 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   20.53 +.\" output yourself in some meaningful fashion.
   20.54 +.ie \nF \{\
   20.55 +.    de IX
   20.56 +.    tm Index:\\$1\t\\n%\t"\\$2"
   20.57 +..
   20.58 +.    nr % 0
   20.59 +.    rr F
   20.60 +.\}
   20.61 +.el \{\
   20.62 +.    de IX
   20.63 +..
   20.64 +.\}
   20.65 +.\"
   20.66 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   20.67 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   20.68 +.    \" fudge factors for nroff and troff
   20.69 +.if n \{\
   20.70 +.    ds #H 0
   20.71 +.    ds #V .8m
   20.72 +.    ds #F .3m
   20.73 +.    ds #[ \f1
   20.74 +.    ds #] \fP
   20.75 +.\}
   20.76 +.if t \{\
   20.77 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   20.78 +.    ds #V .6m
   20.79 +.    ds #F 0
   20.80 +.    ds #[ \&
   20.81 +.    ds #] \&
   20.82 +.\}
   20.83 +.    \" simple accents for nroff and troff
   20.84 +.if n \{\
   20.85 +.    ds ' \&
   20.86 +.    ds ` \&
   20.87 +.    ds ^ \&
   20.88 +.    ds , \&
   20.89 +.    ds ~ ~
   20.90 +.    ds /
   20.91 +.\}
   20.92 +.if t \{\
   20.93 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   20.94 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
   20.95 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
   20.96 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
   20.97 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
   20.98 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
   20.99 +.\}
  20.100 +.    \" troff and (daisy-wheel) nroff accents
  20.101 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  20.102 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  20.103 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  20.104 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  20.105 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  20.106 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  20.107 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  20.108 +.ds ae a\h'-(\w'a'u*4/10)'e
  20.109 +.ds Ae A\h'-(\w'A'u*4/10)'E
  20.110 +.    \" corrections for vroff
  20.111 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  20.112 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  20.113 +.    \" for low resolution devices (crt and lpr)
  20.114 +.if \n(.H>23 .if \n(.V>19 \
  20.115 +\{\
  20.116 +.    ds : e
  20.117 +.    ds 8 ss
  20.118 +.    ds o a
  20.119 +.    ds d- d\h'-1'\(ga
  20.120 +.    ds D- D\h'-1'\(hy
  20.121 +.    ds th \o'bp'
  20.122 +.    ds Th \o'LP'
  20.123 +.    ds ae ae
  20.124 +.    ds Ae AE
  20.125 +.\}
  20.126 +.rm #[ #] #H #V #F C
  20.127 +.\" ========================================================================
  20.128 +.\"
  20.129 +.IX Title "INDEX 8"
  20.130 +.TH INDEX 8 "OpenPKG" "INDEX(8)" "OpenPKG"
  20.131 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
  20.132 +.\" way too many mistakes in technical documents.
  20.133 +.if n .ad l
  20.134 +.nh
  20.135 +.SH "NAME"
  20.136 +openpkg index \- OpenPKG Package Indexing
  20.137 +.SH "SYNOPSIS"
  20.138 +.IX Header "SYNOPSIS"
  20.139 +\&\fBopenpkg\fR
  20.140 +\&\fBindex\fR
  20.141 +[\fB\-r\fR \fIresource\fR]
  20.142 +[\fB\-p\fR \fIplatform\fR]
  20.143 +[\fB\-S\fR]
  20.144 +[\fB\-T\fR]
  20.145 +[\fB\-D\fR]
  20.146 +[\fB\-C\fR \fIcache.db\fR]
  20.147 +[\fB\-o\fR \fIindex.rdf\fR]
  20.148 +[\fB\-c\fR]
  20.149 +[\fB\-i\fR]
  20.150 +\&\fIdir\fR ...
  20.151 +.SH "DESCRIPTION"
  20.152 +.IX Header "DESCRIPTION"
  20.153 +The \fBopenpkg index\fR tool is a frontend for indexing of \s-1RPM\s0 files. It
  20.154 +creates an \s-1XML/RDF\s0 based resource index for \s-1RPM\s0 \fI.spec\fR files in a
  20.155 +source tree or from an \s-1RPM\s0 package repository. The index holds enough
  20.156 +information to support an automated build process by \fBopenpkg build\fR.
  20.157 +.SH "OPTIONS"
  20.158 +.IX Header "OPTIONS"
  20.159 +The following command line options exist:
  20.160 +.IP "\fB\-r\fR \fIresource\fR" 4
  20.161 +.IX Item "-r resource"
  20.162 +The name of the resource stored in the index. The default is
  20.163 +"\f(CW\*(C`OpenPKG\-CURRENT/Source/\*(C'\fR".
  20.164 +.IP "\fB\-p\fR \fIplatform\fR" 4
  20.165 +.IX Item "-p platform"
  20.166 +\&\fBopenpkg index\fR adds a platform attribute for binary RPMs. This
  20.167 +must be unique to correctly identify a specific architecture, \s-1OS\s0
  20.168 +and build environment.
  20.169 +.IP "\fB\-S\fR" 4
  20.170 +.IX Item "-S"
  20.171 +Optionally determines and stores the size (in bytes) of each indexed file.
  20.172 +This is not required for the correct operation of the \fBopenpkg build\fR command, but
  20.173 +the \fBopenpkg mirror\fR command requires it.
  20.174 +.IP "\fB\-T\fR" 4
  20.175 +.IX Item "-T"
  20.176 +Optionally determines and stores the modification time (\f(CW\*(C`mtime\*(C'\fR) of each indexed file.
  20.177 +This is not required for the correct operation of the \fBopenpkg build\fR command, but
  20.178 +the \fBopenpkg mirror\fR command requires it.
  20.179 +.IP "\fB\-D\fR" 4
  20.180 +.IX Item "-D"
  20.181 +Optionally determines and stores the message digest (\f(CW\*(C`md5\*(C'\fR) of each indexed file.
  20.182 +This is not required for the correct operation of the \fBopenpkg build\fR command, but
  20.183 +the \fBopenpkg mirror\fR command requires it.
  20.184 +.IP "\fB\-C\fR \fIcache.db\fR" 4
  20.185 +.IX Item "-C cache.db"
  20.186 +Cache all \fI.spec\fR files into this Berkeley-DB file when indexing source
  20.187 +RPMs. The cache is refreshed automatically when the source RPMs are more
  20.188 +recent than the cache entry. The \fB\-C\fR option requires an installed
  20.189 +DB_File perl module.
  20.190 +.IP "\fB\-o\fR \fIindex.rdf\fR" 4
  20.191 +.IX Item "-o index.rdf"
  20.192 +Name of the output \s-1XML/RDF\s0 file, default is to write to \fIstdout\fR.
  20.193 +.IP "\fB\-c\fR" 4
  20.194 +.IX Item "-c"
  20.195 +Compress output with \f(CW\*(C`bzip2\*(C'\fR. Use the \fB\-o\fR option to specify a \fI.bz2\fR
  20.196 +suffix.
  20.197 +.IP "\fB\-i\fR" 4
  20.198 +.IX Item "-i"
  20.199 +The specified directories are \s-1RPM\s0 repositories. Build index over
  20.200 +all \fI.rpm\fR files in these directories and all subdirectories.
  20.201 +If a subdirectory already contains a \f(CW\*(C`00INDEX.rdf\*(C'\fR or \f(CW\*(C`00INDEX.rdf.*\*(C'\fR
  20.202 +file then skip scanning the subdirectory, instead add a reference
  20.203 +to the index file into the new index.
  20.204 +.Sp
  20.205 +Without this option the directories are source trees with a subdirectory
  20.206 +per package and a \fIpackage\fR\f(CW\*(C`.spec\*(C'\fR file inside each subdirectory.
  20.207 +.SH "SEE ALSO"
  20.208 +.IX Header "SEE ALSO"
  20.209 +\&\fIrpm\fR\|(8).
  20.210 +.SH "HISTORY"
  20.211 +.IX Header "HISTORY"
  20.212 +The \fBopenpkg index\fR command was invented in November 2002 by \fIMichael
  20.213 +van Elst\fR <mlelstv@serpens.de> under contract with \fICable
  20.214 +& Wireless\fR <http://www.cw.com/> for use inside the \fBOpenPKG\fR
  20.215 +project <http://www.openpkg.org/>.
  20.216 +.SH "AUTHORS"
  20.217 +.IX Header "AUTHORS"
  20.218 +.Vb 2
  20.219 +\& Michael van Elst
  20.220 +\& mlelstv@serpens.de
  20.221 +.Ve
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/openpkg/index.pl	Tue Jul 31 12:23:42 2012 +0200
    21.3 @@ -0,0 +1,1173 @@
    21.4 +##
    21.5 +##  index.pl -- OpenPKG Maintenance Tool (backend for indexing)
    21.6 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    21.7 +##
    21.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    21.9 +##  All rights reserved. Licenses which grant limited permission to use,
   21.10 +##  copy, modify and distribute this software are available from the
   21.11 +##  OpenPKG GmbH.
   21.12 +##
   21.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   21.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   21.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   21.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   21.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   21.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   21.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   21.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   21.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   21.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   21.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   21.24 +##  SUCH DAMAGE.
   21.25 +##
   21.26 +
   21.27 +#############################################################################
   21.28 +##
   21.29 +##  MAIN PROCEDURE
   21.30 +##
   21.31 +#############################################################################
   21.32 +
   21.33 +require 5;
   21.34 +#use strict;
   21.35 +
   21.36 +#   determine OpenPKG instance prefix via
   21.37 +#   1. the environment of the "openpkg build" framework
   21.38 +#   2. the installation path of the script
   21.39 +#   3. the installation path of the Perl interpreter
   21.40 +#   4. the path of the "openpkg" command in $PATH
   21.41 +my $l_prefix = $ENV{'OPENPKG_PREFIX'};
   21.42 +if (not $l_prefix) {
   21.43 +    ($l_prefix) = ($0 =~ m/^(.+)\/lib(exec)?\/openpkg(-tools)?\/build(\.pl)?$/);
   21.44 +}
   21.45 +if (not $l_prefix) {
   21.46 +    ($l_prefix) = ($^X =~ m/^(.+)\/bin\/perl.*$/);
   21.47 +}
   21.48 +if (not $l_prefix) {
   21.49 +    $l_prefix = (`(which openpkg) 2>/dev/null` =~ m/^(.+)\/bin\/openpkg$/);
   21.50 +}
   21.51 +if (not -x "$l_prefix/bin/openpkg") {
   21.52 +    die "openpkg:index:FATAL: cannot determine OpenPKG instance prefix";
   21.53 +}
   21.54 +
   21.55 +#   determine tools
   21.56 +my $RPM = ((-f "$l_prefix/bin/openpkg" && -f "$l_prefix/libexec/openpkg/rpm") ?
   21.57 +          "$l_prefix/bin/openpkg rpm" : "$l_prefix/bin/rpm");
   21.58 +my $R2C = ((-f "$l_prefix/bin/openpkg" && -f "$l_prefix/libexec/openpkg/rpm2cpio") ?
   21.59 +          "$l_prefix/bin/openpkg rpm2cpio" : "$l_prefix/bin/rpm2cpio");
   21.60 +my $BZ  = "$l_prefix/lib/openpkg/bzip2 -9";
   21.61 +my $OPENSSL = "$l_prefix/lib/openpkg/openssl";
   21.62 +
   21.63 +#   parse command line
   21.64 +our ($opt_r, $opt_p, $opt_S, $opt_T, $opt_D, $opt_C, $opt_o, $opt_c, $opt_i);
   21.65 +my $getopts = 'r:p:STDC:o:ci';
   21.66 +getopts($getopts);
   21.67 +if ($#ARGV < 0) {
   21.68 +    print "openpkg:index:USAGE: openpkg index [-r resource] [-p platform] [-S] [-T] [-D] [-C cache.db] [-o index.rdf] [-c] [-i] dir ...\n";
   21.69 +    exit(1);
   21.70 +}
   21.71 +
   21.72 +#   optionally open cache file
   21.73 +my %cache;
   21.74 +if ($opt_C) {
   21.75 +    eval {
   21.76 +        require DB_File;
   21.77 +    };
   21.78 +    if ($@) {
   21.79 +        die "openpkg:index:FATAL: The -C option requires an installed DB_File perl module.";
   21.80 +    }
   21.81 +    eval {
   21.82 +        require Fcntl;
   21.83 +    };
   21.84 +    if ($@) {
   21.85 +        die "openpkg:index:FATAL: The -C option requires an installed Fcntl perl module.";
   21.86 +    }
   21.87 +    tie %cache, 'DB_File', $opt_C, Fcntl::O_CREAT()|Fcntl::O_RDWR(), 0666, $DB_File::DB_HASH
   21.88 +        or die "openpkg:index:FATAL: cannot tie cache '$opt_C' ($!)";
   21.89 +}
   21.90 +
   21.91 +#   provide default for repository path
   21.92 +$opt_r = 'OpenPKG-CURRENT/Source/' if (not defined($opt_r));
   21.93 +
   21.94 +#   create make_resource function closure
   21.95 +my $make_resource = gen_make_resource();
   21.96 +
   21.97 +#   determine output channel
   21.98 +my $fh;
   21.99 +my $tmpo;
  21.100 +if (defined($opt_o)) {
  21.101 +    $tmpo = $opt_o . '.tmp';
  21.102 +    if ($opt_c) {
  21.103 +        open(FH, "| $BZ -c > '$tmpo'")
  21.104 +            or die "openpkg:index:FATAL: cannot write '$tmpo' ($!)";
  21.105 +    } else {
  21.106 +        open(FH, "> $tmpo")
  21.107 +            or die "openpkg:index:FATAL: cannot write '$tmpo' ($!)";
  21.108 +    }
  21.109 +} else {
  21.110 +    if ($opt_c) {
  21.111 +        open(FH, "| $BZ -c")
  21.112 +            or die "openpkg:index:FATAL: cannot write to stdout ($!)";
  21.113 +    } else {
  21.114 +        open(FH, ">&=1")
  21.115 +            or die "openpkg:index:FATAL: cannot write to stdout ($!)";
  21.116 +    }
  21.117 +}
  21.118 +$fh = \*FH;
  21.119 +
  21.120 +#   generate XML/RDF output
  21.121 +xml_head($fh, $opt_r);
  21.122 +foreach my $prefix (@ARGV) {
  21.123 +    my $list;
  21.124 +    if (-d $prefix) {
  21.125 +        if ($opt_i) {
  21.126 +            $list = list_rpmdir($prefix);
  21.127 +        } else {
  21.128 +            $list = list_specdir($prefix);
  21.129 +        }
  21.130 +    } else {
  21.131 +        $list = [ $prefix ];
  21.132 +        $prefix = dirname($prefix);
  21.133 +    }
  21.134 +    write_index($fh, $prefix, $opt_r, $opt_p, $list, $opt_C ? \%cache : undef);
  21.135 +}
  21.136 +xml_foot($fh);
  21.137 +
  21.138 +#   close output channel
  21.139 +close($fh)
  21.140 +    or die "openpkg:index:FATAL: write error on output ($!)";
  21.141 +
  21.142 +#   post-process output
  21.143 +if (defined($tmpo)) {
  21.144 +    rename($tmpo, $opt_o)
  21.145 +        or die "openpkg:index:FATAL: cannot rename $tmpo to $opt_o ($!)";
  21.146 +}
  21.147 +
  21.148 +#   die gracefully
  21.149 +exit(0);
  21.150 +
  21.151 +#############################################################################
  21.152 +##
  21.153 +##  FUNCTIONS: PARSING
  21.154 +##
  21.155 +#############################################################################
  21.156 +
  21.157 +#   home-brewn getopt(3) style option parser
  21.158 +sub getopts ($) {
  21.159 +    my ($opts) = @_;
  21.160 +    my (%optf) = map { m/(\w)/; $1 => $_ } $opts =~ m/(\w:|\w)/g;
  21.161 +    my (%opts, @argv, $optarg);
  21.162 +
  21.163 +    foreach (@ARGV) {
  21.164 +        if (@argv) {
  21.165 +            push @argv, $_;
  21.166 +        } elsif (defined $optarg) {
  21.167 +            if (exists $opts{$optarg}) {
  21.168 +                $opts{$optarg} .= " $_";
  21.169 +            } else {
  21.170 +                $opts{$optarg} = $_;
  21.171 +            }
  21.172 +            $optarg = undef;
  21.173 +        } elsif (!/^[-]/) {
  21.174 +            push @argv, $_;
  21.175 +        } else {
  21.176 +            while (/^\-(\w)(.*)/) {
  21.177 +                if (exists $optf{$1}) {
  21.178 +                    if (length($optf{$1}) > 1) {
  21.179 +                        if ($2 ne '') {
  21.180 +                            if (exists $opts{$1}) {
  21.181 +                                $opts{$1} .= " $2";
  21.182 +                            } else {
  21.183 +                                $opts{$1} = $2;
  21.184 +                            }
  21.185 +                        } else {
  21.186 +                            $optarg = $1;
  21.187 +                        }
  21.188 +                        last;
  21.189 +                    } else {
  21.190 +                        $opts{$1} = 1;
  21.191 +                    }
  21.192 +                } else {
  21.193 +                    warn "openpkg:index:WARNING: unknown option $_\n";
  21.194 +                }
  21.195 +                $_ = "-$2";
  21.196 +            }
  21.197 +        }
  21.198 +    }
  21.199 +    if (defined $optarg) {
  21.200 +        warn "openpkg:index:WARNING: option $optarg requires an argument\n";
  21.201 +    }
  21.202 +    foreach (keys %opts) {
  21.203 +        eval '$opt_'.$_.' = "'.quotemeta($opts{$_}).'";';
  21.204 +    }
  21.205 +    @ARGV = @argv;
  21.206 +}
  21.207 +
  21.208 +#############################################################################
  21.209 +##
  21.210 +##  OpenPKG RPM Package Specification Parsing
  21.211 +##
  21.212 +#############################################################################
  21.213 +
  21.214 +#   escape XML for output in RDF file
  21.215 +sub e ($) {
  21.216 +    my ($s) = @_;
  21.217 +    my ($i);
  21.218 +
  21.219 +    #   remove trailing whitespace
  21.220 +    $s =~ s/\n+$//sg;
  21.221 +    $s =~ s/[^\S\n]+$//mg;
  21.222 +
  21.223 +    #   remove common leading whitespace
  21.224 +    $i = undef;
  21.225 +    while ($s =~ m/^([^\S\n]+)/mg) {
  21.226 +        $i = $1 if (!defined($i) || (length($1) < length($i)));
  21.227 +    }
  21.228 +    $s =~ s/^\Q$i\E//mg if (defined($i));
  21.229 +
  21.230 +    #   escape XML special characters
  21.231 +    $s =~ s/&/&amp;/sg;
  21.232 +    $s =~ s/</&lt;/sg;
  21.233 +    $s =~ s/>/&gt;/sg;
  21.234 +
  21.235 +    return $s;
  21.236 +}
  21.237 +
  21.238 +#   make_resource closure
  21.239 +sub gen_make_resource {
  21.240 +    #   generate operator regular expression
  21.241 +    #   (used in make_resource below)
  21.242 +    my %attrname = (
  21.243 +        '=='  => 'equ',
  21.244 +        '='   => 'equ',
  21.245 +        '>='  => 'geq',
  21.246 +        '=>'  => 'geq',
  21.247 +        '<='  => 'leq',
  21.248 +        '=<'  => 'leq',
  21.249 +        '>'   => 'gt',
  21.250 +        '<'   => 'lt'
  21.251 +    );
  21.252 +    my ($opreg) =
  21.253 +        join '|',
  21.254 +        map {
  21.255 +            "\Q$_\E"
  21.256 +        } sort {
  21.257 +               length($b) <=> length($a)
  21.258 +            || $b cmp $a
  21.259 +        } keys(%attrname);
  21.260 +
  21.261 +    #   return function which makes resource object
  21.262 +    return sub ($) {
  21.263 +        my ($s) = @_;
  21.264 +
  21.265 +        if ($s =~ m/(\S+)\s*($opreg)\s*(.*?)\s*$/o) {
  21.266 +            return {
  21.267 +                resource  => $1,
  21.268 +                attrname  => $attrname{$2},
  21.269 +                attrval   => $3
  21.270 +            }
  21.271 +        }
  21.272 +        else {
  21.273 +            return {
  21.274 +                resource => $s
  21.275 +            }
  21.276 +        }
  21.277 +    };
  21.278 +};
  21.279 +
  21.280 +#   split string into array at comma seperator
  21.281 +#   (optioanlly map resource operators into resource objects)
  21.282 +sub commasep ($$) {
  21.283 +    my ($k, $v) = @_;
  21.284 +
  21.285 +    if ($k =~ m/^(NoSource)$/) {
  21.286 +        return split(/\s*,\s*/, $v);
  21.287 +    } elsif ($k =~ /^(PreReq|BuildPreReq|Provides|Conflicts)$/) {
  21.288 +        return map { &$make_resource($_) }
  21.289 +               split(/\s*,\s*/, $v);
  21.290 +    }
  21.291 +    return $v;
  21.292 +}
  21.293 +
  21.294 +#   escape option string
  21.295 +sub optesc ($) {
  21.296 +    my ($s) = @_;
  21.297 +
  21.298 +    $s =~ s/([\x00-\x1f\x80-\xbf\s\%])/sprintf("%%%02x", ord($1))/eg;
  21.299 +    return $s;
  21.300 +}
  21.301 +
  21.302 +#   variable substitution
  21.303 +sub vsub ($$) {
  21.304 +    my ($var, $v) = @_;
  21.305 +
  21.306 +    $v =~ s/\%\{([^}]+)\}/
  21.307 +        exists $var->{$1} ? $var->{$1} : '%{'.$1.'}'/emg;
  21.308 +    return $v;
  21.309 +}
  21.310 +
  21.311 +#   Umgekehrte Polnische Notation (UPN)
  21.312 +#   Reverse Polish Notation (RPN)
  21.313 +#   << ( %{foo} == "yes" ) && ( ! %{bar} == "no" ) || ( %{baz} == "yes" )
  21.314 +#   >> %{foo} %{bar} ! && %{baz} ||
  21.315 +sub upn ($) {
  21.316 +    my ($t) = @_;
  21.317 +    my (@tok);
  21.318 +    my (@out, $op, $o);
  21.319 +    my (@save);
  21.320 +
  21.321 +    #   split string into tokens
  21.322 +    @tok = ($t =~ m/(\(|\)|\&\&|\|\||\!|\S+)/g);
  21.323 +
  21.324 +    #   iterate over all tokens
  21.325 +    $op = [];
  21.326 +    foreach (@tok) {
  21.327 +        if ($_ eq '(') {
  21.328 +            push(@save, $op);
  21.329 +            $op = [];
  21.330 +        } elsif ($_ eq ')') {
  21.331 +            die "openpkg:index:FATAL: unresolved operators in: @tok\n" if (@$op);
  21.332 +            $op = pop(@save)
  21.333 +                or die "openpkg:index:FATAL: unmatched closing parenthesis in: @tok\n";
  21.334 +            while ($o = pop(@$op)) {
  21.335 +                push(@out, $o->[0]);
  21.336 +                last if ($o->[1]);
  21.337 +            }
  21.338 +        } elsif ($_ eq '&&') {
  21.339 +            push(@$op, [ '+', 1 ]);
  21.340 +        } elsif ($_ eq '||') {
  21.341 +            push(@$op, [ '|', 1 ]);
  21.342 +        } elsif ($_ eq '!') {
  21.343 +            push(@$op, [ '!', 0 ]);
  21.344 +        } elsif (m/^\%\{(\S*?)\}$/) {
  21.345 +            push(@out, $1);
  21.346 +            while ($o = pop(@$op)) {
  21.347 +                push(@out, $o->[0]);
  21.348 +                last if ($o->[1]); # binary operator
  21.349 +            }
  21.350 +        }
  21.351 +    }
  21.352 +    return join (' ', @out);
  21.353 +}
  21.354 +
  21.355 +#   deduce external variables from description
  21.356 +#   (backward compatibility for times before openpkg-20021230)
  21.357 +sub find_options ($) {
  21.358 +    my ($descr) = @_;
  21.359 +    my $evar = {};
  21.360 +    $descr =~ s/--define\s*'(\S+)\s*\%\{\1\}'/$evar->{$1} = '%{'.$1.'}', ''/sge;
  21.361 +    return $evar;
  21.362 +}
  21.363 +
  21.364 +#   translate default section from spec-file into a hash
  21.365 +#   - %if/%ifdef/%define... are translated to #/#ifdef/#define
  21.366 +#   - #defines are interpolated (correct ?)
  21.367 +#   - #if/#ifdef/... sections are stripped
  21.368 +#     result is the same as if all conditions evaluate false (!)
  21.369 +#   - all attributes are of the form key: value
  21.370 +#   - repeated attributes are coalesced into a list
  21.371 +#   hint: evar = expansion variables, ovar = option variables
  21.372 +sub package2data ($$) {
  21.373 +    my ($s, $ovar) = @_;
  21.374 +    my (%evar, %var);
  21.375 +    my (@term, $term);
  21.376 +    my (%attr, %avar);
  21.377 +    my ($l, $v, $cond, $d, $p);
  21.378 +    my ($re, @defs);
  21.379 +
  21.380 +    #   combine multilines (line continuation!)
  21.381 +    $s =~ s/\\\n/ /sg;
  21.382 +
  21.383 +    #   map syntax of conditional variable macros
  21.384 +    $s =~ s/^#\{\!\?([^:]*):\s*%(.*?)\s*\}\s*$/#ifndef $1\n#$2\n#endif/mg;
  21.385 +    $s =~ s/^#\{\!\?([^:]*):\s*(.*?)\s*\}\s*$/#ifndef $1\n$2\n#endif/mg;
  21.386 +
  21.387 +    #   map syntax of option macro
  21.388 +    $s =~ s/^#option\s+(\S+)\s*(.*?)\s*$/#ifndef $1\n#define $1 $2\n#endif\n#provides $1 $2/mg;
  21.389 +
  21.390 +    #   use option variables for expansion
  21.391 +    %evar = %$ovar;
  21.392 +
  21.393 +    #   guess more external parameters by scanning for (and removing) "set option default" sections
  21.394 +    $re = '^\#ifndef\s+[\w\_]+\s*\n((?:\#define\s+[\w\_]+\s.*\n)+)\#endif\n';
  21.395 +    @defs = ($s =~ m/$re/gm);
  21.396 +    foreach (@defs) {
  21.397 +        while (m/^\#define\s+([\w\_]+)\s(.*?)\s*$/mg) {
  21.398 +            $ovar->{$1} = $2;
  21.399 +            $evar{$1} = '%{'.$1.'}';
  21.400 +        }
  21.401 +    }
  21.402 +    $s =~ s/$re//gm;
  21.403 +
  21.404 +    #   add everything looking like a "with_xxx" variable
  21.405 +    $re = '%{(with\_[\w\_]+)}';
  21.406 +    @defs = ($s =~ /$re/gm);
  21.407 +    foreach (@defs) {
  21.408 +        next if (exists($ovar->{$1}));
  21.409 +        $ovar->{$1} = '%{'.$1.'}'; # unexpanded
  21.410 +        $evar{$1} = '%{'.$1.'}';
  21.411 +    }
  21.412 +
  21.413 +    #   extract all conditional sections (#if/#else/#endif)
  21.414 +    @term = ();
  21.415 +    %var  = ();
  21.416 +    $cond = '';
  21.417 +    foreach $l (split(/\n/, $s)) {
  21.418 +        #   expand variables
  21.419 +        $v = vsub(\%avar, vsub(\%var, $l));
  21.420 +
  21.421 +        if (($p) = ($v =~ /^\#if\s+(.*?)\s*$/)) {
  21.422 +            #   normalize "%{variable}" != ..."
  21.423 +            $p =~ s/("\%\{[^}]+\}")\s*!=\s*"(yes|no)"/$1 . " == \"" . ($2 ne "yes" ? "yes" : "no") . "\""/sge;
  21.424 +
  21.425 +            #   normalize #if expressions
  21.426 +            #   - "%{variable}" == "yes"
  21.427 +            #   - "%{variable}" == "no"
  21.428 +            #   - operators ! && ||
  21.429 +            #   warn on:
  21.430 +            #   - operator !=
  21.431 +            #   - any other word
  21.432 +            $term = '';
  21.433 +            while ($p =~ m/(!=)|(\!|\|\||\&\&|\(|\))|"\%\{([^}]+)\}"\s*==\s*"(yes|no)"|(\S+)/g) {
  21.434 +                if (defined($1)) {
  21.435 +                    warn "openpkg:index:WARNING: unknown token '$1':\n< $l\n> $v";
  21.436 +                } elsif (defined($5)) {
  21.437 +                    warn "openpkg:index:WARNING: unknown token '$5':\n< $l\n> $v";
  21.438 +                } elsif (defined($2)) {
  21.439 +                    $term .= " $2 ";
  21.440 +                } elsif (exists($evar{$3})) {
  21.441 +                    $term .= ($4 eq 'no' ? '! ' : '').vsub(\%evar, '%{'.$3.'}');
  21.442 +                } else {
  21.443 +                    warn "openpkg:index:WARNING: unknown condition variable '$3':\n< $l\n> $v";
  21.444 +                }
  21.445 +            }
  21.446 +
  21.447 +            #   join with previous conditions for this #if/#endif block
  21.448 +            if ($term ne '') {
  21.449 +                push(@term, "( $term )");
  21.450 +                $cond = join(' && ', grep { $_ ne '' } @term) . '';
  21.451 +            } else {
  21.452 +                push(@term, '');
  21.453 +            }
  21.454 +        }
  21.455 +        elsif ($v =~ /^\#else\s*$/) {
  21.456 +            #   reverse last condition
  21.457 +            if (@term) {
  21.458 +                $term[-1] = ' ! '. $term[-1];
  21.459 +                $cond = join(' && ', grep { $_ ne '' } @term) . '';
  21.460 +            } else {
  21.461 +                die "openpkg:index:FATAL: \"else\" without \"if\"";
  21.462 +            }
  21.463 +        }
  21.464 +        elsif ($v =~ /^\#endif\s*$/) {
  21.465 +            #   unwind last #if expression
  21.466 +            pop(@term);
  21.467 +            $cond = join(' && ', grep { $_ ne '' } @term) . '';
  21.468 +        }
  21.469 +        elsif ($v =~ /^\#(?:define)\s*(\S+)\s*(.*?)\s*$/) {
  21.470 +            #   define conditional variables
  21.471 +            #   - truth-value becomes current condition
  21.472 +            #   define internal variables
  21.473 +            #   - store for subsequent substitution
  21.474 +            if (exists($evar{$1})) {
  21.475 +                if ($2 eq 'yes') {
  21.476 +                    if ($cond eq '') {
  21.477 +                        $evar{$1} = "( \%\{$1\} )";
  21.478 +                    } else {
  21.479 +                        $evar{$1} = "( \%\{$1\} || ( $cond ) )";
  21.480 +                    }
  21.481 +                } elsif ($2 eq 'no') {
  21.482 +                    if ($cond eq '') {
  21.483 +                        $evar{$1} = "( \%\{$1\} )";
  21.484 +                    } else {
  21.485 +                        $evar{$1} = "( %\{$1\} && ! ( $cond ) )";
  21.486 +                    }
  21.487 +                } else {
  21.488 +                    warn "openpkg:index:WARNING: logic too complex for '$1' (boolean expressions allowed only):\n< $l\n> $v";
  21.489 +                }
  21.490 +            } else {
  21.491 +                $var{$1} = $2;
  21.492 +            }
  21.493 +        }
  21.494 +        elsif ($v =~ /^\#(?:undefine)\s*(\S+)\s*$/) {
  21.495 +            #   undefine conditional variables
  21.496 +            #   undefine internal variables
  21.497 +            if (exists($evar{$1})) {
  21.498 +                $evar{$1} = "\%\{$1\}";
  21.499 +            } else {
  21.500 +                delete($var{$1});
  21.501 +            }
  21.502 +        }
  21.503 +        elsif ($v =~ /^\#(?:provides)\s*(\S+)\s*(.*?)\s*$/) {
  21.504 +            #   store option for current condition
  21.505 +            if (exists($attr{'Name'}->{''})) {
  21.506 +                push(@{$attr{'Provides'}->{$cond}}, {
  21.507 +                    resource => $attr{'Name'}->{''}->[0] . '::' . $1,
  21.508 +                    attrname => 'equ',
  21.509 +                    attrval  => optesc($2)
  21.510 +                });
  21.511 +            } else {
  21.512 +                warn "openpkg:index:ERROR: no package name set for option \"$1 = $2\"";
  21.513 +            }
  21.514 +        }
  21.515 +        elsif ($v =~ /^\#NoSource\s*(.*?)\s*$/) {
  21.516 +            #   store conditional NoSource attribute
  21.517 +            push(@{$attr{'NoSource'}->{$cond}}, commasep('NoSource', $1));
  21.518 +
  21.519 +        }
  21.520 +        elsif ($v =~ /^\s*([^\#]\S*)\s*:\s*(.*?)\s*$/) {
  21.521 +            #   store "attribute: value" headers for current condition
  21.522 +            push(@{$attr{$1}->{$cond}}, commasep($1,$2));
  21.523 +            $avar{lc($1)} = $2 if ($cond eq '');
  21.524 +        }
  21.525 +    }
  21.526 +
  21.527 +    #   return all header "attributes"
  21.528 +    return \%attr;
  21.529 +}
  21.530 +
  21.531 +#   split spec file into sections starting with a %word
  21.532 +#   - concatenate extended lines
  21.533 +#   - strip comment lines
  21.534 +#   - map %command to #command
  21.535 +#   - split sections
  21.536 +#   - return package2data() from default section (before first %xxx section)
  21.537 +sub spec2data ($) {
  21.538 +    my ($s) = @_;
  21.539 +    my (%map);
  21.540 +    my ($a, $o);
  21.541 +    my $spec = $s;
  21.542 +
  21.543 +    #   remove comments
  21.544 +    $s =~ s/^\s*#.*?\n//mg;
  21.545 +
  21.546 +    #   map commands
  21.547 +    $s =~ s/^%(ifdef|ifndef|if|NoSource|option|undefine|define|else|endif|\{)/#$1/mg;
  21.548 +
  21.549 +    #   split sections
  21.550 +    foreach (split(m/^(?=%\w+\s*\n)/m, $s)) {
  21.551 +        if (m/^%(\w+)\s*\n/) {
  21.552 +            $map{$1} .= $';
  21.553 +        } else {
  21.554 +            $map{'*'} .= $_;
  21.555 +        }
  21.556 +    }
  21.557 +
  21.558 +    #   translate package information into "data"
  21.559 +    if (exists($map{'description'})) {
  21.560 +        #   backward compatibility (options are in description)
  21.561 +        $o = find_options($map{'description'});
  21.562 +        $a = package2data($map{'*'}, $o );
  21.563 +        $a->{'Description'} = { '' => [ $map{'description'} ] };
  21.564 +    } else {
  21.565 +        #   standard case
  21.566 +        $a = package2data($map{'*'}, {});
  21.567 +    }
  21.568 +    return $a;
  21.569 +}
  21.570 +
  21.571 +#############################################################################
  21.572 +##
  21.573 +##  XML/RDF Generation
  21.574 +##
  21.575 +#############################################################################
  21.576 +
  21.577 +#   start of XML file
  21.578 +sub xml_head ($$) {
  21.579 +    my ($fh, $res) = @_;
  21.580 +    print $fh <<EOFEOF;
  21.581 +<?xml version="1.0" encoding="iso-8859-1"?>
  21.582 +<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  21.583 +         xmlns="http://www.openpkg.org/xml-rdf-index/0.9">
  21.584 +  <Repository rdf:resource="$res">
  21.585 +EOFEOF
  21.586 +}
  21.587 +
  21.588 +#   end of XML file, corresponds with start tags
  21.589 +sub xml_foot ($) {
  21.590 +    my($fh) = @_;
  21.591 +    print $fh <<EOFEOF;
  21.592 +  </Repository>
  21.593 +</rdf:RDF>
  21.594 +EOFEOF
  21.595 +}
  21.596 +
  21.597 +#   conditional expansion of attribute
  21.598 +sub n ($$) {
  21.599 +    my ($a, $k) = @_;
  21.600 +    return if (not $a->{$k});
  21.601 +    return if (not $a->{$k}->{''});
  21.602 +    return ($a->{$k}->{''}->[0]);
  21.603 +}
  21.604 +
  21.605 +#   send out $a->{$k} as text-style tag
  21.606 +sub xml_text ($$$;$) {
  21.607 +    my ($i, $a, $k, $tag) = @_;
  21.608 +    my ($out);
  21.609 +    return "" if (not exists($a->{$k}));
  21.610 +    $tag = $k if (not defined($tag));
  21.611 +    $i = ' ' x $i;
  21.612 +    $out = e(n($a, $k));
  21.613 +    return if $out eq '';
  21.614 +    return "$i<$tag>\n$out\n$i</$tag>\n";
  21.615 +}
  21.616 +
  21.617 +#   send out @{$a->{$k}} as body of an XML tag
  21.618 +#   $k is the name of the tag unless overridden by $tag
  21.619 +#   $i denotes the depth of indentation to form nicely
  21.620 +#   looking files.
  21.621 +#   all data from the list is flattened into a single
  21.622 +#   body, separated by LF and escaped for XML metachars.
  21.623 +sub xml_tag ($$$;$) {
  21.624 +    my ($i, $a, $k, $tag) = @_;
  21.625 +    my ($out, $cond, $upn);
  21.626 +    return "" if (not exists($a->{$k}));
  21.627 +    $tag = $k if (not defined($tag));
  21.628 +    $out = '';
  21.629 +    $i = ' ' x $i;
  21.630 +    foreach $cond (sort keys(%{$a->{$k}})) {
  21.631 +        $upn = e(upn($cond));
  21.632 +        $out .= $i .
  21.633 +            ($cond ne '' ? "<$tag cond=\"$upn\">" : "<$tag>") .
  21.634 +            join("\n", map { e($_) } @{$a->{$k}->{$cond}}) .
  21.635 +            "</$tag>\n";
  21.636 +    }
  21.637 +    return $out;
  21.638 +}
  21.639 +
  21.640 +#   send out @{$a->{$k}} as a rdf:bag
  21.641 +#   $k is the name of the outer tag unless overriden by $tag
  21.642 +#   $i denotes the depth of indentation, inner tags are indented
  21.643 +#   2 or 4 more character positions.
  21.644 +#   each element of the bag is listed
  21.645 +sub xml_bag ($$$;$) {
  21.646 +    my ($i, $a, $k, $tag) = @_;
  21.647 +    my ($out, $cond, $upn);
  21.648 +    return "" if (not exists($a->{$k}));
  21.649 +    $tag = $k if (not defined($tag));
  21.650 +    $out = '';
  21.651 +    $i = ' ' x $i;
  21.652 +    foreach $cond (sort keys %{$a->{$k}}) {
  21.653 +        next if (not @{$a->{$k}->{$cond}});
  21.654 +        $upn = e(upn($cond));
  21.655 +        $out .= $i .
  21.656 +                ($cond ne '' ? "<$tag cond=\"$upn\">\n" : "<$tag>\n") .
  21.657 +                "$i  <rdf:bag>\n" .
  21.658 +                join("",
  21.659 +                     map {
  21.660 +                         ref $_
  21.661 +                         ? "$i    <resource".
  21.662 +                           ( exists $_->{attrname}
  21.663 +                             ? " $_->{attrname}=\"".e($_->{attrval})."\""
  21.664 +                             : ""
  21.665 +                           ) .
  21.666 +                           ">".e($_->{resource})."</resource>\n"
  21.667 +                         : "$i    <rdf:li>".e($_)."</rdf:li>\n"
  21.668 +                     }
  21.669 +                     @{$a->{$k}->{$cond}}) .
  21.670 +                "$i  </rdf:bag>\n" .
  21.671 +                "$i</$tag>\n";
  21.672 +    }
  21.673 +    return $out;
  21.674 +}
  21.675 +
  21.676 +#   send out reference to another RDF
  21.677 +sub xml_reference ($$$$$$) {
  21.678 +    my($fh, $res, $href, $S, $T, $D) = @_;
  21.679 +    print $fh "    <Repository rdf:resource=\"$res\" href=\"$href\"";
  21.680 +    if ($opt_S && defined($S) && $S ne "") {
  21.681 +        print $fh " size=\"$S\"";
  21.682 +    }
  21.683 +    if ($opt_T && defined($T) && $T ne "") {
  21.684 +        print $fh " mtime=\"$T\"";
  21.685 +    }
  21.686 +    if ($opt_D && defined($D) && $D ne "") {
  21.687 +        print $fh " md5=\"$D\"";
  21.688 +    }
  21.689 +    print $fh "/>\n";
  21.690 +}
  21.691 +
  21.692 +#   send out reference to other resources
  21.693 +sub xml_other ($$$$$$) {
  21.694 +    my($fh, $about, $href, $S, $T, $D) = @_;
  21.695 +    print $fh "    <rdf:Description about=\"$about\" href=\"$href\"";
  21.696 +    if ($opt_S && defined($S) && $S ne "") {
  21.697 +        print $fh " size=\"$S\"";
  21.698 +    }
  21.699 +    if ($opt_T && defined($T) && $T ne "") {
  21.700 +        print $fh " mtime=\"$T\"";
  21.701 +    }
  21.702 +    if ($opt_D && defined($D) && $D ne "") {
  21.703 +        print $fh " md5=\"$D\"";
  21.704 +    }
  21.705 +    print $fh ">\n";
  21.706 +    print $fh "    </rdf:Description>\n";
  21.707 +}
  21.708 +
  21.709 +#   translate attributes from %$a as generated by package2data
  21.710 +#   into XML and write to file $fh
  21.711 +sub xml_record ($$$$$$) {
  21.712 +    my ($fh, $a, $href, $S, $T, $D) = @_;
  21.713 +    my ($maj, $min, $rel, $about);
  21.714 +
  21.715 +    $about =
  21.716 +        n($a, 'Name') . '-' .
  21.717 +        n($a, 'Version') . '-' .
  21.718 +        n($a, 'Release');
  21.719 +    if (not defined($href)) {
  21.720 +        #   guess location from Information in Specfile
  21.721 +        if (exists($a->{'NoSource'})) {
  21.722 +            $href = "$about.nosrc.rpm";
  21.723 +        } else {
  21.724 +            $href = "$about.src.rpm";
  21.725 +        }
  21.726 +        ($maj, $min, $rel) = (n($a, 'Release') =~ m/^(\d+)\.(\d+)\.(\d+)/);
  21.727 +        if (defined($min)) {
  21.728 +            if ($maj > 1 || ($maj == 1 && $min > 0)) {
  21.729 +                #   OpenPKG-1.1-RELEASE or later
  21.730 +                if (n($a, 'Distribution') =~ /\[PLUS\]/) {
  21.731 +                    $href = 'PLUS/'.$href;
  21.732 +                }
  21.733 +            }
  21.734 +            if ($maj > 1 || ($maj == 1 && $min >= 0)) {
  21.735 +                #   OpenPKG-1.0-RELEASE or later
  21.736 +                if ($rel > 0) {
  21.737 +                    $href = 'UPD/'.$href;
  21.738 +                }
  21.739 +            }
  21.740 +        } else {
  21.741 +            #   OpenPKG-CURRENT
  21.742 +        }
  21.743 +    }
  21.744 +
  21.745 +    print $fh "    <rdf:Description about=\"$about\" href=\"$href\"";
  21.746 +    if ($opt_S && defined($S) && $S ne "") {
  21.747 +        print $fh " size=\"$S\"";
  21.748 +    }
  21.749 +    if ($opt_T && defined($T) && $T ne "") {
  21.750 +        print $fh " mtime=\"$T\"";
  21.751 +    }
  21.752 +    if ($opt_D && defined($D) && $D ne "") {
  21.753 +        print $fh " md5=\"$D\"";
  21.754 +    }
  21.755 +    print $fh ">\n";
  21.756 +
  21.757 +    #   fake Source attribute from Source\d attribtutes
  21.758 +    #   XXX only default conditional
  21.759 +    $a->{'Source'} = { '' => [
  21.760 +        map {
  21.761 +            s/\Q%{name}\E/n($a, 'Name')/esg;
  21.762 +            s/\Q%{version}\E/n($a, 'Version')/esg;
  21.763 +            s/\Q%{release}\E/n($a, 'Release')/esg;
  21.764 +            $_;
  21.765 +        }
  21.766 +        map {
  21.767 +            $a->{$_}->{''} ? @{$a->{$_}->{''}} : ()
  21.768 +        }
  21.769 +        sort {
  21.770 +            my ($x) = ($a =~ /^(\d*)$/);
  21.771 +            my ($y) = ($b =~ /^(\d*)$/);
  21.772 +            return $x <=> $y;
  21.773 +        }
  21.774 +        grep {
  21.775 +            /^Source\d*$/
  21.776 +        } keys(%$a)
  21.777 +    ]};
  21.778 +    delete($a->{'Source'}) if (not @{$a->{'Source'}->{''}});
  21.779 +
  21.780 +    print $fh
  21.781 +        xml_tag(6,  $a, 'Name'),
  21.782 +        xml_tag(6,  $a, 'Version'),
  21.783 +        xml_tag(6,  $a, 'Release'),
  21.784 +        xml_tag(6,  $a, 'Distribution'),
  21.785 +        xml_tag(6,  $a, 'Class'),
  21.786 +        xml_tag(6,  $a, 'Group'),
  21.787 +        xml_tag(6,  $a, 'License'),
  21.788 +        xml_tag(6,  $a, 'Packager'),
  21.789 +        xml_tag(6,  $a, 'Summary'),
  21.790 +        xml_tag(6,  $a, 'URL'),
  21.791 +        xml_tag(6,  $a, 'Vendor'),
  21.792 +        xml_tag(6,  $a, 'SourceRPM'),
  21.793 +        xml_tag(6,  $a, 'Arch'),
  21.794 +        xml_tag(6,  $a, 'Os'),
  21.795 +        xml_tag(6,  $a, 'BuildHost'),
  21.796 +        xml_tag(6,  $a, 'BuildSystem'),
  21.797 +        xml_tag(6,  $a, 'BuildTime'),
  21.798 +        xml_tag(6,  $a, 'Relocations'),
  21.799 +        xml_tag(6,  $a, 'Size'),
  21.800 +        xml_tag(6,  $a, 'Prefixes'),
  21.801 +        xml_tag(6,  $a, 'Platform'),
  21.802 +        xml_tag(6,  $a, 'SigSize'),
  21.803 +        xml_tag(6,  $a, 'SigMD5'),
  21.804 +        xml_tag(6,  $a, 'SigPGP'),
  21.805 +        xml_tag(6,  $a, 'SigGPG'),
  21.806 +        xml_bag(6,  $a, 'BuildPreReq'),
  21.807 +        xml_bag(6,  $a, 'PreReq'),
  21.808 +        xml_bag(6,  $a, 'Provides'),
  21.809 +        xml_bag(6,  $a, 'Conflicts'),
  21.810 +        xml_bag(6,  $a, 'Source'),
  21.811 +        xml_bag(6,  $a, 'NoSource'),
  21.812 +        xml_bag(6,  $a, 'Filenames'),
  21.813 +        xml_text(6, $a, 'Description');
  21.814 +
  21.815 +    print $fh "    </rdf:Description>\n";
  21.816 +}
  21.817 +
  21.818 +#############################################################################
  21.819 +##
  21.820 +##  OpenPKG RPM Package Payload Extraction
  21.821 +##
  21.822 +#############################################################################
  21.823 +
  21.824 +#   extract foo.spec from foo-V-R.src.rpm file
  21.825 +sub rpm2spec ($) {
  21.826 +    my ($fn) = @_;
  21.827 +    local($SIG{'PIPE'}) = 'IGNORE';
  21.828 +    local(*PIPE);
  21.829 +    open(PIPE, "$R2C '$fn' |")
  21.830 +        or die "openpkg:index:FATAL: cannot read '$fn' ($!)\n";
  21.831 +    my ($buf, @hdr, $n, $m, $name, $step);
  21.832 +    my ($spec);
  21.833 +    while (read(PIPE, $buf, 110) == 110) {
  21.834 +        @hdr = unpack('a6a8a8a8a8a8a8a8a8a8a8a8a8a8', $buf);
  21.835 +        $n = hex($hdr[12]);      # filename length
  21.836 +        $m = int(($n+5)/4)*4-2;  # filename size (padded)
  21.837 +        last if (not (read(PIPE,$buf,$m) == $m));
  21.838 +        $name = substr($buf, 0, $n-1);
  21.839 +        $n = hex($hdr[7]);       # file length
  21.840 +        $m = int(($n+3)/4)*4;    # file size (padded)
  21.841 +        if ($name !~ m/.spec$/) {
  21.842 +            while ($m > 0) {
  21.843 +                $step = $m > 8192 ? 8192 : $m;
  21.844 +                last if (not read(PIPE,$buf,$step));
  21.845 +                $m -= length($buf);
  21.846 +            }
  21.847 +        } else {
  21.848 +            if (read(PIPE,$buf,$n) == $n) {
  21.849 +                $spec = $buf;
  21.850 +            }
  21.851 +            last;
  21.852 +        }
  21.853 +    }
  21.854 +    close(PIPE);
  21.855 +    return $spec;
  21.856 +}
  21.857 +
  21.858 +#############################################################################
  21.859 +##
  21.860 +##  OpenPKG RPM Package Header Extraction
  21.861 +##
  21.862 +#############################################################################
  21.863 +
  21.864 +#   extract header information from foo-V-R.src.rpm
  21.865 +sub rpm2data ($$) {
  21.866 +    my ($fn, $platform) = @_;
  21.867 +    my ($q, %a);
  21.868 +    my ($t, $v);
  21.869 +    local(*PIPE);
  21.870 +
  21.871 +    if (not defined($platform)) {
  21.872 +        die "openpkg:index:FATAL: indexing binary package '$fn' requires -p option\n";
  21.873 +    }
  21.874 +
  21.875 +    $q = <<EOFEOF;
  21.876 +Name %{Name}
  21.877 +Version %{Version}
  21.878 +Release %{Release}
  21.879 +URL %{URL}
  21.880 +Summary %{Summary}
  21.881 +Copyright %{Copyright}
  21.882 +License %{License}
  21.883 +Distribution %{Distribution}
  21.884 +Vendor %{Vendor}
  21.885 +Class %{Class}
  21.886 +Group %{Group}
  21.887 +Packager %{Packager}
  21.888 +Prefixes %{Prefixes}
  21.889 +BuildHost %{BuildHost}
  21.890 +BuildTime %{BuildTime}
  21.891 +Arch %{Arch}
  21.892 +Os %{Os}
  21.893 +Size %{Size}
  21.894 +SigSize %{SigSize}
  21.895 +SigMD5 %{SigMD5}
  21.896 +SigPGP %{SigPGP}
  21.897 +SigGPG %{SigGPG}
  21.898 +SourceRPM %{SourceRPM}
  21.899 +[Patch %{Patch}
  21.900 +]
  21.901 +[Source %{Source}
  21.902 +]
  21.903 +[Filenames %{Filenames}
  21.904 +]
  21.905 +[Conflicts %{CONFLICTNAME} %|CONFLICTFLAGS?{%{CONFLICTFLAGS:depflags} %{CONFLICTVERSION}}:{}|
  21.906 +]
  21.907 +[PreReq %{REQUIRENAME} %|REQUIREFLAGS?{%{REQUIREFLAGS:depflags} %{REQUIREVERSION}}:{}|
  21.908 +]
  21.909 +[Provides %{PROVIDENAME} %|PROVIDEFLAGS?{%{PROVIDEFLAGS:depflags} %{PROVIDEVERSION}}:{}|
  21.910 +]
  21.911 +Description %{Description}
  21.912 +EOFEOF
  21.913 +
  21.914 +    open(PIPE, "$RPM -qp --qf '$q' '$fn' |")
  21.915 +        or die "FATAL: cannot read '$fn' ($!)\n";
  21.916 +    while (<PIPE>) {
  21.917 +        if (/^(\S+)\s+(.*?)\s*$/) {
  21.918 +            $t = $1;
  21.919 +            $v = $2;
  21.920 +        } elsif (/^(\s+.+?)\s*$/) {
  21.921 +            next if (not defined($t));
  21.922 +            $v = $1;
  21.923 +        } else {
  21.924 +            $t = undef;
  21.925 +            next;
  21.926 +        }
  21.927 +        if (exists($a{$t})) {
  21.928 +            $a{$t} .= "\n$v";
  21.929 +        } else {
  21.930 +            $a{$t} = $v;
  21.931 +        }
  21.932 +    }
  21.933 +    close(PIPE);
  21.934 +
  21.935 +    %a = map { $_ => $a{$_} }
  21.936 +         grep { $a{$_} ne '(none)' }
  21.937 +         keys(%a);
  21.938 +    if ($a{'Relocations'} eq '(non relocatable)') {
  21.939 +        delete($a{'Relocations'});
  21.940 +    }
  21.941 +    if ($a{'SigMD5'} eq '(unknown type)') {
  21.942 +        delete($a{'SigMD5'});
  21.943 +    }
  21.944 +    if (defined($platform)) {
  21.945 +        $a{'Platform'} = $platform;
  21.946 +    }
  21.947 +    $a{'Description'} = [ $a{'Description'} ];
  21.948 +
  21.949 +    foreach ('Conflicts', 'PreReq', 'Provides') {
  21.950 +        $a{$_} = [
  21.951 +            map { &$make_resource($_) }
  21.952 +            grep { !/^rpmlib\(/ }
  21.953 +            split(/\n+/, $a{$_})
  21.954 +        ];
  21.955 +    }
  21.956 +
  21.957 +    return { map {
  21.958 +        $_ => { '' => (ref $a{$_} ? $a{$_} : [ split(/\n+/, $a{$_}) ]) }
  21.959 +    } keys(%a) };
  21.960 +}
  21.961 +
  21.962 +#############################################################################
  21.963 +##
  21.964 +##  OpenPKG XML/RDF Index Locating
  21.965 +##
  21.966 +#############################################################################
  21.967 +
  21.968 +#   detect index files
  21.969 +sub getindex ($) {
  21.970 +    my ($dir) = @_;
  21.971 +    my (@idx) =
  21.972 +        sort { -M $a <=> -M $b; }
  21.973 +        grep { -f $_ }
  21.974 +        ( <$dir/00INDEX.rdf>, <$dir/00INDEX.rdf.*> );
  21.975 +    return if (not @idx);
  21.976 +    return $idx[0];
  21.977 +}
  21.978 +
  21.979 +#   list RPM directories of unpacked .spec files
  21.980 +sub list_specdir ($) {
  21.981 +    my ($dir) = @_;
  21.982 +    my ($d, $path);
  21.983 +    my (@list);
  21.984 +
  21.985 +    local(*DH);
  21.986 +    opendir(DH, $dir);
  21.987 +    while ($d = readdir(DH)) {
  21.988 +        next if ($d =~ m/^\./);
  21.989 +        $path = "$dir/$d/$d.spec";
  21.990 +        push(@list, $path) if (-f $path);
  21.991 +    }
  21.992 +    closedir(DH);
  21.993 +    return \@list;
  21.994 +}
  21.995 +
  21.996 +#   list index or RPM file directories
  21.997 +sub list_rpmdir ($) {
  21.998 +    my ($dir) = @_;
  21.999 +    my ($d, $path);
 21.1000 +    my (@list, $idx, $sub);
 21.1001 +
 21.1002 +    local(*DH);
 21.1003 +    opendir(DH, $dir);
 21.1004 +    while ($d = readdir(DH)) {
 21.1005 +        next if ($d =~ m/^\./);
 21.1006 +        $path = "$dir/$d";
 21.1007 +        if (-d $path) {
 21.1008 +            $idx = getindex($path);
 21.1009 +            if (defined($idx)) {
 21.1010 +                push(@list, $idx);
 21.1011 +            } else {
 21.1012 +                $sub = list_rpmdir($path);
 21.1013 +                push(@list, @$sub);
 21.1014 +                undef $sub;
 21.1015 +            }
 21.1016 +        } else {
 21.1017 +            next if (not ($d =~ m/\.(?:rpm|sh)$/ && -f $path));
 21.1018 +            push(@list, $path);
 21.1019 +        }
 21.1020 +    }
 21.1021 +    closedir(DH);
 21.1022 +    return \@list;
 21.1023 +}
 21.1024 +
 21.1025 +#############################################################################
 21.1026 +##
 21.1027 +##  OpenPKG XML/RDF Index Reading
 21.1028 +##
 21.1029 +#############################################################################
 21.1030 +
 21.1031 +#   fetch a whole file
 21.1032 +sub readfile ($) {
 21.1033 +    my ($fn) = @_;
 21.1034 +    local(*FH);
 21.1035 +    open(FH, "< $fn")
 21.1036 +        or die "FATAL: cannot read '$fn' ($!)\n";
 21.1037 +    my $l; { local $/; $l = <FH>; }
 21.1038 +    close(FH);
 21.1039 +    return $l;
 21.1040 +}
 21.1041 +
 21.1042 +#   create relative path by stripping instance prefix
 21.1043 +sub relpath ($$) {
 21.1044 +    my ($prefix, $path) = @_;
 21.1045 +    $path =~ s/^\Q$prefix\E\///s;
 21.1046 +    return $path;
 21.1047 +}
 21.1048 +
 21.1049 +#   create directory path with trailing slash
 21.1050 +sub dirname ($) {
 21.1051 +    my ($path) = @_;
 21.1052 +    $path =~ s/\/[^\/]*$//s;
 21.1053 +    return $path.'/';
 21.1054 +}
 21.1055 +
 21.1056 +#   peek at resource identifier of index file
 21.1057 +sub getresource ($) {
 21.1058 +    my ($fn) = @_;
 21.1059 +    my ($fh, $buf);
 21.1060 +
 21.1061 +    local(*FH);
 21.1062 +    if ($fn =~ /\.bz2$/) {
 21.1063 +        open(FH, "$BZ -dc $fn |")
 21.1064 +            or die "FATAL: cannot read '$fn' ($!)\n";
 21.1065 +    } else {
 21.1066 +        open(FH, "< $fn")
 21.1067 +            or die "FATAL: cannot read '$fn' ($!)\n";
 21.1068 +    }
 21.1069 +    read(FH, $buf, 1024);
 21.1070 +    close(FH);
 21.1071 +    if ($buf =~ /<Repository.*?rdf:resource="([^"]+)"/) {
 21.1072 +        return $1;
 21.1073 +    }
 21.1074 +    return undef;
 21.1075 +}
 21.1076 +
 21.1077 +#############################################################################
 21.1078 +##
 21.1079 +##  OpenPKG XML/RDF Index Output Generation
 21.1080 +##
 21.1081 +#############################################################################
 21.1082 +
 21.1083 +sub sizetime ($) {
 21.1084 +    my ($file) = @_;
 21.1085 +    my @stat = stat($file);
 21.1086 +    return ($stat[7], $stat[9]);
 21.1087 +}
 21.1088 +
 21.1089 +sub digest ($) {
 21.1090 +    my ($file) = @_;
 21.1091 +    my $digest = "";
 21.1092 +    my $output = `($OPENSSL md5 -hex "$file") 2>/dev/null || true`;
 21.1093 +    if ($output =~ m/MD5\(.+?\)=\s*([0-9a-fA-F]+)/s) {
 21.1094 +        $digest = uc($1);
 21.1095 +    }
 21.1096 +    return $digest;
 21.1097 +}
 21.1098 +
 21.1099 +sub write_index ($$$$$$) {
 21.1100 +    my ($fh, $prefix, $resource, $platform, $list, $cache) = @_;
 21.1101 +    my ($a, $h, $r, $spec, $T, $D);
 21.1102 +
 21.1103 +    foreach (@$list) {
 21.1104 +        $a = undef;
 21.1105 +        $h = undef;
 21.1106 +        $r = undef;
 21.1107 +        $S = undef;
 21.1108 +        $T = undef;
 21.1109 +        $D = undef;
 21.1110 +        $o = undef;
 21.1111 +
 21.1112 +        #   determine information
 21.1113 +        if (m/\.spec$/) {
 21.1114 +            $spec = readfile($_);
 21.1115 +            $a = spec2data($spec);
 21.1116 +            ($S, $T) = sizetime($_) if ($opt_S or $opt_T);
 21.1117 +            $D = digest($_) if ($opt_D);
 21.1118 +        } elsif (m/([^\/]+\.(?:no)?src\.rpm)$/) {
 21.1119 +            $h = relpath($prefix, $_);
 21.1120 +            ($S, $T) = sizetime($_) if ($opt_S or $opt_T or $cache);
 21.1121 +            if ($cache) {
 21.1122 +                if (   exists($cache->{"T$_"})
 21.1123 +                    && $cache->{"T$_"} == $T
 21.1124 +                    && exists($cache->{"s$_"})
 21.1125 +                    && $cache->{"s$_"} ne ""
 21.1126 +                    && (!$opt_S || ($opt_S && exists($cache->{"S$_"}) && $cache->{"S$_"} ne ""))
 21.1127 +                    && (!$opt_D || ($opt_D && exists($cache->{"D$_"}) && $cache->{"D$_"} ne ""))) {
 21.1128 +                    #   found in cache
 21.1129 +                    $spec = $cache->{"s$_"};
 21.1130 +                    $S = $cache->{"S$_"} if ($opt_S);
 21.1131 +                    $D = $cache->{"D$_"} if ($opt_D);
 21.1132 +                } else {
 21.1133 +                    #   not found in cache
 21.1134 +                    $spec = rpm2spec($_);
 21.1135 +                    $cache->{"s$_"} = $spec;
 21.1136 +                    $cache->{"S$_"} = $S;
 21.1137 +                    $cache->{"T$_"} = $T;
 21.1138 +                    $D = digest($_)      if ($opt_D);
 21.1139 +                    $cache->{"D$_"} = $D if ($opt_D);
 21.1140 +                }
 21.1141 +            } else {
 21.1142 +                #   no cache at all
 21.1143 +                $spec = rpm2spec($_);
 21.1144 +                $D = digest($_) if ($opt_D);
 21.1145 +            }
 21.1146 +            $a = spec2data($spec);
 21.1147 +        } elsif (m/([^\/]+\.rpm)$/) {
 21.1148 +            $h = relpath($prefix, $_);
 21.1149 +            $a = rpm2data($_, $platform);
 21.1150 +            ($S, $T) = sizetime($_) if ($opt_S or $opt_T);
 21.1151 +            $D = digest($_) if ($opt_D);
 21.1152 +        } elsif (m/(([^\/]+)\.(?:no)?src\.sh)$/) {
 21.1153 +            $h = relpath($prefix, $_);
 21.1154 +            ($S, $T) = sizetime($_) if ($opt_S or $opt_T);
 21.1155 +            $D = digest($_) if ($opt_D);
 21.1156 +            $o = "$2:bootstrap";
 21.1157 +        } elsif (m/([^\/]+\.rdf[^\/]*)$/) {
 21.1158 +            $h = relpath($prefix, $_);
 21.1159 +            $r = getresource($_) || $resource.dirname($h);
 21.1160 +            ($S, $T) = sizetime($_) if ($opt_S or $opt_T);
 21.1161 +            $D = digest($_) if ($opt_D);
 21.1162 +        }
 21.1163 +
 21.1164 +        #   process information
 21.1165 +        if ($a) {
 21.1166 +            xml_record($fh, $a, $h, $S, $T, $D);
 21.1167 +        } elsif ($o) {
 21.1168 +            xml_other($fh, $o, $h, $S, $T, $D);
 21.1169 +        } elsif ($r) {
 21.1170 +            xml_reference($fh, $r, $h, $S, $T, $D);
 21.1171 +        } else {
 21.1172 +            warn "openpkg:index:ERROR: cannot process $_";
 21.1173 +        }
 21.1174 +    }
 21.1175 +}
 21.1176 +
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/openpkg/index.pod	Tue Jul 31 12:23:42 2012 +0200
    22.3 @@ -0,0 +1,133 @@
    22.4 +##
    22.5 +##  index.pod -- OpenPKG Package Indexing
    22.6 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    22.7 +##
    22.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    22.9 +##  All rights reserved. Licenses which grant limited permission to use,
   22.10 +##  copy, modify and distribute this software are available from the
   22.11 +##  OpenPKG GmbH.
   22.12 +##
   22.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   22.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   22.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   22.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   22.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   22.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   22.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   22.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   22.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   22.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   22.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   22.24 +##  SUCH DAMAGE.
   22.25 +##
   22.26 +
   22.27 +=pod
   22.28 +
   22.29 +=head1 NAME
   22.30 +
   22.31 +B<openpkg index> - B<OpenPKG> Package Indexing
   22.32 +
   22.33 +=head1 SYNOPSIS
   22.34 +
   22.35 +B<openpkg>
   22.36 +B<index>
   22.37 +[B<-r> I<resource>]
   22.38 +[B<-p> I<platform>]
   22.39 +[B<-S>]
   22.40 +[B<-T>]
   22.41 +[B<-D>]
   22.42 +[B<-C> I<cache.db>]
   22.43 +[B<-o> I<index.rdf>]
   22.44 +[B<-c>]
   22.45 +[B<-i>]
   22.46 +I<dir> ...
   22.47 +
   22.48 +=head1 DESCRIPTION
   22.49 +
   22.50 +The B<openpkg index> tool is a frontend for indexing of RPM files. It
   22.51 +creates an XML/RDF based resource index for RPM F<.spec> files in a
   22.52 +source tree or from an RPM package repository. The index holds enough
   22.53 +information to support an automated build process by B<openpkg build>.
   22.54 +
   22.55 +=head1 OPTIONS
   22.56 +
   22.57 +The following command line options exist:
   22.58 +
   22.59 +=over 4
   22.60 +
   22.61 +=item B<-r> I<resource>
   22.62 +
   22.63 +The name of the resource stored in the index. The default is
   22.64 +"C<OpenPKG-CURRENT/Source/>".
   22.65 +
   22.66 +=item B<-p> I<platform>
   22.67 +
   22.68 +B<openpkg index> adds a platform attribute for binary RPMs. This
   22.69 +must be unique to correctly identify a specific architecture, OS
   22.70 +and build environment.
   22.71 +
   22.72 +=item B<-S>
   22.73 +
   22.74 +Optionally determines and stores the size (in bytes) of each indexed file.
   22.75 +This is not required for the correct operation of the B<openpkg build> command, but
   22.76 +the B<openpkg mirror> command requires it.
   22.77 +
   22.78 +=item B<-T>
   22.79 +
   22.80 +Optionally determines and stores the modification time (C<mtime>) of each indexed file.
   22.81 +This is not required for the correct operation of the B<openpkg build> command, but
   22.82 +the B<openpkg mirror> command requires it.
   22.83 +
   22.84 +=item B<-D>
   22.85 +
   22.86 +Optionally determines and stores the message digest (C<md5>) of each indexed file.
   22.87 +This is not required for the correct operation of the B<openpkg build> command, but
   22.88 +the B<openpkg mirror> command requires it.
   22.89 +
   22.90 +=item B<-C> I<cache.db>
   22.91 +
   22.92 +Cache all F<.spec> files into this Berkeley-DB file when indexing source
   22.93 +RPMs. The cache is refreshed automatically when the source RPMs are more
   22.94 +recent than the cache entry. The B<-C> option requires an installed
   22.95 +DB_File perl module.
   22.96 +
   22.97 +=item B<-o> I<index.rdf>
   22.98 +
   22.99 +Name of the output XML/RDF file, default is to write to F<stdout>.
  22.100 +
  22.101 +=item B<-c>
  22.102 +
  22.103 +Compress output with C<bzip2>. Use the B<-o> option to specify a F<.bz2>
  22.104 +suffix.
  22.105 +
  22.106 +=item B<-i>
  22.107 +
  22.108 +The specified directories are RPM repositories. Build index over
  22.109 +all F<.rpm> files in these directories and all subdirectories.
  22.110 +If a subdirectory already contains a C<00INDEX.rdf> or C<00INDEX.rdf.*>
  22.111 +file then skip scanning the subdirectory, instead add a reference
  22.112 +to the index file into the new index.
  22.113 +
  22.114 +Without this option the directories are source trees with a subdirectory
  22.115 +per package and a I<package>C<.spec> file inside each subdirectory.
  22.116 +
  22.117 +=back
  22.118 +
  22.119 +=head1 SEE ALSO
  22.120 +
  22.121 +rpm(8).
  22.122 +
  22.123 +=head1 HISTORY
  22.124 +
  22.125 +The B<openpkg index> command was invented in November 2002 by I<Michael
  22.126 +van Elst> E<lt>mlelstv@serpens.deE<gt> under contract with I<Cable
  22.127 +& Wireless> E<lt>http://www.cw.com/E<gt> for use inside the B<OpenPKG>
  22.128 +project E<lt>http://www.openpkg.org/E<gt>.
  22.129 +
  22.130 +=head1 AUTHORS
  22.131 +
  22.132 + Michael van Elst
  22.133 + mlelstv@serpens.de
  22.134 +
  22.135 +=cut
  22.136 +
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/openpkg/libarchive.patch	Tue Jul 31 12:23:42 2012 +0200
    23.3 @@ -0,0 +1,33 @@
    23.4 +Index: Makefile.in
    23.5 +--- Makefile.in.orig	2011-12-24 19:05:17.000000000 +0100
    23.6 ++++ Makefile.in	2011-12-26 08:30:54.000000000 +0100
    23.7 +@@ -1091,7 +1091,7 @@
    23.8 + lib_LTLIBRARIES = libarchive.la
    23.9 + noinst_LTLIBRARIES = libarchive_fe.la
   23.10 + man_MANS = $(libarchive_man_MANS) $(bsdtar_man_MANS) $(bsdcpio_man_MANS)
   23.11 +-BUILT_SOURCES = libarchive/test/list.h tar/test/list.h cpio/test/list.h
   23.12 ++BUILT_SOURCES =
   23.13 + TESTS_ENVIRONMENT = $(libarchive_TESTS_ENVIRONMENT) $(bsdtar_TESTS_ENVIRONMENT) $(bsdcpio_TESTS_ENVIRONMENT)
   23.14 + # Always build and test both bsdtar and bsdcpio as part of 'distcheck'
   23.15 + DISTCHECK_CONFIGURE_FLAGS = --enable-bsdtar --enable-bsdcpio
   23.16 +Index: cpio/cmdline.c
   23.17 +--- cpio/cmdline.c.orig	2011-12-24 18:56:24.000000000 +0100
   23.18 ++++ cpio/cmdline.c	2011-12-26 08:29:08.000000000 +0100
   23.19 +@@ -56,7 +56,7 @@
   23.20 + /*
   23.21 +  * Long options for cpio.  Please keep this sorted.
   23.22 +  */
   23.23 +-static const struct option {
   23.24 ++static const struct libarchive_option {
   23.25 + 	const char *name;
   23.26 + 	int required;	/* 1 if this option requires an argument */
   23.27 + 	int equivalent;	/* Equivalent short option. */
   23.28 +@@ -104,7 +104,7 @@
   23.29 + 	static int state = state_start;
   23.30 + 	static char *opt_word;
   23.31 + 
   23.32 +-	const struct option *popt, *match = NULL, *match2 = NULL;
   23.33 ++	const struct libarchive_option *popt, *match = NULL, *match2 = NULL;
   23.34 + 	const char *p, *long_prefix = "--";
   23.35 + 	size_t optlength;
   23.36 + 	int opt = '?';
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/openpkg/license-BOOT.txt	Tue Jul 31 12:23:42 2012 +0200
    24.3 @@ -0,0 +1,271 @@
    24.4 +-----BEGIN PGP SIGNED MESSAGE-----
    24.5 +Hash: SHA1
    24.6 +
    24.7 +Id:       BOOT
    24.8 +Name:     OpenPKG Framework Bootstrap License
    24.9 +Version:  1.0.0
   24.10 +Issuer:   OpenPKG GmbH <openpkg@openpkg.com>
   24.11 +Issued:   2010-01-01
   24.12 +
   24.13 +Licensee: arbitrary deployer of OpenPKG Framework
   24.14 +          with this run-time license activated
   24.15 +
   24.16 +Description:
   24.17 +
   24.18 +    OPENPKG FRAMEWORK BOOTSTRAP LICENSE
   24.19 +    ===================================
   24.20 +
   24.21 +    This license agreement constitutes a valid and binding agreement
   24.22 +    between the OpenPKG GmbH, jurisdiction identification "DE MUC HRB
   24.23 +    160208", postal address "Weblinger Weg 28, 85221 Dachau, GERMANY",
   24.24 +    digital signature name "OpenPKG GmbH <openpkg@openpkg.com>" and
   24.25 +    digital signature fingerprint "7D12 1A8F C05D C18A 4329 E9EF 6704
   24.26 +    2EC9 61B7 AE34", represented by the two managing directors Ralf S.
   24.27 +    Engelschall and Thomas Lotterer, and you, the licensee.
   24.28 +
   24.29 +    "You" means the natural person or the entity that is agreeing to be
   24.30 +    bound by this agreement. You shall be liable for any failure by your
   24.31 +    employees and third party contractors that provide services to you
   24.32 +    to comply with the terms and conditions of this agreement.
   24.33 +
   24.34 +    AGREEMENT
   24.35 +    ---------
   24.36 +
   24.37 +    By using, copying, modifying or distributing the Product you agree
   24.38 +    to be bound by the terms and conditions of this agreement. If you
   24.39 +    are accepting these terms on behalf of another person or a company
   24.40 +    or other legal entity, you represent and warrant that you have full
   24.41 +    authority to bind that person, company, or legal entity to these
   24.42 +    terms. If you do not agree to the terms and conditions of this
   24.43 +    agreement, you may not use, copy, modify or distribute the Product.
   24.44 +    You may return the unused Product to the supplier from which you
   24.45 +    acquired it within 30 days and request a refund of the license fee,
   24.46 +    if any, already paid upon showing proof of payment.
   24.47 +
   24.48 +    TERMINOLOGY
   24.49 +    -----------
   24.50 +
   24.51 +    OpenPKG is a solution to build software stacks consisting of OpenPKG
   24.52 +    Packages and an OpenPKG Framework to operate them.
   24.53 +
   24.54 +    For your information, OpenPKG Packages are available from the
   24.55 +    OpenPKG Foundation e.V., which licenses and distributes them as Open
   24.56 +    Source Software. These OpenPKG Packages are in no way subject of
   24.57 +    this agreement.
   24.58 +
   24.59 +    The OpenPKG Framework is a property of the OpenPKG GmbH with all
   24.60 +    rights reserved. Licenses, like this one, which grant limited
   24.61 +    permission to use, copy, modify and distribute this software are
   24.62 +    exclusively issued by the OpenPKG GmbH.
   24.63 +
   24.64 +    Licensing as described in this agreement covers the OpenPKG
   24.65 +    Framework code copyrighted by the OpenPKG GmbH and the OpenPKG
   24.66 +    Framework as a compound work. The OpenPKG Framework is distributed
   24.67 +    in source code form and also contains pristine third-party sources
   24.68 +    where each comes with its own licensing model. These licenses are
   24.69 +    in no way altered by this agreement, but passed through to you
   24.70 +    verbatim. You are responsible for obtaining and obeying any such
   24.71 +    vendor license.
   24.72 +
   24.73 +    This license describes how you appropriately use, copy, modify
   24.74 +    and distribute the OpenPKG Framework source code and the binaries
   24.75 +    resulting from the build process. This license does not include any
   24.76 +    entitlement for you to receive service or support from the OpenPKG
   24.77 +    GmbH, there are no warranties beyond the minimum implied warranty,
   24.78 +    and there are no promises with respect to the future of the Product
   24.79 +    or any derived works.
   24.80 +
   24.81 +    GRANT OF RIGHTS GENERAL TERMS
   24.82 +    -----------------------------
   24.83 +
   24.84 +    The OpenPKG Framework is licensed, not sold. Subject to the terms
   24.85 +    and conditions of this agreement, the OpenPKG GmbH hereby grants
   24.86 +    you a non-exclusive, non-sub-licensable and non-transferable right
   24.87 +    to use the Product. You may not lease or rent the OpenPKG Framework
   24.88 +    license.
   24.89 +
   24.90 +    You may sell or otherwise transfer unused licenses if you ensure
   24.91 +    the recipient receives these terms and conditions with the same
   24.92 +    transaction and acknowledges to take over your responsibilities from
   24.93 +    this agreement.
   24.94 +
   24.95 +    You may not remove any titles, trademarks or trade names, copyright
   24.96 +    notices, legends, or other proprietary markings on the Product. You
   24.97 +    are not granted any rights to any trademarks or service marks of the
   24.98 +    OpenPKG GmbH. All rights not expressly granted by this license are
   24.99 +    reserved.
  24.100 +
  24.101 +    You may use the Product as long as you own this license issued by
  24.102 +    the OpenPKG GmbH, install it and obey the terms and conditions
  24.103 +    listed below. This license, issued by the OpenPKG GmbH, ships
  24.104 +    as a digitally signed text file which carries the exact license
  24.105 +    conditions both in human readable plain text and attached in a
  24.106 +    machine readable format. The latter may be used by the OpenPKG
  24.107 +    Framework to programmatically validate the license compliance. If
  24.108 +    programmatic license validation within the OpenPKG Framework detects
  24.109 +    a compliance failure, the OpenPKG Framework might cease operation.
  24.110 +    It is your responsibility to ensure compliance with these terms and
  24.111 +    conditions.
  24.112 +
  24.113 +    GRANT OF RIGHTS TO USE THE OPENPKG FRAMEWORK
  24.114 +    --------------------------------------------
  24.115 +
  24.116 +    This "bootstrap" license ships free of charge with every OpenPKG
  24.117 +    Framework and allows restricted use of the OpenPKG Framework. The
  24.118 +    constraint is a run-time limitation of the RPM database to contain
  24.119 +    only the "openpkg" package and GPG keys, a situation typical during
  24.120 +    and immediately after bootstrapping. The license does not impose
  24.121 +    any life-time limitation.
  24.122 +
  24.123 +    GRANT OF RIGHTS TO COPY THE OPENPKG FRAMEWORK
  24.124 +    ---------------------------------------------
  24.125 +
  24.126 +    You may create an unlimited number of copies of the Product.
  24.127 +
  24.128 +    GRANT OF RIGHTS TO MODIFY THE OPENPKG FRAMEWORK
  24.129 +    -----------------------------------------------
  24.130 +
  24.131 +    You may modify most parts of the Product and adjust it to your
  24.132 +    needs, creating derivative works. You may not remove license
  24.133 +    validation code, and you must ensure the preservation of the OpenPKG
  24.134 +    GmbH fingerprint data. The copyright notice, the license excerpt and
  24.135 +    the reference to this terms and conditions must be kept verbatim.
  24.136 +    You must make clear to the recipient of the derived works that the
  24.137 +    version he is receiving has been modified and by whom.
  24.138 +
  24.139 +    These terms and conditions stay if force for derivative works. To
  24.140 +    keep modifications your property you must not distribute them, in
  24.141 +    source or binary form, beyond your organizational scope. In cases
  24.142 +    of extended distribution or publication you agree to contribute
  24.143 +    your modifications automatically, free of charge and without any
  24.144 +    royalty claims, to the OpenPKG GmbH, transfer the source code of
  24.145 +    your modifications to the OpenPKG GmbH and irrevocably transfer
  24.146 +    all rights of your modifications to the OpenPKG GmbH which will
  24.147 +    grant you unlimited use rights to your contribution. There is no
  24.148 +    promise the OpenPKG GmbH includes your contribution into the OpenPKG
  24.149 +    Framework.
  24.150 +
  24.151 +    GRANT OF RIGHTS TO DISTRIBUTE THE OPENPKG FRAMEWORK
  24.152 +    ---------------------------------------------------
  24.153 +
  24.154 +    You may distribute the Product, or derivative works thereof created
  24.155 +    under adherence of the "rights to modify" grant, if you ensure
  24.156 +    the recipient receives these terms and conditions with the same
  24.157 +    transaction.
  24.158 +
  24.159 +    ONLINE ACCESS
  24.160 +    -------------
  24.161 +
  24.162 +    The OpenPKG Framework collects information about the OpenPKG
  24.163 +    Framework, OpenPKG Framework License and OpenPKG Packages for use
  24.164 +    by the OpenPKG Project, the OpenPKG Foundation e.V. and the OpenPKG
  24.165 +    GmbH. The programmatic license validation might and the information
  24.166 +    upload process does require online access to the Internet. You agree
  24.167 +    to grant the OpenPKG Framework permission for this use case and you
  24.168 +    assume all costs related to the online access.
  24.169 +
  24.170 +    TERMINATION
  24.171 +    -----------
  24.172 +
  24.173 +    You may not use the OpenPKG Framework except as expressly
  24.174 +    provided under the license. Any attempt to otherwise use, copy,
  24.175 +    modify, distribute or sub-license the Product is void, and will
  24.176 +    automatically terminate your rights under this license.
  24.177 +
  24.178 +    CHANGE
  24.179 +    ------
  24.180 +
  24.181 +    The OpenPKG GmbH reserves the right to subsequently modify or amend
  24.182 +    details of these terms and conditions where this seems applicable,
  24.183 +    as long as you are, in good faith, not disadvantaged thereby.
  24.184 +
  24.185 +    Those changes or amendments of the terms and conditions will be
  24.186 +    proclaimed to you by a written document, delivered to you in
  24.187 +    electronic format or paper mail as chosen by the OpenPKG GmbH.
  24.188 +    Anonymous and unknown users cannot be contacted by the OpenPKG GmbH.
  24.189 +    They must review the terms and conditions regularly at the same time
  24.190 +    they obtain or use an updated OpenPKG Framework. You cannot rise an
  24.191 +    objection against the proclaimed changes or amendments. However, you
  24.192 +    can terminate the license agreement without prior notice.
  24.193 +
  24.194 +    DISCLAIMER
  24.195 +    ----------
  24.196 +
  24.197 +    THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
  24.198 +    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  24.199 +    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  24.200 +    IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  24.201 +    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24.202 +    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24.203 +    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  24.204 +    USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24.205 +    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  24.206 +    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  24.207 +    OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  24.208 +    SUCH DAMAGE.
  24.209 +
  24.210 +    LIMITED WARRANTY AND LIMITATION OF LIABILITY
  24.211 +    --------------------------------------------
  24.212 +
  24.213 +    The OpenPKG GmbH is only liable for damages if the OpenPKG GmbH
  24.214 +    or one of its vicarious agents has violated a major contractual
  24.215 +    (cardinal) obligation or jeopardized the intention of the agreement
  24.216 +    or the damage was done by gross negligence or intention of the
  24.217 +    OpenPKG GmbH or one of its vicarious agents.
  24.218 +
  24.219 +    In case the violation of a cardinal obligation is not caused by
  24.220 +    gross negligence or intention of the OpenPKG GmbH or one of its
  24.221 +    vicarious agents the liability of the OpenPKG GmbH is limited to the
  24.222 +    predictable damage characteristical for the contract.
  24.223 +
  24.224 +    The preceding liability limitations apply for contractual and
  24.225 +    non-contractual claims. The liability of the OpenPKG GmbH due to
  24.226 +    warranties, personal injury and due to the German Product Liability
  24.227 +    Act remains unaffected from the preceding liability limitations.
  24.228 +
  24.229 +    GENERAL
  24.230 +    -------
  24.231 +
  24.232 +    This agreement sets forth the OpenPKG GmbH's entire liability and
  24.233 +    your exclusive remedy with respect to the Product and supersedes
  24.234 +    the terms of any purchase orders and any other communications or
  24.235 +    advertising with respect to the Product. You acknowledge that this
  24.236 +    agreement is a complete statement of the agreement between you
  24.237 +    and the OpenPKG GmbH with respect to the Product, and that there
  24.238 +    are no other prior or contemporaneous understandings, promises,
  24.239 +    representations, or descriptions with respect to the Product.
  24.240 +
  24.241 +    Headings under this agreement are intended only for convenience and
  24.242 +    shall not affect the interpretation of this agreement.
  24.243 +
  24.244 +    No failure of either party to exercise or enforce any of its rights
  24.245 +    under this agreement will act as a waiver of those rights. This
  24.246 +    agreement may only be modified, or any rights under it waived, by a
  24.247 +    written document executed by the party against which it is asserted.
  24.248 +
  24.249 +    If any provision of this agreement is found illegal or
  24.250 +    unenforceable, it will be enforced to the maximum extent
  24.251 +    permissible, and the legality and enforceability of the other
  24.252 +    provisions of this agreement will not be affected.
  24.253 +
  24.254 +    This agreement is governed by German law.
  24.255 +
  24.256 +    If you have any questions about this agreement please contact the
  24.257 +    OpenPKG GmbH. Direct all traditional paper correspondence to the
  24.258 +    official company address as listed in the very first paragraph of
  24.259 +    this document. You find the most recent contact information on our
  24.260 +    website http://openpkg.com/
  24.261 +
  24.262 +    You can find the most recent version of this document on our website
  24.263 +    http://openpkg.com/go/framework-license
  24.264 +
  24.265 +Assertion-MinProcVersion: 0.9.0
  24.266 +Assertion-PackageNames:   .*:^(openpkg|gpg-pubkey)$
  24.267 +
  24.268 +-----BEGIN PGP SIGNATURE-----
  24.269 +Comment: OpenPKG GmbH <openpkg@openpkg.com>
  24.270 +
  24.271 +iEYEARECAAYFAktAcNsACgkQZwQuyWG3rjSDIwCgzD8svM5KrsKGPLhOq08f2JLb
  24.272 +WlsAoNBKLE86nU3K78PY9k3ZHl1+CME0
  24.273 +=1xzZ
  24.274 +-----END PGP SIGNATURE-----
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/openpkg/license-COMMUNITY.txt	Tue Jul 31 12:23:42 2012 +0200
    25.3 @@ -0,0 +1,1063 @@
    25.4 +-----BEGIN PGP SIGNED MESSAGE-----
    25.5 +Hash: SHA1
    25.6 +
    25.7 +Id:       COMMUNITY
    25.8 +Name:     OpenPKG Framework Community License
    25.9 +Version:  1.0.0
   25.10 +Issuer:   OpenPKG GmbH <openpkg@openpkg.com>
   25.11 +Issued:   2012-05-12
   25.12 +
   25.13 +Licensee: arbitrary deployer of OpenPKG Framework
   25.14 +          with this run-time license activated
   25.15 +
   25.16 +Description:
   25.17 +
   25.18 +    OPENPKG FRAMEWORK COMMUNITY LICENSE
   25.19 +    ===================================
   25.20 +
   25.21 +    This license agreement constitutes a valid and binding agreement
   25.22 +    between the OpenPKG GmbH, jurisdiction identification "DE MUC HRB
   25.23 +    160208", postal address "Weblinger Weg 28, 85221 Dachau, GERMANY",
   25.24 +    digital signature name "OpenPKG GmbH <openpkg@openpkg.com>" and
   25.25 +    digital signature fingerprint "7D12 1A8F C05D C18A 4329 E9EF 6704
   25.26 +    2EC9 61B7 AE34", represented by the two managing directors Ralf S.
   25.27 +    Engelschall and Thomas Lotterer, and you, the licensee.
   25.28 +
   25.29 +    "You" means the natural person or the entity that is agreeing to be
   25.30 +    bound by this agreement. You shall be liable for any failure by your
   25.31 +    employees and third party contractors that provide services to you
   25.32 +    to comply with the terms and conditions of this agreement.
   25.33 +
   25.34 +    AGREEMENT
   25.35 +    ---------
   25.36 +
   25.37 +    By using, copying, modifying or distributing the Product you agree
   25.38 +    to be bound by the terms and conditions of this agreement. If you
   25.39 +    are accepting these terms on behalf of another person or a company
   25.40 +    or other legal entity, you represent and warrant that you have full
   25.41 +    authority to bind that person, company, or legal entity to these
   25.42 +    terms. If you do not agree to the terms and conditions of this
   25.43 +    agreement, you may not use, copy, modify or distribute the Product.
   25.44 +    You may return the unused Product to the supplier from which you
   25.45 +    acquired it within 30 days and request a refund of the license fee,
   25.46 +    if any, already paid upon showing proof of payment.
   25.47 +
   25.48 +    TERMINOLOGY
   25.49 +    -----------
   25.50 +
   25.51 +    OpenPKG is a solution to build software stacks consisting of OpenPKG
   25.52 +    Packages and an OpenPKG Framework to operate them.
   25.53 +
   25.54 +    For your information, OpenPKG Packages are available from the
   25.55 +    OpenPKG Foundation e.V., which licenses and distributes them as Open
   25.56 +    Source Software. These OpenPKG Packages are in no way subject of
   25.57 +    this agreement.
   25.58 +
   25.59 +    The OpenPKG Framework is a property of the OpenPKG GmbH with all
   25.60 +    rights reserved. Licenses, like this one, which grant limited
   25.61 +    permission to use, copy, modify and distribute this software are
   25.62 +    exclusively issued by the OpenPKG GmbH.
   25.63 +
   25.64 +    Licensing as described in this agreement covers the OpenPKG
   25.65 +    Framework code copyrighted by the OpenPKG GmbH and the OpenPKG
   25.66 +    Framework as a compound work. The OpenPKG Framework is distributed
   25.67 +    in source code form and also contains pristine third-party sources
   25.68 +    where each comes with its own licensing model. These licenses are
   25.69 +    in no way altered by this agreement, but passed through to you
   25.70 +    verbatim. You are responsible for obtaining and obeying any such
   25.71 +    vendor license.
   25.72 +
   25.73 +    This license describes how you appropriately use, copy, modify
   25.74 +    and distribute the OpenPKG Framework source code and the binaries
   25.75 +    resulting from the build process. This license does not include any
   25.76 +    entitlement for you to receive service or support from the OpenPKG
   25.77 +    GmbH, there are no warranties beyond the minimum implied warranty,
   25.78 +    and there are no promises with respect to the future of the Product
   25.79 +    or any derived works.
   25.80 +
   25.81 +    GRANT OF RIGHTS GENERAL TERMS
   25.82 +    -----------------------------
   25.83 +
   25.84 +    The OpenPKG Framework is licensed, not sold. Subject to the terms
   25.85 +    and conditions of this agreement, the OpenPKG GmbH hereby grants
   25.86 +    you a non-exclusive, non-sub-licensable and non-transferable right
   25.87 +    to use the Product. You may not lease or rent the OpenPKG Framework
   25.88 +    license.
   25.89 +
   25.90 +    You may sell or otherwise transfer unused licenses if you ensure
   25.91 +    the recipient receives these terms and conditions with the same
   25.92 +    transaction and acknowledges to take over your responsibilities from
   25.93 +    this agreement.
   25.94 +
   25.95 +    You may not remove any titles, trademarks or trade names, copyright
   25.96 +    notices, legends, or other proprietary markings on the Product. You
   25.97 +    are not granted any rights to any trademarks or service marks of the
   25.98 +    OpenPKG GmbH. All rights not expressly granted by this license are
   25.99 +    reserved.
  25.100 +
  25.101 +    You may use the Product as long as you own this license issued by
  25.102 +    the OpenPKG GmbH, install it and obey the terms and conditions
  25.103 +    listed below. This license, issued by the OpenPKG GmbH, ships
  25.104 +    as a digitally signed text file which carries the exact license
  25.105 +    conditions both in human readable plain text and attached in a
  25.106 +    machine readable format. The latter may be used by the OpenPKG
  25.107 +    Framework to programmatically validate the license compliance. If
  25.108 +    programmatic license validation within the OpenPKG Framework detects
  25.109 +    a compliance failure, the OpenPKG Framework might cease operation.
  25.110 +    It is your responsibility to ensure compliance with these terms and
  25.111 +    conditions.
  25.112 +
  25.113 +    GRANT OF RIGHTS TO USE THE OPENPKG FRAMEWORK
  25.114 +    --------------------------------------------
  25.115 +
  25.116 +    This "community" license ships free of charge with every OpenPKG
  25.117 +    Framework and allows restricted use of the OpenPKG Framework. The
  25.118 +    constraints are run-time limitations of the OpenPKG Framework to
  25.119 +    enforce regular updates. The packages must have been built on the
  25.120 +    target host, inhibiting "build on one host, deploy on other host"
  25.121 +    scenarios. Online reporting is enabled. A large amount of
  25.122 +    packgages being installed must be known by name and release,
  25.123 +    preventing use of large amounts of outdated or modified packages.
  25.124 +    This is effectively a "force source" and "bleeding edge" license.
  25.125 +
  25.126 +    GRANT OF RIGHTS TO COPY THE OPENPKG FRAMEWORK
  25.127 +    ---------------------------------------------
  25.128 +
  25.129 +    You may create an unlimited number of copies of the Product.
  25.130 +
  25.131 +    GRANT OF RIGHTS TO MODIFY THE OPENPKG FRAMEWORK
  25.132 +    -----------------------------------------------
  25.133 +
  25.134 +    You may modify most parts of the Product and adjust it to your
  25.135 +    needs, creating derivative works. You may not remove license
  25.136 +    validation code, and you must ensure the preservation of the OpenPKG
  25.137 +    GmbH fingerprint data. The copyright notice, the license excerpt and
  25.138 +    the reference to this terms and conditions must be kept verbatim.
  25.139 +    You must make clear to the recipient of the derived works that the
  25.140 +    version he is receiving has been modified and by whom.
  25.141 +
  25.142 +    These terms and conditions stay if force for derivative works. To
  25.143 +    keep modifications your property you must not distribute them, in
  25.144 +    source or binary form, beyond your organizational scope. In cases
  25.145 +    of extended distribution or publication you agree to contribute
  25.146 +    your modifications automatically, free of charge and without any
  25.147 +    royalty claims, to the OpenPKG GmbH, transfer the source code of
  25.148 +    your modifications to the OpenPKG GmbH and irrevocably transfer
  25.149 +    all rights of your modifications to the OpenPKG GmbH which will
  25.150 +    grant you unlimited use rights to your contribution. There is no
  25.151 +    promise the OpenPKG GmbH includes your contribution into the OpenPKG
  25.152 +    Framework.
  25.153 +
  25.154 +    GRANT OF RIGHTS TO DISTRIBUTE THE OPENPKG FRAMEWORK
  25.155 +    ---------------------------------------------------
  25.156 +
  25.157 +    You may distribute the Product, or derivative works thereof created
  25.158 +    under adherence of the "rights to modify" grant, if you ensure
  25.159 +    the recipient receives these terms and conditions with the same
  25.160 +    transaction.
  25.161 +
  25.162 +    ONLINE ACCESS
  25.163 +    -------------
  25.164 +
  25.165 +    The OpenPKG Framework collects information about the OpenPKG
  25.166 +    Framework, OpenPKG Framework License and OpenPKG Packages for use
  25.167 +    by the OpenPKG Project, the OpenPKG Foundation e.V. and the OpenPKG
  25.168 +    GmbH. The programmatic license validation might and the information
  25.169 +    upload process does require online access to the Internet. You agree
  25.170 +    to grant the OpenPKG Framework permission for this use case and you
  25.171 +    assume all costs related to the online access.
  25.172 +
  25.173 +    TERMINATION
  25.174 +    -----------
  25.175 +
  25.176 +    You may not use the OpenPKG Framework except as expressly
  25.177 +    provided under the license. Any attempt to otherwise use, copy,
  25.178 +    modify, distribute or sub-license the Product is void, and will
  25.179 +    automatically terminate your rights under this license.
  25.180 +
  25.181 +    CHANGE
  25.182 +    ------
  25.183 +
  25.184 +    The OpenPKG GmbH reserves the right to subsequently modify or amend
  25.185 +    details of these terms and conditions where this seems applicable,
  25.186 +    as long as you are, in good faith, not disadvantaged thereby.
  25.187 +
  25.188 +    Those changes or amendments of the terms and conditions will be
  25.189 +    proclaimed to you by a written document, delivered to you in
  25.190 +    electronic format or paper mail as chosen by the OpenPKG GmbH.
  25.191 +    Anonymous and unknown users cannot be contacted by the OpenPKG GmbH.
  25.192 +    They must review the terms and conditions regularly at the same time
  25.193 +    they obtain or use an updated OpenPKG Framework. You cannot rise an
  25.194 +    objection against the proclaimed changes or amendments. However, you
  25.195 +    can terminate the license agreement without prior notice.
  25.196 +
  25.197 +    DISCLAIMER
  25.198 +    ----------
  25.199 +
  25.200 +    THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
  25.201 +    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  25.202 +    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  25.203 +    IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  25.204 +    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25.205 +    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25.206 +    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  25.207 +    USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  25.208 +    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  25.209 +    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  25.210 +    OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  25.211 +    SUCH DAMAGE.
  25.212 +
  25.213 +    LIMITED WARRANTY AND LIMITATION OF LIABILITY
  25.214 +    --------------------------------------------
  25.215 +
  25.216 +    The OpenPKG GmbH is only liable for damages if the OpenPKG GmbH
  25.217 +    or one of its vicarious agents has violated a major contractual
  25.218 +    (cardinal) obligation or jeopardized the intention of the agreement
  25.219 +    or the damage was done by gross negligence or intention of the
  25.220 +    OpenPKG GmbH or one of its vicarious agents.
  25.221 +
  25.222 +    In case the violation of a cardinal obligation is not caused by
  25.223 +    gross negligence or intention of the OpenPKG GmbH or one of its
  25.224 +    vicarious agents the liability of the OpenPKG GmbH is limited to the
  25.225 +    predictable damage characteristical for the contract.
  25.226 +
  25.227 +    The preceding liability limitations apply for contractual and
  25.228 +    non-contractual claims. The liability of the OpenPKG GmbH due to
  25.229 +    warranties, personal injury and due to the German Product Liability
  25.230 +    Act remains unaffected from the preceding liability limitations.
  25.231 +
  25.232 +    GENERAL
  25.233 +    -------
  25.234 +
  25.235 +    This agreement sets forth the OpenPKG GmbH's entire liability and
  25.236 +    your exclusive remedy with respect to the Product and supersedes
  25.237 +    the terms of any purchase orders and any other communications or
  25.238 +    advertising with respect to the Product. You acknowledge that this
  25.239 +    agreement is a complete statement of the agreement between you
  25.240 +    and the OpenPKG GmbH with respect to the Product, and that there
  25.241 +    are no other prior or contemporaneous understandings, promises,
  25.242 +    representations, or descriptions with respect to the Product.
  25.243 +
  25.244 +    Headings under this agreement are intended only for convenience and
  25.245 +    shall not affect the interpretation of this agreement.
  25.246 +
  25.247 +    No failure of either party to exercise or enforce any of its rights
  25.248 +    under this agreement will act as a waiver of those rights. This
  25.249 +    agreement may only be modified, or any rights under it waived, by a
  25.250 +    written document executed by the party against which it is asserted.
  25.251 +
  25.252 +    If any provision of this agreement is found illegal or
  25.253 +    unenforceable, it will be enforced to the maximum extent
  25.254 +    permissible, and the legality and enforceability of the other
  25.255 +    provisions of this agreement will not be affected.
  25.256 +
  25.257 +    This agreement is governed by German law.
  25.258 +
  25.259 +    If you have any questions about this agreement please contact the
  25.260 +    OpenPKG GmbH. Direct all traditional paper correspondence to the
  25.261 +    official company address as listed in the very first paragraph of
  25.262 +    this document. You find the most recent contact information on our
  25.263 +    website http://openpkg.com/
  25.264 +
  25.265 +    You can find the most recent version of this document on our website
  25.266 +    http://openpkg.com/go/framework-license
  25.267 +
  25.268 +Assertion-MinProcVersion:     0.9.0
  25.269 +Assertion-LifeTime:           2009-01-01:2012-09-01
  25.270 +Assertion-GrantTime:          2009-01-01:2012-09-01
  25.271 +Assertion-FromSourceOnTarget: yes
  25.272 +Assertion-OnlineReporting:    http://openpkg.com/go/framework-license-reporting
  25.273 +Assertion-PackageReleaseAge:  90%:90d:^OpenPKG.*$
  25.274 +    *:20120624                   lzma:20090830
  25.275 +    openpkg:20120701             lzo:20110827
  25.276 +    a2ps:20080101                lzop:20110924
  25.277 +    aalib:20100227               m4:20110303
  25.278 +    accent:20080101              maatkit:20110610
  25.279 +    ack:20120616                 mailgrep:20080101
  25.280 +    activemq:20120509            mailman:20090327
  25.281 +    adns:20080101                mailsync:20080101
  25.282 +    adobeflex:20111217           majordomo:20110208
  25.283 +    aegis:20080808               make:20100729
  25.284 +    afio:20101219                makepp:20090206
  25.285 +    aft:20100911                 mapson:20100225
  25.286 +    aica:20100227                maradns:20120312
  25.287 +    aide:20100911                markdown:20120414
  25.288 +    akka:20120606                mathomatic:20120630
  25.289 +    al:20080101                  matrixssl:20100310
  25.290 +    alpine:20080827              maven:20120121
  25.291 +    altermime:20081116           max:20120623
  25.292 +    amanda:20101006              mbuffer:20110726
  25.293 +    amavisd:20110520             mc:20120423
  25.294 +    amd:20090418                 mcpp:20081130
  25.295 +    analog:20080101              mcrypt:20090130
  25.296 +    anchor:20120319              md5deep:20120612
  25.297 +    ansifilter:20110402          md5sha1sum:20080101
  25.298 +    ant:20120524                 mdbtools:20080102
  25.299 +    antiword:20080101            mdocml:20111009
  25.300 +    antlr:20110809               mediaproxy:20080112
  25.301 +    anubis:20081223              mediawiki:20100529
  25.302 +    apache-apreq:20101219        memcached:20120524
  25.303 +    apache-authext:20110219      memphis:20080101
  25.304 +    apache-authremote:20081228   mercurial:20120603
  25.305 +    apache-cloudflare:20120606   meta-antivirus:20080101
  25.306 +    apache-define:20081228       meta-archiver:20080101
  25.307 +    apache-extfwd:20080102       meta-core:20080101
  25.308 +    apache-fastcgi:20080101      meta-devel:20120627
  25.309 +    apache-flvx:20090301         meta-ldap:20120627
  25.310 +    apache-geoip:20110827        meta-pgp:20120627
  25.311 +    apache-icpquery:20081114     meta-rdbms:20120627
  25.312 +    apache-kerberos:20090326     metalink:20090327
  25.313 +    apache-layout:20080107       mhash:20090327
  25.314 +    apache-macro:20100911        mhonarc:20110109
  25.315 +    apache-openid:20100110       microemacs:20100110
  25.316 +    apache-perl:20120606         microregex:20100110
  25.317 +    apache-php:20120627          milter-backscatter:20100221
  25.318 +    apache-proxyhtml:20081219    milter-bogom:20080626
  25.319 +    apache-pubtkt:20120628       milter-dk:20090327
  25.320 +    apache-python:20101212       milter-dkim:20090826
  25.321 +    apache-roaming:20081230      milter-greylist:20100902
  25.322 +    apache-ruby:20081214         milter-header:20090707
  25.323 +    apache-sasl:20111022         milter-regex:20111122
  25.324 +    apache-security:20100206     milter-sa:20110924
  25.325 +    apache-sendmail:20110409     milter-sid:20080608
  25.326 +    apache-suphp:20100402        milter-smc:20080705
  25.327 +    apache-timedout:20100105     milter:20110731
  25.328 +    apache-tomcat:20120601       mimedefang:20100819
  25.329 +    apache-uid:20090412          minicom:20111229
  25.330 +    apache-wsgi:20101212         mirror:20080208
  25.331 +    apache-xslt:20080906         mixmaster:20100109
  25.332 +    apache-zeus:20080101         mk:20080101
  25.333 +    apache:20120205              mkisofs:20101219
  25.334 +    apacheds:20100410            mksh:20120407
  25.335 +    apachetop:20080101           mktemp:20100426
  25.336 +    apg:20080101                 mldonkey:20100816
  25.337 +    apr:20120214                 mm:20091121
  25.338 +    apt:20080101                 mng:20080101
  25.339 +    aqbanking:20080101           modsurvey:20091122
  25.340 +    aqmoney:20120515             mongodb:20120630
  25.341 +    arc:20100808                 monit:20120507
  25.342 +    ares:20120619                mono:20110106
  25.343 +    argp:20080921                monotone:20100417
  25.344 +    argtable:20110111            mozldap:20090410
  25.345 +    aria2:20120528               mp3c:20080101
  25.346 +    arj:20080101                 mp3imagetagextr:20100129
  25.347 +    arpalert:20080401            mp3info:20080101
  25.348 +    arpd:20080101                mp3nema:20090409
  25.349 +    arpoison:20080101            mpack:20080101
  25.350 +    arptools:20080101            mpc:20110222
  25.351 +    arx:20100930                 mpfr:20120508
  25.352 +    ascii:20110317               mpg123:20120512
  25.353 +    ascii2binary:20100830        mpop:20120502
  25.354 +    asciidoc:20120318            mrtg:20111202
  25.355 +    asmifier:20110912            msmtp:20120502
  25.356 +    asn1c:20080101               msntp:20080101
  25.357 +    aspell:20110731              msort:20100111
  25.358 +    asterisk-conference:20080320 mtasc:20100126
  25.359 +    asterisk-espeak:20080322     mtools:20110629
  25.360 +    asterisk-festival:20080321   mtr:20120623
  25.361 +    asterisk-flite:20080322      mtx:20080821
  25.362 +    asterisk-ldap:20080323       multisort:20080101
  25.363 +    asterisk-libiax:20080320     multitail:20111231
  25.364 +    asterisk-utils:20080324      mutt:20110123
  25.365 +    asterisk:20101019            mxml:20111221
  25.366 +    asymptote:20120602           mybatis:20120523
  25.367 +    atool:20120403               myjit:20120126
  25.368 +    audiofile:20100322           myodbc:20091110
  25.369 +    augeas:20110416              mysql:20120630
  25.370 +    autoconf-archive:20120409    mysql55:20100920
  25.371 +    autoconf:20120426            mysqlproxy:20111211
  25.372 +    autogen:20101120             nagios:20120628
  25.373 +    autojar:20110731             nail:20100418
  25.374 +    automake:20120603            nano:20110511
  25.375 +    autossh:20111013             nant:20120610
  25.376 +    autotrace:20101219           nasm:20090722
  25.377 +    avahi:20110404               ncftp:20110120
  25.378 +    avis:20091216                ncompress:20080101
  25.379 +    awk:20080101                 ncurses:20120529
  25.380 +    axkit:20100415               ndb:20120630
  25.381 +    axl:20120105                 ne:20120419
  25.382 +    babl:20120603                neko:20100107
  25.383 +    bacula:20120629              neo4j:20120421
  25.384 +    bar:20110322                 neon:20110504
  25.385 +    bash:20120603                netatalk:20120523
  25.386 +    bashdb:20110731              netcat:20080101
  25.387 +    bazaar:20120531              netcdf:20100403
  25.388 +    bbe:20080101                 netpbm:20100202
  25.389 +    bc:20080829                  netrik:20090620
  25.390 +    bdc:20080101                 nettle:20111114
  25.391 +    bdec:20110711                newlib:20101217
  25.392 +    beecrypt:20120124            newlisp:20120508
  25.393 +    bind:20120603                newsyslog:20090718
  25.394 +    binutils:20111122            newt:20101112
  25.395 +    bird:20120329                nexus:20111223
  25.396 +    bison:20120606               nfdump:20120314
  25.397 +    bitflu:20120502              nfs-ganesha:20110720
  25.398 +    bittorrent:20081029          nginx:20120627
  25.399 +    blosxom:20080101             ngircd:20120304
  25.400 +    bnd:20110731                 ngrep:20080101
  25.401 +    boa:20080101                 njmc:20080101
  25.402 +    bogofilter:20101219          nmake:20120109
  25.403 +    bonnie:20080101              nmap:20120617
  25.404 +    boost:20120623               nn:20080101
  25.405 +    botan:20120618               nntpcache:20080101
  25.406 +    botan18:20110711             node-redis:20120312
  25.407 +    boxes:20080101               node-underscore:20120410
  25.408 +    bs:20080101                  node:20120630
  25.409 +    bsdiff:20080101              noexec:20080101
  25.410 +    btar:20120610                noweb:20100130
  25.411 +    btyacc:20080101              nqp:20120611
  25.412 +    bup:20120217                 ns4:20100110
  25.413 +    burp:20120608                nsd:20120217
  25.414 +    byacc:20120527               nsis:20091207
  25.415 +    bzip2:20100920               nslint:20100912
  25.416 +    c2man:20080101               nspr:20111211
  25.417 +    cabextract:20110924          nss:20080802
  25.418 +    cacti-spine:20120501         ntp:20111226
  25.419 +    cacti:20120501               nwcc:20090305
  25.420 +    cadaver:20120530             nxlog:20120605
  25.421 +    cairo:20120623               ocaml:20110705
  25.422 +    cairomm:20110509             ocrad:20110111
  25.423 +    calamaris:20080101           ocspd:20110212
  25.424 +    calc:20081229                odoc:20080101
  25.425 +    calcurse:20100529            odt2txt:20091016
  25.426 +    calltree:20080101            offlineimap:20100109
  25.427 +    captivednsd:20081102         oidentd:20080101
  25.428 +    ccache:20120108              omake:20080101
  25.429 +    ccfe:20120513                omnisync:20090104
  25.430 +    ccide:20101009               ondir:20120310
  25.431 +    ccrypt:20090829              onig:20100108
  25.432 +    cdb:20110406                 op:20080101
  25.433 +    cdk:20120329                 opencdk:20080806
  25.434 +    cdpr:20100217                openclipart:20080101
  25.435 +    cdrecord:20080101            opendbx:20100421
  25.436 +    cego:20120527                opendkim:20120625
  25.437 +    cencode:20091121             openfire:20090503
  25.438 +    centericq:20080101           openjade:20090327
  25.439 +    cfengine:20120211            openjpeg:20100110
  25.440 +    cfg:20080101                 openldap:20120301
  25.441 +    cflow:20080101               openmpi:20120515
  25.442 +    cftp:20080101                openpkg-darwin:20100329
  25.443 +    cfv:20090608                 openpkg-external:20111126
  25.444 +    cgdb:20110917                openrdate:20081123
  25.445 +    cgiirc:20101219              opensips:20101221
  25.446 +    cgilib:20100109              openslp:20080101
  25.447 +    cgit:20120319                opensp:20080101
  25.448 +    cgstmad:20100105             openssh:20120627
  25.449 +    chaiscript:20100119          openssl:20120606
  25.450 +    check:20090923               openssl10:20100226
  25.451 +    checkbot:20081015            openvpn:20111223
  25.452 +    cherokee:20111020            opie:20080101
  25.453 +    chilon:20110320              optipng:20120321
  25.454 +    chkrootkit:20090804          oracle:20080101
  25.455 +    cint:20080101                orbit:20080101
  25.456 +    cinvoke:20080101             orbit2:20100929
  25.457 +    citadel:20080304             orc:20111004
  25.458 +    clamav:20120617              orientdb:20120515
  25.459 +    clamshell:20090705           orpie:20100110
  25.460 +    classgen:20080101            ortp:20120223
  25.461 +    clearsilver:20080101         osip:20120412
  25.462 +    clex:20090926                ots:20080101
  25.463 +    cli:20091219                 owncloud:20120629
  25.464 +    cloc:20120410                p0f:20120512
  25.465 +    clojure:20110414             p11kit:20120310
  25.466 +    closurecompiler:20120501     p7zip:20100530
  25.467 +    closurelinter:20120301       pam:20110219
  25.468 +    closurestylesheets:20111231  pango:20120623
  25.469 +    cloudvpn:20110731            pangoxsl:20080101
  25.470 +    cmake:20120419               paperkey:20091015
  25.471 +    cmph:20120603                papyrus:20080101
  25.472 +    cocom:20080101               paq:20080829
  25.473 +    cocor:20080101               par:20080101
  25.474 +    coffeescript:20120410        par2cmdline:20080806
  25.475 +    commons:20120617             parallel:20120623
  25.476 +    compass:20120303             pari:20120207
  25.477 +    config:20120627              parrot:20120528
  25.478 +    conman:20110423              patch:20091230
  25.479 +    cook:20100926                patchutils:20110211
  25.480 +    coreutils:20120603           path:20120310
  25.481 +    couchdb:20120407             pax:20120109
  25.482 +    cparser:20100416             pb4sd:20080101
  25.483 +    cpio:20100311                pcal:20080101
  25.484 +    cppcheck:20100110            pccts:20080101
  25.485 +    cppi:20120603                pcre:20120528
  25.486 +    cppunit:20120505             pdcurses:20080909
  25.487 +    cproto:20110103              pdf2djvu:20120605
  25.488 +    cpu:20080101                 pdf2svg:20100506
  25.489 +    cracklib:20120519            pdflib:20100804
  25.490 +    crm114:20100111              pdfresurrect:20120531
  25.491 +    cronolog:20080515            pdfsam:20101122
  25.492 +    crossroads:20080519          pdftk:20080721
  25.493 +    crush:20091228               pdksh:20080101
  25.494 +    cryptlib:20110731            pdnsd:20120318
  25.495 +    cscope:20120616              pecomato:20080101
  25.496 +    csp:20080101                 peep:20080101
  25.497 +    css2xslfo:20100824           peg:20120501
  25.498 +    cssc:20110515                pegdown:20111217
  25.499 +    csync:20120522               pegtl:20110227
  25.500 +    ctags:20091018               perftools:20110827
  25.501 +    ctalk:20100401               perl-aop:20120531
  25.502 +    ctorrent:20080101            perl-apache:20120531
  25.503 +    ctrlproxy:20090503           perl-asterisk:20120531
  25.504 +    cttl:20090824                perl-biz:20120531
  25.505 +    cufon-fonts:20100313         perl-bytecode:20120605
  25.506 +    cufon:20120414               perl-cache:20120531
  25.507 +    cup:20080101                 perl-comp:20120531
  25.508 +    cups:20120516                perl-conv:20120610
  25.509 +    curl:20120525                perl-crypto:20120608
  25.510 +    cutils:20080101              perl-curses:20120603
  25.511 +    cvs:20100106                 perl-db:20120531
  25.512 +    cvs2cl:20100105              perl-dbi:20120626
  25.513 +    cvsd:20120603                perl-dbix:20120531
  25.514 +    cvsgraph:20080522            perl-devel:20120531
  25.515 +    cvsps:20080402               perl-dns:20120531
  25.516 +    cvstrac:20110203             perl-ds:20120629
  25.517 +    cvsweb:20080101              perl-font:20120531
  25.518 +    cvsync:20080101              perl-gd:20120531
  25.519 +    cwc:20091015                 perl-gfx:20120531
  25.520 +    daemon:20100613              perl-inline:20120531
  25.521 +    daemontools:20081007         perl-kerberos:20120531
  25.522 +    dailystrips:20080101         perl-ldap:20120531
  25.523 +    dante:20120603               perl-locale:20120602
  25.524 +    dar:20110907                 perl-mail:20120621
  25.525 +    darcs:20080101               perl-math:20120622
  25.526 +    dash:20100227                perl-module:20120621
  25.527 +    data-charset:20080530        perl-net:20120621
  25.528 +    data-iana:20080306           perl-ole:20120531
  25.529 +    data-isocodes:20120630       perl-openpkg:20120531
  25.530 +    data-timezone:20110731       perl-par:20120531
  25.531 +    dateutils:20120115           perl-parse:20120622
  25.532 +    davical:20120618             perl-poe:20120531
  25.533 +    db:20091002                  perl-regex:20120607
  25.534 +    db45:20080502                perl-sip:20120626
  25.535 +    dbmail:20120120              perl-ssh:20120531
  25.536 +    dbtool:20090625              perl-ssl:20120618
  25.537 +    dbus:20120628                perl-stats:20120531
  25.538 +    dcc:20090112                 perl-sys:20120616
  25.539 +    dchk:20100805                perl-template:20120531
  25.540 +    dcron:20080424               perl-term:20120531
  25.541 +    ddrescue:20120612            perl-text:20120531
  25.542 +    deco:20100608                perl-time:20120602
  25.543 +    deheader:20110211            perl-tm:20120531
  25.544 +    delegate:20100401            perl-util:20120616
  25.545 +    devtodo:20080101             perl-vcs:20120621
  25.546 +    dhcp-agent:20080101          perl-www:20120628
  25.547 +    dhcpd:20111211               perl-wx:20120531
  25.548 +    dhcpdump:20080625            perl-xml:20120626
  25.549 +    dhcping:20080101             perl:20120531
  25.550 +    dhrystone:20080101           perlbal:20110123
  25.551 +    dhtml:20120623               perltidy:20120621
  25.552 +    di:20111121                  petidomo:20080101
  25.553 +    dialog:20120603              pgautodoc:20120109
  25.554 +    diction:20080101             pgfouine:20100225
  25.555 +    diffstat:20120103            pgp:20080101
  25.556 +    diffutils:20120512           pgp2:20080101
  25.557 +    dim:20091123                 pgpdump:20080101
  25.558 +    diogene87:20120623           pgpool:20120527
  25.559 +    dirac:20120123               pgscript:20080908
  25.560 +    discount:20120120            phc:20090216
  25.561 +    distcache:20080101           php-apc:20120608
  25.562 +    distcc:20120623              php-couchdb:20120608
  25.563 +    ditaa:20090411               php-fpm:20120616
  25.564 +    djbdns:20080101              php-imagemagick:20120608
  25.565 +    djvulibre:20110307           php-memcached:20120608
  25.566 +    dlint:20080101               php-mongodb:20120608
  25.567 +    dmake:20080101               php-sabre:20120613
  25.568 +    dmalloc:20080101             php-slim:20120608
  25.569 +    dnstracer:20080210           php-xcache:20120608
  25.570 +    docbook:20101102             php-xdebug:20120423
  25.571 +    docbook2x:20080726           php-zf:20120623
  25.572 +    doclifter:20120625           php:20120616
  25.573 +    docutils:20120503            phpbb:20100715
  25.574 +    doodle:20101219              pine:20080101
  25.575 +    dos2unix:20120507            pinentry:20120623
  25.576 +    dovecot:20120531             pinfo:20080101
  25.577 +    doxygen:20120603             pisa:20100617
  25.578 +    dparser:20101221             pkgconfig:20110530
  25.579 +    dpkg:20120320                pks:20080101
  25.580 +    drac:20120521                pktstat:20120306
  25.581 +    dragon:20100816              ploticus:20120623
  25.582 +    drizzle:20100915             plotutils:20100507
  25.583 +    drupal-module-misc:20120625  pmake:20080101
  25.584 +    drupal-theme-misc:20120531   pmk:20080325
  25.585 +    drupal:20110526              pnet:20080101
  25.586 +    dsh:20080101                 pnetlib:20080101
  25.587 +    dsniff:20080101              png:20110707
  25.588 +    dspam:20120424               png2ico:20080101
  25.589 +    dss:20080101                 pngrewrite:20100609
  25.590 +    duff:20120129                pngslice:20081018
  25.591 +    dumpasn1:20110218            pod2pdf:20090717
  25.592 +    dvdauthor:20101023           polarssl:20110223
  25.593 +    dvdrw-tools:20080305         poppler-data:20110901
  25.594 +    dvipng:20101215              poppler:20120611
  25.595 +    dwarf:20110123               popt:20100508
  25.596 +    dwdiff:20120613              portablesigner:20100110
  25.597 +    dynamips:20080101            portfwd:20080101
  25.598 +    dyncall:20120103             portsentry:20080101
  25.599 +    easysoap:20080101            poster:20080101
  25.600 +    ecartis:20080101             postfix-mailgraph:20080101
  25.601 +    echoping:20080101            postfix:20120627
  25.602 +    ecj:20111207                 postgresql:20120623
  25.603 +    ecl:20111211                 postgrey:20110505
  25.604 +    ed:20120103                  pound:20111229
  25.605 +    editline:20100813            poweradmin:20080101
  25.606 +    ee:20100604                  powerdns:20090126
  25.607 +    ejs:20090517                 precc:20080101
  25.608 +    eli:20080101                 premake:20101117
  25.609 +    elinks:20090708              prest:20101209
  25.610 +    elm:20110526                 prince:20120122
  25.611 +    emacs:20120623               prince7:20111001
  25.612 +    email:20101101               privoxy:20111227
  25.613 +    enscript:20080101            prngd:20080101
  25.614 +    envstore:20100626            procmail:20090727
  25.615 +    eotutils:20120103            proftpd:20120328
  25.616 +    epic4:20090906               proguard:20120528
  25.617 +    epm:20080101                 protobuf:20110501
  25.618 +    eps2png:20090529             proxytunnel:20080304
  25.619 +    epstool:20080101             prwd:20091212
  25.620 +    epub2pdf:20100516            psh:20080101
  25.621 +    equinox:20111207             pstoedit:20110828
  25.622 +    erlang:20120404              pstreams:20100513
  25.623 +    esmtp:20091224               psutils:20080101
  25.624 +    espeak:20120109              pth:20080101
  25.625 +    ettercap:20080101            punbb-ext-standard:20110305
  25.626 +    ex-vi:20080101               punbb:20110922
  25.627 +    ex:20080211                  pureftpd:20111208
  25.628 +    exif:20101219                pv:20080306
  25.629 +    exim:20100123                pwauth:20111009
  25.630 +    expat:20120325               pwmd:20101122
  25.631 +    expect:20080419              python-crypto:20120128
  25.632 +    ez-ipupdate:20080101         python-db:20111013
  25.633 +    faac:20090301                python-gfx:20100705
  25.634 +    faad:20090228                python-google:20120421
  25.635 +    fann:20090327                python-json:20120626
  25.636 +    fastjar:20090925             python-ldap:20120618
  25.637 +    festival:20080323            python-math:20120520
  25.638 +    fetchmail:20110827           python-net:20120606
  25.639 +    ffe:20110411                 python-paste:20111110
  25.640 +    ffmpeg:20120608              python-pdf:20101205
  25.641 +    fftw:20120507                python-setup:20100724
  25.642 +    fido:20120605                python-text:20120311
  25.643 +    fig2pstricks:20090222        python-www:20111126
  25.644 +    figlet:20120609              python-xml:20111126
  25.645 +    file:20120603                python:20120412
  25.646 +    fileschanged:20120610        python3:20100322
  25.647 +    findutils:20110515           qdbm:20080101
  25.648 +    flac:20090228                qore:20091212
  25.649 +    flashpolicyd:20090919        qpopper:20110701
  25.650 +    flawfinder:20080101          qrencode:20120419
  25.651 +    flex:20100913                quagga:20120502
  25.652 +    flite:20091230               quilt:20120301
  25.653 +    flow2rrd:20110209            r:20120623
  25.654 +    flowd:20100110               rabbitmq:20120622
  25.655 +    flowscan:20080101            radius:20081217
  25.656 +    flowtools:20080101           radiusclient:20080317
  25.657 +    flvtool:20090307             ragel:20110524
  25.658 +    flvtoolxx:20090619           rakudo:20120501
  25.659 +    fly:20090617                 ratbox:20100423
  25.660 +    fm-submit:20080101           rats:20110722
  25.661 +    fntsample:20100806           rbldnsd:20080329
  25.662 +    font-optimizer:20100405      rc:20090509
  25.663 +    fontconfig:20120625          rcs:20120606
  25.664 +    fontface:20120108            rdiff-backup:20090317
  25.665 +    fontforge:20120618           rdist:20080101
  25.666 +    fonts-free:20120614          rdp:20080101
  25.667 +    fonttools:20100405           rdup:20120219
  25.668 +    fop:20100721                 re2:20110305
  25.669 +    fossil:20111214              re2c:20080526
  25.670 +    fourstore-java:20100331      readline:20120406
  25.671 +    fourstore:20110923           recode:20110731
  25.672 +    fpdns:20080101               recutils:20120114
  25.673 +    fping:20120529               redis-libs:20120629
  25.674 +    fprobe:20080101              redis-tools:20110225
  25.675 +    fprot:20080101               redis:20120622
  25.676 +    freeradius:20100929          redland-raptor:20120625
  25.677 +    freetds:20120603             redland-rasqal:20120515
  25.678 +    freetype:20120616            redland:20111204
  25.679 +    fribidi:20090328             regexp9:20080906
  25.680 +    frink:20110218               regina:20100106
  25.681 +    fsharp:20090620              remind:20120124
  25.682 +    fsl:20100418                 reposurgeon:20111116
  25.683 +    gale:20080101                rfc:20100214
  25.684 +    gamin:20120610               rhino:20110730
  25.685 +    ganttproject:20090327        rhodecode:20111211
  25.686 +    gated:20080101               rie:20080101
  25.687 +    gawk:20120331                ripe-asused:20120424
  25.688 +    gc:20120626                  ripe-dbase:20080101
  25.689 +    gcal:20120603                ripe-ipadm:20080101
  25.690 +    gcc:20120321                 ripe-whois:20080101
  25.691 +    gcc47:20120603               rlwrap:20100505
  25.692 +    gcflow:20111014              roadrunner:20080101
  25.693 +    gconf:20100805               roff:20080408
  25.694 +    gcrypt:20100714              rolo:20080101
  25.695 +    gd:20120623                  rpl:20080425
  25.696 +    gdb:20120603                 rrdtool:20120308
  25.697 +    gdbm:20120605                rspamd:20110227
  25.698 +    gdk-pixbuf:20120623          rsstail:20110310
  25.699 +    gecode:20111011              rsstool:20100312
  25.700 +    gengen:20091001              rst2pdf:20120602
  25.701 +    gengetopt:20091224           rsync:20110924
  25.702 +    gentle:20080101              rsyslog:20120605
  25.703 +    geoip:20110827               rt:20120525
  25.704 +    getopt:20080101              ruby-gems:20120428
  25.705 +    gettext:20100607             ruby-gfx:20120303
  25.706 +    ghc-zlib:20120122            ruby-spec:20120504
  25.707 +    ghc:20090503                 ruby:20120414
  25.708 +    ghostscript:20120623         ruby18:20110731
  25.709 +    gif2png:20120309             ruli:20080101
  25.710 +    giflib:20120620              rush:20100708
  25.711 +    gift-ares:20080101           rvm:20101001
  25.712 +    gift-fasttrack:20080101      rwhoisd:20080101
  25.713 +    gift-gnutella:20080101       rxspencer:20080906
  25.714 +    gift-openft:20080101         rzip:20080101
  25.715 +    gift:20080101                sa:20080101
  25.716 +    giftcurs:20080101            sablecc:20120627
  25.717 +    git:20120622                 sablotron:20080101
  25.718 +    gjdoc:20120603               sam2p:20091123
  25.719 +    gjrand:20110701              samba:20120626
  25.720 +    glark:20101219               samhain:20120503
  25.721 +    glassfish:20120623           sasl:20101020
  25.722 +    gle:20120623                 sass:20120303
  25.723 +    glib:20080101                sav:20080101
  25.724 +    glib2:20120610               saxon:20111004
  25.725 +    glibmm:20100107              sbt:20110925
  25.726 +    glimpse:20081220             scala:20120414
  25.727 +    global:20120603              scanssh:20080101
  25.728 +    glpk:20111211                sccs:20110428
  25.729 +    gmime:20120614               scli:20100220
  25.730 +    gmime22:20120410             scons:20110910
  25.731 +    gmime24:20120219             scponly:20101209
  25.732 +    gmp:20120511                 screen:20110217
  25.733 +    gnats:20080101               sec:20120124
  25.734 +    gnet:20100220                sed:20090628
  25.735 +    gntp:20100505                see:20090428
  25.736 +    gnuchess:20120603            seed7:20120623
  25.737 +    gnuit:20090224               sendfile:20080526
  25.738 +    gnupg:20120329               sendmail:20120521
  25.739 +    gnupg1:20120201              serf:20120321
  25.740 +    gnuplot:20120623             sfio:20080101
  25.741 +    gnutls:20120609              sgml:20080101
  25.742 +    go:20120414                  sgmlfmt:20080101
  25.743 +    goaccess:20110103            sgrep:20080101
  25.744 +    gocr:20120623                sh:20100306
  25.745 +    googlecl:20110402            shared-mime-info:20101205
  25.746 +    gperf:20090206               sharutils:20120605
  25.747 +    gpg-error:20101027           shellinabox:20111101
  25.748 +    gpgme:20110731               shiela:20080207
  25.749 +    gpp:20080322                 shishi:20120605
  25.750 +    gprolog:20110731             shrinksafe:20081225
  25.751 +    gradle:20120612              shsql:20080101
  25.752 +    grammatica:20090309          shtool:20080718
  25.753 +    graphite:20100108            shush:20090721
  25.754 +    graphviz:20120623            sid:20100110
  25.755 +    grep:20120425                siege:20100809
  25.756 +    grepcidr:20080101            sio:20080101
  25.757 +    grepmail:20080101            sipcalc:20090721
  25.758 +    groff:20101231               siproxd:20091012
  25.759 +    groovy:20120628              sipsak:20080101
  25.760 +    grzip:20080101               sitecopy:20110731
  25.761 +    gsasl:20120529               skey:20080101
  25.762 +    gsl:20110731                 skill:20080101
  25.763 +    gsm:20090406                 sks:20080101
  25.764 +    gsnmp:20100220               slang:20110731
  25.765 +    gsoap:20100406               sleuthkit:20111009
  25.766 +    gss:20120603                 smalltalk:20120605
  25.767 +    guile:20120201               smbc:20080101
  25.768 +    gup:20080405                 smbget:20080101
  25.769 +    gyp:20120515                 smlnj:20120623
  25.770 +    gzip:20120618                smokeping:20080725
  25.771 +    h2:20120523                  smtpfeed:20080101
  25.772 +    hadoop:20120517              snappy:20120225
  25.773 +    haildb:20111211              sng:20110717
  25.774 +    haml:20120304                snmp:20111211
  25.775 +    hamsterdb:20120123           snmpdx:20080101
  25.776 +    haproxy:20120521             snort:20100427
  25.777 +    haxe:20110131                snownews:20090919
  25.778 +    hclnfsd:20080101             soapbox:20120406
  25.779 +    hdf:20120603                 soapjr:20090326
  25.780 +    heartbeat:20080101           socat:20120515
  25.781 +    heimdal:20100914             softflowd:20080101
  25.782 +    heise:20110205               solarium:20120417
  25.783 +    hevea:20080101               solr:20120412
  25.784 +    hexcurse:20080101            solrflux:20110730
  25.785 +    hexdump:20101021             soot:20120123
  25.786 +    hexer:20110831               sophie:20080101
  25.787 +    highlight:20120105           source-highlight:20120701
  25.788 +    hlfl:20100110                sox:20110228
  25.789 +    honeyd:20080101              spamassassin:20110526
  25.790 +    hping:20080101               spambouncer:20080101
  25.791 +    htdig:20080101               spandsp:20100108
  25.792 +    html2latex:20080101          spdylay:20120612
  25.793 +    html2ps:20100508             speex:20080724
  25.794 +    html2text:20080101           spegla:20080101
  25.795 +    httptunnel:20080101          spin:20120623
  25.796 +    httrack:20100105             splint:20080101
  25.797 +    hugs:20080101                spread:20091003
  25.798 +    hungrycat:20120310           spring:20110731
  25.799 +    hypermail:20080101           sqlite:20120625
  25.800 +    iat:20090825                 sqlitedbms:20080101
  25.801 +    iburg:20080101               sqlshell:20120523
  25.802 +    icecast:20120612             sqlsync:20080508
  25.803 +    ices:20091202                squid:20120609
  25.804 +    icmake:20090430              squidguard:20100910
  25.805 +    icns:20090627                squirrelmail:20100723
  25.806 +    icon-theme:20101109          srp:20081223
  25.807 +    icon:20100414                ss5:20120525
  25.808 +    icoutils:20090817            sshfp:20111211
  25.809 +    icu:20110526                 ssldump:20080101
  25.810 +    id3lib:20080101              sslh:20120519
  25.811 +    idutils:20120603             ssmtp:20110731
  25.812 +    ifile:20080101               ssss:20080325
  25.813 +    iftop:20111005               sswf:20090308
  25.814 +    iksemel:20090726             star:20080523
  25.815 +    imagemagick:20120623         statsvn:20100105
  25.816 +    imap:20120603                steghide:20080101
  25.817 +    imap2mbox:20091102           stlport:20100111
  25.818 +    imapd:20120603               stonevpn:20120128
  25.819 +    imapfilter:20100124          str:20080101
  25.820 +    imapsync:20101027            strace:20091022
  25.821 +    imaputils:20080101           stuffit:20080101
  25.822 +    imlib:20120623               stun:20080101
  25.823 +    indent:20090614              stunnel:20111211
  25.824 +    inetutils:20120603           styx:20101230
  25.825 +    infozip:20080101             subgit:20120313
  25.826 +    iniparser:20080401           subversion-apache:20120518
  25.827 +    inn:20090309                 subversion-cvs:20100725
  25.828 +    instant:20100105             subversion-perl:20110602
  25.829 +    integrit:20080101            subversion-python:20110602
  25.830 +    interceptty:20080101         subversion:20120518
  25.831 +    intltool:20090315            suck:20080101
  25.832 +    io:20100110                  sudo:20120531
  25.833 +    iodbc:20120329               sudosh:20100710
  25.834 +    iozone:20120511              sugarcrm:20120701
  25.835 +    ipaudit:20080101             super:20120310
  25.836 +    ircd:20080101                supervisord:20111126
  25.837 +    ircii:20110731               supose:20100612
  25.838 +    ironout:20080924             surl:20120309
  25.839 +    irssi:20100403               svk:20111103
  25.840 +    iselect:20080101             svnauthcheck:20111113
  25.841 +    ispell:20120607              svnnotify:20111030
  25.842 +    its4:20080101                svntree2files:20090410
  25.843 +    jabberd:20110602             svnweb:20100725
  25.844 +    jam:20100323                 svrcore:20090410
  25.845 +    jargon:20080101              svs:20091018
  25.846 +    jarjar:20120504              swaks:20120321
  25.847 +    jarprocessor:20111207        swatch:20080704
  25.848 +    jasmin:20100508              swfmill:20111107
  25.849 +    jasper:20080101              swftools:20120409
  25.850 +    java-gcj:20080101            swhoisd:20080101
  25.851 +    java-jdk15:20080709          swig:20120526
  25.852 +    java-jdk16:20100111          sympa:20090418
  25.853 +    java-jdkfake:20090922        synctool:20100729
  25.854 +    java:20091207                syslog-ng:20120527
  25.855 +    javacc:20090717              sysmon:20080101
  25.856 +    jboss:20080101               t1lib:20120623
  25.857 +    jclazz:20090430              tacacs:20080101
  25.858 +    jenkins:20120625             tailor:20120606
  25.859 +    jflex:20090131               talkfilters:20080101
  25.860 +    jidgen:20081017              tar:20110731
  25.861 +    jikes:20080101               tardy:20100522
  25.862 +    jitterbug:20080101           tcl:20120623
  25.863 +    jode:20080101                tcpdump:20120613
  25.864 +    joe:20090327                 tcpreplay:20100405
  25.865 +    john:20111124                tcptrace:20080101
  25.866 +    joomla:20111211              tcptraceroute:20080101
  25.867 +    jpeg:20120116                tcptrack:20080207
  25.868 +    jrst:20090223                tcpwrappers:20080101
  25.869 +    js:20111103                  tcsh:20081010
  25.870 +    js2coffee:20120410           teapop:20080101
  25.871 +    jsdoc:20080726               tecla:20120613
  25.872 +    jslim:20120117               termutils:20080101
  25.873 +    jslint:20120122              tetex:20120623
  25.874 +    json:20110522                tex4ht:20080101
  25.875 +    jsqsh:20120523               texinfo:20080923
  25.876 +    jxplorer:20100503            texlive:20120623
  25.877 +    kaffe:20080101               tftp:20110624
  25.878 +    kcd:20090327                 the:20111211
  25.879 +    kelbt:20120123               theora:20091003
  25.880 +    kerberos:20100227            thrift:20111130
  25.881 +    kermit:20080101              throttle:20080305
  25.882 +    keychain:20080101            thttpd:20080101
  25.883 +    kimwitu:20080101             tidy:20110313
  25.884 +    klish:20120630               tiff:20120219
  25.885 +    knot:20120421                tika:20111111
  25.886 +    kotlin:20120217              tin:20111226
  25.887 +    kouprey:20091012             tinyap:20080512
  25.888 +    ksh:20120109                 tinyproxy:20080101
  25.889 +    kwiki:20090823               tla:20080101
  25.890 +    l2:20090710                  tmake:20110320
  25.891 +    lame:20120301                tmpp:20080806
  25.892 +    lasem:20100216               tmux:20120124
  25.893 +    latex2html:20080924          tokyocabinet:20120411
  25.894 +    lcal:20080101                tomcat:20120629
  25.895 +    lcdf-typetools:20120414      top:20090522
  25.896 +    lcms:20111216                tor:20120427
  25.897 +    ldapdiff:20081214            trac-plugins:20110619
  25.898 +    ldapuseradd:20111122         trac:20120207
  25.899 +    ldapvi:20080101              traceroute:20080101
  25.900 +    ldns:20120523                trafficserver:20120622
  25.901 +    lemon:20090718               trang:20080815
  25.902 +    leo:20080504                 transcode:20091101
  25.903 +    less:20120627                tre:20090920
  25.904 +    lessjs:20120618              tree:20091126
  25.905 +    leveldb:20110730             treecc:20080101
  25.906 +    lex:20080101                 tripwire:20080101
  25.907 +    lft:20080516                 ts:20120527
  25.908 +    lftp:20120531                tsocks:20080101
  25.909 +    lha:20080101                 ttf2eot:20120102
  25.910 +    libarchive:20120113          ttfautohint:20120617
  25.911 +    libart:20100402              ttmkfdir:20100405
  25.912 +    libassuan:20120603           tw:20120109
  25.913 +    libbls:20091116              twiki:20080101
  25.914 +    libcli:20100313              txr:20120421
  25.915 +    libcroco:20111116            txt2html:20080508
  25.916 +    libdaemon:20100813           txt2man:20110317
  25.917 +    libdbi:20080607              txt2pdf:20100106
  25.918 +    libdnet:20080101             txt2regex:20080101
  25.919 +    libdrizzle:20100319          txt2tags:20080727
  25.920 +    libdvdcss:20120312           typo3:20120523
  25.921 +    libdvdread:20090329          ucarp:20100201
  25.922 +    libecap:20110219             ucblogo:20100111
  25.923 +    libedit:20120602             ucl:20080101
  25.924 +    libee:20120417               ucspi-tcp:20080101
  25.925 +    libeio:20100812              udns:20111230
  25.926 +    libelf:20091101              uglifyjs:20120528
  25.927 +    libelvin:20080101            umlspeed:20080101
  25.928 +    libemf:20120526              unarj:20080101
  25.929 +    libesmtp:20100810            unfsd:20090106
  25.930 +    libestr:20110803             unhash:20100220
  25.931 +    libev:20110216               uni2ascii:20110515
  25.932 +    libevent:20120504            unifdef:20110223
  25.933 +    libexecinfo:20100328         unison:20110418
  25.934 +    libexif:20101216             units:20120629
  25.935 +    libexplain:20110827          uniutils:20090219
  25.936 +    libextractor:20111211        unix-essentials:20100329
  25.937 +    libfa:20111203               unixodbc:20111126
  25.938 +    libffi:20120603              unrar:20120614
  25.939 +    libfirm:20111223             upx:20111213
  25.940 +    libflaim:20080101            uriparser:20090305
  25.941 +    libgda:20080101              urpmi:20100111
  25.942 +    libgdome:20080101            usemod:20080101
  25.943 +    libghttp:20080101            ustl:20120219
  25.944 +    libgit2:20120612             uucp:20080101
  25.945 +    libgnomeprint:20100929       uudeview:20080101
  25.946 +    libgsasl:20120603            uuid:20080717
  25.947 +    libgsf:20110521              uvscan:20101229
  25.948 +    libhx:20091012               uxdstools:20101126
  25.949 +    libical:20111214             v8:20120625
  25.950 +    libiconv:20110807            vacation:20080216
  25.951 +    libidl:20100331              val:20080101
  25.952 +    libidn:20120529              vala-gee:20090721
  25.953 +    libjio:20110228              vala:20110918
  25.954 +    libjit:20081210              valgrind:20111107
  25.955 +    libjudy:20110227             var:20080101
  25.956 +    libksba:20110303             varnish:20120521
  25.957 +    liblogging:20080506          vbindiff:20080727
  25.958 +    liblqr:20090725              vcdiff:20120404
  25.959 +    liblzf:20110208              vcheck:20110311
  25.960 +    libmcrypt:20080101           vd:20090510
  25.961 +    libmicrohttpd:20120605       vfu:20120609
  25.962 +    libmikmod:20080101           viewmtn:20080101
  25.963 +    libming:20100207             viewvc:20120623
  25.964 +    libmpeg2:20090329            vifm:20120625
  25.965 +    libmrss:20080823             vile:20120627
  25.966 +    libmsgque:20101201           vilistextum:20080101
  25.967 +    libnatpmp:20110809           vim-plugin-misc:20110708
  25.968 +    libnet:20080416              vim-plugin-shell:20110731
  25.969 +    libnetdude:20100317          vim:20120623
  25.970 +    libnfsidmap:20111207         visitors:20080101
  25.971 +    libnids:20100314             vorbis-libs:20120204
  25.972 +    libntlm:20091106             vorbis-tools:20080101
  25.973 +    libnut:20090314              vortex:20120105
  25.974 +    libnxml:20080823             vpnc:20091104
  25.975 +    libodbcplus:20120623         vrl:20090509
  25.976 +    liboil:20100205              vstr:20080101
  25.977 +    liboop:20080101              w3m:20110115
  25.978 +    liboping:20120201            waf:20120415
  25.979 +    libopkele:20091223           wcd:20120301
  25.980 +    libparsifal:20090725         wdg-validator:20110303
  25.981 +    libpcap:20120613             wdiff:20120603
  25.982 +    libpcapnav:20080101          weaveserver:20100131
  25.983 +    libpipeline:20120303         webalizer:20110110
  25.984 +    libpixman:20120630           webdis:20110223
  25.985 +    libpki:20110615              webmin:20110805
  25.986 +    libpst:20111226              webp:20111118
  25.987 +    libptytty:20090504           wget:20111018
  25.988 +    libradius:20080101           whatmask:20080101
  25.989 +    libraw:20120628              whetstone:20080101
  25.990 +    librelp:20091213             which:20080807
  25.991 +    librmath:20120622            whois:20111226
  25.992 +    librsvg:20120623             whoson:20090711
  25.993 +    librsync:20080101            wipe:20101219
  25.994 +    libsamplerate:20110827       wireshark:20120622
  25.995 +    libshout:20120516            wml:20110213
  25.996 +    libsieve:20081116            woff:20120103
  25.997 +    libsigcxx:20120603           wordpress:20120629
  25.998 +    libsigsegv:20110403          wput:20100110
  25.999 +    libsmbclient:20120626        wv:20120623
 25.1000 +    libsndfile:20110715          x264:20120414
 25.1001 +    libsoup:20111122             x509:20120315
 25.1002 +    libspf2:20081105             xalan:20080101
 25.1003 +    libsrs2:20080101             xar:20080105
 25.1004 +    libssh2:20120519             xbase:20080101
 25.1005 +    libtasn1:20120603            xdelta:20100803
 25.1006 +    libtelnet:20100110           xds:20080101
 25.1007 +    libtool:20111211             xerces-c:20100620
 25.1008 +    libtpl:20100206              xfpt:20120520
 25.1009 +    libunistring:20110216        xinetd:20080101
 25.1010 +    liburcu:20120421             xjobs:20120413
 25.1011 +    libutf8:20100105             xmake:20080101
 25.1012 +    libutf8proc:20100110         xml-coreutils:20110731
 25.1013 +    libuuid:20101223             xml2rfc:20110327
 25.1014 +    libvncserver:20120623        xmlcatmgr:20080101
 25.1015 +    libvpx:20110403              xmldiff:20081001
 25.1016 +    libwmf:20120623              xmlpatch:20111211
 25.1017 +    libxdiff:20081113            xmlroff:20120623
 25.1018 +    libxml:20101106              xmlrpcpp:20080101
 25.1019 +    libxmlpatch:20111126         xmlsec:20110512
 25.1020 +    libxr:20090223               xmlstarlet:20120115
 25.1021 +    libxslt:20090925             xmlto:20100105
 25.1022 +    libzdb:20120620              xmlvm:20100328
 25.1023 +    libzip:20120321              xnm:20090130
 25.1024 +    lighttpd:20120601            xpdf:20120623
 25.1025 +    limesurvey:20120623          xplain2sql:20080819
 25.1026 +    limo:20080101                xsugar:20090130
 25.1027 +    linc:20080101                xtermcontrol:20120630
 25.1028 +    linkchecker:20090608         xvid:20110602
 25.1029 +    linklint:20080101            xz:20120627
 25.1030 +    links:20120626               yacc:20080101
 25.1031 +    llgen:20080101               yamdi:20110227
 25.1032 +    lljvm:20100125               yaml:20120420
 25.1033 +    llnextgen:20120102           yasm:20111031
 25.1034 +    llvm:20111203                yassl:20100127
 25.1035 +    lmtp2nntp:20080101           yml:20111230
 25.1036 +    log4c:20080921               yodl:20080101
 25.1037 +    log4net:20080204             youtrack:20120630
 25.1038 +    logsurfer:20080101           ypanything:20080101
 25.1039 +    logtools:20080608            ytree:20110110
 25.1040 +    lout:20100922                yuicompressor:20110430
 25.1041 +    lpsolve:20100813             yum:20080101
 25.1042 +    lrzip:20110928               zebra:20080101
 25.1043 +    lrzsz:20080101               zile:20111222
 25.1044 +    lsh:20080101                 zimg:20080101
 25.1045 +    lsof:20120603                ziproxy:20100909
 25.1046 +    lua-cjson:20120302           zlex:20080101
 25.1047 +    lua-curl:20100208            zlib:20120503
 25.1048 +    lua-posix:20080719           zmq:20111004
 25.1049 +    lua-rdbms:20080608           zoem:20110617
 25.1050 +    lua-regex:20101216           zoo:20080101
 25.1051 +    lua-socket:20080608          zope-cmf:20080106
 25.1052 +    lua-std:20110227             zope-plone:20080101
 25.1053 +    lua:20120616                 zope:20080510
 25.1054 +    luit:20120623                zsh:20120603
 25.1055 +    lwc:20080101                 zsync:20100920
 25.1056 +    lynx:20090707                zyacc:20080101
 25.1057 +    lzip:20120313                zziplib:20120311
 25.1058 +    lzlib:20120408
 25.1059 +
 25.1060 +-----BEGIN PGP SIGNATURE-----
 25.1061 +Comment: OpenPKG GmbH <openpkg@openpkg.com>
 25.1062 +
 25.1063 +iEYEARECAAYFAk/wbhYACgkQZwQuyWG3rjQkjACfUNFTGwKIiCEhQrOSi3P4BWTu
 25.1064 +tf4AoLdAZtAXzDeduf6bKpzR1fM0jFAE
 25.1065 +=YgE4
 25.1066 +-----END PGP SIGNATURE-----
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/openpkg/license-EVAL.txt	Tue Jul 31 12:23:42 2012 +0200
    26.3 @@ -0,0 +1,272 @@
    26.4 +-----BEGIN PGP SIGNED MESSAGE-----
    26.5 +Hash: SHA1
    26.6 +
    26.7 +Id:       EVAL
    26.8 +Name:     OpenPKG Framework Evaluation License
    26.9 +Version:  1.0.0
   26.10 +Issuer:   OpenPKG GmbH <openpkg@openpkg.com>
   26.11 +Issued:   2010-01-01
   26.12 +
   26.13 +Licensee: arbitrary deployer of OpenPKG Framework
   26.14 +          with this run-time license activated
   26.15 +
   26.16 +Description:
   26.17 +
   26.18 +    OPENPKG FRAMEWORK EVALUATION LICENSE
   26.19 +    ====================================
   26.20 +
   26.21 +    This license agreement constitutes a valid and binding agreement
   26.22 +    between the OpenPKG GmbH, jurisdiction identification "DE MUC HRB
   26.23 +    160208", postal address "Weblinger Weg 28, 85221 Dachau, GERMANY",
   26.24 +    digital signature name "OpenPKG GmbH <openpkg@openpkg.com>" and
   26.25 +    digital signature fingerprint "7D12 1A8F C05D C18A 4329 E9EF 6704
   26.26 +    2EC9 61B7 AE34", represented by the two managing directors Ralf S.
   26.27 +    Engelschall and Thomas Lotterer, and you, the licensee.
   26.28 +
   26.29 +    "You" means the natural person or the entity that is agreeing to be
   26.30 +    bound by this agreement. You shall be liable for any failure by your
   26.31 +    employees and third party contractors that provide services to you
   26.32 +    to comply with the terms and conditions of this agreement.
   26.33 +
   26.34 +    AGREEMENT
   26.35 +    ---------
   26.36 +
   26.37 +    By using, copying, modifying or distributing the Product you agree
   26.38 +    to be bound by the terms and conditions of this agreement. If you
   26.39 +    are accepting these terms on behalf of another person or a company
   26.40 +    or other legal entity, you represent and warrant that you have full
   26.41 +    authority to bind that person, company, or legal entity to these
   26.42 +    terms. If you do not agree to the terms and conditions of this
   26.43 +    agreement, you may not use, copy, modify or distribute the Product.
   26.44 +    You may return the unused Product to the supplier from which you
   26.45 +    acquired it within 30 days and request a refund of the license fee,
   26.46 +    if any, already paid upon showing proof of payment.
   26.47 +
   26.48 +    TERMINOLOGY
   26.49 +    -----------
   26.50 +
   26.51 +    OpenPKG is a solution to build software stacks consisting of OpenPKG
   26.52 +    Packages and an OpenPKG Framework to operate them.
   26.53 +
   26.54 +    For your information, OpenPKG Packages are available from the
   26.55 +    OpenPKG Foundation e.V., which licenses and distributes them as Open
   26.56 +    Source Software. These OpenPKG Packages are in no way subject of
   26.57 +    this agreement.
   26.58 +
   26.59 +    The OpenPKG Framework is a property of the OpenPKG GmbH with all
   26.60 +    rights reserved. Licenses, like this one, which grant limited
   26.61 +    permission to use, copy, modify and distribute this software are
   26.62 +    exclusively issued by the OpenPKG GmbH.
   26.63 +
   26.64 +    Licensing as described in this agreement covers the OpenPKG
   26.65 +    Framework code copyrighted by the OpenPKG GmbH and the OpenPKG
   26.66 +    Framework as a compound work. The OpenPKG Framework is distributed
   26.67 +    in source code form and also contains pristine third-party sources
   26.68 +    where each comes with its own licensing model. These licenses are
   26.69 +    in no way altered by this agreement, but passed through to you
   26.70 +    verbatim. You are responsible for obtaining and obeying any such
   26.71 +    vendor license.
   26.72 +
   26.73 +    This license describes how you appropriately use, copy, modify
   26.74 +    and distribute the OpenPKG Framework source code and the binaries
   26.75 +    resulting from the build process. This license does not include any
   26.76 +    entitlement for you to receive service or support from the OpenPKG
   26.77 +    GmbH, there are no warranties beyond the minimum implied warranty,
   26.78 +    and there are no promises with respect to the future of the Product
   26.79 +    or any derived works.
   26.80 +
   26.81 +    GRANT OF RIGHTS GENERAL TERMS
   26.82 +    -----------------------------
   26.83 +
   26.84 +    The OpenPKG Framework is licensed, not sold. Subject to the terms
   26.85 +    and conditions of this agreement, the OpenPKG GmbH hereby grants
   26.86 +    you a non-exclusive, non-sub-licensable and non-transferable right
   26.87 +    to use the Product. You may not lease or rent the OpenPKG Framework
   26.88 +    license.
   26.89 +
   26.90 +    You may sell or otherwise transfer unused licenses if you ensure
   26.91 +    the recipient receives these terms and conditions with the same
   26.92 +    transaction and acknowledges to take over your responsibilities from
   26.93 +    this agreement.
   26.94 +
   26.95 +    You may not remove any titles, trademarks or trade names, copyright
   26.96 +    notices, legends, or other proprietary markings on the Product. You
   26.97 +    are not granted any rights to any trademarks or service marks of the
   26.98 +    OpenPKG GmbH. All rights not expressly granted by this license are
   26.99 +    reserved.
  26.100 +
  26.101 +    You may use the Product as long as you own this license issued by
  26.102 +    the OpenPKG GmbH, install it and obey the terms and conditions
  26.103 +    listed below. This license, issued by the OpenPKG GmbH, ships
  26.104 +    as a digitally signed text file which carries the exact license
  26.105 +    conditions both in human readable plain text and attached in a
  26.106 +    machine readable format. The latter may be used by the OpenPKG
  26.107 +    Framework to programmatically validate the license compliance. If
  26.108 +    programmatic license validation within the OpenPKG Framework detects
  26.109 +    a compliance failure, the OpenPKG Framework might cease operation.
  26.110 +    It is your responsibility to ensure compliance with these terms and
  26.111 +    conditions.
  26.112 +
  26.113 +    GRANT OF RIGHTS TO USE THE OPENPKG FRAMEWORK
  26.114 +    --------------------------------------------
  26.115 +
  26.116 +    This "evaluation" license ships free of charge with every OpenPKG
  26.117 +    Framework and allows restricted use of the OpenPKG Framework. The
  26.118 +    constraint is a run-time limitation after initial installation,
  26.119 +    see "Assertion-InstanceAge" at the bottom of this document. After
  26.120 +    that period the evaluation license is void and either must be
  26.121 +    replaced by another license or use of the OpenPKG Framework must be
  26.122 +    discontinued.
  26.123 +
  26.124 +    GRANT OF RIGHTS TO COPY THE OPENPKG FRAMEWORK
  26.125 +    ---------------------------------------------
  26.126 +
  26.127 +    You may create an unlimited number of copies of the Product.
  26.128 +
  26.129 +    GRANT OF RIGHTS TO MODIFY THE OPENPKG FRAMEWORK
  26.130 +    -----------------------------------------------
  26.131 +
  26.132 +    You may modify most parts of the Product and adjust it to your
  26.133 +    needs, creating derivative works. You may not remove license
  26.134 +    validation code, and you must ensure the preservation of the OpenPKG
  26.135 +    GmbH fingerprint data. The copyright notice, the license excerpt and
  26.136 +    the reference to this terms and conditions must be kept verbatim.
  26.137 +    You must make clear to the recipient of the derived works that the
  26.138 +    version he is receiving has been modified and by whom.
  26.139 +
  26.140 +    These terms and conditions stay if force for derivative works. To
  26.141 +    keep modifications your property you must not distribute them, in
  26.142 +    source or binary form, beyond your organizational scope. In cases
  26.143 +    of extended distribution or publication you agree to contribute
  26.144 +    your modifications automatically, free of charge and without any
  26.145 +    royalty claims, to the OpenPKG GmbH, transfer the source code of
  26.146 +    your modifications to the OpenPKG GmbH and irrevocably transfer
  26.147 +    all rights of your modifications to the OpenPKG GmbH which will
  26.148 +    grant you unlimited use rights to your contribution. There is no
  26.149 +    promise the OpenPKG GmbH includes your contribution into the OpenPKG
  26.150 +    Framework.
  26.151 +
  26.152 +    GRANT OF RIGHTS TO DISTRIBUTE THE OPENPKG FRAMEWORK
  26.153 +    ---------------------------------------------------
  26.154 +
  26.155 +    You may distribute the Product, or derivative works thereof created
  26.156 +    under adherence of the "rights to modify" grant, if you ensure
  26.157 +    the recipient receives these terms and conditions with the same
  26.158 +    transaction.
  26.159 +
  26.160 +    ONLINE ACCESS
  26.161 +    -------------
  26.162 +
  26.163 +    The OpenPKG Framework collects information about the OpenPKG
  26.164 +    Framework, OpenPKG Framework License and OpenPKG Packages for use
  26.165 +    by the OpenPKG Project, the OpenPKG Foundation e.V. and the OpenPKG
  26.166 +    GmbH. The programmatic license validation might and the information
  26.167 +    upload process does require online access to the Internet. You agree
  26.168 +    to grant the OpenPKG Framework permission for this use case and you
  26.169 +    assume all costs related to the online access.
  26.170 +
  26.171 +    TERMINATION
  26.172 +    -----------
  26.173 +
  26.174 +    You may not use the OpenPKG Framework except as expressly
  26.175 +    provided under the license. Any attempt to otherwise use, copy,
  26.176 +    modify, distribute or sub-license the Product is void, and will
  26.177 +    automatically terminate your rights under this license.
  26.178 +
  26.179 +    CHANGE
  26.180 +    ------
  26.181 +
  26.182 +    The OpenPKG GmbH reserves the right to subsequently modify or amend
  26.183 +    details of these terms and conditions where this seems applicable,
  26.184 +    as long as you are, in good faith, not disadvantaged thereby.
  26.185 +
  26.186 +    Those changes or amendments of the terms and conditions will be
  26.187 +    proclaimed to you by a written document, delivered to you in
  26.188 +    electronic format or paper mail as chosen by the OpenPKG GmbH.
  26.189 +    Anonymous and unknown users cannot be contacted by the OpenPKG GmbH.
  26.190 +    They must review the terms and conditions regularly at the same time
  26.191 +    they obtain or use an updated OpenPKG Framework. You cannot rise an
  26.192 +    objection against the proclaimed changes or amendments. However, you
  26.193 +    can terminate the license agreement without prior notice.
  26.194 +
  26.195 +    DISCLAIMER
  26.196 +    ----------
  26.197 +
  26.198 +    THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
  26.199 +    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  26.200 +    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  26.201 +    IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  26.202 +    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26.203 +    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26.204 +    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  26.205 +    USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  26.206 +    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26.207 +    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  26.208 +    OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  26.209 +    SUCH DAMAGE.
  26.210 +
  26.211 +    LIMITED WARRANTY AND LIMITATION OF LIABILITY
  26.212 +    --------------------------------------------
  26.213 +
  26.214 +    The OpenPKG GmbH is only liable for damages if the OpenPKG GmbH
  26.215 +    or one of its vicarious agents has violated a major contractual
  26.216 +    (cardinal) obligation or jeopardized the intention of the agreement
  26.217 +    or the damage was done by gross negligence or intention of the
  26.218 +    OpenPKG GmbH or one of its vicarious agents.
  26.219 +
  26.220 +    In case the violation of a cardinal obligation is not caused by
  26.221 +    gross negligence or intention of the OpenPKG GmbH or one of its
  26.222 +    vicarious agents the liability of the OpenPKG GmbH is limited to the
  26.223 +    predictable damage characteristical for the contract.
  26.224 +
  26.225 +    The preceding liability limitations apply for contractual and
  26.226 +    non-contractual claims. The liability of the OpenPKG GmbH due to
  26.227 +    warranties, personal injury and due to the German Product Liability
  26.228 +    Act remains unaffected from the preceding liability limitations.
  26.229 +
  26.230 +    GENERAL
  26.231 +    -------
  26.232 +
  26.233 +    This agreement sets forth the OpenPKG GmbH's entire liability and
  26.234 +    your exclusive remedy with respect to the Product and supersedes
  26.235 +    the terms of any purchase orders and any other communications or
  26.236 +    advertising with respect to the Product. You acknowledge that this
  26.237 +    agreement is a complete statement of the agreement between you
  26.238 +    and the OpenPKG GmbH with respect to the Product, and that there
  26.239 +    are no other prior or contemporaneous understandings, promises,
  26.240 +    representations, or descriptions with respect to the Product.
  26.241 +
  26.242 +    Headings under this agreement are intended only for convenience and
  26.243 +    shall not affect the interpretation of this agreement.
  26.244 +
  26.245 +    No failure of either party to exercise or enforce any of its rights
  26.246 +    under this agreement will act as a waiver of those rights. This
  26.247 +    agreement may only be modified, or any rights under it waived, by a
  26.248 +    written document executed by the party against which it is asserted.
  26.249 +
  26.250 +    If any provision of this agreement is found illegal or
  26.251 +    unenforceable, it will be enforced to the maximum extent
  26.252 +    permissible, and the legality and enforceability of the other
  26.253 +    provisions of this agreement will not be affected.
  26.254 +
  26.255 +    This agreement is governed by German law.
  26.256 +
  26.257 +    If you have any questions about this agreement please contact the
  26.258 +    OpenPKG GmbH. Direct all traditional paper correspondence to the
  26.259 +    official company address as listed in the very first paragraph of
  26.260 +    this document. You find the most recent contact information on our
  26.261 +    website http://openpkg.com/
  26.262 +
  26.263 +    You can find the most recent version of this document on our website
  26.264 +    http://openpkg.com/go/framework-license
  26.265 +
  26.266 +Assertion-MinProcVersion: 0.9.0
  26.267 +Assertion-InstanceAge:    90d
  26.268 +
  26.269 +-----BEGIN PGP SIGNATURE-----
  26.270 +Comment: OpenPKG GmbH <openpkg@openpkg.com>
  26.271 +
  26.272 +iEYEARECAAYFAktAcOAACgkQZwQuyWG3rjTH+gCfXyfm2xzMoGqsYthehkbLh+8x
  26.273 +mooAnA6O7bygggM8RaHjRZs2YZ1oQAqa
  26.274 +=zsbV
  26.275 +-----END PGP SIGNATURE-----
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/openpkg/license-EXAMPLE.txt	Tue Jul 31 12:23:42 2012 +0200
    27.3 @@ -0,0 +1,275 @@
    27.4 +-----BEGIN PGP SIGNED MESSAGE-----
    27.5 +Hash: SHA1
    27.6 +
    27.7 +Id:       EXAMPLE
    27.8 +Name:     OpenPKG Framework Example License
    27.9 +Version:  1.0.0
   27.10 +Issuer:   OpenPKG GmbH <openpkg@openpkg.com>
   27.11 +Issued:   2010-01-01
   27.12 +
   27.13 +Licensee: arbitrary deployer of OpenPKG Framework
   27.14 +          with this run-time license activated
   27.15 +
   27.16 +Description:
   27.17 +
   27.18 +    OPENPKG FRAMEWORK EXAMPLE LICENSE
   27.19 +    =================================
   27.20 +
   27.21 +    This license agreement constitutes a valid and binding agreement
   27.22 +    between the OpenPKG GmbH, jurisdiction identification "DE MUC HRB
   27.23 +    160208", postal address "Weblinger Weg 28, 85221 Dachau, GERMANY",
   27.24 +    digital signature name "OpenPKG GmbH <openpkg@openpkg.com>" and
   27.25 +    digital signature fingerprint "7D12 1A8F C05D C18A 4329 E9EF 6704
   27.26 +    2EC9 61B7 AE34", represented by the two managing directors Ralf S.
   27.27 +    Engelschall and Thomas Lotterer, and you, the licensee.
   27.28 +
   27.29 +    "You" means the natural person or the entity that is agreeing to be
   27.30 +    bound by this agreement. You shall be liable for any failure by your
   27.31 +    employees and third party contractors that provide services to you
   27.32 +    to comply with the terms and conditions of this agreement.
   27.33 +
   27.34 +    AGREEMENT
   27.35 +    ---------
   27.36 +
   27.37 +    By using, copying, modifying or distributing the Product you agree
   27.38 +    to be bound by the terms and conditions of this agreement. If you
   27.39 +    are accepting these terms on behalf of another person or a company
   27.40 +    or other legal entity, you represent and warrant that you have full
   27.41 +    authority to bind that person, company, or legal entity to these
   27.42 +    terms. If you do not agree to the terms and conditions of this
   27.43 +    agreement, you may not use, copy, modify or distribute the Product.
   27.44 +    You may return the unused Product to the supplier from which you
   27.45 +    acquired it within 30 days and request a refund of the license fee,
   27.46 +    if any, already paid upon showing proof of payment.
   27.47 +
   27.48 +    TERMINOLOGY
   27.49 +    -----------
   27.50 +
   27.51 +    OpenPKG is a solution to build software stacks consisting of OpenPKG
   27.52 +    Packages and an OpenPKG Framework to operate them.
   27.53 +
   27.54 +    For your information, OpenPKG Packages are available from the
   27.55 +    OpenPKG Foundation e.V., which licenses and distributes them as Open
   27.56 +    Source Software. These OpenPKG Packages are in no way subject of
   27.57 +    this agreement.
   27.58 +
   27.59 +    The OpenPKG Framework is a property of the OpenPKG GmbH with all
   27.60 +    rights reserved. Licenses, like this one, which grant limited
   27.61 +    permission to use, copy, modify and distribute this software are
   27.62 +    exclusively issued by the OpenPKG GmbH.
   27.63 +
   27.64 +    Licensing as described in this agreement covers the OpenPKG
   27.65 +    Framework code copyrighted by the OpenPKG GmbH and the OpenPKG
   27.66 +    Framework as a compound work. The OpenPKG Framework is distributed
   27.67 +    in source code form and also contains pristine third-party sources
   27.68 +    where each comes with its own licensing model. These licenses are
   27.69 +    in no way altered by this agreement, but passed through to you
   27.70 +    verbatim. You are responsible for obtaining and obeying any such
   27.71 +    vendor license.
   27.72 +
   27.73 +    This license describes how you appropriately use, copy, modify
   27.74 +    and distribute the OpenPKG Framework source code and the binaries
   27.75 +    resulting from the build process. This license does not include any
   27.76 +    entitlement for you to receive service or support from the OpenPKG
   27.77 +    GmbH, there are no warranties beyond the minimum implied warranty,
   27.78 +    and there are no promises with respect to the future of the Product
   27.79 +    or any derived works.
   27.80 +
   27.81 +    GRANT OF RIGHTS GENERAL TERMS
   27.82 +    -----------------------------
   27.83 +
   27.84 +    The OpenPKG Framework is licensed, not sold. Subject to the terms
   27.85 +    and conditions of this agreement, the OpenPKG GmbH hereby grants
   27.86 +    you a non-exclusive, non-sub-licensable and non-transferable right
   27.87 +    to use the Product. You may not lease or rent the OpenPKG Framework
   27.88 +    license.
   27.89 +
   27.90 +    You may sell or otherwise transfer unused licenses if you ensure
   27.91 +    the recipient receives these terms and conditions with the same
   27.92 +    transaction and acknowledges to take over your responsibilities from
   27.93 +    this agreement.
   27.94 +
   27.95 +    You may not remove any titles, trademarks or trade names, copyright
   27.96 +    notices, legends, or other proprietary markings on the Product. You
   27.97 +    are not granted any rights to any trademarks or service marks of the
   27.98 +    OpenPKG GmbH. All rights not expressly granted by this license are
   27.99 +    reserved.
  27.100 +
  27.101 +    You may use the Product as long as you own this license issued by
  27.102 +    the OpenPKG GmbH, install it and obey the terms and conditions
  27.103 +    listed below. This license, issued by the OpenPKG GmbH, ships
  27.104 +    as a digitally signed text file which carries the exact license
  27.105 +    conditions both in human readable plain text and attached in a
  27.106 +    machine readable format. The latter may be used by the OpenPKG
  27.107 +    Framework to programmatically validate the license compliance. If
  27.108 +    programmatic license validation within the OpenPKG Framework detects
  27.109 +    a compliance failure, the OpenPKG Framework might cease operation.
  27.110 +    It is your responsibility to ensure compliance with these terms and
  27.111 +    conditions.
  27.112 +
  27.113 +    GRANT OF RIGHTS TO USE THE OPENPKG FRAMEWORK
  27.114 +    --------------------------------------------
  27.115 +
  27.116 +    This "example" license ships free of charge with every OpenPKG
  27.117 +    Framework and allows restricted use of the OpenPKG Framework. The
  27.118 +    constraints are the use in documentation, demonstration and training
  27.119 +    material only and the filesystem prefix, user and group
  27.120 +    parameters being locked to certain paramenters, see
  27.121 +    "Assertion-Prefix", "Assertion-User" and "Assertion-Group" at the
  27.122 +    bottom of this document. The license does not impose any life-time
  27.123 +    limitation.
  27.124 +
  27.125 +    GRANT OF RIGHTS TO COPY THE OPENPKG FRAMEWORK
  27.126 +    ---------------------------------------------
  27.127 +
  27.128 +    You may create an unlimited number of copies of the Product.
  27.129 +
  27.130 +    GRANT OF RIGHTS TO MODIFY THE OPENPKG FRAMEWORK
  27.131 +    -----------------------------------------------
  27.132 +
  27.133 +    You may modify most parts of the Product and adjust it to your
  27.134 +    needs, creating derivative works. You may not remove license
  27.135 +    validation code, and you must ensure the preservation of the OpenPKG
  27.136 +    GmbH fingerprint data. The copyright notice, the license excerpt and
  27.137 +    the reference to this terms and conditions must be kept verbatim.
  27.138 +    You must make clear to the recipient of the derived works that the
  27.139 +    version he is receiving has been modified and by whom.
  27.140 +
  27.141 +    These terms and conditions stay if force for derivative works. To
  27.142 +    keep modifications your property you must not distribute them, in
  27.143 +    source or binary form, beyond your organizational scope. In cases
  27.144 +    of extended distribution or publication you agree to contribute
  27.145 +    your modifications automatically, free of charge and without any
  27.146 +    royalty claims, to the OpenPKG GmbH, transfer the source code of
  27.147 +    your modifications to the OpenPKG GmbH and irrevocably transfer
  27.148 +    all rights of your modifications to the OpenPKG GmbH which will
  27.149 +    grant you unlimited use rights to your contribution. There is no
  27.150 +    promise the OpenPKG GmbH includes your contribution into the OpenPKG
  27.151 +    Framework.
  27.152 +
  27.153 +    GRANT OF RIGHTS TO DISTRIBUTE THE OPENPKG FRAMEWORK
  27.154 +    ---------------------------------------------------
  27.155 +
  27.156 +    You may distribute the Product, or derivative works thereof created
  27.157 +    under adherence of the "rights to modify" grant, if you ensure
  27.158 +    the recipient receives these terms and conditions with the same
  27.159 +    transaction.
  27.160 +
  27.161 +    ONLINE ACCESS
  27.162 +    -------------
  27.163 +
  27.164 +    The OpenPKG Framework collects information about the OpenPKG
  27.165 +    Framework, OpenPKG Framework License and OpenPKG Packages for use
  27.166 +    by the OpenPKG Project, the OpenPKG Foundation e.V. and the OpenPKG
  27.167 +    GmbH. The programmatic license validation might and the information
  27.168 +    upload process does require online access to the Internet. You agree
  27.169 +    to grant the OpenPKG Framework permission for this use case and you
  27.170 +    assume all costs related to the online access.
  27.171 +
  27.172 +    TERMINATION
  27.173 +    -----------
  27.174 +
  27.175 +    You may not use the OpenPKG Framework except as expressly
  27.176 +    provided under the license. Any attempt to otherwise use, copy,
  27.177 +    modify, distribute or sub-license the Product is void, and will
  27.178 +    automatically terminate your rights under this license.
  27.179 +
  27.180 +    CHANGE
  27.181 +    ------
  27.182 +
  27.183 +    The OpenPKG GmbH reserves the right to subsequently modify or amend
  27.184 +    details of these terms and conditions where this seems applicable,
  27.185 +    as long as you are, in good faith, not disadvantaged thereby.
  27.186 +
  27.187 +    Those changes or amendments of the terms and conditions will be
  27.188 +    proclaimed to you by a written document, delivered to you in
  27.189 +    electronic format or paper mail as chosen by the OpenPKG GmbH.
  27.190 +    Anonymous and unknown users cannot be contacted by the OpenPKG GmbH.
  27.191 +    They must review the terms and conditions regularly at the same time
  27.192 +    they obtain or use an updated OpenPKG Framework. You cannot rise an
  27.193 +    objection against the proclaimed changes or amendments. However, you
  27.194 +    can terminate the license agreement without prior notice.
  27.195 +
  27.196 +    DISCLAIMER
  27.197 +    ----------
  27.198 +
  27.199 +    THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
  27.200 +    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  27.201 +    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  27.202 +    IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  27.203 +    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  27.204 +    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27.205 +    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  27.206 +    USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  27.207 +    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  27.208 +    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  27.209 +    OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27.210 +    SUCH DAMAGE.
  27.211 +
  27.212 +    LIMITED WARRANTY AND LIMITATION OF LIABILITY
  27.213 +    --------------------------------------------
  27.214 +
  27.215 +    The OpenPKG GmbH is only liable for damages if the OpenPKG GmbH
  27.216 +    or one of its vicarious agents has violated a major contractual
  27.217 +    (cardinal) obligation or jeopardized the intention of the agreement
  27.218 +    or the damage was done by gross negligence or intention of the
  27.219 +    OpenPKG GmbH or one of its vicarious agents.
  27.220 +
  27.221 +    In case the violation of a cardinal obligation is not caused by
  27.222 +    gross negligence or intention of the OpenPKG GmbH or one of its
  27.223 +    vicarious agents the liability of the OpenPKG GmbH is limited to the
  27.224 +    predictable damage characteristical for the contract.
  27.225 +
  27.226 +    The preceding liability limitations apply for contractual and
  27.227 +    non-contractual claims. The liability of the OpenPKG GmbH due to
  27.228 +    warranties, personal injury and due to the German Product Liability
  27.229 +    Act remains unaffected from the preceding liability limitations.
  27.230 +
  27.231 +    GENERAL
  27.232 +    -------
  27.233 +
  27.234 +    This agreement sets forth the OpenPKG GmbH's entire liability and
  27.235 +    your exclusive remedy with respect to the Product and supersedes
  27.236 +    the terms of any purchase orders and any other communications or
  27.237 +    advertising with respect to the Product. You acknowledge that this
  27.238 +    agreement is a complete statement of the agreement between you
  27.239 +    and the OpenPKG GmbH with respect to the Product, and that there
  27.240 +    are no other prior or contemporaneous understandings, promises,
  27.241 +    representations, or descriptions with respect to the Product.
  27.242 +
  27.243 +    Headings under this agreement are intended only for convenience and
  27.244 +    shall not affect the interpretation of this agreement.
  27.245 +
  27.246 +    No failure of either party to exercise or enforce any of its rights
  27.247 +    under this agreement will act as a waiver of those rights. This
  27.248 +    agreement may only be modified, or any rights under it waived, by a
  27.249 +    written document executed by the party against which it is asserted.
  27.250 +
  27.251 +    If any provision of this agreement is found illegal or
  27.252 +    unenforceable, it will be enforced to the maximum extent
  27.253 +    permissible, and the legality and enforceability of the other
  27.254 +    provisions of this agreement will not be affected.
  27.255 +
  27.256 +    This agreement is governed by German law.
  27.257 +
  27.258 +    If you have any questions about this agreement please contact the
  27.259 +    OpenPKG GmbH. Direct all traditional paper correspondence to the
  27.260 +    official company address as listed in the very first paragraph of
  27.261 +    this document. You find the most recent contact information on our
  27.262 +    website http://openpkg.com/
  27.263 +
  27.264 +    You can find the most recent version of this document on our website
  27.265 +    http://openpkg.com/go/framework-license
  27.266 +
  27.267 +Assertion-MinProcVersion: 0.9.0
  27.268 +Assertion-Prefix:         /example
  27.269 +Assertion-User:           example
  27.270 +Assertion-Group:          example
  27.271 +
  27.272 +-----BEGIN PGP SIGNATURE-----
  27.273 +Comment: OpenPKG GmbH <openpkg@openpkg.com>
  27.274 +
  27.275 +iEYEARECAAYFAktAcOIACgkQZwQuyWG3rjSTnACgpJQfhIGbGVd5z7XsM2F+aC8y
  27.276 +nT8AoNrkoEU9ChUQVDse4q9liDfeJayN
  27.277 +=aCvW
  27.278 +-----END PGP SIGNATURE-----
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/openpkg/license-PROMO.txt	Tue Jul 31 12:23:42 2012 +0200
    28.3 @@ -0,0 +1,272 @@
    28.4 +-----BEGIN PGP SIGNED MESSAGE-----
    28.5 +Hash: SHA1
    28.6 +
    28.7 +Id:       PROMO
    28.8 +Name:     OpenPKG Framework Promotion License
    28.9 +Version:  1.0.0
   28.10 +Issuer:   OpenPKG GmbH <openpkg@openpkg.com>
   28.11 +Issued:   2010-01-30
   28.12 +
   28.13 +Licensee: arbitrary deployer of OpenPKG Framework
   28.14 +          with this run-time license activated
   28.15 +
   28.16 +Description:
   28.17 +
   28.18 +    OPENPKG FRAMEWORK PROMOTION LICENSE
   28.19 +    ===================================
   28.20 +
   28.21 +    This license agreement constitutes a valid and binding agreement
   28.22 +    between the OpenPKG GmbH, jurisdiction identification "DE MUC HRB
   28.23 +    160208", postal address "Weblinger Weg 28, 85221 Dachau, GERMANY",
   28.24 +    digital signature name "OpenPKG GmbH <openpkg@openpkg.com>" and
   28.25 +    digital signature fingerprint "7D12 1A8F C05D C18A 4329 E9EF 6704
   28.26 +    2EC9 61B7 AE34", represented by the two managing directors Ralf S.
   28.27 +    Engelschall and Thomas Lotterer, and you, the licensee.
   28.28 +
   28.29 +    "You" means the natural person or the entity that is agreeing to be
   28.30 +    bound by this agreement. You shall be liable for any failure by your
   28.31 +    employees and third party contractors that provide services to you
   28.32 +    to comply with the terms and conditions of this agreement.
   28.33 +
   28.34 +    AGREEMENT
   28.35 +    ---------
   28.36 +
   28.37 +    By using, copying, modifying or distributing the Product you agree
   28.38 +    to be bound by the terms and conditions of this agreement. If you
   28.39 +    are accepting these terms on behalf of another person or a company
   28.40 +    or other legal entity, you represent and warrant that you have full
   28.41 +    authority to bind that person, company, or legal entity to these
   28.42 +    terms. If you do not agree to the terms and conditions of this
   28.43 +    agreement, you may not use, copy, modify or distribute the Product.
   28.44 +    You may return the unused Product to the supplier from which you
   28.45 +    acquired it within 30 days and request a refund of the license fee,
   28.46 +    if any, already paid upon showing proof of payment.
   28.47 +
   28.48 +    TERMINOLOGY
   28.49 +    -----------
   28.50 +
   28.51 +    OpenPKG is a solution to build software stacks consisting of OpenPKG
   28.52 +    Packages and an OpenPKG Framework to operate them.
   28.53 +
   28.54 +    For your information, OpenPKG Packages are available from the
   28.55 +    OpenPKG Foundation e.V., which licenses and distributes them as Open
   28.56 +    Source Software. These OpenPKG Packages are in no way subject of
   28.57 +    this agreement.
   28.58 +
   28.59 +    The OpenPKG Framework is a property of the OpenPKG GmbH with all
   28.60 +    rights reserved. Licenses, like this one, which grant limited
   28.61 +    permission to use, copy, modify and distribute this software are
   28.62 +    exclusively issued by the OpenPKG GmbH.
   28.63 +
   28.64 +    Licensing as described in this agreement covers the OpenPKG
   28.65 +    Framework code copyrighted by the OpenPKG GmbH and the OpenPKG
   28.66 +    Framework as a compound work. The OpenPKG Framework is distributed
   28.67 +    in source code form and also contains pristine third-party sources
   28.68 +    where each comes with its own licensing model. These licenses are
   28.69 +    in no way altered by this agreement, but passed through to you
   28.70 +    verbatim. You are responsible for obtaining and obeying any such
   28.71 +    vendor license.
   28.72 +
   28.73 +    This license describes how you appropriately use, copy, modify
   28.74 +    and distribute the OpenPKG Framework source code and the binaries
   28.75 +    resulting from the build process. This license does not include any
   28.76 +    entitlement for you to receive service or support from the OpenPKG
   28.77 +    GmbH, there are no warranties beyond the minimum implied warranty,
   28.78 +    and there are no promises with respect to the future of the Product
   28.79 +    or any derived works.
   28.80 +
   28.81 +    GRANT OF RIGHTS GENERAL TERMS
   28.82 +    -----------------------------
   28.83 +
   28.84 +    The OpenPKG Framework is licensed, not sold. Subject to the terms
   28.85 +    and conditions of this agreement, the OpenPKG GmbH hereby grants
   28.86 +    you a non-exclusive, non-sub-licensable and non-transferable right
   28.87 +    to use the Product. You may not lease or rent the OpenPKG Framework
   28.88 +    license.
   28.89 +
   28.90 +    You may sell or otherwise transfer unused licenses if you ensure
   28.91 +    the recipient receives these terms and conditions with the same
   28.92 +    transaction and acknowledges to take over your responsibilities from
   28.93 +    this agreement.
   28.94 +
   28.95 +    You may not remove any titles, trademarks or trade names, copyright
   28.96 +    notices, legends, or other proprietary markings on the Product. You
   28.97 +    are not granted any rights to any trademarks or service marks of the
   28.98 +    OpenPKG GmbH. All rights not expressly granted by this license are
   28.99 +    reserved.
  28.100 +
  28.101 +    You may use the Product as long as you own this license issued by
  28.102 +    the OpenPKG GmbH, install it and obey the terms and conditions
  28.103 +    listed below. This license, issued by the OpenPKG GmbH, ships
  28.104 +    as a digitally signed text file which carries the exact license
  28.105 +    conditions both in human readable plain text and attached in a
  28.106 +    machine readable format. The latter may be used by the OpenPKG
  28.107 +    Framework to programmatically validate the license compliance. If
  28.108 +    programmatic license validation within the OpenPKG Framework detects
  28.109 +    a compliance failure, the OpenPKG Framework might cease operation.
  28.110 +    It is your responsibility to ensure compliance with these terms and
  28.111 +    conditions.
  28.112 +
  28.113 +    GRANT OF RIGHTS TO USE THE OPENPKG FRAMEWORK
  28.114 +    --------------------------------------------
  28.115 +
  28.116 +    This "promotion" license can be obtained from the OpenPKG GmbH
  28.117 +    and allows restricted use of the OpenPKG Framework. The constraints
  28.118 +    are the use of the OpenPKG Framework in a specified real-time frame,
  28.119 +    see "Assertion-LifeTime" at the bottom of this document, and use of
  28.120 +    the OpenPKG Framework released in a specified time frame, see
  28.121 +    "Assertion-GrantTime" at the bottom of this document.
  28.122 +
  28.123 +    GRANT OF RIGHTS TO COPY THE OPENPKG FRAMEWORK
  28.124 +    ---------------------------------------------
  28.125 +
  28.126 +    You may create an unlimited number of copies of the Product.
  28.127 +
  28.128 +    GRANT OF RIGHTS TO MODIFY THE OPENPKG FRAMEWORK
  28.129 +    -----------------------------------------------
  28.130 +
  28.131 +    You may modify most parts of the Product and adjust it to your
  28.132 +    needs, creating derivative works. You may not remove license
  28.133 +    validation code, and you must ensure the preservation of the OpenPKG
  28.134 +    GmbH fingerprint data. The copyright notice, the license excerpt and
  28.135 +    the reference to this terms and conditions must be kept verbatim.
  28.136 +    You must make clear to the recipient of the derived works that the
  28.137 +    version he is receiving has been modified and by whom.
  28.138 +
  28.139 +    These terms and conditions stay if force for derivative works. To
  28.140 +    keep modifications your property you must not distribute them, in
  28.141 +    source or binary form, beyond your organizational scope. In cases
  28.142 +    of extended distribution or publication you agree to contribute
  28.143 +    your modifications automatically, free of charge and without any
  28.144 +    royalty claims, to the OpenPKG GmbH, transfer the source code of
  28.145 +    your modifications to the OpenPKG GmbH and irrevocably transfer
  28.146 +    all rights of your modifications to the OpenPKG GmbH which will
  28.147 +    grant you unlimited use rights to your contribution. There is no
  28.148 +    promise the OpenPKG GmbH includes your contribution into the OpenPKG
  28.149 +    Framework.
  28.150 +
  28.151 +    GRANT OF RIGHTS TO DISTRIBUTE THE OPENPKG FRAMEWORK
  28.152 +    ---------------------------------------------------
  28.153 +
  28.154 +    You may distribute the Product, or derivative works thereof created
  28.155 +    under adherence of the "rights to modify" grant, if you ensure
  28.156 +    the recipient receives these terms and conditions with the same
  28.157 +    transaction.
  28.158 +
  28.159 +    ONLINE ACCESS
  28.160 +    -------------
  28.161 +
  28.162 +    The OpenPKG Framework collects information about the OpenPKG
  28.163 +    Framework, OpenPKG Framework License and OpenPKG Packages for use
  28.164 +    by the OpenPKG Project, the OpenPKG Foundation e.V. and the OpenPKG
  28.165 +    GmbH. The programmatic license validation might and the information
  28.166 +    upload process does require online access to the Internet. You agree
  28.167 +    to grant the OpenPKG Framework permission for this use case and you
  28.168 +    assume all costs related to the online access.
  28.169 +
  28.170 +    TERMINATION
  28.171 +    -----------
  28.172 +
  28.173 +    You may not use the OpenPKG Framework except as expressly
  28.174 +    provided under the license. Any attempt to otherwise use, copy,
  28.175 +    modify, distribute or sub-license the Product is void, and will
  28.176 +    automatically terminate your rights under this license.
  28.177 +
  28.178 +    CHANGE
  28.179 +    ------
  28.180 +
  28.181 +    The OpenPKG GmbH reserves the right to subsequently modify or amend
  28.182 +    details of these terms and conditions where this seems applicable,
  28.183 +    as long as you are, in good faith, not disadvantaged thereby.
  28.184 +
  28.185 +    Those changes or amendments of the terms and conditions will be
  28.186 +    proclaimed to you by a written document, delivered to you in
  28.187 +    electronic format or paper mail as chosen by the OpenPKG GmbH.
  28.188 +    Anonymous and unknown users cannot be contacted by the OpenPKG GmbH.
  28.189 +    They must review the terms and conditions regularly at the same time
  28.190 +    they obtain or use an updated OpenPKG Framework. You cannot rise an
  28.191 +    objection against the proclaimed changes or amendments. However, you
  28.192 +    can terminate the license agreement without prior notice.
  28.193 +
  28.194 +    DISCLAIMER
  28.195 +    ----------
  28.196 +
  28.197 +    THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
  28.198 +    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  28.199 +    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  28.200 +    IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  28.201 +    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  28.202 +    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  28.203 +    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  28.204 +    USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  28.205 +    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28.206 +    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  28.207 +    OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28.208 +    SUCH DAMAGE.
  28.209 +
  28.210 +    LIMITED WARRANTY AND LIMITATION OF LIABILITY
  28.211 +    --------------------------------------------
  28.212 +
  28.213 +    The OpenPKG GmbH is only liable for damages if the OpenPKG GmbH
  28.214 +    or one of its vicarious agents has violated a major contractual
  28.215 +    (cardinal) obligation or jeopardized the intention of the agreement
  28.216 +    or the damage was done by gross negligence or intention of the
  28.217 +    OpenPKG GmbH or one of its vicarious agents.
  28.218 +
  28.219 +    In case the violation of a cardinal obligation is not caused by
  28.220 +    gross negligence or intention of the OpenPKG GmbH or one of its
  28.221 +    vicarious agents the liability of the OpenPKG GmbH is limited to the
  28.222 +    predictable damage characteristical for the contract.
  28.223 +
  28.224 +    The preceding liability limitations apply for contractual and
  28.225 +    non-contractual claims. The liability of the OpenPKG GmbH due to
  28.226 +    warranties, personal injury and due to the German Product Liability
  28.227 +    Act remains unaffected from the preceding liability limitations.
  28.228 +
  28.229 +    GENERAL
  28.230 +    -------
  28.231 +
  28.232 +    This agreement sets forth the OpenPKG GmbH's entire liability and
  28.233 +    your exclusive remedy with respect to the Product and supersedes
  28.234 +    the terms of any purchase orders and any other communications or
  28.235 +    advertising with respect to the Product. You acknowledge that this
  28.236 +    agreement is a complete statement of the agreement between you
  28.237 +    and the OpenPKG GmbH with respect to the Product, and that there
  28.238 +    are no other prior or contemporaneous understandings, promises,
  28.239 +    representations, or descriptions with respect to the Product.
  28.240 +
  28.241 +    Headings under this agreement are intended only for convenience and
  28.242 +    shall not affect the interpretation of this agreement.
  28.243 +
  28.244 +    No failure of either party to exercise or enforce any of its rights
  28.245 +    under this agreement will act as a waiver of those rights. This
  28.246 +    agreement may only be modified, or any rights under it waived, by a
  28.247 +    written document executed by the party against which it is asserted.
  28.248 +
  28.249 +    If any provision of this agreement is found illegal or
  28.250 +    unenforceable, it will be enforced to the maximum extent
  28.251 +    permissible, and the legality and enforceability of the other
  28.252 +    provisions of this agreement will not be affected.
  28.253 +
  28.254 +    This agreement is governed by German law.
  28.255 +
  28.256 +    If you have any questions about this agreement please contact the
  28.257 +    OpenPKG GmbH. Direct all traditional paper correspondence to the
  28.258 +    official company address as listed in the very first paragraph of
  28.259 +    this document. You find the most recent contact information on our
  28.260 +    website http://openpkg.com/
  28.261 +
  28.262 +    You can find the most recent version of this document on our website
  28.263 +    http://openpkg.com/go/framework-license
  28.264 +
  28.265 +Assertion-MinProcVersion: 0.9.0
  28.266 +Assertion-LifeTime:       2008-01-01:2010-04-01
  28.267 +Assertion-GrantTime:      2008-01-01:2010-04-01
  28.268 +
  28.269 +-----BEGIN PGP SIGNATURE-----
  28.270 +Comment: OpenPKG GmbH <openpkg@openpkg.com>
  28.271 +
  28.272 +iEYEARECAAYFAktlqB8ACgkQZwQuyWG3rjSHwgCgrBoJ8HMeOGPiylwb3QbTKTis
  28.273 +kHIAoISMlvKP/DpIv86yDSjWpn6kPB0c
  28.274 +=ik+2
  28.275 +-----END PGP SIGNATURE-----
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/openpkg/license-RECOVERY.txt	Tue Jul 31 12:23:42 2012 +0200
    29.3 @@ -0,0 +1,270 @@
    29.4 +-----BEGIN PGP SIGNED MESSAGE-----
    29.5 +Hash: SHA1
    29.6 +
    29.7 +Id:       RECOVERY
    29.8 +Name:     OpenPKG Framework Recovery License
    29.9 +Version:  1.0.0
   29.10 +Issuer:   OpenPKG GmbH <openpkg@openpkg.com>
   29.11 +Issued:   2010-01-01
   29.12 +
   29.13 +Licensee: arbitrary deployer of OpenPKG Framework
   29.14 +          with this run-time license activated
   29.15 +
   29.16 +Description:
   29.17 +
   29.18 +    OPENPKG FRAMEWORK RECOVERY LICENSE
   29.19 +    ==================================
   29.20 +
   29.21 +    This license agreement constitutes a valid and binding agreement
   29.22 +    between the OpenPKG GmbH, jurisdiction identification "DE MUC HRB
   29.23 +    160208", postal address "Weblinger Weg 28, 85221 Dachau, GERMANY",
   29.24 +    digital signature name "OpenPKG GmbH <openpkg@openpkg.com>" and
   29.25 +    digital signature fingerprint "7D12 1A8F C05D C18A 4329 E9EF 6704
   29.26 +    2EC9 61B7 AE34", represented by the two managing directors Ralf S.
   29.27 +    Engelschall and Thomas Lotterer, and you, the licensee.
   29.28 +
   29.29 +    "You" means the natural person or the entity that is agreeing to be
   29.30 +    bound by this agreement. You shall be liable for any failure by your
   29.31 +    employees and third party contractors that provide services to you
   29.32 +    to comply with the terms and conditions of this agreement.
   29.33 +
   29.34 +    AGREEMENT
   29.35 +    ---------
   29.36 +
   29.37 +    By using, copying, modifying or distributing the Product you agree
   29.38 +    to be bound by the terms and conditions of this agreement. If you
   29.39 +    are accepting these terms on behalf of another person or a company
   29.40 +    or other legal entity, you represent and warrant that you have full
   29.41 +    authority to bind that person, company, or legal entity to these
   29.42 +    terms. If you do not agree to the terms and conditions of this
   29.43 +    agreement, you may not use, copy, modify or distribute the Product.
   29.44 +    You may return the unused Product to the supplier from which you
   29.45 +    acquired it within 30 days and request a refund of the license fee,
   29.46 +    if any, already paid upon showing proof of payment.
   29.47 +
   29.48 +    TERMINOLOGY
   29.49 +    -----------
   29.50 +
   29.51 +    OpenPKG is a solution to build software stacks consisting of OpenPKG
   29.52 +    Packages and an OpenPKG Framework to operate them.
   29.53 +
   29.54 +    For your information, OpenPKG Packages are available from the
   29.55 +    OpenPKG Foundation e.V., which licenses and distributes them as Open
   29.56 +    Source Software. These OpenPKG Packages are in no way subject of
   29.57 +    this agreement.
   29.58 +
   29.59 +    The OpenPKG Framework is a property of the OpenPKG GmbH with all
   29.60 +    rights reserved. Licenses, like this one, which grant limited
   29.61 +    permission to use, copy, modify and distribute this software are
   29.62 +    exclusively issued by the OpenPKG GmbH.
   29.63 +
   29.64 +    Licensing as described in this agreement covers the OpenPKG
   29.65 +    Framework code copyrighted by the OpenPKG GmbH and the OpenPKG
   29.66 +    Framework as a compound work. The OpenPKG Framework is distributed
   29.67 +    in source code form and also contains pristine third-party sources
   29.68 +    where each comes with its own licensing model. These licenses are
   29.69 +    in no way altered by this agreement, but passed through to you
   29.70 +    verbatim. You are responsible for obtaining and obeying any such
   29.71 +    vendor license.
   29.72 +
   29.73 +    This license describes how you appropriately use, copy, modify
   29.74 +    and distribute the OpenPKG Framework source code and the binaries
   29.75 +    resulting from the build process. This license does not include any
   29.76 +    entitlement for you to receive service or support from the OpenPKG
   29.77 +    GmbH, there are no warranties beyond the minimum implied warranty,
   29.78 +    and there are no promises with respect to the future of the Product
   29.79 +    or any derived works.
   29.80 +
   29.81 +    GRANT OF RIGHTS GENERAL TERMS
   29.82 +    -----------------------------
   29.83 +
   29.84 +    The OpenPKG Framework is licensed, not sold. Subject to the terms
   29.85 +    and conditions of this agreement, the OpenPKG GmbH hereby grants
   29.86 +    you a non-exclusive, non-sub-licensable and non-transferable right
   29.87 +    to use the Product. You may not lease or rent the OpenPKG Framework
   29.88 +    license.
   29.89 +
   29.90 +    You may sell or otherwise transfer unused licenses if you ensure
   29.91 +    the recipient receives these terms and conditions with the same
   29.92 +    transaction and acknowledges to take over your responsibilities from
   29.93 +    this agreement.
   29.94 +
   29.95 +    You may not remove any titles, trademarks or trade names, copyright
   29.96 +    notices, legends, or other proprietary markings on the Product. You
   29.97 +    are not granted any rights to any trademarks or service marks of the
   29.98 +    OpenPKG GmbH. All rights not expressly granted by this license are
   29.99 +    reserved.
  29.100 +
  29.101 +    You may use the Product as long as you own this license issued by
  29.102 +    the OpenPKG GmbH, install it and obey the terms and conditions
  29.103 +    listed below. This license, issued by the OpenPKG GmbH, ships
  29.104 +    as a digitally signed text file which carries the exact license
  29.105 +    conditions both in human readable plain text and attached in a
  29.106 +    machine readable format. The latter may be used by the OpenPKG
  29.107 +    Framework to programmatically validate the license compliance. If
  29.108 +    programmatic license validation within the OpenPKG Framework detects
  29.109 +    a compliance failure, the OpenPKG Framework might cease operation.
  29.110 +    It is your responsibility to ensure compliance with these terms and
  29.111 +    conditions.
  29.112 +
  29.113 +    GRANT OF RIGHTS TO USE THE OPENPKG FRAMEWORK
  29.114 +    --------------------------------------------
  29.115 +
  29.116 +    This "recovery" license ships free of charge with every OpenPKG
  29.117 +    Framework and allows temporary recovery from licensing issues.
  29.118 +    It requires online access to license clearing services from the
  29.119 +    OpenPKG GmbH which are not guaranteed to be available.
  29.120 +
  29.121 +    GRANT OF RIGHTS TO COPY THE OPENPKG FRAMEWORK
  29.122 +    ---------------------------------------------
  29.123 +
  29.124 +    You may create an unlimited number of copies of the Product.
  29.125 +
  29.126 +    GRANT OF RIGHTS TO MODIFY THE OPENPKG FRAMEWORK
  29.127 +    -----------------------------------------------
  29.128 +
  29.129 +    You may modify most parts of the Product and adjust it to your
  29.130 +    needs, creating derivative works. You may not remove license
  29.131 +    validation code, and you must ensure the preservation of the OpenPKG
  29.132 +    GmbH fingerprint data. The copyright notice, the license excerpt and
  29.133 +    the reference to this terms and conditions must be kept verbatim.
  29.134 +    You must make clear to the recipient of the derived works that the
  29.135 +    version he is receiving has been modified and by whom.
  29.136 +
  29.137 +    These terms and conditions stay if force for derivative works. To
  29.138 +    keep modifications your property you must not distribute them, in
  29.139 +    source or binary form, beyond your organizational scope. In cases
  29.140 +    of extended distribution or publication you agree to contribute
  29.141 +    your modifications automatically, free of charge and without any
  29.142 +    royalty claims, to the OpenPKG GmbH, transfer the source code of
  29.143 +    your modifications to the OpenPKG GmbH and irrevocably transfer
  29.144 +    all rights of your modifications to the OpenPKG GmbH which will
  29.145 +    grant you unlimited use rights to your contribution. There is no
  29.146 +    promise the OpenPKG GmbH includes your contribution into the OpenPKG
  29.147 +    Framework.
  29.148 +
  29.149 +    GRANT OF RIGHTS TO DISTRIBUTE THE OPENPKG FRAMEWORK
  29.150 +    ---------------------------------------------------
  29.151 +
  29.152 +    You may distribute the Product, or derivative works thereof created
  29.153 +    under adherence of the "rights to modify" grant, if you ensure
  29.154 +    the recipient receives these terms and conditions with the same
  29.155 +    transaction.
  29.156 +
  29.157 +    ONLINE ACCESS
  29.158 +    -------------
  29.159 +
  29.160 +    The OpenPKG Framework collects information about the OpenPKG
  29.161 +    Framework, OpenPKG Framework License and OpenPKG Packages for use
  29.162 +    by the OpenPKG Project, the OpenPKG Foundation e.V. and the OpenPKG
  29.163 +    GmbH. The programmatic license validation might and the information
  29.164 +    upload process does require online access to the Internet. You agree
  29.165 +    to grant the OpenPKG Framework permission for this use case and you
  29.166 +    assume all costs related to the online access.
  29.167 +
  29.168 +    TERMINATION
  29.169 +    -----------
  29.170 +
  29.171 +    You may not use the OpenPKG Framework except as expressly
  29.172 +    provided under the license. Any attempt to otherwise use, copy,
  29.173 +    modify, distribute or sub-license the Product is void, and will
  29.174 +    automatically terminate your rights under this license.
  29.175 +
  29.176 +    CHANGE
  29.177 +    ------
  29.178 +
  29.179 +    The OpenPKG GmbH reserves the right to subsequently modify or amend
  29.180 +    details of these terms and conditions where this seems applicable,
  29.181 +    as long as you are, in good faith, not disadvantaged thereby.
  29.182 +
  29.183 +    Those changes or amendments of the terms and conditions will be
  29.184 +    proclaimed to you by a written document, delivered to you in
  29.185 +    electronic format or paper mail as chosen by the OpenPKG GmbH.
  29.186 +    Anonymous and unknown users cannot be contacted by the OpenPKG GmbH.
  29.187 +    They must review the terms and conditions regularly at the same time
  29.188 +    they obtain or use an updated OpenPKG Framework. You cannot rise an
  29.189 +    objection against the proclaimed changes or amendments. However, you
  29.190 +    can terminate the license agreement without prior notice.
  29.191 +
  29.192 +    DISCLAIMER
  29.193 +    ----------
  29.194 +
  29.195 +    THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
  29.196 +    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  29.197 +    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  29.198 +    IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  29.199 +    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  29.200 +    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  29.201 +    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  29.202 +    USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  29.203 +    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  29.204 +    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  29.205 +    OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  29.206 +    SUCH DAMAGE.
  29.207 +
  29.208 +    LIMITED WARRANTY AND LIMITATION OF LIABILITY
  29.209 +    --------------------------------------------
  29.210 +
  29.211 +    The OpenPKG GmbH is only liable for damages if the OpenPKG GmbH
  29.212 +    or one of its vicarious agents has violated a major contractual
  29.213 +    (cardinal) obligation or jeopardized the intention of the agreement
  29.214 +    or the damage was done by gross negligence or intention of the
  29.215 +    OpenPKG GmbH or one of its vicarious agents.
  29.216 +
  29.217 +    In case the violation of a cardinal obligation is not caused by
  29.218 +    gross negligence or intention of the OpenPKG GmbH or one of its
  29.219 +    vicarious agents the liability of the OpenPKG GmbH is limited to the
  29.220 +    predictable damage characteristical for the contract.
  29.221 +
  29.222 +    The preceding liability limitations apply for contractual and
  29.223 +    non-contractual claims. The liability of the OpenPKG GmbH due to
  29.224 +    warranties, personal injury and due to the German Product Liability
  29.225 +    Act remains unaffected from the preceding liability limitations.
  29.226 +
  29.227 +    GENERAL
  29.228 +    -------
  29.229 +
  29.230 +    This agreement sets forth the OpenPKG GmbH's entire liability and
  29.231 +    your exclusive remedy with respect to the Product and supersedes
  29.232 +    the terms of any purchase orders and any other communications or
  29.233 +    advertising with respect to the Product. You acknowledge that this
  29.234 +    agreement is a complete statement of the agreement between you
  29.235 +    and the OpenPKG GmbH with respect to the Product, and that there
  29.236 +    are no other prior or contemporaneous understandings, promises,
  29.237 +    representations, or descriptions with respect to the Product.
  29.238 +
  29.239 +    Headings under this agreement are intended only for convenience and
  29.240 +    shall not affect the interpretation of this agreement.
  29.241 +
  29.242 +    No failure of either party to exercise or enforce any of its rights
  29.243 +    under this agreement will act as a waiver of those rights. This
  29.244 +    agreement may only be modified, or any rights under it waived, by a
  29.245 +    written document executed by the party against which it is asserted.
  29.246 +
  29.247 +    If any provision of this agreement is found illegal or
  29.248 +    unenforceable, it will be enforced to the maximum extent
  29.249 +    permissible, and the legality and enforceability of the other
  29.250 +    provisions of this agreement will not be affected.
  29.251 +
  29.252 +    This agreement is governed by German law.
  29.253 +
  29.254 +    If you have any questions about this agreement please contact the
  29.255 +    OpenPKG GmbH. Direct all traditional paper correspondence to the
  29.256 +    official company address as listed in the very first paragraph of
  29.257 +    this document. You find the most recent contact information on our
  29.258 +    website http://openpkg.com/
  29.259 +
  29.260 +    You can find the most recent version of this document on our website
  29.261 +    http://openpkg.com/go/framework-license
  29.262 +
  29.263 +Assertion-MinProcVersion: 0.9.0
  29.264 +Assertion-OnlineApproval: http://openpkg.com/go/framework-license-exception
  29.265 +Assertion-ErrorToWarning: yes
  29.266 +
  29.267 +-----BEGIN PGP SIGNATURE-----
  29.268 +Comment: OpenPKG GmbH <openpkg@openpkg.com>
  29.269 +
  29.270 +iEYEARECAAYFAktAcOcACgkQZwQuyWG3rjSeagCfcFS91ucreRtRxxK1rRoODgLI
  29.271 +mmAAnim+i0THJLMrm/ha1FfOGroa30ve
  29.272 +=VAb/
  29.273 +-----END PGP SIGNATURE-----
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/openpkg/license.8	Tue Jul 31 12:23:42 2012 +0200
    30.3 @@ -0,0 +1,210 @@
    30.4 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
    30.5 +.\"
    30.6 +.\" Standard preamble:
    30.7 +.\" ========================================================================
    30.8 +.de Sp \" Vertical space (when we can't use .PP)
    30.9 +.if t .sp .5v
   30.10 +.if n .sp
   30.11 +..
   30.12 +.de Vb \" Begin verbatim text
   30.13 +.ft CW
   30.14 +.nf
   30.15 +.ne \\$1
   30.16 +..
   30.17 +.de Ve \" End verbatim text
   30.18 +.ft R
   30.19 +.fi
   30.20 +..
   30.21 +.\" Set up some character translations and predefined strings.  \*(-- will
   30.22 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   30.23 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
   30.24 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
   30.25 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
   30.26 +.\" nothing in troff, for use with C<>.
   30.27 +.tr \(*W-
   30.28 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   30.29 +.ie n \{\
   30.30 +.    ds -- \(*W-
   30.31 +.    ds PI pi
   30.32 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   30.33 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   30.34 +.    ds L" ""
   30.35 +.    ds R" ""
   30.36 +.    ds C` 
   30.37 +.    ds C' 
   30.38 +'br\}
   30.39 +.el\{\
   30.40 +.    ds -- \|\(em\|
   30.41 +.    ds PI \(*p
   30.42 +.    ds L" ``
   30.43 +.    ds R" ''
   30.44 +'br\}
   30.45 +.\"
   30.46 +.\" Escape single quotes in literal strings from groff's Unicode transform.
   30.47 +.ie \n(.g .ds Aq \(aq
   30.48 +.el       .ds Aq '
   30.49 +.\"
   30.50 +.\" If the F register is turned on, we'll generate index entries on stderr for
   30.51 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
   30.52 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   30.53 +.\" output yourself in some meaningful fashion.
   30.54 +.ie \nF \{\
   30.55 +.    de IX
   30.56 +.    tm Index:\\$1\t\\n%\t"\\$2"
   30.57 +..
   30.58 +.    nr % 0
   30.59 +.    rr F
   30.60 +.\}
   30.61 +.el \{\
   30.62 +.    de IX
   30.63 +..
   30.64 +.\}
   30.65 +.\"
   30.66 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   30.67 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   30.68 +.    \" fudge factors for nroff and troff
   30.69 +.if n \{\
   30.70 +.    ds #H 0
   30.71 +.    ds #V .8m
   30.72 +.    ds #F .3m
   30.73 +.    ds #[ \f1
   30.74 +.    ds #] \fP
   30.75 +.\}
   30.76 +.if t \{\
   30.77 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   30.78 +.    ds #V .6m
   30.79 +.    ds #F 0
   30.80 +.    ds #[ \&
   30.81 +.    ds #] \&
   30.82 +.\}
   30.83 +.    \" simple accents for nroff and troff
   30.84 +.if n \{\
   30.85 +.    ds ' \&
   30.86 +.    ds ` \&
   30.87 +.    ds ^ \&
   30.88 +.    ds , \&
   30.89 +.    ds ~ ~
   30.90 +.    ds /
   30.91 +.\}
   30.92 +.if t \{\
   30.93 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   30.94 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
   30.95 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
   30.96 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
   30.97 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
   30.98 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
   30.99 +.\}
  30.100 +.    \" troff and (daisy-wheel) nroff accents
  30.101 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  30.102 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  30.103 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  30.104 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  30.105 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  30.106 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  30.107 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  30.108 +.ds ae a\h'-(\w'a'u*4/10)'e
  30.109 +.ds Ae A\h'-(\w'A'u*4/10)'E
  30.110 +.    \" corrections for vroff
  30.111 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  30.112 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  30.113 +.    \" for low resolution devices (crt and lpr)
  30.114 +.if \n(.H>23 .if \n(.V>19 \
  30.115 +\{\
  30.116 +.    ds : e
  30.117 +.    ds 8 ss
  30.118 +.    ds o a
  30.119 +.    ds d- d\h'-1'\(ga
  30.120 +.    ds D- D\h'-1'\(hy
  30.121 +.    ds th \o'bp'
  30.122 +.    ds Th \o'LP'
  30.123 +.    ds ae ae
  30.124 +.    ds Ae AE
  30.125 +.\}
  30.126 +.rm #[ #] #H #V #F C
  30.127 +.\" ========================================================================
  30.128 +.\"
  30.129 +.IX Title "LICENSE 8"
  30.130 +.TH LICENSE 8 "OpenPKG" "LICENSE(8)" "OpenPKG"
  30.131 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
  30.132 +.\" way too many mistakes in technical documents.
  30.133 +.if n .ad l
  30.134 +.nh
  30.135 +.SH "NAME"
  30.136 +openpkg license \- OpenPKG License Utility
  30.137 +.SH "SYNOPSIS"
  30.138 +.IX Header "SYNOPSIS"
  30.139 +\&\fBopenpkg license\fR \fBhelp\fR
  30.140 +.PP
  30.141 +\&\fBopenpkg license\fR \fBinstall\fR \fIid\fR \fIfile\fR|\fIurl\fR|\f(CW\*(C`\-\*(C'\fR
  30.142 +.PP
  30.143 +\&\fBopenpkg license\fR \fBupdate\fR \fIid\fR \fIfile\fR|\fIurl\fR|\f(CW\*(C`\-\*(C'\fR
  30.144 +.PP
  30.145 +\&\fBopenpkg license\fR \fBuninstall\fR \fIid\fR
  30.146 +.PP
  30.147 +\&\fBopenpkg license\fR \fBactivate\fR \fIid\fR
  30.148 +.PP
  30.149 +\&\fBopenpkg license\fR \fBview\fR \fIid\fR
  30.150 +.PP
  30.151 +\&\fBopenpkg license\fR \fBlist\fR
  30.152 +.PP
  30.153 +\&\fBopenpkg license\fR \fBactive\fR
  30.154 +.PP
  30.155 +\&\fBopenpkg license\fR \fBsanity\fR
  30.156 +.SH "DESCRIPTION"
  30.157 +.IX Header "DESCRIPTION"
  30.158 +The \fBopenpkg license\fR command is the maintenance utility for OpenPKG
  30.159 +Framework licenses.
  30.160 +.SH "COMMANDS"
  30.161 +.IX Header "COMMANDS"
  30.162 +.IP "\fBopenpkg license\fR \fBhelp\fR" 4
  30.163 +.IX Item "openpkg license help"
  30.164 +This command just displays a short usage help information.
  30.165 +.ie n .IP "\fBopenpkg license\fR \fBinstall\fR \fIid\fR \fIfile\fR|\fIurl\fR|\*(C`\-\*(C'" 4
  30.166 +.el .IP "\fBopenpkg license\fR \fBinstall\fR \fIid\fR \fIfile\fR|\fIurl\fR|\f(CW\*(C`\-\*(C'\fR" 4
  30.167 +.IX Item "openpkg license install id file|url|-"
  30.168 +This command installs the license contained in \fIfile\fR or at \fIurl\fR or
  30.169 +provided on \fIstdin\fR under the identifier \fIid\fR. The \fIid\fR can be an
  30.170 +arbitrary string, but the convention is that \fIid\fR is a short upper-case
  30.171 +identifier.
  30.172 +.ie n .IP "\fBopenpkg license\fR \fBupdate\fR \fIid\fR \fIfile\fR|\fIurl\fR|\*(C`\-\*(C'" 4
  30.173 +.el .IP "\fBopenpkg license\fR \fBupdate\fR \fIid\fR \fIfile\fR|\fIurl\fR|\f(CW\*(C`\-\*(C'\fR" 4
  30.174 +.IX Item "openpkg license update id file|url|-"
  30.175 +This command updates an already installed license with the license
  30.176 +contained in \fIfile\fR or at \fIurl\fR or provided on \fIstdin\fR under the
  30.177 +identifier \fIid\fR.
  30.178 +.IP "\fBopenpkg license\fR \fBuninstall\fR \fIid\fR" 4
  30.179 +.IX Item "openpkg license uninstall id"
  30.180 +This command uninstalls the license which is installed under \fIid\fR.
  30.181 +A license can be uninstalled only if it is not currently activated (see
  30.182 +\&\fBopenpkg license activate\fR command).
  30.183 +.IP "\fBopenpkg license\fR \fBactivate\fR \fIid\fR" 4
  30.184 +.IX Item "openpkg license activate id"
  30.185 +This command activates the license which is installed under \fIid\fR.
  30.186 +Only one installed license can be active at any time, so this command
  30.187 +implicitly deactivates the currently activate license.
  30.188 +.IP "\fBopenpkg license\fR \fBview\fR \fIid\fR" 4
  30.189 +.IX Item "openpkg license view id"
  30.190 +This command shows the license which is installed under \fIid\fR.
  30.191 +.IP "\fBopenpkg license\fR \fBlist\fR" 4
  30.192 +.IX Item "openpkg license list"
  30.193 +This command lists the identifiers of all installed licenses.
  30.194 +.IP "\fBopenpkg license\fR \fBactive\fR" 4
  30.195 +.IX Item "openpkg license active"
  30.196 +This command outputs the identifier of the currently activated license.
  30.197 +.IP "\fBopenpkg license\fR \fBsanity\fR" 4
  30.198 +.IX Item "openpkg license sanity"
  30.199 +This command sanity checks the current license configuration.
  30.200 +.SH "FILES"
  30.201 +.IX Header "FILES"
  30.202 +.ie n .IP "\fI\fI@l_prefix\fI@/etc/license\fR" 4
  30.203 +.el .IP "\fI\f(CI@l_prefix\fI@/etc/license\fR" 4
  30.204 +.IX Item "@l_prefix@/etc/license"
  30.205 +The name of the currently activated license file under
  30.206 +\&\fI\f(CI@l_prefix\fI@/etc/license.d/\fR.
  30.207 +.ie n .IP "\fI\fI@l_prefix\fI@/etc/license.d/*\fR" 4
  30.208 +.el .IP "\fI\f(CI@l_prefix\fI@/etc/license.d/*\fR" 4
  30.209 +.IX Item "@l_prefix@/etc/license.d/*"
  30.210 +The directory containing all installed license files.
  30.211 +.SH "HISTORY"
  30.212 +.IX Header "HISTORY"
  30.213 +The \fBopenpkg license\fR command first appeared in \fBOpenPKG 4.0\fR.
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/openpkg/license.lua	Tue Jul 31 12:23:42 2012 +0200
    31.3 @@ -0,0 +1,808 @@
    31.4 +-----BEGIN PGP SIGNED MESSAGE-----
    31.5 +Hash: SHA1
    31.6 +
    31.7 +- --
    31.8 +- --  OpenPKG Framework License Processor
    31.9 +- --  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
   31.10 +- --
   31.11 +- --  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   31.12 +- --  All rights reserved. Licenses which grant limited permission to use,
   31.13 +- --  copy, modify and distribute this software are available from the
   31.14 +- --  OpenPKG GmbH.
   31.15 +- --
   31.16 +- --  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   31.17 +- --  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   31.18 +- --  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   31.19 +- --  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   31.20 +- --  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   31.21 +- --  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   31.22 +- --  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   31.23 +- --  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   31.24 +- --  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   31.25 +- --  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   31.26 +- --  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   31.27 +- --  SUCH DAMAGE.
   31.28 +- --
   31.29 +
   31.30 +- --  This is the RPM run-time integrity processor of the OpenPKG
   31.31 +- --  Framework. It currently checks the OpenPKG Framework run-time
   31.32 +- --  license only. The following grammar specifies and documents all
   31.33 +- --  currently supported license parameters.
   31.34 +- --
   31.35 +- --  license ::= "Assertion-MinProcVersion:" version
   31.36 +- --              # require a minimum version of the license integrity processor
   31.37 +- --              
   31.38 +- --              | "Assertion-ErrorToWarning:" yes-no
   31.39 +- --              # allow all fatal integrity checking errors to be
   31.40 +- --              # converted to non-fatal warnings
   31.41 +- --              
   31.42 +- --              | "Assertion-OnlineApproval:" url
   31.43 +- --              # require an online approval by receiving an "OK" from
   31.44 +- --              # specified remote service
   31.45 +- --              
   31.46 +- --              | "Assertion-OnlineReporting:" url
   31.47 +- --              # perform an asynchronous online reporting to
   31.48 +- --              # specified remote service
   31.49 +- --              
   31.50 +- --              | "Assertion-Prefix:" path
   31.51 +- --              # require %{l_prefix} to match specified path
   31.52 +- --              
   31.53 +- --              | "Assertion-User:" user
   31.54 +- --              # require %{l_musr} to match specified username
   31.55 +- --              
   31.56 +- --              | "Assertion-Group:" group
   31.57 +- --              # require %{l_mgrp} to match specified groupname
   31.58 +- --              
   31.59 +- --              | "Assertion-Domain:" domain
   31.60 +- --              # require domain of host to match specified domain name
   31.61 +- --              
   31.62 +- --              | "Assertion-LifeTime:" iso-date.":".iso-date
   31.63 +- --              # require current real-time to be within specified
   31.64 +- --              # begin and end date
   31.65 +- --              
   31.66 +- --              | "Assertion-GrantTime:" iso-date.":".iso-date
   31.67 +- --              # require current OpenPKG Framework %{RELEASE}
   31.68 +- --              # (release time) to be within specified begin and end
   31.69 +- --              # date
   31.70 +- --              
   31.71 +- --              | "Assertion-InstanceAge:" duration
   31.72 +- --              # require current OpenPKG Framework %{ORIGINTIME}
   31.73 +- --              # (first install time) to be within specified begin
   31.74 +- --              # and end date
   31.75 +- --              
   31.76 +- --              | "Assertion-FromSourceOnTarget:" yes-no
   31.77 +- --              # require either (if "yes") that all package
   31.78 +- --              # %{BUILDHOST} are equal the host name or (if "no")
   31.79 +- --              # that all package %{BUILDHOST} are not equal the host
   31.80 +- --              # name
   31.81 +- --              
   31.82 +- --              | "Assertion-PackageNames:" 
   31.83 +- --                ("!"?.mode-regex.":"."!"?.package-regex)+
   31.84 +- --              # require all package %{NAME} to (not) match the
   31.85 +- --              # specified regex while the current RPM run-time mode
   31.86 +- --              # has to (not) match the specified regex. RPM run-time
   31.87 +- --              # modes are: query, verify, checksig, resign, install,
   31.88 +- --              # erase, build rebuild, recompile, tarbuild, initdb,
   31.89 +- --              # rebuilddb and verifydb.
   31.90 +- --              
   31.91 +- --              | "Assertion-PackageReleaseAge:"
   31.92 +- --                percent.":".duration.":".dist-regex ((package-name|"*").":".release)+
   31.93 +- --              # require that for at least the specified amount (in
   31.94 +- --              # percent) of packages, which %{DISTRIBUTION} matches
   31.95 +- --              # the specified regex, the %{RELEASE} is at least as
   31.96 +- --              # old as the specified release or at least not older
   31.97 +- --              # than the specified duration.
   31.98 +- --
   31.99 +- --              | "Assertion-Expression:" expression
  31.100 +- --              # evaluates the Lua boolean expression after expanding
  31.101 +- --              # RPM macros %{VARNAME} and expanding the construct
  31.102 +- --              # "<string>" ~~ /<regex>/ into the corresponding PCRE
  31.103 +- --              # based regular expression match.
  31.104 +- --  
  31.105 +- --  version       ::= /^\d+\.\d+\.\d+$/
  31.106 +- --  yes-no        ::= /^yes|no$/
  31.107 +- --  url           ::= /^https?:\/\/.+$/
  31.108 +- --  path          ::= /^\/.+$/
  31.109 +- --  user          ::= /^[a-z][a-zA-Z0-9_]*$/
  31.110 +- --  group         ::= /^[a-z][a-zA-Z0-9_]*$/
  31.111 +- --  domain        ::= /^(?:[^.]+\.)+[^.]+$/
  31.112 +- --  mode-regex    ::= /^.+$/
  31.113 +- --  package-regex ::= /^.+$/
  31.114 +- --  package-name  ::= /^[a-z][a-zA-Z0-9-]*$/
  31.115 +- --  percent       ::= /^\d+%$/
  31.116 +- --  duration      ::= /^\d+[smhdw]?$/
  31.117 +- --  release       ::= /^\d{8}$/
  31.118 +- --  iso-date      ::= /^\d{4}-\d{2}-\d{2}$/
  31.119 +- --  expression    ::= /^.+$/
  31.120 +
  31.121 +- --  integrity processor version
  31.122 +integrity.version = "1.0.0"
  31.123 +
  31.124 +- --  integrity processor validation callback function
  31.125 +function integrity.validate(ctx, cfg)
  31.126 +    integrity.util.debug(1, "OpenPKG run-time license integrity validation")
  31.127 +    integrity.util.debug(4, function (ctx) return "dump: ctx = " .. util.dump(ctx) end, ctx)
  31.128 +    integrity.util.debug(4, function (cfg) return "dump: cfg = " .. util.dump(cfg) end, cfg)
  31.129 +
  31.130 +    --  process "Assertion-OnlineApproval" constraint
  31.131 +    if os.getenv("OPENPKG_LICENSE_EXCEPTION") ~= nil then
  31.132 +        --  support explicitly requested license exception
  31.133 +        cfg["Assertion-OnlineApproval"] = "http://openpkg.com/go/framework-license-exception"
  31.134 +    end
  31.135 +    if cfg["Assertion-OnlineApproval"] ~= nil then
  31.136 +        integrity.util.debug(2, "checking: Assertion-OnlineApproval: \"%s\"", cfg["Assertion-OnlineApproval"])
  31.137 +        local uuids = integrity.util.uuids()
  31.138 +        if  uuids["UUID_REGISTRY"] == "" then
  31.139 +            uuids["UUID_REGISTRY"] = "unknown"
  31.140 +        end
  31.141 +        if  uuids["UUID_INSTANCE"] == "" then
  31.142 +            uuids["UUID_INSTANCE"] = "unknown"
  31.143 +        end
  31.144 +        if  uuids["UUID_PLATFORM"] == "" then
  31.145 +            uuids["UUID_PLATFORM"] = "unknown"
  31.146 +        end
  31.147 +        local request = cfg["Assertion-OnlineApproval"]
  31.148 +        request = request .. "?UUID_REGISTRY=" .. uuids["UUID_REGISTRY"]
  31.149 +        request = request .. "&UUID_INSTANCE=" .. uuids["UUID_INSTANCE"]
  31.150 +        request = request .. "&UUID_PLATFORM=" .. uuids["UUID_PLATFORM"]
  31.151 +        integrity.util.debug(3, "info: remote request \"%s\"", request)
  31.152 +        local response = rpm.expand("%(%{l_prefix}/bin/openpkg curl -s -L -R '" .. request .. "')")
  31.153 +        integrity.util.debug(3, "info: remote response \"%s\"", response)
  31.154 +        if util.rmatch(response, "(?s)^\\s*OK\\s*$") then
  31.155 +            --  approved
  31.156 +            if os.getenv("OPENPKG_LICENSE_EXCEPTION") ~= nil then
  31.157 +                --  support explicitly requested license exception
  31.158 +                cfg["Assertion-ErrorToWarning"] = "yes"
  31.159 +            end
  31.160 +        else
  31.161 +            --  rejected
  31.162 +            cfg["Assertion-ErrorToWarning"] = "no"
  31.163 +            return integrity.util.error(ctx, cfg,
  31.164 +                "license requires online approval but we failed to get " ..
  31.165 +                "an \"OK\" response from the online service")
  31.166 +        end
  31.167 +    end
  31.168 +
  31.169 +    --  process "Assertion-MinProcVersion" constraint
  31.170 +    integrity.util.debug(2, "checking: Assertion-MinProcVersion: \"%s\"", cfg["Assertion-MinProcVersion"])
  31.171 +    if cfg["Assertion-MinProcVersion"] == nil then
  31.172 +        return integrity.util.error(ctx, cfg,
  31.173 +            "license configuration is missing required \"Assertion-MinProcVersion\" parameter")
  31.174 +    end
  31.175 +    integrity.util.debug(3, "require: %s <= %s", cfg["Assertion-MinProcVersion"], integrity.version)
  31.176 +    if rpm.vercmp(cfg["Assertion-MinProcVersion"], integrity.version) > 0 then
  31.177 +        return integrity.util.error(ctx, cfg,
  31.178 +            "license configuration requires a license processor of " ..
  31.179 +            "at least version \"" .. cfg["Assertion-MinProcVersion"] .. "\"")
  31.180 +    end
  31.181 +
  31.182 +    --  process "Assertion-OnlineReporting" constraint
  31.183 +    if cfg["Assertion-OnlineReporting"] ~= nil then
  31.184 +        integrity.util.debug(2, "checking: Assertion-OnlineReporting: \"%s\"", cfg["Assertion-OnlineReporting"])
  31.185 +        local uuids = integrity.util.uuids()
  31.186 +        if  uuids["UUID_REGISTRY"] == "" then
  31.187 +            uuids["UUID_REGISTRY"] = "unknown"
  31.188 +        end
  31.189 +        if  uuids["UUID_INSTANCE"] == "" then
  31.190 +            uuids["UUID_INSTANCE"] = "unknown"
  31.191 +        end
  31.192 +        if  uuids["UUID_PLATFORM"] == "" then
  31.193 +            uuids["UUID_PLATFORM"] = "unknown"
  31.194 +        end
  31.195 +        local request = cfg["Assertion-OnlineReporting"]
  31.196 +        request = request .. "?UUID_REGISTRY=" .. uuids["UUID_REGISTRY"]
  31.197 +        request = request .. "&UUID_INSTANCE=" .. uuids["UUID_INSTANCE"]
  31.198 +        request = request .. "&UUID_PLATFORM=" .. uuids["UUID_PLATFORM"]
  31.199 +        integrity.util.debug(3, "info: remote request \"%s\"", request)
  31.200 +        rpm.expand("%(nohup %{l_prefix}/bin/openpkg curl -s -L -R '" .. request .. "' >/dev/null 2>&1 &)")
  31.201 +        integrity.util.debug(3, "response: (ignored, because asynchronous operation)")
  31.202 +    end
  31.203 +
  31.204 +    --  process "Assertion-Prefix" constraint
  31.205 +    if cfg["Assertion-Prefix"] ~= nil then
  31.206 +        integrity.util.debug(2, "checking: Assertion-Prefix: \"%s\"", cfg["Assertion-Prefix"])
  31.207 +        local prefix = rpm.expand("%{l_prefix}")
  31.208 +        integrity.util.debug(3, "require: \"%s\" == \"%s\"", cfg["Assertion-Prefix"], prefix)
  31.209 +        if cfg["Assertion-Prefix"] ~= prefix then
  31.210 +            return integrity.util.error(ctx, cfg,
  31.211 +                "instance prefix \"" .. prefix .. "\" " ..
  31.212 +                "does not match value \"" .. cfg["Assertion-Prefix"] .. "\" of " ..
  31.213 +                "license configuration parameter \"Assertion-Prefix\"")
  31.214 +        end
  31.215 +    end
  31.216 +
  31.217 +    --  process "Assertion-User" constraint
  31.218 +    if cfg["Assertion-User"] ~= nil then
  31.219 +        integrity.util.debug(2, "checking: Assertion-User: \"%s\"", cfg["Assertion-User"])
  31.220 +        local user = rpm.expand("%{l_musr}")
  31.221 +        integrity.util.debug(3, "require: \"%s\" == \"%s\"", cfg["Assertion-User"], user)
  31.222 +        if cfg["Assertion-User"] ~= user then
  31.223 +            return integrity.util.error(ctx, cfg,
  31.224 +                "instance management user \"" .. user .. "\" " ..
  31.225 +                "does not match value \"" .. cfg["Assertion-User"] .. "\" of " ..
  31.226 +                "license configuration parameter \"Assertion-User\"")
  31.227 +        end
  31.228 +    end
  31.229 +
  31.230 +    --  process "Assertion-Group" constraint
  31.231 +    if cfg["Assertion-Group"] ~= nil then
  31.232 +        integrity.util.debug(2, "checking: Assertion-Group: \"%s\"", cfg["Assertion-Group"])
  31.233 +        local group = rpm.expand("%{l_mgrp}")
  31.234 +        integrity.util.debug(3, "require: \"%s\" == \"%s\"", cfg["Assertion-Group"], group)
  31.235 +        if cfg["Assertion-Group"] ~= group then
  31.236 +            return integrity.util.error(ctx, cfg,
  31.237 +                "instance management group \"" .. group .. "\" " ..
  31.238 +                "does not match value \"" .. cfg["Assertion-Group"] .. "\" of " ..
  31.239 +                "license configuration parameter \"Assertion-Group\"")
  31.240 +        end
  31.241 +    end
  31.242 +
  31.243 +    --  process "Assertion-Domain" constraint
  31.244 +    if cfg["Assertion-Domain"] ~= nil then
  31.245 +        integrity.util.debug(2, "checking: Assertion-Domain: \"%s\"", cfg["Assertion-Domain"])
  31.246 +        local domain = rpm.expand("%(%{l_shtool} echo -n -e '%d')")
  31.247 +        integrity.util.debug(3, "require: \"%s\" ~~ /(?s)^.*%s$/", domain, cfg["Assertion-Domain"])
  31.248 +        local s, _, m = util.rmatch(domain, "(?s)^.*" .. cfg["Assertion-Domain"] .. "$")
  31.249 +        if s == nil then
  31.250 +            return integrity.util.error(ctx, cfg,
  31.251 +                "host domain \"" .. domain .. "\" " ..
  31.252 +                "does not end in pattern \"" .. cfg["Assertion-Domain"] .. "\") " ..
  31.253 +                "of license configuration parameter \"Assertion-Domain\"")
  31.254 +        end
  31.255 +    end
  31.256 +
  31.257 +    --  process "Assertion-LifeTime" constraint
  31.258 +    if cfg["Assertion-LifeTime"] ~= nil then
  31.259 +        integrity.util.debug(2, "checking: Assertion-LifeTime: \"%s\"", cfg["Assertion-LifeTime"])
  31.260 +
  31.261 +        --  determine lifetime begin and end
  31.262 +        local lifetime = cfg["Assertion-LifeTime"]
  31.263 +        local s, _, m = util.rmatch(lifetime, "^(?s)(\\d{4})-(\\d{2})-(\\d{2})\\s*:\\s*(\\d{4})-(\\d{2})-(\\d{2})$")
  31.264 +        if s == nil then
  31.265 +            return integrity.util.error(ctx, cfg,
  31.266 +                "failed to extract time information from " ..
  31.267 +                "license configuration parameter \"Assertion-LifeTime\"")
  31.268 +        end
  31.269 +        local lifetime_begin = os.time({
  31.270 +            year  = tonumber(m[1]),
  31.271 +            month = tonumber(m[2]),
  31.272 +            day   = tonumber(m[3]),
  31.273 +            hour  = 0,
  31.274 +            min   = 0,
  31.275 +            sec   = 0
  31.276 +        })
  31.277 +        local lifetime_end = os.time({
  31.278 +            year  = tonumber(m[4]),
  31.279 +            month = tonumber(m[5]),
  31.280 +            day   = tonumber(m[6]),
  31.281 +            hour  = 23,
  31.282 +            min   = 59,
  31.283 +            sec   = 59
  31.284 +        })
  31.285 +
  31.286 +        --  check whether current run-time is within lifetime
  31.287 +        local t_now = os.time()
  31.288 +        integrity.util.debug(3, "require: %d <= %d <= %d", lifetime_begin, t_now, lifetime_end)
  31.289 +        if not (lifetime_begin <= t_now and t_now <= lifetime_end) then
  31.290 +            return integrity.util.error(ctx, cfg,
  31.291 +                "current time \"" .. os.date("!%Y-%m-%d %H:%M:%S UTC", t_now) .. "\" " ..
  31.292 +                "is not within the timerange \"" .. cfg["Assertion-LifeTime"] .. "\" " ..
  31.293 +                "of license configuration parameter \"Assertion-LifeTime\"")
  31.294 +        end
  31.295 +    end
  31.296 +
  31.297 +    --  process "Assertion-GrantTime" constraint
  31.298 +    if cfg["Assertion-GrantTime"] ~= nil then
  31.299 +        integrity.util.debug(2, "checking: Assertion-GrantTime: \"%s\"", cfg["Assertion-GrantTime"])
  31.300 +
  31.301 +        --  determine granttime begin and end
  31.302 +        local granttime = cfg["Assertion-GrantTime"]
  31.303 +        local s, _, m = util.rmatch(granttime, "^(?s)(\\d{4})-(\\d{2})-(\\d{2})\\s*:\\s*(\\d{4})-(\\d{2})-(\\d{2})$")
  31.304 +        if s == nil then
  31.305 +            return integrity.util.error(ctx, cfg,
  31.306 +                "failed to extract time information from " ..
  31.307 +                "license configuration parameter \"Assertion-GrantTime\"")
  31.308 +        end
  31.309 +        local granttime_begin = os.time({
  31.310 +            year  = tonumber(m[1]),
  31.311 +            month = tonumber(m[2]),
  31.312 +            day   = tonumber(m[3]),
  31.313 +            hour  = 0,
  31.314 +            min   = 0,
  31.315 +            sec   = 0
  31.316 +        })
  31.317 +        local granttime_end = os.time({
  31.318 +            year  = tonumber(m[4]),
  31.319 +            month = tonumber(m[5]),
  31.320 +            day   = tonumber(m[6]),
  31.321 +            hour  = 23,
  31.322 +            min   = 59,
  31.323 +            sec   = 59
  31.324 +        })
  31.325 +
  31.326 +        --  determine OpenPKG Framework release time
  31.327 +        --  (allow openpkg.spec:%pre to override with a higher value for pre-checking)
  31.328 +        local t_release = 0
  31.329 +        local result = {}
  31.330 +        for _, line in ipairs(rpm.query("Q:%{RELEASE}", false, "openpkg")) do
  31.331 +            local s, _, m = util.rmatch(line, "(?s)^Q:(.+)$")
  31.332 +            if s ~= nil then
  31.333 +                table.insert(result, m[1])
  31.334 +            end
  31.335 +        end
  31.336 +        if result[1] ~= nil then
  31.337 +            local s, _, m = util.rmatch(result[1], "^(?s)(\\d{4})(\\d{2})(\\d{2})$")
  31.338 +            if s ~= nil then
  31.339 +                t_release = os.time({
  31.340 +                    year  = tonumber(m[1]),
  31.341 +                    month = tonumber(m[2]),
  31.342 +                    day   = tonumber(m[3]),
  31.343 +                    hour  = 0,
  31.344 +                    min   = 0,
  31.345 +                    sec   = 0
  31.346 +                })
  31.347 +            end
  31.348 +        end
  31.349 +        if t_release == 0 then
  31.350 +            return integrity.util.error(ctx, cfg,
  31.351 +                "failed to determine OpenPKG Framework release time")
  31.352 +        end
  31.353 +        local override = os.getenv("OPENPKG_FRAMEWORK_RELEASE")
  31.354 +        if override ~= nil then
  31.355 +            local s, _, m = util.rmatch(override, "^(?s)(\\d{4})(\\d{2})(\\d{2})$")
  31.356 +            if s ~= nil then
  31.357 +                local t_override = os.time({
  31.358 +                    year  = tonumber(m[1]),
  31.359 +                    month = tonumber(m[2]),
  31.360 +                    day   = tonumber(m[3]),
  31.361 +                    hour  = 0,
  31.362 +                    min   = 0,
  31.363 +                    sec   = 0
  31.364 +                })
  31.365 +                if t_release < t_override then
  31.366 +                    t_release = t_override
  31.367 +                end
  31.368 +            end
  31.369 +        end
  31.370 +
  31.371 +        --  check whether current OpenPKG Framework release time is within granttime
  31.372 +        integrity.util.debug(3, "require: %d <= %d <= %d", granttime_begin, t_release, granttime_end)
  31.373 +        if not (granttime_begin <= t_release and t_release <= granttime_end) then
  31.374 +            return integrity.util.error(ctx, cfg,
  31.375 +                "current OpenPKG Framework release time \"" .. os.date("%Y-%m-%d", t_release) .. "\" " ..
  31.376 +                "is not within the timerange \"" .. cfg["Assertion-GrantTime"] .. "\" " ..
  31.377 +                "of license configuration parameter \"Assertion-GrantTime\"")
  31.378 +        end
  31.379 +    end
  31.380 +
  31.381 +    --  process "Assertion-InstanceAge" constraint
  31.382 +    if cfg["Assertion-InstanceAge"] ~= nil then
  31.383 +        integrity.util.debug(2, "checking: Assertion-InstanceAge: \"%s\"", cfg["Assertion-InstanceAge"])
  31.384 +
  31.385 +        --  determine maximum instance age in seconds
  31.386 +        local t_diff_max = cfg["Assertion-InstanceAge"]
  31.387 +        t_diff_max = 0 + util.rsubst(t_diff_max, "^(\\d+)([smhdw])$", function (t, unit)
  31.388 +            if     unit == "s" then t = t * 1
  31.389 +            elseif unit == "m" then t = t * 60
  31.390 +            elseif unit == "h" then t = t * 60 * 60
  31.391 +            elseif unit == "d" then t = t * 60 * 60 * 24
  31.392 +            elseif unit == "w" then t = t * 60 * 60 * 24 * 7
  31.393 +            end
  31.394 +            return t
  31.395 +        end)
  31.396 +
  31.397 +        --  approach 1: determine install time via timestamp of UUID_REGISTRY
  31.398 +        local uuids = integrity.util.uuids()
  31.399 +        if uuids["UUID_REGISTRY"] == "" then
  31.400 +            return integrity.util.error(ctx, cfg,
  31.401 +                "failed to load UUID_REGISTRY")
  31.402 +        end
  31.403 +        txt = uuid.describe(uuids["UUID_REGISTRY"])
  31.404 +        if txt == nil then
  31.405 +            return integrity.util.error(ctx, cfg,
  31.406 +                "failed to parse extracted UUID_REGISTRY string \"" .. uuids["UUID_REGISTRY"] .. "\" as an UUID")
  31.407 +        end
  31.408 +        local s, _, m = util.rmatch(txt, "(?s)^.*time:\\s+(\\d{4})-(\\d{2})-(\\d{2})\\s+(\\d{2}):(\\d{2}):(\\d{2}).*$")
  31.409 +        if s == nil then
  31.410 +            return integrity.util.error(ctx, cfg,
  31.411 +                "failed to extract timestamp from UUID_REGISTRY \"" .. uuids["UUID_REGISTRY"] .. "\"")
  31.412 +        end
  31.413 +        local t_install = os.time({
  31.414 +            year  = tonumber(m[1]),
  31.415 +            month = tonumber(m[2]),
  31.416 +            day   = tonumber(m[3]),
  31.417 +            hour  = tonumber(m[4]),
  31.418 +            min   = tonumber(m[5]),
  31.419 +            sec   = tonumber(m[6])
  31.420 +        })
  31.421 +
  31.422 +        --  approach 2: determine install time via first install time of "openpkg" package
  31.423 +        local result = {}
  31.424 +        for _, line in ipairs(rpm.query(
  31.425 +            "Q:%|ORIGINTIME?{" ..
  31.426 +                "%{ORIGINTIME}" ..       -- regular case: RPM 5 installed/updated with RPM 5
  31.427 +            "}:{" ..
  31.428 +                "%|INSTALLTIME?{" ..
  31.429 +                    "%{INSTALLTIME}" ..  -- special case: RPM 5 installed initially with RPM 4
  31.430 +                "}:{" ..
  31.431 +                "}|" ..
  31.432 +            "}|", false, "openpkg"
  31.433 +        )) do
  31.434 +            local s, _, m = util.rmatch(line, "(?s)^Q:(.+)$")
  31.435 +            if s ~= nil then
  31.436 +                table.insert(result, m[1])
  31.437 +            end
  31.438 +        end
  31.439 +        if result[1] ~= nil then
  31.440 +            local n = tonumber(result[1])
  31.441 +            if n > 0 then
  31.442 +                t_install = n
  31.443 +            end
  31.444 +        end
  31.445 +
  31.446 +        --  check time difference
  31.447 +        local t_now = os.time()
  31.448 +        local t_diff = os.difftime(t_now, t_install)
  31.449 +        integrity.util.debug(3, "calc: %d - %d = %d", t_now, t_install, t_diff)
  31.450 +        if t_diff < 0 then
  31.451 +            return integrity.util.error(ctx, cfg,
  31.452 +                "current system time \"" .. t_now .. "\" is lower than " ..
  31.453 +                "instance installation time \"" .. t_install .. "\"")
  31.454 +        end
  31.455 +        integrity.util.debug(3, "require: %d <= %d", t_diff, t_diff_max)
  31.456 +        if t_diff > t_diff_max then
  31.457 +            return integrity.util.error(ctx, cfg,
  31.458 +                "instance age \"" .. t_diff .. "\" " ..
  31.459 +                "is greater than value \"" .. t_diff_max .. "\" (\"" .. cfg["Assertion-InstanceAge"] .. "\") " ..
  31.460 +                "of license configuration parameter \"Assertion-InstanceAge\"")
  31.461 +        end
  31.462 +    end
  31.463 +
  31.464 +    --  process "Assertion-FromSourceOnTarget" constraint
  31.465 +    if cfg["Assertion-FromSourceOnTarget"] ~= nil then
  31.466 +        integrity.util.debug(2, "checking: Assertion-FromSourceOnTarget: \"%s\"", cfg["Assertion-FromSourceOnTarget"])
  31.467 +        local hostname = rpm.hostname()
  31.468 +        for _, line in ipairs(rpm.query("Q:%{NAME}:%{BUILDHOST}", true, "*")) do
  31.469 +            local s, _, m = util.rmatch(line, "(?s)^Q:([^:]+):(.+)$")
  31.470 +            if s ~= nil then
  31.471 +                local name = m[1]
  31.472 +                local buildhost = m[2]
  31.473 +                integrity.util.debug(4, "info: name \"%s\", buildhost \"%s\"", name, buildhost)
  31.474 +                if not util.rmatch(name, "(?s)^gpg-.+$") and buildhost ~= "localhost" then
  31.475 +                    if cfg["Assertion-FromSourceOnTarget"] == "yes" and buildhost ~= hostname then
  31.476 +                        return integrity.util.error(ctx, cfg,
  31.477 +                            "license-required \"build from source on target system only\" situation not met because " ..
  31.478 +                            "package build host \"" .. buildhost .. "\" is not(!) equal to the package install host \"" .. hostname .. "\".")
  31.479 +                    end
  31.480 +                    if cfg["Assertion-FromSourceOnTarget"] == "no" and buildhost == hostname then
  31.481 +                        return integrity.util.error(ctx, cfg,
  31.482 +                            "license-required \"build binaries on separate build-host only\" situation not met because " ..
  31.483 +                            "package build host \"" .. buildhost .. "\" is equal to the package install host \"" .. hostname .. "\".")
  31.484 +                    end
  31.485 +                end
  31.486 +            end
  31.487 +        end
  31.488 +    end
  31.489 +
  31.490 +    --  process "Assertion-PackageNames" constraints
  31.491 +    if cfg["Assertion-PackageNames"] ~= nil then
  31.492 +        integrity.util.debug(2, "checking: Assertion-PackageNames: \"%s\"", cfg["Assertion-PackageNames"])
  31.493 +
  31.494 +        --  query RPMDB for names of all installed packages
  31.495 +        local packages = {}
  31.496 +        for _, line in ipairs(rpm.query("Q:%{NAME}", true, "*")) do
  31.497 +            local s, _, m = util.rmatch(line, "(?s)^Q:(.+)$")
  31.498 +            if s ~= nil then
  31.499 +                table.insert(packages, m[1])
  31.500 +            end
  31.501 +        end
  31.502 +
  31.503 +        --  iterate over all constraints
  31.504 +        for _, constraint in
  31.505 +            ipairs(
  31.506 +                util.rsplit(
  31.507 +                    util.rsubst(
  31.508 +                        cfg["Assertion-PackageNames"],
  31.509 +                        "(?s)^\\s*(.+?)\\s*$", "%1"
  31.510 +                    ),
  31.511 +                    "(?s)\\s+"
  31.512 +                )
  31.513 +            ) do
  31.514 +            --  parse constraint
  31.515 +            local s, _, m = util.rmatch(constraint, "(?s)^(!?)([^:]+):(!?)(.+)$")
  31.516 +            if s == nil then
  31.517 +                return integrity.util.error(ctx, cfg,
  31.518 +                    "invalid syntax in license configuration \"Assertion-PackageNames\" " ..
  31.519 +                    "parameter: \"" ..  constraint .. "\"")
  31.520 +            end
  31.521 +            local mode_negate    = m[1] ~= ""
  31.522 +            local mode_regex     = m[2]
  31.523 +            local package_negate = m[3] ~= ""
  31.524 +            local package_regex  = m[4]
  31.525 +            --  apply the mode filter
  31.526 +            local mode_matches, _, _ = util.rmatch(ctx.rpm.mode, mode_regex);
  31.527 +            if     (not mode_negate and mode_matches ~= nil)
  31.528 +                or (    mode_negate and mode_matches == nil) then
  31.529 +                --  apply the package filter to names of all installed packages
  31.530 +                for _, package in ipairs(packages) do
  31.531 +                    if package_negate then
  31.532 +                        integrity.util.debug(3, "require: \"%s\" !~ /%s/", package, package_regex)
  31.533 +                    else
  31.534 +                        integrity.util.debug(3, "require: \"%s\" ~~ /%s/", package, package_regex)
  31.535 +                    end
  31.536 +                    local package_matches, _, _ = util.rmatch(package, package_regex)
  31.537 +                    if  not (   (not package_negate and package_matches ~= nil)
  31.538 +                             or (    package_negate and package_matches == nil)) then
  31.539 +                        --  indicate integrity validation error
  31.540 +                        return integrity.util.error(ctx, cfg,
  31.541 +                            "installed package \"" .. package .. "\" " ..
  31.542 +                            "under RPM run-time mode \"" .. ctx.rpm.mode .. "\" " ..
  31.543 +                            "not covered by pattern \"" .. package_regex .. "\" " ..
  31.544 +                            "of license configuration parameter \"Assertion-PackageNames\"")
  31.545 +                    end
  31.546 +                end
  31.547 +            end
  31.548 +        end
  31.549 +    end
  31.550 +
  31.551 +    --  process "Assertion-PackageReleaseAge"
  31.552 +    if cfg["Assertion-PackageReleaseAge"] ~= nil then
  31.553 +        integrity.util.debug(2, "checking: Assertion-PackageReleaseAge: \"%s[...]\"", string.sub(cfg["Assertion-PackageReleaseAge"], 1, 20))
  31.554 +
  31.555 +        --  parse constraint
  31.556 +        local constraint = cfg["Assertion-PackageReleaseAge"]
  31.557 +        local s, _, m = util.rmatch(constraint, "(?s)^([^:]+)%:([^:]+):([^\\s]+)\\s+(.+)$")
  31.558 +        if s == nil then
  31.559 +            return integrity.util.error(ctx, cfg,
  31.560 +                "invalid syntax in license configuration \"Assertion-PackageReleaseAge\" parameter")
  31.561 +        end
  31.562 +        local percent   = m[1] / 100
  31.563 +        local offset    = m[2]
  31.564 +        local distregex = m[3]
  31.565 +        local spec      = m[4]
  31.566 +
  31.567 +        --  determine maximum release time difference (in seconds)
  31.568 +        local t_diff_max = 0 + util.rsubst(offset, "^(\\d+)([smhdw])$", function (t, unit)
  31.569 +            if     unit == "s" then t = t * 1
  31.570 +            elseif unit == "m" then t = t * 60
  31.571 +            elseif unit == "h" then t = t * 60 * 60
  31.572 +            elseif unit == "d" then t = t * 60 * 60 * 24
  31.573 +            elseif unit == "w" then t = t * 60 * 60 * 24 * 7
  31.574 +            end
  31.575 +            return t
  31.576 +        end)
  31.577 +
  31.578 +        --  iterate over all package specifications to build release map
  31.579 +        local releases = {}
  31.580 +        for _, constraint in
  31.581 +            ipairs(
  31.582 +                util.rsplit(
  31.583 +                    util.rsubst(
  31.584 +                        spec,
  31.585 +                        "(?s)^\\s*(.+?)\\s*$", "%1"
  31.586 +                    ),
  31.587 +                    "(?s)\\s+"
  31.588 +                )
  31.589 +            ) do
  31.590 +
  31.591 +            --  parse specification into package name and release constraint
  31.592 +            local s, _, m = util.rmatch(constraint, "(?s)^([^:]+):(.+)$")
  31.593 +            if s == nil then
  31.594 +                return integrity.util.error(ctx, cfg,
  31.595 +                    "invalid syntax in license configuration \"Assertion-PackageReleaseAge\" " ..
  31.596 +                    "parameter: \"" ..  constraint .. "\"")
  31.597 +            end
  31.598 +
  31.599 +            -- store result into release map
  31.600 +            releases[m[1]] = m[2]
  31.601 +        end
  31.602 +
  31.603 +        --  query RPMDB for releases of all installed packages and decide
  31.604 +        --  whether the release time is inside or outside our constraint window
  31.605 +        local release_window_inside  = 0
  31.606 +        local release_window_outside = 0
  31.607 +        local release_window_foreign = 0
  31.608 +        local release_window_unknown = 0
  31.609 +        for _, line in ipairs(rpm.query("Q:%{NAME}:%{RELEASE}:%{DISTRIBUTION}", true, "*")) do
  31.610 +            local s, _, m = util.rmatch(line, "(?s)^Q:([^:]+):(\\d\\d\\d\\d)(\\d\\d)(\\d\\d):(.+)$")
  31.611 +            if s ~= nil then
  31.612 +                --  parse query results
  31.613 +                local name = m[1]
  31.614 +                local t_release = os.time({
  31.615 +                    year  = tonumber(m[2]),
  31.616 +                    month = tonumber(m[3]),
  31.617 +                    day   = tonumber(m[4]),
  31.618 +                    hour  = 23,
  31.619 +                    min   = 59,
  31.620 +                    sec   = 59
  31.621 +                })
  31.622 +                local dist = m[5]
  31.623 +
  31.624 +                --  only check files of the constrained distribution(s)
  31.625 +                if util.rmatch(dist, "(?s)" .. distregex) then
  31.626 +
  31.627 +                    --  determine minimum release constraint
  31.628 +                    local t_release_min = releases[name]
  31.629 +                    if t_release_min == nil then
  31.630 +                        t_release_min = releases["*"]
  31.631 +                    end
  31.632 +                    if t_release_min == nil then
  31.633 +                        t_release_min = os.time()
  31.634 +                    else
  31.635 +                        local s, _, m = util.rmatch(t_release_min, "^(?s)(\\d{4})(\\d{2})(\\d{2})$")
  31.636 +                        t_release_min = os.time({
  31.637 +                            year  = tonumber(m[1]),
  31.638 +                            month = tonumber(m[2]),
  31.639 +                            day   = tonumber(m[3]),
  31.640 +                            hour  = 0,
  31.641 +                            min   = 0,
  31.642 +                            sec   = 0
  31.643 +                        })
  31.644 +                    end
  31.645 +                    
  31.646 +                    --  check time difference of package release
  31.647 +                    local t_diff = os.difftime(t_release_min, t_release)
  31.648 +                    integrity.util.debug(4, "calc: %d - %d = %d", t_release_min, t_release, t_diff)
  31.649 +                    integrity.util.debug(4, "require: %d <= 0 or (%d > 0 and %d < %d)", t_diff, t_diff, t_diff, t_diff_max)
  31.650 +                    if t_diff <= 0 or (t_diff > 0 and t_diff < t_diff_max) then
  31.651 +                        release_window_inside  = release_window_inside  + 1
  31.652 +                    else
  31.653 +                        release_window_outside = release_window_outside + 1
  31.654 +                    end
  31.655 +                else
  31.656 +                    release_window_foreign = release_window_foreign + 1
  31.657 +                end
  31.658 +            else
  31.659 +                release_window_unknown = release_window_unknown + 1
  31.660 +            end
  31.661 +        end
  31.662 +        integrity.util.debug(3, "info: inside %d, outside %d, foreign %d, unknown %d",
  31.663 +            release_window_inside, release_window_outside, release_window_foreign, release_window_unknown)
  31.664 +
  31.665 +        --  check validity of overall constraint
  31.666 +        local percent_inside =
  31.667 +            (release_window_inside / (release_window_inside + release_window_outside))
  31.668 +        integrity.util.debug(3, "require: %d >= %d", percent_inside, percent)
  31.669 +        if percent_inside < percent then
  31.670 +            return integrity.util.error(ctx, cfg,
  31.671 +                "there are only " .. math.floor(percent_inside * 100) .. "% " ..
  31.672 +                "packages inside the release date constraint " ..
  31.673 +                "(expected a minimum of " .. math.floor(percent * 100) .. "%)")
  31.674 +        end
  31.675 +    end
  31.676 +
  31.677 +    --  process "Assertion-Expression" constraint
  31.678 +    if cfg["Assertion-Expression"] ~= nil then
  31.679 +        integrity.util.debug(2, "checking: Assertion-Expression: \"%s\"", cfg["Assertion-Expression"])
  31.680 +
  31.681 +        --  expand special consytructs in expression
  31.682 +        local expr = cfg["Assertion-Expression"]
  31.683 +        expr = util.rsubst(expr, "(%\{[a-zA-Z_][a-zA-Z0-9_]+\})", function (str)
  31.684 +            return rpm.expand(str)
  31.685 +        end)
  31.686 +        expr = util.rsubst(expr, "\"((?:\\\\.|[^\"])+)\"\\s*~~\\s*/((?:\\\\.|[^/])+)/", function (str, regex)
  31.687 +            if util.rmatch(str, "(?s)" .. regex) ~= nil then
  31.688 +                return "true"
  31.689 +            else
  31.690 +                return "false"
  31.691 +            end
  31.692 +        end)
  31.693 +
  31.694 +        --  evaluate expression
  31.695 +        integrity.util.debug(3, "evaluate: %s", expr)
  31.696 +        result = assert(loadstring(expr))()
  31.697 +        if type(result) ~= "boolean" then
  31.698 +            result = false
  31.699 +        end
  31.700 +        if not result then
  31.701 +            return integrity.util.error(ctx, cfg,
  31.702 +                "expression \"" .. cfg["Assertion-Expression"] .. "\" " ..
  31.703 +                "of license configuration parameter \"Assertion-Expression\"" ..
  31.704 +                "evaluated to false")
  31.705 +        end
  31.706 +    end
  31.707 +
  31.708 +    --  indicate license integrity validation success
  31.709 +    return "OK"
  31.710 +end
  31.711 +
  31.712 +- --  integrity processor utilities namespace
  31.713 +integrity.util = {}
  31.714 +
  31.715 +- --  write debug information to stderr
  31.716 +function integrity.util.debug(level_this, msg, ...)
  31.717 +    local level_min = os.getenv("OPENPKG_LICENSE_DEBUG")
  31.718 +    if level_min ~= nil then
  31.719 +        if type(level_min) == "string" then
  31.720 +            level_min = tonumber(level_min)
  31.721 +        end
  31.722 +        if type(level_min) ~= "number" then
  31.723 +            level_min = 0
  31.724 +        end
  31.725 +        if level_this <= level_min then
  31.726 +            local output
  31.727 +            if type(msg) == "function" then
  31.728 +                output = msg(...)
  31.729 +            else
  31.730 +                output = string.format(msg, ...)
  31.731 +            end
  31.732 +            local prefix = ""
  31.733 +            local i = 1
  31.734 +            while (i < level_this) do
  31.735 +                prefix = prefix .. "    "
  31.736 +                i = i + 1
  31.737 +            end
  31.738 +            io.stderr:write("rpm: DEBUG: " .. prefix .. output .. "\n")
  31.739 +        end
  31.740 +    end
  31.741 +end
  31.742 +
  31.743 +- --  load OpenPKG instance UUIDs
  31.744 +function integrity.util.uuids()
  31.745 +    local uuids = {
  31.746 +        UUID_REGISTRY = "",
  31.747 +        UUID_INSTANCE = "",
  31.748 +        UUID_PLATFORM = ""
  31.749 +    }
  31.750 +    local filename = rpm.expand("%{l_prefix}/etc/openpkg/uuid")
  31.751 +    local txt = rpm.slurp(filename)
  31.752 +    if txt ~= nil then
  31.753 +        for name, _ in pairs(uuids) do
  31.754 +            local s, _, m = util.rmatch(txt, "(?s)^.*" .. name .. "=\"([^\"\"]+)\".*$")
  31.755 +            if s ~= nil then
  31.756 +                uuids[name] = m[1]
  31.757 +            end
  31.758 +        end
  31.759 +    end
  31.760 +    return uuids
  31.761 +end
  31.762 +
  31.763 +- --  report validation warning
  31.764 +function integrity.util.warning(ctx, cfg, warning)
  31.765 +    --  return prominent warning message
  31.766 +    return
  31.767 +        "WARNING: OpenPKG run-time license check failed -- continue processing\n" ..
  31.768 +        "+-----------------------------------------------------------------------------+\n" ..
  31.769 +        "| Attention, the OpenPKG RPM run-time integrity checking facility encountered a\n" ..
  31.770 +        "| non-fatal problem during license checking, but allows processing to continue.\n" ..
  31.771 +        "| The particular warning reported by the OpenPKG license processor is:\n" ..
  31.772 +        "|\n" ..
  31.773 +        util.textwrap("|   ", warning, 60, 70) ..
  31.774 +        "|\n" ..
  31.775 +        "| Notice: Operation of the OpenPKG Framework requires a valid license.\n" ..
  31.776 +        "| Go to http://openpkg.com/go/framework-license for more details, please.\n" ..
  31.777 +        "+-----------------------------------------------------------------------------+"
  31.778 +end
  31.779 +
  31.780 +- --  report validation error
  31.781 +function integrity.util.error(ctx, cfg, error)
  31.782 +    --  support conversion of errors into warnings
  31.783 +    if cfg["Assertion-ErrorToWarning"] ~= nil then
  31.784 +        if cfg["Assertion-ErrorToWarning"] == "yes" then
  31.785 +            return integrity.util.warning(ctx, cfg, error)
  31.786 +        end
  31.787 +    end
  31.788 +
  31.789 +    --  return prominent error message
  31.790 +    return
  31.791 +        "ERROR: OpenPKG run-time license check failed -- stopping processing\n" ..
  31.792 +        "+-----------------------------------------------------------------------------+\n" ..
  31.793 +        "| Sorry, the OpenPKG RPM run-time integrity checking facility encountered a\n" ..
  31.794 +        "| fatal problem during license checking and stops processing immediately.\n" ..
  31.795 +        "| The particular error reported by the OpenPKG license processor is:\n" ..
  31.796 +        "|\n" ..
  31.797 +        util.textwrap("|   ", error, 60, 70) ..
  31.798 +        "|\n" ..
  31.799 +        "| Notice: Operation of the OpenPKG Framework requires a valid license.\n" ..
  31.800 +        "| Go to http://openpkg.com/go/framework-license for more details, please.\n" ..
  31.801 +        "| Run \"openpkg man license\" for details about local license management.\n" ..
  31.802 +        "+-----------------------------------------------------------------------------+"
  31.803 +end
  31.804 +
  31.805 +-----BEGIN PGP SIGNATURE-----
  31.806 +Comment: OpenPKG GmbH <openpkg@openpkg.com>
  31.807 +
  31.808 +iEYEARECAAYFAk8BelcACgkQZwQuyWG3rjTL6QCeLTLVj4PTnd/E7mf+Sv4mgbZj
  31.809 +5J0AoMXrO4EimPSSCZSJ1TLW8f8GP+B5
  31.810 +=AVpf
  31.811 +-----END PGP SIGNATURE-----
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/openpkg/license.pod	Tue Jul 31 12:23:42 2012 +0200
    32.3 @@ -0,0 +1,126 @@
    32.4 +##
    32.5 +##  OpenPKG License Utility
    32.6 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    32.7 +##
    32.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    32.9 +##  All rights reserved. Licenses which grant limited permission to use,
   32.10 +##  copy, modify and distribute this software are available from the
   32.11 +##  OpenPKG GmbH.
   32.12 +##
   32.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   32.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   32.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   32.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   32.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   32.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   32.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   32.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   32.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   32.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   32.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   32.24 +##  SUCH DAMAGE.
   32.25 +##
   32.26 +
   32.27 +=pod
   32.28 +
   32.29 +=head1 NAME
   32.30 +
   32.31 +B<openpkg license> - OpenPKG License Utility
   32.32 +
   32.33 +=head1 SYNOPSIS
   32.34 +
   32.35 +B<openpkg license> B<help>
   32.36 +
   32.37 +B<openpkg license> B<install> I<id> I<file>|I<url>|C<->
   32.38 +
   32.39 +B<openpkg license> B<update> I<id> I<file>|I<url>|C<->
   32.40 +
   32.41 +B<openpkg license> B<uninstall> I<id>
   32.42 +
   32.43 +B<openpkg license> B<activate> I<id>
   32.44 +
   32.45 +B<openpkg license> B<view> I<id>
   32.46 +
   32.47 +B<openpkg license> B<list>
   32.48 +
   32.49 +B<openpkg license> B<active>
   32.50 +
   32.51 +B<openpkg license> B<sanity>
   32.52 +
   32.53 +=head1 DESCRIPTION
   32.54 +
   32.55 +The B<openpkg license> command is the maintenance utility for OpenPKG
   32.56 +Framework licenses.
   32.57 +
   32.58 +=head1 COMMANDS
   32.59 +
   32.60 +=over 4
   32.61 +
   32.62 +=item B<openpkg license> B<help>
   32.63 +
   32.64 +This command just displays a short usage help information.
   32.65 +
   32.66 +=item B<openpkg license> B<install> I<id> I<file>|I<url>|C<->
   32.67 +
   32.68 +This command installs the license contained in I<file> or at I<url> or
   32.69 +provided on F<stdin> under the identifier I<id>. The I<id> can be an
   32.70 +arbitrary string, but the convention is that I<id> is a short upper-case
   32.71 +identifier.
   32.72 +
   32.73 +=item B<openpkg license> B<update> I<id> I<file>|I<url>|C<->
   32.74 +
   32.75 +This command updates an already installed license with the license
   32.76 +contained in I<file> or at I<url> or provided on F<stdin> under the
   32.77 +identifier I<id>.
   32.78 +
   32.79 +=item B<openpkg license> B<uninstall> I<id>
   32.80 +
   32.81 +This command uninstalls the license which is installed under I<id>.
   32.82 +A license can be uninstalled only if it is not currently activated (see
   32.83 +B<openpkg license activate> command).
   32.84 +
   32.85 +=item B<openpkg license> B<activate> I<id>
   32.86 +
   32.87 +This command activates the license which is installed under I<id>.
   32.88 +Only one installed license can be active at any time, so this command
   32.89 +implicitly deactivates the currently activate license.
   32.90 +
   32.91 +=item B<openpkg license> B<view> I<id>
   32.92 +
   32.93 +This command shows the license which is installed under I<id>.
   32.94 +
   32.95 +=item B<openpkg license> B<list>
   32.96 +
   32.97 +This command lists the identifiers of all installed licenses.
   32.98 +
   32.99 +=item B<openpkg license> B<active>
  32.100 +
  32.101 +This command outputs the identifier of the currently activated license.
  32.102 +
  32.103 +=item B<openpkg license> B<sanity>
  32.104 +
  32.105 +This command sanity checks the current license configuration.
  32.106 +
  32.107 +=back
  32.108 +
  32.109 +=head1 FILES
  32.110 +
  32.111 +=over 4
  32.112 +
  32.113 +=item F<@l_prefix@/etc/license>
  32.114 +
  32.115 +The name of the currently activated license file under
  32.116 +F<@l_prefix@/etc/license.d/>.
  32.117 +
  32.118 +=item F<@l_prefix@/etc/license.d/*>
  32.119 +
  32.120 +The directory containing all installed license files.
  32.121 +
  32.122 +=back
  32.123 +
  32.124 +=head1 HISTORY
  32.125 +
  32.126 +The B<openpkg license> command first appeared in B<OpenPKG 4.0>.
  32.127 +
  32.128 +=cut
  32.129 +
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/openpkg/license.sh	Tue Jul 31 12:23:42 2012 +0200
    33.3 @@ -0,0 +1,281 @@
    33.4 +#!@l_prefix@/lib/openpkg/bash
    33.5 +##
    33.6 +##  uuid -- OpenPKG UUID Update Utility
    33.7 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    33.8 +##
    33.9 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   33.10 +##  All rights reserved. Licenses which grant limited permission to use,
   33.11 +##  copy, modify and distribute this software are available from the
   33.12 +##  OpenPKG GmbH.
   33.13 +##
   33.14 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   33.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   33.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   33.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   33.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   33.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   33.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   33.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   33.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   33.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   33.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   33.25 +##  SUCH DAMAGE.
   33.26 +##
   33.27 +
   33.28 +#   configuration
   33.29 +prefix="@l_prefix@"
   33.30 +musr="@l_musr@"
   33.31 +mgrp="@l_mgrp@"
   33.32 +
   33.33 +#   minimum command line parsing
   33.34 +opt_v=no
   33.35 +while [ 1 ]; do
   33.36 +    case "$1" in
   33.37 +        -v | --verbose ) opt_v=yes; shift ;;
   33.38 +        * ) break ;;
   33.39 +    esac
   33.40 +done
   33.41 +
   33.42 +#   determine temporary directory
   33.43 +tmpdir="${TMPDIR-/tmp}"
   33.44 +
   33.45 +#   helper function for checking the signature
   33.46 +valid_signature () {
   33.47 +    script="%{lua: print(rpm.signature(\"$1\", nil,"
   33.48 +    script="$script \"$prefix/etc/openpkg/openpkg.com.pgp\","
   33.49 +    script="$script \"7D121A8FC05DC18A4329E9EF67042EC961B7AE34\")) }"
   33.50 +    result=`$prefix/bin/openpkg rpm --eval "$script" 2>/dev/null || true`
   33.51 +    if [ ".$result" == .true ]; then
   33.52 +        return 0
   33.53 +    else
   33.54 +        return 1
   33.55 +    fi
   33.56 +}
   33.57 +
   33.58 +#   display usage help
   33.59 +do_help () {
   33.60 +    echo "openpkg license help .......................... show usage help (this text)"
   33.61 +    echo "openpkg license install <id> <file>|<url>|- ... install a new license"
   33.62 +    echo "openpkg license update <id> <file>|<url>|- .... update an installed license"
   33.63 +    echo "openpkg license uninstall <id> ................ uninstall an installed license"
   33.64 +    echo "openpkg license activate <id> ................. activate an installed license"
   33.65 +    echo "openpkg license view <id> ..................... view an installed license"
   33.66 +    echo "openpkg license list .......................... list all installed licenses"
   33.67 +    echo "openpkg license active ........................ list the currently activated license"
   33.68 +    echo "openpkg license sanity ........................ sanity check installed license"
   33.69 +}
   33.70 +
   33.71 +#   install license
   33.72 +do_install () {
   33.73 +    if [ $# -ne 2 ]; then
   33.74 +        echo "openpkg:license:USAGE: openpkg license install <id> <file>|-" 1>&2
   33.75 +        exit 1
   33.76 +    fi
   33.77 +    id="$1"
   33.78 +    src="$2"
   33.79 +    case "$src" in
   33.80 +        http:* | https:* | ftp:* )
   33.81 +            tmp="$tmpdir/openpkg.license.txt"
   33.82 +            ( rm -f $tmp >/dev/null 2>&1 || true
   33.83 +              set -o noclobber
   33.84 +              $prefix/lib/openpkg/curl -s -q -f -L $src >$tmp
   33.85 +            ) || exit $?
   33.86 +            src="$tmp"
   33.87 +            ;;
   33.88 +        "-" )
   33.89 +            src="$tmpdir/openpkg.license.txt"
   33.90 +            ( rm -f $src >/dev/null 2>&1 || true
   33.91 +              set -o noclobber
   33.92 +              cat >$src
   33.93 +            ) || exit $?
   33.94 +            ;;
   33.95 +    esac
   33.96 +    if [ -f $prefix/etc/openpkg/license.d/$id ]; then
   33.97 +        echo "openpkg:license:ERROR: license with id \"$id\" already exists -- uninstall first" 1>&2
   33.98 +        exit 1
   33.99 +    fi
  33.100 +    if ! valid_signature $src; then
  33.101 +        echo "openpkg:license:ERROR: invalid signature on license file" 1>&2
  33.102 +        exit 1
  33.103 +    fi
  33.104 +    if [ ! -w $prefix/etc/openpkg/license.d ]; then
  33.105 +        echo "openpkg:license:ERROR: unable to store signature -- permission problems?" 1>&2
  33.106 +        exit 1
  33.107 +    fi
  33.108 +    cat $src >$prefix/etc/openpkg/license.d/$id || exit $?
  33.109 +    chown $musr:$mgrp $prefix/etc/openpkg/license.d/$id >/dev/null 2>&1 || true
  33.110 +}
  33.111 +
  33.112 +#   update license
  33.113 +do_update () {
  33.114 +    if [ $# -ne 2 ]; then
  33.115 +        echo "openpkg:license:USAGE: openpkg license update <id> <file>|-" 1>&2
  33.116 +        exit 1
  33.117 +    fi
  33.118 +    id="$1"
  33.119 +    src="$2"
  33.120 +    case "$src" in
  33.121 +        http:* | https:* | ftp:* )
  33.122 +            tmp="$tmpdir/openpkg.license.txt"
  33.123 +            ( rm -f $tmp >/dev/null 2>&1 || true
  33.124 +              set -o noclobber
  33.125 +              $prefix/lib/openpkg/curl -s -q -f -L $src >$tmp
  33.126 +            ) || exit $?
  33.127 +            src="$tmp"
  33.128 +            ;;
  33.129 +        "-" )
  33.130 +            src="$tmpdir/openpkg.license.txt"
  33.131 +            ( rm -f $src >/dev/null 2>&1 || true
  33.132 +              set -o noclobber
  33.133 +              cat >$src
  33.134 +            ) || exit $?
  33.135 +            ;;
  33.136 +    esac
  33.137 +    if [ ! -f $prefix/etc/openpkg/license.d/$id ]; then
  33.138 +        echo "openpkg:license:ERROR: license with id \"$id\" does not exist -- install first to update" 1>&2
  33.139 +        exit 1
  33.140 +    fi
  33.141 +    if ! valid_signature $src; then
  33.142 +        echo "openpkg:license:ERROR: invalid signature on license file" 1>&2
  33.143 +        exit 1
  33.144 +    fi
  33.145 +    if [ ! -w $prefix/etc/openpkg/license.d ]; then
  33.146 +        echo "openpkg:license:ERROR: unable to store signature -- permission problems?" 1>&2
  33.147 +        exit 1
  33.148 +    fi
  33.149 +    cat $src >$prefix/etc/openpkg/license.d/$id || exit $?
  33.150 +    chown $musr:$mgrp $prefix/etc/openpkg/license.d/$id >/dev/null 2>&1 || true
  33.151 +}
  33.152 +
  33.153 +#   uninstall license
  33.154 +do_uninstall () {
  33.155 +    if [ $# -ne 1 ]; then
  33.156 +        echo "openpkg:license:USAGE: openpkg license uninstall <id>" 1>&2
  33.157 +        exit 1
  33.158 +    fi
  33.159 +    id="$1"
  33.160 +    if [ ! -f $prefix/etc/openpkg/license.d/$id ]; then
  33.161 +        echo "openpkg:license:ERROR: no license under id \"$id\" installed" 1>&2
  33.162 +        exit 1
  33.163 +    fi
  33.164 +    id_active="`cat $prefix/etc/openpkg/license`"
  33.165 +    if [ ".$id" = ".$id_active" ]; then
  33.166 +        echo "openpkg:license:ERROR: license under id \"$id\" still activated -- activate a different one first" 1>&2
  33.167 +        exit 1
  33.168 +    fi
  33.169 +    rm -f $prefix/etc/openpkg/license.d/$id
  33.170 +    if [ $? -ne 0 ]; then
  33.171 +        echo "openpkg:license:ERROR: failed to uninstall license" 1>&2
  33.172 +        exit 1
  33.173 +    fi
  33.174 +}
  33.175 +
  33.176 +#   activate license
  33.177 +do_activate () {
  33.178 +    if [ $# -ne 1 ]; then
  33.179 +        echo "openpkg:license:USAGE: openpkg license activate <id>" 1>&2
  33.180 +        exit 1
  33.181 +    fi
  33.182 +    id="$1"
  33.183 +    if [ ! -f $prefix/etc/openpkg/license.d/$id ]; then
  33.184 +        echo "openpkg:license:ERROR: no license under id \"$id\" installed" 1>&2
  33.185 +        exit 1
  33.186 +    fi
  33.187 +    id_active="`cat $prefix/etc/openpkg/license`"
  33.188 +    if [ ".$id" = ".$id_active" ]; then
  33.189 +        echo "openpkg:license:ERROR: license id \"$id\" is already activated" 1>&2
  33.190 +        exit 1
  33.191 +    fi
  33.192 +    echo "$id" >$prefix/etc/openpkg/license
  33.193 +    if [ $? -ne 0 ]; then
  33.194 +        echo "openpkg:license:ERROR: failed to activate license under id \"$id\"" 1>&2
  33.195 +        exit 1
  33.196 +    fi
  33.197 +}
  33.198 +
  33.199 +#   view license
  33.200 +do_view () {
  33.201 +    if [ $# -ne 1 ]; then
  33.202 +        echo "openpkg:license:USAGE: openpkg license view <id>" 1>&2
  33.203 +        exit 1
  33.204 +    fi
  33.205 +    id="$1"
  33.206 +    if [ ! -f $prefix/etc/openpkg/license.d/$id ]; then
  33.207 +        echo "openpkg:license:ERROR: no license under id \"$id\" installed" 1>&2
  33.208 +        exit 1
  33.209 +    fi
  33.210 +    viewer=""
  33.211 +    for name in less more cat; do
  33.212 +        for dir in `echo $PATH | sed -e 's;:; ;g'`; do
  33.213 +            if [ -x $dir/$name ]; then
  33.214 +                viewer="$dir/$name"
  33.215 +                break
  33.216 +            fi
  33.217 +        done
  33.218 +        if [ ".$viewer" != . ]; then
  33.219 +            break
  33.220 +        fi
  33.221 +    done
  33.222 +    eval $viewer $prefix/etc/openpkg/license.d/$id
  33.223 +}
  33.224 +
  33.225 +#   list license
  33.226 +do_list () {
  33.227 +    if [ $# -ne 0 ]; then
  33.228 +        echo "openpkg:license:USAGE: openpkg license list" 1>&2
  33.229 +        exit 1
  33.230 +    fi
  33.231 +    id_active="`cat $prefix/etc/openpkg/license`"
  33.232 +    for file in `cd / && find $prefix/etc/openpkg/license.d -type f -print | sort`; do
  33.233 +        id=`echo $file | sed -e "s;^$prefix/etc/openpkg/license.d/;;"`
  33.234 +        status="-"
  33.235 +        if [ ".$id" = ".$id_active" ]; then
  33.236 +            status="+"
  33.237 +        fi
  33.238 +        echo . | awk '{ printf("%s %s\n", status, id); }' id="$id" status="$status"
  33.239 +    done
  33.240 +}
  33.241 +
  33.242 +#   list currently activate license
  33.243 +do_active () {
  33.244 +    if [ $# -ne 0 ]; then
  33.245 +        echo "openpkg:license:USAGE: openpkg license active" 1>&2
  33.246 +        exit 1
  33.247 +    fi
  33.248 +    cat $prefix/etc/openpkg/license
  33.249 +}
  33.250 +
  33.251 +#   sanity-check license
  33.252 +do_sanity () {
  33.253 +    if [ $# -ne 0 ]; then
  33.254 +        echo "openpkg:license:USAGE: openpkg license sanity" 1>&2
  33.255 +        exit 1
  33.256 +    fi
  33.257 +    id="`cat $prefix/etc/openpkg/license`"
  33.258 +    if [ ! -f $prefix/etc/openpkg/license.d/$id ]; then
  33.259 +        echo "openpkg:license:ERROR: active license with id \"$id\" does not exist" 1>&2
  33.260 +        exit 1
  33.261 +    fi
  33.262 +    if ! valid_signature $prefix/etc/openpkg/license.d/$id; then
  33.263 +        echo "openpkg:license:ERROR: invalid signature on active license" 1>&2
  33.264 +        exit 1
  33.265 +    fi
  33.266 +}
  33.267 +
  33.268 +#   Command Line Dispatching
  33.269 +cmd="$1"
  33.270 +shift
  33.271 +case "$cmd" in
  33.272 +    help      ) do_help      ${1+"$@"} ;;
  33.273 +    install   ) do_install   ${1+"$@"} ;;
  33.274 +    update    ) do_update    ${1+"$@"} ;;
  33.275 +    uninstall ) do_uninstall ${1+"$@"} ;;
  33.276 +    activate  ) do_activate  ${1+"$@"} ;;
  33.277 +    view      ) do_view      ${1+"$@"} ;;
  33.278 +    list      ) do_list      ${1+"$@"} ;;
  33.279 +    active    ) do_active    ${1+"$@"} ;;
  33.280 +    sanity    ) do_sanity    ${1+"$@"} ;;
  33.281 +    ""        ) echo "openpkg:license:ERROR: no command given (use \"help\" for usage)" 1>&2; exit 1 ;;
  33.282 +    *         ) echo "openpkg:license:ERROR: invalid command \"$cmd\" (use \"help\" for usage)" 1>&2; exit 1 ;;
  33.283 +esac
  33.284 +
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/openpkg/lint-fsl.pl	Tue Jul 31 12:23:42 2012 +0200
    34.3 @@ -0,0 +1,502 @@
    34.4 +##
    34.5 +##  lint-fsl.pl -- OpenPKG fsl.* File Checker
    34.6 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    34.7 +##
    34.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    34.9 +##  All rights reserved. Licenses which grant limited permission to use,
   34.10 +##  copy, modify and distribute this software are available from the
   34.11 +##  OpenPKG GmbH.
   34.12 +##
   34.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   34.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   34.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   34.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   34.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   34.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   34.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   34.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   34.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   34.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   34.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   34.24 +##  SUCH DAMAGE.
   34.25 +##
   34.26 +
   34.27 +#   Perl run-time requirement
   34.28 +require 5;
   34.29 +BEGIN {
   34.30 +    eval "use Getopt::Long; use IO;";
   34.31 +    if ($@) {
   34.32 +        print STDERR
   34.33 +            "lint-fsl: ERROR: This command requires a full-size Perl installation!\n" .
   34.34 +            "lint-fsl: HINT:  Install OpenPKG \"perl\" package to use this command.\n";
   34.35 +        exit(1);
   34.36 +    }
   34.37 +}
   34.38 +
   34.39 +#   OpenPKG instance prefix
   34.40 +my $my_prefix = $ENV{'OPENPKG_PREFIX'};
   34.41 +delete $ENV{'OPENPKG_PREFIX'};
   34.42 +
   34.43 +#   program information
   34.44 +my $progname = "lint-fsl";
   34.45 +my $progvers = "1.0.0";
   34.46 +
   34.47 +#   parameters (defaults)
   34.48 +my $version  = 0;
   34.49 +my $verbose  = 0;
   34.50 +my $help     = 0;
   34.51 +my $check    = 'all';
   34.52 +my $tmpdir   = ($ENV{TMPDIR} || $ENV{TEMPDIR} || "/tmp") . "/$progname";
   34.53 +my $rpm      = "$my_prefix/bin/openpkg rpm";
   34.54 +
   34.55 +#   exception handling support
   34.56 +$SIG{__DIE__} = sub {
   34.57 +    my ($err) = @_;
   34.58 +    $err =~ s|\s+at\s+.*||s if (not $verbose);
   34.59 +    print STDERR "$progname:ERROR: $err ". ($! ? "($!)" : "") . "\n";
   34.60 +    exit(1);
   34.61 +};
   34.62 +
   34.63 +#   command line parsing
   34.64 +Getopt::Long::Configure("bundling");
   34.65 +my $result = GetOptions(
   34.66 +    'V|version'     => \$version,
   34.67 +    'v|verbose'     => \$verbose,
   34.68 +    'h|help'        => \$help,
   34.69 +    'c|check=s'     => \$check,
   34.70 +    't|tmpdir=s'    => \$tmpdir,
   34.71 +    'r|rpm=s'       => \$rpm,
   34.72 +) || die "option parsing failed";
   34.73 +if ($help) {
   34.74 +    print "Usage: $progname [options] [RPMFILE ...]\n" .
   34.75 +          "Available options:\n" .
   34.76 +          " -v,--verbose       enable verbose run-time mode\n" .
   34.77 +          " -h,--help          print out this usage page\n" .
   34.78 +          " -c,--check=CHECKS  select checks to perform (default='all')\n" .
   34.79 +          " -r,--rpm=FILE      filesystem path to RPM program\n" .
   34.80 +          " -t,--tmpdir=PATH   filesystem path to temporary directory\n" .
   34.81 +          " -V,--version       print program version\n";
   34.82 +    exit(0);
   34.83 +}
   34.84 +if ($version) {
   34.85 +    print "OpenPKG $progname $progvers\n";
   34.86 +    exit(0);
   34.87 +}
   34.88 +
   34.89 +#   verbose message printing
   34.90 +sub msg_verbose {
   34.91 +    my ($msg) = @_;
   34.92 +    print STDERR "$msg\n" if ($verbose);
   34.93 +}
   34.94 +
   34.95 +#   warning message printing
   34.96 +sub msg_warning {
   34.97 +    my ($msg) = @_;
   34.98 +    print STDERR "$progname:WARNING: $msg\n";
   34.99 +}
  34.100 +
  34.101 +#   error message printing
  34.102 +sub msg_error {
  34.103 +    my ($msg) = @_;
  34.104 +    print STDERR "$progname:ERROR: $msg\n";
  34.105 +}
  34.106 +
  34.107 +#   determine check list
  34.108 +my @check_list = (qw(
  34.109 +    blank
  34.110 +    comment
  34.111 +    ident
  34.112 +));
  34.113 +my @checks = ();
  34.114 +if ($check eq 'all') {
  34.115 +    @checks = @check_list;
  34.116 +}
  34.117 +else {
  34.118 +    foreach my $c (split(/,/, $check)) {
  34.119 +        if (not grep(/^$c$/, @check_list)) {
  34.120 +            die "invalid check \"$c\"";
  34.121 +        }
  34.122 +        push(@checks, $c);
  34.123 +    }
  34.124 +}
  34.125 +
  34.126 +#   global return code
  34.127 +$main::GRC = 0;
  34.128 +
  34.129 +#   environment preparation
  34.130 +system("rm -rf $tmpdir");
  34.131 +system("mkdir -p $tmpdir");
  34.132 +
  34.133 +#   iterate over all fsl. files
  34.134 +foreach my $filename (@ARGV) {
  34.135 +    my $io = new IO::File "<$filename"
  34.136 +        or die "unable to open file \"$filename\" for reading";
  34.137 +    my $spec; { local $/ = undef; $spec = <$io>; }
  34.138 +    $io->close;
  34.139 +    foreach my $check (@checks) {
  34.140 +        eval "\&check_$check(\$filename, \$spec);";
  34.141 +    }
  34.142 +}
  34.143 +
  34.144 +#   environment cleanup
  34.145 +system("rm -rf $tmpdir");
  34.146 +
  34.147 +#   die gracefully
  34.148 +exit($main::GRC);
  34.149 +
  34.150 +##  _________________________________________________________________
  34.151 +##
  34.152 +##  COMMON SUBROUTINES
  34.153 +##  _________________________________________________________________
  34.154 +##
  34.155 +
  34.156 +sub lines {
  34.157 +    my ($txt) = @_;
  34.158 +    my $l = 0;
  34.159 +    $txt =~ s|\n|$l++, ''|sge;
  34.160 +    return $l;
  34.161 +}
  34.162 +
  34.163 +sub lint_message {
  34.164 +    my ($type, $file, $done, $this, $msg) = @_;
  34.165 +    if (defined($done) and defined($this)) {
  34.166 +        my $start = &lines($done) + 1;
  34.167 +        my $end = $start + &lines($this);
  34.168 +        my $pos = $start;
  34.169 +        $pos .= "-". $end if ($end > $start);
  34.170 +        printf("%s:%s: %s:%s: %s\n", $progname, $type, $file, $pos, $msg);
  34.171 +    }
  34.172 +    else {
  34.173 +        printf("%s:%s: %s: %s\n", $progname, $type, $file, $msg);
  34.174 +    }
  34.175 +}
  34.176 +
  34.177 +sub lint_warning {
  34.178 +    my ($file, $done, $this, $msg) = @_;
  34.179 +    &lint_message("WARNING", $file, $done, $this, $msg);
  34.180 +    $main::GRC = 1 if ($main::GRC < 1);
  34.181 +}
  34.182 +
  34.183 +sub lint_error {
  34.184 +    my ($file, $done, $this, $msg) = @_;
  34.185 +    &lint_message("ERROR", $file, $done, $this, $msg);
  34.186 +    $main::GRC = 2 if ($main::GRC < 2);
  34.187 +}
  34.188 +
  34.189 +##  _________________________________________________________________
  34.190 +##
  34.191 +##  CHECK "blank": whitespace and blank lines
  34.192 +##  _________________________________________________________________
  34.193 +##
  34.194 +
  34.195 +sub check_blank {
  34.196 +    my ($file, $spec) = @_;
  34.197 +
  34.198 +    #   check for CR-LF combination
  34.199 +    my $done = ''; my $this = ''; my $todo = $spec;
  34.200 +    while ($todo =~ m/\r\n/s) {
  34.201 +        $done .= $`; $this = $&; $todo = $';
  34.202 +        &lint_warning($file, $done, $this, "carriage-return (CR, 0x0d) line-feed (NL, 0x0a) combination (expected just line-feed)");
  34.203 +        $done .= $this;
  34.204 +    }
  34.205 +
  34.206 +    #   check for multiple blank lines
  34.207 +    $done = ''; $this = ''; $todo = $spec;
  34.208 +    while ($todo =~ m/(\r?\n[ \t]*){3,}/s) {
  34.209 +        $done .= $`; $this = $&; $todo = $';
  34.210 +        &lint_warning($file, $done, $this, "multiple subsequent blank lines (expected single blank line)");
  34.211 +        $done .= $this;
  34.212 +    }
  34.213 +
  34.214 +    #   check for trailing whitespaces
  34.215 +    $done = ''; $this = ''; $todo = $spec;
  34.216 +    while ($todo =~ m/[ \t]+\r?\n/s) {
  34.217 +        $done .= $`; $this = $&; $todo = $';
  34.218 +        if ($done eq '' or $done =~ m|\n$|s) {
  34.219 +            &lint_warning($file, $done, $this, "whitespace on empty line (expected none)");
  34.220 +        }
  34.221 +        else {
  34.222 +            &lint_warning($file, $done, $this, "trailing whitespace (expected none)");
  34.223 +        }
  34.224 +        $done .= $this;
  34.225 +    }
  34.226 +
  34.227 +    #   check for bogus line continuations
  34.228 +    $done = ''; $this = ''; $todo = $spec;
  34.229 +    while ($todo =~ m/\\[ \t]*\r?\n(?=[ \t]*\r?\n)/s) {
  34.230 +        $done .= $`; $this = $&; $todo = $';
  34.231 +        &lint_warning($file, $done, $this, "bogus line continuation for following empty line (expect no line continuation)");
  34.232 +        $done .= $this;
  34.233 +    }
  34.234 +
  34.235 +    #   check for leading whitespaces before line continuations
  34.236 +    $done = ''; $this = ''; $todo = $spec;
  34.237 +    while ($todo =~ m/[ \t]{2,}\\[ \t]*\r?\n/s) {
  34.238 +        $done .= $`; $this = $&; $todo = $';
  34.239 +        &lint_warning($file, $done, $this, "multiple leading whitespace before line continuation (expected just a single space)");
  34.240 +        $done .= $this;
  34.241 +    }
  34.242 +
  34.243 +    #   check for leading tabs
  34.244 +    $done = ''; $this = ''; $todo = $spec;
  34.245 +    while ($todo =~ m/^ *\t+ *[^ \t]/m) {
  34.246 +        $done .= $`; $this = $&; $todo = $';
  34.247 +        &lint_warning($file, $done, $this, "leading tabs (expected spaces)");
  34.248 +        $done .= $this;
  34.249 +    }
  34.250 +
  34.251 +    #   check for mandatory/wished trailing blank line
  34.252 +    if ($spec !~ m|\n\n$|) {
  34.253 +        &lint_warning($file, $done, "", "mandatory/wished trailing blank line missing (expected one)");
  34.254 +    }
  34.255 +}
  34.256 +
  34.257 +##  _________________________________________________________________
  34.258 +##
  34.259 +##  CHECK "comment": sharp-comments
  34.260 +##  _________________________________________________________________
  34.261 +##
  34.262 +
  34.263 +sub check_comment {
  34.264 +    my ($file, $spec) = @_;
  34.265 +    my ($pkg);
  34.266 +
  34.267 +    #   determine package name
  34.268 +    $pkg = $file;
  34.269 +    $pkg =~ s|^.+/||;
  34.270 +    $pkg =~ s|^fsl\.||;
  34.271 +
  34.272 +    #   check comment header
  34.273 +    my $re = "";
  34.274 +    $re .= "##\\n##  fsl.$pkg -- OSSP fsl configuration\\n##\\n\\n";
  34.275 +    if ($spec !~ m|^$re|os) {
  34.276 +        &lint_warning($file, "", "", "invalid comment header (expected $re)");
  34.277 +    }
  34.278 +
  34.279 +    #   check for comment indentation
  34.280 +    my $done .= $`; my $this = $&; my $todo = $';
  34.281 +    while ($todo =~ m/^([ \t]*)(#+)([ \t]*)(.*?)$/m) {
  34.282 +        $done .= $`; $this = $&; $todo = $';
  34.283 +        my ($lead, $sharp, $pad, $text) = ($1, $2, $3, $4);
  34.284 +        if (length($lead) % 2 != 0) {
  34.285 +            &lint_warning($file, $done, $this, "incorrect comment indentation (expected a multiple of 2 spaces)");
  34.286 +        }
  34.287 +        if (length($lead) > 1 && length($sharp) > 1) {
  34.288 +            &lint_warning($file, $done, $this, "indented comment has introduced with multiple sharps (expected single sharp character)");
  34.289 +        }
  34.290 +        if (length($pad.$text) > 0 && length($sharp.$pad) % 4 != 0) {
  34.291 +            &lint_warning($file, $done, $this, "incorrect comment text padding (expected a multiple of 4 sharps or spaces)");
  34.292 +        }
  34.293 +        if (length($pad) == 0 && length($text) > 0) {
  34.294 +            &lint_warning($file, $done, $this, "missing leading space before comment text (expected padding spaces)");
  34.295 +        }
  34.296 +        if (length($pad) > 0 && length($text) == 0) {
  34.297 +            &lint_warning($file, $done, $this, "empty comment text (expected a reasonable text)");
  34.298 +        }
  34.299 +        $done .= $this;
  34.300 +    }
  34.301 +}
  34.302 +
  34.303 +##  _________________________________________________________________
  34.304 +##
  34.305 +##  CHECK "ident"
  34.306 +##  _________________________________________________________________
  34.307 +##
  34.308 +
  34.309 +sub check_ident {
  34.310 +    my ($file, $spec) = @_;
  34.311 +    my ($pkg, $section);
  34.312 +
  34.313 +    #   determine package name
  34.314 +    $pkg = $file;
  34.315 +    $pkg =~ s|^.+/||;
  34.316 +    $pkg =~ s|^fsl\.||;
  34.317 +
  34.318 +    #   check sections with ident/facility regex
  34.319 +    my $done .= ""; my $this = ""; my $todo = $spec;
  34.320 +    while ($todo =~ m:\n(\w+)(\s+)(\S+)/(\S+)(\s+)q\{(.*?)\};:s) {
  34.321 +        $done .= $`; $this = $&; $todo = $';
  34.322 +        my ($section, $ws1, $ident, $facility, $ws2, $body) = ($1, $2, $3, $4, $5, $6);
  34.323 +
  34.324 +        if ($pkg eq "fsl") {
  34.325 +            #   enforce default section for fsl
  34.326 +            if ($section ne "default") {
  34.327 +                &lint_warning($file, "", "", "section \"$section\" not allowed for package $pkg (expected default)");
  34.328 +            }
  34.329 +        }
  34.330 +        else {
  34.331 +            #   enforce ident section for any package othen than fsl
  34.332 +            if ($section ne "ident") {
  34.333 +                &lint_warning($file, "", "", "section \"$section\" not allowed for package $pkg (expected ident)");
  34.334 +            }
  34.335 +
  34.336 +            #   ident and facility wildcard-only would be a catch-all
  34.337 +            if ($ident =~ m/^[(]?\.[\+\*][)]?$/ and $facility =~ m/^[(]?\.[\+\*][)]?$/) {
  34.338 +                &lint_warning($file, "", "", "wildcard not allowed for both ident and facility (found $ident/$facility");
  34.339 +            }
  34.340 +        }
  34.341 +
  34.342 +        #   enforce a single space
  34.343 +        if (length($ws1) != 1) {
  34.344 +            &lint_warning($file, "", "", "whitespace count wrong between section ($section) and ident ($ident)");
  34.345 +        }
  34.346 +
  34.347 +        #   enforce a single space
  34.348 +        if (length($ws2) != 1) {
  34.349 +            &lint_warning($file, "", "", "whitespace count wrong between facility ($facility) and end of line");
  34.350 +        }
  34.351 +
  34.352 +        #   ident same as facility is likely to be a typo
  34.353 +        if ($ident eq $facility) {
  34.354 +            &lint_warning($file, "", "", "unusual constellation ident equal to facility (found $ident/$facility");
  34.355 +        }
  34.356 +
  34.357 +        #   FIXME MTAs hardcoded here for /mail
  34.358 +        if ($facility eq "mail" and $pkg !~ m/^(sendmail|ssmtp|postfix|exim)$/) {
  34.359 +            &lint_warning($file, "", "", "only MTAs may match facility mail");
  34.360 +        }
  34.361 +
  34.362 +        #   FIXME inn hardcoded here for /news
  34.363 +        if ($facility eq "news" and $pkg !~ m/^(inn)$/) {
  34.364 +            &lint_warning($file, "", "", "only inn may match facility news");
  34.365 +        }
  34.366 +
  34.367 +        #   check prefix channel
  34.368 +        if ($body =~ m/\n([ ]*)prefix(\s*?)\((.*?)\)/s) {
  34.369 +            my ($ws1, $ws2, $options) = ($1, $2, $3);
  34.370 +
  34.371 +            #   enforce eight spaces
  34.372 +            if (length($ws1) != 4) {
  34.373 +                &lint_warning($file, "", "", "prefix channel whitespace count at start of line");
  34.374 +            }
  34.375 +
  34.376 +            #   enforce zero spaces
  34.377 +            if (length($ws2) != 0) {
  34.378 +                &lint_warning($file, "", "", "whitespace not allowed between prefix channel and round open bracket");
  34.379 +            }
  34.380 +
  34.381 +            #   enforce prefix options in prefix channel
  34.382 +            if ($options !~ m/\sprefix="%b %d %H:%M:%S %N (<%L> )?\$1(\[%P\])?: "/) {
  34.383 +                &lint_warning($file, "", "", "prefix option in prefix channel invalid or missing");
  34.384 +            }
  34.385 +            $options = $';
  34.386 +            $options =~ s/,//;
  34.387 +
  34.388 +            #   detect superflous options in prefix channel
  34.389 +            if ($options =~ m/\S+/s) {
  34.390 +                $options =~ s/\n/\\n/;
  34.391 +                &lint_warning($file, "", "", "superflous option in prefix channel unseparated line detected: $options");
  34.392 +            }
  34.393 +        }
  34.394 +        else {
  34.395 +            &lint_warning($file, "", "", "prefix channel missing");
  34.396 +        }
  34.397 +
  34.398 +        #   check path branch
  34.399 +        if ($body !~ m/\n([ ]*)->(\s*?)\{(.*)\}\n/s) {
  34.400 +            &lint_warning($file, "", "", "no path branch found");
  34.401 +            return;
  34.402 +        }
  34.403 +        my ($ws1, $ws2, $body) = ($1, $2, $3); #FIXME check ws1/ws2
  34.404 +
  34.405 +        #   check path channel
  34.406 +        while ($body =~ m/\n([ ]*)(\w+):(\s+?)file(\s*?)\((.*?)\);/s) {
  34.407 +            my ($ws1, $level, $ws2, $ws3, $options) = ($1, $2, $3, $4, $5);
  34.408 +            $body = $';
  34.409 +
  34.410 +            #   enforce eight spaces
  34.411 +            if (length($ws1) != 8) {
  34.412 +                &lint_warning($file, "", "", "path channel whitespace count at start of line");
  34.413 +            }
  34.414 +
  34.415 +            #   enforce spaces
  34.416 +            if (length($ws2) < 1) {
  34.417 +                &lint_warning($file, "", "", "whitespace required between level and file");
  34.418 +            }
  34.419 +
  34.420 +            #   enforce zero spaces
  34.421 +            if (length($ws3) != 0) {
  34.422 +                &lint_warning($file, "", "", "path channel whitespace not allowed between file channel and round open bracket");
  34.423 +            }
  34.424 +
  34.425 +            #   check for legal l2 level
  34.426 +            if ($level !~ m/^(panic|critical|error|warning|notice|info|trace|debug)$/) {
  34.427 +                &lint_warning($file, "", "", "illegal l2 level $level detected");
  34.428 +            }
  34.429 +
  34.430 +            #   enforce file option in file channel
  34.431 +            if ($options !~ m;path="\@l_prefix\@/var/$pkg/(log\S+|$pkg\.log)";) {
  34.432 +                &lint_warning($file, "", "", "path option in file channel invalid or missing");
  34.433 +            }
  34.434 +            $options = $';
  34.435 +            $options =~ s/,//;
  34.436 +
  34.437 +            #   enforce perm option in file channel
  34.438 +            if ($options !~ m;perm=0[0-7]{3};) {
  34.439 +                &lint_warning($file, "", "", "perm option in file channel invalid or missing");
  34.440 +            }
  34.441 +            $options = $';
  34.442 +            $options =~ s/,//;
  34.443 +
  34.444 +            #   detect superflous options in file channel
  34.445 +            if ($options =~ m/\S+/s) {
  34.446 +                $options =~ s/\n/\\n/;
  34.447 +                &lint_warning($file, "", "", "superflous option in prefix channel detected: $options");
  34.448 +            }
  34.449 +        }
  34.450 +
  34.451 +        #   check path channel
  34.452 +        if ($body =~ m/\n([ ]*)(\w+):(\s*?)file(\s*?)\((.*?)\)/s) {
  34.453 +            my ($ws1, $level, $ws2, $ws3, $options) = ($1, $2, $3, $4, $5);
  34.454 +
  34.455 +            #   enforce eight spaces
  34.456 +            if (length($ws1) != 8) {
  34.457 +                &lint_warning($file, "", "", "path channel whitespace count at start of unseparated line");
  34.458 +            }
  34.459 +
  34.460 +            #   enforce spaces
  34.461 +            if (length($ws2) < 1) {
  34.462 +                &lint_warning($file, "", "", "path channel whitespace required between level and file of unseparated line");
  34.463 +            }
  34.464 +
  34.465 +            #   enforce zero spaces
  34.466 +            if (length($ws3) != 0) {
  34.467 +                &lint_warning($file, "", "", "whitespace not allowed between file channel and round open bracket");
  34.468 +            }
  34.469 +
  34.470 +            #   check for legal l2 level
  34.471 +            if ($level !~ m/^(panic|critical|error|warning|notice|info|trace|debug)$/) {
  34.472 +                &lint_warning($file, "", "", "illegal l2 level $level detected on unseparated line");
  34.473 +            }
  34.474 +
  34.475 +            #   enforce file option in file channel
  34.476 +            if ($options !~ m;path="\@l_prefix\@/var/$pkg/(log\S+|$pkg\.log)";) {
  34.477 +                &lint_warning($file, "", "", "XXX path option in file channel invalid or missing on unseparated line");
  34.478 +            }
  34.479 +            $options = $';
  34.480 +            $options =~ s/,//;
  34.481 +
  34.482 +            #   enforce perm option in file channel
  34.483 +            if ($options !~ m;perm=0[0-7]{3};) {
  34.484 +                &lint_warning($file, "", "", "perm option in file channel invalid or missing on unseparated line");
  34.485 +            }
  34.486 +
  34.487 +            $options = $';
  34.488 +            $options =~ s/, jitter=[0-9]+//;
  34.489 +            $options =~ s/, monitor=[0-9]+//;
  34.490 +            $options =~ s/,//;
  34.491 +
  34.492 +            #   detect superflous options in file channel
  34.493 +            if ($options =~ m/\S+/s) {
  34.494 +                $options =~ s/\n/\\n/;
  34.495 +                &lint_warning($file, "", "", "superflous option in file channel unseparated line detected: $options");
  34.496 +            }
  34.497 +        }
  34.498 +        else {
  34.499 +            &lint_warning($file, "", "", "file channel missing");
  34.500 +        }
  34.501 +
  34.502 +        $done .= $this;
  34.503 +    }
  34.504 +    return;
  34.505 +}
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/openpkg/lint-rc.pl	Tue Jul 31 12:23:42 2012 +0200
    35.3 @@ -0,0 +1,517 @@
    35.4 +##
    35.5 +##  lint-rc.pl -- OpenPKG rc.* File Checker
    35.6 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    35.7 +##
    35.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    35.9 +##  All rights reserved. Licenses which grant limited permission to use,
   35.10 +##  copy, modify and distribute this software are available from the
   35.11 +##  OpenPKG GmbH.
   35.12 +##
   35.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   35.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   35.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   35.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   35.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   35.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   35.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   35.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   35.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   35.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   35.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   35.24 +##  SUCH DAMAGE.
   35.25 +##
   35.26 +
   35.27 +#   Perl run-time requirement
   35.28 +require 5;
   35.29 +BEGIN {
   35.30 +    eval "use Getopt::Long; use IO;";
   35.31 +    if ($@) {
   35.32 +        print STDERR
   35.33 +            "lint-rc: ERROR: This command requires a full-size Perl installation!\n" .
   35.34 +            "lint-rc: HINT:  Install OpenPKG \"perl\" package to use this command.\n";
   35.35 +        exit(1);
   35.36 +    }
   35.37 +}
   35.38 +
   35.39 +#   OpenPKG instance prefix
   35.40 +my $my_prefix = $ENV{'OPENPKG_PREFIX'};
   35.41 +delete $ENV{'OPENPKG_PREFIX'};
   35.42 +
   35.43 +#   program information
   35.44 +my $progname = "lint-rc";
   35.45 +my $progvers = "1.0.0";
   35.46 +
   35.47 +#   parameters (defaults)
   35.48 +my $version  = 0;
   35.49 +my $verbose  = 0;
   35.50 +my $help     = 0;
   35.51 +my $check    = 'all';
   35.52 +my $tmpdir   = ($ENV{TMPDIR} || $ENV{TEMPDIR} || "/tmp") . "/$progname";
   35.53 +my $rpm      = "$my_prefix/bin/openpkg rpm";
   35.54 +
   35.55 +#   exception handling support
   35.56 +$SIG{__DIE__} = sub {
   35.57 +    my ($err) = @_;
   35.58 +    $err =~ s|\s+at\s+.*||s if (not $verbose);
   35.59 +    print STDERR "$progname:ERROR: $err ". ($! ? "($!)" : "") . "\n";
   35.60 +    exit(1);
   35.61 +};
   35.62 +
   35.63 +#   command line parsing
   35.64 +Getopt::Long::Configure("bundling");
   35.65 +my $result = GetOptions(
   35.66 +    'V|version'     => \$version,
   35.67 +    'v|verbose'     => \$verbose,
   35.68 +    'h|help'        => \$help,
   35.69 +    'c|check=s'     => \$check,
   35.70 +    't|tmpdir=s'    => \$tmpdir,
   35.71 +    'r|rpm=s'       => \$rpm,
   35.72 +) || die "option parsing failed";
   35.73 +if ($help) {
   35.74 +    print "Usage: $progname [options] [RPMFILE ...]\n" .
   35.75 +          "Available options:\n" .
   35.76 +          " -v,--verbose       enable verbose run-time mode\n" .
   35.77 +          " -h,--help          print out this usage page\n" .
   35.78 +          " -c,--check=CHECKS  select checks to perform (default='all')\n" .
   35.79 +          " -r,--rpm=FILE      filesystem path to RPM program\n" .
   35.80 +          " -t,--tmpdir=PATH   filesystem path to temporary directory\n" .
   35.81 +          " -V,--version       print program version\n";
   35.82 +    exit(0);
   35.83 +}
   35.84 +if ($version) {
   35.85 +    print "OpenPKG $progname $progvers\n";
   35.86 +    exit(0);
   35.87 +}
   35.88 +
   35.89 +#   verbose message printing
   35.90 +sub msg_verbose {
   35.91 +    my ($msg) = @_;
   35.92 +    print STDERR "$msg\n" if ($verbose);
   35.93 +}
   35.94 +
   35.95 +#   warning message printing
   35.96 +sub msg_warning {
   35.97 +    my ($msg) = @_;
   35.98 +    print STDERR "$progname:WARNING: $msg\n";
   35.99 +}
  35.100 +
  35.101 +#   error message printing
  35.102 +sub msg_error {
  35.103 +    my ($msg) = @_;
  35.104 +    print STDERR "$progname:ERROR: $msg\n";
  35.105 +}
  35.106 +
  35.107 +#   determine check list
  35.108 +my @check_list = (qw(
  35.109 +    blank
  35.110 +    comment
  35.111 +    section
  35.112 +    script
  35.113 +    global
  35.114 +));
  35.115 +my @checks = ();
  35.116 +if ($check eq 'all') {
  35.117 +    @checks = @check_list;
  35.118 +}
  35.119 +else {
  35.120 +    foreach my $c (split(/,/, $check)) {
  35.121 +        if (not grep(/^$c$/, @check_list)) {
  35.122 +            die "invalid check \"$c\"";
  35.123 +        }
  35.124 +        push(@checks, $c);
  35.125 +    }
  35.126 +}
  35.127 +
  35.128 +#   global return code
  35.129 +$main::GRC = 0;
  35.130 +
  35.131 +#   environment preparation
  35.132 +system("rm -rf $tmpdir");
  35.133 +system("mkdir -p $tmpdir");
  35.134 +
  35.135 +#   iterate over all rc. files
  35.136 +foreach my $filename (@ARGV) {
  35.137 +    my $io = new IO::File "<$filename"
  35.138 +        or die "unable to open file \"$filename\" for reading";
  35.139 +    my $spec; { local $/ = undef; $spec = <$io>; }
  35.140 +    $io->close;
  35.141 +    foreach my $check (@checks) {
  35.142 +        &msg_verbose("$check in $filename");
  35.143 +        eval "\&check_$check(\$filename, \$spec);";
  35.144 +    }
  35.145 +}
  35.146 +
  35.147 +#   environment cleanup
  35.148 +system("rm -rf $tmpdir");
  35.149 +
  35.150 +#   die gracefully
  35.151 +exit($main::GRC);
  35.152 +
  35.153 +##  _________________________________________________________________
  35.154 +##
  35.155 +##  COMMON SUBROUTINES
  35.156 +##  _________________________________________________________________
  35.157 +##
  35.158 +
  35.159 +sub lines {
  35.160 +    my ($txt) = @_;
  35.161 +    my $l = 0;
  35.162 +    $txt =~ s|\n|$l++, ''|sge;
  35.163 +    return $l;
  35.164 +}
  35.165 +
  35.166 +sub lint_message {
  35.167 +    my ($type, $file, $done, $this, $msg) = @_;
  35.168 +    if (defined($done) and defined($this)) {
  35.169 +        my $start = &lines($done) + 1;
  35.170 +        my $end = $start + &lines($this);
  35.171 +        my $pos = $start;
  35.172 +        $pos .= "-". $end if ($end > $start);
  35.173 +        printf("%s:%s: %s:%s: %s\n", $progname, $type, $file, $pos, $msg);
  35.174 +    }
  35.175 +    else {
  35.176 +        printf("%s:%s: %s: %s\n", $progname, $type, $file, $msg);
  35.177 +    }
  35.178 +}
  35.179 +
  35.180 +sub lint_warning {
  35.181 +    my ($file, $done, $this, $msg) = @_;
  35.182 +    &lint_message("WARNING", $file, $done, $this, $msg);
  35.183 +    $main::GRC = 1 if ($main::GRC < 1);
  35.184 +}
  35.185 +
  35.186 +sub lint_error {
  35.187 +    my ($file, $done, $this, $msg) = @_;
  35.188 +    &lint_message("ERROR", $file, $done, $this, $msg);
  35.189 +    $main::GRC = 2 if ($main::GRC < 2);
  35.190 +}
  35.191 +
  35.192 +##  _________________________________________________________________
  35.193 +##
  35.194 +##  CHECK "blank": whitespace and blank lines
  35.195 +##  _________________________________________________________________
  35.196 +##
  35.197 +
  35.198 +sub check_blank {
  35.199 +    my ($file, $spec) = @_;
  35.200 +
  35.201 +    #   check for CR-LF combination
  35.202 +    my $done = ''; my $this = ''; my $todo = $spec;
  35.203 +    while ($todo =~ m/\r\n/s) {
  35.204 +        $done .= $`; $this = $&; $todo = $';
  35.205 +        &lint_warning($file, $done, $this, "carriage-return (CR, 0x0d) line-feed (NL, 0x0a) combination (expected just line-feed)");
  35.206 +        $done .= $this;
  35.207 +    }
  35.208 +
  35.209 +    #   check for multiple blank lines
  35.210 +    $done = ''; $this = ''; $todo = $spec;
  35.211 +    while ($todo =~ m/(\r?\n[ \t]*){3,}/s) {
  35.212 +        $done .= $`; $this = $&; $todo = $';
  35.213 +        &lint_warning($file, $done, $this, "multiple subsequent blank lines (expected single blank line)");
  35.214 +        $done .= $this;
  35.215 +    }
  35.216 +
  35.217 +    #   check for trailing whitespaces
  35.218 +    $done = ''; $this = ''; $todo = $spec;
  35.219 +    while ($todo =~ m/[ \t]+\r?\n/s) {
  35.220 +        $done .= $`; $this = $&; $todo = $';
  35.221 +        if ($done eq '' or $done =~ m|\n$|s) {
  35.222 +            &lint_warning($file, $done, $this, "whitespace on empty line (expected none)");
  35.223 +        }
  35.224 +        else {
  35.225 +            &lint_warning($file, $done, $this, "trailing whitespace (expected none)");
  35.226 +        }
  35.227 +        $done .= $this;
  35.228 +    }
  35.229 +
  35.230 +    #   check for bogus line continuations
  35.231 +    $done = ''; $this = ''; $todo = $spec;
  35.232 +    while ($todo =~ m/\\[ \t]*\r?\n(?=[ \t]*\r?\n)/s) {
  35.233 +        $done .= $`; $this = $&; $todo = $';
  35.234 +        &lint_warning($file, $done, $this, "bogus line continuation for following empty line (expect no line continuation)");
  35.235 +        $done .= $this;
  35.236 +    }
  35.237 +
  35.238 +    #   check for leading whitespaces before line continuations
  35.239 +    $done = ''; $this = ''; $todo = $spec;
  35.240 +    while ($todo =~ m/[ \t]{2,}\\[ \t]*\r?\n/s) {
  35.241 +        $done .= $`; $this = $&; $todo = $';
  35.242 +        &lint_warning($file, $done, $this, "multiple leading whitespace before line continuation (expected just a single space)");
  35.243 +        $done .= $this;
  35.244 +    }
  35.245 +
  35.246 +    #   check for leading tabs
  35.247 +    $done = ''; $this = ''; $todo = $spec;
  35.248 +    while ($todo =~ m/^ *\t+ *[^ \t]/m) {
  35.249 +        $done .= $`; $this = $&; $todo = $';
  35.250 +        &lint_warning($file, $done, $this, "leading tabs (expected spaces)");
  35.251 +        $done .= $this;
  35.252 +    }
  35.253 +
  35.254 +    #   check for mandatory/wished trailing blank line
  35.255 +    if ($spec !~ m|\n\n$|s) {
  35.256 +        &lint_warning($file, $done, "", "mandatory/wished trailing blank line at end of file missing (expected one)");
  35.257 +    }
  35.258 +}
  35.259 +
  35.260 +##  _________________________________________________________________
  35.261 +##
  35.262 +##  CHECK "comment": sharp-comments
  35.263 +##  _________________________________________________________________
  35.264 +##
  35.265 +
  35.266 +sub check_comment {
  35.267 +    my ($file, $spec) = @_;
  35.268 +    my ($pkg);
  35.269 +
  35.270 +    #   determine package name
  35.271 +    $pkg = $file;
  35.272 +    $pkg =~ s|^.+/||;
  35.273 +    $pkg =~ s|^rc\.||;
  35.274 +
  35.275 +    #   check "shebang" header
  35.276 +    my $re = "";
  35.277 +    $re .= "#!\@l_prefix\@/bin/openpkg rc\\n";
  35.278 +    if ($spec !~ m|^$re|s) {
  35.279 +        &lint_warning($file, "", "", "invalid shebang header (expected $re)");
  35.280 +    }
  35.281 +
  35.282 +    #   check comment header
  35.283 +    my $re = "";
  35.284 +    $re .= ".*?\\n##\\n##  rc.$pkg -- Run-Commands\\n##\\n\\n";
  35.285 +    if ($pkg ne "openpkg" and $spec !~ m|^$re|s) {
  35.286 +        &lint_warning($file, "", "", "invalid comment header (expected $re)");
  35.287 +    }
  35.288 +
  35.289 +    #   check for comment indentation
  35.290 +    my $done .= $`; my $this = $&; my $todo = $';
  35.291 +    while ($todo =~ m/^([ \t]*)(#+)([ \t]*)(.*?)$/m) {
  35.292 +        $done .= $`; $this = $&; $todo = $';
  35.293 +        my ($lead, $sharp, $pad, $text) = ($1, $2, $3, $4);
  35.294 +        if (length($lead) % 2 != 0) {
  35.295 +            &lint_warning($file, $done, $this, "incorrect comment indentation (expected a multiple of 2 spaces)");
  35.296 +        }
  35.297 +        if (length($lead) > 1 && length($sharp) > 1) {
  35.298 +            &lint_warning($file, $done, $this, "indented comment has introduced with multiple sharps (expected single sharp character)");
  35.299 +        }
  35.300 +        if (length($pad.$text) > 0 && length($sharp.$pad) % 4 != 0) {
  35.301 +            &lint_warning($file, $done, $this, "incorrect comment text padding (expected a multiple of 4 sharps or spaces)");
  35.302 +        }
  35.303 +        if (length($pad) == 0 && length($text) > 0) {
  35.304 +            &lint_warning($file, $done, $this, "missing leading space before comment text (expected padding spaces)");
  35.305 +        }
  35.306 +        if (length($pad) > 0 && length($text) == 0) {
  35.307 +            &lint_warning($file, $done, $this, "empty comment text (expected a reasonable text)");
  35.308 +        }
  35.309 +        $done .= $this;
  35.310 +    }
  35.311 +}
  35.312 +
  35.313 +##  _________________________________________________________________
  35.314 +##
  35.315 +##  CHECK "section": run command sections
  35.316 +##  _________________________________________________________________
  35.317 +##
  35.318 +
  35.319 +sub check_section {
  35.320 +    my ($file, $spec) = @_;
  35.321 +
  35.322 +    my $require = qq{
  35.323 +        (%config,)?
  35.324 +        (%common,)?
  35.325 +        (%status,)?
  35.326 +        (%info,)?
  35.327 +        (%start,)?
  35.328 +        (%stop,)?
  35.329 +        (%restart,)?
  35.330 +        (%reload,)?
  35.331 +        (%quarterly,)?
  35.332 +        (%hourly,)?
  35.333 +        (%daily,)?
  35.334 +        (%weekly,)?
  35.335 +        (%monthly,)?
  35.336 +        (%env,)?
  35.337 +    };
  35.338 +
  35.339 +    #   check for order of headers
  35.340 +    my $sections = "";
  35.341 +    my $done = ''; my $this = ''; my $todo = $spec;
  35.342 +    while ($todo =~ m/^(\S+:|%\S+).*$/m) {
  35.343 +        $done .= $`; $this = $&; $todo = $';
  35.344 +        my $section = $1;
  35.345 +        $sections .= "$section,";
  35.346 +        $done .= $this;
  35.347 +    }
  35.348 +    my $regex = $require;
  35.349 +    $regex =~ s|\s+||sg;
  35.350 +    if ($sections !~ m/^$regex$/s) {
  35.351 +        $regex =~ s|,| |sg;
  35.352 +        &lint_error($file, undef, undef, "invalid run command section order (expected \"$regex\")");
  35.353 +    }
  35.354 +}
  35.355 +
  35.356 +##  _________________________________________________________________
  35.357 +##
  35.358 +##  CHECK "script": shell scripts
  35.359 +##  _________________________________________________________________
  35.360 +##
  35.361 +
  35.362 +sub check_script {
  35.363 +    my ($file, $spec) = @_;
  35.364 +
  35.365 +    my $done = ''; my $this = ''; my $todo = $spec;
  35.366 +    while ($todo =~ m/(\%(?:config|info|common|status|start|stop|restart|reload|quarterly|hourly|daily|weekly|env))([^\n]*)\n(.*?\n)(?=\%(?:config|info|common|status|start|stop|restart|reload|quarterly|hourly|daily|weekly|env)|$)/s) {
  35.367 +        $done .= $`; $this = $&; $todo = $';
  35.368 +        my ($section, $args, $script) = ($1, $2, $3);
  35.369 +
  35.370 +        #   perform checks for a single script section
  35.371 +        &check_script_section($file, $done, $this, $section, $args, $script);
  35.372 +
  35.373 +        $done .= $this;
  35.374 +    }
  35.375 +}
  35.376 +
  35.377 +sub check_script_section {
  35.378 +    my ($file, $outer_done, $outer_this, $section, $args, $script) = @_;
  35.379 +    my ($done, $this, $todo);
  35.380 +    my ($pkg, $pkgu);
  35.381 +
  35.382 +    #   determine package name
  35.383 +    $pkg = $file;
  35.384 +    $pkg =~ s|^.+/||;
  35.385 +    $pkg =~ s|^rc\.||;
  35.386 +
  35.387 +    #   determine package name, dash becomes underscore
  35.388 +    $pkgu = $pkg;
  35.389 +    $pkgu =~ s|-|_|;
  35.390 +
  35.391 +    #   remove comment contents
  35.392 +    $outer_this =~ s|^[ \t]*#[^\n]*\n||mg;
  35.393 +
  35.394 +    #   check config
  35.395 +    if ($section =~ m/^%(config)$/) {
  35.396 +
  35.397 +        #   check for badly prefixed variables
  35.398 +        $done = $outer_done; $this = ''; $todo = $outer_this;
  35.399 +        while ($todo =~ m/    [^=]+=[^\n]+/s) {
  35.400 +            $done .= $`; $this = $&; $todo = $';
  35.401 +            if ($this !~ m/    ([A-Z]+|$pkgu)_[a-z_][a-z0-9_]*=/) {
  35.402 +                &lint_warning($file, $done, $this, "section $section: badly prefixed variable");
  35.403 +            }
  35.404 +            $done .= $this;
  35.405 +        }
  35.406 +
  35.407 +        #   enforce _enable to default to openpkg_rc_def
  35.408 +        $done = $outer_done; $this = ''; $todo = $outer_this;
  35.409 +        if ( $todo =~ m/    [^=]+_enable=[^\n]+/s and $todo !~ m/    [^=]+_enable="\$openpkg_rc_def"\n+/s) {
  35.410 +            &lint_warning($file, $done, $this, "section $section: wrong default for ${pkgu}_enable");
  35.411 +        }
  35.412 +
  35.413 +        if ($pkg eq "openpkg") {
  35.414 +            #   openpkg_rc before _enable, if used, must be the first variable
  35.415 +            $done = $outer_done; $this = ''; $todo = $outer_this;
  35.416 +            if ( $todo !~ m/%config\n(    [A-Z]+_[a-z_]+=[^\n]*\n)*    openpkg_rc_def=[^\n]+?\n    openpkg_rc_all=[^\n]+?\n    [^=]+_enable=[^\n]+/s) {
  35.417 +                &lint_warning($file, $done, $this, "section $section: openpkg_rc_def, openpkg_rc_all and ${pkgu}_enable must be the first lowercase variable");
  35.418 +            }
  35.419 +        }
  35.420 +        else {
  35.421 +            #   _enable, if used, must be the first variable
  35.422 +            $done = $outer_done; $this = ''; $todo = $outer_this;
  35.423 +            if ( $todo =~ m/    [^=]+_enable=[^\n]+/s and $todo !~ m/%config\n(    [A-Z]+_[a-z_]+=[^\n]*\n)*    [^=]+_enable=[^\n]+/s) {
  35.424 +                &lint_warning($file, $done, $this, "section $section: ${pkgu}_enable must be the first lowercase variable");
  35.425 +            }
  35.426 +        }
  35.427 +    }
  35.428 +
  35.429 +    if ($section =~ m/^%(config|info|status)$/) {
  35.430 +        #   check illegal use of return/exit
  35.431 +        $done = $outer_done; $this = ''; $todo = $outer_this;
  35.432 +        if ( $todo =~ m/[^a-zA-Z0-9_](return|exit)\s/s ) {
  35.433 +            &lint_warning($file, $done, $this, "section $section: return or exit not allowed here");
  35.434 +        }
  35.435 +        return;
  35.436 +    }
  35.437 +
  35.438 +    #   check rcService only used for enable|usable|active PR#232
  35.439 +    $done = $outer_done; $this = ''; $todo = $outer_this;
  35.440 +    while ( $todo =~ m/rcService\s+\w+\s+(\w+)/s )  {
  35.441 +        $done .= $`; $this = $&; $todo = $';
  35.442 +        if ( $1 !~ m/^(enable|usable|active)$/ ) {
  35.443 +            &lint_warning($file, $done, $this, "section $section: rcService must check for (enable|usable|active) only, found check for \"$1\"");
  35.444 +        }
  35.445 +        $done .= $this;
  35.446 +    }
  35.447 +
  35.448 +    #   check rcService short circuit
  35.449 +    if ($section !~ m/^%(config|common|info)$/) {
  35.450 +        $done = $outer_done; $this = ''; $todo = $outer_this;
  35.451 +        if ( $todo !~ m/^[^\n]+\n    rcService $pkg enable yes \|\| exit 0\n/s ) {
  35.452 +            &lint_warning($file, $done, $this, "section $section: \"rcService ... enable yes\" short circuit missing");
  35.453 +        }
  35.454 +        else {
  35.455 +            #   check rcService package reference
  35.456 +            $done = $outer_done; $this = ''; $todo = $outer_this;
  35.457 +            if ( $todo !~ m/\brcService\s+$pkg\s+/s ) {
  35.458 +                &lint_warning($file, $done, $this, "section $section: rcService referencing wrong package");
  35.459 +            }
  35.460 +        }
  35.461 +    }
  35.462 +
  35.463 +    #   check shell redirections
  35.464 +    $done = $outer_done; $this = ''; $todo = $outer_this;
  35.465 +    while (   $todo =~ m/[ \t]+(\d+)?[><][ \t]+\S+/s
  35.466 +           or $todo =~ m/[ \t]+[><](\&\d+)?[ \t]+\S+/s) {
  35.467 +        $done .= $`; $this = $&; $todo = $';
  35.468 +        &lint_warning($file, $done, $this, "section $section: whitespace after shell redirection (expected none)");
  35.469 +        $done .= $this;
  35.470 +    }
  35.471 +}
  35.472 +
  35.473 +##  _________________________________________________________________
  35.474 +##
  35.475 +##  CHECK "global": globals
  35.476 +##  _________________________________________________________________
  35.477 +##
  35.478 +
  35.479 +sub check_global {
  35.480 +    my ($file, $spec) = @_;
  35.481 +
  35.482 +    #   utility function: extract a single shell command
  35.483 +    sub command_extract {
  35.484 +        my ($script) = @_;
  35.485 +        my $cmd = '';
  35.486 +        while ($script ne '') {
  35.487 +            $script =~ s/^([ \t]*'[^']*')/         $cmd .= $1, ''/se && next;
  35.488 +            $script =~ s/^([ \t]*"[^"]*")/         $cmd .= $1, ''/se && next;
  35.489 +            $script =~ s/^([ \t]*[^ \t;\)\\\r\n]+)/$cmd .= $1, ''/se && next;
  35.490 +            $script =~ s/^([ \t]*\\[ \t]*\r?\n)/   $cmd .= $1, ''/se && next;
  35.491 +            last;
  35.492 +        }
  35.493 +        return ($cmd, $script);
  35.494 +    }
  35.495 +
  35.496 +    #   check for deprecated use of opServiceEnabled function
  35.497 +    my $done = ''; my $this = ''; my $todo = $spec;
  35.498 +    while ($todo =~ m/\bopServiceEnabled\b/s) {
  35.499 +        $done .= $`; $this = $&; $todo = $';
  35.500 +        &lint_warning($file, $done, $this, "deprecated usage of opServiceEnabled macro (expected rcService ... enable yes)");
  35.501 +        $done .= $this;
  35.502 +    }
  35.503 +
  35.504 +    my $done = ''; my $this = ''; my $todo = $spec;
  35.505 +    while ($todo =~ m/shtool\s+/s) {
  35.506 +        $done .= $`; $this = $&; $todo = $';
  35.507 +        ($this, $todo) = &command_extract($this . $todo);
  35.508 +
  35.509 +        #   check for shtool options with no space before argument
  35.510 +        my $subthis = $this;
  35.511 +        $subthis =~ s/%{[^}]*?}//sg;
  35.512 +        $subthis =~ s/'[^']*'//sg;
  35.513 +        $subthis =~ s/"[^"]*"//sg;
  35.514 +        $subthis =~ s/[;|&].*$//s; # catch command termination by semicolon, pipe, or, and;
  35.515 +        if ($subthis =~ m/\s-[a-zA-Z]\S/) {
  35.516 +            &lint_warning($file, $done, $this, "found use of shtool option with space omitted before argument");
  35.517 +        }
  35.518 +        $done .= $this;
  35.519 +    }
  35.520 +}
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/openpkg/lint-rpm.pl	Tue Jul 31 12:23:42 2012 +0200
    36.3 @@ -0,0 +1,447 @@
    36.4 +##
    36.5 +##  lint-rpm.pl -- OpenPKG *.rpm File Checker
    36.6 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    36.7 +##
    36.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    36.9 +##  All rights reserved. Licenses which grant limited permission to use,
   36.10 +##  copy, modify and distribute this software are available from the
   36.11 +##  OpenPKG GmbH.
   36.12 +##
   36.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   36.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   36.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   36.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   36.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   36.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   36.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   36.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   36.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   36.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   36.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   36.24 +##  SUCH DAMAGE.
   36.25 +##
   36.26 +
   36.27 +#   Perl run-time requirement
   36.28 +require 5;
   36.29 +BEGIN {
   36.30 +    eval "use Getopt::Long; use IO;";
   36.31 +    if ($@) {
   36.32 +        print STDERR
   36.33 +            "lint-rpm: ERROR: This command requires a full-size Perl installation!\n" .
   36.34 +            "lint-rpm: HINT:  Install OpenPKG \"perl\" package to use this command.\n";
   36.35 +        exit(1);
   36.36 +    }
   36.37 +}
   36.38 +
   36.39 +#   OpenPKG instance prefix
   36.40 +my $my_prefix = $ENV{'OPENPKG_PREFIX'};
   36.41 +delete $ENV{'OPENPKG_PREFIX'};
   36.42 +
   36.43 +#   program information
   36.44 +my $progname = "lint-rpm";
   36.45 +my $progvers = "1.0.0";
   36.46 +
   36.47 +#   parameters (defaults)
   36.48 +my $version  = 0;
   36.49 +my $verbose  = 0;
   36.50 +my $help     = 0;
   36.51 +my $check    = 'all';
   36.52 +my $tmpdir   = ($ENV{TMPDIR} || $ENV{TEMPDIR} || "/tmp") . "/$progname";
   36.53 +my $rpm      = "$my_prefix/bin/openpkg rpm";
   36.54 +my $rpm2cpio = "$my_prefix/bin/openpkg rpm2cpio";
   36.55 +
   36.56 +#   exception handling support
   36.57 +$SIG{__DIE__} = sub {
   36.58 +    my ($err) = @_;
   36.59 +    $err =~ s|\s+at\s+.*||s if (not $verbose);
   36.60 +    print STDERR "$progname:ERROR: $err ". ($! ? "($!)" : "") . "\n";
   36.61 +    exit(1);
   36.62 +};
   36.63 +
   36.64 +#   command line parsing
   36.65 +Getopt::Long::Configure("bundling");
   36.66 +my $result = GetOptions(
   36.67 +    'V|version'     => \$version,
   36.68 +    'v|verbose'     => \$verbose,
   36.69 +    'h|help'        => \$help,
   36.70 +    'c|check=s'     => \$check,
   36.71 +    't|tmpdir=s'    => \$tmpdir,
   36.72 +    'r|rpm=s'       => \$rpm,
   36.73 +) || die "option parsing failed";
   36.74 +if ($help) {
   36.75 +    print "Usage: $progname [options] [RPMFILE ...]\n" .
   36.76 +          "Available options:\n" .
   36.77 +          " -v,--verbose       enable verbose run-time mode\n" .
   36.78 +          " -h,--help          print out this usage page\n" .
   36.79 +          " -c,--check=CHECKS  select checks to perform (default='all')\n" .
   36.80 +          " -r,--rpm=FILE      filesystem path to RPM program\n" .
   36.81 +          " -t,--tmpdir=PATH   filesystem path to temporary directory\n" .
   36.82 +          " -V,--version       print program version\n";
   36.83 +    exit(0);
   36.84 +}
   36.85 +if ($version) {
   36.86 +    print "OpenPKG $progname $progvers\n";
   36.87 +    exit(0);
   36.88 +}
   36.89 +
   36.90 +#   verbose message printing
   36.91 +sub msg_verbose {
   36.92 +    my ($msg) = @_;
   36.93 +    print STDERR "$msg\n" if ($verbose);
   36.94 +}
   36.95 +
   36.96 +#   warning message printing
   36.97 +sub msg_warning {
   36.98 +    my ($msg) = @_;
   36.99 +    print STDERR "$progname:WARNING: $msg\n";
  36.100 +}
  36.101 +
  36.102 +#   error message printing
  36.103 +sub msg_error {
  36.104 +    my ($msg) = @_;
  36.105 +    print STDERR "$progname:ERROR: $msg\n";
  36.106 +}
  36.107 +
  36.108 +#   determine check list
  36.109 +my @check_list = (qw(
  36.110 +    layout
  36.111 +    attrib
  36.112 +    content
  36.113 +));
  36.114 +my @checks = ();
  36.115 +if ($check eq 'all') {
  36.116 +    @checks = @check_list;
  36.117 +}
  36.118 +else {
  36.119 +    foreach my $c (split(/,/, $check)) {
  36.120 +        if (not grep(/^$c$/, @check_list)) {
  36.121 +            die "invalid check \"$c\"";
  36.122 +        }
  36.123 +        push(@checks, $c);
  36.124 +    }
  36.125 +}
  36.126 +
  36.127 +#   global return code
  36.128 +$main::GRC = 0;
  36.129 +
  36.130 +#   environment preparation
  36.131 +system("rm -rf $tmpdir");
  36.132 +system("mkdir -p $tmpdir");
  36.133 +
  36.134 +#   iterate over all .rpm files
  36.135 +foreach my $filename (@ARGV) {
  36.136 +    die "unable to open file \"$filename\" for reading"
  36.137 +        if (not -f $filename);
  36.138 +    my $info = &rpm_info($filename, \@checks);
  36.139 +    foreach my $check (@checks) {
  36.140 +        eval "\&check_$check(\$filename, \$info);";
  36.141 +    }
  36.142 +    &rpm_info_cleanup($filename, \@checks, $info);
  36.143 +}
  36.144 +
  36.145 +#   environment cleanup
  36.146 +system("rm -rf $tmpdir");
  36.147 +
  36.148 +#   die gracefully
  36.149 +exit($main::GRC);
  36.150 +
  36.151 +##  _________________________________________________________________
  36.152 +##
  36.153 +##  COMMON SUBROUTINES
  36.154 +##  _________________________________________________________________
  36.155 +##
  36.156 +
  36.157 +sub lint_message {
  36.158 +    my ($type, $file, $msg) = @_;
  36.159 +    $file =~ s|^.+?/([^/]+)$|$1|s;
  36.160 +    printf(STDERR "%s:%s: %s: %s\n", $progname, $type, $file, $msg);
  36.161 +}
  36.162 +
  36.163 +sub lint_warning {
  36.164 +    my ($file, $msg) = @_;
  36.165 +    &lint_message("WARNING", $file, $msg);
  36.166 +    $main::GRC = 1 if ($main::GRC < 1);
  36.167 +}
  36.168 +
  36.169 +sub lint_error {
  36.170 +    my ($file, $msg) = @_;
  36.171 +    &lint_message("ERROR", $file, $msg);
  36.172 +    $main::GRC = 2 if ($main::GRC < 2);
  36.173 +}
  36.174 +
  36.175 +##  _________________________________________________________________
  36.176 +##
  36.177 +##  RPM INFORMATION GATHERING
  36.178 +##  _________________________________________________________________
  36.179 +##
  36.180 +
  36.181 +sub rpm_info {
  36.182 +    my ($filename, $checks) = @_;
  36.183 +    my $info = {};
  36.184 +
  36.185 +    #   query package name
  36.186 +    &msg_verbose("++ querying RPM package name");
  36.187 +    $info->{name} = `$rpm -qp --qf '%{NAME}' $filename`;
  36.188 +
  36.189 +    #   query prefix
  36.190 +    &msg_verbose("++ querying RPM package installation prefix");
  36.191 +    $info->{prefix} = `$rpm -qp --qf '%{PREFIXES}' $filename`;
  36.192 +
  36.193 +    #   query file listing
  36.194 +    &msg_verbose("++ querying RPM package file listing");
  36.195 +    my @list = `$rpm -qplv $filename`;
  36.196 +    my @config = `$rpm -qplc $filename`;
  36.197 +
  36.198 +    #   process file listing
  36.199 +    $info->{ls} = {};
  36.200 +    foreach my $entry (@list) {
  36.201 +        if ($entry =~ m|^\(contains no files\)\s*$|s) {
  36.202 +            next;
  36.203 +        }
  36.204 +        elsif ($entry =~ m|^(\S+)\s+(\d+)\s+(\S+)\s+(\S+)\s+(\d+)\s+(.{12})\s+(.+)\s*$|s) {
  36.205 +            my ($perm, $links, $owner, $group, $size, $mtime, $path) = ($1, $2, $3, $4, $5, $6, $7);
  36.206 +            my $symlink = "";
  36.207 +            if ($path =~ m|^(\S+)\s+->\s+(\S+)$|) {
  36.208 +                ($path, $symlink) = ($1, $2);
  36.209 +            }
  36.210 +            $path =~ s|\s+$||s;
  36.211 +            my $config = 0;
  36.212 +            if (grep(m|^$path$|, @config)) {
  36.213 +                $config = 1;
  36.214 +            }
  36.215 +            $info->{ls}->{$path} = {
  36.216 +                'perm'    => $perm,
  36.217 +                'links'   => $links,
  36.218 +                'owner'   => $owner,
  36.219 +                'group'   => $group,
  36.220 +                'size'    => $size,
  36.221 +                'time'    => $mtime,
  36.222 +                'path'    => $path,
  36.223 +                'symlink' => $symlink,
  36.224 +                'config'  => $config,
  36.225 +            };
  36.226 +        }
  36.227 +        else {
  36.228 +            &lint_error($filename, "invalid file listing entry: \"$entry\"");
  36.229 +        }
  36.230 +    }
  36.231 +
  36.232 +    #   unpacking files
  36.233 +    if (grep(/^content$/, @{$checks})) {
  36.234 +        &msg_verbose("++ unpacking RPM package files");
  36.235 +        $info->{root} = "$tmpdir/root";
  36.236 +        system("mkdir -p ".$info->{root});
  36.237 +        system("$rpm2cpio $filename | (cd ".$info->{root}." && cpio -idmu 2>/dev/null)");
  36.238 +    }
  36.239 +
  36.240 +    return $info;
  36.241 +}
  36.242 +
  36.243 +sub rpm_info_cleanup {
  36.244 +    my ($filename, $checks, $info) = @_;
  36.245 +
  36.246 +    if (grep(/^content$/, @{$checks})) {
  36.247 +        system("rm -rf ".$info->{root}) if ($info->{root} =~ m/^\/.+/ and -d $info->{root});
  36.248 +    }
  36.249 +}
  36.250 +
  36.251 +##  _________________________________________________________________
  36.252 +##
  36.253 +##  CHECK "layout": file path layout
  36.254 +##  _________________________________________________________________
  36.255 +##
  36.256 +
  36.257 +sub check_layout {
  36.258 +    my ($rpm, $info) = @_;
  36.259 +
  36.260 +    #   no need to check 'openpkg' package because it
  36.261 +    #   has a hard-coded file list!
  36.262 +    return if ($rpm =~ m|^(.+?/)?openpkg-\d[^/]+$|);
  36.263 +
  36.264 +    #   check prefix
  36.265 +    if ($info->{prefix} !~ m|^/.+$|) {
  36.266 +        &lint_error($rpm, "invalid installation prefix ".$info->{prefix}.
  36.267 +                    " (expected to match \"^/.+\$\")");
  36.268 +        return;
  36.269 +    }
  36.270 +
  36.271 +    #   check top-level path (all-in-one)
  36.272 +    my @topdirs = (qw(
  36.273 +        bin cgi etc include info lib libexec
  36.274 +        local man pub sbin share usr var
  36.275 +    ));
  36.276 +    my $topdirs = "{".join(",", @topdirs)."}";
  36.277 +    if (not keys(%{$info->{ls}})) {
  36.278 +        &lint_error($rpm, "invalid empty package (expected at least one file)");
  36.279 +        return;
  36.280 +    }
  36.281 +    foreach my $path (keys(%{$info->{ls}})) {
  36.282 +        my $ok = 0;
  36.283 +        foreach my $topdir (@topdirs) {
  36.284 +            my $prefix = quotemeta($info->{prefix} . "/" . $topdir);
  36.285 +            if ($path =~ m/^$prefix$/ && $rpm !~ m|^openpkg-\d+|) {
  36.286 +                &lint_error($rpm, "top-level directory \"$topdir\" provided" .
  36.287 +                            " (expected none except for 'openpkg' package)");
  36.288 +            }
  36.289 +            if ($path =~ m/^$prefix/) {
  36.290 +                $ok = 1;
  36.291 +                last;
  36.292 +            }
  36.293 +        }
  36.294 +        if (not $ok) {
  36.295 +            &lint_error($rpm, "invalid top-level directory in path \"$path\"".
  36.296 +                       " (expected one of $topdirs)");
  36.297 +        }
  36.298 +    }
  36.299 +
  36.300 +    #   check for second-level path (all-in-one)
  36.301 +    my @topdirs_subdir_no  = (qw(bin cgi info sbin));
  36.302 +    my @topdirs_subdir_yes = (qw(etc libexec share var));
  36.303 +    foreach my $path (keys(%{$info->{ls}})) {
  36.304 +        foreach my $topdir (@topdirs_subdir_yes) {
  36.305 +            my $prefix = quotemeta($info->{prefix} . "/" . $topdir);
  36.306 +            if ($path =~ m/^$prefix\/[^\/]+$/) {
  36.307 +                if ($info->{ls}->{$path}->{perm} !~ m|^d|) {
  36.308 +                    &lint_error($rpm, "invalid positioned file \"$path\" under topdir \"$topdir\" (expected directory)");
  36.309 +                }
  36.310 +            }
  36.311 +        }
  36.312 +        foreach my $topdir (@topdirs_subdir_no) {
  36.313 +            my $prefix = quotemeta($info->{prefix} . "/" . $topdir);
  36.314 +            if ($path =~ m/^$prefix\/[^\/]+$/) {
  36.315 +                if ($info->{ls}->{$path}->{perm} =~ m|^d|) {
  36.316 +                    &lint_error($rpm, "invalid positioned directory \"$path\" under topdir \"$topdir\" (expected file)");
  36.317 +                }
  36.318 +            }
  36.319 +        }
  36.320 +    }
  36.321 +
  36.322 +    #   check "bin" and "sbin" directories
  36.323 +    foreach my $path (keys(%{$info->{ls}})) {
  36.324 +        foreach my $topdir (qw(bin sbin)) {
  36.325 +            my $prefix = quotemeta($info->{prefix} . "/" . $topdir);
  36.326 +            if ($path =~ m/^$prefix\/(.+)$/) {
  36.327 +                my $file = $1;
  36.328 +                if ($file =~ m|^[^/]+\.[^/.]+$|) {
  36.329 +                    &lint_warning($rpm, "strange executable filename \"$path\" containing an extension (expected no extension)");
  36.330 +                }
  36.331 +                my $perm = $info->{ls}->{$path}->{'perm'};
  36.332 +                if ($perm =~ m|^-| && $perm !~ m|^-[-r][-w][sx][-r][-w][-sx][-r][-w][-tx]$|) {
  36.333 +                    &lint_error($rpm, "non-executable file \"$path\" (with permissions \"$perm\" under topdir \"$topdir\" (expected to be executable)");
  36.334 +                }
  36.335 +            }
  36.336 +        }
  36.337 +    }
  36.338 +
  36.339 +    #   check for symbolic link targets (outside absolute, dangling)
  36.340 +    foreach my $path (keys(%{$info->{ls}})) {
  36.341 +        my $symlink = $info->{ls}->{$path}->{'symlink'};
  36.342 +        if ($symlink ne '') {
  36.343 +            #   check for outside absolute target
  36.344 +            my $prefix = quotemeta($info->{prefix});
  36.345 +            if ($symlink =~ m|^/.*| and $symlink !~ m|^$prefix|s) {
  36.346 +                &lint_warning($rpm, "symbolic link \"$path\" points to absolute path \"$symlink\" outside prefix \"$info->{prefix}\" (expected it to be under prefix only)");
  36.347 +            }
  36.348 +            #   check for dangling target
  36.349 +            my $resolved = &resolve($info, $path);
  36.350 +            sub resolve {
  36.351 +                my ($info, $path) = @_;
  36.352 +                if (not defined($info->{ls}->{$path})) {
  36.353 +                    return $path;
  36.354 +                }
  36.355 +                my $symlink = $info->{ls}->{$path}->{'symlink'};
  36.356 +                if ($symlink eq '') {
  36.357 +                    return $path;
  36.358 +                }
  36.359 +                else {
  36.360 +                    my $resolved;
  36.361 +                    if ($symlink =~ m|^/|) {
  36.362 +                        $resolved = $symlink;
  36.363 +                    }
  36.364 +                    else {
  36.365 +                        $resolved = $path;
  36.366 +                        $resolved =~ s|/[^/]+$||s;
  36.367 +                        $resolved .= "/" . $symlink;
  36.368 +                        $resolved =~ s|/{2,}|/|sg;
  36.369 +                        $resolved =~ s|/\.(?=/)||sg;
  36.370 +                        $resolved =~ s|/\.$||sg;
  36.371 +                        1 while ($resolved =~ s|/[^/]+/\.\./|/|s);
  36.372 +                        $resolved =~ s|/[^/]+/\.\.$||s;
  36.373 +                        $resolved =~ s|(.)/$|$1|s;
  36.374 +                    }
  36.375 +                    return &resolve($info, $resolved);
  36.376 +                }
  36.377 +            }
  36.378 +            if (not defined($info->{ls}->{$resolved})) {
  36.379 +                &lint_error($rpm, "symbolic link \"$path\" points to not existing target path \"$resolved\" (expected existing target path)");
  36.380 +            }
  36.381 +        }
  36.382 +    }
  36.383 +}
  36.384 +
  36.385 +##  _________________________________________________________________
  36.386 +##
  36.387 +##  CHECK "attrib": file attributes
  36.388 +##  _________________________________________________________________
  36.389 +##
  36.390 +
  36.391 +sub check_attrib {
  36.392 +    my ($rpm, $info) = @_;
  36.393 +
  36.394 +    #   check for empty files
  36.395 +    foreach my $path (keys(%{$info->{ls}})) {
  36.396 +        if (    $info->{ls}->{$path}->{'size'} == 0
  36.397 +            and $info->{ls}->{$path}->{'perm'} !~ m|^d|
  36.398 +            and $path !~ m/^.*\/lib\/perl\/.+\.bs$/
  36.399 +            and $rpm !~ m/\bopenpkg-[0-9]+/) {
  36.400 +            &lint_warning($rpm, "empty file \"$path\" found (expected no empty files)");
  36.401 +        }
  36.402 +    }
  36.403 +
  36.404 +    #   check for %config flagged files
  36.405 +    my $prefix = quotemeta($info->{'prefix'});
  36.406 +    my $name   = quotemeta($info->{'name'});
  36.407 +    foreach my $path (keys(%{$info->{ls}})) {
  36.408 +        my $config = $info->{ls}->{$path}->{'config'};
  36.409 +        my $path   = $info->{ls}->{$path}->{'path'};
  36.410 +        if ($rpm !~ m/\bopenpkg-[0-9]+/ and $config and $path !~ m/^$prefix\/etc\/($name\d*|fsl)\/.+/) {
  36.411 +            &lint_warning($rpm, "non-config file \"$path\" flagged as \%config (expected only \"$prefix/etc/$name/*\" files to be \%config files)");
  36.412 +        }
  36.413 +        if ($config and $path =~ m/^$prefix\/s?bin\/[^\/]+$/) {
  36.414 +            &lint_error($rpm, "executable file \"$path\" flagged as \%config");
  36.415 +        }
  36.416 +        if ($config and $path =~ m/^$prefix\/etc\/rc\.d\/rc\.$name$/) {
  36.417 +            &lint_error($rpm, "run-command file \"$path\" flagged as \%config");
  36.418 +        }
  36.419 +    }
  36.420 +
  36.421 +    #   check for permissions
  36.422 +    foreach my $path (keys(%{$info->{ls}})) {
  36.423 +        my $perm = $info->{ls}->{$path}->{'perm'};
  36.424 +        if ($path =~ m/^$prefix\/(bin|sbin)\/[^\/]+$/) {
  36.425 +            if ($perm !~ m|^[^d]..[xs]..[xs]..[xt]$|) {
  36.426 +                &lint_warning($rpm, "executable file \"$path\" has permissions \"$perm\" only (expected it to be executable by everyone)");
  36.427 +            }
  36.428 +        }
  36.429 +    }
  36.430 +
  36.431 +    #   TODO: user/group?
  36.432 +}
  36.433 +
  36.434 +##  _________________________________________________________________
  36.435 +##
  36.436 +##  CHECK "content": file content
  36.437 +##  _________________________________________________________________
  36.438 +##
  36.439 +
  36.440 +sub check_content {
  36.441 +    my ($rpm, $info) = @_;
  36.442 +
  36.443 +    #   TODO: stripped (file)
  36.444 +    #   TODO: syslibs (ldd)
  36.445 +    #   TODO: hard-coded paths pointing outside instance
  36.446 +    #   TODO: sanity check for shebang-lines
  36.447 +    #   TODO: contained temporary path
  36.448 +    #   TODO: bad-files: .po
  36.449 +}
  36.450 +
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/openpkg/lint-spec.pl	Tue Jul 31 12:23:42 2012 +0200
    37.3 @@ -0,0 +1,1388 @@
    37.4 +##
    37.5 +##  lint-spec.pl -- OpenPKG *.spec File Checker
    37.6 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    37.7 +##
    37.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    37.9 +##  All rights reserved. Licenses which grant limited permission to use,
   37.10 +##  copy, modify and distribute this software are available from the
   37.11 +##  OpenPKG GmbH.
   37.12 +##
   37.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   37.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   37.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   37.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   37.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   37.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   37.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   37.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   37.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   37.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   37.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   37.24 +##  SUCH DAMAGE.
   37.25 +##
   37.26 +
   37.27 +#   Perl run-time requirement
   37.28 +require 5;
   37.29 +BEGIN {
   37.30 +    eval "use Getopt::Long; use IO;";
   37.31 +    if ($@) {
   37.32 +        print STDERR
   37.33 +            "lint-spec: ERROR: This command requires a full-size Perl installation!\n" .
   37.34 +            "lint-spec: HINT:  Install OpenPKG \"perl\" package to use this command.\n";
   37.35 +        exit(1);
   37.36 +    }
   37.37 +}
   37.38 +
   37.39 +#   OpenPKG instance prefix
   37.40 +my $my_prefix = $ENV{'OPENPKG_PREFIX'};
   37.41 +delete $ENV{'OPENPKG_PREFIX'};
   37.42 +
   37.43 +#   program information
   37.44 +my $progname = "lint-spec";
   37.45 +my $progvers = "1.0.0";
   37.46 +
   37.47 +#   parameters (defaults)
   37.48 +my $version = 0;
   37.49 +my $verbose = 0;
   37.50 +my $help    = 0;
   37.51 +my $check   = 'all';
   37.52 +my $tmpdir  = ($ENV{TMPDIR} || $ENV{TEMPDIR} || "/tmp") . "/$progname";
   37.53 +my $rpm     = "$my_prefix/bin/openpkg rpm";
   37.54 +
   37.55 +#   exception handling support
   37.56 +$SIG{__DIE__} = sub {
   37.57 +    my ($err) = @_;
   37.58 +    $err =~ s|\s+at\s+.*||s if (not $verbose);
   37.59 +    print STDERR "$progname:ERROR: $err ". ($! ? "($!)" : "") . "\n";
   37.60 +    exit(1);
   37.61 +};
   37.62 +
   37.63 +#   command line parsing
   37.64 +Getopt::Long::Configure("bundling");
   37.65 +my $result = GetOptions(
   37.66 +    'V|version'     => \$version,
   37.67 +    'v|verbose'     => \$verbose,
   37.68 +    'h|help'        => \$help,
   37.69 +    'c|check=s'     => \$check,
   37.70 +    't|tmpdir=s'    => \$tmpdir,
   37.71 +    'r|rpm=s'       => \$rpm,
   37.72 +) || die "option parsing failed";
   37.73 +if ($help) {
   37.74 +    print "Usage: $progname [options] [SPECFILE ...]\n" .
   37.75 +          "Available options:\n" .
   37.76 +          " -v,--verbose       enable verbose run-time mode\n" .
   37.77 +          " -h,--help          print out this usage page\n" .
   37.78 +          " -c,--check=CHECKS  select checks to perform (default='all')\n" .
   37.79 +          " -r,--rpm=FILE      filesystem path to RPM program\n" .
   37.80 +          " -t,--tmpdir=PATH   filesystem path to temporary directory\n" .
   37.81 +          " -V,--version       print program version\n";
   37.82 +    exit(0);
   37.83 +}
   37.84 +if ($version) {
   37.85 +    print "OpenPKG $progname $progvers\n";
   37.86 +    exit(0);
   37.87 +}
   37.88 +
   37.89 +#   verbose message printing
   37.90 +sub msg_verbose {
   37.91 +    my ($msg) = @_;
   37.92 +    print STDERR "$msg\n" if ($verbose);
   37.93 +}
   37.94 +
   37.95 +#   warning message printing
   37.96 +sub msg_warning {
   37.97 +    my ($msg) = @_;
   37.98 +    print STDERR "$progname:WARNING: $msg\n";
   37.99 +}
  37.100 +
  37.101 +#   error message printing
  37.102 +sub msg_error {
  37.103 +    my ($msg) = @_;
  37.104 +    print STDERR "$progname:ERROR: $msg\n";
  37.105 +}
  37.106 +
  37.107 +#   determine check list
  37.108 +my @check_list = (qw(
  37.109 +    blank
  37.110 +    comment
  37.111 +    license
  37.112 +    header
  37.113 +    section
  37.114 +    preproc
  37.115 +    script
  37.116 +    global
  37.117 +    sources
  37.118 +    digest
  37.119 +));
  37.120 +my @checks = ();
  37.121 +if ($check eq 'all') {
  37.122 +    @checks = @check_list;
  37.123 +}
  37.124 +else {
  37.125 +    foreach my $c (split(/,/, $check)) {
  37.126 +        if (not grep($c, @check_list)) {
  37.127 +            die "invalid check \"$c\"";
  37.128 +        }
  37.129 +        push(@checks, $c);
  37.130 +    }
  37.131 +}
  37.132 +
  37.133 +#   global return code
  37.134 +$main::GRC = 0;
  37.135 +
  37.136 +#   iterate over all .spec files
  37.137 +foreach my $filename (@ARGV) {
  37.138 +    my $io = new IO::File "<$filename"
  37.139 +        or die "unable to open file \"$filename\" for reading";
  37.140 +    my $spec; { local $/ = undef; $spec = <$io>; }
  37.141 +    $io->close;
  37.142 +    foreach my $check (@checks) {
  37.143 +        eval "\&check_$check(\$filename, \$spec);";
  37.144 +    }
  37.145 +}
  37.146 +
  37.147 +#   die gracefully
  37.148 +exit($main::GRC);
  37.149 +
  37.150 +##  _________________________________________________________________
  37.151 +##
  37.152 +##  COMMON SUBROUTINES
  37.153 +##  _________________________________________________________________
  37.154 +##
  37.155 +
  37.156 +sub lines {
  37.157 +    my ($txt) = @_;
  37.158 +    my $l = 0;
  37.159 +    $txt =~ s|\n|$l++, ''|sge;
  37.160 +    return $l;
  37.161 +}
  37.162 +
  37.163 +sub lint_message {
  37.164 +    my ($type, $file, $done, $this, $msg) = @_;
  37.165 +    if (defined($done) and defined($this)) {
  37.166 +        my $start = &lines($done) + 1;
  37.167 +        my $end = $start + &lines($this);
  37.168 +        my $pos = $start;
  37.169 +        $pos .= "-". $end if ($end > $start);
  37.170 +        printf("%s:%s: %s:%s: %s\n", $progname, $type, $file, $pos, $msg);
  37.171 +    }
  37.172 +    else {
  37.173 +        printf("%s:%s: %s: %s\n", $progname, $type, $file, $msg);
  37.174 +    }
  37.175 +}
  37.176 +
  37.177 +sub lint_warning {
  37.178 +    my ($file, $done, $this, $msg) = @_;
  37.179 +    &lint_message("WARNING", $file, $done, $this, $msg);
  37.180 +    $main::GRC = 1 if ($main::GRC < 1);
  37.181 +}
  37.182 +
  37.183 +sub lint_error {
  37.184 +    my ($file, $done, $this, $msg) = @_;
  37.185 +    &lint_message("ERROR", $file, $done, $this, $msg);
  37.186 +    $main::GRC = 2 if ($main::GRC < 2);
  37.187 +}
  37.188 +
  37.189 +##  _________________________________________________________________
  37.190 +##
  37.191 +##  CHECK "blank": whitespace and blank lines
  37.192 +##  _________________________________________________________________
  37.193 +##
  37.194 +
  37.195 +sub check_blank {
  37.196 +    my ($file, $spec) = @_;
  37.197 +
  37.198 +    #   check for CR-LF combination
  37.199 +    my $done = ''; my $this = ''; my $todo = $spec;
  37.200 +    while ($todo =~ m/\r\n/s) {
  37.201 +        $done .= $`; $this = $&; $todo = $';
  37.202 +        &lint_warning($file, $done, $this, "carriage-return (CR, 0x0d) line-feed (NL, 0x0a) combination (expected just line-feed)");
  37.203 +        $done .= $this;
  37.204 +    }
  37.205 +
  37.206 +    #   check for multiple blank lines
  37.207 +    $done = ''; $this = ''; $todo = $spec;
  37.208 +    while ($todo =~ m/(\r?\n[ \t]*){3,}/s) {
  37.209 +        $done .= $`; $this = $&; $todo = $';
  37.210 +        &lint_warning($file, $done, $this, "multiple subsequent blank lines (expected single blank line)");
  37.211 +        $done .= $this;
  37.212 +    }
  37.213 +
  37.214 +    #   check for trailing whitespaces
  37.215 +    $done = ''; $this = ''; $todo = $spec;
  37.216 +    while ($todo =~ m/[ \t]+\r?\n/s) {
  37.217 +        $done .= $`; $this = $&; $todo = $';
  37.218 +        if ($done eq '' or $done =~ m|\n$|s) {
  37.219 +            &lint_warning($file, $done, $this, "whitespace on empty line (expected none)");
  37.220 +        }
  37.221 +        else {
  37.222 +            &lint_warning($file, $done, $this, "trailing whitespace (expected none)");
  37.223 +        }
  37.224 +        $done .= $this;
  37.225 +    }
  37.226 +
  37.227 +    #   check for bogus line continuations
  37.228 +    $done = ''; $this = ''; $todo = $spec;
  37.229 +    while ($todo =~ m/\\[ \t]*\r?\n(?=[ \t]*\r?\n)/s) {
  37.230 +        $done .= $`; $this = $&; $todo = $';
  37.231 +        &lint_warning($file, $done, $this, "bogus line continuation for following empty line (expect no line continuation)");
  37.232 +        $done .= $this;
  37.233 +    }
  37.234 +
  37.235 +    #   check for leading whitespaces before line continuations
  37.236 +    $done = ''; $this = ''; $todo = $spec;
  37.237 +    while ($todo =~ m/[ \t]{2,}\\[ \t]*\r?\n/s) {
  37.238 +        $done .= $`; $this = $&; $todo = $';
  37.239 +        &lint_warning($file, $done, $this, "multiple leading whitespace before line continuation (expected just a single space)");
  37.240 +        $done .= $this;
  37.241 +    }
  37.242 +
  37.243 +    #   check for leading tabs
  37.244 +    $done = ''; $this = ''; $todo = $spec;
  37.245 +    while ($todo =~ m/^ *\t+ *[^ \t]/m) {
  37.246 +        $done .= $`; $this = $&; $todo = $';
  37.247 +        &lint_warning($file, $done, $this, "leading tabs (expected spaces)");
  37.248 +        $done .= $this;
  37.249 +    }
  37.250 +
  37.251 +    #   check for mandatory/wished trailing blank line
  37.252 +    if ($spec !~ m|\n\n$|) {
  37.253 +        &lint_warning($file, $spec, "", "mandatory/wished trailing blank line missing (expected one)");
  37.254 +    }
  37.255 +}
  37.256 +
  37.257 +##  _________________________________________________________________
  37.258 +##
  37.259 +##  CHECK "comment": sharp-comments
  37.260 +##  _________________________________________________________________
  37.261 +##
  37.262 +
  37.263 +sub check_comment {
  37.264 +    my ($file, $spec) = @_;
  37.265 +
  37.266 +    #   check for comment indentation and contents
  37.267 +    my $done = ''; my $this = ''; my $todo = $spec;
  37.268 +    while ($todo =~ m/^([ \t]*)(#+)([ \t]*)(.*?)$/m) {
  37.269 +        $done .= $`; $this = $&; $todo = $';
  37.270 +        my ($lead, $sharp, $pad, $text) = ($1, $2, $3, $4);
  37.271 +        if (length($lead) % 2 != 0) {
  37.272 +            &lint_warning($file, $done, $this, "incorrect comment indentation (expected a multiple of 2 spaces)");
  37.273 +        }
  37.274 +        if (length($lead) > 1 && length($sharp) > 1) {
  37.275 +            &lint_warning($file, $done, $this, "indented comment has introduced with multiple sharps (expected single sharp character)");
  37.276 +        }
  37.277 +        if (length($pad.$text) > 0 && length($sharp.$pad) % 4 != 0) {
  37.278 +            &lint_warning($file, $done, $this, "incorrect comment text padding (expected a multiple of 4 sharps or spaces)");
  37.279 +        }
  37.280 +        if (length($pad) == 0 && length($text) > 0) {
  37.281 +            &lint_warning($file, $done, $this, "missing leading space before comment text (expected padding spaces)");
  37.282 +        }
  37.283 +        if (length($pad) > 0 && length($text) == 0) {
  37.284 +            &lint_warning($file, $done, $this, "empty comment text (expected a reasonable text)");
  37.285 +        }
  37.286 +        $done .= $this;
  37.287 +    }
  37.288 +
  37.289 +    #   check for comment contents only
  37.290 +    if ($file !~ m|openpkg\.spec$|) {
  37.291 +        $done = ''; $this = ''; $todo = $spec;
  37.292 +        while ($todo =~ m/\n\n[ \t]*#[ \t]+([^\n]+)(?!\n([ \t]*#))/s) {
  37.293 +            $done .= $`; $this = $&; $todo = $';
  37.294 +            my $text = $1;
  37.295 +            if (length($text) > 0 and $text =~ m|^[A-Z][^A-Z]|) {
  37.296 +                &lint_warning($file, $done, $this, "comment text starts with upper-case letter (expected lower-case letter)");
  37.297 +            }
  37.298 +            $done .= $this;
  37.299 +        }
  37.300 +    }
  37.301 +}
  37.302 +
  37.303 +##  _________________________________________________________________
  37.304 +##
  37.305 +##  CHECK "license": license header
  37.306 +##  _________________________________________________________________
  37.307 +##
  37.308 +
  37.309 +sub check_license {
  37.310 +    my ($file, $spec) = @_;
  37.311 +
  37.312 +    my $name = "[a-z][a-z0-9-]*";
  37.313 +    if ($file =~ m|^.*/([a-z][a-z0-9-]*)\.spec$|) {
  37.314 +        $name = $1;
  37.315 +    }
  37.316 +    elsif ($file =~ m|^([a-z][a-z0-9-]*)\.spec$|) {
  37.317 +        $name = $1;
  37.318 +    }
  37.319 +    my $re = "";
  37.320 +    $re .= "##\\n";
  37.321 +    $re .= "##  $name\\.spec -- OpenPKG RPM Package Specification\\n";
  37.322 +    $re .= "##  Copyright \\(c\\) 200[0-9]-2012 OpenPKG Foundation e\.V\. <http://openpkg\\.net/>\\n";
  37.323 +    $re .= "##\\n";
  37.324 +    $re .= "##  Permission to use, copy, modify, and distribute this software for\\n";
  37.325 +    $re .= "##  any purpose with or without fee is hereby granted, provided that\\n";
  37.326 +    $re .= "##  the above copyright notice and this permission notice appear in all\\n";
  37.327 +    $re .= "##  copies\\.\\n";
  37.328 +    $re .= "##\\n";
  37.329 +    $re .= "##  THIS SOFTWARE IS PROVIDED \\`\\`AS IS'' AND ANY EXPRESSED OR IMPLIED\\n";
  37.330 +    $re .= "##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\\n";
  37.331 +    $re .= "##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED\\.\\n";
  37.332 +    $re .= "##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR\\n";
  37.333 +    $re .= "##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\\n";
  37.334 +    $re .= "##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \\(INCLUDING, BUT NOT\\n";
  37.335 +    $re .= "##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\\n";
  37.336 +    $re .= "##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION\\) HOWEVER CAUSED AND\\n";
  37.337 +    $re .= "##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\\n";
  37.338 +    $re .= "##  OR TORT \\(INCLUDING NEGLIGENCE OR OTHERWISE\\) ARISING IN ANY WAY OUT\\n";
  37.339 +    $re .= "##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\\n";
  37.340 +    $re .= "##  SUCH DAMAGE\\.\\n";
  37.341 +    $re .= "##\\n";
  37.342 +    if ($name ne "openpkg" and $spec !~ m|^$re|os) {
  37.343 +        &lint_warning($file, "", "", "invalid license header");
  37.344 +    }
  37.345 +}
  37.346 +
  37.347 +##  _________________________________________________________________
  37.348 +##
  37.349 +##  CHECK "header": RPM headers
  37.350 +##  _________________________________________________________________
  37.351 +##
  37.352 +
  37.353 +sub check_header {
  37.354 +    my ($file, $spec) = @_;
  37.355 +
  37.356 +    my @headers = (qw(
  37.357 +        m:Name:^[a-z][a-z0-9-]*$
  37.358 +        m:Summary:^[A-Z]\S*(\s+([A-Z]\S*|of|for|from|in|at|on|\(\S+\)))*
  37.359 +        m:URL:^((https?|ftp)://.+|-)$
  37.360 +        m:Vendor:.+
  37.361 +        m:Packager:^(OpenPKG\sFoundation\se\.V\.|OpenPKG\sGmbH)$
  37.362 +        m:Distribution:^(OpenPKG|OpenPKG\sCommunity|OpenPKG\sEnterprise)$
  37.363 +        m:Class:^(BOOT|CORE|BASE|PLUS|EVAL|JUNK|PRIV)$
  37.364 +        m:Group:^[A-Z][a-zA-Z0-9]+$
  37.365 +        m:License:.+
  37.366 +        m:Version:^[^-]+$
  37.367 +        m:Release:^(E?([1-9]\.)?20[0-9][0-9](0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[01])|E?[1-9]\.[0-9]\.\d+|%\{[^\}]+\})$
  37.368 +        o:Source\d+:^((https?|ftp)://.+|[^/]+)$
  37.369 +        o:Patch\d+:^((https?|ftp)://.+|[^/]+)$
  37.370 +        o:Prefix:^%{l_prefix}$
  37.371 +        o:BuildRoot:^%{l_buildroot}$
  37.372 +        m:BuildPreReq:^(((,\s+)?digest\\(sha1:\%\{(SOURCE|PATCH)\d+\}\\)\s+=\s+[0-9a-fA-F]+)+|(OpenPKG,\sopenpkg\s>=\s\S+)?((,\s)?([a-z][a-z0-9-]*(\:\:with_[a-z][a-z0-9_]+)?|[A-Z][A-Z0-9-]*)(\s(>=?|==?|<=?|!=)\s\S+)?)+)$
  37.373 +        m:PreReq:^(OpenPKG,\sopenpkg\s>=\s\S+)?((,\s)?([a-z][a-z0-9-]*(\:\:with_[a-z][a-z0-9_]+)?|[A-Z][A-Z0-9-]*)(\s(>=?|==?|<=?|!=)\s\S+)?)+$
  37.374 +        o:AutoReq:^no$
  37.375 +        o:AutoReqProv:^no$
  37.376 +        o:Provides:^((,\s)?([a-z][a-z0-9-]*(\:\:with_[a-z][a-z0-9_]+)?|[A-Z][A-Z0-9-]*)(\s==?\s\S+)?)+$
  37.377 +        o:Conflicts:^((,\s)?([a-z][a-z0-9-]*(\:\:with_[a-z][a-z0-9_]+)?|[A-Z][A-Z0-9-]*)(\s(>=?|==?|<=?|!=)\s\S+)?)+$
  37.378 +    ));
  37.379 +    my @headers_def = (qw(
  37.380 +        Summary:^Badly\sPackaged\sProgram$
  37.381 +        Vendor:^John\sDoe$
  37.382 +        Group:^Unknown$
  37.383 +        License:^DoePL$
  37.384 +    ));
  37.385 +    my @headers_mult = (qw(
  37.386 +        BuildPreReq PreReq Provides Conflicts
  37.387 +    ));
  37.388 +
  37.389 +    my @seen = ();
  37.390 +    my %count = ();
  37.391 +    my $done = ''; my $this = ''; my $todo = $spec;
  37.392 +    while ($todo =~ m/^(\S+):([ \t]*)(.*?)$/m) {
  37.393 +        $done .= $`; $this = $&; $todo = $';
  37.394 +        my ($header, $pad, $value) = ($1, $2, $3);
  37.395 +
  37.396 +        #   check for layouting
  37.397 +        if (length($value) == 0) {
  37.398 +            &lint_error($file, $done, $this, "empty RPM header value");
  37.399 +        }
  37.400 +        if (length($header.":".$pad) != 14) {
  37.401 +            &lint_warning($file, $done, $this, "invalid RPM header name/value padding (expected value at column 15)");
  37.402 +        }
  37.403 +
  37.404 +        #   check for valid header name and value
  37.405 +        if (not grep { $header =~ m|^$_$|s } map { m/^[^:]:([^:]+):/, $1 } @headers) {
  37.406 +            &lint_error($file, $done, $this, "invalid RPM header name \"$header\"");
  37.407 +        }
  37.408 +        else {
  37.409 +            my $hn = quotemeta((grep { $header =~ m|^$_$|s } map { m/^[^:]+:([^:]+):/, $1 } @headers)[0]);
  37.410 +            my $re = (map { m/^[^:]+:${hn}:(.+)$/s } @headers)[0];
  37.411 +            my $re_match = $re;
  37.412 +            $re_match =~ s|^\(|(?:|sg;
  37.413 +            $re_match =~ s|([^\\])\(|\1(?:|sg;
  37.414 +            if (    not ($file =~ m|openpkg\.spec$| and $header eq 'Provides' and $value eq '%{l_prefix}')
  37.415 +                and $value !~ m|${re_match}|s) {
  37.416 +                &lint_warning($file, $done, $this, "RPM header \"$header\": " .
  37.417 +                              "invalid value \"$value\" (expected to match \"$re\")");
  37.418 +            }
  37.419 +            my $re_def = (map { m/^${hn}:(.+)$/s } @headers_def)[0];
  37.420 +            if (defined($re_def)) {
  37.421 +                my $re_def_match = $re_def;
  37.422 +                $re_def_match =~ s|^\(|(?:|sg;
  37.423 +                $re_def_match =~ s|([^\\])\(|\1(?:|sg;
  37.424 +                if ($value =~ m|${re_def_match}|s) {
  37.425 +                    &lint_warning($file, $done, $this, "RPM header \"$header\": " .
  37.426 +                                  "default value \"$value\" (expected to match \"$re\", except for this)");
  37.427 +                }
  37.428 +            }
  37.429 +            if ($header =~ m/^Vendor/ and $value =~ m/et\sal/ and $value !~ m/et\sal\./) {
  37.430 +                &lint_warning($file, $done, $this, "RPM header \"$header\": " .
  37.431 +                              "has value \"$value\" (expected \"et al.\" with dot)");
  37.432 +            }
  37.433 +        }
  37.434 +        push(@seen, $header);
  37.435 +        $count{$header}++;
  37.436 +        $done .= $this;
  37.437 +    }
  37.438 +
  37.439 +    #   check for existence of mandatory headers
  37.440 +    foreach my $header (@headers) {
  37.441 +        my ($type, $name, $regex) = split(/:/, $header, 3);
  37.442 +        if ($type eq 'm') {
  37.443 +            if ($file =~ m|openpkg\.spec$| and
  37.444 +                ($name eq "BuildPreReq" or $name eq "PreReq")) {
  37.445 +                #   the bootstrap package is an obvious exception
  37.446 +                next;
  37.447 +            }
  37.448 +            if (not grep(/^$name$/, @seen)) {
  37.449 +                &lint_warning($file, undef, undef, "mandatory RPM header \"$name\" not found");
  37.450 +            }
  37.451 +        }
  37.452 +    }
  37.453 +
  37.454 +    #   check for multiple occurrence headers
  37.455 +    foreach my $seen (@seen) {
  37.456 +        if ($count{$seen} > 1 and not (grep { $_ eq $seen } @headers_mult)) {
  37.457 +            &lint_error($file, undef, undef, "RPM header \"$seen\" occurs multiple times (expected just once)");
  37.458 +        }
  37.459 +    }
  37.460 +}
  37.461 +
  37.462 +##  _________________________________________________________________
  37.463 +##
  37.464 +##  CHECK "section": RPM sections
  37.465 +##  _________________________________________________________________
  37.466 +##
  37.467 +
  37.468 +sub check_section {
  37.469 +    my ($file, $spec) = @_;
  37.470 +
  37.471 +    my $require = qq{
  37.472 +        (%define,)*
  37.473 +        Name:,
  37.474 +        Summary:,
  37.475 +        URL:,
  37.476 +        Vendor:,
  37.477 +        Packager:,
  37.478 +        Distribution:,
  37.479 +        Class:,
  37.480 +        Group:,
  37.481 +        License:,
  37.482 +        Version:,
  37.483 +        Release:,
  37.484 +        (%option,)*
  37.485 +        (%define,|%undefine,)*
  37.486 +        (Source\\d+:,)*
  37.487 +        (Patch\\d+:,)*
  37.488 +        (%NoSource,)*
  37.489 +        (%NoPatch,)*
  37.490 +        (Prefix:,)?
  37.491 +        (BuildRoot:,)?
  37.492 +        ((BuildPreReq:,)
  37.493 +         |(PreReq:,))*
  37.494 +        (AutoReq:,)?
  37.495 +        (AutoReqProv:,)?
  37.496 +        (Provides:,)*
  37.497 +        (Conflicts:,)*
  37.498 +        %description,
  37.499 +        (%track,)?
  37.500 +        %prep,
  37.501 +        %build,
  37.502 +        %install,
  37.503 +        (%check,)?
  37.504 +        %files,
  37.505 +        %clean,
  37.506 +        (%pre,)?
  37.507 +        (%post,)?
  37.508 +        (%preun,)?
  37.509 +        (%postun,)?
  37.510 +        (%trigger,)?
  37.511 +        (%triggerin,)?
  37.512 +        (%triggerun,)?
  37.513 +        (%triggerpostun,)?
  37.514 +        (%verifyscript,)?
  37.515 +    };
  37.516 +
  37.517 +    #   check for order of headers
  37.518 +    my $sections = "";
  37.519 +    my $done = ''; my $this = ''; my $todo = $spec;
  37.520 +    while ($todo =~ m/^(\S+:|%\S+).*$/m) {
  37.521 +        $done .= $`; $this = $&; $todo = $';
  37.522 +        my $section = $1;
  37.523 +        next if ($section =~ m/^%(if|else|endif)/);
  37.524 +        $sections .= "$section,";
  37.525 +        $done .= $this;
  37.526 +    }
  37.527 +    my $regex = $require;
  37.528 +    $regex =~ s|\s+||sg;
  37.529 +    if ($sections !~ m/^$regex$/s) {
  37.530 +        $regex =~ s|,| |sg;
  37.531 +        &lint_error($file, undef, undef, "invalid RPM section order: $sections (expected \"$regex\")");
  37.532 +    }
  37.533 +}
  37.534 +
  37.535 +##  _________________________________________________________________
  37.536 +##
  37.537 +##  CHECK "preproc": RPM macro pre-processor
  37.538 +##  _________________________________________________________________
  37.539 +##
  37.540 +
  37.541 +sub check_preproc {
  37.542 +    my ($file, $spec) = @_;
  37.543 +
  37.544 +    my $done = ''; my $this = ''; my $todo = $spec;
  37.545 +    while ($todo =~ m/^(%(?:if|else|endif|define|undefine|option))(.*)$/m) {
  37.546 +        $done .= $`; $this = $&; $todo = $';
  37.547 +        my ($cmd, $args) = ($1, $2);
  37.548 +        if ($cmd eq '%if') {
  37.549 +            #   FIXME: either try to really parse the boolean expression
  37.550 +            #   FIXME: or at least try to guess its correct syntax
  37.551 +        }
  37.552 +        elsif ($cmd eq '%else' or $cmd eq '%endif') {
  37.553 +            if (length($args) > 0) {
  37.554 +                &lint_warning($file, $done, $this, "garbage after pre-processor directive " .
  37.555 +                              "\"$cmd\" (expected no arguments)");
  37.556 +            }
  37.557 +        }
  37.558 +        elsif ($cmd eq '%undefine') {
  37.559 +            if ($args =~ m|^\s+(\S+)\s*$|) {
  37.560 +                my $var = $1;
  37.561 +                if ($var !~ m/^(V|with)_[a-z][a-zA-Z0-9_]*$/) {
  37.562 +                    &lint_warning($file, $done, $this, "unusually named macro: \"$var\" " .
  37.563 +                                  "(expected \"(V|with)_[a-z][a-zA-Z0-9_]*\")");
  37.564 +                    next;
  37.565 +                }
  37.566 +            }
  37.567 +            else {
  37.568 +                &lint_error($file, $done, $this, "invalid number of arguments to pre-processor " .
  37.569 +                            "directive \"$cmd\" (expected exactly 1 argument)");
  37.570 +            }
  37.571 +        }
  37.572 +        elsif ($cmd eq '%define' or $cmd eq '%option') {
  37.573 +            if ($args =~ m|^\s+(\S+)\s+(.*)$|) {
  37.574 +                my ($var, $val) = ($1, $2);
  37.575 +                if ($var !~ m/^(V|with)_[a-z][a-zA-Z0-9_]*$/) {
  37.576 +                    &lint_warning($file, $done, $this, "unusually named macro: \"$var\" " .
  37.577 +                                  "(expected \"(V|with)_[a-z][a-zA-Z0-9_]*\")");
  37.578 +                    next;
  37.579 +                }
  37.580 +                if (length($val) == 0) {
  37.581 +                    &lint_error($file, $done, $this, "empty macro value");
  37.582 +                }
  37.583 +            }
  37.584 +            else {
  37.585 +                &lint_error($file, $done, $this, "invalid number of arguments to pre-processor " .
  37.586 +                            "directive \"$cmd\" (expected exactly 2 arguments)");
  37.587 +            }
  37.588 +        }
  37.589 +        $done .= $this;
  37.590 +    }
  37.591 +
  37.592 +    #   check correct if/endif nesting
  37.593 +    my @stack = ();
  37.594 +    $done = ''; $this = ''; $todo = $spec;
  37.595 +    while ($todo =~ m/^(%(?:if|else|endif|define|undefine|option)).*$/m) {
  37.596 +        $done .= $`; $this = $&; $todo = $';
  37.597 +        my $directive = $1;
  37.598 +        if ($directive eq '%if') {
  37.599 +            push(@stack, &lines($done . $this));
  37.600 +        }
  37.601 +        elsif ($directive eq '%endif') {
  37.602 +            if (@stack == 0) {
  37.603 +                &lint_error($file, $done, $this, "found \%endif without corresponding opening \%if");
  37.604 +                last;
  37.605 +            }
  37.606 +            pop(@stack);
  37.607 +        }
  37.608 +        $done .= $this;
  37.609 +    }
  37.610 +    my $line;
  37.611 +    while (defined($line = pop(@stack))) {
  37.612 +        &lint_error($file, undef, undef, "\%if at line $line never closed by \%endif");
  37.613 +    }
  37.614 +
  37.615 +    #   check for indented preprocessor constructs
  37.616 +    $done = ''; $this = ''; $todo = $spec;
  37.617 +    while ($todo =~ m/^[ \t]+(%(?:if|else|endif|define|undefine|option)).*$/m) {
  37.618 +        $done .= $`; $this = $&; $todo = $';
  37.619 +        my $directive = $1;
  37.620 +        &lint_error($file, $done, $this, "found indented \"$directive\" preprocessor directive (expected no indentation)");
  37.621 +        $done .= $this;
  37.622 +    }
  37.623 +}
  37.624 +
  37.625 +##  _________________________________________________________________
  37.626 +##
  37.627 +##  CHECK "script": shell scripts
  37.628 +##  _________________________________________________________________
  37.629 +##
  37.630 +
  37.631 +sub check_script {
  37.632 +    my ($file, $spec) = @_;
  37.633 +
  37.634 +    my $done = ''; my $this = ''; my $todo = $spec;
  37.635 +    while ($todo =~ m/(\%(?:description|prep|build|install|check|files|clean|pre|post|preun|postun|trigger|triggerin|triggerun|triggerpostun|verifyscript))([^\n]*)\n(.*?\n)(?=\%(?:description|prep|build|install|check|files|clean|pre|post|preun|postun|trigger|triggerin|triggerun|triggerpostun|verifyscript)|$)/s) {
  37.636 +        $done .= $`; $this = $&; $todo = $';
  37.637 +        my ($section, $args, $script) = ($1, $2, $3);
  37.638 +
  37.639 +        #   perform checks for a single script section
  37.640 +        &check_script_section($file, $done, $this, $section, $args, $script);
  37.641 +
  37.642 +        $done .= $this;
  37.643 +    }
  37.644 +}
  37.645 +
  37.646 +sub check_script_section {
  37.647 +    my ($file, $outer_done, $outer_this, $section, $args, $script) = @_;
  37.648 +
  37.649 +    #   skip plain-text/non-scripting section %description
  37.650 +    return if ($section eq '%description');
  37.651 +
  37.652 +    #   remove comment contents
  37.653 +    $outer_this =~ s|^[ \t]*#[^\n]*||mg;
  37.654 +
  37.655 +    #   check shell redirections
  37.656 +    my $done = $outer_done; my $this = ''; my $todo = $outer_this;
  37.657 +    while (   $todo =~ m/[ \t]+(\d+)?[><][ \t]+\S+/s
  37.658 +           or $todo =~ m/[ \t]+[><](\&\d+)?[ \t]+\S+/s) {
  37.659 +        $done .= $`; $this = $&; $todo = $';
  37.660 +        &lint_warning($file, $done, $this, "section $section: whitespace after shell redirection (expected none)");
  37.661 +        $done .= $this;
  37.662 +    }
  37.663 +
  37.664 +    #   utility function: extract a single shell command
  37.665 +    sub command_extract {
  37.666 +        my ($script) = @_;
  37.667 +        my $cmd = '';
  37.668 +        while ($script ne '') {
  37.669 +            $script =~ s/^([ \t]*'[^']*')/         $cmd .= $1, ''/se && next;
  37.670 +            $script =~ s/^([ \t]*"[^"]*")/         $cmd .= $1, ''/se && next;
  37.671 +            $script =~ s/^([ \t]*[^ \t;\)\\\r\n]+)/$cmd .= $1, ''/se && next;
  37.672 +            $script =~ s/^([ \t]*\\[ \t]*\r?\n)/   $cmd .= $1, ''/se && next;
  37.673 +            last;
  37.674 +        }
  37.675 +        return ($cmd, $script);
  37.676 +    }
  37.677 +
  37.678 +    #   utility function: join a multi-line command
  37.679 +    sub multiline_join {
  37.680 +        my ($cmd) = @_;
  37.681 +        $cmd =~ s/([ \t]*\\[ \t]*\r?\n[ \t]*)/ /sg;
  37.682 +        return $cmd;
  37.683 +    }
  37.684 +
  37.685 +    #   utility function: split command into arguments
  37.686 +    sub shell_tokenize {
  37.687 +        my ($cmd) = @_;
  37.688 +        my @cmd = ();
  37.689 +        while ($cmd ne '') {
  37.690 +            $cmd =~ s/^\s*('[^']*')/push(@cmd, $1), ''/se && next;
  37.691 +            $cmd =~ s/^\s*("[^"]*")/push(@cmd, $1), ''/se && next;
  37.692 +            $cmd =~ s/^\s*(\S+)/    push(@cmd, $1), ''/se && next;
  37.693 +            $cmd =~ s/^\s*$/                        ''/se && last;
  37.694 +        }
  37.695 +        return @cmd;
  37.696 +    }
  37.697 +
  37.698 +    #   check filesystem path style
  37.699 +    $done = $outer_done; $this = ''; $todo = $outer_this;
  37.700 +    while ($todo =~ m/\%\{l_shtool\}\s+(\w+)\s+/s) {
  37.701 +        $done .= $`; $this = $&; $todo = $';
  37.702 +        ($this, $todo) = &command_extract($this . $todo);
  37.703 +
  37.704 +        #   check for shtool options with no space before argument
  37.705 +        my $subthis = $this;
  37.706 +        $subthis =~ s/\%{[A-Za-z][A-Za-z0-9_]*}//sg;
  37.707 +        $subthis =~ s/\%{[A-Za-z][A-Za-z0-9_]*(?:\s+[^}]+?)?}//sg;
  37.708 +        #   remove content of quoted arguments as they might contain unrelated things to catch
  37.709 +        $subthis =~ s/'[^']*'/ARG/sg;
  37.710 +        $subthis =~ s/"[^"]*"/ARG/sg;
  37.711 +        $subthis =~ s/`[^`]*`/ARG/sg;
  37.712 +        #   remove us completely if line ends with a quote as this indicates we are a quoted argument to ourselfs
  37.713 +        $subthis =~ s/[^']*'$//s;
  37.714 +        $subthis =~ s/[^"]*"$//s;
  37.715 +        $subthis =~ s/[^`]*`$//s;
  37.716 +        $subthis =~ s/[^']*' \\\n//s;
  37.717 +        $subthis =~ s/[^"]*" \\\n//s;
  37.718 +        $subthis =~ s/[^`]*` \\\n//s;
  37.719 +        #   catch command termination by semicolon, pipe, or, and;
  37.720 +        $subthis =~ s/[;|&].*$//s;
  37.721 +        if ($subthis =~ m/\s-[a-zA-Z]\S/) {
  37.722 +            &lint_warning($file, $done, $this, "found use of shtool option with space omitted before argument");
  37.723 +        }
  37.724 +
  37.725 +        #   openpkg-rc is special because does bootstrap things
  37.726 +        last if ($file =~ m|openpkg-rc\.spec$|);
  37.727 +
  37.728 +        my @cmd = &shell_tokenize(&multiline_join($this));
  37.729 +        if ($cmd[1] eq 'mkdir') {
  37.730 +            #   join flags with their arguments
  37.731 +            for (my $i = 2; $i <= $#cmd; $i++) {
  37.732 +                if ($cmd[$i] eq '-m') {
  37.733 +                    splice(@cmd, $i, 2, $cmd[$i].$cmd[$i+1]);
  37.734 +                }
  37.735 +            }
  37.736 +            #   check paths
  37.737 +            for (my $i = $#cmd; $i > 1 and $cmd[$i] !~ m|^-| and $cmd[$i] !~ m|^\d+$|; $i--) {
  37.738 +                if ($cmd[$i] =~ m|/$|) {
  37.739 +                    &lint_warning($file, $done, $this, "section $section: superfluous trailing slash on " .
  37.740 +                                  "created path in \"shtool mkdir\" command (expected none)");
  37.741 +                }
  37.742 +            }
  37.743 +        }
  37.744 +        elsif ($cmd[1] eq 'install') {
  37.745 +            #   join flags with their arguments
  37.746 +            for (my $i = 2; $i <= $#cmd; $i++) {
  37.747 +                if ($cmd[$i] =~ m/-(e|m|o|g)$/) {
  37.748 +                    splice(@cmd, $i, 2, $cmd[$i].$cmd[$i+1]);
  37.749 +                }
  37.750 +                elsif ($cmd[$i] eq '%{SOURCE') {
  37.751 +                    splice(@cmd, $i, 2, $cmd[$i].$cmd[$i+1]);
  37.752 +                }
  37.753 +                elsif ($cmd[$i] eq '%{l_value') {
  37.754 +                    while ($i < $#cmd and $cmd[$i+1] !~ m|\}$|s) {
  37.755 +                        splice(@cmd, $i, 2, $cmd[$i].$cmd[$i+1]);
  37.756 +                    }
  37.757 +                    splice(@cmd, $i, 2);
  37.758 +                    $i--;
  37.759 +                }
  37.760 +            }
  37.761 +
  37.762 +            #   determine last path argument
  37.763 +            my $i = $#cmd; $i-- while ($i > 1 and $cmd[$i] !~ m|^-| and $cmd[$i] !~ m|^\d+$|);
  37.764 +
  37.765 +            #   check paths
  37.766 +            if (($#cmd - $i) > 2 and $cmd[-1] !~ m|/$|) {
  37.767 +                #   simple case: multiple sources require target to be a directory
  37.768 +                &lint_warning($file, $done, $this, "section $section: missing trailing slash on " .
  37.769 +                              "destination path in \"shtool install\" command (expected one) 1");
  37.770 +            }
  37.771 +            elsif (($#cmd - $i) == 2 and $cmd[-1] !~ m|/$|) {
  37.772 +                #   complex case: single source, so we can check only known destination paths
  37.773 +                if (   $cmd[-1] =~ m/\%\{l_prefix\}\/(bin|cgi|include|info|lib|pub|sbin)$/
  37.774 +                    or $cmd[-1] =~ m/\%\{l_prefix\}\/(etc|libexec|man|share|var)(\/[^\/]+)?$/) {
  37.775 +                    &lint_warning($file, $done, $this, "section $section: missing trailing slash on " .
  37.776 +                                  "destination path in \"shtool install\" command (expected one) 2");
  37.777 +                }
  37.778 +            }
  37.779 +            else {
  37.780 +                #   special case: if any path contains '*', then globbing might occur
  37.781 +                for (my $i = 2; $i <= $#cmd; $i++) {
  37.782 +                    if ($cmd[$i] =~ m/\*/ and $cmd[-1] !~ m|/$|) {
  37.783 +                        &lint_warning($file, $done, $this, "section $section: missing trailing slash on " .
  37.784 +                                      "destination path in \"shtool install\" command (expected one) 3");
  37.785 +                        last;
  37.786 +                    }
  37.787 +                }
  37.788 +            }
  37.789 +        }
  37.790 +        $done .= $this;
  37.791 +    }
  37.792 +
  37.793 +    #   check for redundant 'export PATH' statements
  37.794 +    #$done = $outer_done; $this = ''; $todo = $outer_this;
  37.795 +    #while ($todo =~ m/\bexport[ \t]+([a-zA-Z_][a-zA-Z0-9_]*[ \t]+)*PATH\b/s) {
  37.796 +    #    $done .= $`; $this = $&; $todo = $';
  37.797 +    #    &lint_warning($file, $done, $this, "section $section: redundant \"export PATH\" statement (expected none)");
  37.798 +    #    $done .= $this;
  37.799 +    #}
  37.800 +
  37.801 +    #   check for obsolete cpp build flags
  37.802 +    $done = $outer_done; $this = ''; $todo = $outer_this;
  37.803 +    while ($todo =~ m/-I\%\{l_prefix\}\/include(\/([^ \t"';]+?))?[ \t"';]/s) {
  37.804 +        $done .= $`; $this = $&; $todo = $';
  37.805 +        my ($subdir) = $2;
  37.806 +        &lint_warning($file, $done, $this, "section $section: hard-coded C pre-processor path option " .
  37.807 +                      "(use \"%{l_cppflags".($subdir ? " $subdir" : "")."}\" instead)");
  37.808 +        $done .= $this;
  37.809 +    }
  37.810 +
  37.811 +    #   check for obsolete ld build flags
  37.812 +    $done = $outer_done; $this = ''; $todo = $outer_this;
  37.813 +    while ($todo =~ m/-L\%\{l_prefix\}\/lib(\/([^ \t"';]+?))?[ \t"';]/s) {
  37.814 +        $done .= $`; $this = $&; $todo = $';
  37.815 +        my ($subdir) = $2;
  37.816 +        &lint_warning($file, $done, $this, "section $section: hard-coded linker path option " .
  37.817 +                      "(use \"%{l_ldflags".($subdir ? " $subdir" : "")."}\" instead)");
  37.818 +        $done .= $this;
  37.819 +    }
  37.820 +
  37.821 +    #   check for "raw" tool usage
  37.822 +    if ($section ne '%description' and $file !~ m|openpkg\.spec$|) {
  37.823 +        foreach my $token (&shell_tokenize($outer_this)) {
  37.824 +            if ($token =~ m/^(rpmtool|shtool|curl|bash|gzip|bzip2|tar|cc|cxx|make|patch)$/s) {
  37.825 +                &lint_warning($file, undef, undef, "section $section: raw usage of standard tool \"$token\"" .
  37.826 +                              " (use \"%{l_${token}}\" instead)");
  37.827 +            }
  37.828 +        }
  37.829 +    }
  37.830 +
  37.831 +    #   check for setup and patch macro usage
  37.832 +    if ($section eq '%prep') {
  37.833 +        $done = $outer_done; $this = ''; $todo = $outer_this;
  37.834 +        my @tokens = &shell_tokenize($outer_this);
  37.835 +        while ($todo =~ m/([^\n]*)\n/s) {
  37.836 +            $done .= $`; $this = $&; $todo = $';
  37.837 +            if ($this =~ m/^ *%setup.*  .*$/) {
  37.838 +                &lint_warning($file, undef, undef, "section $section: multiple spaces in \"\%setup\" macro" .
  37.839 +                              " (reduce to single space)");
  37.840 +            }
  37.841 +            if ($this =~ m/^ *%setup.*-[ab]$/ and grep(/^\%setup+$/, @tokens) == 1) {
  37.842 +                &lint_warning($file, undef, undef, "section $section: -[ab] option superflous for single \"\%setup\" macro" .
  37.843 +                              " (remove it)");
  37.844 +            }
  37.845 +            if ($this =~ m/^ *%patch.*  .*$/) {
  37.846 +                &lint_warning($file, undef, undef, "section $section: multiple spaces in \"\%patch\" macro" .
  37.847 +                              " (reduce to single space)");
  37.848 +            }
  37.849 +            if ($this =~ m/^ *%patch.*-p +[01]/) {
  37.850 +                &lint_warning($file, undef, undef, "section $section: syntactically wrong space in \"\%patch\" macro" .
  37.851 +                              " (use -pN)");
  37.852 +            }
  37.853 +            if ($this =~ m/^ *%patch.*-P 0\s*$/ and grep(/^\%patch+$/, @tokens) == 1) {
  37.854 +                &lint_warning($file, undef, undef, "section $section: syntactically wrong space in \"\%patch\" macro" .
  37.855 +                              " (omit -P 0 for single patch)");
  37.856 +            }
  37.857 +            if ($this =~ m/^ *%patch.*-P [^0-9]/ and grep(/^\%patch+$/, @tokens)  > 1) {
  37.858 +                &lint_warning($file, undef, undef, "section $section: syntactically wrong space in \"\%patch\" macro" .
  37.859 +                              " (use -P for multiple patches)");
  37.860 +            }
  37.861 +            $done .= $this;
  37.862 +        }
  37.863 +        if (grep(/^\%setup\d+$/, @tokens)) {
  37.864 +            &lint_warning($file, undef, undef, "section $section: numbered \"\%setup\" macro" .
  37.865 +                          " (do not use %setup directly followed by a number, replace with %setup ... -[ab])");
  37.866 +        }
  37.867 +        if (grep(/^\%patch\d+$/, @tokens)) {
  37.868 +            &lint_warning($file, undef, undef, "section $section: numbered \"\%patch\" macro" .
  37.869 +                          " (do not use %patch directly followed by a number, replace with %patch ... -P)");
  37.870 +        }
  37.871 +    }
  37.872 +
  37.873 +    #   check for hard-coded prefix in %pre[un],%post[un] scripts
  37.874 +    if ($section =~ m/^\%(preun|postun|pre|post)$/s and $file !~ m|openpkg\.spec$|) {
  37.875 +        $done = $outer_done; $this = ''; $todo = $outer_this;
  37.876 +        while ($todo =~ m/\%\{l_prefix\}/s) {
  37.877 +            $done .= $`; $this = $&; $todo = $';
  37.878 +            &lint_warning($file, $done, $this, "section $section: hard-coded prefix (\%{l_prefix}) found " .
  37.879 +                          "(use \"\$RPM_INSTALL_PREFIX\" to allow relocation)");
  37.880 +            $done .= $this;
  37.881 +        }
  37.882 +    }
  37.883 +
  37.884 +    #   check for sub-shell parenthesis style
  37.885 +    #   (this is such complicated because the Bourne Shell has a
  37.886 +    #   construct "case <value> in <pattern> ) <script> ;; ... esac"
  37.887 +    #   where the closing parenthesis makes heavy problems for our
  37.888 +    #   check. So we first have to get rid of this. Unfortunately this
  37.889 +    #   is again not easy because there exists nested(!) case/esac
  37.890 +    #   constructs. Hence, we have to use a small recursive descent
  37.891 +    #   parser which replaces the ")" in case/esac constructs with
  37.892 +    #   "PCLOSE". A similar thing is done with string literals, although
  37.893 +    #   here the job is more trivial).
  37.894 +    if ($section !~ m/^\%files$/s) {
  37.895 +        $done = $outer_done; $this = ''; $todo = $outer_this;
  37.896 +        $todo =~ s/`[^`]*`/STRING/sg;
  37.897 +        $todo =~ s/'[^']*'/STRING/sg;
  37.898 +        $todo =~ s/"[^"]*"/STRING/sg;
  37.899 +        $todo = (&parse_sh("", $todo))[0];
  37.900 +        sub parse_sh {
  37.901 +            my ($done, $todo) = @_;
  37.902 +            while ($todo =~ m/^(.*?)(case|;;)/s) {
  37.903 +                if ($2 eq 'case') {
  37.904 +                    ($done, $todo) = &parse_case($done.$1, $2.$');
  37.905 +                }
  37.906 +                else {
  37.907 +                    ($done, $todo) = ($done.$1, $2.$');
  37.908 +                    return ($done, $todo);
  37.909 +                }
  37.910 +            }
  37.911 +            ($done, $todo) = ($done . $todo, "");
  37.912 +            return ($done, $todo);
  37.913 +        }
  37.914 +        sub parse_case {
  37.915 +            my ($done, $todo) = @_;
  37.916 +            $todo =~ m|^\s*case\s+\S+\s+in\b|s or return (undef, undef);
  37.917 +            ($done, $todo) = ($done . $&, $');
  37.918 +            while ($todo =~ m|^(\s*[^)\n]+)(\))|s) {
  37.919 +                ($done, $todo) = ($done . $1 . "PCLOSE", $');
  37.920 +                ($done, $todo) = &parse_sh($done, $todo) or return (undef, undef);
  37.921 +                $todo =~ m|^\s*;;|s or return (undef, undef);
  37.922 +                ($done, $todo) = ($done . $&, $');
  37.923 +            }
  37.924 +            $todo =~ m|^\s*esac|s or return (undef, undef);
  37.925 +            ($done, $todo) = ($done . $&, $');
  37.926 +            return ($done, $todo);
  37.927 +        }
  37.928 +        if ($file !~ m|openpkg\.spec$| and $todo eq '') {
  37.929 +            &lint_warning($file, $outer_done, $outer_this,
  37.930 +                          "unable to correctly parse case/esac constructs in shell-script" .
  37.931 +                          " (sub-shell parenthesis check skipped)");
  37.932 +        }
  37.933 +        else {
  37.934 +            while ($todo =~ m/\)[ \t]*\n/s) {
  37.935 +                $done .= $`; $this = $&; $todo = $';
  37.936 +                &lint_warning($file, $done, $this, "problematic sub-shell construct without error handling " .
  37.937 +                              "(use \"...) || exit \$?\" to make sure it correctly exits on nested failure)");
  37.938 +                $done .= $this;
  37.939 +            }
  37.940 +        }
  37.941 +    }
  37.942 +}
  37.943 +
  37.944 +##  _________________________________________________________________
  37.945 +##
  37.946 +##  CHECK "global": globals
  37.947 +##  _________________________________________________________________
  37.948 +##
  37.949 +
  37.950 +sub check_global {
  37.951 +    my ($file, $spec) = @_;
  37.952 +
  37.953 +    #   check for deprecated use of %{name} macro
  37.954 +    my $done = ''; my $this = ''; my $todo = $spec;
  37.955 +    while ($todo =~ m/\%\{name\}/s) {
  37.956 +        $done .= $`; $this = $&; $todo = $';
  37.957 +        &lint_warning($file, $done, $this, "deprecated usage of %{name} macro (expected none)");
  37.958 +        $done .= $this;
  37.959 +    }
  37.960 +
  37.961 +    #   FIXME: activate later
  37.962 +    #   check for over-long lines
  37.963 +    #$done = ''; $this = ''; $todo = $spec;
  37.964 +    #while ($todo =~ m/([^\n]{80,})\n/s) {
  37.965 +    #    $done .= $`; $this = $&; $todo = $';
  37.966 +    #    &lint_warning($file, $done, $this, "over-long line with ".sprintf("%d", length($1))." characters " .
  37.967 +    #                  "(expected maximum of 79 characters)");
  37.968 +    #    $done .= $this;
  37.969 +    #}
  37.970 +
  37.971 +    #   check for "shtool install" with -e on same line
  37.972 +    my $done = ''; my $this = ''; my $todo = $spec;
  37.973 +    while ($todo =~ m/%{l_shtool} install[^\n]*-e/s) {
  37.974 +        $done .= $`; $this = $&; $todo = $';
  37.975 +        &lint_warning($file, $done, $this, "found -e option of \"shtool install\" on same line (expected separate lines)");
  37.976 +        $done .= $this;
  37.977 +    }
  37.978 +
  37.979 +    #   check for "shtool install" with multiple -e on same line
  37.980 +    my $done = ''; my $this = ''; my $todo = $spec;
  37.981 +    while ($todo =~ m/%{l_shtool} install[^\n]+\\\n([^\n]*?-e[^\n]*?-e[^\n]*\\\n)+/s) {
  37.982 +        $done .= $`; $this = $&; $todo = $';
  37.983 +        &lint_warning($file, $done, $this, "found multiple -e options of \"shtool install\" on same line (expected separate lines)");
  37.984 +        $done .= $this;
  37.985 +    }
  37.986 +
  37.987 +    #   check for deprecated use of "shtool install|subst -e @l_...@ %{l_...}"
  37.988 +    if ($file !~ m|openpkg-tool|) {
  37.989 +        my $done = ''; my $this = ''; my $todo = $spec;
  37.990 +        while ($todo =~ m/%{l_shtool} (install|subst)(?:\\\n|[^\n])*?-e(?:\\\n|[^\n])*?\@l_(prefix|[smrn](usr|grp|uid|gid))\@[^n]+%{l_\2}/s) {
  37.991 +            $done .= $`; $this = $&; $todo = $';
  37.992 +            &lint_warning($file, $done, $this, "deprecated usage of \"shtool $1 -e \@l_$2\@\" (expected use of %{l_value -s -a})");
  37.993 +            $done .= $this;
  37.994 +        }
  37.995 +    }
  37.996 +
  37.997 +    #   check for constant "root" in %attr
  37.998 +    my $done = ''; my $this = ''; my $todo = $spec;
  37.999 +    while ($todo =~ m/%attr\(\s*(\d+)\s*,\s*root\s*,/s) {
 37.1000 +        $done .= $`; $this = $&; $todo = $';
 37.1001 +        &lint_warning($file, $done, $this, "found constant \"root\" in %attr (expected variable %{l_susr})");
 37.1002 +        $done .= $this;
 37.1003 +    }
 37.1004 +
 37.1005 +    #   check for valid RPM macro usage
 37.1006 +    if ($file !~ m|^(.+/)?openpkg\.spec$|s) {
 37.1007 +        my $ok = `$rpm --eval '\%dump' 2>&1 | egrep "^-*[0-9][0-9]*: l_" | sed -e 's;^[^:]*: *\\(l_[a-zA-Z0-9_]*\\).*;\\1;' | sort -u`;
 37.1008 +        my @ok = split(/\n/, $ok);
 37.1009 +        my $todo = $spec;
 37.1010 +        $todo =~ s|^([a-zA-Z][a-zA-Z0-9]+):\s+(.+)$|push(@ok, lc($1)), ''|mge;
 37.1011 +        $todo =~ s/^\%(?:define|option)\s+(\S+)\s+.+$/push(@ok, $1), ''/mge;
 37.1012 +        my $done = ''; my $this = ''; my $todo = $spec;
 37.1013 +        while ($todo =~ m|\%\{([a-zA-Z][a-zA-Z0-9_]+)|s) {
 37.1014 +            $done .= $`; $this = $&; $todo = $';
 37.1015 +            my $name = $1;
 37.1016 +            next if ($name =~ m/^(SOURCE|PATCH)\d*$/ or $name =~ m/^(expand|echo|warn|error)$/);
 37.1017 +            if (not grep(/^\Q$name\E$/, @ok)) {
 37.1018 +                &lint_error($file, $done, $this, "unknown macro \"\%{$name}\"");
 37.1019 +            }
 37.1020 +            $done .= $this;
 37.1021 +        }
 37.1022 +    }
 37.1023 +}
 37.1024 +
 37.1025 +##  _________________________________________________________________
 37.1026 +##
 37.1027 +##  CHECK "sources": source file consistency
 37.1028 +##  _________________________________________________________________
 37.1029 +##
 37.1030 +
 37.1031 +sub check_sources {
 37.1032 +    my ($file, $spec) = @_;
 37.1033 +
 37.1034 +    ##
 37.1035 +    ##  PREPARATION
 37.1036 +    ##
 37.1037 +
 37.1038 +    my $D = {};
 37.1039 +    my $S = {};
 37.1040 +    my $i = 99;
 37.1041 +
 37.1042 +    #   determine defines values
 37.1043 +    my $done = ''; my $this = ''; my $todo = $spec;
 37.1044 +    while ($todo =~ m/^\%(define|option)\s+(\S+)\s+(.+)\s*$/m) {
 37.1045 +        $done .= $`; $this = $&; $todo = $';
 37.1046 +        my ($var, $val) = ($2, $3);
 37.1047 +        $val =~ s|(\%\{([a-zA-Z_][a-zA-Z0-9_]*)\})|defined($D->{$2}) ? $D->{$2} : $1|sge;
 37.1048 +        $D->{$var} = $val;
 37.1049 +        $done .= $this;
 37.1050 +    }
 37.1051 +    $done = ''; $this = ''; $todo = $spec;
 37.1052 +    while ($todo =~ m/^([a-zA-Z][a-zA-Z0-9_]+):\s+(.*)$/m) {
 37.1053 +        $done .= $`; $this = $&; $todo = $';
 37.1054 +        my ($var, $val) = (lc($1), $2);
 37.1055 +        $val =~ s|(\%\{([a-zA-Z_][a-zA-Z0-9_]*)\})|defined($D->{$2}) ? $D->{$2} : $1|sge;
 37.1056 +        $D->{$var} = $val;
 37.1057 +        $done .= $this;
 37.1058 +    }
 37.1059 +
 37.1060 +    #   expand define values (allow one level of nesting)
 37.1061 +    $spec =~ s|(\%\{([a-zA-Z_][a-zA-Z0-9_]*)\})|defined($D->{$2}) ? $D->{$2} : $1|sge;
 37.1062 +    $spec =~ s|(\%\{([a-zA-Z_][a-zA-Z0-9_]*)\})|defined($D->{$2}) ? $D->{$2} : $1|sge;
 37.1063 +
 37.1064 +    #   parse Source# and Patch# headers
 37.1065 +    $done = ''; $this = ''; $todo = $spec;
 37.1066 +    while ($todo =~ m/^(Source|Patch)(\d+):[ \t]*(.*?)$/m) {
 37.1067 +        $done .= $`; $this = $&; $todo = $';
 37.1068 +        my ($type, $num, $file) = (lc($1), $2, $3);
 37.1069 +        my $url = "";
 37.1070 +        if ($file =~ m|^(.+/)([^/]+)$|s) {
 37.1071 +            ($url, $file) = ($1, $2);
 37.1072 +        }
 37.1073 +        if (not defined($S->{"$type$num"})) {
 37.1074 +            $S->{"$type$num"} = {
 37.1075 +                -type   => $type,
 37.1076 +                -num    => $num,
 37.1077 +                -url    => $url,
 37.1078 +                -file   => $file,
 37.1079 +                -refhdr => 1,
 37.1080 +                -refcmd => 0,
 37.1081 +                -refmac => 0,
 37.1082 +                -refvar => 0,
 37.1083 +            };
 37.1084 +        }
 37.1085 +        else {
 37.1086 +            $S->{"$type$num"}->{-refhdr}++;
 37.1087 +        }
 37.1088 +        $done .= $this;
 37.1089 +    }
 37.1090 +
 37.1091 +    #   parse %setup and %patch commands
 37.1092 +    $done = ''; $this = ''; $todo = $spec;
 37.1093 +    $todo =~ s/^(\s*\%patch)((?:\s+-\S+|\s+-d\s+\S+)*)((?:\s+\d+)+)\s*$/&expand_patch($1, $2, $3)/mge;
 37.1094 +    sub expand_patch {
 37.1095 +        my ($cmd, $opts, $nums) = @_;
 37.1096 +        my $cmds = '';
 37.1097 +        $cmds .= "${cmd}0${opts}\n" if ($opts !~ m|\s+-P|s);
 37.1098 +        $opts =~ s|\s+-P||s;
 37.1099 +        while ($nums =~ s|^\s+(\d+)||) {
 37.1100 +            my $num = $1;
 37.1101 +            $cmds .= "${cmd}${num}${opts}\n";
 37.1102 +        }
 37.1103 +        return $cmds;
 37.1104 +    }
 37.1105 +    while ($todo =~ m/^\s*\%(setup|patch)(\d+)?(\s+.*)?$/m) {
 37.1106 +        $done .= $`; $this = $&; $todo = $';
 37.1107 +        my ($type, $num, $opts) = ($1, $2, $3);
 37.1108 +        $type = 'source' if ($type eq 'setup');
 37.1109 +        my $num_force = '';
 37.1110 +        if ($opts =~ m/\s-(?:a|b)\s*(\d+)/s) {
 37.1111 +            $num_force = $1;
 37.1112 +        }
 37.1113 +        if ($num ne '' and $num_force ne '' and $num ne $num_force) {
 37.1114 +            &lint_warning($file, $done, $this, "macro and enforced $type number conflict: $num <-> $num_force" .
 37.1115 +                        " (expected either just enforced number or make them match)");
 37.1116 +        }
 37.1117 +        $num = $num_force if ($num_force ne '');
 37.1118 +        $num = 0 if ($num eq '');
 37.1119 +        next if ($opts =~ m|\s-T|s and $num == 0);
 37.1120 +        if (not defined($S->{"$type$num"})) {
 37.1121 +            $S->{"$type$num"} = {
 37.1122 +                -type   => $type,
 37.1123 +                -num    => $num,
 37.1124 +                -url    => "",
 37.1125 +                -file   => "",
 37.1126 +                -refhdr => 0,
 37.1127 +                -refcmd => 1,
 37.1128 +                -refmac => 0,
 37.1129 +                -refvar => 0,
 37.1130 +            };
 37.1131 +        }
 37.1132 +        else {
 37.1133 +            $S->{"$type$num"}->{-refcmd}++;
 37.1134 +        }
 37.1135 +        $done .= $this;
 37.1136 +    }
 37.1137 +
 37.1138 +    #   parse %{SOURCE#} and %{PATCH#} macros
 37.1139 +    $done = ''; $this = ''; $todo = $spec;
 37.1140 +    while ($todo =~ m/\%\{(SOURCE|PATCH)(\d+)\}/m) {
 37.1141 +        $done .= $`; $this = $&; $todo = $';
 37.1142 +        my ($type, $num) = (lc($1), $2);
 37.1143 +        if (not defined($S->{"$type$num"})) {
 37.1144 +            $S->{"$type$num"} = {
 37.1145 +                -type   => $type,
 37.1146 +                -num    => $num,
 37.1147 +                -url    => "",
 37.1148 +                -file   => "",
 37.1149 +                -refhdr => 0,
 37.1150 +                -refcmd => 0,
 37.1151 +                -refmac => 1,
 37.1152 +                -refvar => 0,
 37.1153 +            };
 37.1154 +        }
 37.1155 +        else {
 37.1156 +            $S->{"$type$num"}->{-refmac}++;
 37.1157 +        }
 37.1158 +        $done .= $this;
 37.1159 +    }
 37.1160 +
 37.1161 +    #   parse %{SOURCE ...} and %{PATCH ...} macros
 37.1162 +    $done = ''; $this = ''; $todo = $spec;
 37.1163 +    while ($todo =~ m/\%\{(SOURCE|PATCH)\s+([^\s}]+)\}/m) {
 37.1164 +        $done .= $`; $this = $&; $todo = $';
 37.1165 +        my ($type, $file) = (lc($1), $2);
 37.1166 +        my $key = "";
 37.1167 +        foreach my $src (keys(%{$S})) {
 37.1168 +            if ($S->{$src}->{-type} eq $type and $S->{$src}->{-file} eq $file) {
 37.1169 +                $key = $src;
 37.1170 +            }
 37.1171 +        }
 37.1172 +        if ($key eq '') {
 37.1173 +            $S->{"$type$i"} = {
 37.1174 +                -type   => $type,
 37.1175 +                -num    => $i,
 37.1176 +                -url    => "",
 37.1177 +                -file   => $file,
 37.1178 +                -refhdr => 0,
 37.1179 +                -refcmd => 0,
 37.1180 +                -refmac => 1,
 37.1181 +                -refvar => 0,
 37.1182 +            };
 37.1183 +            $i++;
 37.1184 +        }
 37.1185 +        else {
 37.1186 +            $S->{$key}->{-refmac}++;
 37.1187 +        }
 37.1188 +        $done .= $this;
 37.1189 +    }
 37.1190 +
 37.1191 +    #   parse $RPM_SOURCE_DIR based references
 37.1192 +    $done = ''; $this = ''; $todo = $spec;
 37.1193 +    while ($todo =~ m/\$RPM_SOURCE_DIR\/([^\s;"']+)/m) {
 37.1194 +        $done .= $`; $this = $&; $todo = $';
 37.1195 +        my ($file) = ($1);
 37.1196 +        my $key = "";
 37.1197 +        foreach my $src (keys(%{$S})) {
 37.1198 +            if ($S->{$src}->{-file} eq $file) {
 37.1199 +                $key = $src;
 37.1200 +            }
 37.1201 +        }
 37.1202 +        if ($key eq '') {
 37.1203 +            $S->{"source$i"} = {
 37.1204 +                -type   => "source",
 37.1205 +                -num    => $i,
 37.1206 +                -url    => "",
 37.1207 +                -file   => $file,
 37.1208 +                -refhdr => 0,
 37.1209 +                -refcmd => 0,
 37.1210 +                -refmac => 0,
 37.1211 +                -refvar => 1,
 37.1212 +            };
 37.1213 +            $i++;
 37.1214 +        }
 37.1215 +        else {
 37.1216 +            $S->{$key}->{-refmac}++;
 37.1217 +        }
 37.1218 +        $done .= $this;
 37.1219 +    }
 37.1220 +
 37.1221 +    ##
 37.1222 +    ##  CHECKING
 37.1223 +    ##
 37.1224 +
 37.1225 +    #   check reference counts
 37.1226 +    foreach my $src (%{$S}) {
 37.1227 +        my $s = $S->{$src};
 37.1228 +        my $str_hdr = ($s->{-type} eq 'source' ? 'Source' : 'Patch' ) . $s->{-num};
 37.1229 +        my $str_cmd = ($s->{-type} eq 'source' ? '%setup' : '%patch') . $s->{-num};
 37.1230 +        my $str_mac = ($s->{-type} eq 'source' ? '%{SOURCE ...}' : '%{PATCH ...}');
 37.1231 +        my $str_var = "\$RPM_SOURCE_DIR";
 37.1232 +        if ($file !~ m/\b(openpkg-.*|openpkg|vim|ncurses|openssh)\.spec$/) {
 37.1233 +            if ($s->{-refhdr} > 0) {
 37.1234 +                if ($s->{-refcmd} == 0 and $s->{-refmac} == 0 and $s->{-refvar} == 0) {
 37.1235 +                    &lint_error($file, undef, undef, "source \"$str_hdr\" defined (file $s->{-file}), but never used" .
 37.1236 +                                " (expected at least one reference via \"$str_cmd\", \"$str_mac\" or \"$str_var\")");
 37.1237 +                }
 37.1238 +                elsif ($s->{-refcmd} > 1) {
 37.1239 +                    &lint_error($file, undef, undef, "source \"$str_hdr\" defined (file $s->{-file}), but used multiple times" .
 37.1240 +                                " (expected just one reference via \"$str_cmd\")");
 37.1241 +                }
 37.1242 +            }
 37.1243 +            else {
 37.1244 +                if ($s->{-refcmd}+$s->{-refmac}+$s->{-refvar} > 0) {
 37.1245 +                    &lint_error($file, undef, undef, "source \"$str_hdr\" not defined, but used ".
 37.1246 +                                ($s->{-file} ? "(file ".$s->{-file}.")" : "").
 37.1247 +                                " (expected at least one definition via \"$str_hdr\")");
 37.1248 +                }
 37.1249 +            }
 37.1250 +        }
 37.1251 +    }
 37.1252 +
 37.1253 +    #   check for existing of sources on filesystem
 37.1254 +    my $name = $file;
 37.1255 +    $name =~ s|.*/([^/]+)$|$1|s;
 37.1256 +    $name =~ s|\.spec$||s;
 37.1257 +    my $cvsdir = `$rpm --define 'name $name' --eval '%{_specdir}'`;
 37.1258 +    $cvsdir =~ s|\n$||s;
 37.1259 +    $cvsdir =~ s|/+$||s;
 37.1260 +    my $dstdir = `$rpm --define 'name $name' --eval '%{_sourcedir}'`;
 37.1261 +    $dstdir =~ s|\n$||s;
 37.1262 +    $dstdir =~ s|/+$||s;
 37.1263 +    foreach my $src (%{$S}) {
 37.1264 +        my $s = $S->{$src};
 37.1265 +        next if (not $s->{-refhdr});
 37.1266 +        if ($s->{-url} eq '' and not -f $cvsdir."/".$s->{-file} and not -f $dstdir."/".$s->{-file}) {
 37.1267 +            &lint_error($file, undef, undef, "source \"$s->{-file}\" neither found in SRC nor DST locations (you have to provide it)");
 37.1268 +        }
 37.1269 +        elsif ($s->{-url} eq '' and not -f $cvsdir."/".$s->{-file} and -f $dstdir."/".$s->{-file}) {
 37.1270 +            &lint_error($file, undef, undef, "source \"$s->{-file}\" not found in SRC, but in DST (expected it in SRC or want URL)");
 37.1271 +        }
 37.1272 +        elsif ($s->{-url} ne '' and not -f $cvsdir."/".$s->{-file} and not -f $dstdir."/".$s->{-file}) {
 37.1273 +            &lint_error($file, undef, undef, "source \"$s->{-file}\" neither found in SRC nor DST locations (you have to download it)");
 37.1274 +        }
 37.1275 +        elsif ($s->{-url} ne '' and -f $cvsdir."/".$s->{-file} and not -f $dstdir."/".$s->{-file}) {
 37.1276 +            &lint_error($file, undef, undef, "source \"$s->{-file}\" not found in DST, but in SRC (expected it in DST or want URL)");
 37.1277 +        }
 37.1278 +        #if ($s->{-url} ne '' and $s->{-file} !~ m/\d/) {
 37.1279 +        #    &lint_warning($file, undef, undef, "vendor source \"$s->{-file}\" not versioned");
 37.1280 +        #}
 37.1281 +    }
 37.1282 +
 37.1283 +    #   check for patch file naming
 37.1284 +    foreach my $src (%{$S}) {
 37.1285 +        my $s = $S->{$src};
 37.1286 +        next if (not $s->{-refhdr});
 37.1287 +        if (    $s->{-url} eq '' and $s->{-type} eq 'patch'
 37.1288 +            and $s->{-file} !~ m|^${name}\.patch(\.[^./]+)?$|) {
 37.1289 +            &lint_warning($file, undef, undef, "non-canonical patch filename \"$s->{-file}\"" .
 37.1290 +                          " (expected to match \"${name}\\.patch(\\.[^./]+)?\$\")");
 37.1291 +        }
 37.1292 +    }
 37.1293 +}
 37.1294 +
 37.1295 +##  _________________________________________________________________
 37.1296 +##
 37.1297 +##  CHECK "digest": digest consistency
 37.1298 +##  _________________________________________________________________
 37.1299 +##
 37.1300 +
 37.1301 +sub check_digest {
 37.1302 +    my ($file, $spec) = @_;
 37.1303 +
 37.1304 +    ##
 37.1305 +    ##  PREPARATION
 37.1306 +    ##
 37.1307 +
 37.1308 +    my $D = {};
 37.1309 +    my $S = {};
 37.1310 +
 37.1311 +    #   determine defines values
 37.1312 +    my $done = ''; my $this = ''; my $todo = $spec;
 37.1313 +    while ($todo =~ m/^\%(define|option)\s+(\S+)\s+(.+)\s*$/m) {
 37.1314 +        $done .= $`; $this = $&; $todo = $';
 37.1315 +        my ($var, $val) = ($2, $3);
 37.1316 +        $val =~ s|(\%\{([a-zA-Z_][a-zA-Z0-9_]*)\})|defined($D->{$2}) ? $D->{$2} : $1|sge;
 37.1317 +        $D->{$var} = $val;
 37.1318 +        $done .= $this;
 37.1319 +    }
 37.1320 +    $done = ''; $this = ''; $todo = $spec;
 37.1321 +    while ($todo =~ m/^([a-zA-Z][a-zA-Z0-9_]+):\s+(.*)$/m) {
 37.1322 +        $done .= $`; $this = $&; $todo = $';
 37.1323 +        my ($var, $val) = (lc($1), $2);
 37.1324 +        $val =~ s|(\%\{([a-zA-Z_][a-zA-Z0-9_]*)\})|defined($D->{$2}) ? $D->{$2} : $1|sge;
 37.1325 +        $D->{$var} = $val;
 37.1326 +        $done .= $this;
 37.1327 +    }
 37.1328 +
 37.1329 +    #   expand define values (allow one level of nesting)
 37.1330 +    $spec =~ s|(\%\{([a-zA-Z_][a-zA-Z0-9_]*)\})|defined($D->{$2}) ? $D->{$2} : $1|sge;
 37.1331 +    $spec =~ s|(\%\{([a-zA-Z_][a-zA-Z0-9_]*)\})|defined($D->{$2}) ? $D->{$2} : $1|sge;
 37.1332 +
 37.1333 +    #   determine locations
 37.1334 +    my $name = $file;
 37.1335 +    $name =~ s|.*/([^/]+)$|$1|s;
 37.1336 +    $name =~ s|\.spec$||s;
 37.1337 +    my $srcdir = `$rpm --define 'name $name' --eval '%{_specdir}'`;
 37.1338 +    $srcdir =~ s|\n$||s;
 37.1339 +    $srcdir =~ s|/+$||s;
 37.1340 +    my $dstdir = `$rpm --define 'name $name' --eval '%{_sourcedir}'`;
 37.1341 +    $dstdir =~ s|\n$||s;
 37.1342 +    $dstdir =~ s|/+$||s;
 37.1343 +
 37.1344 +    #   parse Source# and Patch# headers
 37.1345 +    $done = ''; $this = ''; $todo = $spec;
 37.1346 +    while ($todo =~ m/^(Source|Patch)(\d+):[ \t]*(.*?)$/m) {
 37.1347 +        $done .= $`; $this = $&; $todo = $';
 37.1348 +        my ($type, $num, $url) = (lc($1), $2, $3);
 37.1349 +        my $file;
 37.1350 +        if ($url =~ m|^.+/([^/]+)$|s) {
 37.1351 +            $file = "$dstdir/$1";
 37.1352 +        }
 37.1353 +        else {
 37.1354 +            $file = "$srcdir/$url";
 37.1355 +        }
 37.1356 +        if (not defined($S->{"$type$num"})) {
 37.1357 +            $S->{"$type$num"} = {
 37.1358 +                -type   => $type,
 37.1359 +                -num    => $num,
 37.1360 +                -url    => $url,
 37.1361 +                -file   => $file
 37.1362 +            };
 37.1363 +        }
 37.1364 +        else {
 37.1365 +            $S->{"$type$num"}->{-refhdr}++;
 37.1366 +        }
 37.1367 +        $done .= $this;
 37.1368 +    }
 37.1369 +
 37.1370 +    #   parse BuildPreReq headers
 37.1371 +    $done = ''; $this = ''; $todo = $spec;
 37.1372 +    while ($todo =~ m/^BuildPreReq:[ \t]+digest\(sha1:\%\{(.+?)\}\)[ \t]+=[ \t]+([0-9a-fA-F]+)$/m) {
 37.1373 +        $done .= $`; $this = $&; $todo = $';
 37.1374 +        my ($macro, $sha1) = ($1, $2);
 37.1375 +
 37.1376 +        my $url = $S->{lc($macro)}->{-url};
 37.1377 +        my $filename = $S->{lc($macro)}->{-file};
 37.1378 +        my $basename = $filename;
 37.1379 +        $basename =~ s/^.+\/([^\/]+)$/$1/s;
 37.1380 +
 37.1381 +        my $sha1_real = `$openssl sha1 $filename 2>/dev/null`;
 37.1382 +        $sha1_real =~ s/^SHA1\s*\(.+?\)\s*=\s*([0-9a-fA-F]+)\s*$/$1/s;
 37.1383 +
 37.1384 +        if (lc($sha1) ne lc($sha1_real)) {
 37.1385 +            &lint_error($file, undef, undef, "source \"$basename\" (\%{$macro}) has a digest(sha1) requirement of \"$sha1\" (expected \"$sha1_real\")");
 37.1386 +        }
 37.1387 +
 37.1388 +        $done .= $this;
 37.1389 +    }
 37.1390 +}
 37.1391 +
    38.1 --- a/openpkg/local.README	Tue Jul 31 12:12:54 2012 +0200
    38.2 +++ b/openpkg/local.README	Tue Jul 31 12:23:42 2012 +0200
    38.3 @@ -1,16 +1,16 @@
    38.4  
    38.5 -  This is @l_prefix@/local/, the manually-managed software package hierarchy
    38.6 -  inside the OpenPKG software hierarchy @l_prefix@. This filesystem area
    38.7 +  This is @l_prefix@/local/, the manually-managed software stack
    38.8 +  inside the OpenPKG instance @l_prefix@. This filesystem area
    38.9    contains software which was manually installed under @l_prefix@/local/PKG/
   38.10    and activated under @l_prefix@/local/ by running:
   38.11  
   38.12    $ @l_prefix@/bin/openpkg lsync
   38.13  
   38.14 -  Use "eval `@l_prefix@/etc/rc --eval all env`" from within a user's
   38.15 -  Bourne (Again) Shell startup script (.profile or .bashrc) in
   38.16 -  order to activate this hierarchy and all of its packages.
   38.17 +  Use "eval `@l_prefix@/bin/openpkg rc --eval all env`" from within a
   38.18 +  user's Bourne (Again) Shell startup script (.profile or .bashrc) in
   38.19 +  order to activate this manual software stack and all of its packages.
   38.20  
   38.21    In case of any questions or problems post to the OpenPKG project
   38.22    user support mailing list <openpkg-users@openpkg.org>. For more
   38.23 -  details about OpenPKG visit http://www.openpkg.org/.
   38.24 +  details about OpenPKG visit http://openpkg.org/.
   38.25  
    39.1 --- a/openpkg/lsync	Tue Jul 31 12:12:54 2012 +0200
    39.2 +++ b/openpkg/lsync	Tue Jul 31 12:23:42 2012 +0200
    39.3 @@ -1,15 +1,14 @@
    39.4  #!@l_prefix@/lib/openpkg/bash
    39.5  ##
    39.6  ##  lsync -- Access Layer Synchronization Tool
    39.7 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    39.8 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    39.9 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
   39.10  ##
   39.11 -##  Permission to use, copy, modify, and distribute this software for
   39.12 -##  any purpose with or without fee is hereby granted, provided that
   39.13 -##  the above copyright notice and this permission notice appear in all
   39.14 -##  copies.
   39.15 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   39.16 +##  All rights reserved. Licenses which grant limited permission to use,
   39.17 +##  copy, modify and distribute this software are available from the
   39.18 +##  OpenPKG GmbH.
   39.19  ##
   39.20 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   39.21 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   39.22  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   39.23  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   39.24  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    40.1 --- a/openpkg/lsync.8	Tue Jul 31 12:12:54 2012 +0200
    40.2 +++ b/openpkg/lsync.8	Tue Jul 31 12:23:42 2012 +0200
    40.3 @@ -1,15 +1,7 @@
    40.4 -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
    40.5 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
    40.6  .\"
    40.7  .\" Standard preamble:
    40.8  .\" ========================================================================
    40.9 -.de Sh \" Subsection heading
   40.10 -.br
   40.11 -.if t .Sp
   40.12 -.ne 5
   40.13 -.PP
   40.14 -\fB\\$1\fR
   40.15 -.PP
   40.16 -..
   40.17  .de Sp \" Vertical space (when we can't use .PP)
   40.18  .if t .sp .5v
   40.19  .if n .sp
   40.20 @@ -25,11 +17,11 @@
   40.21  ..
   40.22  .\" Set up some character translations and predefined strings.  \*(-- will
   40.23  .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   40.24 -.\" double quote, and \*(R" will give a right double quote.  | will give a
   40.25 -.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
   40.26 -.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
   40.27 -.\" expand to `' in nroff, nothing in troff, for use with C<>.
   40.28 -.tr \(*W-|\(bv\*(Tr
   40.29 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
   40.30 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
   40.31 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
   40.32 +.\" nothing in troff, for use with C<>.
   40.33 +.tr \(*W-
   40.34  .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   40.35  .ie n \{\
   40.36  .    ds -- \(*W-
   40.37 @@ -48,22 +40,25 @@
   40.38  .    ds R" ''
   40.39  'br\}
   40.40  .\"
   40.41 +.\" Escape single quotes in literal strings from groff's Unicode transform.
   40.42 +.ie \n(.g .ds Aq \(aq
   40.43 +.el       .ds Aq '
   40.44 +.\"
   40.45  .\" If the F register is turned on, we'll generate index entries on stderr for
   40.46 -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
   40.47 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
   40.48  .\" entries marked with X<> in POD.  Of course, you'll have to process the
   40.49  .\" output yourself in some meaningful fashion.
   40.50 -.if \nF \{\
   40.51 +.ie \nF \{\
   40.52  .    de IX
   40.53  .    tm Index:\\$1\t\\n%\t"\\$2"
   40.54  ..
   40.55  .    nr % 0
   40.56  .    rr F
   40.57  .\}
   40.58 -.\"
   40.59 -.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   40.60 -.\" way too many mistakes in technical documents.
   40.61 -.hy 0
   40.62 -.if n .na
   40.63 +.el \{\
   40.64 +.    de IX
   40.65 +..
   40.66 +.\}
   40.67  .\"
   40.68  .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   40.69  .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   40.70 @@ -130,8 +125,12 @@
   40.71  .\"
   40.72  .IX Title "LSYNC 8"
   40.73  .TH LSYNC 8 "OpenPKG" "LSYNC(8)" "OpenPKG"
   40.74 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   40.75 +.\" way too many mistakes in technical documents.
   40.76 +.if n .ad l
   40.77 +.nh
   40.78  .SH "NAME"
   40.79 -\&\fBopenpkg lsync\fR \- Access Layer Synchronization Tool
   40.80 +openpkg lsync \- Access Layer Synchronization Tool
   40.81  .SH "SYNOPSIS"
   40.82  .IX Header "SYNOPSIS"
   40.83  \&\fBopenpkg lsync\fR
    41.1 --- a/openpkg/lsync.pod	Tue Jul 31 12:12:54 2012 +0200
    41.2 +++ b/openpkg/lsync.pod	Tue Jul 31 12:23:42 2012 +0200
    41.3 @@ -1,14 +1,13 @@
    41.4  ##
    41.5  ##  lsync.pod -- Access Layer Synchronization Tool (Manual Page)
    41.6 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    41.7 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    41.8 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    41.9  ##
   41.10 -##  Permission to use, copy, modify, and distribute this software for
   41.11 -##  any purpose with or without fee is hereby granted, provided that
   41.12 -##  the above copyright notice and this permission notice appear in all
   41.13 -##  copies.
   41.14 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   41.15 +##  All rights reserved. Licenses which grant limited permission to use,
   41.16 +##  copy, modify and distribute this software are available from the
   41.17 +##  OpenPKG GmbH.
   41.18  ##
   41.19 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   41.20 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   41.21  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   41.22  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   41.23  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    42.1 --- a/openpkg/make.patch	Tue Jul 31 12:12:54 2012 +0200
    42.2 +++ b/openpkg/make.patch	Tue Jul 31 12:23:42 2012 +0200
    42.3 @@ -1,7 +1,6 @@
    42.4  Index: glob/glob.c
    42.5 -diff -Nau glob/glob.c.orig glob/glob.c
    42.6 ---- glob/glob.c.orig	2006-03-10 03:20:45 +0100
    42.7 -+++ glob/glob.c	2006-04-01 19:09:18 +0200
    42.8 +--- glob/glob.c.orig	2009-09-28 08:46:03.000000000 +0200
    42.9 ++++ glob/glob.c	2010-07-29 14:25:40.000000000 +0200
   42.10  @@ -217,13 +217,13 @@
   42.11   #  ifdef HAVE_ALLOCA_H
   42.12   #   include <alloca.h>
   42.13 @@ -19,15 +18,14 @@
   42.14   # endif	/* GCC.  */
   42.15   
   42.16  Index: make.h
   42.17 -diff -Nau make.h.orig make.h
   42.18 ---- make.h.orig	2006-02-16 00:54:43 +0100
   42.19 -+++ make.h	2006-04-01 19:09:18 +0200
   42.20 +--- make.h.orig	2010-07-20 15:12:06.000000000 +0200
   42.21 ++++ make.h	2010-07-29 14:27:20.000000000 +0200
   42.22  @@ -36,7 +36,7 @@
   42.23    #pragma alloca
   42.24   # else
   42.25   #  if !defined(__GNUC__) && !defined(WINDOWS32)
   42.26  -#   ifndef alloca /* predefined by HP cc +Olibcalls */
   42.27 -+#   if !defined (alloca) && !defined (__FreeBSD__) /* predefined by HP cc +Olibcalls, part of stdlib.h on FreeBSD */
   42.28 ++#   if !defined(alloca) && !defined(__FreeBSD__) /* predefined by HP cc +Olibcalls, part of stdlib.h on FreeBSD */
   42.29   char *alloca ();
   42.30   #   endif
   42.31   #  endif
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/openpkg/makeproxy.8	Tue Jul 31 12:23:42 2012 +0200
    43.3 @@ -0,0 +1,291 @@
    43.4 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
    43.5 +.\"
    43.6 +.\" Standard preamble:
    43.7 +.\" ========================================================================
    43.8 +.de Sp \" Vertical space (when we can't use .PP)
    43.9 +.if t .sp .5v
   43.10 +.if n .sp
   43.11 +..
   43.12 +.de Vb \" Begin verbatim text
   43.13 +.ft CW
   43.14 +.nf
   43.15 +.ne \\$1
   43.16 +..
   43.17 +.de Ve \" End verbatim text
   43.18 +.ft R
   43.19 +.fi
   43.20 +..
   43.21 +.\" Set up some character translations and predefined strings.  \*(-- will
   43.22 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   43.23 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
   43.24 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
   43.25 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
   43.26 +.\" nothing in troff, for use with C<>.
   43.27 +.tr \(*W-
   43.28 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   43.29 +.ie n \{\
   43.30 +.    ds -- \(*W-
   43.31 +.    ds PI pi
   43.32 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   43.33 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   43.34 +.    ds L" ""
   43.35 +.    ds R" ""
   43.36 +.    ds C` 
   43.37 +.    ds C' 
   43.38 +'br\}
   43.39 +.el\{\
   43.40 +.    ds -- \|\(em\|
   43.41 +.    ds PI \(*p
   43.42 +.    ds L" ``
   43.43 +.    ds R" ''
   43.44 +'br\}
   43.45 +.\"
   43.46 +.\" Escape single quotes in literal strings from groff's Unicode transform.
   43.47 +.ie \n(.g .ds Aq \(aq
   43.48 +.el       .ds Aq '
   43.49 +.\"
   43.50 +.\" If the F register is turned on, we'll generate index entries on stderr for
   43.51 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
   43.52 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   43.53 +.\" output yourself in some meaningful fashion.
   43.54 +.ie \nF \{\
   43.55 +.    de IX
   43.56 +.    tm Index:\\$1\t\\n%\t"\\$2"
   43.57 +..
   43.58 +.    nr % 0
   43.59 +.    rr F
   43.60 +.\}
   43.61 +.el \{\
   43.62 +.    de IX
   43.63 +..
   43.64 +.\}
   43.65 +.\"
   43.66 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   43.67 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   43.68 +.    \" fudge factors for nroff and troff
   43.69 +.if n \{\
   43.70 +.    ds #H 0
   43.71 +.    ds #V .8m
   43.72 +.    ds #F .3m
   43.73 +.    ds #[ \f1
   43.74 +.    ds #] \fP
   43.75 +.\}
   43.76 +.if t \{\
   43.77 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   43.78 +.    ds #V .6m
   43.79 +.    ds #F 0
   43.80 +.    ds #[ \&
   43.81 +.    ds #] \&
   43.82 +.\}
   43.83 +.    \" simple accents for nroff and troff
   43.84 +.if n \{\
   43.85 +.    ds ' \&
   43.86 +.    ds ` \&
   43.87 +.    ds ^ \&
   43.88 +.    ds , \&
   43.89 +.    ds ~ ~
   43.90 +.    ds /
   43.91 +.\}
   43.92 +.if t \{\
   43.93 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   43.94 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
   43.95 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
   43.96 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
   43.97 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
   43.98 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
   43.99 +.\}
  43.100 +.    \" troff and (daisy-wheel) nroff accents
  43.101 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  43.102 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  43.103 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  43.104 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  43.105 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  43.106 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  43.107 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  43.108 +.ds ae a\h'-(\w'a'u*4/10)'e
  43.109 +.ds Ae A\h'-(\w'A'u*4/10)'E
  43.110 +.    \" corrections for vroff
  43.111 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  43.112 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  43.113 +.    \" for low resolution devices (crt and lpr)
  43.114 +.if \n(.H>23 .if \n(.V>19 \
  43.115 +\{\
  43.116 +.    ds : e
  43.117 +.    ds 8 ss
  43.118 +.    ds o a
  43.119 +.    ds d- d\h'-1'\(ga
  43.120 +.    ds D- D\h'-1'\(hy
  43.121 +.    ds th \o'bp'
  43.122 +.    ds Th \o'LP'
  43.123 +.    ds ae ae
  43.124 +.    ds Ae AE
  43.125 +.\}
  43.126 +.rm #[ #] #H #V #F C
  43.127 +.\" ========================================================================
  43.128 +.\"
  43.129 +.IX Title "MAKEPROXY 8"
  43.130 +.TH MAKEPROXY 8 "OpenPKG" "MAKEPROXY(8)" "OpenPKG"
  43.131 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
  43.132 +.\" way too many mistakes in technical documents.
  43.133 +.if n .ad l
  43.134 +.nh
  43.135 +.SH "NAME"
  43.136 +openpkg makeproxy \-\- Make Proxy OpenPKG RPM Package
  43.137 +.SH "SYNOPSIS"
  43.138 +.IX Header "SYNOPSIS"
  43.139 +\&\fBopenpkg makeproxy\fR
  43.140 +[\fB\-h\fR|\fB\-\-help\fR]
  43.141 +[\fB\-V\fR|\fB\-\-version\fR]
  43.142 +[\fB\-d\fR|\fB\-\-debug\fR]
  43.143 +[\fB\-v\fR|\fB\-\-verbose\fR]
  43.144 +[\fB\-m\fR|\fB\-\-master\fR \fImaster-prefix\fR]
  43.145 +[\fB\-s\fR|\fB\-\-slave\fR \fIslave-prefix\fR]
  43.146 +[\fB\-t\fR|\fB\-\-tmpdir\fR \fIdirectory\fR]
  43.147 +[\fB\-o\fR|\fB\-\-output\fR \fIdirectory\fR|\fIslave-package-file\fR|\f(CW\*(C`\-\*(C'\fR]
  43.148 +[\fImaster-package-name\fR|\fImaster-package-file\fR|\f(CW\*(C`\-\*(C'\fR]
  43.149 +.SH "DESCRIPTION"
  43.150 +.IX Header "DESCRIPTION"
  43.151 +\&\fBopenpkg makeproxy\fR creates a \fIproxy\fR binary \fBOpenPKG\fR \s-1RPM\s0 package
  43.152 +for a \fIslave\fR \fBOpenPKG\fR instance by emulating a regular binary
  43.153 +\&\fBOpenPKG\fR \s-1RPM\s0 package from a \fImaster\fR \fBOpenPKG\fR instance.
  43.154 +.PP
  43.155 +A proxy package contains (virtually) the same contents as the regular
  43.156 +package, but in the form of a shadow tree. Such a shadow tree consists
  43.157 +of the same physical directory structure but with all files replaced by
  43.158 +symbolic links pointing to the regular files in the master \fBOpenPKG\fR
  43.159 +instance.
  43.160 +.PP
  43.161 +A proxy package is useful if multiple closely related \fBOpenPKG\fR
  43.162 +instances are installed on the same system. In this case lots of
  43.163 +dependent (and this way required, although not explicitly wanted)
  43.164 +packages have to be installed in \fIevery\fR \fBOpenPKG\fR instance. Think
  43.165 +about packages like \fBopenssl\fR, \fBperl\fR, \fBgcc\fR, etc. This can be both
  43.166 +very time-consuming and become a maintenance nightmare on upgrades.
  43.167 +Instead, you can select a master \fBOpenPKG\fR instance, install those
  43.168 +regular packages physically there only and install simple proxy packages
  43.169 +for them in all other slave \fBOpenPKG\fR instances.
  43.170 +.PP
  43.171 +Keep in mind that this obviously works correctly for packages which
  43.172 +do \fInot\fR have hard-coded dependencies to their \fBOpenPKG\fR instance
  43.173 +(configuration files, etc). For other packages it might also work,
  43.174 +but be at least be warned about side-effects! Additionally, make sure
  43.175 +you always keep proxy packages in sync with the regular package by
  43.176 +recreating the proxy packages after the regular packages have changed.
  43.177 +.SH "SHADOW TREE"
  43.178 +.IX Header "SHADOW TREE"
  43.179 +The shadow tree of a proxy package \fBname\fR contain the following three
  43.180 +types of paths:
  43.181 +.IP "\fIslave-prefix\fR[/\fIdir\fR]" 4
  43.182 +.IX Item "slave-prefix[/dir]"
  43.183 +This is a physical directory for the slave \fBOpenPKG\fR instance, exactly
  43.184 +as it exists in the regular package of the master \fBOpenPKG\fR instance.
  43.185 +.ie n .IP "\fIslave-prefix\fR[/\fIdir\fR]/\fIfile\fR \-> \fIrevdir\fR\*(C`/.prefix\-\*(C'\fBfoo\fR[/\fIdir\fR]/\fIfile\fR" 4
  43.186 +.el .IP "\fIslave-prefix\fR[/\fIdir\fR]/\fIfile\fR \-> \fIrevdir\fR\f(CW\*(C`/.prefix\-\*(C'\fR\fBfoo\fR[/\fIdir\fR]/\fIfile\fR" 4
  43.187 +.IX Item "slave-prefix[/dir]/file -> revdir/.prefix-foo[/dir]/file"
  43.188 +This is a virtual file (symbolic link) for the slave \fBOpenPKG\fR
  43.189 +instance, indirectly pointing to the corresponding file of the regular
  43.190 +package in the master \fBOpenPKG\fR instance. The \fIrevdir\fR is a reverse
  43.191 +path corresponding to \fIdir\fR, i.e., for each sub-directory step in
  43.192 +\&\fIdir\fR it contains a "\f(CW\*(C`../\*(C'\fR" parent directory step.
  43.193 +.ie n .IP "\fIslave-prefix\fR\*(C`/.prefix\-\*(C'\fBfoo\fR \-> \fImaster-prefix\fR" 4
  43.194 +.el .IP "\fIslave-prefix\fR\f(CW\*(C`/.prefix\-\*(C'\fR\fBfoo\fR \-> \fImaster-prefix\fR" 4
  43.195 +.IX Item "slave-prefix/.prefix-foo -> master-prefix"
  43.196 +This is a virtual file (symbolic link) for the slave \fBOpenPKG\fR
  43.197 +instance, directly pointing to the prefix of the master \fBOpenPKG\fR
  43.198 +instance. This allows one to redirect a whole package to
  43.199 +a different \fBOpenPKG\fR instance by manually changing the
  43.200 +\&\fIslave-prefix\fR\f(CW\*(C`/.prefix\-\*(C'\fR\fBfoo\fR symbolic link. The idea is that this
  43.201 +link even could be automatically controlled by a higher-level facility.
  43.202 +.SH "OPTIONS"
  43.203 +.IX Header "OPTIONS"
  43.204 +The following command line options and arguments are supported:
  43.205 +.IP "\fB\-h\fR, \fB\-\-help\fR" 4
  43.206 +.IX Item "-h, --help"
  43.207 +Print the usage message and immediately exit.
  43.208 +.IP "\fB\-V\fR, \fB\-\-version\fR" 4
  43.209 +.IX Item "-V, --version"
  43.210 +Print program version.
  43.211 +.IP "\fB\-v\fR, \fB\-\-verbose\fR" 4
  43.212 +.IX Item "-v, --verbose"
  43.213 +Enable printing of verbose messages on \fIstderr\fR summarizing the internal processing.
  43.214 +.IP "\fB\-d\fR, \fB\-\-debug\fR" 4
  43.215 +.IX Item "-d, --debug"
  43.216 +Enable printing of debug messages on \fIstderr\fR showing the executed shell commands.
  43.217 +.IP "\fB\-m\fR, \fB\-\-master\fR \fImaster-prefix\fR" 4
  43.218 +.IX Item "-m, --master master-prefix"
  43.219 +Set the filesystem path prefix of the \fImaster\fR \fBOpenPKG\fR instance.
  43.220 +If not specified, the prefix is determined from the master package.
  43.221 +.IP "\fB\-s\fR, \fB\-\-slave\fR \fIslave-prefix\fR" 4
  43.222 +.IX Item "-s, --slave slave-prefix"
  43.223 +Set the filesystem path prefix of the \fIslave\fR \fBOpenPKG\fR instance.
  43.224 +If not specified, the prefix defaults to the prefix of
  43.225 +the \fBOpenPKG\fR instance the \f(CW\*(C`openpkg makeproxy\*(C'\fR command is run from.
  43.226 +.IP "\fB\-t\fR, \fB\-\-tmpdir\fR \fIdirectory\fR" 4
  43.227 +.IX Item "-t, --tmpdir directory"
  43.228 +Set a particular temporary directory. The default is \f(CW$TMPDIR\fR or
  43.229 +\&\f(CW\*(C`/tmp\*(C'\fR (in that order).
  43.230 +.ie n .IP "\fB\-o\fR, \fB\-\-output\fR \fIdirectory\fR|\fIslave-package-file\fR|\*(C`\-\*(C'" 4
  43.231 +.el .IP "\fB\-o\fR, \fB\-\-output\fR \fIdirectory\fR|\fIslave-package-file\fR|\f(CW\*(C`\-\*(C'\fR" 4
  43.232 +.IX Item "-o, --output directory|slave-package-file|-"
  43.233 +Set the location where to write the output proxy \s-1RPM\s0 package for the
  43.234 +slave \fBOpenPKG\fR instance. The argument "\f(CW\*(C`\-\*(C'\fR" indicates that the output
  43.235 +proxy \s-1RPM\s0 package is written to \fIstdout\fR. The default is "\f(CW\*(C`.\*(C'\fR" (the
  43.236 +current working directory). If the output location is a directory and
  43.237 +the regular \s-1RPM\s0 package of the master \fBOpenPKG\fR instance is named
  43.238 +"\fIname\fR\f(CW\*(C`\-\*(C'\fR\fIversion\fR\f(CW\*(C`\-\*(C'\fR\fIrelease\fR\f(CW\*(C`.\*(C'\fR\fIarch\fR\f(CW\*(C`\-\*(C'\fR\fIos\fR\f(CW\*(C`\-\*(C'\fR\fItag1\fR\f(CW\*(C`.rp
  43.239 +m\*(C'\fR\*(L", then the output proxy \s-1RPM\s0 package is named
  43.240 +\&\*(R"\fIname\fR\f(CW\*(C`\-\*(C'\fR\fIversion\fR\f(CW\*(C`\-\*(C'\fR\fIrelease\fR\f(CW\*(C`+PROXY\*(C'\fR\f(CW\*(C`.\*(C'\fR\fIarch\fR\f(CW\*(C`\-\*(C'\fR\fIos\fR\f(CW\*(C`\-\*(C'\fR\fIt
  43.241 +ag2\fR\f(CW\*(C`.rpm\*(C'\fR" in the output directory (\fItag1\fR and \fItag2\fR are the tags
  43.242 +of the master and slave \fBOpenPKG\fR instances).
  43.243 +.ie n .IP "\fImaster-package-file\fR|\*(C`\-\*(C'" 4
  43.244 +.el .IP "\fImaster-package-file\fR|\f(CW\*(C`\-\*(C'\fR" 4
  43.245 +.IX Item "master-package-file|-"
  43.246 +Set the location where to read the input regular \s-1RPM\s0 package. The
  43.247 +special argument "\f(CW\*(C`\-\*(C'\fR" indicates that the input regular \s-1RPM\s0 package is
  43.248 +read from \fIstdin\fR (the default).
  43.249 +.SH "EXAMPLE"
  43.250 +.IX Header "EXAMPLE"
  43.251 +Assume you have three \fBOpenPKG\fR instances on a system: \f(CW\*(C`/usr/opkg\*(C'\fR
  43.252 +(the master instance), \f(CW\*(C`/v/foo/sw\*(C'\fR (a project instance) and \f(CW\*(C`/v/bar/sw\*(C'\fR
  43.253 +(another project instance). Now let us install the \fBOpenPKG\fR \fBbash\fR package in
  43.254 +all three locations, but only once physically.
  43.255 +.PP
  43.256 +.Vb 5
  43.257 +\& # build and install regular binary RPM package for /usr/opkg
  43.258 +\& $ /usr/opkg/bin/openpkg rpm \-\-rebuild \e
  43.259 +\&    bash\-3.1.17\-20060622.src.rpm
  43.260 +\& $ /usr/opkg/bin/openpkg rpm \-Uvh \e
  43.261 +\&   /usr/opkg/RPM/PKG/bash\-3.1.17\-20060622.*.rpm
  43.262 +\&
  43.263 +\& # build and install proxy RPM package for /v/foo/sw
  43.264 +\& # (using the regular binary RPM package of /usr/opkg)
  43.265 +\& $ /v/foo/sw/bin/openpkg makeproxy \-\-output=/v/foo/RPM/PKG/ \e
  43.266 +\&   /usr/opkg/RPM/PKG/bash\-3.1.17\-20060622.*.rpm
  43.267 +\& $ /v/foo/sw/bin/openpkg rpm \-Uvh \e
  43.268 +\&   /v/foo/RPM/PKG/bash\-3.1.17\-20060622+PROXY.*.rpm
  43.269 +\&
  43.270 +\& # build and install proxy RPM package for /v/bar/sw
  43.271 +\& # (using the installed package of /usr/opkg)
  43.272 +\& $ /v/bar/sw/bin/openpkg makeproxy \-\-output=/v/bar/RPM/PKG/ \e
  43.273 +\&   \-\-master=/usr/opkg bash
  43.274 +\& $ /v/bar/sw/bin/openpkg rpm \-Uvh \e
  43.275 +\&   /v/bar/RPM/PKG/bash\-3.1.17\-20060622+PROXY.*.rpm
  43.276 +.Ve
  43.277 +.SH "SEE ALSO"
  43.278 +.IX Header "SEE ALSO"
  43.279 +\&\fBOpenPKG\fR http://www.openpkg.org/,
  43.280 +\&\fBopenpkg rpm\fR, \fIln\fR\|(1).
  43.281 +.SH "HISTORY"
  43.282 +.IX Header "HISTORY"
  43.283 +\&\fBopenpkg makeproxy\fR was developed in February 2002 by Ralf S.
  43.284 +Engelschall <rse@engelschall.com> for the \fBOpenPKG\fR
  43.285 +project after an idea for virtual packages by Thomas Lotterer
  43.286 +<thomas@lotterer.net>. The implementation was completely
  43.287 +worked off in August 2006.
  43.288 +.SH "AUTHOR"
  43.289 +.IX Header "AUTHOR"
  43.290 +.Vb 3
  43.291 +\& Ralf S. Engelschall
  43.292 +\& rse@engelschall.com
  43.293 +\& www.engelschall.com
  43.294 +.Ve
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/openpkg/makeproxy.pl	Tue Jul 31 12:23:42 2012 +0200
    44.3 @@ -0,0 +1,411 @@
    44.4 +##
    44.5 +##  makeproxy.pl -- OpenPKG Tool Chain
    44.6 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    44.7 +##
    44.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    44.9 +##  All rights reserved. Licenses which grant limited permission to use,
   44.10 +##  copy, modify and distribute this software are available from the
   44.11 +##  OpenPKG GmbH.
   44.12 +##
   44.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   44.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   44.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   44.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   44.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   44.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   44.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   44.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   44.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   44.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   44.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   44.24 +##  SUCH DAMAGE.
   44.25 +##
   44.26 +
   44.27 +require 5.003;
   44.28 +
   44.29 +#   OpenPKG instance prefix and RPM
   44.30 +my $my_prefix = $ENV{'OPENPKG_PREFIX'};
   44.31 +my $my_rpm    = "$my_prefix/bin/openpkg rpm";
   44.32 +delete $ENV{'OPENPKG_PREFIX'};
   44.33 +
   44.34 +#   program identification
   44.35 +my $progname  = "makeproxy";
   44.36 +my $progvers  = "2.1.0";
   44.37 +
   44.38 +#   parameters (defaults)
   44.39 +my $help          = 0;
   44.40 +my $version       = 0;
   44.41 +my $verbose       = 0;
   44.42 +my $debug         = 0;
   44.43 +my $slave_prefix  = $my_prefix;
   44.44 +my $master_prefix = '';
   44.45 +my $tmpdir        = ($ENV{TMPDIR} || "/tmp");
   44.46 +my $output        = '.';
   44.47 +my $input         = '-';
   44.48 +
   44.49 +#   cleanup support
   44.50 +my @cleanup = ();
   44.51 +sub cleanup_remember {
   44.52 +    my ($cmd) = @_;
   44.53 +    push(@cleanup, $cmd);
   44.54 +}
   44.55 +sub cleanup_perform {
   44.56 +    foreach my $cmd (reverse @cleanup) {
   44.57 +        runcmd($cmd);
   44.58 +    }
   44.59 +}
   44.60 +
   44.61 +#   exception handling support
   44.62 +$SIG{__DIE__} = sub {
   44.63 +    my ($err) = @_;
   44.64 +    $err =~ s|\s+at\s+.*||s if (not $verbose);
   44.65 +    $err =~ s/\n+$//s;
   44.66 +    print STDERR "openpkg:$progname:ERROR: $err\n";
   44.67 +    cleanup_perform() if (not $verbose);
   44.68 +    exit(1);
   44.69 +};
   44.70 +
   44.71 +#   verbose message printing
   44.72 +sub verbose {
   44.73 +    my ($msg) = @_;
   44.74 +    print STDERR "$msg\n" if ($verbose);
   44.75 +}
   44.76 +
   44.77 +#   execution of external commands
   44.78 +sub runcmd {
   44.79 +    my ($cmd) = @_;
   44.80 +    if ($cmd =~ m/^(.+)\|$/s) {
   44.81 +        print STDERR "\$ $1\n" if ($debug);
   44.82 +        return `$1`;
   44.83 +    }
   44.84 +    else {
   44.85 +        print STDERR "\$ $cmd\n" if ($debug);
   44.86 +        $cmd = "($cmd) >/dev/null 2>&1" if (not $debug);
   44.87 +        return (system($cmd) == 0);
   44.88 +    }
   44.89 +}
   44.90 +
   44.91 +#   expand into a full filesystem path
   44.92 +sub fullpath {
   44.93 +    my ($prog) = @_;
   44.94 +    my $fullprog = '';
   44.95 +    foreach my $path (split(/:/, $ENV{PATH})) {
   44.96 +        if (-x "$path/$prog") {
   44.97 +            $fullprog = "$path/$prog";
   44.98 +            last;
   44.99 +        }
  44.100 +    }
  44.101 +    return $fullprog;
  44.102 +}
  44.103 +
  44.104 +#   convert a subdirectory (a/b/c/)
  44.105 +#   into a corresponding reverse path (../../../)
  44.106 +sub sub2rev {
  44.107 +    my ($sub) = @_;
  44.108 +    my $rev = '';
  44.109 +    $sub =~ s|^/+||s;
  44.110 +    $sub =~ s|/+$||s;
  44.111 +    while ($sub =~ s|/[^/]+||) {
  44.112 +        $rev .= "../";
  44.113 +    }
  44.114 +    if ($sub ne '') {
  44.115 +        $rev .= "../";
  44.116 +    }
  44.117 +    $rev =~ s|/$||s;
  44.118 +    return $rev;
  44.119 +}
  44.120 +
  44.121 +#   create a directory (plus its missing parent dirs)
  44.122 +sub mkdirp {
  44.123 +    my ($dir) = @_;
  44.124 +    my $pdir = $dir;
  44.125 +    $pdir =~ s|/[^/]*$||s;
  44.126 +    if (not -d $pdir) {
  44.127 +        mkdirp($pdir);
  44.128 +    }
  44.129 +    if (not -d $dir) {
  44.130 +        runcmd("mkdir $dir");
  44.131 +    }
  44.132 +}
  44.133 +
  44.134 +#   home-brewn getopt(3) style option parser
  44.135 +sub getopts ($) {
  44.136 +    my ($opts) = @_;
  44.137 +    my (%optf) = map { m/(\w)/; $1 => $_ } $opts =~ m/(\w:|\w)/g;
  44.138 +    my (%opts, @argv, $optarg);
  44.139 +
  44.140 +    foreach (@ARGV) {
  44.141 +        if (@argv) {
  44.142 +            push @argv, $_;
  44.143 +        } elsif (defined $optarg) {
  44.144 +            if (exists $opts{$optarg}) {
  44.145 +                $opts{$optarg} .= " $_";
  44.146 +            } else {
  44.147 +                $opts{$optarg} = $_;
  44.148 +            }
  44.149 +            $optarg = undef;
  44.150 +        } elsif (!/^[-]/) {
  44.151 +            push @argv, $_;
  44.152 +        } else {
  44.153 +            while (/^\-(\w)(.*)/) {
  44.154 +                if (exists $optf{$1}) {
  44.155 +                    if (length($optf{$1}) > 1) {
  44.156 +                        if ($2 ne '') {
  44.157 +                            if (exists $opts{$1}) {
  44.158 +                                $opts{$1} .= " $2";
  44.159 +                            } else {
  44.160 +                                $opts{$1} = $2;
  44.161 +                            }
  44.162 +                        } else {
  44.163 +                            $optarg = $1;
  44.164 +                        }
  44.165 +                        last;
  44.166 +                    } else {
  44.167 +                        $opts{$1} = 1;
  44.168 +                    }
  44.169 +                } else {
  44.170 +                    warn "openpkg:makeproxy:WARNING: unknown option $_\n";
  44.171 +                }
  44.172 +                $_ = "-$2";
  44.173 +            }
  44.174 +        }
  44.175 +    }
  44.176 +    if (defined $optarg) {
  44.177 +        warn "openpkg:makeproxy:WARNING: option $optarg requires an argument\n";
  44.178 +    }
  44.179 +    foreach (keys %opts) {
  44.180 +        eval '$opt_'.$_.' = "'.quotemeta($opts{$_}).'";';
  44.181 +    }
  44.182 +    @ARGV = @argv;
  44.183 +}
  44.184 +
  44.185 +#   command line parsing
  44.186 +getopts("Vhdvm:s:t:o:");
  44.187 +$version       = $opt_V if (defined $opt_V);
  44.188 +$help          = $opt_h if (defined $opt_h);
  44.189 +$debug         = $opt_d if (defined $opt_d);
  44.190 +$verbose       = $opt_v if (defined $opt_v);
  44.191 +$master_prefix = $opt_m if (defined $opt_m);
  44.192 +$slave_prefix  = $opt_s if (defined $opt_s);
  44.193 +$tmpdir        = $opt_t if (defined $opt_t);
  44.194 +$output        = $opt_o if (defined $opt_o);
  44.195 +if ($help) {
  44.196 +    print "Usage: openpkg $progname [options] master-package\n" .
  44.197 +          " -h,--help          print this usage page\n" .
  44.198 +          " -V,--version       print version\n" .
  44.199 +          " -v,--verbose       print verbose run-time information\n" .
  44.200 +          " -d,--debug         print debug information\n" .
  44.201 +          " -m,--master=DIR    filesystem path to master OpenPKG instance\n" .
  44.202 +          " -s,--slave=DIR     filesystem path to slave OpenPKG instance\n" .
  44.203 +          " -t,--tmpdir=DIR    filesystem path to temporary directory\n" .
  44.204 +          " -o,--output=FILE   filesystem path to output proxy OpenPKG RPM package\n";
  44.205 +    exit(0);
  44.206 +}
  44.207 +if ($version) {
  44.208 +    print "OpenPKG $progname $progvers\n";
  44.209 +    exit(0);
  44.210 +}
  44.211 +if ($#ARGV == 0) {
  44.212 +    $input = shift(@ARGV);
  44.213 +}
  44.214 +if ($#ARGV != -1) {
  44.215 +    die "invalid number of command line arguments";
  44.216 +}
  44.217 +
  44.218 +#   prepare temporary location
  44.219 +verbose("++ prepare temporary directory");
  44.220 +$tmpdir = "$tmpdir/$progname.$$";
  44.221 +if (not -d $tmpdir) {
  44.222 +    runcmd("umask 077 && mkdir $tmpdir")
  44.223 +        or die "cannot create temporary directory \"$tmpdir\"";
  44.224 +    cleanup_remember("rm -rf $tmpdir");
  44.225 +}
  44.226 +verbose("-- temporary directory: $tmpdir");
  44.227 +
  44.228 +#   determine input and output RPM
  44.229 +verbose("++ determining OpenPKG RPM package files");
  44.230 +verbose("-- input/master/regular RPM package: $input");
  44.231 +verbose("-- output/slave/proxy   RPM package: $output");
  44.232 +
  44.233 +#   ensure input RPM package is available on the filesystem
  44.234 +if ($input eq '-') {
  44.235 +    $input = "$tmpdir/input.rpm";
  44.236 +    runcmd("cat >$input");
  44.237 +}
  44.238 +
  44.239 +#   determine master and slave OpenPKG instance and RPM commands
  44.240 +if ($master_prefix eq '') {
  44.241 +    if (not -f $input) {
  44.242 +        die "input/master/regular RPM package does not exist: \"$input\"";
  44.243 +    }
  44.244 +    $master_prefix = runcmd("($my_rpm -qp --qf '%{PREFIXES}' $input 2>/dev/null || true) |");
  44.245 +    $master_prefix =~ s/\r?\n$//s;
  44.246 +    if ($master_prefix eq '') {
  44.247 +        die "unable to determine master OpenPKG instance";
  44.248 +    }
  44.249 +}
  44.250 +if ($master_prefix eq $slave_prefix) {
  44.251 +    die "master and slave OpenPKG instances have to be different";
  44.252 +}
  44.253 +my $slave_rpm  = (-f "$slave_prefix/bin/openpkg"  ? "$slave_prefix/bin/openpkg rpm"  : $my_rpm);
  44.254 +my $master_rpm = (-f "$master_prefix/bin/openpkg" ? "$master_prefix/bin/openpkg rpm" : $my_rpm);
  44.255 +verbose("-- tool   OpenPKG instance:    $my_prefix");
  44.256 +verbose("-- tool   OpenPKG RPM command: $my_rpm");
  44.257 +verbose("-- master OpenPKG instance:    $master_prefix");
  44.258 +verbose("-- master OpenPKG RPM command: $master_rpm");
  44.259 +verbose("-- slave  OpenPKG instance:    $slave_prefix");
  44.260 +verbose("-- slave  OpenPKG RPM command: $slave_rpm");
  44.261 +
  44.262 +#   helper function for parsing RPM query outputs
  44.263 +sub parseresponse {
  44.264 +    my ($r, $o) = @_;
  44.265 +    sub parseline {
  44.266 +        my ($r, $t, $k, $v) = @_;
  44.267 +        $v =~ s|^\s+||s;
  44.268 +        $v =~ s|\s+$||s;
  44.269 +        if ($t eq 'S') {     # single-value results
  44.270 +            $r->{$k} = $v;
  44.271 +        }
  44.272 +        elsif ($t eq 'M') {  # multi-value results
  44.273 +            $r->{$k} = [] if (not defined($r->{$k}));
  44.274 +            push(@{$r->{$k}}, $v);
  44.275 +        }
  44.276 +    }
  44.277 +    $o =~ s|([SM])-([^:]+):<(.*?)>\n|parseline($r, $1, $2, $3, '')|egs;
  44.278 +    return $r;
  44.279 +}
  44.280 +
  44.281 +#   query master OpenPKG RPM package
  44.282 +verbose("++ query information from master OpenPKG RPM package");
  44.283 +my $q = '';
  44.284 +foreach my $t (qw(
  44.285 +    NAME SUMMARY URL VENDOR PACKAGER DISTRIBUTION CLASS GROUP LICENSE VERSION RELEASE
  44.286 +    DESCRIPTION
  44.287 +)) {
  44.288 +    $q .= "S-$t:<%{$t}>\\n";
  44.289 +}
  44.290 +$q .= '[M-PREREQ:<%{REQUIRENAME} %|REQUIREFLAGS?{%{REQUIREFLAGS:depflags} %{REQUIREVERSION}}:{}|>\n]';
  44.291 +$q .= '[M-PROVIDES:<%{PROVIDENAME} %|PROVIDEFLAGS?{%{PROVIDEFLAGS:depflags} %{PROVIDEVERSION}}:{}|>\n]';
  44.292 +$q .= '[M-PREFIXES:<%{PREFIXES}>\n]';
  44.293 +my $cmd = sprintf("%s -q %s --qf '$q' %s", $master_rpm, (-f $input ? "-p" : ""), $input);
  44.294 +my $o = runcmd("$cmd|");
  44.295 +if ($o =~ m/package .* is not installed/s) {
  44.296 +    die "master package \"$input\" not installed in master OpenPKG instance \"$master_prefix\"";
  44.297 +}
  44.298 +$o =~ s|M-PREREQ:<rpmlib\(.*?\).*?>\n||gs;
  44.299 +my $r = {};
  44.300 +$r = parseresponse($r, $o);
  44.301 +my $BD = '';
  44.302 +my $ID = '';
  44.303 +my $PR = '';
  44.304 +foreach my $d (@{$r->{PREREQ}}) {
  44.305 +    if ($d =~ m|^OpenPKG|i) {
  44.306 +        $BD .= ", " if ($BD ne '');
  44.307 +        $BD .= $d;
  44.308 +    }
  44.309 +    $ID .= ", " if ($ID ne '');
  44.310 +    $ID .= $d;
  44.311 +}
  44.312 +foreach my $d (@{$r->{PROVIDES}}) {
  44.313 +    $PR .= ", " if ($PR ne '');
  44.314 +    $PR .= $d;
  44.315 +}
  44.316 +
  44.317 +#   prepare build environment
  44.318 +verbose("++ establishing temporary OpenPKG RPM environment");
  44.319 +verbose("-- directory: $tmpdir");
  44.320 +runcmd("rm -rf $tmpdir/src; mkdir $tmpdir/src");
  44.321 +runcmd("rm -rf $tmpdir/bld; mkdir $tmpdir/bld");
  44.322 +cleanup_remember("rm -rf $tmpdir/src");
  44.323 +cleanup_remember("rm -rf $tmpdir/tmp");
  44.324 +cleanup_remember("rm -rf $tmpdir/bld");
  44.325 +cleanup_remember("rm -rf $tmpdir/pkg");
  44.326 +runcmd("mkdir $tmpdir/src/.openpkg");
  44.327 +open(MACRO, ">$tmpdir/src/.openpkg/rpmmacros")
  44.328 +    or die "unable to write file \"$tmpdir/src/.openpkg/rpmmacros\": $!";
  44.329 +print MACRO "\%openpkg_layout macrosfile=\%{macrosfile} layout=local shared=no\n";
  44.330 +close(MACRO);
  44.331 +$ENV{HOME} = $tmpdir;
  44.332 +
  44.333 +#   generate OpenPKG RPM .spec file for proxy OpenPKG RPM package
  44.334 +verbose("++ generating OpenPKG RPM package specification for proxy package");
  44.335 +verbose("-- file: $tmpdir/src/".$r->{NAME}.".spec");
  44.336 +my $S = '';
  44.337 +$S .= "Name:         ".$r->{NAME}."\n";
  44.338 +$S .= "Summary:      ".$r->{SUMMARY}."\n";
  44.339 +$S .= "URL:          ".$r->{URL}."\n";
  44.340 +$S .= "Vendor:       ".$r->{VENDOR}."\n";
  44.341 +$S .= "Packager:     ".$r->{PACKAGER}."\n";
  44.342 +$S .= "Distribution: ".$r->{DISTRIBUTION}."\n";
  44.343 +$S .= "Class:        ".$r->{CLASS}."\n";
  44.344 +$S .= "Group:        ".$r->{GROUP}."\n";
  44.345 +$S .= "License:      ".$r->{LICENSE}."\n";
  44.346 +$S .= "Version:      ".$r->{VERSION}."\n";
  44.347 +$S .= "Release:      ".$r->{RELEASE}."+PROXY\n";
  44.348 +$S .= "\n";
  44.349 +$S .= "BuildPreReq:  $BD\n" if ($BD ne '');
  44.350 +$S .= "PreReq:       $ID\n" if ($ID ne '');
  44.351 +$S .= "Provides:     $PR\n" if ($PR ne '');
  44.352 +$S .= "\n";
  44.353 +$S .= "\%description\n";
  44.354 +$S .= "    ".$r->{DESCRIPTION}."\n";
  44.355 +$S .= "\n";
  44.356 +$S .= "\%install\n";
  44.357 +$S .= "    \%{l_rpmtool} files -v -ofiles -r\$RPM_BUILD_ROOT \%{l_files_std}\n";
  44.358 +$S .= "\n";
  44.359 +$S .= "\%files -f files\n";
  44.360 +$S .= "\n";
  44.361 +open(SPEC, ">$tmpdir/src/".$r->{NAME}.".spec")
  44.362 +   or die "unable to write file \"$tmpdir/src/".$r->{NAME}."\": $!";
  44.363 +print SPEC $S;
  44.364 +close(SPEC);
  44.365 +
  44.366 +#   creating shadow tree of original contents
  44.367 +verbose("++ creating shadow tree from original package contents");
  44.368 +$q = '[%{FILEMODES:perms} %{FILENAMES}\n]';
  44.369 +$cmd = sprintf("%s -q %s --qf '$q' '%s'", $master_rpm, (-f $input ? "-p" : ""), $input);
  44.370 +my @FL = runcmd("$cmd|");
  44.371 +my $FD = [];
  44.372 +my $FR = [];
  44.373 +foreach my $fl (@FL) {
  44.374 +    $fl =~ s|\n$||s;
  44.375 +    if ($fl =~ m|^(d\S+)\s+$master_prefix(.*)$|) {
  44.376 +        mkdirp("$tmpdir/bld$slave_prefix$2");
  44.377 +        verbose("-- | PHYS $1 $slave_prefix$2");
  44.378 +    }
  44.379 +    elsif ($fl =~ m|^(\S+)\s+$master_prefix(.*?)([^/\s]+)$|) {
  44.380 +        my ($subdir, $file) = ($2, $3);
  44.381 +        my $target = sub2rev($subdir)."/.prefix-".$r->{NAME}.$subdir.$file;
  44.382 +        mkdirp("$tmpdir/bld$slave_prefix$subdir");
  44.383 +        runcmd("ln -s $target $tmpdir/bld$slave_prefix$subdir$file");
  44.384 +        verbose("-- | VIRT $1 $slave_prefix$subdir$file");
  44.385 +    }
  44.386 +}
  44.387 +
  44.388 +#   create master-reference symbolic link
  44.389 +runcmd("ln -s $master_prefix $tmpdir/bld$slave_prefix/.prefix-".$r->{NAME});
  44.390 +
  44.391 +#   rolling output proxy RPM package
  44.392 +verbose("++ rolling output proxy RPM package");
  44.393 +runcmd(
  44.394 +    "cd $tmpdir/src && " .
  44.395 +    "$slave_rpm -bb " .
  44.396 +    "--define 'buildroot $tmpdir/bld' " .
  44.397 +    "--define '__spec_install_pre \%{___build_pre}' " .
  44.398 +    "--nodeps ".$r->{NAME}.".spec"
  44.399 +);
  44.400 +
  44.401 +#   providing output
  44.402 +verbose("++ providing output: $output");
  44.403 +if ($output eq '-') {
  44.404 +    runcmd("cat $tmpdir/src/*.rpm");
  44.405 +}
  44.406 +else {
  44.407 +    runcmd("cp $tmpdir/src/*.rpm $output");
  44.408 +}
  44.409 +
  44.410 +#   die gracefully...
  44.411 +verbose("++ cleaning up environment");
  44.412 +cleanup_perform();
  44.413 +exit(0);
  44.414 +
    45.1 --- a/openpkg/man.sh	Tue Jul 31 12:12:54 2012 +0200
    45.2 +++ b/openpkg/man.sh	Tue Jul 31 12:23:42 2012 +0200
    45.3 @@ -1,15 +1,14 @@
    45.4  #!@l_prefix@/lib/openpkg/bash
    45.5  ##
    45.6  ##  man -- OpenPKG Tool Chain "man" command
    45.7 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    45.8 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    45.9 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
   45.10  ##
   45.11 -##  Permission to use, copy, modify, and distribute this software for
   45.12 -##  any purpose with or without fee is hereby granted, provided that
   45.13 -##  the above copyright notice and this permission notice appear in all
   45.14 -##  copies.
   45.15 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   45.16 +##  All rights reserved. Licenses which grant limited permission to use,
   45.17 +##  copy, modify and distribute this software are available from the
   45.18 +##  OpenPKG GmbH.
   45.19  ##
   45.20 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   45.21 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   45.22  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   45.23  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   45.24  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/openpkg/mirror.8	Tue Jul 31 12:23:42 2012 +0200
    46.3 @@ -0,0 +1,227 @@
    46.4 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
    46.5 +.\"
    46.6 +.\" Standard preamble:
    46.7 +.\" ========================================================================
    46.8 +.de Sp \" Vertical space (when we can't use .PP)
    46.9 +.if t .sp .5v
   46.10 +.if n .sp
   46.11 +..
   46.12 +.de Vb \" Begin verbatim text
   46.13 +.ft CW
   46.14 +.nf
   46.15 +.ne \\$1
   46.16 +..
   46.17 +.de Ve \" End verbatim text
   46.18 +.ft R
   46.19 +.fi
   46.20 +..
   46.21 +.\" Set up some character translations and predefined strings.  \*(-- will
   46.22 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   46.23 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
   46.24 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
   46.25 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
   46.26 +.\" nothing in troff, for use with C<>.
   46.27 +.tr \(*W-
   46.28 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   46.29 +.ie n \{\
   46.30 +.    ds -- \(*W-
   46.31 +.    ds PI pi
   46.32 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   46.33 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   46.34 +.    ds L" ""
   46.35 +.    ds R" ""
   46.36 +.    ds C` 
   46.37 +.    ds C' 
   46.38 +'br\}
   46.39 +.el\{\
   46.40 +.    ds -- \|\(em\|
   46.41 +.    ds PI \(*p
   46.42 +.    ds L" ``
   46.43 +.    ds R" ''
   46.44 +'br\}
   46.45 +.\"
   46.46 +.\" Escape single quotes in literal strings from groff's Unicode transform.
   46.47 +.ie \n(.g .ds Aq \(aq
   46.48 +.el       .ds Aq '
   46.49 +.\"
   46.50 +.\" If the F register is turned on, we'll generate index entries on stderr for
   46.51 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
   46.52 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   46.53 +.\" output yourself in some meaningful fashion.
   46.54 +.ie \nF \{\
   46.55 +.    de IX
   46.56 +.    tm Index:\\$1\t\\n%\t"\\$2"
   46.57 +..
   46.58 +.    nr % 0
   46.59 +.    rr F
   46.60 +.\}
   46.61 +.el \{\
   46.62 +.    de IX
   46.63 +..
   46.64 +.\}
   46.65 +.\"
   46.66 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   46.67 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   46.68 +.    \" fudge factors for nroff and troff
   46.69 +.if n \{\
   46.70 +.    ds #H 0
   46.71 +.    ds #V .8m
   46.72 +.    ds #F .3m
   46.73 +.    ds #[ \f1
   46.74 +.    ds #] \fP
   46.75 +.\}
   46.76 +.if t \{\
   46.77 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   46.78 +.    ds #V .6m
   46.79 +.    ds #F 0
   46.80 +.    ds #[ \&
   46.81 +.    ds #] \&
   46.82 +.\}
   46.83 +.    \" simple accents for nroff and troff
   46.84 +.if n \{\
   46.85 +.    ds ' \&
   46.86 +.    ds ` \&
   46.87 +.    ds ^ \&
   46.88 +.    ds , \&
   46.89 +.    ds ~ ~
   46.90 +.    ds /
   46.91 +.\}
   46.92 +.if t \{\
   46.93 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   46.94 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
   46.95 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
   46.96 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
   46.97 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
   46.98 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
   46.99 +.\}
  46.100 +.    \" troff and (daisy-wheel) nroff accents
  46.101 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  46.102 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  46.103 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  46.104 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  46.105 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  46.106 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  46.107 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  46.108 +.ds ae a\h'-(\w'a'u*4/10)'e
  46.109 +.ds Ae A\h'-(\w'A'u*4/10)'E
  46.110 +.    \" corrections for vroff
  46.111 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  46.112 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  46.113 +.    \" for low resolution devices (crt and lpr)
  46.114 +.if \n(.H>23 .if \n(.V>19 \
  46.115 +\{\
  46.116 +.    ds : e
  46.117 +.    ds 8 ss
  46.118 +.    ds o a
  46.119 +.    ds d- d\h'-1'\(ga
  46.120 +.    ds D- D\h'-1'\(hy
  46.121 +.    ds th \o'bp'
  46.122 +.    ds Th \o'LP'
  46.123 +.    ds ae ae
  46.124 +.    ds Ae AE
  46.125 +.\}
  46.126 +.rm #[ #] #H #V #F C
  46.127 +.\" ========================================================================
  46.128 +.\"
  46.129 +.IX Title "MIRROR 8"
  46.130 +.TH MIRROR 8 "OpenPKG" "MIRROR(8)" "OpenPKG"
  46.131 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
  46.132 +.\" way too many mistakes in technical documents.
  46.133 +.if n .ad l
  46.134 +.nh
  46.135 +.SH "NAME"
  46.136 +openpkg mirror \- OpenPKG Package Mirroring
  46.137 +.SH "SYNOPSIS"
  46.138 +.IX Header "SYNOPSIS"
  46.139 +\&\fBopenpkg\fR
  46.140 +\&\fBmirror\fR
  46.141 +[\fB\-h\fR]
  46.142 +[\fB\-f\fR]
  46.143 +[\fB\-q\fR]
  46.144 +[\fB\-C\fR \fIlocal-cache-file\fR]
  46.145 +[\fB\-r\fR \fIremote-url\fR]
  46.146 +[\fB\-p\fR \fIremote-url-prefix\fR]
  46.147 +\&\fIlocal-dir-prefix\fR ...
  46.148 +.SH "DESCRIPTION"
  46.149 +.IX Header "DESCRIPTION"
  46.150 +The \fBopenpkg mirror\fR tool is a frontend for mirroring OpenPKG
  46.151 +repositories, based on the OpenPKG \s-1XML/RDF\s0 index files \fBopenpkg
  46.152 +index \-S \-T \-D\fR creates. The resulting mirror can then be used with
  46.153 +\&\fBopenpkg build\fR.
  46.154 +.SH "COMMAND LINE ARGUMENTS"
  46.155 +.IX Header "COMMAND LINE ARGUMENTS"
  46.156 +The following command line options and arguments exist:
  46.157 +.IP "\fB\-h\fR" 4
  46.158 +.IX Item "-h"
  46.159 +Print usage help.
  46.160 +.IP "\fB\-f\fR" 4
  46.161 +.IX Item "-f"
  46.162 +Force deletion of local files, even if more than 30% of the existing
  46.163 +local files have to be removed.
  46.164 +.IP "\fB\-q\fR" 4
  46.165 +.IX Item "-q"
  46.166 +More quiet operation, i.e., do not print interactive download progress
  46.167 +bars.
  46.168 +.IP "\fB\-C\fR \fIlocal-cache-file\fR" 4
  46.169 +.IX Item "-C local-cache-file"
  46.170 +Use the text-file \fIlocal-cache-file\fR for caching size/mtime/MD5
  46.171 +information of local files in order to especially avoid the expensive
  46.172 +re-calculation of \s-1MD5\s0 message digests of local files on every mirror
  46.173 +operation. It is strongly advised to use such a cache. Do \s-1NOT\s0 place
  46.174 +\&\fIlocal-cache-file\fR under \fIlocal-dir-prefix\fR.
  46.175 +.IP "\fB\-r\fR \fIremote-url\fR" 4
  46.176 +.IX Item "-r remote-url"
  46.177 +The OpenPKG repository \s-1URL\s0. By default the same \s-1URL\s0 as for \fBopenpkg
  46.178 +build\fR is used: \f(CW\*(C`http://download.openpkg.org/stacks/current/source/\*(C'\fR
  46.179 +.IP "\fB\-p\fR \fIremote-url-prefix\fR" 4
  46.180 +.IX Item "-p remote-url-prefix"
  46.181 +In case the \fIremote-url\fR (option \fB\-r\fR above) points \s-1NOT\s0 to a
  46.182 +root/base directory of the remote repository, it is required to
  46.183 +provide the corresponding base directory \fIremote-url-prefix\fR in
  46.184 +order to allow all remote paths to be correctly mapped to sub-paths
  46.185 +under \fIlocal-dir-prefix\fR. By default \fIremote-url-prefix\fR is
  46.186 +just \fIremote-url\fR. For the public OpenPKG default repository \s-1URL\s0
  46.187 +\&\f(CW\*(C`http://download.openpkg.org/stacks/current/source/\*(C'\fR the corresponding
  46.188 +\&\fIremote-url-prefix\fR is \f(CW\*(C`http://download.openpkg.org/\*(C'\fR.
  46.189 +.IP "\fIlocal-dir-prefix\fR" 4
  46.190 +.IX Item "local-dir-prefix"
  46.191 +The local base directory under which the mirror is established.
  46.192 +Content-wise it directly corresponds to \fIremote-url-prefix\fR (option
  46.193 +\&\fB\-p\fR above).
  46.194 +.SH "EXAMPLE"
  46.195 +.IX Header "EXAMPLE"
  46.196 +The following command mirrors the public OpenPKG-CURRENT repository
  46.197 +files from download.openpkg.org to the local directory \fIdownload/\fR. The
  46.198 +prefix specification is important as the OpenPKG-CURRENT stack index
  46.199 +points upwards.
  46.200 +.PP
  46.201 +.Vb 5
  46.202 +\& $ openpkg mirror \e
  46.203 +\&   \-C download.cache \e
  46.204 +\&   \-r http://download.openpkg.org/stacks/current/source/ \e
  46.205 +\&   \-p http://download.openpkg.org/ \e
  46.206 +\&   download/
  46.207 +.Ve
  46.208 +.PP
  46.209 +The mirror now can be used with \fBopenpkg build\fR:
  46.210 +.PP
  46.211 +.Vb 3
  46.212 +\& $ openpkg build \e
  46.213 +\&   \-r file://\`pwd\`/download/stacks/current/source/ \e
  46.214 +\&   \-Uaq | sh
  46.215 +.Ve
  46.216 +.SH "SEE ALSO"
  46.217 +.IX Header "SEE ALSO"
  46.218 +\&\fIindex\fR\|(8).
  46.219 +.SH "HISTORY"
  46.220 +.IX Header "HISTORY"
  46.221 +The \fBopenpkg mirror\fR command was invented in May 2012 by \fIRalf
  46.222 +S.  Engelschall\fR <rse@engelschall.com> for use inside the
  46.223 +\&\fBOpenPKG\fR project <http://www.openpkg.org/>.
  46.224 +.SH "AUTHORS"
  46.225 +.IX Header "AUTHORS"
  46.226 +.Vb 3
  46.227 +\& Ralf S. Engelschall
  46.228 +\& rse@engelschall.com
  46.229 +\& www.engelschall.com
  46.230 +.Ve
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/openpkg/mirror.pl	Tue Jul 31 12:23:42 2012 +0200
    47.3 @@ -0,0 +1,463 @@
    47.4 +##
    47.5 +##  mirror.pl -- OpenPKG Package Mirroring
    47.6 +##  Copyright (c) 2011-2012 OpenPKG GmbH <http://openpkg.com/>
    47.7 +##
    47.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    47.9 +##  All rights reserved. Licenses which grant limited permission to use,
   47.10 +##  copy, modify and distribute this software are available from the
   47.11 +##  OpenPKG GmbH.
   47.12 +##
   47.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   47.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   47.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   47.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   47.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   47.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   47.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   47.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   47.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   47.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   47.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   47.24 +##  SUCH DAMAGE.
   47.25 +##
   47.26 +
   47.27 +require 5.003;
   47.28 +
   47.29 +#   OpenPKG instance prefix and tools
   47.30 +my $my_prefix = $ENV{'OPENPKG_PREFIX'};
   47.31 +my $my_rpm = "$my_prefix/bin/openpkg rpm";
   47.32 +my $my_openssl = "$my_prefix/lib/openpkg/openssl";
   47.33 +delete $ENV{'OPENPKG_PREFIX'};
   47.34 +
   47.35 +#   program identification
   47.36 +my $progname  = "search";
   47.37 +my $progvers  = "0.1.0";
   47.38 +
   47.39 +#   determine reasonable temporary directory
   47.40 +my $tmpdir = ($ENV{"TMPDIR"} || "/tmp");
   47.41 +
   47.42 +#   use unbuffered stdout
   47.43 +$|++;
   47.44 +
   47.45 +##
   47.46 +##  COMMAND-LINE INTERFACE HANDLING
   47.47 +##
   47.48 +
   47.49 +#   home-brewn getopt(3) style option parser
   47.50 +sub getopts ($$@) {
   47.51 +    my ($opt_spec, $opts, @argv_orig) = @_;
   47.52 +    my (%optf) = map { m/(\w)/; $1 => $_ } $opt_spec =~ m/(\w:|\w)/g;
   47.53 +    my (@argv, $optarg);
   47.54 +
   47.55 +    foreach (@argv_orig) {
   47.56 +        if (@argv) {
   47.57 +            push @argv, $_;
   47.58 +        } elsif (defined $optarg) {
   47.59 +            if (exists $opts->{$optarg}) {
   47.60 +                $opts->{$optarg} .= " $_";
   47.61 +            } else {
   47.62 +                $opts->{$optarg} = $_;
   47.63 +            }
   47.64 +            $optarg = undef;
   47.65 +        } elsif (!/^[-]/) {
   47.66 +            push @argv, $_;
   47.67 +        } else {
   47.68 +            while (/^\-(\w)(.*)/) {
   47.69 +                if (exists $optf{$1}) {
   47.70 +                    if (length($optf{$1}) > 1) {
   47.71 +                        if ($2 ne '') {
   47.72 +                            if (exists $opts->{$1}) {
   47.73 +                                $opts->{$1} .= " $2";
   47.74 +                            } else {
   47.75 +                                $opts->{$1} = $2;
   47.76 +                            }
   47.77 +                        } else {
   47.78 +                            $optarg = $1;
   47.79 +                        }
   47.80 +                        last;
   47.81 +                    } else {
   47.82 +                        $opts->{$1} = 1;
   47.83 +                    }
   47.84 +                } else {
   47.85 +                    warn "openpkg:$prog_name:WARNING: unknown option $_\n";
   47.86 +                }
   47.87 +                $_ = "-$2";
   47.88 +            }
   47.89 +        }
   47.90 +    }
   47.91 +    if (defined $optarg) {
   47.92 +        warn "openpkg:$prog_name:WARNING: option $optarg requires an argument\n";
   47.93 +    }
   47.94 +    foreach my $opt (keys %optf) {
   47.95 +        if (not exists $opts->{$opt}) {
   47.96 +            $opts->{$opt} = (length($optf{$opt}) > 1 ? "" : 0);
   47.97 +        }
   47.98 +    }
   47.99 +    return @argv;
  47.100 +}
  47.101 +
  47.102 +#   parse command line options
  47.103 +my $opts = {};
  47.104 +@ARGV = getopts("hfqr:p:C:", $opts, @ARGV);
  47.105 +
  47.106 +#   usage sanity check and usage help
  47.107 +sub usage {
  47.108 +    my ($rc) = @_;
  47.109 +    my $usage = "openpkg:$prog_name:USAGE: openpkg mirror [-h] [-f] [-C <cache-file>] [-r <remote-url>] [-p <remote-url-prefix>] <local-prefix-dir>\n";
  47.110 +    if ($rc == 0) {
  47.111 +        print STDOUT $usage;
  47.112 +    }
  47.113 +    else {
  47.114 +        print STDERR $usage;
  47.115 +    }
  47.116 +    exit($rc);
  47.117 +}
  47.118 +if ($opts->{"h"}) {
  47.119 +    usage(0);
  47.120 +}
  47.121 +if (@ARGV != 1) {
  47.122 +    usage(1);
  47.123 +}
  47.124 +
  47.125 +#   determine arguments
  47.126 +my ($localprefixdir) = @ARGV;
  47.127 +if (not -d $localprefixdir) {
  47.128 +    print STDERR "openpkg:$prog_name:ERROR: local directory already has to exist: $localprefixdir\n";
  47.129 +    exit(1);
  47.130 +}
  47.131 +
  47.132 +#   determine start URL
  47.133 +my $url = $opts->{"r"} || "";
  47.134 +if ($url eq "") {
  47.135 +    $url = `$my_prefix/bin/openpkg release --fmt='%u' 2>/dev/null`;
  47.136 +    $url =~ s/^\s+//s;
  47.137 +    $url =~ s/\s+$//s;
  47.138 +}
  47.139 +if ($url eq "") {
  47.140 +    print STDERR "openpkg:$prog_name:ERROR: no repository URL known\n";
  47.141 +    exit(1);
  47.142 +}
  47.143 +
  47.144 +#   determine URL prefix
  47.145 +my $remoteprefixurl = $opts->{"p"};
  47.146 +if (not defined $remoteprefixurl) {
  47.147 +    $remoteprefixurl = $url;
  47.148 +    $remoteprefixurl =~ s/\/([^\/]+)$//s;
  47.149 +}
  47.150 +
  47.151 +##
  47.152 +##  HELPER FUNCTIONS
  47.153 +##
  47.154 +
  47.155 +#   determine size and mtime of a file
  47.156 +sub sizetime ($) {
  47.157 +    my ($file) = @_;
  47.158 +    my @stat = stat($file);
  47.159 +    return ($stat[7], $stat[9]);
  47.160 +}
  47.161 +
  47.162 +#   determine MD5 of a file
  47.163 +sub digest ($) {
  47.164 +    my ($file) = @_;
  47.165 +    my $digest = "";
  47.166 +    my $output = `($my_openssl md5 -hex "$file") 2>/dev/null || true`;
  47.167 +    if ($output =~ m/MD5\(.+?\)=\s*([0-9a-fA-F]+)/s) {
  47.168 +        $digest = uc($1);
  47.169 +    }
  47.170 +    return $digest;
  47.171 +}
  47.172 +
  47.173 +#   print a byte size in human-readable form
  47.174 +sub humansize ($) {
  47.175 +    my ($bytes) = @_;
  47.176 +    my $size = "";
  47.177 +    if    ($bytes > 1024*1024*1024) { $size = sprintf("%.1fGB", $bytes / (1024*1024*1024)); }
  47.178 +    elsif ($bytes > 1024*1024)      { $size = sprintf("%.1fMB", $bytes / (1024*1024)     ); }
  47.179 +    elsif ($bytes > 1024)           { $size = sprintf("%.1fKB", $bytes / (1024)          ); }
  47.180 +    else                            { $size = sprintf("%dB",    $bytes                   ); }
  47.181 +    return $size;
  47.182 +}
  47.183 +
  47.184 +#   caching support: load cache
  47.185 +sub cache_load () {
  47.186 +    my $cache = {};
  47.187 +    if ($opts->{"C"}) {
  47.188 +        if (-f $opts->{"C"}) {
  47.189 +            #   load cache file
  47.190 +            open(FP, "<" . $opts->{"C"})
  47.191 +                or die "unable to load cache file: " . $opts->{"C"};
  47.192 +            my $txt = ""; $txt .= $_ while (<FP>);
  47.193 +            close(FP);
  47.194 +
  47.195 +            #   parse cache file
  47.196 +            $txt =~ s/^\s*(\d+)\s+(\d+)\s+([\da-fA-F]+)\s+(.+)$/
  47.197 +                $cache->{$4} = { size => $1, mtime => $2, md5 => $3 }, ''
  47.198 +            /mge;
  47.199 +        }
  47.200 +    }
  47.201 +    return $cache;
  47.202 +}
  47.203 +
  47.204 +#   caching support: save cache
  47.205 +sub cache_save ($) {
  47.206 +    my ($cache) = @_;
  47.207 +    if ($opts->{"C"}) {
  47.208 +        #   generate cache file
  47.209 +        my $txt = "";
  47.210 +        foreach my $url (sort { $a cmp $b } keys %{$cache}) {
  47.211 +            $txt .= sprintf("%10d %10d %s %s\n",
  47.212 +                $cache->{$url}->{"size"},
  47.213 +                $cache->{$url}->{"mtime"},
  47.214 +                $cache->{$url}->{"md5"},
  47.215 +                $url
  47.216 +            );
  47.217 +        }
  47.218 +
  47.219 +        #   write cache file
  47.220 +        open(FP, ">" . $opts->{"C"})
  47.221 +            or die "unable to save cache file: " . $opts->{"C"};
  47.222 +        print FP $txt;
  47.223 +        close(FP);
  47.224 +    }
  47.225 +    return;
  47.226 +}
  47.227 +
  47.228 +##
  47.229 +##   DETERMINE LOCAL AND REMOTE FILES
  47.230 +##
  47.231 +
  47.232 +#   optionally load the cache
  47.233 +my $cache = cache_load();
  47.234 +
  47.235 +#   determine local files
  47.236 +print "++ determining local files\n";
  47.237 +my @local_files = map {
  47.238 +    s/\r?\n$//s;
  47.239 +    s/\/$//s;
  47.240 +    $_;
  47.241 +} `find $localprefixdir -depth -print`;
  47.242 +print "-- local: " . @local_files . " files\n";
  47.243 +
  47.244 +#   determine remote files
  47.245 +print "++ determining remote files\n";
  47.246 +sub relurl ($$) {
  47.247 +    my ($url, $suburl) = @_;
  47.248 +    if ($suburl =~ m/^\w+:\/\//) {
  47.249 +        $url = $suburl;
  47.250 +    }
  47.251 +    elsif ($suburl =~ m/^\//) {
  47.252 +        $url = "file://$suburl";
  47.253 +    }
  47.254 +    else {
  47.255 +        $url =~ s/(\/)?\/*[^\/]*$/$1$suburl/;
  47.256 +    }
  47.257 +    1 while ($url =~ s/\/\.\//\//s);
  47.258 +    1 while ($url =~ s/\/[^\/]+\/\.\.\//\//s);
  47.259 +    return $url;
  47.260 +}
  47.261 +sub parse_attr ($) {
  47.262 +    my ($xml) = @_;
  47.263 +    my $info = { href => "", size => -1, mtime => -1, md5 => "-" };
  47.264 +    $info->{"href"}  = $1 if ($xml =~ m/\bhref="([^"]*)"/s);
  47.265 +    $info->{"size"}  = $1 if ($xml =~ m/\bsize="([^"]*)"/s);
  47.266 +    $info->{"mtime"} = $1 if ($xml =~ m/\bmtime="([^"]*)"/s);
  47.267 +    $info->{"md5"}   = $1 if ($xml =~ m/\bmd5="([^"]*)"/s);
  47.268 +    return $info;
  47.269 +}
  47.270 +sub get_urls ($) {
  47.271 +    my ($info) = @_;
  47.272 +
  47.273 +    #   determine URL
  47.274 +    my $url = $info->{"href"};
  47.275 +    if ($url =~ m/^\//) {
  47.276 +        $url = "file://$url";
  47.277 +    }
  47.278 +    if ($url =~ m/\/$/) {
  47.279 +        $url .= "00INDEX.rdf";
  47.280 +    }
  47.281 +    $info->{"href"} = $url;
  47.282 +
  47.283 +    #   fetch URL content
  47.284 +    print "-- fetching XML/RDF index: $url\n";
  47.285 +    my $tmpfile = "$tmpdir/openpkg-mirror.tmp";
  47.286 +    unlink($tmpfile);
  47.287 +    my $cmd = "$my_prefix/bin/openpkg curl -k -s -R -o \"$tmpfile\" \"$url\"";
  47.288 +    system($cmd);
  47.289 +    my $xml;
  47.290 +    if ($url =~ m/\.bz2$/) {
  47.291 +        $xml = `$my_prefix/lib/openpkg/bzip2 -d -c <"$tmpfile"`;
  47.292 +    }
  47.293 +    else {
  47.294 +        $xml = `cat "$tmpfile"`;
  47.295 +    }
  47.296 +
  47.297 +    #   provide information about this URL
  47.298 +    my @urls = ();
  47.299 +    if ($info->{"size"} == -1 or $info->{"mtime"} == -1) {
  47.300 +        my ($S, $T) = sizetime($tmpfile);
  47.301 +        $info->{"size"} = $S;
  47.302 +        $info->{"mtime"} = $T;
  47.303 +    }
  47.304 +    if ($info->{"md5"} eq "-") {
  47.305 +        $info->{"md5"} = digest($tmpfile);
  47.306 +    }
  47.307 +    push(@urls, $info);
  47.308 +    unlink($tmpfile);
  47.309 +
  47.310 +    #   parse references
  47.311 +    my @ref1 = ();
  47.312 +    my @ref2 = ();
  47.313 +    while ($xml =~ m/<Repository\s+([^>]*href=[^>]*)>/gs) {
  47.314 +        push(@ref1, $1);
  47.315 +    }
  47.316 +    while ($xml =~ m/<rdf:Description\s+([^>]*href=[^>]*)>/gs) {
  47.317 +        push(@ref2, $1);
  47.318 +    }
  47.319 +
  47.320 +    #   provide information about referenced leave URLs
  47.321 +    foreach my $ref2 (@ref2) {
  47.322 +        my $i = parse_attr($ref2);
  47.323 +        $i->{"href"} = relurl($url, $i->{"href"});
  47.324 +        push(@urls, $i);
  47.325 +    }
  47.326 +
  47.327 +    #   provide information about referenced index URLs
  47.328 +    foreach my $ref1 (@ref1) {
  47.329 +        my $i = parse_attr($ref1);
  47.330 +        $i->{"href"} = relurl($url, $i->{"href"});
  47.331 +        push(@urls, get_urls($i)); # RECURSION
  47.332 +    }
  47.333 +
  47.334 +    return @urls;
  47.335 +}
  47.336 +my @remote_urls = get_urls({ href => $url, size => -1, mtime => -1, md5 => "-" });
  47.337 +my $size = 0;
  47.338 +foreach my $url (@remote_urls) {
  47.339 +    $size += int($url->{"size"}) if ($url->{"size"} > 0);
  47.340 +}
  47.341 +print "-- remote: " . @remote_urls . " files (" . humansize($size) . ")\n";
  47.342 +
  47.343 +##
  47.344 +##   DOWNLOAD NEW OR UPDATED REMOTE FILES
  47.345 +##
  47.346 +
  47.347 +#   fetching remote files
  47.348 +print "++ fetching new/updated files\n";
  47.349 +my $local_files_keep = {};
  47.350 +sub keep ($) {
  47.351 +    my ($path) = @_;
  47.352 +    #   keep path and all its parent paths
  47.353 +    while ($path ne "") {
  47.354 +        $local_files_keep->{$path} = 1;
  47.355 +        $path =~ s/(?:^\/$|\/?[^\/]+$)//s;
  47.356 +    }
  47.357 +}
  47.358 +sub mkdir_for_file ($$) {
  47.359 +    my ($prefix, $path) = @_;
  47.360 +    $path =~ s/(?:^\/$|\/?[^\/]+$)//s;
  47.361 +    my @dirs = split("/", $path);
  47.362 +    $path = $prefix;
  47.363 +    $path =~ s/\/$//s;
  47.364 +    foreach my $dir (@dirs) {
  47.365 +        $path .= "/$dir";
  47.366 +        if (not -d $path) {
  47.367 +            print "-- creating: $path\n";
  47.368 +            system("mkdir \"$path\"");
  47.369 +        }
  47.370 +    }
  47.371 +}
  47.372 +foreach my $remote_url (@remote_urls) {
  47.373 +    my $href = $remote_url->{"href"};
  47.374 +    if ($href =~ m/^\Q$remoteprefixurl\E(.+)$/) {
  47.375 +        #   derive local path
  47.376 +        my $local_path = $1;
  47.377 +        my $local_file = $localprefixdir . $local_path;
  47.378 +        keep($local_file);
  47.379 +
  47.380 +        #   determine information about local path
  47.381 +        my $download = 1;
  47.382 +        my $cache_update = 0;
  47.383 +        my ($size, $mtime, $md5);
  47.384 +        if (-f $local_file) {
  47.385 +            my $c = $cache->{$local_file};
  47.386 +            $size  = $c->{"size"}  if (defined $c and defined $c->{"size"});
  47.387 +            $mtime = $c->{"mtime"} if (defined $c and defined $c->{"mtime"});
  47.388 +            if (not defined $size or not defined $mtime) {
  47.389 +                ($size, $mtime) = sizetime($local_file);
  47.390 +                $cache_update = 1;
  47.391 +            }
  47.392 +            if (    $size  == $remote_url->{"size"}
  47.393 +                and $mtime == $remote_url->{"mtime"}) {
  47.394 +                $md5 = $c->{"md5"} if (defined $c and defined $c->{"md5"});
  47.395 +                if (not defined $md5) {
  47.396 +                    $md5 = digest($local_file);
  47.397 +                    $cache_update = 1;
  47.398 +                }
  47.399 +                if ($md5 eq $remote_url->{"md5"}) {
  47.400 +                    $download = 0;
  47.401 +                }
  47.402 +            }
  47.403 +        }
  47.404 +
  47.405 +        #   optionally download remote file to local path
  47.406 +        if ($download) {
  47.407 +            print "-- fetching: $local_path\n";
  47.408 +            mkdir_for_file($localprefixdir, $local_path);
  47.409 +            my $cmd = "$my_prefix/bin/openpkg curl";
  47.410 +            $cmd .= " -s"     if (    $opts->{"q"});
  47.411 +            $cmd .= " \"-#\"" if (not $opts->{"q"});
  47.412 +            $cmd .= " -k -R -o \"$local_file\" \"$href\"";
  47.413 +            system($cmd);
  47.414 +            ($size, $mtime) = sizetime($local_file);
  47.415 +            $md5 = digest($local_file);
  47.416 +            $cache_update = 1;
  47.417 +        }
  47.418 +
  47.419 +        #   optionally update the size/mtime/md5 cache
  47.420 +        if ($opts->{"C"} and $cache_update) {
  47.421 +            $cache->{$local_file} = { size => $size, mtime => $mtime, md5 => $md5 };
  47.422 +            cache_save($cache);
  47.423 +        }
  47.424 +    }
  47.425 +    else {
  47.426 +        print "** WARNING: URL \"$href\" not under prefix \"$remoteprefixurl\": " .
  47.427 +            "unable to derive local path -- skipping URL\n";
  47.428 +    }
  47.429 +}
  47.430 +
  47.431 +##
  47.432 +##   REMOVE OBSOLETE LOCAL FILES
  47.433 +##
  47.434 +
  47.435 +#   remove obsolete files
  47.436 +print "++ removing obsolete files\n";
  47.437 +my $lf  = @local_files;
  47.438 +my $lfk = keys %{$local_files_keep};
  47.439 +if (not $opts->{"f"} and ($lf - $lfk) > ($lf * 0.3)) {
  47.440 +    print "** WARNING: more than 30% of your existing local files would be removed (require option -f)\n";
  47.441 +}
  47.442 +else {
  47.443 +    foreach my $local_file (@local_files) {
  47.444 +        if (not exists $local_files_keep->{$local_file}) {
  47.445 +            if (-f $local_file) {
  47.446 +                print "-- removing: $local_file (file)\n";
  47.447 +                system("rm \"$local_file\" >/dev/null 2>&1 || true");
  47.448 +            }
  47.449 +            elsif (-d $local_file) {
  47.450 +                print "-- removing: $local_file (dir)\n";
  47.451 +                system("rmdir \"$local_file\" >/dev/null 2>&1 || true");
  47.452 +            }
  47.453 +        }
  47.454 +    }
  47.455 +}
  47.456 +
  47.457 +##
  47.458 +##   CLEANUP
  47.459 +##
  47.460 +
  47.461 +#   optionally flush the cache
  47.462 +cache_save($cache);
  47.463 +
  47.464 +#   exit gracefully
  47.465 +exit(0);
  47.466 +
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/openpkg/mirror.pod	Tue Jul 31 12:23:42 2012 +0200
    48.3 @@ -0,0 +1,137 @@
    48.4 +##
    48.5 +##  mirror.pod -- OpenPKG Package Mirroring
    48.6 +##  Copyright (c) 2011-2012 OpenPKG GmbH <http://openpkg.com/>
    48.7 +##
    48.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    48.9 +##  All rights reserved. Licenses which grant limited permission to use,
   48.10 +##  copy, modify and distribute this software are available from the
   48.11 +##  OpenPKG GmbH.
   48.12 +##
   48.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   48.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   48.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   48.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   48.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   48.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   48.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   48.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   48.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   48.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   48.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   48.24 +##  SUCH DAMAGE.
   48.25 +##
   48.26 +
   48.27 +=pod
   48.28 +
   48.29 +=head1 NAME
   48.30 +
   48.31 +B<openpkg mirror> - B<OpenPKG> Package Mirroring
   48.32 +
   48.33 +=head1 SYNOPSIS
   48.34 +
   48.35 +B<openpkg>
   48.36 +B<mirror>
   48.37 +[B<-h>]
   48.38 +[B<-f>]
   48.39 +[B<-q>]
   48.40 +[B<-C> I<local-cache-file>]
   48.41 +[B<-r> I<remote-url>]
   48.42 +[B<-p> I<remote-url-prefix>]
   48.43 +I<local-dir-prefix> ...
   48.44 +
   48.45 +=head1 DESCRIPTION
   48.46 +
   48.47 +The B<openpkg mirror> tool is a frontend for mirroring OpenPKG
   48.48 +repositories, based on the OpenPKG XML/RDF index files B<openpkg
   48.49 +index -S -T -D> creates. The resulting mirror can then be used with
   48.50 +B<openpkg build>.
   48.51 +
   48.52 +=head1 COMMAND LINE ARGUMENTS
   48.53 +
   48.54 +The following command line options and arguments exist:
   48.55 +
   48.56 +=over 4
   48.57 +
   48.58 +=item B<-h>
   48.59 +
   48.60 +Print usage help.
   48.61 +
   48.62 +=item B<-f>
   48.63 +
   48.64 +Force deletion of local files, even if more than 30% of the existing
   48.65 +local files have to be removed.
   48.66 +
   48.67 +=item B<-q>
   48.68 +
   48.69 +More quiet operation, i.e., do not print interactive download progress
   48.70 +bars.
   48.71 +
   48.72 +=item B<-C> I<local-cache-file>
   48.73 +
   48.74 +Use the text-file I<local-cache-file> for caching size/mtime/MD5
   48.75 +information of local files in order to especially avoid the expensive
   48.76 +re-calculation of MD5 message digests of local files on every mirror
   48.77 +operation. It is strongly advised to use such a cache. Do NOT place
   48.78 +I<local-cache-file> under I<local-dir-prefix>.
   48.79 +
   48.80 +=item B<-r> I<remote-url>
   48.81 +
   48.82 +The OpenPKG repository URL. By default the same URL as for B<openpkg
   48.83 +build> is used: C<http://download.openpkg.org/stacks/current/source/>
   48.84 +
   48.85 +=item B<-p> I<remote-url-prefix>
   48.86 +
   48.87 +In case the I<remote-url> (option B<-r> above) points NOT to a
   48.88 +root/base directory of the remote repository, it is required to
   48.89 +provide the corresponding base directory I<remote-url-prefix> in
   48.90 +order to allow all remote paths to be correctly mapped to sub-paths
   48.91 +under I<local-dir-prefix>. By default I<remote-url-prefix> is
   48.92 +just I<remote-url>. For the public OpenPKG default repository URL
   48.93 +C<http://download.openpkg.org/stacks/current/source/> the corresponding
   48.94 +I<remote-url-prefix> is C<http://download.openpkg.org/>.
   48.95 +
   48.96 +=item I<local-dir-prefix>
   48.97 +
   48.98 +The local base directory under which the mirror is established.
   48.99 +Content-wise it directly corresponds to I<remote-url-prefix> (option
  48.100 +B<-p> above).
  48.101 +
  48.102 +=back
  48.103 +
  48.104 +=head1 EXAMPLE
  48.105 +
  48.106 +The following command mirrors the public OpenPKG-CURRENT repository
  48.107 +files from download.openpkg.org to the local directory F<download/>. The
  48.108 +prefix specification is important as the OpenPKG-CURRENT stack index
  48.109 +points upwards.
  48.110 +
  48.111 + $ openpkg mirror \
  48.112 +   -C download.cache \
  48.113 +   -r http://download.openpkg.org/stacks/current/source/ \
  48.114 +   -p http://download.openpkg.org/ \
  48.115 +   download/ 
  48.116 +
  48.117 +The mirror now can be used with B<openpkg build>:
  48.118 +
  48.119 + $ openpkg build \
  48.120 +   -r file://`pwd`/download/stacks/current/source/ \
  48.121 +   -Uaq | sh
  48.122 +
  48.123 +=head1 SEE ALSO
  48.124 +
  48.125 +index(8).
  48.126 +
  48.127 +=head1 HISTORY
  48.128 +
  48.129 +The B<openpkg mirror> command was invented in May 2012 by I<Ralf
  48.130 +S.  Engelschall> E<lt>rse@engelschall.comE<gt> for use inside the
  48.131 +B<OpenPKG> project E<lt>http://www.openpkg.org/E<gt>.
  48.132 +
  48.133 +=head1 AUTHORS
  48.134 +
  48.135 + Ralf S. Engelschall
  48.136 + rse@engelschall.com
  48.137 + www.engelschall.com
  48.138 +
  48.139 +=cut
  48.140 +
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/openpkg/mutex.c	Tue Jul 31 12:23:42 2012 +0200
    49.3 @@ -0,0 +1,260 @@
    49.4 +/*
    49.5 +**  mutex.c -- OpenPKG Mutex Utility
    49.6 +**  Copyright (c) 2008-2012 OpenPKG GmbH <http://openpkg.com/>
    49.7 +**
    49.8 +**  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    49.9 +**  All rights reserved. Licenses which grant limited permission to use,
   49.10 +**  copy, modify and distribute this software are available from the
   49.11 +**  OpenPKG GmbH.
   49.12 +**
   49.13 +**  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   49.14 +**  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   49.15 +**  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   49.16 +**  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   49.17 +**  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   49.18 +**  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   49.19 +**  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   49.20 +**  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   49.21 +**  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   49.22 +**  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   49.23 +**  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   49.24 +**  SUCH DAMAGE.
   49.25 +*/
   49.26 +
   49.27 +/*  standard system headers  */
   49.28 +#include <stdio.h>
   49.29 +#include <stdlib.h>
   49.30 +#include <stdarg.h>
   49.31 +#include <string.h>
   49.32 +#include <unistd.h>
   49.33 +#include <errno.h>
   49.34 +#include <fcntl.h>
   49.35 +#include <signal.h>
   49.36 +#include <sys/types.h>
   49.37 +#include <sys/wait.h>
   49.38 +
   49.39 +/*  non-standard add-on headers */
   49.40 +#include "popt.h"
   49.41 +
   49.42 +/*  program information  */
   49.43 +#define PROGRAM_NAME         "mutex"
   49.44 +
   49.45 +/*  error handling constants  */
   49.46 +#define EXITCODE_NONE        00
   49.47 +#define EXITCODE_USAGE       64
   49.48 +#define EXITCODE_OSERR       71
   49.49 +#define EXITCODE_CANTCREAT   73
   49.50 +#define EXITCODE_TEMPFAIL    75
   49.51 +#define ERRORCODE_NONE       0
   49.52 +#define ERRORCODE_SYSTEM     1
   49.53 +
   49.54 +/*  global variables  */
   49.55 +static const char           *mutex_filename  = NULL;
   49.56 +static int                   mutex_fd        = -1;
   49.57 +static int                   mutex_keep      = 0;
   49.58 +static int                   mutex_timeout   = -1;
   49.59 +static volatile int          mutex_timed_out = 0;
   49.60 +
   49.61 +/*  display warning and continue or display error and exit  */
   49.62 +static void
   49.63 +error(
   49.64 +    int exitcode,
   49.65 +    int errorcode,
   49.66 +    const char *fmt, ...)
   49.67 +{
   49.68 +    va_list ap;
   49.69 +    int errno_safed = errno;
   49.70 +
   49.71 +    va_start(ap, fmt);
   49.72 +    if (exitcode != 0)
   49.73 +        fprintf(stderr, PROGRAM_NAME ":ERROR: ");
   49.74 +    else
   49.75 +        fprintf(stderr, PROGRAM_NAME ":WARNING: ");
   49.76 +    vfprintf(stderr, fmt, ap);
   49.77 +    if (errorcode)
   49.78 +       fprintf(stderr, ": %s", strerror(errno_safed));
   49.79 +    fprintf(stderr, "\n");
   49.80 +    va_end(ap);
   49.81 +    if (exitcode != 0)
   49.82 +        exit(exitcode);
   49.83 +    return;
   49.84 +}
   49.85 +
   49.86 +/*  acquire mutex */
   49.87 +static int
   49.88 +mutex_acquire(int nonblock)
   49.89 +{
   49.90 +    static struct flock lock;
   49.91 +    int flags;
   49.92 +
   49.93 +    /* open mutex file (and optionally create it) */
   49.94 +    flags = O_RDWR|O_CREAT;
   49.95 +    if (nonblock)
   49.96 +        flags |= O_NONBLOCK;
   49.97 +    if ((mutex_fd = open(mutex_filename, flags, 0600)) == -1) {
   49.98 +        if (errno == EAGAIN || errno == EINTR)
   49.99 +            return 0;
  49.100 +        error(EXITCODE_CANTCREAT, ERRORCODE_SYSTEM, "cannot open mutex file \"%s\"",
  49.101 +            mutex_filename);
  49.102 +    }
  49.103 +
  49.104 +    /* acquire exclusive lock on the mutex file */
  49.105 +    lock.l_whence = SEEK_SET; /* from current point */
  49.106 +    lock.l_start  = 0;        /* -"- */
  49.107 +    lock.l_len    = 0;        /* until end of file */
  49.108 +    lock.l_type   = F_WRLCK;  /* set exclusive/read-write lock */
  49.109 +    lock.l_pid    = 0;        /* pid not actually interesting */
  49.110 +    if (fcntl(mutex_fd, nonblock ? F_SETLK : F_SETLKW, &lock) == -1) {
  49.111 +        close(mutex_fd);
  49.112 +        mutex_fd = -1;
  49.113 +        return 0;
  49.114 +    }
  49.115 +
  49.116 +    return 1;
  49.117 +}
  49.118 +
  49.119 +/*  release mutex  */
  49.120 +static void
  49.121 +mutex_release(void)
  49.122 +{
  49.123 +    static struct flock unlock;
  49.124 +
  49.125 +    if (mutex_fd != -1) {
  49.126 +        /* release lock on the mutex file */
  49.127 +        unlock.l_whence  = SEEK_SET; /* from current point */
  49.128 +        unlock.l_start   = 0;        /* -"- */
  49.129 +        unlock.l_len     = 0;        /* until end of file */
  49.130 +        unlock.l_type    = F_UNLCK;  /* unlock */
  49.131 +        unlock.l_pid     = 0;        /* pid not actually interesting */
  49.132 +        fcntl(mutex_fd, F_SETLK, &unlock);
  49.133 +
  49.134 +        /* close mutex file */
  49.135 +        close(mutex_fd);
  49.136 +        mutex_fd = -1;
  49.137 +    }
  49.138 +    return;
  49.139 +}
  49.140 +
  49.141 +/*  destroy the mutex  */
  49.142 +static void
  49.143 +mutex_destroy(
  49.144 +    void)
  49.145 +{
  49.146 +    /* release lock on mutex file */
  49.147 +    mutex_release();
  49.148 +
  49.149 +    /* optionally remove mutex file */
  49.150 +    if (!mutex_keep)
  49.151 +        unlink(mutex_filename);
  49.152 +
  49.153 +    return;
  49.154 +}
  49.155 +
  49.156 +/*  signal handler for SIGTERM  */
  49.157 +static void
  49.158 +handler_killed(
  49.159 +    int sig)
  49.160 +{
  49.161 +    /* destroy mutex */
  49.162 +    mutex_destroy();
  49.163 +
  49.164 +    /* re-raise the signal */
  49.165 +    signal(sig, SIG_DFL);
  49.166 +    if (kill(getpid(), sig) == -1)
  49.167 +        error(EXITCODE_OSERR, ERRORCODE_SYSTEM, "kill(2) failed");
  49.168 +
  49.169 +    return;
  49.170 +}
  49.171 +
  49.172 +/*  signal handler for SIGALRM  */
  49.173 +static void
  49.174 +handler_timeout(
  49.175 +    int sig)
  49.176 +{
  49.177 +    mutex_timed_out = 1;
  49.178 +    return;
  49.179 +}
  49.180 +
  49.181 +/*  command line options  */
  49.182 +static struct poptOption options_tab[] = {
  49.183 +    { "keep",    'k', POPT_ARG_NONE, &mutex_keep,    0, NULL, NULL },
  49.184 +    { "timeout", 't', POPT_ARG_INT,  &mutex_timeout, 0, NULL, NULL },
  49.185 +    POPT_TABLEEND
  49.186 +};
  49.187 +
  49.188 +/*  main program procedure  */
  49.189 +int
  49.190 +main(
  49.191 +    int argc,
  49.192 +    char *argv[])
  49.193 +{
  49.194 +    int status;
  49.195 +    pid_t child;
  49.196 +    int locked;
  49.197 +    char c;
  49.198 +    const char **args;
  49.199 +    poptContext options_ctx;
  49.200 +
  49.201 +    /* process command line arguments */
  49.202 +    options_ctx = poptGetContext(argv[0], argc, (const char **)argv,
  49.203 +        options_tab, POPT_CONTEXT_NO_EXEC|POPT_CONTEXT_POSIXMEHARDER);
  49.204 +    while ((c = poptGetNextOpt(options_ctx)) > 0)
  49.205 +        ;
  49.206 +    if (c < -1)
  49.207 +        error(EXITCODE_USAGE, ERRORCODE_NONE, "command line option \"%s\": %s",
  49.208 +            poptBadOption(options_ctx, POPT_BADOPTION_NOALIAS), poptStrerror(c));
  49.209 +    mutex_filename = poptGetArg(options_ctx);
  49.210 +    if (mutex_filename == NULL) {
  49.211 +        fprintf(stderr,
  49.212 +            "usage: %s [--keep|-k] [--timeout|-t <seconds>] <mutex-file> <command> [<arguments>]\n",
  49.213 +            PROGRAM_NAME);
  49.214 +        exit(EXITCODE_USAGE);
  49.215 +    }
  49.216 +    args = poptGetArgs(options_ctx);
  49.217 +
  49.218 +    /* optionally set up a timeout */
  49.219 +    if (mutex_timeout > 0) {
  49.220 +        struct sigaction act;
  49.221 +        act.sa_handler = handler_timeout;
  49.222 +        act.sa_flags = 0;
  49.223 +        sigemptyset(&act.sa_mask);
  49.224 +        sigaction(SIGALRM, &act, NULL);
  49.225 +        alarm(mutex_timeout);
  49.226 +    }
  49.227 +
  49.228 +    /* try to acquire the mutex lock */
  49.229 +    locked = mutex_acquire(1 /* non-blocking */);
  49.230 +    while (!locked && !mutex_timed_out && mutex_timeout != 0)
  49.231 +        locked = mutex_acquire(0 /* blocking */);
  49.232 +
  49.233 +    /* optionally destroy timeout */
  49.234 +    if (mutex_timeout > 0)
  49.235 +        alarm(0);
  49.236 +
  49.237 +    /* exit in case we failed to acquire the mutex lock */
  49.238 +    if (!locked)
  49.239 +        error(EXITCODE_TEMPFAIL, ERRORCODE_NONE, "%s: already locked", mutex_filename);
  49.240 +
  49.241 +    /* execute the command */
  49.242 +    if (atexit(mutex_destroy) == -1)
  49.243 +        error(EXITCODE_OSERR, ERRORCODE_SYSTEM, "atexit(3) failed");
  49.244 +    if ((child = fork()) == -1)
  49.245 +        error(EXITCODE_OSERR, ERRORCODE_SYSTEM, "fork(2) failed");
  49.246 +    if (child == 0) {
  49.247 +        /* the child process */
  49.248 +        mutex_release();
  49.249 +        execvp((char *)args[0], (char **)args);
  49.250 +        error(EXITCODE_NONE, ERRORCODE_SYSTEM, "execvp(2) failed: %s", args[0]);
  49.251 +        exit(1);
  49.252 +    }
  49.253 +    poptFreeContext(options_ctx);
  49.254 +
  49.255 +    /* wait for child process and return its exit status */
  49.256 +    signal(SIGINT,  SIG_IGN);
  49.257 +    signal(SIGQUIT, SIG_IGN);
  49.258 +    signal(SIGTERM, handler_killed);
  49.259 +    if (waitpid(child, &status, 0) == -1)
  49.260 +        error(EXITCODE_OSERR, ERRORCODE_SYSTEM, "waitpid(2) failed");
  49.261 +    return (WIFEXITED(status) ? WEXITSTATUS(status) : 1);
  49.262 +}
  49.263 +
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/openpkg/mutex.mk	Tue Jul 31 12:23:42 2012 +0200
    50.3 @@ -0,0 +1,17 @@
    50.4 +
    50.5 +CC             = cc
    50.6 +CFLAGS         =
    50.7 +CPPFLAGS       =
    50.8 +LDFLAGS        =
    50.9 +LIBS           = -lpopt
   50.10 +
   50.11 +MUTEX_DOT_C    = mutex.c
   50.12 +
   50.13 +all: mutex
   50.14 +
   50.15 +mutex: $(MUTEX_DOT_C)
   50.16 +	$(CC) $(CFLAGS) $(CPPFLAGS) -o mutex $(MUTEX_DOT_C) $(LDFLAGS) $(LIBS)
   50.17 +
   50.18 +clean:
   50.19 +	-rm -f mutex
   50.20 +
    51.1 --- a/openpkg/openpkg.1	Tue Jul 31 12:12:54 2012 +0200
    51.2 +++ b/openpkg/openpkg.1	Tue Jul 31 12:23:42 2012 +0200
    51.3 @@ -1,15 +1,7 @@
    51.4 -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
    51.5 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
    51.6  .\"
    51.7  .\" Standard preamble:
    51.8  .\" ========================================================================
    51.9 -.de Sh \" Subsection heading
   51.10 -.br
   51.11 -.if t .Sp
   51.12 -.ne 5
   51.13 -.PP
   51.14 -\fB\\$1\fR
   51.15 -.PP
   51.16 -..
   51.17  .de Sp \" Vertical space (when we can't use .PP)
   51.18  .if t .sp .5v
   51.19  .if n .sp
   51.20 @@ -25,11 +17,11 @@
   51.21  ..
   51.22  .\" Set up some character translations and predefined strings.  \*(-- will
   51.23  .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   51.24 -.\" double quote, and \*(R" will give a right double quote.  | will give a
   51.25 -.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
   51.26 -.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
   51.27 -.\" expand to `' in nroff, nothing in troff, for use with C<>.
   51.28 -.tr \(*W-|\(bv\*(Tr
   51.29 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
   51.30 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
   51.31 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
   51.32 +.\" nothing in troff, for use with C<>.
   51.33 +.tr \(*W-
   51.34  .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   51.35  .ie n \{\
   51.36  .    ds -- \(*W-
   51.37 @@ -48,22 +40,25 @@
   51.38  .    ds R" ''
   51.39  'br\}
   51.40  .\"
   51.41 +.\" Escape single quotes in literal strings from groff's Unicode transform.
   51.42 +.ie \n(.g .ds Aq \(aq
   51.43 +.el       .ds Aq '
   51.44 +.\"
   51.45  .\" If the F register is turned on, we'll generate index entries on stderr for
   51.46 -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
   51.47 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
   51.48  .\" entries marked with X<> in POD.  Of course, you'll have to process the
   51.49  .\" output yourself in some meaningful fashion.
   51.50 -.if \nF \{\
   51.51 +.ie \nF \{\
   51.52  .    de IX
   51.53  .    tm Index:\\$1\t\\n%\t"\\$2"
   51.54  ..
   51.55  .    nr % 0
   51.56  .    rr F
   51.57  .\}
   51.58 -.\"
   51.59 -.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   51.60 -.\" way too many mistakes in technical documents.
   51.61 -.hy 0
   51.62 -.if n .na
   51.63 +.el \{\
   51.64 +.    de IX
   51.65 +..
   51.66 +.\}
   51.67  .\"
   51.68  .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   51.69  .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   51.70 @@ -130,41 +125,17 @@
   51.71  .\"
   51.72  .IX Title "OPENPKG 1"
   51.73  .TH OPENPKG 1 "OpenPKG" "OPENPKG(8)" "OpenPKG"
   51.74 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   51.75 +.\" way too many mistakes in technical documents.
   51.76 +.if n .ad l
   51.77 +.nh
   51.78  .SH "NAME"
   51.79 -\&\fBOpenPKG\fR \-\- Cross\-Platform Unix Software Packaging Facility
   51.80 +OpenPKG \-\- Cross\-Platform Unix Software Packaging
   51.81  .SH "SYNOPSIS"
   51.82  .IX Header "SYNOPSIS"
   51.83 -.IP "Command Line Interface" 4
   51.84 -.IX Item "Command Line Interface"
   51.85  $ \fBopenpkg\fR [\fIopt\fR ...] \fIcmd\fR [\fIcmd_opt\fR ...] [\fIcmd_arg\fR ...]
   51.86 -.Sp
   51.87 +.PP
   51.88  $ \fBopenpkg\fR \fBman\fR \fIcmd\fR
   51.89 -.IP "Project Locations" 4
   51.90 -.IX Item "Project Locations"
   51.91 -.Vb 4
   51.92 -\& http://www.openpkg.org/       web service
   51.93 -\& http://cvs.openpkg.org/       repository service
   51.94 -\& http://pgp.openpkg.org/       OpenPGP service
   51.95 -\& ftp://ftp.openpkg.org/        download service
   51.96 -.Ve
   51.97 -.IP "Project Forums" 4
   51.98 -.IX Item "Project Forums"
   51.99 -.Vb 4
  51.100 -\& petidomo@openpkg.org          mailing-list manager
  51.101 -\& openpkg-announce@openpkg.org  project announcements
  51.102 -\& openpkg-dev@openpkg.org       developer forum
  51.103 -\& openpkg-users@openpkg.org     users forum
  51.104 -.Ve
  51.105 -.IP "Local Documentation" 4
  51.106 -.IX Item "Local Documentation"
  51.107 -.Vb 6
  51.108 -\& openpkg-rpm(1)                RPM package manager
  51.109 -\& openpkg-rpmbuild(1)           RPM package manager (build only)
  51.110 -\& openpkg-rpm2cpio(1)           RPM payload utility
  51.111 -\& openpkg-rpm-config(1)         RPM C API utility
  51.112 -\& openpkg-lsync(1)              local area synchronization
  51.113 -\& openpkg-rc(1)                 run-command facility
  51.114 -.Ve
  51.115  .SH "DESCRIPTION"
  51.116  .IX Header "DESCRIPTION"
  51.117  OpenPKG is the world leading instrument for deployment and maintenance
  51.118 @@ -181,3 +152,145 @@
  51.119  a tricky bootstrapping procedure in order to allow one to create from
  51.120  scratch the initial state of the whole OpenPKG software packaging
  51.121  system.
  51.122 +.SH "TUTORIAL"
  51.123 +.IX Header "TUTORIAL"
  51.124 +.IP "\fB1. System Preparation (optional)\fR" 3
  51.125 +.IX Item "1. System Preparation (optional)"
  51.126 +Before you start, the Unix system optionally should be prepared. Here
  51.127 +especially the necessary disk space requirements of OpenPKG have to be
  51.128 +taken into account.
  51.129 +.Sp
  51.130 +.Vb 3
  51.131 +\& # optionally direct /openpkg to at least 150MB free disk space:
  51.132 +\& $ mkdir /storage/openpkg
  51.133 +\& $ ln \-s /storage/openpkg /openpkg
  51.134 +\&
  51.135 +\& # optionally direct temp\-directory to at least 250MB free disk space:
  51.136 +\& $ TMPDIR=/var/tmp
  51.137 +\& $ export TMPDIR
  51.138 +\&
  51.139 +\& # switch to temporary directory:
  51.140 +\& $ cd $TMPDIR
  51.141 +.Ve
  51.142 +.IP "\fB2. Instance Bootstrapping\fR" 3
  51.143 +.IX Item "2. Instance Bootstrapping"
  51.144 +The next step is to bootstrap the OpenPKG instance. Here we are using
  51.145 +the standard /openpkg filesystem prefix. An arbitrary prefix can be
  51.146 +used as long as at least the \*(L"Bootstrap From Source\*(R" approach is used.
  51.147 +.Sp
  51.148 +.Vb 2
  51.149 +\& # download bootstrap source shell package:
  51.150 +\& $ wget http://openpkg.org/go/download/openpkg.src.sh
  51.151 +\&
  51.152 +\& # build bootstrap binary shell package from source shell package:
  51.153 +\& $ sh openpkg.src.sh \e
  51.154 +\&   \-\-prefix=/openpkg \-\-tag=openpkg \e
  51.155 +\&   \-\-user=openpkg \-\-group=openpkg \e
  51.156 +\&   \-\-tag=openpkg
  51.157 +\&
  51.158 +\& # install bootstrap binary script package:
  51.159 +\& $ sh openpkg\-*\-*.*\-openpkg.sh
  51.160 +.Ve
  51.161 +.IP "\fB3. Software Deployment\fR" 3
  51.162 +.IX Item "3. Software Deployment"
  51.163 +Now you can install arbitrary OpenPKG software packages by either using
  51.164 +the lower-level OpenPKG \s-1RPM\s0 command or the higher-level OpenPKG tool
  51.165 +chain build command. As a simple illustration example the \s-1GNU\s0 Bash
  51.166 +package of OpenPKG is installed.
  51.167 +.Sp
  51.168 +.Vb 2
  51.169 +\& # build and install GNU Bash:
  51.170 +\& $ /openpkg/bin/openpkg build bash | sh
  51.171 +.Ve
  51.172 +.IP "\fB4. Software Usage\fR" 3
  51.173 +.IX Item "4. Software Usage"
  51.174 +Finally, you can use the deployed software. Either through explicit
  51.175 +paths (reasonable if leveraging OpenPKG's multiple-instance feature) or
  51.176 +implicitly by merging the OpenPKG instance into the local environment.
  51.177 +.Sp
  51.178 +.Vb 2
  51.179 +\& # explicit usage:
  51.180 +\& $ /openpkg/bin/bash \-\-version
  51.181 +\&
  51.182 +\& # implicit usage (alternatively)
  51.183 +\& $ eval \`/openpkg/bin/openpkg rc \-\-eval all env\`
  51.184 +\& $ bash \-\-version
  51.185 +.Ve
  51.186 +.IP "\fB5. Go Ahead!\fR" 3
  51.187 +.IX Item "5. Go Ahead!"
  51.188 +Want to know more now? Please read the manual pages of at least the
  51.189 +deployment commands and then proceed by searching and deploying even
  51.190 +more software into your OpenPKG instance.
  51.191 +.Sp
  51.192 +.Vb 3
  51.193 +\& # read manual pages:
  51.194 +\& $ /openpkg/bin/openpkg man search
  51.195 +\& $ /openpkg/bin/openpkg man build
  51.196 +\&
  51.197 +\& # search for a package
  51.198 +\& $ /openpkg/bin/openpkg search [\-v] <regex>
  51.199 +\&
  51.200 +\& # deploy even more packages
  51.201 +\& $ /openpkg/bin/openpkg build \e
  51.202 +\&   [\-D[<package1>::]with_<name>] \e
  51.203 +\&   [\-D[<package2>::]with_<name>] \e
  51.204 +\&   <package1> <package2> ... | sh
  51.205 +.Ve
  51.206 +.Sp
  51.207 +For instance, to install and start an Apache \s-1HTTP\s0 server with \s-1SSL/TLS\s0
  51.208 +support you can use:
  51.209 +.Sp
  51.210 +.Vb 3
  51.211 +\& $ /openpkg/bin/openpkg search \-v apache | more
  51.212 +\& $ /openpkg/bin/openpkg build \-D with_mod_ssl=yes apache | sh
  51.213 +\& $ /openpkg/bin/openpkg rc apache start
  51.214 +.Ve
  51.215 +.IP "\fB6. Cleanup\fR" 3
  51.216 +.IX Item "6. Cleanup"
  51.217 +OpenPKG has not convinced you? Well, it's a pity, but no problem. You
  51.218 +can easily get rid of anything you installed at once (both the OpenPKG
  51.219 +instance and any of its OpenPKG packages) with the following simple
  51.220 +command:
  51.221 +.Sp
  51.222 +.Vb 2
  51.223 +\& $ /openpkg/bin/openpkg rc all stop
  51.224 +\& $ /openpkg/bin/openpkg rpm \-e \`/openpkg/bin/openpkg rpm \-qa\`
  51.225 +.Ve
  51.226 +.SH "SEE ALSO"
  51.227 +.IX Header "SEE ALSO"
  51.228 +OpenPKG local documentation can be viewed the command "\fBopenpkg man\fR
  51.229 +\&\fIcmd\fR", where \fIcmd\fR is one of the following commands:
  51.230 +.PP
  51.231 +.Vb 6
  51.232 +\& index           OpenPKG package indexing
  51.233 +\& search          OpenPKG package searching
  51.234 +\& mirror          OpenPKG package mirroring
  51.235 +\& build           OpenPKG package building and installing
  51.236 +\& rc              OpenPKG run\-command facility
  51.237 +\& lsync           OpenPKG local area synchronization
  51.238 +\&
  51.239 +\& stack           OpenPKG software stack generation
  51.240 +\& makeproxy       OpenPKG proxy package generation
  51.241 +\& dev             OpenPKG development tool
  51.242 +\&
  51.243 +\& rpm             RPM package manager
  51.244 +\& rpm2cpio        RPM payload utility
  51.245 +\& rpm\-config      RPM C API utility
  51.246 +\& rpmtool         OpenPKG RPM packaging helper tool
  51.247 +\&
  51.248 +\& license         OpenPKG license management
  51.249 +\& release         OpenPKG release information
  51.250 +\& register        OpenPKG registry client (obsolete)
  51.251 +\&
  51.252 +\& sea             Shell Execution Archive tool
  51.253 +\& uuid            Universal Unique Identifiers tool
  51.254 +.Ve
  51.255 +.PP
  51.256 +Additionally, OpenPKG can be found under the following locations on the
  51.257 +Internet:
  51.258 +.PP
  51.259 +.Vb 3
  51.260 +\& http://openpkg.org/  OpenPKG Project (Distribution)
  51.261 +\& http://openpkg.com/  OpenPKG GmbH (Framework, Support)
  51.262 +\& http://openpkg.net/  OpenPKG Foundation e.V. (Packages)
  51.263 +.Ve
    52.1 --- a/openpkg/openpkg.boot	Tue Jul 31 12:12:54 2012 +0200
    52.2 +++ b/openpkg/openpkg.boot	Tue Jul 31 12:23:42 2012 +0200
    52.3 @@ -1,15 +1,14 @@
    52.4  #!/bin/sh
    52.5  ##
    52.6  ##  openpkg.boot -- OpenPKG bootstrap procedure (look Ma, without hands ;)
    52.7 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    52.8 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    52.9 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
   52.10  ##
   52.11 -##  Permission to use, copy, modify, and distribute this software for
   52.12 -##  any purpose with or without fee is hereby granted, provided that
   52.13 -##  the above copyright notice and this permission notice appear in all
   52.14 -##  copies.
   52.15 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   52.16 +##  All rights reserved. Licenses which grant limited permission to use,
   52.17 +##  copy, modify and distribute this software are available from the
   52.18 +##  OpenPKG GmbH.
   52.19  ##
   52.20 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   52.21 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   52.22  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   52.23  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   52.24  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   52.25 @@ -47,6 +46,8 @@
   52.26  verbose=''
   52.27  prefix=''
   52.28  tag=''
   52.29 +stack=''
   52.30 +unprivileged=no
   52.31  usr='';  grp=''
   52.32  susr=''; sgrp=''
   52.33  musr=''; mgrp=''
   52.34 @@ -71,6 +72,8 @@
   52.35          -v | --verbose       ) verbose=v   ;;
   52.36          --prefix=*           ) prefix=$arg ;;
   52.37          --tag=*              ) tag=$arg    ;;
   52.38 +        --stack=*            ) stack=$arg  ;;
   52.39 +        --unprivileged       ) unprivileged=yes ;;
   52.40          --usr=* | --user=*   ) usr=$arg    ;;
   52.41          --grp=* | --group=*  ) grp=$arg    ;;
   52.42          --susr=*             ) susr=$arg   ;;
   52.43 @@ -106,6 +109,7 @@
   52.44  if [ ".$help" = .1 ]; then
   52.45      echo "Usage: sh $me" 2>&1
   52.46      echo "       [--prefix=<prefix>] [--tag=<str>]" 2>&1
   52.47 +    echo "       [--stack=<name-or-url>] [--unprivileged]" 2>&1
   52.48      echo "       [--user=<usr>] [--group=<grp>]" 2>&1
   52.49      echo "       [--{s,m,r,n}usr=<usr>] [--{s,m,r,n}grp=<grp>]" 2>&1
   52.50      echo "       [--{s,m,r,n}uid=<uid>] [--{s,m,r,n}gid=<gid>]" 2>&1
   52.51 @@ -115,8 +119,33 @@
   52.52      exit 1
   52.53  fi
   52.54  
   52.55 +#   special support for environments with only a single 
   52.56 +#   fully unprivileged user account (the current user)
   52.57 +if [ ".$unprivileged" = .yes ]; then
   52.58 +    #   determine current user/group
   52.59 +    cusr=`(id -un) 2>/dev/null ||\
   52.60 +          (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
   52.61 +          (whoami) 2>/dev/null ||\
   52.62 +          (who am i | cut "-d " -f1) 2>/dev/null ||\
   52.63 +          echo $LOGNAME`
   52.64 +    cgid=`(id -g $cusr) 2>/dev/null ||\
   52.65 +          ((getent passwd "${cusr}"; grep "^${cusr}:" /etc/passwd; ypmatch "${cusr}" passwd; nismatch "${cusr}" passwd; nidump passwd . | grep "^${cusr}:") 2>/dev/null |\
   52.66 +           sed -n -e '1p' | awk -F: '{ print $4; }')`
   52.67 +    cgrp=`(id -gn $cusr) 2>/dev/null ||\
   52.68 +          ((getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null | grep "^[^:]*:[^:]*:${cgid}:" |\
   52.69 +           sed -n -e '1p' | awk -F: '{ print $1; }')`
   52.70 +    [ ".$cgrp" = . ] && cgrp="$cusr"
   52.71 +
   52.72 +    #   set all other user/group variants to current user/group
   52.73 +    for who in s m r n; do
   52.74 +        for what in usr grp; do
   52.75 +            eval "${who}${what}=\"\$c${what}\""
   52.76 +        done
   52.77 +    done
   52.78 +fi
   52.79 +
   52.80  #   determine missing parameters
   52.81 -eval `sh aux.usrgrp.sh \
   52.82 +eval `sh etc.usrgrp.sh \
   52.83        --usr="$usr" --grp="$grp" \
   52.84        --susr="$susr" --sgrp="$sgrp" \
   52.85        --musr="$musr" --mgrp="$mgrp" \
   52.86 @@ -141,8 +170,8 @@
   52.87  
   52.88  name="openpkg"
   52.89  spec="$name.spec"
   52.90 -version=`grep V_openpkg $spec | sed -e 'q' | awk '{ printf("%s", $3); }'`
   52.91 -release="$version"
   52.92 +version=`grep '^Version:' $spec | sed -e 'q' | awk '{ printf("%s", $2); }'`
   52.93 +release=`grep '^Release:' $spec | sed -e 'q' | awk '{ printf("%s", $2); }'`
   52.94  
   52.95  ##
   52.96  ##  display headline
   52.97 @@ -158,24 +187,18 @@
   52.98  
   52.99  if [ ".$bs" = .1 ]; then
  52.100      srcdir=.
  52.101 -    if [ -d ../../dst ]; then
  52.102 +    if [ -d ../dst ]; then
  52.103 +       dstdir=../dst
  52.104 +    elif [ -d ../../dst/openpkg ]; then
  52.105         dstdir=../../dst/openpkg
  52.106      else
  52.107         dstdir=.
  52.108      fi
  52.109      tmpdir="/tmp/$me.$$.d"
  52.110 -    if [ -d ../PKG/SRC ]; then
  52.111 -       pkgdir=../PKG/SRC
  52.112 -    elif [ -d ../PKG ]; then
  52.113 -       pkgdir=../PKG
  52.114 -    elif [ -d ../../PKG/SRC ]; then
  52.115 -       pkgdir=../../PKG/SRC
  52.116 -    elif [ -d ../../PKG ]; then
  52.117 -       pkgdir=../../PKG
  52.118 -    elif [ -d ../../pkg/src ]; then
  52.119 -       pkgdir=../../pkg/src
  52.120 -    elif [ -d ../../pkg ]; then
  52.121 -       pkgdir=../../pkg
  52.122 +    if [ -d ../pkg ]; then
  52.123 +       pkgdir=../pkg
  52.124 +    elif [ -d ../../pkg/openpkg ]; then
  52.125 +       pkgdir=../../pkg/openpkg
  52.126      else
  52.127         pkgdir=..
  52.128      fi
  52.129 @@ -196,7 +219,7 @@
  52.130      rm -f $tmpdir/.sh
  52.131      l_version="$release"
  52.132      l_release=`sh ./release.sh -r "${l_version}" -F "%t"`
  52.133 -    sed <$srcdir/aux.wrapsrc.sh >$tmpdir/openpkg.boot.tmp \
  52.134 +    sed <$srcdir/etc.wrapsrc.sh >$tmpdir/openpkg.boot.tmp \
  52.135          -e "s;@l_dir@;$name-$version-$release.src;" \
  52.136          -e "s;@l_release@;$l_release;" \
  52.137          -e "s;@l_version@;$l_version;"
  52.138 @@ -218,8 +241,10 @@
  52.139  ##
  52.140  
  52.141  V_rpm=`grep V_rpm $spec | sed -e 'q' | awk '{ printf("%s", $3); }'`
  52.142 -if [ -f "../../dst/openpkg/rpm-${V_rpm}.tar.gz" ]; then
  52.143 -    distdir="`cd ../../dst/openpkg; pwd`" # developer only
  52.144 +if [ -d ../dst ]; then
  52.145 +    distdir="`cd ../dst; pwd`"
  52.146 +elif [ -d ../../dst/openpkg ]; then
  52.147 +    distdir="`cd ../../dst/openpkg; pwd`"
  52.148  else
  52.149      distdir="`pwd`"
  52.150  fi
  52.151 @@ -229,14 +254,18 @@
  52.152  ##  perform prerequisite checks
  52.153  ##
  52.154  
  52.155 -sh ./aux.prereq.sh source || exit $?
  52.156 +sh ./etc.prereq.sh source || exit $?
  52.157  
  52.158  ##
  52.159  ##  find reasonable run-time paths and tools
  52.160  ##
  52.161  
  52.162  #   find reasonable temporary directory
  52.163 -tmpdir="${TMPDIR-/tmp}"
  52.164 +if [ -d ../tmp ]; then
  52.165 +    tmpdir="`cd ../tmp; pwd`"
  52.166 +else
  52.167 +    tmpdir="${TMPDIR-/tmp}"
  52.168 +fi
  52.169  
  52.170  #   find reasonable safe program path
  52.171  test ".$PATH" = . && PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin"
  52.172 @@ -264,7 +293,8 @@
  52.173    echo "_builddir=$tmpdir"
  52.174    echo "l_prefix=$prefix"
  52.175    echo "l_tag_fmt=\"$tag\""
  52.176 -  echo "l_buildroot=$tmpdir/$name-$version-root"
  52.177 +  echo "l_stack=$stack"
  52.178 +  echo "l_buildroot=$tmpdir/$name-$version-$release-buildroot"
  52.179    echo "l_susr=$susr"
  52.180    echo "l_sgrp=$sgrp"
  52.181    echo "l_musr=$musr"
  52.182 @@ -281,6 +311,7 @@
  52.183    echo "l_rgid=$rgid"
  52.184    echo "l_nuid=$nuid"
  52.185    echo "l_ngid=$ngid"
  52.186 +  echo "l_unprivileged=$unprivileged"
  52.187    echo "use_tar=$use_tar"
  52.188    echo "use_make=$use_make"
  52.189    echo "use_cc=$use_cc"
  52.190 @@ -341,7 +372,7 @@
  52.191  
  52.192  ##
  52.193  ##  adjust build environment so that the installed
  52.194 -##  "rpm" is actually useable, although it still resides in
  52.195 +##  "rpm" is actually usable, although it still resides in
  52.196  ##  the temporary location instead of the real location.
  52.197  ##
  52.198  
  52.199 @@ -354,6 +385,7 @@
  52.200  . $tmpdir/openpkg-*/.buildenv
  52.201  
  52.202  #   create a custom "rpm" command
  52.203 +#   (and direct it to an adjusted macro set)
  52.204  echo "++ creating custom RPM command"
  52.205  rm -f $tmpdir/rpm >/dev/null 2>&1
  52.206  rmdir $tmpdir/rpm >/dev/null 2>&1
  52.207 @@ -367,22 +399,21 @@
  52.208  fi
  52.209  ( echo "#!/bin/sh"
  52.210    echo "exec $RPM_BUILD_ROOT$prefix/lib/openpkg/rpm \\"
  52.211 -  echo "    --rcfile \"$tmpdir/rpm.1\" \\"
  52.212 -  echo "    --define \"__platform $RPM_BUILD_ROOT$prefix/etc/openpkg/platform\" \\"
  52.213 +  echo "    --macros \"$tmpdir/rpm.1:$tmpdir/rpm.2:$tmpdir/rpm.3\" \\"
  52.214 +  echo "    --rpmpopt \"$tmpdir/rpm.4:$tmpdir/rpm.5\" \\"
  52.215 +  echo "    --rpmlua \"$tmpdir/rpm.6\" \\"
  52.216    echo "    \"\$@\""
  52.217  ) >$tmpdir/rpm
  52.218  chmod a+x $tmpdir/rpm
  52.219  
  52.220 -#   direct our own "rpm" tool to adjusted macro sets
  52.221 -sed <`SOURCE rpmrc` >$tmpdir/rpm.1 \
  52.222 -    -e "s;^\\(macrofiles:\\) .*;\\1 $tmpdir/rpm.2:$tmpdir/rpm.3;"
  52.223 -
  52.224  #   use an adjusted vendor macro set
  52.225 -sed <$RPM_BUILD_ROOT$prefix/lib/openpkg/macros >$tmpdir/rpm.2 \
  52.226 +rm -f $tmpdir/rpm.1 >/dev/null 2>&1
  52.227 +sed <$RPM_BUILD_ROOT$prefix/lib/openpkg/rpmmacros >$tmpdir/rpm.1 \
  52.228      -e "s;$prefix;$RPM_BUILD_ROOT$prefix;g"
  52.229  
  52.230  #   override the vendor macro set
  52.231 -sed <`SOURCE rpmmacros` >$tmpdir/rpm.3 \
  52.232 +rm -f $tmpdir/rpm.2 >/dev/null 2>&1
  52.233 +sed <`SOURCE rpmmacros` >$tmpdir/rpm.2 \
  52.234      -e "s;@SUSR@;$susr;" \
  52.235      -e "s;@SGRP@;$sgrp;" \
  52.236      -e "s;@MUSR@;$musr;" \
  52.237 @@ -392,10 +423,11 @@
  52.238      -e "s;@NUSR@;$nusr;" \
  52.239      -e "s;@NGRP@;$ngrp;" \
  52.240      -e "s;@TAG@;$tag;" \
  52.241 +    -e "s;@l_unprivileged@;$unprivileged;" \
  52.242      -e "s;\\(%{l_prefix}/lib/openpkg/rpmtool\\);%{l_bash} \\1;g" \
  52.243      -e "s;@l_prefix_static@;$prefix;g" \
  52.244      -e "s;@l_prefix@;$RPM_BUILD_ROOT$prefix;g" \
  52.245 -    -e "s;%l_prefix\\([^_]\\);%l_prefix_INTERNAL\\1;g" \
  52.246 +    -e "s;^%l_prefix\\([^_]\\);%l_prefix_INTERNAL\\1;g" \
  52.247      -e "s;%{l_prefix};%{l_prefix_INTERNAL};g" \
  52.248      -e "s;^\\(%_specdir *\\).*;\\1 `pwd`;" \
  52.249      -e "s;^\\(%_sourcedir *\\).*;\\1 $distdir;" \
  52.250 @@ -405,17 +437,33 @@
  52.251      -e "s;@l_build_path@;/bin:/sbin:/usr/bin:/usr/sbin;g" \
  52.252      -e "s;@l_build_ldlp@;/usr/lib;g" \
  52.253      -e "s;@l_build_ulim@;:;g"
  52.254 -echo "%l_prefix $prefix" >>$tmpdir/rpm.3
  52.255  
  52.256 -#   use an own $HOME/.popt in order to make sure the "rpm"
  52.257 -#   tool is able to execute its sub-tools "rpm<x>".
  52.258 -V_rpm=`grep V_rpm $spec | sed -e 'q' | awk '{ printf("%s", $3); }'`
  52.259 -sed <$RPM_BUILD_ROOT$prefix/lib/openpkg/rpmpopt >$tmpdir/.popt \
  52.260 -    -e "s;^\\(rpm.*exec.*\\)\\(rpm[bdieukvq]*\\);\\1$RPM_BUILD_ROOT$prefix/lib/openpkg/\\2;"
  52.261 +#   provide some special overrides
  52.262 +rm -f $tmpdir/rpm.3 >/dev/null 2>&1
  52.263 +( echo "%l_prefix $prefix"
  52.264 +  echo "%l_rpm $tmpdir/rpm"
  52.265 +  echo "%__spec_install_pre %{nil}"
  52.266 +  echo "%__spec_clean_body  %{nil}"
  52.267 +  echo "%__platform $RPM_BUILD_ROOT$prefix/etc/openpkg/platform"
  52.268 +  echo "%_integrity_spec_cfg $RPM_BUILD_ROOT$prefix/etc/openpkg/license.d/BOOT"
  52.269 +  echo "%_integrity_proc_lua $RPM_BUILD_ROOT$prefix/lib/openpkg/license.lua"
  52.270 +  echo "%_integrity_pkey_pgp $RPM_BUILD_ROOT$prefix/etc/openpkg/openpkg.com.pgp"
  52.271 +) >$tmpdir/rpm.3
  52.272  
  52.273 -#   activate the .popt file
  52.274 -HOME=$tmpdir
  52.275 -export HOME
  52.276 +#   use an adjusted vendor POPT config
  52.277 +rm -f $tmpdir/rpm.4 >/dev/null 2>&1
  52.278 +sed <$RPM_BUILD_ROOT$prefix/lib/openpkg/rpmpopt >$tmpdir/rpm.4 \
  52.279 +    -e "s;$prefix;$RPM_BUILD_ROOT$prefix;g"
  52.280 +
  52.281 +#   override the vendor POPT config
  52.282 +rm -f $tmpdir/rpm.5 >/dev/null 2>&1
  52.283 +sed <$RPM_BUILD_ROOT$prefix/etc/openpkg/rpmpopt >$tmpdir/rpm.5 \
  52.284 +    -e "s;@l_prefix@;$RPM_BUILD_ROOT$prefix;g"
  52.285 +
  52.286 +#   use an adjusted vendor RPM Lua script
  52.287 +rm -f $tmpdir/rpm.6 >/dev/null 2>&1
  52.288 +sed <$RPM_BUILD_ROOT$prefix/etc/openpkg/rpmlua >$tmpdir/rpm.6 \
  52.289 +    -e "s;@l_prefix@;$RPM_BUILD_ROOT$prefix;g"
  52.290  
  52.291  ##
  52.292  ##   now initialize the RPM database under the temporary install location
  52.293 @@ -450,7 +498,7 @@
  52.294  ##
  52.295  
  52.296  echo "++ overwriting RPM installation by installing via RPM itself"
  52.297 -$tmpdir/rpm --install --justdb --force --noscripts --notriggers --ignoresize \
  52.298 +$tmpdir/rpm --install --justdb --replacepkgs --replacefiles --oldpackage --noscripts --notriggers --ignoresize \
  52.299      $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-*.rpm
  52.300  
  52.301  ##  Puhhhh!!! what a tricky bootstrapping procedure. But now we are
  52.302 @@ -462,28 +510,24 @@
  52.303  t="`$tmpdir/rpm --eval '%{l_platform -p}-%{l_tag}'`"
  52.304  
  52.305  #   find a reasonable destination directory for packages
  52.306 -if [ -d ../PKG/BIN ]; then
  52.307 -   dstdir=../PKG/BIN
  52.308 -elif [ -d ../PKG ]; then
  52.309 -   dstdir=../PKG
  52.310 -elif [ -d ../../PKG/BIN ]; then
  52.311 -   dstdir=../../PKG/BIN
  52.312 -elif [ -d ../../PKG ]; then
  52.313 -   dstdir=../../PKG
  52.314 +if [ -d ../pkg ]; then
  52.315 +   pkgdir=../pkg
  52.316 +elif [ -d ../../pkg/openpkg ]; then
  52.317 +   pkgdir=../../pkg/openpkg
  52.318  else
  52.319 -   dstdir=..
  52.320 +   pkgdir=..
  52.321  fi
  52.322  
  52.323  #   create Source-RPM file
  52.324  echo "++ creating bootstrap source RPM file"
  52.325 -$tmpdir/rpm -bs --nodeps $spec
  52.326 -cp $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.src.rpm $dstdir/
  52.327 -rm -f $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.src.rpm
  52.328 +$tmpdir/rpm -bs --nodeps --define "_srcrpmdir $pkgdir" $spec
  52.329  
  52.330  #   create Binary-RPM file
  52.331 +#   (notice that there might be a discrepancy in the platform
  52.332 +#   identification, so we have to copy the source via wildcard)
  52.333  echo "++ creating bootstrap binary RPM file"
  52.334 -cp $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.$t.rpm $dstdir/
  52.335 -rm -f $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.$t.rpm
  52.336 +cp $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-*.rpm $pkgdir/openpkg-$v.$t.rpm
  52.337 +rm -f $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-*.rpm
  52.338  
  52.339  #   create Binary-Bootstrap file
  52.340  echo "++ creating bootstrap binary shell script"
  52.341 @@ -492,13 +536,15 @@
  52.342         grep -v '^ *$' | grep -v '%defattr' |\
  52.343         sed -e 's;%config(noreplace) *;;' -e 's;%config *;;' -e 's;%ghost *;;' -e 's;%attr([^)]*) *;;' \
  52.344             -e 's;%dir *;;' -e 's;%{l_prefix}/;;' -e 's;^ *;;' -e "s;%{V_rpm};${V_rpm};"`
  52.345 +rm -f $RPM_BUILD_ROOT$prefix/RPM/DB/__db.[0-9]*
  52.346  db_files=""
  52.347  for db_file in \
  52.348      `$RPM_BUILD_ROOT$prefix/lib/openpkg/bash \
  52.349       $RPM_BUILD_ROOT$prefix/lib/openpkg/rpmdb \
  52.350           --prefix=$RPM_BUILD_ROOT$prefix \
  52.351           --dbpath=$RPM_BUILD_ROOT$prefix/RPM/DB \
  52.352 -         --list --quiet`; do
  52.353 +         --rpm=$tmpdir/rpm \
  52.354 +         --list --quiet` VERSION; do
  52.355      db_files="$db_files RPM/DB/$db_file"
  52.356  done
  52.357  chmod 644 $RPM_BUILD_ROOT$prefix/RPM/DB/*
  52.358 @@ -533,7 +579,7 @@
  52.359          -e 's;%{![?]l_\([^:}]*\)};${\1-""};g' \
  52.360          -e 's;%{l_\([^}]*\)};${\1};g' \
  52.361      >$tmpdir/rpm.post
  52.362 -sed <`SOURCE aux.wrapbin.sh` \
  52.363 +sed <`SOURCE etc.wrapbin.sh` \
  52.364      -e "s;@SUSR@;$susr;" -e "s;@SGRP@;$sgrp;" \
  52.365      -e "s;@MUSR@;$musr;" -e "s;@MGRP@;$mgrp;" \
  52.366      -e "s;@RUSR@;$rusr;" -e "s;@RGRP@;$rgrp;" \
  52.367 @@ -546,6 +592,7 @@
  52.368      -e "s;@l_platform@;$l_platform;" \
  52.369      -e "s;@l_release@;$l_release;" \
  52.370      -e "s;@l_version@;$l_version;" \
  52.371 +    -e "s;@l_unprivileged@;$unprivileged;" \
  52.372      -e "/^@PRE@/r $tmpdir/rpm.pre" \
  52.373      -e "/^@POST@/r $tmpdir/rpm.post" |\
  52.374      sed -e '/^@PRE@/d' -e '/^@POST@/d' >$tmpdir/openpkg.boot.tmp
  52.375 @@ -554,30 +601,30 @@
  52.376          printf("        ");
  52.377      }
  52.378  }' >>$tmpdir/openpkg.boot.tmp
  52.379 -rm -f $dstdir/openpkg-$v.$t.sh
  52.380 +rm -f $pkgdir/openpkg-$v.$t.sh
  52.381  dd if=$tmpdir/openpkg.boot.tmp bs=8192 count=8 \
  52.382 -   of=$dstdir/openpkg-$v.$t.sh 2>/dev/null
  52.383 +   of=$pkgdir/openpkg-$v.$t.sh 2>/dev/null
  52.384  rm -f $tmpdir/openpkg.boot.tmp
  52.385  ( cd $RPM_BUILD_ROOT$prefix
  52.386    $RPM_BUILD_ROOT$prefix/lib/openpkg/tar --no-recursion -cf - \
  52.387        openpkg.tar openpkg.bzip2 openpkg.tar.bz2
  52.388 -) >>$dstdir/openpkg-$v.$t.sh
  52.389 +) >>$pkgdir/openpkg-$v.$t.sh
  52.390  
  52.391  #   cleanup
  52.392  echo "++ cleaning up"
  52.393  cp `SOURCE rpmtool` $tmpdir/rpmtool
  52.394  rm -rf $RPM_BUILD_ROOT
  52.395  rm -rf $tmpdir/$name-$version
  52.396 -rm -f $tmpdir/rpm $tmpdir/rpm.[123] $tmpdir/.popt $tmpdir/rpm.pre $tmpdir/rpm.post
  52.397 +rm -f $tmpdir/rpm $tmpdir/rpm.[123456] $tmpdir/rpm.pre $tmpdir/rpm.post
  52.398  rm -f $prolog
  52.399  
  52.400  #   final hint about results
  52.401 -echo "++ resulting OpenPKG bootstrap package files:"
  52.402 -(cd $dstdir; ls -l openpkg-$v.$t.sh openpkg-$v.$t.rpm openpkg-$v.src.rpm)
  52.403 +echo "++ resulting OpenPKG Framework bootstrap package files:"
  52.404 +(cd $pkgdir; ls -l openpkg-$v.$t.sh openpkg-$v.$t.rpm openpkg-$v.src.rpm)
  52.405  set +x
  52.406 -( echo "You have successfully built the OpenPKG Package from scratch"
  52.407 +( echo "You have successfully built the OpenPKG Framework from scratch"
  52.408    echo "for prefix $prefix on target platform $l_platform. The input"
  52.409 -  echo "was the OpenPKG Source Bootstrap Package in file:"
  52.410 +  echo "was the OpenPKG Framework Source Bootstrap Package in file:"
  52.411    echo ""
  52.412    echo "    openpkg-$v.src.sh"
  52.413    echo ""
  52.414 @@ -587,23 +634,23 @@
  52.415    echo "    openpkg-$v.$t.rpm"
  52.416    echo "    openpkg-$v.$t.sh"
  52.417    echo ""
  52.418 -  echo "The first result file is the OpenPKG Source RPM Package,"
  52.419 -  echo "containing just the same contents than the OpenPKG Source"
  52.420 -  echo "Bootstrap Package, but now in RPM format. Optionally use this"
  52.421 -  echo "after the installation of the OpenPKG Binary Bootstrap Package"
  52.422 +  echo "The first result file is the OpenPKG Framework Source RPM Package,"
  52.423 +  echo "containing just the same contents than the OpenPKG Framework Source"
  52.424 +  echo "Bootstrap Package, but now in RPM format. Optionally use this after"
  52.425 +  echo "the installation of the OpenPKG Framework Binary Bootstrap Package"
  52.426    echo "if you want to rebuild from source again (but then with RPM"
  52.427    echo "available)."
  52.428    echo ""
  52.429 -  echo "The second result file is the OpenPKG Binary RPM Package,"
  52.430 +  echo "The second result file is the OpenPKG Framework Binary RPM Package,"
  52.431    echo "containing the installation files in RPM format for the OpenPKG"
  52.432    echo "instance $prefix. Optionally use this after the installation of"
  52.433 -  echo "the OpenPKG Binary Bootstrap Package if you want (usually for"
  52.434 -  echo "fixing something) to reinstall (but then with RPM available)."
  52.435 +  echo "the OpenPKG Framework Binary Bootstrap Package if you want (usually"
  52.436 +  echo "for fixing something) to reinstall (but then with RPM available)."
  52.437    echo ""
  52.438 -  echo "The third result file is the OpenPKG Binary Bootstrap Package,"
  52.439 -  echo "containing the installation files as a self-extracting shell"
  52.440 -  echo "script for the OpenPKG instance $prefix. Use this in YOUR NEXT"
  52.441 -  echo "STEP to initially create the OpenPKG instance from scratch."
  52.442 +  echo "The third result file is the OpenPKG Framework Binary Bootstrap"
  52.443 +  echo "Package, containing the installation files as a self-extracting"
  52.444 +  echo "shell script for the OpenPKG instance $prefix. Use this in YOUR"
  52.445 +  echo "NEXT STEP to initially create the OpenPKG instance from scratch."
  52.446    echo "Hence, proceed now by running the following command:"
  52.447    echo ""
  52.448    cusr=`(id -un) 2>/dev/null ||\
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/openpkg/openpkg.c	Tue Jul 31 12:23:42 2012 +0200
    53.3 @@ -0,0 +1,504 @@
    53.4 +/*
    53.5 +**  openpkg.c -- OpenPKG Frontend
    53.6 +**  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    53.7 +**
    53.8 +**  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    53.9 +**  All rights reserved. Licenses which grant limited permission to use,
   53.10 +**  copy, modify and distribute this software are available from the
   53.11 +**  OpenPKG GmbH.
   53.12 +**
   53.13 +**  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   53.14 +**  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   53.15 +**  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   53.16 +**  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   53.17 +**  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   53.18 +**  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   53.19 +**  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   53.20 +**  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   53.21 +**  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   53.22 +**  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   53.23 +**  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   53.24 +**  SUCH DAMAGE.
   53.25 +*/
   53.26 +
   53.27 +/* program information */
   53.28 +#define LICENSE \
   53.29 +    "Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>\n" \
   53.30 +    "\n" \
   53.31 +    "This software is property of the OpenPKG GmbH, DE MUC HRB 160208.\n" \
   53.32 +    "All rights reserved. Licenses which grant limited permission to use,\n" \
   53.33 +    "copy, modify and distribute this software are available from the\n" \
   53.34 +    "OpenPKG GmbH.\n" \
   53.35 +    "\n" \
   53.36 +    "THIS SOFTWARE IS PROVIDED \"AS IS\" AND ANY EXPRESSED OR IMPLIED\n" \
   53.37 +    "WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n" \
   53.38 +    "MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n" \
   53.39 +    "IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR\n" \
   53.40 +    "CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n" \
   53.41 +    "SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n" \
   53.42 +    "LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\n" \
   53.43 +    "USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n" \
   53.44 +    "ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n" \
   53.45 +    "OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT\n" \
   53.46 +    "OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" \
   53.47 +    "SUCH DAMAGE.\n"
   53.48 +
   53.49 +/* system includes */
   53.50 +#include <stdio.h>
   53.51 +#include <stdlib.h>
   53.52 +#include <stdarg.h>
   53.53 +#include <string.h>
   53.54 +#include <sys/types.h>
   53.55 +#include <sys/param.h>
   53.56 +#include <sys/stat.h>
   53.57 +#include <pwd.h>
   53.58 +#include <grp.h>
   53.59 +#include <unistd.h>
   53.60 +#include <errno.h>
   53.61 +
   53.62 +/* sanity check compilation */
   53.63 +#ifndef OPENPKG_PREFIX
   53.64 +#error OpenPKG instance prefix not defined
   53.65 +#endif
   53.66 +#ifndef OPENPKG_SUSR
   53.67 +#error OpenPKG super user not defined
   53.68 +#endif
   53.69 +#ifndef OPENPKG_MUSR
   53.70 +#error OpenPKG management user not defined
   53.71 +#endif
   53.72 +
   53.73 +/* platform specifics */
   53.74 +#if defined(OPENPKG_PLATFORM_FREEBSD) || \
   53.75 +    defined(OPENPKG_PLATFORM_NETBSD)  || \
   53.76 +    defined(OPENPKG_PLATFORM_OPENBSD) || \
   53.77 +    defined(OPENPKG_PLATFORM_SUNOS)   || \
   53.78 +    defined(OPENPKG_PLATFORM_LINUX)   || \
   53.79 +    defined(OPENPKG_PLATFORM_DARWIN)  || \
   53.80 +    defined(OPENPKG_PLATFORM_AIX)     || \
   53.81 +    defined(OPENPKG_PLATFORM_IRIX)    || \
   53.82 +    defined(OPENPKG_PLATFORM_HPUX)
   53.83 +#define HAVE_INITGROUPS
   53.84 +#endif
   53.85 +
   53.86 +/* global debug enable flag */
   53.87 +static int debug_enable = 0;
   53.88 +
   53.89 +/* helper function: emulate (still less portable) setenv(3) via (more portable) putenv(3) */
   53.90 +static int my_setenv(const char *name, const char *value, int overwrite)
   53.91 +{
   53.92 +    char *pair;
   53.93 +
   53.94 +    if (overwrite == 0 && getenv(name) != NULL)
   53.95 +        return 0;
   53.96 +    if ((pair = malloc(strlen(name) + 1 + strlen(value) + 1)) == NULL)
   53.97 +        return -1;
   53.98 +    strcpy(pair, name);
   53.99 +    strcat(pair, "=");
  53.100 +    strcat(pair, value);
  53.101 +    putenv(pair);
  53.102 +    return 0;
  53.103 +}
  53.104 +
  53.105 +/* helper function for printing a warning message */
  53.106 +static void warn(const char *fmt, ...)
  53.107 +{
  53.108 +    va_list ap;
  53.109 +
  53.110 +    va_start(ap, fmt);
  53.111 +    fprintf(stderr, "openpkg:WARNING: ");
  53.112 +    vfprintf(stderr, fmt, ap);
  53.113 +    fprintf(stderr, "\n");
  53.114 +    va_end(ap);
  53.115 +    return;
  53.116 +}
  53.117 +
  53.118 +/* helper function for printing a debug message */
  53.119 +static void debug(const char *fmt, ...)
  53.120 +{
  53.121 +    va_list ap;
  53.122 +
  53.123 +    va_start(ap, fmt);
  53.124 +    if (debug_enable) {
  53.125 +        fprintf(stderr, "openpkg:DEBUG: ");
  53.126 +        vfprintf(stderr, fmt, ap);
  53.127 +        fprintf(stderr, "\n");
  53.128 +    }
  53.129 +    va_end(ap);
  53.130 +    return;
  53.131 +}
  53.132 +
  53.133 +/* helper function for printing a fatal message and exit */
  53.134 +static void fatal(const char *fmt, ...)
  53.135 +{
  53.136 +    va_list ap;
  53.137 +
  53.138 +    va_start(ap, fmt);
  53.139 +    fprintf(stderr, "openpkg:ERROR: ");
  53.140 +    vfprintf(stderr, fmt, ap);
  53.141 +    fprintf(stderr, "\n");
  53.142 +    va_end(ap);
  53.143 +    exit(1);
  53.144 +    return;
  53.145 +}
  53.146 +
  53.147 +/* adjust process privileges */
  53.148 +static void adjust_privileges(uid_t uid, gid_t gid, int login)
  53.149 +{
  53.150 +    struct passwd *pw;
  53.151 +    char cwd[MAXPATHLEN];
  53.152 +
  53.153 +    /* optionally emulate a more complete login */
  53.154 +    if (login) {
  53.155 +        /* determine information about user id */
  53.156 +        if ((pw = getpwuid(uid)) == NULL)
  53.157 +            fatal("unable to resolve user id \"%d\": %s", uid, strerror(errno));
  53.158 +
  53.159 +        /* reset some essential environment variables */
  53.160 +        my_setenv("LOGNAME", pw->pw_name,   1);
  53.161 +        my_setenv("USER",    pw->pw_name,   1);
  53.162 +        my_setenv("SHELL",   pw->pw_shell,  1);
  53.163 +        my_setenv("HOME",    pw->pw_dir,    1);
  53.164 +
  53.165 +#ifdef HAVE_INITGROUPS
  53.166 +        /* initialize complete group access list */
  53.167 +        if (initgroups(pw->pw_name, pw->pw_gid) == -1)
  53.168 +            fatal("failed to initialize access group list via initgroups(3): %s", strerror(errno));
  53.169 +#endif
  53.170 +    }
  53.171 +
  53.172 +    /* switch to group id (first) */
  53.173 +    if (setgid(gid) == -1)
  53.174 +        fatal("failed to set group id via setgid(2): %s", strerror(errno));
  53.175 +
  53.176 +    /* switch to user id (second) */
  53.177 +    if (setuid(uid) == -1)
  53.178 +        fatal("failed to set user id via setuid(2): %s", strerror(errno));
  53.179 +
  53.180 +    /* in case the current working directory is NO LONGER accessible,
  53.181 +       try to switch to the home directory of the target identity to
  53.182 +       prevent failures in subsequently called programs (e.g. GNU bash) */
  53.183 +    if (login) {
  53.184 +        if (getcwd(cwd, sizeof(cwd)) == NULL) {
  53.185 +            warn("current working directory is no longer accessible -- switching to \"%s\"", pw->pw_dir);
  53.186 +            if (chdir(pw->pw_dir) == -1)
  53.187 +                fatal("unable to chdir(2) to \"%s\": %s", pw->pw_dir, strerror(errno));
  53.188 +        }
  53.189 +    }
  53.190 +
  53.191 +    return;
  53.192 +}
  53.193 +
  53.194 +/* check whether caller is an explictly configured management user */
  53.195 +static int check_whether_is_manager(uid_t my_uid, gid_t my_gid, uid_t m_uid, gid_t m_gid)
  53.196 +{
  53.197 +    char buf[1024];
  53.198 +    char *username;
  53.199 +    char *groupname;
  53.200 +    char *filename;
  53.201 +    struct stat sb;
  53.202 +    char *cp;
  53.203 +    FILE *fp;
  53.204 +    struct passwd *pw;
  53.205 +    struct group *gr;
  53.206 +    int i;
  53.207 +    int ok_uid;
  53.208 +    int ok_gid;
  53.209 +    int is_manager;
  53.210 +
  53.211 +    is_manager = 0;
  53.212 +
  53.213 +    /* path to the managers configuration file */
  53.214 +    filename = OPENPKG_PREFIX "/etc/openpkg/managers";
  53.215 +
  53.216 +    /* check permissions of file */
  53.217 +    if (stat(filename, &sb) == -1) {
  53.218 +        warn("unable to determine information about configuration"
  53.219 +             " file \"%s\": %s -- ignoring file", filename, strerror(errno));
  53.220 +        return 0;
  53.221 +    }
  53.222 +    if (sb.st_uid != m_uid) {
  53.223 +        warn("invalid owner user id %d (expected %d) on configuration"
  53.224 +             " file \"%s\" -- ignoring file", sb.st_uid, m_uid, filename);
  53.225 +        return 0;
  53.226 +    }
  53.227 +    if (sb.st_gid != m_gid) {
  53.228 +        warn("invalid owner group id %d (expected %d) on configuration"
  53.229 +             " file \"%s\" -- ignoring file", sb.st_gid, m_gid, filename);
  53.230 +        return 0;
  53.231 +    }
  53.232 +    if (sb.st_mode != (S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH)) {
  53.233 +        warn("invalid permissions on configuration"
  53.234 +             " file \"%s\" -- ignoring file", filename);
  53.235 +        return 0;
  53.236 +    }
  53.237 +
  53.238 +    /* parse configuration file */
  53.239 +    if ((fp = fopen(filename, "r")) == NULL) {
  53.240 +        warn("unable to open configuration file \"%s\": %s -- ignoring file", filename, strerror(errno));
  53.241 +        return 0;
  53.242 +    }
  53.243 +    while ((cp = fgets(buf, sizeof(buf), fp)) != NULL) {
  53.244 +        /* parse entry as "<username>[:<groupname>]" where both
  53.245 +           <username> and <groupname> can be set and default to "*"
  53.246 +           to indicate an arbitrary user or group */
  53.247 +        if ((i = strlen(buf)) == 0) {
  53.248 +            warn("unexpected empty buffer during parsing of configuration file \"%\"", filename);
  53.249 +            break;
  53.250 +        }
  53.251 +        if (i >= sizeof(buf)) {
  53.252 +            warn("unexpected buffer overflow during parsing of configuration file \"%\"", filename);
  53.253 +            break;
  53.254 +        }
  53.255 +        if (buf[i-1] != '\r' && buf[i-1] != '\n') {
  53.256 +            warn("unexpected non-newline-terminated line found during parsing of configuration file \"%\"", filename);
  53.257 +            break;
  53.258 +        }
  53.259 +        username = buf + strspn(buf, " \t");
  53.260 +        cp = username + strcspn(username, " \t#\r\n");
  53.261 +        *cp = '\0';
  53.262 +        if (username[0] == '#' || username[0] == '\r' || username[0] == '\n' || username[0] == '\0')
  53.263 +            continue;
  53.264 +        groupname = "*";
  53.265 +        if ((cp = strchr(username, ':')) != NULL) {
  53.266 +            *cp++ = '\0';
  53.267 +            groupname = cp;
  53.268 +        }
  53.269 +        debug("parsing result: username=\"%s\" groupname=\"%s\"", username, groupname);
  53.270 +
  53.271 +        /* check whether UID is ok */
  53.272 +        ok_uid = 0;
  53.273 +        if (strcmp(username, "*") == 0)
  53.274 +            ok_uid = 1;
  53.275 +        else {
  53.276 +            if ((pw = getpwnam(username)) == NULL) {
  53.277 +                warn("invalid username \"%s\" in \"%s\"", username, filename);
  53.278 +                continue;
  53.279 +            }
  53.280 +            if (pw->pw_uid == my_uid)
  53.281 +                ok_uid = 1;
  53.282 +        }
  53.283 +
  53.284 +        /* check whether GID is ok */
  53.285 +        ok_gid = 0;
  53.286 +        if (strcmp(groupname, "*") == 0)
  53.287 +            ok_gid = 1;
  53.288 +        else {
  53.289 +            if ((gr = getgrnam(groupname)) == NULL) {
  53.290 +                warn("invalid groupname \"%s\" in \"%s\"", groupname, filename);
  53.291 +                continue;
  53.292 +            }
  53.293 +            if (gr->gr_gid == my_gid)
  53.294 +                ok_gid = 1;
  53.295 +        }
  53.296 +
  53.297 +        /* if both UID and GID are ok, user is manager */
  53.298 +        debug("matching: username ok = %s, groupname ok = %s", ok_uid ? "yes" : "no", ok_gid ? "yes" : "no");
  53.299 +        if (ok_uid && ok_gid) {
  53.300 +            is_manager = 1;
  53.301 +            break;
  53.302 +        }
  53.303 +    }
  53.304 +    fclose(fp);
  53.305 +    return is_manager;
  53.306 +}
  53.307 +
  53.308 +/* check whether command requires super-user privileges */
  53.309 +static int check_whether_require_superuser(int argc, char *argv[])
  53.310 +{
  53.311 +    int require_superuser;
  53.312 +    int i, j;
  53.313 +
  53.314 +    require_superuser = 0;
  53.315 +    if (argc > 1 && strcmp(argv[1], "rpm") == 0) {
  53.316 +        for (i = 2; i < argc; i++) {
  53.317 +            if (strcmp(argv[i], "--") == 0)
  53.318 +                break;
  53.319 +            else if (   strcmp(argv[i], "--erase")      == 0
  53.320 +                     || strcmp(argv[i], "--freshen")    == 0
  53.321 +                     || strcmp(argv[i], "--install")    == 0
  53.322 +                     || strcmp(argv[i], "--upgrade")    == 0
  53.323 +                     || strcmp(argv[i], "--import")     == 0
  53.324 +                     || strcmp(argv[i], "--initdb")     == 0
  53.325 +                     || strcmp(argv[i], "--rebuilddb")  == 0
  53.326 +                     || strcmp(argv[i], "--db-build")   == 0
  53.327 +                     || strcmp(argv[i], "--db-rebuild") == 0
  53.328 +                     || strcmp(argv[i], "--db-cleanup") == 0
  53.329 +                     || strcmp(argv[i], "--db-fixate")  == 0
  53.330 +                     || strcmp(argv[i], "--setperms")   == 0
  53.331 +                     || strcmp(argv[i], "--setugids")   == 0) {
  53.332 +                require_superuser = 1;
  53.333 +                break;
  53.334 +            }
  53.335 +            else if (   argv[i][0] == '-'
  53.336 +                     && argv[i][1] != '-'
  53.337 +                     && argv[i][1] != 'b'
  53.338 +                     && argv[i][1] != 't'
  53.339 +                ) {
  53.340 +                for (j = 1; argv[i][j] != '\0'; j++) {
  53.341 +                    if (    (   argv[i][j] == 'q'
  53.342 +                             || argv[i][j] == 'K')
  53.343 +                         && argv[i][j+1] != '\0') {
  53.344 +                        j++;
  53.345 +                        continue;
  53.346 +                    }
  53.347 +                    else if (   argv[i][j] == 'i'
  53.348 +                        || argv[i][j] == 'U'
  53.349 +                        || argv[i][j] == 'F'
  53.350 +                        || argv[i][j] == 'V'
  53.351 +                        || argv[i][j] == 'e') {
  53.352 +                        require_superuser = 1;
  53.353 +                        break;
  53.354 +                    }
  53.355 +                }
  53.356 +                if (require_superuser)
  53.357 +                    break;
  53.358 +            }
  53.359 +        }
  53.360 +    }
  53.361 +    else if (argc > 1 && strcmp(argv[1], "rc") == 0) {
  53.362 +        require_superuser = 1;
  53.363 +        for (i = 2; i < argc; i++) {
  53.364 +            if (strcmp(argv[i], "--") == 0)
  53.365 +                break;
  53.366 +            else if (   strcmp(argv[i], "-p")       == 0
  53.367 +                     || strcmp(argv[i], "--print")  == 0
  53.368 +                     || strcmp(argv[i], "-e")       == 0
  53.369 +                     || strcmp(argv[i], "--eval")   == 0
  53.370 +                     || strcmp(argv[i], "-q")       == 0
  53.371 +                     || strcmp(argv[i], "--query")  == 0
  53.372 +                     || strcmp(argv[i], "-c")       == 0
  53.373 +                     || strcmp(argv[i], "--config") == 0) {
  53.374 +                require_superuser = 0;
  53.375 +                break;
  53.376 +            }
  53.377 +        }
  53.378 +    }
  53.379 +    return require_superuser;
  53.380 +}
  53.381 +
  53.382 +/* main program */
  53.383 +int main(int argc, char **argv, char **envp)
  53.384 +{
  53.385 +    int keep_original_privileges;
  53.386 +    int is_manager;
  53.387 +    int require_superuser;
  53.388 +    uid_t my_uid, my_euid;
  53.389 +    gid_t my_gid, my_egid;
  53.390 +    uid_t m_uid;
  53.391 +    gid_t m_gid;
  53.392 +    uid_t s_uid;
  53.393 +    gid_t s_gid;
  53.394 +    struct passwd *pw;
  53.395 +    struct group *gr;
  53.396 +    int dry_run;
  53.397 +    int license;
  53.398 +
  53.399 +    /* parse command line options */
  53.400 +    license = 0;
  53.401 +    dry_run = 0;
  53.402 +    keep_original_privileges = 0;
  53.403 +    if (argc <= 0)
  53.404 +        abort();
  53.405 +    argv++; argc--;
  53.406 +    while (argc > 0) {
  53.407 +        if (argv[0][0] != '-')
  53.408 +            break;
  53.409 +        else if (strcmp(argv[0], "--") == 0) {
  53.410 +            argv++; argc--;
  53.411 +            break;
  53.412 +        }
  53.413 +        else if (strcmp(argv[0], "--license") == 0) {
  53.414 +            license = 1;
  53.415 +            argv++; argc--;
  53.416 +            continue;
  53.417 +        }
  53.418 +        else if (strcmp(argv[0], "--debug") == 0) {
  53.419 +            debug_enable = 1;
  53.420 +            argv++; argc--;
  53.421 +            continue;
  53.422 +        }
  53.423 +        else if (strcmp(argv[0], "--dry-run") == 0) {
  53.424 +            dry_run = 1;
  53.425 +            argv++; argc--;
  53.426 +            continue;
  53.427 +        }
  53.428 +        else if (strcmp(argv[0], "--keep-privileges") == 0) {
  53.429 +            keep_original_privileges = 1;
  53.430 +            argv++; argc--;
  53.431 +            continue;
  53.432 +        }
  53.433 +        break;
  53.434 +    }
  53.435 +    argv--; argc++;
  53.436 +
  53.437 +    /* display stand-alone license information */
  53.438 +    if (license) {
  53.439 +        fprintf(stdout, "%s", LICENSE);
  53.440 +        exit(0);
  53.441 +    }
  53.442 +
  53.443 +    /* determine our current real and effective user/group ids */
  53.444 +    my_uid  = getuid();
  53.445 +    my_gid  = getgid();
  53.446 +    my_euid = geteuid();
  53.447 +    my_egid = getegid();
  53.448 +    if ((pw = getpwuid(my_uid)) == NULL)
  53.449 +        fatal("unable to resolve current user id %d: %s", my_uid, strerror(errno));
  53.450 +    if ((gr = getgrgid(my_gid)) == NULL)
  53.451 +        fatal("unable to resolve current group id %d: %s", my_gid, strerror(errno));
  53.452 +    debug("current-user: usr=%s uid=%d euid=%d grp=%s gid=%d egid=%d",
  53.453 +          pw->pw_name, my_uid, my_euid, gr->gr_name, my_gid, my_egid);
  53.454 +
  53.455 +    /* determine super user/group id */
  53.456 +    if ((pw = getpwnam(OPENPKG_SUSR)) == NULL)
  53.457 +        fatal("unable to resolve OpenPKG superuser username \"%s\": %s", OPENPKG_SUSR, strerror(errno));
  53.458 +    s_uid = pw->pw_uid;
  53.459 +    s_gid = pw->pw_gid;
  53.460 +    debug("super-user: s_usr=%s s_uid=%d s_gid=%d", OPENPKG_SUSR, s_uid, s_gid);
  53.461 +
  53.462 +    /* determine management user/group id */
  53.463 +    if ((pw = getpwnam(OPENPKG_MUSR)) == NULL)
  53.464 +        fatal("unable to resolve OpenPKG management username \"%s\": %s", OPENPKG_MUSR, strerror(errno));
  53.465 +    m_uid = pw->pw_uid;
  53.466 +    m_gid = pw->pw_gid;
  53.467 +    debug("management-user: m_grp=%s m_uid=%d m_gid=%d", OPENPKG_MUSR, m_uid, m_gid);
  53.468 +
  53.469 +    /* determine whether caller is explicitly configured as a management user */
  53.470 +    is_manager = 0;
  53.471 +    if (!keep_original_privileges)
  53.472 +        is_manager = check_whether_is_manager(my_uid, my_gid, m_uid, m_gid);
  53.473 +    debug("current user is manager: %s", is_manager ? "yes" : "no");
  53.474 +
  53.475 +    /* determine whether command requires super-user privileges */
  53.476 +    require_superuser = check_whether_require_superuser(argc, argv);
  53.477 +    debug("current command requires super user privileges: %s", require_superuser ? "yes" : "no");
  53.478 +
  53.479 +    /* adjust privileges according to determined information */
  53.480 +    if (!keep_original_privileges && require_superuser && is_manager && my_euid == 0) {
  53.481 +        /* increase privileges to super user */
  53.482 +        debug("increase privileges to super user");
  53.483 +        adjust_privileges(s_uid, s_gid, 1);
  53.484 +    }
  53.485 +    else if (!keep_original_privileges && !require_superuser && is_manager && my_euid == 0) {
  53.486 +        /* decrease privileges to management user */
  53.487 +        debug("decrease privileges to management user");
  53.488 +        adjust_privileges(m_uid, m_gid, 1);
  53.489 +    }
  53.490 +    else /* keep_original_privileges || !is_manager */ {
  53.491 +        /* drop effective privileges for current user*/
  53.492 +        debug("drop effective privileges for current user");
  53.493 +        adjust_privileges(my_uid, my_gid, 0);
  53.494 +    }
  53.495 +
  53.496 +    /* pass-through control to real Execution Frontend (shell script) */
  53.497 +    argv[0] = OPENPKG_PREFIX "/lib/openpkg/openpkg";
  53.498 +    debug("execute \"%s\"", argv[0]);
  53.499 +    if (!dry_run) {
  53.500 +        if (execve(argv[0], argv, envp) == -1)
  53.501 +            fatal("failed to execute \"%s\": %s", argv[0], strerror(errno));
  53.502 +        /* NOT REACHED */
  53.503 +        fatal("INTERNAL ERROR");
  53.504 +    }
  53.505 +    return 0;
  53.506 +}
  53.507 +
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/openpkg/openpkg.mk	Tue Jul 31 12:23:42 2012 +0200
    54.3 @@ -0,0 +1,33 @@
    54.4 +
    54.5 +CC             = cc
    54.6 +CFLAGS         =
    54.7 +LDFLAGS        =
    54.8 +LIBS           =
    54.9 +
   54.10 +OPENPKG_PREFIX = /openpkg
   54.11 +OPENPKG_SUSR   = root
   54.12 +OPENPKG_MUSR   = openpkg
   54.13 +
   54.14 +OPENPKG_DOT_C  = openpkg.c
   54.15 +
   54.16 +openpkg: $(OPENPKG_DOT_C)
   54.17 +	@os_name=`(uname -s) 2>/dev/null` || os_name='Unknown'; \
   54.18 +	os_name=`echo "$${os_name}" |\
   54.19 +	sed -e 's;[^a-zA-Z0-9];;g' |\
   54.20 +	tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`; \
   54.21 +	echo "++ compiling \"openpkg\" executable"; \
   54.22 +	echo "   OPENPKG_PLATFORM_$${os_name}"; \
   54.23 +	echo "   OPENPKG_PREFIX=\"$(OPENPKG_PREFIX)\""; \
   54.24 +	echo "   OPENPKG_SUSR=\"$(OPENPKG_SUSR)\""; \
   54.25 +	echo "   OPENPKG_MUSR=\"$(OPENPKG_MUSR)\""; \
   54.26 +	$(CC) $(CFLAGS) \
   54.27 +	    -DOPENPKG_PLATFORM_$${os_name} \
   54.28 +	    -DOPENPKG_PREFIX=\"$(OPENPKG_PREFIX)\" \
   54.29 +	    -DOPENPKG_SUSR=\"$(OPENPKG_SUSR)\" \
   54.30 +	    -DOPENPKG_MUSR=\"$(OPENPKG_MUSR)\" \
   54.31 +	    -o openpkg $(OPENPKG_DOT_C) \
   54.32 +	    $(LDFLAGS) $(LIBS)
   54.33 +
   54.34 +clean:
   54.35 +	-rm -f openpkg
   54.36 +
    55.1 --- a/openpkg/openpkg.pod	Tue Jul 31 12:12:54 2012 +0200
    55.2 +++ b/openpkg/openpkg.pod	Tue Jul 31 12:23:42 2012 +0200
    55.3 @@ -1,14 +1,13 @@
    55.4  ##
    55.5  ##  openpkg -- OpenPKG Tool Chain
    55.6 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    55.7 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    55.8 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    55.9  ##
   55.10 -##  Permission to use, copy, modify, and distribute this software for
   55.11 -##  any purpose with or without fee is hereby granted, provided that
   55.12 -##  the above copyright notice and this permission notice appear in all
   55.13 -##  copies.
   55.14 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   55.15 +##  All rights reserved. Licenses which grant limited permission to use,
   55.16 +##  copy, modify and distribute this software are available from the
   55.17 +##  OpenPKG GmbH.
   55.18  ##
   55.19 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   55.20 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   55.21  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   55.22  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   55.23  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   55.24 @@ -28,45 +27,16 @@
   55.25  
   55.26  =head1 NAME
   55.27  
   55.28 -B<OpenPKG> -- Cross-Platform Unix Software Packaging Facility
   55.29 +B<OpenPKG> -- Cross-Platform Unix Software Packaging
   55.30  
   55.31  =head1 SYNOPSIS
   55.32  
   55.33 -=over 4
   55.34 -
   55.35 -=item Command Line Interface
   55.36 -
   55.37  $ B<openpkg> [I<opt> ...] I<cmd> [I<cmd_opt> ...] [I<cmd_arg> ...]
   55.38  
   55.39  $ B<openpkg> B<man> I<cmd>
   55.40  
   55.41 -=item Project Locations
   55.42 +=head1 DESCRIPTION
   55.43  
   55.44 - http://www.openpkg.org/       web service
   55.45 - http://cvs.openpkg.org/       repository service
   55.46 - http://pgp.openpkg.org/       OpenPGP service
   55.47 - ftp://ftp.openpkg.org/        download service
   55.48 -
   55.49 -=item Project Forums
   55.50 -
   55.51 - petidomo@openpkg.org          mailing-list manager
   55.52 - openpkg-announce@openpkg.org  project announcements
   55.53 - openpkg-dev@openpkg.org       developer forum
   55.54 - openpkg-users@openpkg.org     users forum
   55.55 -
   55.56 -=item Local Documentation
   55.57 -
   55.58 - openpkg-rpm(1)                RPM package manager
   55.59 - openpkg-rpmbuild(1)           RPM package manager (build only)
   55.60 - openpkg-rpm2cpio(1)           RPM payload utility
   55.61 - openpkg-rpm-config(1)         RPM C API utility
   55.62 - openpkg-lsync(1)              local area synchronization
   55.63 - openpkg-rc(1)                 run-command facility
   55.64 -
   55.65 -=back
   55.66 -
   55.67 -=head1 DESCRIPTION
   55.68 -  
   55.69  OpenPKG is the world leading instrument for deployment and maintenance
   55.70  of Open Source software when administration crosses Unix platform
   55.71  boundaries. The OpenPKG project is a collaboration effort with the
   55.72 @@ -82,5 +52,140 @@
   55.73  scratch the initial state of the whole OpenPKG software packaging
   55.74  system.
   55.75  
   55.76 +=head1 TUTORIAL
   55.77 +
   55.78 +=over 3
   55.79 +
   55.80 +=item B<1. System Preparation (optional)>
   55.81 +
   55.82 +Before you start, the Unix system optionally should be prepared. Here
   55.83 +especially the necessary disk space requirements of OpenPKG have to be
   55.84 +taken into account.
   55.85 +
   55.86 + # optionally direct /openpkg to at least 150MB free disk space:
   55.87 + $ mkdir /storage/openpkg
   55.88 + $ ln -s /storage/openpkg /openpkg
   55.89 +
   55.90 + # optionally direct temp-directory to at least 250MB free disk space:
   55.91 + $ TMPDIR=/var/tmp
   55.92 + $ export TMPDIR
   55.93 +
   55.94 + # switch to temporary directory:
   55.95 + $ cd $TMPDIR
   55.96 +
   55.97 +=item B<2. Instance Bootstrapping>
   55.98 +
   55.99 +The next step is to bootstrap the OpenPKG instance. Here we are using
  55.100 +the standard /openpkg filesystem prefix. An arbitrary prefix can be
  55.101 +used as long as at least the "Bootstrap From Source" approach is used.
  55.102 +
  55.103 + # download bootstrap source shell package:
  55.104 + $ wget http://openpkg.org/go/download/openpkg.src.sh
  55.105 +
  55.106 + # build bootstrap binary shell package from source shell package:
  55.107 + $ sh openpkg.src.sh \
  55.108 +   --prefix=/openpkg --tag=openpkg \
  55.109 +   --user=openpkg --group=openpkg \
  55.110 +   --tag=openpkg
  55.111 +
  55.112 + # install bootstrap binary script package:
  55.113 + $ sh openpkg-*-*.*-openpkg.sh
  55.114 +
  55.115 +=item B<3. Software Deployment>
  55.116 +
  55.117 +Now you can install arbitrary OpenPKG software packages by either using
  55.118 +the lower-level OpenPKG RPM command or the higher-level OpenPKG tool
  55.119 +chain build command. As a simple illustration example the GNU Bash
  55.120 +package of OpenPKG is installed.
  55.121 +
  55.122 + # build and install GNU Bash:
  55.123 + $ /openpkg/bin/openpkg build bash | sh
  55.124 +
  55.125 +=item B<4. Software Usage>
  55.126 +
  55.127 +Finally, you can use the deployed software. Either through explicit
  55.128 +paths (reasonable if leveraging OpenPKG's multiple-instance feature) or
  55.129 +implicitly by merging the OpenPKG instance into the local environment.
  55.130 +
  55.131 + # explicit usage:
  55.132 + $ /openpkg/bin/bash --version
  55.133 +
  55.134 + # implicit usage (alternatively)
  55.135 + $ eval `/openpkg/bin/openpkg rc --eval all env`
  55.136 + $ bash --version
  55.137 +
  55.138 +=item B<5. Go Ahead!>
  55.139 +
  55.140 +Want to know more now? Please read the manual pages of at least the
  55.141 +deployment commands and then proceed by searching and deploying even
  55.142 +more software into your OpenPKG instance.
  55.143 +
  55.144 + # read manual pages:
  55.145 + $ /openpkg/bin/openpkg man search
  55.146 + $ /openpkg/bin/openpkg man build
  55.147 +
  55.148 + # search for a package
  55.149 + $ /openpkg/bin/openpkg search [-v] <regex>
  55.150 +
  55.151 + # deploy even more packages
  55.152 + $ /openpkg/bin/openpkg build \
  55.153 +   [-D[<package1>::]with_<name>] \
  55.154 +   [-D[<package2>::]with_<name>] \
  55.155 +   <package1> <package2> ... | sh
  55.156 +
  55.157 +For instance, to install and start an Apache HTTP server with SSL/TLS
  55.158 +support you can use:
  55.159 +
  55.160 + $ /openpkg/bin/openpkg search -v apache | more
  55.161 + $ /openpkg/bin/openpkg build -D with_mod_ssl=yes apache | sh
  55.162 + $ /openpkg/bin/openpkg rc apache start
  55.163 +
  55.164 +=item B<6. Cleanup>
  55.165 +
  55.166 +OpenPKG has not convinced you? Well, it's a pity, but no problem. You
  55.167 +can easily get rid of anything you installed at once (both the OpenPKG
  55.168 +instance and any of its OpenPKG packages) with the following simple
  55.169 +command:
  55.170 +
  55.171 + $ /openpkg/bin/openpkg rc all stop
  55.172 + $ /openpkg/bin/openpkg rpm -e `/openpkg/bin/openpkg rpm -qa`
  55.173 +
  55.174 +=back
  55.175 +
  55.176 +=head1 SEE ALSO
  55.177 +
  55.178 +OpenPKG local documentation can be viewed the command "B<openpkg man>
  55.179 +I<cmd>", where I<cmd> is one of the following commands:
  55.180 +
  55.181 + index           OpenPKG package indexing
  55.182 + search          OpenPKG package searching
  55.183 + mirror          OpenPKG package mirroring
  55.184 + build           OpenPKG package building and installing
  55.185 + rc              OpenPKG run-command facility
  55.186 + lsync           OpenPKG local area synchronization
  55.187 +
  55.188 + stack           OpenPKG software stack generation
  55.189 + makeproxy       OpenPKG proxy package generation
  55.190 + dev             OpenPKG development tool
  55.191 +
  55.192 + rpm             RPM package manager
  55.193 + rpm2cpio        RPM payload utility
  55.194 + rpm-config      RPM C API utility
  55.195 + rpmtool         OpenPKG RPM packaging helper tool
  55.196 +
  55.197 + license         OpenPKG license management
  55.198 + release         OpenPKG release information
  55.199 + register        OpenPKG registry client (obsolete)
  55.200 +
  55.201 + sea             Shell Execution Archive tool
  55.202 + uuid            Universal Unique Identifiers tool
  55.203 +
  55.204 +Additionally, OpenPKG can be found under the following locations on the
  55.205 +Internet:
  55.206 +
  55.207 + http://openpkg.org/  OpenPKG Project (Distribution)
  55.208 + http://openpkg.com/  OpenPKG GmbH (Framework, Support)
  55.209 + http://openpkg.net/  OpenPKG Foundation e.V. (Packages)
  55.210 +
  55.211  =cut
  55.212  
    56.1 --- a/openpkg/openpkg.sh	Tue Jul 31 12:12:54 2012 +0200
    56.2 +++ b/openpkg/openpkg.sh	Tue Jul 31 12:23:42 2012 +0200
    56.3 @@ -1,15 +1,14 @@
    56.4  #!@l_prefix@/lib/openpkg/bash
    56.5  ##
    56.6  ##  openpkg -- OpenPKG Tool Chain
    56.7 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    56.8 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    56.9 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
   56.10  ##
   56.11 -##  Permission to use, copy, modify, and distribute this software for
   56.12 -##  any purpose with or without fee is hereby granted, provided that
   56.13 -##  the above copyright notice and this permission notice appear in all
   56.14 -##  copies.
   56.15 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   56.16 +##  All rights reserved. Licenses which grant limited permission to use,
   56.17 +##  copy, modify and distribute this software are available from the
   56.18 +##  OpenPKG GmbH.
   56.19  ##
   56.20 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   56.21 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   56.22  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   56.23  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   56.24  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   56.25 @@ -94,13 +93,13 @@
   56.26  
   56.27  #   determine path to OpenPKG Tool Chain commands
   56.28  cmdpath="${openpkg_prefix}/libexec/openpkg"
   56.29 -if [ -d "${openpkg_prefix}/libexec/openpkg-tools" ]; then
   56.30 -    #   openpkg-tools package overrides
   56.31 -    cmdpath="${openpkg_prefix}/libexec/openpkg-tools:${cmdpath}"
   56.32 +if [ -d "${openpkg_prefix}/libexec/openpkg-bf" ]; then
   56.33 +    #   openpkg-bf package overrides
   56.34 +    cmdpath="${openpkg_prefix}/libexec/openpkg-bf:${cmdpath}"
   56.35  fi
   56.36 -if [ -d "${openpkg_prefix}/libexec/openpkg-audit" ]; then
   56.37 -    #   openpkg-audit package overrides
   56.38 -    cmdpath="${openpkg_prefix}/libexec/openpkg-audit:${cmdpath}"
   56.39 +if [ -d "${openpkg_prefix}/libexec/openpkg-rg" ]; then
   56.40 +    #   openpkg-rg package overrides
   56.41 +    cmdpath="${openpkg_prefix}/libexec/openpkg-rg:${cmdpath}"
   56.42  fi
   56.43  if [ ".${openpkg_tools_cmdpath}" != . ]; then
   56.44      #   user supplied path overrides
   56.45 @@ -110,9 +109,13 @@
   56.46  
   56.47  #   determine path to OpenPKG Tool Chain API
   56.48  apipath=""
   56.49 -if [ -d "${openpkg_prefix}/lib/openpkg-tools" ]; then
   56.50 -    #   openpkg-tools package overrides
   56.51 -    apipath="${openpkg_prefix}/lib/openpkg-tools:${apipath}"
   56.52 +if [ -d "${openpkg_prefix}/lib/openpkg-bf" ]; then
   56.53 +    #   openpkg-bf package overrides
   56.54 +    apipath="${openpkg_prefix}/lib/openpkg-bf:${apipath}"
   56.55 +fi
   56.56 +if [ -d "${openpkg_prefix}/lib/openpkg-rg" ]; then
   56.57 +    #   openpkg-rg package overrides
   56.58 +    apipath="${openpkg_prefix}/lib/openpkg-rg:${apipath}"
   56.59  fi
   56.60  if [ ".${openpkg_tools_apipath}" != . ]; then
   56.61      #   user supplied path overrides
   56.62 @@ -131,8 +134,7 @@
   56.63      echo "This is ${release} <http://www.openpkg.org/>"
   56.64      echo "Cross-Platform Unix Software Packaging Facility"
   56.65      echo ""
   56.66 -    echo "Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>"
   56.67 -    echo "Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>"
   56.68 +    echo "Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>"
   56.69      echo ""
   56.70      echo "The command \"${openpkg_prefix}/bin/openpkg\" is the official command-line"
   56.71      echo "execution frontend of the OpenPKG tool chain. Its usage is:"
   56.72 @@ -148,13 +150,29 @@
   56.73      echo ""
   56.74      echo "where <command> is one of the following commands:"
   56.75      echo "  rpm             (provided by bootstrap package)"
   56.76 -    echo "  rpmbuild        (provided by bootstrap package)"
   56.77 +    echo "  rpmcache        (provided by bootstrap package)"
   56.78 +    echo "  rpmconstant     (provided by bootstrap package)"
   56.79 +    echo "  rpmgrep         (provided by bootstrap package)"
   56.80      echo "  rpm2cpio        (provided by bootstrap package)"
   56.81      echo "  rpm-config      (provided by bootstrap package)"
   56.82 +    echo "  build           (provided by bootstrap package)"
   56.83 +    echo "  curl            (provided by bootstrap package)"
   56.84 +    echo "  dev             (provided by bootstrap package)"
   56.85 +    echo "  index           (provided by bootstrap package)"
   56.86 +    echo "  license         (provided by bootstrap package)"
   56.87 +    echo "  lint-fsl        (provided by bootstrap package)"
   56.88 +    echo "  lint-rc         (provided by bootstrap package)"
   56.89 +    echo "  lint-rpm        (provided by bootstrap package)"
   56.90 +    echo "  lint-spec       (provided by bootstrap package)"
   56.91 +    echo "  lsync           (provided by bootstrap package)"
   56.92 +    echo "  makeproxy       (provided by bootstrap package)"
   56.93 +    echo "  man             (provided by bootstrap package)"
   56.94 +    echo "  rc              (provided by bootstrap package)"
   56.95 +    echo "  register        (provided by bootstrap package)"
   56.96 +    echo "  release         (provided by bootstrap package)"
   56.97 +    echo "  svs             (provided by bootstrap package)"
   56.98      echo "  uuid            (provided by bootstrap package)"
   56.99 -    echo "  rc              (provided by bootstrap package)"
  56.100 -    echo "  lsync           (provided by bootstrap package)"
  56.101 -    echo "  man             (provided by bootstrap package)"
  56.102 +
  56.103      #   install command intentionally left out in above display!
  56.104  
  56.105      #   dynamically figure out add-on commands
    57.1 --- a/openpkg/openpkg.spec	Tue Jul 31 12:12:54 2012 +0200
    57.2 +++ b/openpkg/openpkg.spec	Tue Jul 31 12:23:42 2012 +0200
    57.3 @@ -1,14 +1,13 @@
    57.4  ##
    57.5  ##  openpkg.spec -- OpenPKG RPM Package Specification
    57.6 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    57.7 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    57.8 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    57.9  ##
   57.10 -##  Permission to use, copy, modify, and distribute this software for
   57.11 -##  any purpose with or without fee is hereby granted, provided that
   57.12 -##  the above copyright notice and this permission notice appear in all
   57.13 -##  copies.
   57.14 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   57.15 +##  All rights reserved. Licenses which grant limited permission to use,
   57.16 +##  copy, modify and distribute this software are available from the
   57.17 +##  OpenPKG GmbH.
   57.18  ##
   57.19 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   57.20 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   57.21  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   57.22  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   57.23  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   57.24 @@ -38,144 +37,228 @@
   57.25  #   o any make(1)
   57.26  #   o any cc(1)
   57.27  
   57.28 -#   the package version/release
   57.29 -%define       V_openpkg  20120714
   57.30 -
   57.31  #   the used software versions
   57.32 -%define       V_rpm      4.2.1
   57.33 -%define       V_zlib     1.2.5
   57.34 -%define       V_bzip2    1.0.5
   57.35 -%define       V_beecrypt 4.1.2
   57.36 -%define       V_curl     7.21.1
   57.37 -%define       V_make     3.82
   57.38 -%define       V_gzip     1.4
   57.39 -%define       V_gzip_r   1.13
   57.40 -%define       V_patch    2.6.1
   57.41 -%define       V_tar      1.23
   57.42 -%define       V_bash     3.2
   57.43 -%define       V_uuid     1.6.2
   57.44 -%define       V_config   20060923
   57.45 -%define       V_registry 1.1.3
   57.46 -%define       V_perl     5.10.0
   57.47 -%define       V_openssl  0.9.8g
   57.48 -%define       V_tools    1.4.5
   57.49 -%define       V_exec     2.0.1-C
   57.50 +%define       V_rpm_major   5.1
   57.51 +%define       V_rpm_minor   9
   57.52 +%define       V_popt        1.16
   57.53 +%define       V_db          4.7.25
   57.54 +%define       V_lua         5.1.4
   57.55 +%define       V_sqlite      3.6.17
   57.56 +%define       V_zlib        1.2.7
   57.57 +%define       V_bzip2       1.0.6
   57.58 +%define       V_beecrypt    4.2.1
   57.59 +%define       V_curl        7.26.0
   57.60 +%define       V_pcre        8.31
   57.61 +%define       V_make        3.82
   57.62 +%define       V_gzip        1.5
   57.63 +%define       V_patch       2.6.1
   57.64 +%define       V_tar         1.26
   57.65 +%define       V_bash        4.2
   57.66 +%define       V_bash_pl     29
   57.67 +%define       V_uuid        1.6.2
   57.68 +%define       V_config      20120627
   57.69 +%define       V_perl        5.16.0
   57.70 +%define       V_openssl     1.0.1c
   57.71 +%define       V_xz          5.0.4
   57.72 +%define       V_shtool      2.0.8
   57.73 +%define       V_libarchive  3.0.3
   57.74 +%define       V_diffutils   3.2
   57.75 +%define       V_svs         1.1.0
   57.76  
   57.77  #   package information
   57.78  Name:         openpkg
   57.79 -Summary:      OpenPKG Bootstrap
   57.80 -URL:          http://www.openpkg.org/
   57.81 -Vendor:       OpenPKG
   57.82 -Packager:     OpenPKG Foundation e.V.
   57.83 -Distribution: OpenPKG Community
   57.84 -Class:        CORE
   57.85 +Summary:      OpenPKG Framework
   57.86 +URL:          http://openpkg.org/
   57.87 +Vendor:       OpenPKG GmbH
   57.88 +Packager:     OpenPKG GmbH
   57.89 +Distribution: OpenPKG
   57.90 +Class:        BOOT
   57.91  Group:        Bootstrapping
   57.92 -License:      MIT/BSD/LGPL/GPL
   57.93 -Version:      %{V_openpkg}
   57.94 -Release:      %{V_openpkg}
   57.95 +License:      Proprietary, Open Source
   57.96 +Version:      4.6.7
   57.97 +Release:      20120708
   57.98  
   57.99 -#   list of sources
  57.100 +#   list of pristine upstream sources
  57.101  Source0:      ftp://ftp.gnu.org/gnu/patch/patch-%{V_patch}.tar.gz
  57.102  Source1:      ftp://ftp.cwru.edu/pub/bash/bash-%{V_bash}.tar.gz
  57.103  Source2:      ftp://ftp.gnu.org/gnu/make/make-%{V_make}.tar.gz
  57.104  Source3:      ftp://ftp.gnu.org/gnu/tar/tar-%{V_tar}.tar.gz
  57.105 -Source4:      ftp://ftp.openpkg.org/sources/CPY/config/config-%{V_config}.tar.gz
  57.106 -Source5:      ftp://ftp.openpkg.org/sources/CPY/openpkg-registry/openpkg-registry-%{V_registry}.tar.gz
  57.107 -Source6:      ftp://ftp.openpkg.org/sources/CPY/openpkg-tools/openpkg-tools-%{V_tools}.tar.gz
  57.108 -Source7:      ftp://ftp.openpkg.org/sources/CPY/openpkg/gzip-%{V_gzip}-openpkg-r%{V_gzip_r}.tar
  57.109 -Source8:      ftp://ftp.gnu.org/gnu/gzip/gzip-%{V_gzip}.tar
  57.110 -Source9:      ftp://ftp.openpkg.org/sources/CPY/openpkg/openpkg-executable-%{V_exec}.tar.gz
  57.111 -Source10:     ftp://ftp.openpkg.org/sources/CPY/openpkg/rpm-%{V_rpm}.tar.gz
  57.112 -Source11:     ftp://ftp.openpkg.org/sources/CPY/perl/perl-%{V_perl}-mini.tar.gz
  57.113 -Source12:     ftp://ftp.openssl.org/source/openssl-%{V_openssl}.tar.gz
  57.114 -Source13:     ftp://ftp.ossp.org/pkg/lib/uuid/uuid-%{V_uuid}.tar.gz
  57.115 -Source14:     http://curl.haxx.se/download/curl-%{V_curl}.tar.gz
  57.116 -Source15:     http://switch.dl.sourceforge.net/beecrypt/beecrypt-%{V_beecrypt}.tar.gz
  57.117 -Source16:     http://www.bzip.org/%{V_bzip2}/bzip2-%{V_bzip2}.tar.gz
  57.118 -Source17:     http://www.zlib.net/zlib-%{V_zlib}.tar.gz
  57.119 +Source4:      http://download.openpkg.org/components/versioned/config/config-%{V_config}.tar.gz
  57.120 +Source5:      http://download.openpkg.org/components/derived/gzip/gzip-%{V_gzip}.tar
  57.121 +Source6:      http://download.openpkg.org/components/derived/perl/perl-%{V_perl}-mini.tar.gz
  57.122 +Source7:      http://rpm5.org/files/rpm/rpm-%{V_rpm_major}/rpm-%{V_rpm_major}.%{V_rpm_minor}.tar.gz
  57.123 +Source8:      ftp://ftp.openssl.org/source/openssl-%{V_openssl}.tar.gz
  57.124 +Source9:      ftp://ftp.ossp.org/pkg/lib/uuid/uuid-%{V_uuid}.tar.gz
  57.125 +Source10:     http://curl.haxx.se/download/curl-%{V_curl}.tar.gz
  57.126 +Source11:     http://switch.dl.sourceforge.net/beecrypt/beecrypt-%{V_beecrypt}.tar.gz
  57.127 +Source12:     http://www.bzip.org/%{V_bzip2}/bzip2-%{V_bzip2}.tar.gz
  57.128 +Source13:     http://www.zlib.net/zlib-%{V_zlib}.tar.gz
  57.129 +Source14:     http://rpm5.org/files/popt/popt-%{V_popt}.tar.gz
  57.130 +Source15:     http://www.sqlite.org/sqlite-%{V_sqlite}.tar.gz
  57.131 +Source16:     ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-%{V_pcre}.tar.gz
  57.132 +Source17:     http://libarchive.googlecode.com/files/libarchive-%{V_libarchive}.tar.gz
  57.133 +Source18:     ftp://ftp.gnu.org/gnu/diffutils/diffutils-%{V_diffutils}.tar.gz
  57.134 +Source19:     ftp://ftp.ossp.org/pkg/tool/svs/svs-%{V_svs}.tar.gz
  57.135 +Source20:     http://tukaani.org/xz/xz-%{V_xz}.tar.gz
  57.136 +
  57.137 +#   list of local patches against pristine upstream sources
  57.138  Source100:    bash.patch
  57.139 -Source101:    beecrypt.patch
  57.140 -Source102:    make.patch
  57.141 -Source103:    openssl.patch
  57.142 -Source104:    perl.patch
  57.143 -Source105:    tar.patch
  57.144 -Source106:    rpm.patch.bugfix
  57.145 -Source107:    rpm.patch.feature
  57.146 -Source108:    rpm.patch.porting
  57.147 -Source109:    rpm.patch.regen
  57.148 -Source200:    HISTORY
  57.149 -Source201:    README
  57.150 -Source202:    aux.prereq.sh
  57.151 -Source203:    aux.usrgrp.sh
  57.152 -Source204:    aux.wrapbin.sh
  57.153 -Source205:    aux.wrapsrc.sh
  57.154 -Source206:    dot.bash_login
  57.155 -Source207:    dot.bashrc
  57.156 -Source208:    dot.lsyncrc
  57.157 -Source209:    install.sh
  57.158 -Source210:    local.README
  57.159 -Source211:    lsync
  57.160 -Source212:    lsync.8
  57.161 -Source213:    lsync.pod
  57.162 -Source214:    man.sh
  57.163 -Source215:    openpkg.1
  57.164 -Source216:    openpkg.boot
  57.165 -Source217:    openpkg.com.pgp
  57.166 -Source218:    openpkg.net.pgp
  57.167 -Source219:    openpkg.org.pgp
  57.168 -Source220:    openpkg.pod
  57.169 -Source221:    openpkg.sh
  57.170 -Source222:    pod2man.sh
  57.171 -Source223:    rc
  57.172 -Source224:    rc.8
  57.173 -Source225:    rc.conf
  57.174 -Source226:    rc.func
  57.175 -Source227:    rc.openpkg
  57.176 -Source228:    rc.pod
  57.177 -Source229:    release.8
  57.178 -Source230:    release.pod
  57.179 -Source231:    release.sh
  57.180 -Source232:    root.README
  57.181 -Source233:    rpm-config.8
  57.182 -Source234:    rpm-config.pod
  57.183 -Source235:    rpm-config.sh
  57.184 -Source236:    rpmdb
  57.185 -Source237:    rpmtool
  57.186 -Source238:    rpmtool.8
  57.187 -Source239:    rpmtool.pod
  57.188 -Source240:    shtool
  57.189 -Source241:    uuid.8
  57.190 -Source242:    uuid.pod
  57.191 -Source243:    uuid.sh
  57.192 -Source244:    rpmmacros
  57.193 -Source245:    rpmpopt
  57.194 -Source246:    rpmrc
  57.195 +Source101:    bash.patch.vendor
  57.196 +Source102:    beecrypt.patch
  57.197 +Source103:    make.patch
  57.198 +Source104:    openssl.patch
  57.199 +Source105:    perl.patch
  57.200 +Source106:    tar.patch
  57.201 +Source107:    rpm.patch
  57.202 +Source108:    popt.patch
  57.203 +Source109:    sqlite.patch
  57.204 +Source110:    curl.patch
  57.205 +Source111:    pcre.patch
  57.206 +Source112:    diffutils.patch
  57.207 +Source113:    libarchive.patch
  57.208 +Source114:    patch.strnlen.c
  57.209 +Source115:    patch.Makefile.in
  57.210 +Source116:    xz.patch
  57.211 +Source117:    zlib.patch
  57.212 +
  57.213 +#   list of local sources
  57.214 +Source200:    README
  57.215 +Source201:    etc.prereq.sh
  57.216 +Source202:    etc.usrgrp.sh
  57.217 +Source203:    etc.wrapbin.sh
  57.218 +Source204:    etc.wrapsrc.sh
  57.219 +Source205:    dot.bash_login
  57.220 +Source206:    dot.bashrc
  57.221 +Source207:    dot.lsyncrc
  57.222 +Source208:    local.README
  57.223 +Source209:    lsync
  57.224 +Source210:    lsync.8
  57.225 +Source211:    lsync.pod
  57.226 +Source212:    man.sh
  57.227 +Source213:    openpkg.1
  57.228 +Source214:    openpkg.boot
  57.229 +Source215:    openpkg.com.pgp
  57.230 +Source216:    openpkg.net.pgp
  57.231 +Source217:    openpkg.org.pgp
  57.232 +Source218:    openpkg.pod
  57.233 +Source219:    openpkg.sh
  57.234 +Source220:    rc
  57.235 +Source221:    rc.8
  57.236 +Source222:    rc.conf
  57.237 +Source223:    rc.func
  57.238 +Source224:    rc.openpkg
  57.239 +Source225:    rc.pod
  57.240 +Source226:    release.8
  57.241 +Source227:    release.pod
  57.242 +Source228:    release.sh
  57.243 +Source229:    root.README
  57.244 +Source230:    rpm-config.8
  57.245 +Source231:    rpm-config.pod
  57.246 +Source232:    rpm-config.sh
  57.247 +Source233:    rpmdb
  57.248 +Source234:    rpmtool
  57.249 +Source235:    rpmtool.8
  57.250 +Source236:    rpmtool.pod
  57.251 +Source237:    shtool
  57.252 +Source238:    shtool.sh
  57.253 +Source239:    uuid.8
  57.254 +Source240:    uuid.pod
  57.255 +Source241:    uuid.sh
  57.256 +Source242:    rpmmacros
  57.257 +Source243:    rpmpopt
  57.258 +Source244:    curl.sh
  57.259 +Source245:    index.pl
  57.260 +Source246:    index.8
  57.261 +Source247:    index.pod
  57.262 +Source248:    build.pl
  57.263 +Source249:    build.8
  57.264 +Source250:    build.pod
  57.265 +Source251:    makeproxy.pl
  57.266 +Source252:    makeproxy.8
  57.267 +Source253:    lint-fsl.pl
  57.268 +Source254:    lint-rc.pl
  57.269 +Source255:    lint-rpm.pl
  57.270 +Source256:    lint-spec.pl
  57.271 +Source257:    dev.pl
  57.272 +Source258:    dev.8
  57.273 +Source259:    dev.pod
  57.274 +Source260:    openpkg.mk
  57.275 +Source261:    openpkg.c
  57.276 +Source262:    Makefile
  57.277 +Source263:    mutex.c
  57.278 +Source264:    mutex.mk
  57.279 +Source265:    register.sh
  57.280 +Source266:    register.pod
  57.281 +Source267:    register.8
  57.282 +Source268:    rpm.sh
  57.283 +Source269:    license.lua
  57.284 +Source270:    license-BOOT.txt
  57.285 +Source271:    license-COMMUNITY.txt
  57.286 +Source272:    license-EVAL.txt
  57.287 +Source273:    license-EXAMPLE.txt
  57.288 +Source274:    license-PROMO.txt
  57.289 +Source275:    license-RECOVERY.txt
  57.290 +Source276:    license.sh
  57.291 +Source277:    license.pod
  57.292 +Source278:    license.8
  57.293 +Source279:    rpmlua
  57.294 +Source280:    sea.sh
  57.295 +Source281:    sea.pod
  57.296 +Source282:    sea.8
  57.297 +Source283:    stack.sh
  57.298 +Source284:    stack.pod
  57.299 +Source285:    stack.8
  57.300 +Source286:    search.pl
  57.301 +Source287:    search.pod
  57.302 +Source288:    search.8
  57.303 +Source289:    mirror.pl
  57.304 +Source290:    mirror.pod
  57.305 +Source291:    mirror.8
  57.306  
  57.307  #   build information
  57.308 -Prefix:       %{l_prefix}
  57.309  BuildRoot:    %{l_buildroot}
  57.310  AutoReq:      no
  57.311  AutoReqProv:  no
  57.312 +Provides:     %{l_prefix}
  57.313  Provides:     OpenPKG
  57.314 +Provides:     openpkg = %{release}-%{release}
  57.315  
  57.316  %description
  57.317 -    This is the bootstrap package for the RPM-based Unix Software
  57.318 -    Package Hierarchy OpenPKG. The RPM Package Manager (RPM) is a
  57.319 -    sophisticated and portable package manager for Unix platforms,
  57.320 -    which supports automated building, installation, management and
  57.321 -    deinstallation of Unix software. RPM was originally designed and
  57.322 -    implemented for the RedHat Linux operating system where it manages
  57.323 -    every file on the whole system. OpenPKG uses RPM only for managing
  57.324 -    the files in a particular filesystem hierarchy dedicated to the
  57.325 -    installation of third-party software packages provided by the
  57.326 -    OpenPKG project.
  57.327 +    This is the OpenPKG Framework, the so-called "bootstrap" package
  57.328 +    of OpenPKG. OpenPKG is a cross-platform, self-contained, RPM-based
  57.329 +    software packaging solution, targeting the flexible building of
  57.330 +    software stacks on Unix platforms. The RPM Package Manager (RPM)
  57.331 +    is the underlying, sophisticated and portable package management
  57.332 +    tool which drives the automated building, installation, management
  57.333 +    and deinstallation of all Unix software components in an OpenPKG
  57.334 +    software stack.
  57.335  
  57.336 -    The OpenPKG bootstrap package includes the following software:
  57.337 -        RPM %{V_rpm}, ZLib %{V_zlib}, GNU Bzip2 %{V_bzip2},
  57.338 -        GNU Gzip %{V_gzip}, GNU Tar %{V_tar}, GNU Patch %{V_patch},
  57.339 -        GNU Make %{V_make}, GNU Bash %{V_bash}, cURL %{V_curl},
  57.340 -        OSSP uuid %{V_uuid}, BeeCrypt %{V_beecrypt},
  57.341 -        OpenSSL %{V_openssl}, Perl %{V_perl}
  57.342 +    This OpenPKG package contains the following individual
  57.343 +    software components (individual licenses listed in brackets):
  57.344 +        OpenPKG Framework  %(echo "%{version}"                    | awk '{ printf("%%-7s", $1); }') [Proprietary]
  57.345 +        rpm5.org RPM       %(echo "%{V_rpm_major}.%{V_rpm_minor}" | awk '{ printf("%%-7s", $1); }') [LGPL]
  57.346 +        rpm5.org POPT      %(echo "%{V_popt}"                     | awk '{ printf("%%-7s", $1); }') [LGPL]
  57.347 +        BeeCrypt           %(echo "%{V_beecrypt}"                 | awk '{ printf("%%-7s", $1); }') [LGPL]
  57.348 +        Lua                %(echo "%{V_lua}"                      | awk '{ printf("%%-7s", $1); }') [MIT]
  57.349 +        Berkeley-DB        %(echo "%{V_db}"                       | awk '{ printf("%%-7s", $1); }') [BSD/MIT]
  57.350 +        SQLite             %(echo "%{V_sqlite}"                   | awk '{ printf("%%-7s", $1); }') [Public-Domain]
  57.351 +        PCRE               %(echo "%{V_pcre}"                     | awk '{ printf("%%-7s", $1); }') [BSD/MIT]
  57.352 +        ZLib               %(echo "%{V_zlib}"                     | awk '{ printf("%%-7s", $1); }') [BSD/MIT]
  57.353 +        XZ                 %(echo "%{V_xz}"                       | awk '{ printf("%%-7s", $1); }') [PD/LGPL/GPL]
  57.354 +        GNU Bzip2          %(echo "%{V_bzip2}"                    | awk '{ printf("%%-7s", $1); }') [BSD/MIT]
  57.355 +        GNU Gzip           %(echo "%{V_gzip}"                     | awk '{ printf("%%-7s", $1); }') [GPL]
  57.356 +        GNU Tar            %(echo "%{V_tar}"                      | awk '{ printf("%%-7s", $1); }') [GPL]
  57.357 +        GNU Patch          %(echo "%{V_patch}"                    | awk '{ printf("%%-7s", $1); }') [GPL]
  57.358 +        GNU Shtool         %(echo "%{V_shtool}"                   | awk '{ printf("%%-7s", $1); }') [GPL]
  57.359 +        GNU Make           %(echo "%{V_make}"                     | awk '{ printf("%%-7s", $1); }') [GPL]
  57.360 +        GNU Bash           %(echo "%{V_bash}.%{V_bash_pl}"        | awk '{ printf("%%-7s", $1); }') [GPL]
  57.361 +        GNU DiffUtils      %(echo "%{V_diffutils}"                | awk '{ printf("%%-7s", $1); }') [GPL]
  57.362 +        BSD libarchive     %(echo "%{V_libarchive}"               | awk '{ printf("%%-7s", $1); }') [BSD/MIT]
  57.363 +        OSSP uuid          %(echo "%{V_uuid}"                     | awk '{ printf("%%-7s", $1); }') [BSD/MIT]
  57.364 +        OSSP svs           %(echo "%{V_svs}"                      | awk '{ printf("%%-7s", $1); }') [BSD/MIT]
  57.365 +        cURL               %(echo "%{V_curl}"                     | awk '{ printf("%%-7s", $1); }') [BSD/MIT]
  57.366 +        OpenSSL            %(echo "%{V_openssl}"                  | awk '{ printf("%%-7s", $1); }') [BSD]
  57.367 +        Perl               %(echo "%{V_perl}"                     | awk '{ printf("%%-7s", $1); }') [Artistic]
  57.368  
  57.369  %track
  57.370      prog openpkg:bash = {
  57.371 @@ -193,35 +276,35 @@
  57.372          url       = http://curl.haxx.se/download/
  57.373          regex     = curl-(__VER__)\.tar\.gz
  57.374      }
  57.375 +    prog openpkg:pcre = {
  57.376 +        version   = %{V_pcre}
  57.377 +        url       = ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
  57.378 +        regex     = pcre-(__VER__)\.tar\.gz
  57.379 +    }
  57.380      prog openpkg:gzip = {
  57.381 -        comment   = "rse: intentionally tracked at gnu.org, although fetched from openpkg.org because of uncompression"
  57.382          version   = %{V_gzip}
  57.383          url       = ftp://ftp.gnu.org/gnu/gzip/
  57.384          regex     = gzip-(__VER__)\.tar(\.gz)?
  57.385      }
  57.386 -    prog openpkg:gzip_r = {
  57.387 -        version   = %{V_gzip_r}
  57.388 -        url       = ftp://ftp.openpkg.org/sources/CPY/openpkg/
  57.389 -        regex     = gzip-%{V_gzip}-openpkg-r(__VER__)\.tar
  57.390 -    }
  57.391      prog openpkg:make = {
  57.392          version   = %{V_make}
  57.393          url       = ftp://ftp.gnu.org/gnu/make/
  57.394          regex     = make-(__VER__)\.tar\.gz
  57.395      }
  57.396      prog openpkg:patch = {
  57.397 -        disabled
  57.398 -        comment   = "rse: directory missing after GNU.org security issues"
  57.399          version   = %{V_patch}
  57.400 -        url       = ftp://alpha.gnu.org/gnu/patch/
  57.401 +        url       = ftp://ftp.gnu.org/gnu/patch/
  57.402          regex     = patch-(__VER__)\.tar\.gz
  57.403      }
  57.404 +    prog openpkg:popt = {
  57.405 +        version   = %{V_popt}
  57.406 +        url       = http://rpm5.org/files/popt/
  57.407 +        regex     = popt-(\d+\.\d+)\.tar\.gz
  57.408 +    }
  57.409      prog openpkg:rpm = {
  57.410 -        disabled
  57.411 -        comment   = "rse: we have a .src.rpm extracted .tar.gz, because there is still no tarball for 4.2.1"
  57.412 -        version   = %{V_rpm}
  57.413 -        url       = ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.2.x/
  57.414 -        regex     = rpm-(4\.2\.\d+)\.tar\.gz
  57.415 +        version   = %{V_rpm_major}.%{V_rpm_minor}
  57.416 +        url       = http://rpm5.org/files/rpm/rpm-%{V_rpm_major}/
  57.417 +        regex     = rpm-(\d+\.\d+[.ab]\d+)\.tar\.gz
  57.418      }
  57.419      prog openpkg:tar = {
  57.420          version   = %{V_tar}
  57.421 @@ -233,29 +316,39 @@
  57.422          url       = http://www.zlib.net/
  57.423          regex     = zlib-(__VER__)\.tar\.gz
  57.424      }
  57.425 +    prog openpkg:diffutils = {
  57.426 +        version   = %{V_diffutils}
  57.427 +        url       = ftp://alpha.gnu.org/gnu/diffutils/
  57.428 +        regex     = diffutils-(__VER__)\.tar\.gz
  57.429 +    }
  57.430 +    prog openpkg:libarchive = {
  57.431 +        version   = %{V_libarchive}
  57.432 +        url       = http://code.google.com/p/libarchive/downloads/list
  57.433 +        regex     = libarchive-(__VER__)\.tar\.gz
  57.434 +    }
  57.435      prog openpkg:uuid = {
  57.436          version   = %{V_uuid}
  57.437          url       = ftp://ftp.ossp.org/pkg/lib/uuid/
  57.438          regex     = uuid-(__VER__)\.tar\.gz
  57.439      }
  57.440 +    prog openpkg:svs = {
  57.441 +        version   = %{V_svs}
  57.442 +        url       = ftp://ftp.ossp.org/pkg/tool/svs/
  57.443 +        regex     = svs-(__VER__)\.tar\.gz
  57.444 +    }
  57.445      prog openpkg:config = {
  57.446          version   = %{V_config}
  57.447 -        url       = ftp://ftp.openpkg.org/sources/CPY/config/
  57.448 +        url       = http://download.openpkg.org/components/versioned/config/
  57.449          regex     = config-(__VER__)\.tar\.gz
  57.450      }
  57.451      prog openpkg:beecrypt = {
  57.452          version   = %{V_beecrypt}
  57.453 -        url       = http://prdownloads.sourceforge.net/beecrypt/
  57.454 +        url       = http://sourceforge.net/project/showfiles.php?group_id=8924&package_id=9007
  57.455          regex     = beecrypt-(__VER__)\.tar\.gz
  57.456      }
  57.457 -    prog openpkg:registry = {
  57.458 -        version   = %{V_registry}
  57.459 -        url       = ftp://ftp.openpkg.org/sources/CPY/openpkg-registry/
  57.460 -        regex     = openpkg-registry-(__VER__)\.tar\.gz
  57.461 -    }
  57.462      prog openpkg:perl = {
  57.463          version   = %{V_perl}
  57.464 -        url       = ftp://ftp.openpkg.org/sources/CPY/perl/
  57.465 +        url       = http://download.openpkg.org/components/derived/perl/
  57.466          regex     = perl-(__VER__)-mini\.tar\.gz
  57.467      }
  57.468      prog openpkg:openssl = {
  57.469 @@ -263,15 +356,20 @@
  57.470          url       = ftp://ftp.openssl.org/source/
  57.471          regex     = openssl-(\d+\.\d+\.\d+[a-z]?)\.tar\.gz
  57.472      }
  57.473 -    prog openpkg:openpkg-tools = {
  57.474 -        version   = %{V_tools}
  57.475 -        url       = ftp://ftp.openpkg.org/sources/CPY/openpkg-tools/
  57.476 -        regex     = openpkg-tools-(__VER__)\.tar\.gz
  57.477 +    prog openpkg:lua = {
  57.478 +        version   = %{V_lua}
  57.479 +        url       = http://www.lua.org/download.html
  57.480 +        regex     = lua-(\d+\.\d+\.\d+)\.tar\.gz
  57.481      }
  57.482 -    prog openpkg:openpkg-executable = {
  57.483 -        version   = %{V_exec}
  57.484 -        url       = ftp://ftp.openpkg.org/sources/CPY/openpkg/
  57.485 -        regex     = openpkg-executable-(__VER__-C)\.tar\.gz
  57.486 +    prog openpkg:sqlite = {
  57.487 +        version   = %{V_sqlite}
  57.488 +        url       = http://www.sqlite.org/download.html
  57.489 +        regex     = sqlite-(\d+\.\d+\.\d+(?:\.\d+)?)\.tar\.gz
  57.490 +    }
  57.491 +    prog openpkg:xz = {
  57.492 +        version   = %{V_xz}
  57.493 +        url       = http://tukaani.org/xz/
  57.494 +        regex     = xz-(\d+\.\d+\.\d+)\.tar\.gz
  57.495      }
  57.496  
  57.497  %prep
  57.498 @@ -407,8 +505,8 @@
  57.499      fi
  57.500      echo "l_strip=\"$l_strip\"; export l_strip" >>.buildenv
  57.501  
  57.502 -    #   determine path to aux.usrgrp.sh script
  57.503 -    usrgrp=`SOURCE aux.usrgrp.sh`
  57.504 +    #   determine path to etc.usrgrp.sh script
  57.505 +    usrgrp=`SOURCE etc.usrgrp.sh`
  57.506      echo "usrgrp=$usrgrp; export usrgrp" >>./.buildenv
  57.507  
  57.508      #   display verbosity header
  57.509 @@ -494,6 +592,7 @@
  57.510          OSF1/V5.* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  57.511          HP-UX/*   ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  57.512          IRIX*/6.* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  57.513 +        CYGWIN*/* ) l_build_path="/bin:/usr/bin:/usr/sbin"       ;;
  57.514          *         ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  57.515      esac
  57.516      case $plid in
  57.517 @@ -507,6 +606,7 @@
  57.518          OSF1/V5.* ) l_build_ldlp="/usr/lib" ;;
  57.519          HP-UX/*   ) l_build_ldlp="/usr/lib" ;;
  57.520          IRIX*/6.* ) l_build_ldlp="/usr/lib" ;;
  57.521 +        CYGWIN*/* ) l_build_ldlp="/lib:/usr/lib" ;;
  57.522          *         ) l_build_ldlp="/usr/lib" ;;
  57.523      esac
  57.524      case $plid in
  57.525 @@ -516,20 +616,29 @@
  57.526      echo "l_build_ldlp=\"$l_build_ldlp\"; export l_build_ldlp" >>.buildenv
  57.527      echo "l_build_ulim=\"$l_build_ulim\"; export l_build_ulim" >>.buildenv
  57.528  
  57.529 +    #   ACTIVATE AGAIN AFTER ALL 4.2.5 VERSIONS WERE UPGRADED TO AT LEAST 4.2.7
  57.530 +    #   determine status of unprivileged operation
  57.531 +    if [ ".%{?l_unprivileged:set}" = .set ]; then
  57.532 +        l_unprivileged="%{l_unprivileged}"
  57.533 +    else
  57.534 +        l_unprivileged="no"
  57.535 +    fi
  57.536 +    echo "l_unprivileged=\"$l_unprivileged\"; export l_unprivileged" >>.buildenv
  57.537 +
  57.538      #   display verbosity header
  57.539      set +x; VERBOSE "PREPARATION: Build GNU gzip (Compression Tool)"; set -x
  57.540  
  57.541      #   bootstrap GNU zip tool
  57.542      ${l_tar} xf `SOURCE gzip-%{V_gzip}.tar` 2>/dev/null || true
  57.543 -    ${l_tar} xf `SOURCE gzip-%{V_gzip}-openpkg-r%{V_gzip_r}.tar` 2>/dev/null || true
  57.544      ( cd gzip-%{V_gzip}
  57.545 -      echo "ac_cv_prog_cc_g=no" >config.cache
  57.546 +      ( echo "ac_cv_prog_cc_g=no"
  57.547 +        echo "ac_cv_header_getopt_h=no"
  57.548 +      ) >config.cache
  57.549        case $plid in
  57.550            Darwin/* ) echo "gzip_cv_assembler=no" >>config.cache ;;
  57.551        esac
  57.552        CC="${l_cc}" \
  57.553        GREP="grep" \
  57.554 -      MAKE="${l_make}" \
  57.555        ./configure \
  57.556            --cache-file=./config.cache
  57.557        ${l_make} || exit $?
  57.558 @@ -550,24 +659,36 @@
  57.559      #   bootstrap GNU patch tool
  57.560      ${l_gzip} -dc `SOURCE patch-%{V_patch}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
  57.561      ( cd patch-%{V_patch}
  57.562 -      cp `SOURCE rplstrnlen.c` gl/lib/strnlen.c
  57.563 -      chmod u+w config.guess config.sub >/dev/null 2>&1 || true
  57.564 -      cp ../config/config.guess .
  57.565 -      cp ../config/config.sub   .
  57.566 +      chmod a+x install-sh
  57.567 +      echo '#!' >update-version.sh
  57.568 +      cp `SOURCE patch.Makefile.in` Makefile.in
  57.569 +      cp `SOURCE patch.strnlen.c` gl/lib/strnlen.c
  57.570        ( echo 'ac_cv_func_setmode=${ac_cv_func_setmode=no}'
  57.571          echo 'ac_cv_prog_cc_g=no'
  57.572          false=`sh $shtool path false`
  57.573          echo "ac_cv_path_ed_PROGRAM=\${ac_cv_path_ed_PROGRAM=$false}"
  57.574        ) >config.cache
  57.575        CC="${l_cc}" \
  57.576 -      GREP="grep" \
  57.577        ./configure \
  57.578            --cache-file=./config.cache \
  57.579 +          --enable-merge \
  57.580            --disable-largefile
  57.581        ${l_make} || exit $?
  57.582        ( mv src/patch ..; ${l_make} clean || true; mv ../patch . ) || exit $?
  57.583      ) || exit $?
  57.584      l_patch="`pwd`/patch-%{V_patch}/patch"; export l_patch
  57.585 +    case `sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"` in
  57.586 +        *-cygwin* )
  57.587 +            #   Cygwin under Windows Vista dislikes executables with
  57.588 +            #   "patch" in the same and would require a "*.manifest"
  57.589 +            #   file applied with the "mt.exe" from the "Windows
  57.590 +            #   Software Development Kit (SDK)" in order to escape from
  57.591 +            #   UAC. An easy alternative is to just rename the file to a
  57.592 +            #   different name.
  57.593 +            mv patch-%{V_patch}/patch patch-%{V_patch}/pitch
  57.594 +            l_patch="`pwd`/patch-%{V_patch}/pitch"
  57.595 +            ;;
  57.596 +    esac
  57.597      echo "l_patch=\"$l_patch\"; export l_patch" >>.buildenv
  57.598  
  57.599      #   display verbosity header
  57.600 @@ -584,12 +705,14 @@
  57.601          echo 'ac_cv_type_iconv_t=no'
  57.602        ) >config.cache
  57.603        CC="${l_cc}" \
  57.604 -      MAKE="${l_make}" \
  57.605        MAKEINFO="true" \
  57.606        GREP="grep" \
  57.607 +      FORCE_UNSAFE_CONFIGURE=1 \
  57.608        ./configure \
  57.609            --cache-file=./config.cache \
  57.610            --prefix=%{l_prefix} \
  57.611 +          --with-gzip=%{l_prefix}/lib/openpkg/gzip \
  57.612 +          --with-bzip2=%{l_prefix}/lib/openpkg/bzip2 \
  57.613            --disable-nls
  57.614        ${l_make} || exit $?
  57.615        ( mv src/tar ..; ${l_make} clean || true; mv ../tar . ) || exit $?
  57.616 @@ -601,23 +724,26 @@
  57.617      set +x; VERBOSE "PREPARATION: Unpack Distribution Tarballs"; set -x
  57.618  
  57.619      #   unpack distribution tarballs
  57.620 -    ${l_gzip} -dc `SOURCE rpm-%{V_rpm}.tar.gz`                        | ${l_tar} xf - 2>/dev/null || true
  57.621 +    ${l_gzip} -dc `SOURCE rpm-%{V_rpm_major}.%{V_rpm_minor}.tar.gz`   | ${l_tar} xf - 2>/dev/null || true
  57.622 +    ${l_gzip} -dc `SOURCE popt-%{V_popt}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
  57.623 +    ${l_gzip} -dc `SOURCE sqlite-%{V_sqlite}.tar.gz`                  | ${l_tar} xf - 2>/dev/null || true
  57.624      ${l_gzip} -dc `SOURCE zlib-%{V_zlib}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
  57.625      ${l_gzip} -dc `SOURCE bzip2-%{V_bzip2}.tar.gz`                    | ${l_tar} xf - 2>/dev/null || true
  57.626 +    ${l_gzip} -dc `SOURCE xz-%{V_xz}.tar.gz`                          | ${l_tar} xf - 2>/dev/null || true
  57.627      ${l_gzip} -dc `SOURCE curl-%{V_curl}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
  57.628 +    ${l_gzip} -dc `SOURCE pcre-%{V_pcre}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
  57.629      ${l_gzip} -dc `SOURCE make-%{V_make}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
  57.630      ${l_gzip} -dc `SOURCE bash-%{V_bash}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
  57.631      ${l_gzip} -dc `SOURCE uuid-%{V_uuid}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
  57.632      ${l_gzip} -dc `SOURCE beecrypt-%{V_beecrypt}.tar.gz`              | ${l_tar} xf - 2>/dev/null || true
  57.633 -    ${l_gzip} -dc `SOURCE openpkg-registry-%{V_registry}.tar.gz`      | ${l_tar} xf - 2>/dev/null || true
  57.634      ${l_gzip} -dc `SOURCE perl-%{V_perl}-mini.tar.gz`                 | ${l_tar} xf - 2>/dev/null || true
  57.635      ${l_gzip} -dc `SOURCE openssl-%{V_openssl}.tar.gz`                | ${l_tar} xf - 2>/dev/null || true
  57.636 -    ${l_gzip} -dc `SOURCE openpkg-tools-%{V_tools}.tar.gz`            | ${l_tar} xf - 2>/dev/null || true
  57.637 -    ${l_gzip} -dc `SOURCE openpkg-executable-%{V_exec}.tar.gz`        | ${l_tar} xf - 2>/dev/null || true
  57.638 +    ${l_gzip} -dc `SOURCE libarchive-%{V_libarchive}.tar.gz`          | ${l_tar} xf - 2>/dev/null || true
  57.639 +    ${l_gzip} -dc `SOURCE diffutils-%{V_diffutils}.tar.gz`            | ${l_tar} xf - 2>/dev/null || true
  57.640 +    ${l_gzip} -dc `SOURCE svs-%{V_svs}.tar.gz`                        | ${l_tar} xf - 2>/dev/null || true
  57.641  
  57.642      #   update config.guess/config.sub
  57.643 -    for dir in rpm-%{V_rpm} rpm-%{V_rpm}/popt beecrypt-%{V_beecrypt} \
  57.644 -               curl-%{V_curl} make-%{V_make} bash-%{V_bash}/support; do
  57.645 +    for dir in curl-%{V_curl} make-%{V_make} bash-%{V_bash}/support; do
  57.646          chmod u+w $dir/config.guess $dir/config.sub >/dev/null 2>&1 || true
  57.647          cp config/config.guess $dir/
  57.648          cp config/config.sub   $dir/
  57.649 @@ -627,18 +753,15 @@
  57.650      set +x; VERBOSE "PREPARATION: Apply OpenPKG Patches to Distributions"; set -x
  57.651  
  57.652      #   apply OpenPKG patches to distribution trees
  57.653 -    ( cd rpm-%{V_rpm}
  57.654 -      sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.bugfix`  | ${l_patch} -p0
  57.655 -      sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.feature` | ${l_patch} -p0
  57.656 -      sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.porting` | ${l_patch} -p0
  57.657 -      sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.regen`   | ${l_patch} -p0
  57.658 -      rm -rf db/docs # just reduce disk size of source tree
  57.659 +    ( cd rpm-%{V_rpm_major}.%{V_rpm_minor}
  57.660 +      sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch` | ${l_patch} -p0
  57.661      ) || exit $?
  57.662      ( cd make-%{V_make}
  57.663        ${l_patch} -p0 <`SOURCE make.patch`
  57.664      ) || exit $?
  57.665      ( cd bash-%{V_bash}
  57.666        ${l_patch} -p0 <`SOURCE bash.patch`
  57.667 +      ${l_patch} -p0 <`SOURCE bash.patch.vendor`
  57.668        sleep 1
  57.669        touch y.tab.[ch]
  57.670        touch configure config.h.in
  57.671 @@ -652,6 +775,30 @@
  57.672      ( cd openssl-%{V_openssl}
  57.673        ${l_patch} -p0 <`SOURCE openssl.patch`
  57.674      ) || exit $?
  57.675 +    ( cd popt-%{V_popt}
  57.676 +      ${l_patch} -p0 <`SOURCE popt.patch`
  57.677 +    ) || exit $?
  57.678 +    ( cd sqlite-%{V_sqlite}
  57.679 +      ${l_patch} -p0 <`SOURCE sqlite.patch`
  57.680 +    ) || exit $?
  57.681 +    ( cd curl-%{V_curl}
  57.682 +      ${l_patch} -p0 <`SOURCE curl.patch`
  57.683 +    ) || exit $?
  57.684 +    ( cd pcre-%{V_pcre}
  57.685 +      ${l_patch} -p0 <`SOURCE pcre.patch`
  57.686 +    ) || exit $?
  57.687 +    ( cd diffutils-%{V_diffutils}
  57.688 +      ${l_patch} -p0 <`SOURCE diffutils.patch`
  57.689 +    ) || exit $?
  57.690 +    ( cd libarchive-%{V_libarchive}
  57.691 +      ${l_patch} -p0 <`SOURCE libarchive.patch`
  57.692 +    ) || exit $?
  57.693 +    ( cd zlib-%{V_zlib}
  57.694 +      ${l_patch} -p0 <`SOURCE zlib.patch`
  57.695 +    ) || exit $?
  57.696 +    ( cd xz-%{V_xz}
  57.697 +      ${l_patch} -p0 <`SOURCE xz.patch`
  57.698 +    ) || exit $?
  57.699  
  57.700      #   display verbosity header
  57.701      set +x; VERBOSE "PREPARATION: Build GNU make (Build Tool)"; set -x
  57.702 @@ -659,7 +806,6 @@
  57.703      #   bootstrap GNU make tool
  57.704      ( cd make-%{V_make}
  57.705        CC="${l_cc}" \
  57.706 -      GREP="grep" \
  57.707        ./configure \
  57.708            --without-libiconv-prefix \
  57.709            --without-libintl-prefix \
  57.710 @@ -700,9 +846,15 @@
  57.711          #   disable building with debug symbols
  57.712          echo "ac_cv_prog_cc_g=no"
  57.713        ) >config.cache
  57.714 -      AUTOCONF="true" \
  57.715 -      CC="${l_cc}" \
  57.716 -      MAKE="${l_make}" \
  57.717 +      AUTOCONF="true"
  57.718 +      export AUTOCONF
  57.719 +      CC="${l_cc}"
  57.720 +      export CC
  57.721 +      LDFLAGS=""
  57.722 +      export LDFLAGS
  57.723 +      case "$plid" in
  57.724 +          Darwin/* ) LDFLAGS="-Wl,-search_paths_first" ;;
  57.725 +      esac
  57.726        ./configure \
  57.727            --cache-file=./config.cache \
  57.728            --prefix=%{l_prefix} \
  57.729 @@ -746,6 +898,28 @@
  57.730      ) || exit $?
  57.731  
  57.732      #   display verbosity header
  57.733 +    set +x; VERBOSE "BUILD: Build XZ (Compression Library)"; set -x
  57.734 +
  57.735 +    #   build XZ library
  57.736 +    ( cd xz-%{V_xz}
  57.737 +      opts=""
  57.738 +      case "$plid" in
  57.739 +          Darwin/* ) opts="--disable-assembler" ;;
  57.740 +      esac
  57.741 +      CC="${l_cc}" \
  57.742 +      CFLAGS="-O" \
  57.743 +      ./configure \
  57.744 +          --prefix=%{l_prefix} \
  57.745 +          --mandir=%{l_prefix}/man \
  57.746 +          --without-libiconv-prefix \
  57.747 +          --without-libintl-prefix \
  57.748 +          --disable-nls \
  57.749 +          --disable-shared \
  57.750 +          $opts
  57.751 +      ${l_make} || exit $?
  57.752 +    ) || exit $?
  57.753 +
  57.754 +    #   display verbosity header
  57.755      set +x; VERBOSE "BUILD: Build OSSP uuid (UUID Generation Tool)"; set -x
  57.756  
  57.757      #   build OSSP uuid tool
  57.758 @@ -757,7 +931,6 @@
  57.759          --prefix=%{l_prefix} \
  57.760          --disable-shared
  57.761        ${l_make} || exit $?
  57.762 -      ( mv uuid ..; ${l_make} clean || true; mv ../uuid . ) || exit $?
  57.763      ) || exit $?
  57.764  
  57.765      #   display verbosity header
  57.766 @@ -777,11 +950,6 @@
  57.767        for dir in %{l_prefix}/lib /lib64 /usr/lib64 /lib /usr/lib /usr/ccs/lib; do
  57.768            [ -d $dir ] && libdirs="$libdirs $dir"
  57.769        done
  57.770 -      loclibs=""
  57.771 -      case `(uname -s) 2>/dev/null` in
  57.772 -          Linux ) loclibs="-lm -lrt" ;;
  57.773 -      esac
  57.774 -      PATH=$PATH:`echo "${l_make}" | sed -e 's;\(.*\)/[^/][^/]*$;\1;'` \
  57.775        ./Configure \
  57.776            -d -e -s \
  57.777            -Dprefix=%{l_prefix} \
  57.778 @@ -796,12 +964,15 @@
  57.779            -Dldflags="-L""%{l_prefix}/lib" \
  57.780            -Dlibpth="$libdirs" \
  57.781            -Dglibpth="$libdirs" \
  57.782 -          -Dlibs="$loclibs" \
  57.783            -Dscriptdir="%{l_prefix}/bin" \
  57.784            -Uinstallusrbinperl \
  57.785            -Adefine:useshrplib='false' \
  57.786            -Ui_malloc -Ui_iconv -Ui_db
  57.787 -      ${l_make} miniperl || exit $?
  57.788 +      case `sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"` in
  57.789 +          *-cygwin* ) miniperl="miniperl.exe" ;;
  57.790 +          * )         miniperl="miniperl"     ;;
  57.791 +      esac
  57.792 +      ${l_make} $miniperl || exit $?
  57.793        rm -f *.o >/dev/null 2>&1 || true
  57.794      ) || exit $?
  57.795      l_perl="`pwd`/perl-%{V_perl}/miniperl"; export l_perl
  57.796 @@ -842,6 +1013,44 @@
  57.797        ( mkdir lib; cd lib; ln -s ../lib*.a . ) || exit $?
  57.798      ) || exit $?
  57.799  
  57.800 +    #   build BSD libarchive
  57.801 +    ( cd libarchive-%{V_libarchive}
  57.802 +      CC="${l_cc}" \
  57.803 +      CFLAGS="-O -D_POSIX_PTHREAD_SEMANTICS" \
  57.804 +      CPPFLAGS="-I`pwd`/../zlib-%{V_zlib} -I`pwd`/../bzip2-%{V_bzip2} -I`pwd`/../xz-%{V_xz}/src/liblzma/api -I`pwd`/../openssl-%{V_openssl}/include" \
  57.805 +      LDFLAGS="-L`pwd`/../zlib-%{V_zlib} -L`pwd`/../bzip2-%{V_bzip2} -L`pwd`/../xz-%{V_xz}/src/liblzma/.libs -L`pwd`/../openssl-%{V_openssl}" \
  57.806 +      GREP="grep" \
  57.807 +      ./configure \
  57.808 +          --prefix=%{l_prefix} \
  57.809 +          --enable-bsdtar \
  57.810 +          --enable-bsdcpio \
  57.811 +          --with-zlib \
  57.812 +          --with-bz2lib \
  57.813 +          --with-lzma \
  57.814 +          --without-lzmadec \
  57.815 +          --with-openssl \
  57.816 +          --without-xml2 \
  57.817 +          --without-expat \
  57.818 +          --without-iconv \
  57.819 +          --disable-shared
  57.820 +      ${l_make} || exit $?
  57.821 +      ( mv bsdcpio bsdtar ..; ${l_make} clean || true; mv ../bsdcpio ../bsdtar . ) || exit $?
  57.822 +    ) || exit $?
  57.823 +
  57.824 +    #   build GNU diffutils
  57.825 +    ( cd diffutils-%{V_diffutils}
  57.826 +      CC="${l_cc}" \
  57.827 +      CFLAGS="-O" \
  57.828 +      ./configure \
  57.829 +          --prefix=%{l_prefix} \
  57.830 +          --disable-nls
  57.831 +      ${l_make} || exit $?
  57.832 +      ( mv src/diff src/diff3 src/sdiff src/cmp ..
  57.833 +        ${l_make} clean || true
  57.834 +        mv ../diff ../diff3 ../sdiff ../cmp .
  57.835 +      ) || exit $?
  57.836 +    ) || exit $?
  57.837 +
  57.838      #   display verbosity header
  57.839      set +x; VERBOSE "BUILD: Build cURL (URL Fetching Tool)"; set -x
  57.840  
  57.841 @@ -852,7 +1061,6 @@
  57.842          echo 'lt_cv_sys_max_cmd_len=100'
  57.843        ) >config.cache
  57.844        CC="${l_cc}" \
  57.845 -      MAKE="${l_make}" \
  57.846        CFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
  57.847        CPPFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
  57.848        LDFLAGS="-L`pwd`/../zlib-%{V_zlib}" \
  57.849 @@ -868,7 +1076,18 @@
  57.850            --with-ssl=`pwd`/../openssl-%{V_openssl} \
  57.851            --with-ca-bundle=%{l_prefix}/etc/openpkg/openpkg.x509
  57.852        ${l_make} || exit $?
  57.853 -      ( mv src/curl ..; ${l_make} clean || true; mv ../curl ./src ) || exit $?
  57.854 +      mv src/curl ..; ${l_make} clean || true; mv ../curl .
  57.855 +    ) || exit $?
  57.856 +
  57.857 +    #   build PCRE library
  57.858 +    ( cd pcre-%{V_pcre}
  57.859 +      CC="${l_cc}" \
  57.860 +      GREP="grep" \
  57.861 +      ./configure \
  57.862 +          --disable-cpp \
  57.863 +          --disable-utf8 \
  57.864 +          --disable-shared
  57.865 +      ${l_make} || exit $?
  57.866      ) || exit $?
  57.867  
  57.868      #   display verbosity header
  57.869 @@ -878,32 +1097,32 @@
  57.870      ( cd beecrypt-%{V_beecrypt}
  57.871        sh $shtool subst \
  57.872            -e 's;^[ 	][ 	]*#;#;' \
  57.873 -          aes.c base64.c blowfish.c entropy.c fips186.c fips186.h md5.c \
  57.874 -          md5.h mp.c mtprng.c mtprng.h sha1.c sha1.h sha256.c sha256.h timestamp.c
  57.875 +          aes.c base64.c blockmode.c blowfish.c entropy.c fips186.c md4.c md5.c \
  57.876 +          mp.c mtprng.c ripemd128.c ripemd160.c ripemd256.c ripemd320.c rsa.c \
  57.877 +          sha1.c sha224.c sha256.c sha2k64.c sha384.c sha512.c timestamp.c
  57.878        sh $shtool subst \
  57.879           -e 's;cppglue\.lo;;g' \
  57.880           -e 's;cppglue\.cxx;;g' \
  57.881           -e '/^CXX = /s;@CXX@;@CC@;g' \
  57.882           Makefile.in
  57.883 -      sh $shtool subst \
  57.884 -          -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
  57.885 -          configure
  57.886        ( echo 'ac_cv_have_dev_dsp=no'
  57.887          echo 'ac_cv_have_dev_audio=no'
  57.888          echo 'ac_cv_func_gettimeofday=yes'
  57.889          echo 'bc_cv_as_noexecstack=no'
  57.890        ) >config.cache
  57.891        CC="${l_cc}" \
  57.892 -      MAKE="${l_make}" \
  57.893        CFLAGS="-O" \
  57.894        ./configure \
  57.895          --cache-file=./config.cache \
  57.896          --prefix=%{l_prefix} \
  57.897 +        --with-cpu=none \
  57.898 +        --with-arch=none \
  57.899          --without-cplusplus \
  57.900          --without-java \
  57.901          --without-python \
  57.902 -        --with-cpu=none \
  57.903 -        --with-arch=none \
  57.904 +        --disable-expert-mode \
  57.905 +        --disable-aio \
  57.906 +        --disable-openmp \
  57.907          --disable-threads \
  57.908          --disable-shared
  57.909        ${l_make} || exit $?
  57.910 @@ -911,101 +1130,161 @@
  57.911      ) || exit $?
  57.912  
  57.913      #   display verbosity header
  57.914 +    set +x; VERBOSE "BUILD: Build POPT (Option Parsing Library)"; set -x
  57.915 +
  57.916 +    #   build POPT library
  57.917 +    ( cd popt-%{V_popt}
  57.918 +      CC="${l_cc}" \
  57.919 +      CPPFLAGS="-DOPENPKG -DPOPT_fprintf=fprintf" \
  57.920 +      GREP="grep" \
  57.921 +      ./configure \
  57.922 +          --prefix=%{l_prefix} \
  57.923 +          --disable-shared \
  57.924 +          --with-included-gettext \
  57.925 +          --without-libintl-prefix \
  57.926 +          --without-libiconv-prefix \
  57.927 +          --disable-nls
  57.928 +      ${l_make}
  57.929 +    ) || exit $?
  57.930 +
  57.931 +    #   display verbosity header
  57.932 +    set +x; VERBOSE "BUILD: Build SQLite (RDBMS Library)"; set -x
  57.933 +
  57.934 +    #   build SQLite library
  57.935 +    ( cd sqlite-%{V_sqlite}
  57.936 +      CC="${l_cc}" \
  57.937 +      LIBS="-lm" \
  57.938 +      GREP="grep" \
  57.939 +      ./configure \
  57.940 +          --prefix=%{l_prefix} \
  57.941 +          --disable-threadsafe \
  57.942 +          --disable-readline \
  57.943 +          --disable-debug \
  57.944 +          --disable-amalgamation \
  57.945 +          --disable-tcl \
  57.946 +          --disable-shared
  57.947 +      ${l_make}
  57.948 +    ) || exit $?
  57.949 +
  57.950 +    #   display verbosity header
  57.951      set +x; VERBOSE "BUILD: Build RPM (RPM Package Manager)"; set -x
  57.952  
  57.953      #   build RPM
  57.954      ( br=`pwd`
  57.955 -      cd rpm-%{V_rpm}
  57.956 -
  57.957 -      #   remove object files accidentally distributed with the RPM tarball
  57.958 -      rm -f db/build_unix/*.o
  57.959 -      rm -f db/build_unix/*.lo
  57.960 -
  57.961 -      #   remove embedded zlib (we are linking with an external one)
  57.962 -      rm -rf zlib
  57.963 -
  57.964 -      #   kill Linux-based preconfigured DB header, to allow the Makefiles to
  57.965 -      #   symlink to it the header that is configured for the current system.
  57.966 -      rm -f rpmdb/db.h
  57.967 -
  57.968 -      #   make sure we do not trigger Autoconf/Automake tools
  57.969 -      touch configure
  57.970 -      touch config.h.in
  57.971 -
  57.972 -      #   disable running of any Autoconf/Automake tools
  57.973 -      ACLOCAL=true
  57.974 -      AUTOCONF=true
  57.975 -      AUTOMAKE=true
  57.976 -      AUTOHEADER=true
  57.977 -      MAKEINFO=true
  57.978 -      AMTAR=true
  57.979 -      export ACLOCAL AUTOMAKE AUTOHEADER MAKEINFO AMTAR
  57.980 +      cd rpm-%{V_rpm_major}.%{V_rpm_minor}
  57.981  
  57.982        #   cheat GNU Autoconf
  57.983        ( echo 'ac_cv_path_MSGFMT=:'
  57.984          echo 'ac_cv_path_GMSGFMT=:'
  57.985          echo 'ac_cv_path_XGETTEXT=:'
  57.986          echo 'ac_cv_path_MSGMERGE=:'
  57.987 -        echo "ac_cv_path_MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'"
  57.988 -        echo "ac_cv_path___MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'"
  57.989 -        echo "ac_cv_path___PYTHON=true"
  57.990 -        echo "ac_cv_path___DOXYGEN=true"
  57.991 -        echo "acl_cv_rpath=no"
  57.992          echo "ac_cv_header_getopt_h=no"
  57.993 +        echo "ac_cv_lib_gz_gzread=no"
  57.994        ) >config.cache
  57.995  
  57.996 -      #   provide platform identification
  57.997 -      os_name=`(uname -s) 2>/dev/null` || os_name='Unknown'
  57.998 -      os_name=`echo "${os_name}" |\
  57.999 -               sed -e 's;[^a-zA-Z0-9];;g' |\
 57.1000 -               tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
 57.1001 +      #   use miniperl
 57.1002 +      PERL="${l_perl}"
 57.1003 +      export PERL
 57.1004  
 57.1005        #   set build tool flags
 57.1006        CC="${l_cc}"
 57.1007 -      CPPFLAGS="-DOPENPKG -DOPENPKG_${os_name} -I$br/zlib-%{V_zlib} -I$br/bzip2-%{V_bzip2} -I$br/beecrypt-%{V_beecrypt}"
 57.1008 -      CFLAGS="$CPPFLAGS"
 57.1009 -      LDFLAGS="-L$br/zlib-%{V_zlib} -L$br/bzip2-%{V_bzip2} -L$br/beecrypt-%{V_beecrypt}"
 57.1010 -      LIBS="$LDFLAGS -lz -lbz2 -lbeecrypt"
 57.1011 -      case $os_name in
 57.1012 -           SUNOS* ) LIBS="$LIBS -lresolv" ;;
 57.1013 -           IRIX*  ) LIBS="$LIBS -lgen" ;;
 57.1014 -      esac
 57.1015 -      export CC CPPFLAGS CFLAGS LDFLAGS LIBS
 57.1016 +      CFLAGS=""
 57.1017 +      CPPFLAGS="-DRPM_VENDOR_OPENPKG"
 57.1018 +      LDFLAGS=""
 57.1019 +      LIBS=""
 57.1020 +      LIBS="$LIBS -lm"
 57.1021 +      export CC
 57.1022 +      export CFLAGS
 57.1023 +      export CPPFLAGS
 57.1024 +      export LDFLAGS
 57.1025 +      export LIBS
 57.1026  
 57.1027 -      #   adjust for BeeCrypt 4.0
 57.1028 +      #   special platform workarounds
 57.1029 +      GREP="grep"
 57.1030 +      export GREP
 57.1031 +
 57.1032 +      #   determine POPT option, RPM macros and Lua script file paths
 57.1033 +      RPMPOPT="%{l_prefix}/lib/openpkg/rpmpopt"
 57.1034 +      RPMPOPT="$RPMPOPT:%{l_prefix}/etc/openpkg/rpmpopt"
 57.1035 +      RPMPOPT="$RPMPOPT:%{l_prefix}/etc/openpkg/rpmpopt.d/*"
 57.1036 +      RPMPOPT="$RPMPOPT:~/.openpkg/rpmpopt"
 57.1037 +      RPMPOPT="$RPMPOPT:@../../.openpkg/rpmpopt"
 57.1038 +      RPMPOPT="$RPMPOPT:@../.openpkg/rpmpopt"
 57.1039 +      RPMPOPT="$RPMPOPT:@./.openpkg/rpmpopt"
 57.1040 +      RPMMACROS="%{l_prefix}/lib/openpkg/rpmmacros"
 57.1041 +      RPMMACROS="$RPMMACROS:%{l_prefix}/etc/openpkg/rpmmacros"
 57.1042 +      RPMMACROS="$RPMMACROS:%{l_prefix}/etc/openpkg/rpmmacros.d/*"
 57.1043 +      RPMMACROS="$RPMMACROS:~/.openpkg/rpmmacros"
 57.1044 +      RPMMACROS="$RPMMACROS:@../../.openpkg/rpmmacros"
 57.1045 +      RPMMACROS="$RPMMACROS:@../.openpkg/rpmmacros"
 57.1046 +      RPMMACROS="$RPMMACROS:@./.openpkg/rpmmacros"
 57.1047 +      RPMLUA="%{l_prefix}/lib/openpkg/rpmlua"
 57.1048 +      RPMLUA="$RPMLUA:%{l_prefix}/etc/openpkg/rpmlua"
 57.1049 +      RPMLUA="$RPMLUA:%{l_prefix}/etc/openpkg/rpmlua.d/*"
 57.1050 +      RPMLUA="$RPMLUA:~/.openpkg/rpmlua"
 57.1051 +      RPMLUA="$RPMLUA:@../../.openpkg/rpmlua"
 57.1052 +      RPMLUA="$RPMLUA:@../.openpkg/rpmlua"
 57.1053 +      RPMLUA="$RPMLUA:@./.openpkg/rpmlua"
 57.1054 +
 57.1055 +      #   parametrize integrity checking framework
 57.1056        sh $shtool subst \
 57.1057 -          -e 's;beecrypt\.api\.h;beecrypt.h;g' \
 57.1058 -          rpmio/rpmio_internal.h
 57.1059 +          -e "s;0000000000000000000000000000000000000000;7D121A8FC05DC18A4329E9EF67042EC961B7AE34;" \
 57.1060 +          -e "s;0\\.0\\.0;0.9.0;" \
 57.1061 +          rpmqv.c
 57.1062 +
 57.1063 +      #   disable building of any tests
 57.1064 +      #   (mainly because those would fail because of integrity checking anyway)
 57.1065        sh $shtool subst \
 57.1066 -          -e 's;\(rsavrfy(\)\(&dig->rsa_pk\);\1\2.n, \2.e;g' \
 57.1067 -          lib/signature.c
 57.1068 -      sh $shtool subst \
 57.1069 -          -e 's;\(^LIBS =\)[ \t]*;\1 -ldb;' \
 57.1070 -          -e 's;\(^rpmdb_[^_][^_]*_LDFLAGS =\)[ \t]*;\1 -L$(top_srcdir)/db3;g' \
 57.1071 -          rpmdb/Makefile.in
 57.1072 -      sh $shtool subst \
 57.1073 -          -e 's;\(^myLDFLAGS =\);\1 -L$(top_srcdir)/db3;' \
 57.1074 +          -e 's;tools scripts tests doc;tools scripts doc;' \
 57.1075            Makefile.in
 57.1076  
 57.1077 -      #   configure the package
 57.1078 -      MAKE="${l_make}" \
 57.1079 -      sh ./configure \
 57.1080 +      #   configure program
 57.1081 +      ./configure \
 57.1082            --cache-file=./config.cache \
 57.1083            --prefix=%{l_prefix} \
 57.1084 -          --with-db \
 57.1085 -          --with-glob \
 57.1086 +          --mandir="%{l_prefix}/man" \
 57.1087 +          --includedir="%{l_prefix}/include/openpkg" \
 57.1088 +          --with-name="OpenPKG RPM" \
 57.1089 +          --with-path-cfg="%{l_prefix}/etc/openpkg" \
 57.1090 +          --with-path-rpmpopt="$RPMPOPT" \
 57.1091 +          --with-path-macros="$RPMMACROS" \
 57.1092 +          --with-path-rpmlua="$RPMLUA" \
 57.1093 +          --with-path-lib="%{l_prefix}/lib/openpkg" \
 57.1094 +          --with-path-locale="%{l_prefix}/share/openpkg/locale" \
 57.1095 +          --with-path-database="%{l_prefix}/RPM/DB" \
 57.1096 +          --with-path-sources="%{l_prefix}/RPM" \
 57.1097 +          --with-bugreport="openpkg-users@openpkg.org" \
 57.1098 +          --with-beecrypt="$br/beecrypt-%{V_beecrypt}" \
 57.1099 +          --with-openssl="$br/openssl-%{V_openssl}" \
 57.1100 +          --with-zlib="$br/zlib-%{V_zlib}" \
 57.1101 +          --with-bzip2="$br/bzip2-%{V_bzip2}" \
 57.1102 +          --with-popt="$br/popt-%{V_popt}" \
 57.1103 +          --with-sqlite="$br/sqlite-%{V_sqlite}" \
 57.1104 +          --with-pcre="$br/pcre-%{V_pcre}" \
 57.1105 +          --with-uuid="$br/uuid-%{V_uuid}" \
 57.1106 +          --with-lua="internal" \
 57.1107 +          --with-db="internal" \
 57.1108 +          --without-db-rpc \
 57.1109 +          --without-db-largefile \
 57.1110 +          --with-db-tools-integrated \
 57.1111 +          --with-db-mutex="UNIX/fcntl" \
 57.1112 +          --without-file \
 57.1113 +          --without-neon \
 57.1114 +          --without-pthreads \
 57.1115 +          --without-libelf \
 57.1116 +          --without-selinux \
 57.1117 +          --without-perl \
 57.1118            --without-python \
 57.1119            --without-apidocs \
 57.1120 +          --disable-build-warnings \
 57.1121 +          --disable-build-extlibdep \
 57.1122 +          --disable-build-intlibdep \
 57.1123 +          --disable-build-lafiles \
 57.1124            --disable-shared \
 57.1125            --disable-rpath \
 57.1126            --disable-nls
 57.1127  
 57.1128 -      #   deny automatic dependency calculations
 57.1129 -      rm -f find-provides find-requires
 57.1130 -      ln -s autodeps/none find-provides
 57.1131 -      ln -s autodeps/none find-requires
 57.1132 -
 57.1133 -      #   build the package
 57.1134 +      #   build program
 57.1135        ${l_make}
 57.1136      ) || exit $?
 57.1137  
 57.1138 @@ -1013,13 +1292,22 @@
 57.1139      set +x; VERBOSE "BUILD: Build OpenPKG Frontend (Set-UID Wrapper)"; set -x
 57.1140  
 57.1141      #   build "openpkg" executable
 57.1142 -    ( cd openpkg-executable-%{V_exec}
 57.1143 -      ${l_make} \
 57.1144 +    ${l_make} -f `SOURCE openpkg.mk` \
 57.1145            CC="${l_cc}" \
 57.1146            OPENPKG_PREFIX="%{l_prefix}" \
 57.1147            OPENPKG_SUSR="%{l_susr}" \
 57.1148 -          OPENPKG_MUSR="%{l_musr}"
 57.1149 -    ) || exit $?
 57.1150 +          OPENPKG_MUSR="%{l_musr}" \
 57.1151 +          OPENPKG_DOT_C="`SOURCE openpkg.c`"
 57.1152 +
 57.1153 +    #   display verbosity header
 57.1154 +    set +x; VERBOSE "BUILD: Build OpenPKG Mutual Exclusion (MutEx) Utility"; set -x
 57.1155 +
 57.1156 +    #   build "mutex" executable
 57.1157 +    ${l_make} -f `SOURCE mutex.mk` \
 57.1158 +          CC="${l_cc}" \
 57.1159 +          CPPFLAGS="-Ipopt-%{V_popt}" \
 57.1160 +          LDFLAGS="-Lpopt-%{V_popt} -Lpopt-%{V_popt}/.libs" \
 57.1161 +          MUTEX_DOT_C="`SOURCE mutex.c`"
 57.1162  
 57.1163  %install
 57.1164      #   skip in bootstrap phase 2 (see openpkg.boot)
 57.1165 @@ -1057,73 +1345,93 @@
 57.1166      done
 57.1167      test -d $RPM_BUILD_ROOT%{l_prefix}/RPM || \
 57.1168      mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM
 57.1169 -    for dir in SRC PKG DB TMP; do
 57.1170 +    for dir in SRC PKG DB TR TMP; do
 57.1171          test -d $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir || \
 57.1172          mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir
 57.1173      done
 57.1174      mkdir $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg
 57.1175 -    mkdir $RPM_BUILD_ROOT%{l_prefix}/include/openpkg
 57.1176  
 57.1177      #   display verbosity header
 57.1178      set +x; VERBOSE "INSTALL: Installation of RPM"; set -x
 57.1179  
 57.1180      #   install RPM into installation hierarchy
 57.1181 -    ( cd rpm-%{V_rpm}
 57.1182 -      DESTDIR="$RPM_BUILD_ROOT"
 57.1183 -      export DESTDIR
 57.1184 -      ${l_make} install
 57.1185 +    ( cd rpm-%{V_rpm_major}.%{V_rpm_minor}
 57.1186 +      ${l_make} install DESTDIR="$RPM_BUILD_ROOT"
 57.1187 +      cp lua/rpmlua $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/lua
 57.1188 +      chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/lua
 57.1189      ) || exit $?
 57.1190  
 57.1191 +    #   post-adjust RPM installation
 57.1192 +    mv  $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/macros \
 57.1193 +        $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmmacros
 57.1194 +
 57.1195      #   display verbosity header
 57.1196      set +x; VERBOSE "INSTALL: Install Additional Files"; set -x
 57.1197  
 57.1198      #   add additional development files
 57.1199 -    cp rpm-%{V_rpm}/misc/glob.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
 57.1200 -    cp zlib-%{V_zlib}/zlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
 57.1201 -    cp zlib-%{V_zlib}/zconf.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
 57.1202 +    cp rpm-%{V_rpm_major}.%{V_rpm_minor}/rpmio/glob.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
 57.1203 +    cp zlib-%{V_zlib}/zlib.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
 57.1204 +    cp zlib-%{V_zlib}/zconf.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
 57.1205      cp zlib-%{V_zlib}/libz.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmz.a
 57.1206 -    cp bzip2-%{V_bzip2}/bzlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
 57.1207 +    cp bzip2-%{V_bzip2}/bzlib.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
 57.1208      cp bzip2-%{V_bzip2}/libbz2.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbz2.a
 57.1209 -    cp beecrypt-%{V_beecrypt}/beecrypt.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
 57.1210 +    cp beecrypt-%{V_beecrypt}/include/beecrypt/beecrypt.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
 57.1211      cp beecrypt-%{V_beecrypt}/libbeecrypt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbeecrypt.a
 57.1212 +    cp popt-%{V_popt}/popt.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
 57.1213 +    cp popt-%{V_popt}/.libs/libpopt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmpopt.a
 57.1214 +    cp sqlite-%{V_sqlite}/sqlite3.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
 57.1215 +    cp sqlite-%{V_sqlite}/.libs/libsqlite3.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmsqlite3.a
 57.1216  
 57.1217      #   display verbosity header
 57.1218      set +x; VERBOSE "INSTALL: Post-Adjust Installation"; set -x
 57.1219  
 57.1220 -    #   post-adjust RPM installation (namespace-clean POPT inclusion)
 57.1221 -    mv $RPM_BUILD_ROOT%{l_prefix}/lib/libpopt.a \
 57.1222 -       $RPM_BUILD_ROOT%{l_prefix}/lib/librpmpopt.a
 57.1223 -    mv $RPM_BUILD_ROOT%{l_prefix}/include/popt.h \
 57.1224 -       $RPM_BUILD_ROOT%{l_prefix}/include/rpm/popt.h
 57.1225 -
 57.1226      #   move C API into custom locations
 57.1227 -    mv $RPM_BUILD_ROOT%{l_prefix}/include/rpm \
 57.1228 -       $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm
 57.1229      mv $RPM_BUILD_ROOT%{l_prefix}/lib/librpm* \
 57.1230         $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
 57.1231 +    mv $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/rpm.pc \
 57.1232 +       $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
 57.1233 +    #   FIXME: does the rpm.pc really work this way?
 57.1234  
 57.1235      #   move rpm tool to custom location
 57.1236      mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm \
 57.1237         $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
 57.1238      mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm.8 \
 57.1239         $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm.8
 57.1240 +    ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm >/dev/null 2>&1 || true
 57.1241  
 57.1242      #   move rpm2cpio tool to custom location
 57.1243      mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm2cpio \
 57.1244         $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio
 57.1245      mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm2cpio.8 \
 57.1246         $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio.8
 57.1247 +    ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio >/dev/null 2>&1 || true
 57.1248  
 57.1249 -    #   replace symlinks with hardlinks
 57.1250 -    for entry in rpme:rpmi rpmt:rpmb rpmu:rpmi rpmv:rpmq; do
 57.1251 -        eval `echo $entry | sed -e 's/^\(.*\):\(.*\)$/dst=\1; src=\2/'`
 57.1252 -        rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
 57.1253 -        ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$src \
 57.1254 -           $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
 57.1255 -    done
 57.1256 -    rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/rpmbuild
 57.1257 -    ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmb \
 57.1258 -       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild
 57.1259 +    #   move rpmconstant tool to custom location
 57.1260 +    mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpmconstant \
 57.1261 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmconstant
 57.1262 +    mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmconstant.8 \
 57.1263 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmconstant.8
 57.1264 +    ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmconstant >/dev/null 2>&1 || true
 57.1265 +
 57.1266 +    #   move rpmcache tool to custom location
 57.1267 +    mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpmcache \
 57.1268 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmcache
 57.1269 +    mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmcache.8 \
 57.1270 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmcache.8
 57.1271 +    ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmcache >/dev/null 2>&1 || true
 57.1272 +
 57.1273 +    #   move rpmgrep tool to custom location
 57.1274 +    mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpmgrep \
 57.1275 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgrep
 57.1276 +    mv $RPM_BUILD_ROOT%{l_prefix}/man/man1/rpmgrep.1 \
 57.1277 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgrep.1
 57.1278 +    ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgrep >/dev/null 2>&1 || true
 57.1279 +
 57.1280 +    #   move manual pages to custom location
 57.1281 +    mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmdeps.8 \
 57.1282 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmdeps.8
 57.1283 +    mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmgraph.8 \
 57.1284 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgraph.8
 57.1285      mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmbuild.8 \
 57.1286         $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild.8
 57.1287  
 57.1288 @@ -1133,29 +1441,29 @@
 57.1289      #   strip RPM installation
 57.1290      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/* \
 57.1291            $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/* >/dev/null 2>&1 || true
 57.1292 -    for dir in man/ja man/pl man/ru man/sk src; do
 57.1293 -        rm -rf $RPM_BUILD_ROOT%{l_prefix}/$dir >/dev/null 2>&1 || true
 57.1294 -    done
 57.1295 -    rm -rf $RPM_BUILD_ROOT/var >/dev/null 2>&1 || true
 57.1296 -    for file in rpme rpmi rpmsign rpmu rpmverify rpmquery gendiff; do
 57.1297 +    for file in rpmbuild gendiff; do
 57.1298          rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/$file >/dev/null 2>&1 || true
 57.1299      done
 57.1300 -    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/* >/dev/null 2>&1 || true
 57.1301 +    for dir in RPMS SRPMS SPEC SOURCES BUILD; do
 57.1302 +        rm -rf $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir >/dev/null 2>&1 || true
 57.1303 +    done
 57.1304      rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/* >/dev/null 2>&1 || true
 57.1305      rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man3/* >/dev/null 2>&1 || true
 57.1306 -    rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmpopt >/dev/null 2>&1 || true
 57.1307 -    rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmrc >/dev/null 2>&1 || true
 57.1308      rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.la >/dev/null 2>&1 || true
 57.1309 -    rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/lib >/dev/null 2>&1 || true
 57.1310 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig >/dev/null 2>&1 || true
 57.1311      for file in \
 57.1312 -        u_pkg.sh vpkg-provides.sh vpkg-provides2.sh rpmdiff.cgi rpmdiff \
 57.1313 -        mkinstalldirs magic.prov magic.req http.req getpo.sh \
 57.1314 -        get_magic.pl find-provides find-requires find-requires.perl \
 57.1315 -        find-req.pl find-provides.perl find-prov.pl find-lang.sh \
 57.1316 -        cpanflute convertrpmrc.sh check-prereqs rpmputtext rpmgettext \
 57.1317 -        brp-compress brp-redhat brp-sparc64-linux brp-strip \
 57.1318 -        brp-strip-shared brp-strip-comment-note rpmrc \
 57.1319 -        config.guess config.sub check-files; do
 57.1320 +        brp-compress brp-python-bytecompile brp-java-gcjcompile brp-strip brp-strip-comment-note \
 57.1321 +        brp-nobuildrootpath brp-strip-shared brp-strip-static-archive brp-sparc64-linux check-files \
 57.1322 +        cross-build executabledeps.sh find-debuginfo.sh find-lang.sh find-prov.pl find-req.pl \
 57.1323 +        find-provides.perl find-requires.perl getpo.sh http.req javadeps.sh libtooldeps.sh mono-find-provides \
 57.1324 +        mono-find-requires osgideps.pl pkgconfigdeps.sh perldeps.pl perl.prov perl.req pythondeps.sh \
 57.1325 +        php.prov php.req rpmdb_loadcvt rpm.daily rpm.log rpm.xinetd symclash.py symclash.sh tgpg u_pkg.sh \
 57.1326 +        vpkg-provides.sh vpkg-provides2.sh install-sh mkinstalldirs; do
 57.1327 +        rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
 57.1328 +    done
 57.1329 +    for file in \
 57.1330 +        db_archive db_checkpoint db_deadlock db_dump db_hotbackup db_load \
 57.1331 +        db_printlog db_recover db_stat db_upgrade db_verify; do
 57.1332          rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
 57.1333      done
 57.1334  
 57.1335 @@ -1180,48 +1488,75 @@
 57.1336        l_cflags=""
 57.1337        l_cppflags="-DOPENPKG -I${l_prefix}/include/openpkg/rpm -I${l_prefix}/include/openpkg"
 57.1338        l_ldflags="-L${l_prefix}/lib/openpkg"
 57.1339 -      l_libs="-lrpmbuild -lrpm -lrpmio -lrpmdb -lrpmpopt -lrpmbeecrypt -lrpmbz2 -lrpmz"
 57.1340 +      l_libs="-lrpmbuild -lrpm -lrpmio -lrpmdb -lrpmmisc -lrpmsqlite3 -lrpmpopt -lrpmbeecrypt -lrpmbz2 -lrpmz"
 57.1341        sed -e "s:@l_prefix@:%{l_prefix}:g" \
 57.1342            -e "s:@l_cc@:$l_cc:g" \
 57.1343            -e "s:@l_cflags@:$l_cflags:g" \
 57.1344            -e "s:@l_cppflags@:$l_cppflags:g" \
 57.1345            -e "s:@l_ldflags@:$l_ldflags:g" \
 57.1346            -e "s:@l_libs@:$l_libs:g" \
 57.1347 -          -e "s:@l_version@:%{V_rpm}:g" \
 57.1348 +          -e "s:@l_version@:%{V_rpm_major}.%{V_rpm_minor}:g" \
 57.1349            <`SOURCE rpm-config.sh` \
 57.1350            >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
 57.1351      ) || exit $?
 57.1352      chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
 57.1353 -    sed -e "s:RPM_VERSION:%{V_rpm}:g" \
 57.1354 +    sed -e "s:RPM_VERSION:%{V_rpm_major}.%{V_rpm_minor}:g" \
 57.1355          <`SOURCE rpm-config.8` \
 57.1356          >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config.8
 57.1357  
 57.1358      #   install OpenPKG registry commands
 57.1359 -    ( cd openpkg-registry-%{V_registry}
 57.1360 -      mv  $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm \
 57.1361 -          $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpm
 57.1362 -      sed -e "s;@l_prefix@;%{l_prefix};g" \
 57.1363 -          rpm.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
 57.1364 -      chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
 57.1365 -      sed -e "s;@l_prefix@;%{l_prefix};g" \
 57.1366 -          register.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
 57.1367 -      chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
 57.1368 -      cp register.8 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register.8
 57.1369 -    ) || exit $?
 57.1370 +    mv  $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm \
 57.1371 +        $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpm
 57.1372 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
 57.1373 +        `SOURCE rpm.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
 57.1374 +    chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
 57.1375 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
 57.1376 +        `SOURCE register.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
 57.1377 +    chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
 57.1378 +    cp `SOURCE register.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register.8
 57.1379  
 57.1380 -    #   install OpenPKG Tool Chain command subset
 57.1381 -    ( cd openpkg-tools-%{V_tools}
 57.1382 -      cp cmd/curl.sh $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/curl.sh
 57.1383 -      cp cmd/build.pl $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
 57.1384 -      chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
 57.1385 -      cp cmd/build.8 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.8
 57.1386 -    ) || exit $?
 57.1387 +    #   allow GNU shtool to be called as "openpkg shtool" from external, too.
 57.1388 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
 57.1389 +        `SOURCE shtool.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/shtool.sh
 57.1390 +    chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/shtool.sh
 57.1391 +
 57.1392 +    #   install OpenPKG tool chain command subset
 57.1393 +    cp `SOURCE curl.sh`  $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/curl.sh
 57.1394 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/curl.sh
 57.1395 +    cp `SOURCE build.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
 57.1396 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
 57.1397 +    cp `SOURCE build.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.8
 57.1398 +    cp `SOURCE index.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/index.pl
 57.1399 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/index.pl
 57.1400 +    cp `SOURCE index.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/index.8
 57.1401 +    cp `SOURCE search.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/search.pl
 57.1402 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/search.pl
 57.1403 +    cp `SOURCE search.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/search.8
 57.1404 +    cp `SOURCE mirror.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/mirror.pl
 57.1405 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/mirror.pl
 57.1406 +    cp `SOURCE mirror.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/mirror.8
 57.1407 +    cp `SOURCE makeproxy.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/makeproxy.pl
 57.1408 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/makeproxy.pl
 57.1409 +    cp `SOURCE makeproxy.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/makeproxy.8
 57.1410 +    cp `SOURCE lint-fsl.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-fsl.pl
 57.1411 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-fsl.pl
 57.1412 +    cp `SOURCE lint-rc.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rc.pl
 57.1413 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rc.pl
 57.1414 +    cp `SOURCE lint-rpm.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rpm.pl
 57.1415 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rpm.pl
 57.1416 +    cp `SOURCE lint-spec.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-spec.pl
 57.1417 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-spec.pl
 57.1418 +    cp `SOURCE dev.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/dev.pl
 57.1419 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/dev.pl
 57.1420 +    cp `SOURCE dev.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/dev.8
 57.1421 +    cp `SOURCE sea.sh` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/sea.sh
 57.1422 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/sea.sh
 57.1423 +    cp `SOURCE sea.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/sea.8
 57.1424 +    cp `SOURCE stack.sh` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/stack.sh
 57.1425 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/stack.sh
 57.1426 +    cp `SOURCE stack.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/stack.8
 57.1427  
 57.1428      #   install RPM extension
 57.1429 -    ( cd rpm-%{V_rpm}
 57.1430 -      cp file/file $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
 57.1431 -      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
 57.1432 -    ) || exit $?
 57.1433      ( cd perl-%{V_perl}
 57.1434        cp miniperl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
 57.1435        ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
 57.1436 @@ -1231,7 +1566,7 @@
 57.1437        ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
 57.1438      ) || exit $?
 57.1439      ( cd curl-%{V_curl}
 57.1440 -      cp src/curl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
 57.1441 +      cp curl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
 57.1442        ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
 57.1443      ) || exit $?
 57.1444      ( cd bzip2-%{V_bzip2}
 57.1445 @@ -1242,6 +1577,10 @@
 57.1446        cp gzip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
 57.1447        ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
 57.1448      ) || exit $?
 57.1449 +    ( cd xz-%{V_xz}
 57.1450 +      cp src/xz/xz $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/xz
 57.1451 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/xz
 57.1452 +    ) || exit $?
 57.1453      ( cd patch-%{V_patch}
 57.1454        cp patch $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
 57.1455        ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
 57.1456 @@ -1258,6 +1597,27 @@
 57.1457        cp uuid $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
 57.1458        ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
 57.1459      ) || exit $?
 57.1460 +    ( cd sqlite-%{V_sqlite}
 57.1461 +      cp sqlite3 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/sqlite3
 57.1462 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/sqlite3
 57.1463 +    ) || exit $?
 57.1464 +    ( cd libarchive-%{V_libarchive}
 57.1465 +      cp bsdcpio $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdcpio
 57.1466 +      cp bsdtar $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdtar
 57.1467 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdcpio
 57.1468 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdtar
 57.1469 +    ) || exit $?
 57.1470 +    ( cd diffutils-%{V_diffutils}
 57.1471 +      ${l_strip} diff diff3 sdiff cmp
 57.1472 +      cp diff diff3 sdiff cmp $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
 57.1473 +    ) || exit $?
 57.1474 +    ( cd svs-%{V_svs}
 57.1475 +      sed -e "s;/bin/sh;%{l_prefix}/lib/openpkg/bash;" \
 57.1476 +          -e "s;^\(  *\)\(diff \);\1%{l_prefix}/lib/openpkg/\2;" \
 57.1477 +          <svs.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/svs
 57.1478 +      chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/svs
 57.1479 +      cp svs.1 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/svs.1
 57.1480 +    ) || exit $?
 57.1481      sed -e "s;@l_prefix@;%{l_prefix};g" \
 57.1482          -e "s;@l_musr@;%{l_musr};g" \
 57.1483          -e "s;@l_mgrp@;%{l_mgrp};g" \
 57.1484 @@ -1278,9 +1638,16 @@
 57.1485      sed -e "s:@l_prefix@:%{l_prefix}:g" \
 57.1486          <`SOURCE rpmtool` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
 57.1487      chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
 57.1488 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
 57.1489 +        -e "s;@l_musr@;%{l_musr};g" \
 57.1490 +        -e "s;@l_mgrp@;%{l_mgrp};g" \
 57.1491 +        <`SOURCE license.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/license
 57.1492 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/license
 57.1493 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
 57.1494 +        <`SOURCE license.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/license.8
 57.1495  
 57.1496      #   install OpenPKG tool chain execution frontend and execution wrapper
 57.1497 -    cp openpkg-executable-%{V_exec}/openpkg $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
 57.1498 +    cp openpkg $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
 57.1499      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
 57.1500      chmod 4775 $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
 57.1501      sed -e "s;@l_prefix@;%{l_prefix};g" \
 57.1502 @@ -1292,12 +1659,12 @@
 57.1503  
 57.1504      #   install more OpenPKG tool chain commands
 57.1505      sed -e "s;@l_prefix@;%{l_prefix};g" \
 57.1506 -        <`SOURCE install.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install
 57.1507 -    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install
 57.1508 -    sed -e "s;@l_prefix@;%{l_prefix};g" \
 57.1509          <`SOURCE man.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
 57.1510      chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
 57.1511  
 57.1512 +    #   install OpenPKG mutex utility
 57.1513 +    cp mutex $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/mutex
 57.1514 +
 57.1515      #   install an own copy of shtool
 57.1516      cp $shtool $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
 57.1517      chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
 57.1518 @@ -1387,18 +1754,37 @@
 57.1519        echo ""
 57.1520      ) >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/managers
 57.1521  
 57.1522 +    #   install default release information file
 57.1523 +    release_tag=""
 57.1524 +    release_url=""
 57.1525 +    l_stack=""; [ ".%{?l_stack:set}"  = .set ] && l_stack="%{l_stack}"
 57.1526 +    case "$l_stack" in
 57.1527 +        http: | https: | ftp: | file: )
 57.1528 +            release_url="$l_stack"
 57.1529 +            ;;
 57.1530 +        [a-zA-Z]* )
 57.1531 +            release_tag="$l_stack"
 57.1532 +            ;;
 57.1533 +    esac
 57.1534 +    ( echo "##"
 57.1535 +      echo "##  release -- OpenPKG Release Information"
 57.1536 +      echo "##"
 57.1537 +      echo ""
 57.1538 +      echo "TAG=$release_tag"
 57.1539 +      echo "URL=$release_url"
 57.1540 +      echo ""
 57.1541 +    ) >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/release
 57.1542 +
 57.1543      #   install overriding RPM configuration files
 57.1544      sed -e "s:@l_prefix@:%{l_prefix}:g" \
 57.1545          <`SOURCE rpmpopt` \
 57.1546 -        >>$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmpopt
 57.1547 -    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 57.1548 -        <`SOURCE rpmrc` \
 57.1549 -        >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmrc
 57.1550 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmpopt
 57.1551      sed -e "s:@l_prefix@:%{l_prefix}:g" \
 57.1552          -e "s:@l_prefix_static@:%{l_prefix}:g" \
 57.1553          -e "s;@l_build_path@;$l_build_path;g" \
 57.1554          -e "s;@l_build_ldlp@;$l_build_ldlp;g" \
 57.1555          -e "s;@l_build_ulim@;$l_build_ulim;g" \
 57.1556 +        -e "s;@l_unprivileged@;$l_unprivileged;g" \
 57.1557          -e "s:@TAG@:$tag:g" \
 57.1558          -e "s:@SUSR@:$susr:g" \
 57.1559          -e "s:@SGRP@:$sgrp:g" \
 57.1560 @@ -1410,6 +1796,9 @@
 57.1561          -e "s:@NGRP@:$ngrp:g" \
 57.1562          <`SOURCE rpmmacros` \
 57.1563          >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros
 57.1564 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 57.1565 +        <`SOURCE rpmlua` \
 57.1566 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmlua
 57.1567      cp `SOURCE openpkg.org.pgp` \
 57.1568         $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.org.pgp
 57.1569      cp `SOURCE openpkg.com.pgp` \
 57.1570 @@ -1417,6 +1806,33 @@
 57.1571      cp `SOURCE openpkg.net.pgp` \
 57.1572         $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.net.pgp
 57.1573  
 57.1574 +    #   install license data
 57.1575 +    test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d || \
 57.1576 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d
 57.1577 +    cp `SOURCE license-BOOT.txt` \
 57.1578 +       $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/BOOT
 57.1579 +    cp `SOURCE license-COMMUNITY.txt` \
 57.1580 +       $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/COMMUNITY
 57.1581 +    cp `SOURCE license-EVAL.txt` \
 57.1582 +       $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/EVAL
 57.1583 +    cp `SOURCE license-EXAMPLE.txt` \
 57.1584 +       $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/EXAMPLE
 57.1585 +    cp `SOURCE license-PROMO.txt` \
 57.1586 +       $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/PROMO
 57.1587 +    cp `SOURCE license-RECOVERY.txt` \
 57.1588 +       $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/RECOVERY
 57.1589 +    cp `SOURCE license.lua` \
 57.1590 +       $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/license.lua
 57.1591 +    touch $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license
 57.1592 +
 57.1593 +    #   provide directories for easy overriding of RPM configuration files
 57.1594 +    test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros.d || \
 57.1595 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros.d
 57.1596 +    test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmpopt.d || \
 57.1597 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmpopt.d
 57.1598 +    test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmlua.d || \
 57.1599 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmlua.d
 57.1600 +
 57.1601      #   display verbosity header
 57.1602      set +x; VERBOSE "INSTALL: Done. Thank you for flying OpenPKG..."; set -x
 57.1603  
 57.1604 @@ -1428,6 +1844,7 @@
 57.1605      %dir %{l_prefix}/RPM
 57.1606      %dir %{l_prefix}/RPM/SRC
 57.1607      %dir %{l_prefix}/RPM/PKG
 57.1608 +    %dir %{l_prefix}/RPM/TR
 57.1609      %dir %{l_prefix}/RPM/DB
 57.1610      %dir %{l_prefix}/RPM/TMP
 57.1611      %dir %{l_prefix}/cgi
 57.1612 @@ -1440,10 +1857,23 @@
 57.1613      %dir %{l_prefix}/etc/rc.d
 57.1614      %{l_prefix}/etc/rc.d/rc.openpkg
 57.1615      %dir %{l_prefix}/etc/openpkg
 57.1616 +    %ghost %{l_prefix}/etc/openpkg/license
 57.1617 +    %dir %{l_prefix}/etc/openpkg/license.d
 57.1618 +    %{l_prefix}/etc/openpkg/license.d/BOOT
 57.1619 +    %{l_prefix}/etc/openpkg/license.d/COMMUNITY
 57.1620 +    %{l_prefix}/etc/openpkg/license.d/EVAL
 57.1621 +    %{l_prefix}/etc/openpkg/license.d/EXAMPLE
 57.1622 +    %{l_prefix}/etc/openpkg/license.d/PROMO
 57.1623 +    %{l_prefix}/etc/openpkg/license.d/RECOVERY
 57.1624      %ghost %{l_prefix}/etc/openpkg/uuid
 57.1625 +    %config %{l_prefix}/etc/openpkg/release
 57.1626      %config %{l_prefix}/etc/openpkg/platform
 57.1627      %config %{l_prefix}/etc/openpkg/rpmmacros
 57.1628 -    %config %{l_prefix}/etc/openpkg/rpmrc
 57.1629 +    %config %{l_prefix}/etc/openpkg/rpmpopt
 57.1630 +    %config %{l_prefix}/etc/openpkg/rpmlua
 57.1631 +    %dir %{l_prefix}/etc/openpkg/rpmmacros.d
 57.1632 +    %dir %{l_prefix}/etc/openpkg/rpmpopt.d
 57.1633 +    %dir %{l_prefix}/etc/openpkg/rpmlua.d
 57.1634      %ghost %{l_prefix}/etc/openpkg/register.conf
 57.1635      %ghost %{l_prefix}/etc/openpkg/register.prep
 57.1636      %ghost %{l_prefix}/etc/openpkg/register.tran
 57.1637 @@ -1459,45 +1889,75 @@
 57.1638      %{l_prefix}/include/openpkg/rpm/beecrypt.h
 57.1639      %{l_prefix}/include/openpkg/rpm/bzlib.h
 57.1640      %{l_prefix}/include/openpkg/rpm/db.h
 57.1641 +    %{l_prefix}/include/openpkg/rpm/envvar.h
 57.1642 +    %{l_prefix}/include/openpkg/rpm/fs.h
 57.1643      %{l_prefix}/include/openpkg/rpm/fts.h
 57.1644      %{l_prefix}/include/openpkg/rpm/glob.h
 57.1645 -    %{l_prefix}/include/openpkg/rpm/hdrinline.h
 57.1646 -    %{l_prefix}/include/openpkg/rpm/header.h
 57.1647 +    %{l_prefix}/include/openpkg/rpm/mire.h
 57.1648      %{l_prefix}/include/openpkg/rpm/misc.h
 57.1649 +    %{l_prefix}/include/openpkg/rpm/pkgio.h
 57.1650      %{l_prefix}/include/openpkg/rpm/popt.h
 57.1651 +    %{l_prefix}/include/openpkg/rpm/rpm4compat.h
 57.1652      %{l_prefix}/include/openpkg/rpm/rpmal.h
 57.1653 +    %{l_prefix}/include/openpkg/rpm/rpmbc.h
 57.1654      %{l_prefix}/include/openpkg/rpm/rpmbuild.h
 57.1655 +    %{l_prefix}/include/openpkg/rpm/rpmcb.h
 57.1656      %{l_prefix}/include/openpkg/rpm/rpmcli.h
 57.1657 +    %{l_prefix}/include/openpkg/rpm/rpmconstant.h
 57.1658 +    %{l_prefix}/include/openpkg/rpm/rpmdav.h
 57.1659      %{l_prefix}/include/openpkg/rpm/rpmdb.h
 57.1660      %{l_prefix}/include/openpkg/rpm/rpmds.h
 57.1661 -    %{l_prefix}/include/openpkg/rpm/rpmerr.h
 57.1662 +    %{l_prefix}/include/openpkg/rpm/rpmevr.h
 57.1663      %{l_prefix}/include/openpkg/rpm/rpmfc.h
 57.1664      %{l_prefix}/include/openpkg/rpm/rpmfi.h
 57.1665 -    %{l_prefix}/include/openpkg/rpm/rpmfile.h
 57.1666 +    %{l_prefix}/include/openpkg/rpm/rpmgc.h
 57.1667 +    %{l_prefix}/include/openpkg/rpm/rpmgi.h
 57.1668      %{l_prefix}/include/openpkg/rpm/rpmhash.h
 57.1669 +    %{l_prefix}/include/openpkg/rpm/rpmio-stub.h
 57.1670      %{l_prefix}/include/openpkg/rpm/rpmio.h
 57.1671 +    %{l_prefix}/include/openpkg/rpm/rpmiotypes.h
 57.1672 +    %{l_prefix}/include/openpkg/rpm/rpmku.h
 57.1673      %{l_prefix}/include/openpkg/rpm/rpmlib.h
 57.1674      %{l_prefix}/include/openpkg/rpm/rpmlog.h
 57.1675      %{l_prefix}/include/openpkg/rpm/rpmmacro.h
 57.1676 -    %{l_prefix}/include/openpkg/rpm/rpmmessages.h
 57.1677 +    %{l_prefix}/include/openpkg/rpm/rpmmg.h
 57.1678 +    %{l_prefix}/include/openpkg/rpm/rpmns.h
 57.1679 +    %{l_prefix}/include/openpkg/rpm/rpmnss.h
 57.1680      %{l_prefix}/include/openpkg/rpm/rpmpgp.h
 57.1681      %{l_prefix}/include/openpkg/rpm/rpmps.h
 57.1682      %{l_prefix}/include/openpkg/rpm/rpmspec.h
 57.1683 +    %{l_prefix}/include/openpkg/rpm/rpmsq.h
 57.1684 +    %{l_prefix}/include/openpkg/rpm/rpmssl.h
 57.1685      %{l_prefix}/include/openpkg/rpm/rpmsw.h
 57.1686 +    %{l_prefix}/include/openpkg/rpm/rpmsx.h
 57.1687 +    %{l_prefix}/include/openpkg/rpm/rpmtag.h
 57.1688      %{l_prefix}/include/openpkg/rpm/rpmte.h
 57.1689      %{l_prefix}/include/openpkg/rpm/rpmts.h
 57.1690      %{l_prefix}/include/openpkg/rpm/rpmurl.h
 57.1691 -    %{l_prefix}/include/openpkg/rpm/stringbuf.h
 57.1692 +    %{l_prefix}/include/openpkg/rpm/rpmuuid.h
 57.1693 +    %{l_prefix}/include/openpkg/rpm/rpmversion.h
 57.1694 +    %{l_prefix}/include/openpkg/rpm/rpmwf.h
 57.1695 +    %{l_prefix}/include/openpkg/rpm/rpmxar.h
 57.1696 +    %{l_prefix}/include/openpkg/rpm/rpmzlog.h
 57.1697 +    %{l_prefix}/include/openpkg/rpm/signature.h
 57.1698 +    %{l_prefix}/include/openpkg/rpm/sqlite3.h
 57.1699      %{l_prefix}/include/openpkg/rpm/ugid.h
 57.1700 +    %{l_prefix}/include/openpkg/rpm/yarn.h
 57.1701      %{l_prefix}/include/openpkg/rpm/zconf.h
 57.1702      %{l_prefix}/include/openpkg/rpm/zlib.h
 57.1703      %dir %{l_prefix}/info
 57.1704      %dir %{l_prefix}/lib
 57.1705      %dir %{l_prefix}/lib/openpkg
 57.1706      %{l_prefix}/lib/openpkg/bash
 57.1707 +    %{l_prefix}/lib/openpkg/bsdcpio
 57.1708 +    %{l_prefix}/lib/openpkg/bsdtar
 57.1709      %{l_prefix}/lib/openpkg/bzip2
 57.1710      %{l_prefix}/lib/openpkg/curl
 57.1711 -    %{l_prefix}/lib/openpkg/file
 57.1712 +    %{l_prefix}/lib/openpkg/db_tool
 57.1713 +    %{l_prefix}/lib/openpkg/cmp
 57.1714 +    %{l_prefix}/lib/openpkg/diff
 57.1715 +    %{l_prefix}/lib/openpkg/diff3
 57.1716 +    %{l_prefix}/lib/openpkg/sdiff
 57.1717      %{l_prefix}/lib/openpkg/gzip
 57.1718      %{l_prefix}/lib/openpkg/librpm.a
 57.1719      %{l_prefix}/lib/openpkg/librpmbeecrypt.a
 57.1720 @@ -1505,46 +1965,52 @@
 57.1721      %{l_prefix}/lib/openpkg/librpmbz2.a
 57.1722      %{l_prefix}/lib/openpkg/librpmdb.a
 57.1723      %{l_prefix}/lib/openpkg/librpmio.a
 57.1724 +    %{l_prefix}/lib/openpkg/librpmmisc.a
 57.1725      %{l_prefix}/lib/openpkg/librpmpopt.a
 57.1726 +    %{l_prefix}/lib/openpkg/librpmsqlite3.a
 57.1727      %{l_prefix}/lib/openpkg/librpmz.a
 57.1728 -    %{l_prefix}/lib/openpkg/macros
 57.1729 -    %{l_prefix}/lib/openpkg/magic
 57.1730 -    %{l_prefix}/lib/openpkg/magic.mgc
 57.1731 -    %{l_prefix}/lib/openpkg/magic.mime
 57.1732 -    %{l_prefix}/lib/openpkg/magic.mime.mgc
 57.1733 +    %{l_prefix}/lib/openpkg/license.lua
 57.1734      %{l_prefix}/lib/openpkg/miniperl
 57.1735 +    %{l_prefix}/lib/openpkg/mutex
 57.1736      %{l_prefix}/lib/openpkg/openpkg
 57.1737      %{l_prefix}/lib/openpkg/openssl
 57.1738      %{l_prefix}/lib/openpkg/patch
 57.1739      %{l_prefix}/lib/openpkg/rc
 57.1740      %{l_prefix}/lib/openpkg/rpm
 57.1741 -    %{l_prefix}/lib/openpkg/rpmb
 57.1742 -    %{l_prefix}/lib/openpkg/rpmd
 57.1743 +    %{l_prefix}/lib/openpkg/rpm.pc
 57.1744      %{l_prefix}/lib/openpkg/rpmdb
 57.1745 -    %{l_prefix}/lib/openpkg/rpmdb_dump
 57.1746 -    %{l_prefix}/lib/openpkg/rpmdb_load
 57.1747 -    %{l_prefix}/lib/openpkg/rpmdb_verify
 57.1748 -    %{l_prefix}/lib/openpkg/rpme
 57.1749 -    %{l_prefix}/lib/openpkg/rpmi
 57.1750 -    %{l_prefix}/lib/openpkg/rpmk
 57.1751 +    %{l_prefix}/lib/openpkg/rpmdeps
 57.1752 +    %{l_prefix}/lib/openpkg/lua
 57.1753 +    %{l_prefix}/lib/openpkg/rpmmacros
 57.1754      %{l_prefix}/lib/openpkg/rpmpopt
 57.1755 -    %{l_prefix}/lib/openpkg/rpmq
 57.1756 -    %{l_prefix}/lib/openpkg/rpmt
 57.1757      %{l_prefix}/lib/openpkg/rpmtool
 57.1758 -    %{l_prefix}/lib/openpkg/rpmu
 57.1759 -    %{l_prefix}/lib/openpkg/rpmv
 57.1760      %{l_prefix}/lib/openpkg/shtool
 57.1761 +    %{l_prefix}/lib/openpkg/sqlite3
 57.1762      %{l_prefix}/lib/openpkg/tar
 57.1763      %{l_prefix}/lib/openpkg/uuid
 57.1764 +    %{l_prefix}/lib/openpkg/xz
 57.1765      %dir %{l_prefix}/libexec
 57.1766      %dir %{l_prefix}/libexec/openpkg
 57.1767      %{l_prefix}/libexec/openpkg/build.8
 57.1768      %{l_prefix}/libexec/openpkg/build.pl
 57.1769      %{l_prefix}/libexec/openpkg/curl.sh
 57.1770 -    %{l_prefix}/libexec/openpkg/install
 57.1771 +    %{l_prefix}/libexec/openpkg/dev.8
 57.1772 +    %{l_prefix}/libexec/openpkg/dev.pl
 57.1773 +    %{l_prefix}/libexec/openpkg/index.8
 57.1774 +    %{l_prefix}/libexec/openpkg/index.pl
 57.1775 +    %{l_prefix}/libexec/openpkg/license
 57.1776 +    %{l_prefix}/libexec/openpkg/license.8
 57.1777      %{l_prefix}/libexec/openpkg/lsync
 57.1778      %{l_prefix}/libexec/openpkg/lsync.8
 57.1779 +    %{l_prefix}/libexec/openpkg/lint-fsl.pl
 57.1780 +    %{l_prefix}/libexec/openpkg/lint-rc.pl
 57.1781 +    %{l_prefix}/libexec/openpkg/lint-rpm.pl
 57.1782 +    %{l_prefix}/libexec/openpkg/lint-spec.pl
 57.1783 +    %{l_prefix}/libexec/openpkg/makeproxy.8
 57.1784 +    %{l_prefix}/libexec/openpkg/makeproxy.pl
 57.1785      %{l_prefix}/libexec/openpkg/man
 57.1786 +    %{l_prefix}/libexec/openpkg/mirror.8
 57.1787 +    %{l_prefix}/libexec/openpkg/mirror.pl
 57.1788      %{l_prefix}/libexec/openpkg/rc
 57.1789      %{l_prefix}/libexec/openpkg/rc.8
 57.1790      %{l_prefix}/libexec/openpkg/register
 57.1791 @@ -1555,10 +2021,26 @@
 57.1792      %{l_prefix}/libexec/openpkg/rpm-config
 57.1793      %{l_prefix}/libexec/openpkg/rpm-config.8
 57.1794      %{l_prefix}/libexec/openpkg/rpm.8
 57.1795 +    %{l_prefix}/libexec/openpkg/rpmconstant
 57.1796 +    %{l_prefix}/libexec/openpkg/rpmconstant.8
 57.1797      %{l_prefix}/libexec/openpkg/rpm2cpio
 57.1798      %{l_prefix}/libexec/openpkg/rpm2cpio.8
 57.1799 -    %{l_prefix}/libexec/openpkg/rpmbuild
 57.1800      %{l_prefix}/libexec/openpkg/rpmbuild.8
 57.1801 +    %{l_prefix}/libexec/openpkg/rpmcache
 57.1802 +    %{l_prefix}/libexec/openpkg/rpmcache.8
 57.1803 +    %{l_prefix}/libexec/openpkg/rpmdeps.8
 57.1804 +    %{l_prefix}/libexec/openpkg/rpmgraph.8
 57.1805 +    %{l_prefix}/libexec/openpkg/rpmgrep
 57.1806 +    %{l_prefix}/libexec/openpkg/rpmgrep.1
 57.1807 +    %{l_prefix}/libexec/openpkg/sea.8
 57.1808 +    %{l_prefix}/libexec/openpkg/sea.sh
 57.1809 +    %{l_prefix}/libexec/openpkg/search.8
 57.1810 +    %{l_prefix}/libexec/openpkg/search.pl
 57.1811 +    %{l_prefix}/libexec/openpkg/stack.8
 57.1812 +    %{l_prefix}/libexec/openpkg/stack.sh
 57.1813 +    %{l_prefix}/libexec/openpkg/shtool.sh
 57.1814 +    %{l_prefix}/libexec/openpkg/svs
 57.1815 +    %{l_prefix}/libexec/openpkg/svs.1
 57.1816      %{l_prefix}/libexec/openpkg/uuid
 57.1817      %{l_prefix}/libexec/openpkg/uuid.8
 57.1818      %dir %{l_prefix}/man
 57.1819 @@ -1638,7 +2120,7 @@
 57.1820            echo $LOGNAME`
 57.1821  
 57.1822      #   determine runtime details (for both inside and outside RPM!!)
 57.1823 -    #   - bootstrapping: $xxx is set from aux.wrapbin.sh
 57.1824 +    #   - bootstrapping: $xxx is set from etc.wrapbin.sh
 57.1825      #   - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
 57.1826      #   - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
 57.1827      [ ".$susr" = . ] && susr="%{?l_susr}%{!?l_susr:root}"
 57.1828 @@ -1673,6 +2155,33 @@
 57.1829      [ ".$prefix" = . ] && prefix="%{l_prefix}"
 57.1830      prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
 57.1831  
 57.1832 +    #   Pre-flight check before update to make sure that the currently
 57.1833 +    #   activated license is still valid. This is done just be friendly
 57.1834 +    #   to people and to not too easily shoot theirself into the foot
 57.1835 +    #   by blindly upgrading and then having to recognize that the new
 57.1836 +    #   OpenPKG Framework is no longer covered by the old license.
 57.1837 +    if [ ".$1" = .2 ]; then
 57.1838 +        ( OPENPKG_FRAMEWORK_RELEASE="%{release}"
 57.1839 +          export OPENPKG_FRAMEWORK_RELEASE
 57.1840 +          #   LATER:
 57.1841 +          #   $prefix/bin/openpkg rpm -q openpkg >/dev/null 2>&1 || exit $?
 57.1842 +          #   if [ $? -ne 0 ]; then
 57.1843 +          #   NOW:
 57.1844 +          output="`$prefix/bin/openpkg rpm -q openpkg 2>&1 | grep 'ENVIRONMENT ANOMALY'`"
 57.1845 +          if [ ".$output" != . ]; then
 57.1846 +              id="`($prefix/bin/openpkg license active) 2>/dev/null`"
 57.1847 +              [ ".$id" = . ] && id="UNKNOWN"
 57.1848 +              ( echo "Attention, your currently active license \"$id\" does"
 57.1849 +                echo "not allow you to use this newer version of the OpenPKG Framework!"
 57.1850 +                echo "We cancel this update to prevent you from a run-time failure."
 57.1851 +                echo "Please first upgrade to a newer license with the command:"
 57.1852 +                echo "  \$ $prefix/bin/openpkg license update $id <file>"
 57.1853 +              ) | $prefix/lib/openpkg/rpmtool msg -b -t error
 57.1854 +              exit 42
 57.1855 +          fi
 57.1856 +        ) || exit $?
 57.1857 +    fi
 57.1858 +
 57.1859      #   register instance in presence file
 57.1860      presence="/etc/openpkg"
 57.1861      exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
 57.1862 @@ -1689,12 +2198,19 @@
 57.1863          eval "xuid=\"\$${class}uid\""
 57.1864          eval "xgid=\"\$${class}gid\""
 57.1865          if [ ".$xuid" = . ]; then
 57.1866 -            xuid=`(getent passwd "${xusr}"; \
 57.1867 -                   grep "^${xusr}:" /etc/passwd; \
 57.1868 -                   ypmatch "${xusr}" passwd; \
 57.1869 -                   nismatch "${xusr}" passwd; \
 57.1870 -                   nidump passwd . | grep "^${xusr}:") 2>/dev/null | \
 57.1871 -                   sed -e 'q' | awk -F: '{ print $3; }'`
 57.1872 +            case "$plid" in
 57.1873 +                Darwin/10.[1-9]* | Darwin/1[1-9].* )
 57.1874 +                    xuid=`dscl . -read "/users/${xusr}" UniqueID 2>/dev/null | awk '{ print $2; }'`
 57.1875 +                    ;;
 57.1876 +                * )
 57.1877 +                    xuid=`(getent passwd "${xusr}"; \
 57.1878 +                        grep "^${xusr}:" /etc/passwd; \
 57.1879 +                        ypmatch "${xusr}" passwd; \
 57.1880 +                        nismatch "${xusr}" passwd; \
 57.1881 +                        nidump passwd . | grep "^${xusr}:") 2>/dev/null | \
 57.1882 +                        sed -e 'q' | awk -F: '{ print $3; }'`
 57.1883 +                    ;;
 57.1884 +            esac
 57.1885              if [ ".$xuid" = . ]; then
 57.1886                  #   seek for a reasonably uid/gid pair
 57.1887                  xuid=1000
 57.1888 @@ -1702,13 +2218,26 @@
 57.1889                  while [ ".$ok" = .0 ]; do
 57.1890                      eval "u_exists=\$u_exists_$xuid"
 57.1891                      if [ ".$u_exists" = . ]; then
 57.1892 -                        u_exists=`(getent passwd; cat /etc/passwd; ypcat passwd; niscat passwd; nidump passwd .) 2>/dev/null |\
 57.1893 -                                  grep "^[^:]*:[^:]*:$xuid:"`
 57.1894 +                        case "$plid" in
 57.1895 +                            Darwin/10.[1-9]* | Darwin/1[1-9].* )
 57.1896 +                                u_exists=`dscl . -search /users UniqueID "$xuid" 2>/dev/null`
 57.1897 +                                ;;
 57.1898 +                            * )
 57.1899 +                                u_exists=`(getent passwd; cat /etc/passwd; ypcat passwd; niscat passwd; nidump passwd .) 2>/dev/null |\
 57.1900 +                                          grep "^[^:]*:[^:]*:$xuid:"`
 57.1901 +                                ;;
 57.1902 +                        esac
 57.1903                      fi
 57.1904                      eval "g_exists=\$g_exists_$xuid"
 57.1905                      if [ ".$g_exists" = . ]; then
 57.1906 -                        g_exists=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
 57.1907 -                                  grep "^[^:]*:[^:]*:$xuid:"`
 57.1908 +                        case "$plid" in
 57.1909 +                            Darwin/10.[1-9]* | Darwin/1[1-9].* )
 57.1910 +                                g_exists=`dscl . -search /groups PrimaryGroupID "$xuid" 2>/dev/null`
 57.1911 +                                ;;
 57.1912 +                            * )
 57.1913 +                                g_exists=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
 57.1914 +                                          grep "^[^:]*:[^:]*:$xuid:"`
 57.1915 +                        esac
 57.1916                      fi
 57.1917                      if [ ".$u_exists" = . -a ".$g_exists" = . ]; then
 57.1918                          ok=1
 57.1919 @@ -1725,7 +2254,8 @@
 57.1920                    grep "^${xgrp}:" /etc/group; \
 57.1921                    ypmatch "${xgrp}" group; \
 57.1922                    nismatch "${xgrp}" group; \
 57.1923 -                  nidump group . | grep "^${xgrp}:") 2>/dev/null | \
 57.1924 +                  nidump group . | grep "^${xgrp}:"; \
 57.1925 +                  dscl . -read "/groups/${xgrp}" | grep RecordName) 2>/dev/null | \
 57.1926                    sed -e 'q' | awk -F: '{ print $3; }'`
 57.1927              if [ ".$xgid" = . ]; then
 57.1928                  xgid="$xuid"
 57.1929 @@ -1771,7 +2301,8 @@
 57.1930                   grep "^$usr:" /etc/passwd; \
 57.1931                   ypmatch "$usr" passwd; \
 57.1932                   nismatch "$usr" passwd; \
 57.1933 -                 nidump passwd . | grep "^$usr:") 2>/dev/null | \
 57.1934 +                 nidump passwd . | grep "^$usr:"; \
 57.1935 +                 dscl . -read "/users/$usr" | grep RecordName) 2>/dev/null | \
 57.1936                   sed -e 'q'`
 57.1937          if [ ".$exists" = . ]; then
 57.1938              if [ ".$cusr" != ".root" ]; then
 57.1939 @@ -1822,8 +2353,22 @@
 57.1940                          else update=":"
 57.1941                          fi
 57.1942                          ;;
 57.1943 +                    CYGWIN*/* )
 57.1944 +                        file=/etc/passwd
 57.1945 +                        entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
 57.1946 +                        update=":"
 57.1947 +                        ;;
 57.1948                  esac
 57.1949                  case "$plid" in
 57.1950 +                    Darwin/10.[1-9]* | Darwin/1[1-9].* )
 57.1951 +                        dscl . -create "/users/${usr}"
 57.1952 +                        dscl . -create "/users/${usr}" Password         "*"
 57.1953 +                        dscl . -create "/users/${usr}" UniqueID         "${uid}"
 57.1954 +                        dscl . -create "/users/${usr}" PrimaryGroupID   "${gid}"
 57.1955 +                        dscl . -create "/users/${usr}" RealName         "${realname}"
 57.1956 +                        dscl . -create "/users/${usr}" NFSHomeDirectory "${prefix}"
 57.1957 +                        dscl . -create "/users/${usr}" UserShell        "${shell}"
 57.1958 +                        ;;
 57.1959                      Darwin/* )
 57.1960                          niutil -create     . "/users/${usr}"
 57.1961                          niutil -createprop . "/users/${usr}" passwd   "*"
 57.1962 @@ -1860,7 +2405,8 @@
 57.1963                  grep "^$grp:" /etc/group; \
 57.1964                  ypmatch "$grp" group; \
 57.1965                  nismatch "$grp" group; \
 57.1966 -                nidump group . | grep "^$grp:") 2>/dev/null | \
 57.1967 +                nidump group . | grep "^$grp:"; \
 57.1968 +                dscl . -read "/groups/$grp" | grep RecordName) 2>/dev/null | \
 57.1969                  sed -e 'q'`
 57.1970          if [ ".$exists" = . ]; then
 57.1971              if [ ".$cusr" != ".root" ]; then
 57.1972 @@ -1868,6 +2414,12 @@
 57.1973                  echo "openpkg:WARNING: (would require root-privileges)" 1>&2
 57.1974              else
 57.1975                  case "$plid" in
 57.1976 +                    Darwin/10.[1-9]* | Darwin/1[1-9].* )
 57.1977 +                        dscl . -create "/groups/${grp}"
 57.1978 +                        dscl . -create "/groups/${grp}" Password        "*"
 57.1979 +                        dscl . -create "/groups/${grp}" PrimaryGroupID  "${gid}"
 57.1980 +                        dscl . -create "/groups/${grp}" GroupMembership "${usr}"
 57.1981 +                        ;;
 57.1982                      Darwin/* )
 57.1983                          niutil -create     . "/groups/${grp}"
 57.1984                          niutil -createprop . "/groups/${grp}" gid   "${gid}"
 57.1985 @@ -1899,26 +2451,30 @@
 57.1986      #   ensure chown/chgrp works immediately after pwconv on Linux and Solaris
 57.1987      if [ -x /usr/sbin/nscd ]; then
 57.1988          /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
 57.1989 -        /usr/sbin/nscd -i group >/dev/null 2>&1 || true
 57.1990 +        /usr/sbin/nscd -i group  >/dev/null 2>&1 || true
 57.1991      fi
 57.1992  
 57.1993      #   create the startup/shutdown transfer script
 57.1994 -    name=`echo "$prefix" | sed -e 's;/;;g'`
 57.1995 +    name_old="`echo "$prefix" | sed -e 's;/;;g'`"
 57.1996 +    name="openpkg-`echo "$prefix" | sed -e 's;[^a-zA-Z0-9];;g'`"
 57.1997      if [ ".$cusr" != ".root" ]; then
 57.1998          echo "openpkg:WARNING: skipping creation of system run-command hooks" 1>&2
 57.1999          echo "openpkg:WARNING: (would require root-privileges)" 1>&2
 57.2000      else
 57.2001          case "$plid" in
 57.2002              FreeBSD/* )
 57.2003 -                if [ ! -f /etc/rc.d/openpkg-${name} ]; then
 57.2004 +                if [ -f /etc/rc.d/${name_old} ]; then
 57.2005 +                    rm -f /etc/rc.d/${name_old}
 57.2006 +                fi
 57.2007 +                if [ ! -f /etc/rc.d/${name} ]; then
 57.2008                      #   install transfer script
 57.2009 -                    rm -f /etc/rc.d/openpkg-${name} >/dev/null 2>&1
 57.2010 +                    rm -f /etc/rc.d/${name} >/dev/null 2>&1
 57.2011                      ( echo "#!/bin/sh"
 57.2012                        echo "##"
 57.2013 -                      echo "##  openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 57.2014 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 57.2015                        echo "##"
 57.2016                        echo ""
 57.2017 -                      echo "# PROVIDE: openpkg-${name}"
 57.2018 +                      echo "# PROVIDE: ${name}"
 57.2019                        echo "# REQUIRE: LOGIN"
 57.2020                        echo "# KEYWORD: shutdown"
 57.2021                        echo ""
 57.2022 @@ -1930,19 +2486,22 @@
 57.2023                        echo "restart_cmd=\"openpkg_rc_all stop start\""
 57.2024                        echo ""
 57.2025                        echo "openpkg_rc_all () {"
 57.2026 -                      echo "    if [ -f ${prefix}/etc/rc ]; then"
 57.2027 -                      echo "        ${prefix}/etc/rc all \"\$@\""
 57.2028 +                      echo "    if [ -f ${prefix}/bin/openpkg ]; then"
 57.2029 +                      echo "        ${prefix}/bin/openpkg rc all \"\$@\""
 57.2030                        echo "    fi"
 57.2031                        echo "}"
 57.2032                        echo ""
 57.2033                        echo "load_rc_config \$name"
 57.2034                        echo "run_rc_command \"\$1\""
 57.2035                        echo ""
 57.2036 -                    ) >/etc/rc.d/openpkg-${name}
 57.2037 -                    chmod 755 /etc/rc.d/openpkg-${name}
 57.2038 +                    ) >/etc/rc.d/${name}
 57.2039 +                    chmod 755 /etc/rc.d/${name}
 57.2040                  fi
 57.2041                  ;;
 57.2042              NetBSD/* )
 57.2043 +                if [ -f /etc/rc.d/${name_old} ]; then
 57.2044 +                    rm -f /etc/rc.d/${name_old}
 57.2045 +                fi
 57.2046                  if [ ! -f /etc/rc.d/${name} ]; then
 57.2047                      ( echo "#!/bin/sh"
 57.2048                        echo "##"
 57.2049 @@ -1952,11 +2511,11 @@
 57.2050                        echo "##  REQUIRE: DAEMON LOGIN NETWORK SERVERS"
 57.2051                        echo "##"
 57.2052                        echo ""
 57.2053 -                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 57.2054 +                      echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
 57.2055                        echo "case \$1 in"
 57.2056 -                      echo "    start   ) exec ${prefix}/etc/rc all start ;;"
 57.2057 -                      echo "    stop    ) exec ${prefix}/etc/rc all stop  ;;"
 57.2058 -                      echo "    restart ) exec ${prefix}/etc/rc all stop start ;;"
 57.2059 +                      echo "    start   ) exec ${prefix}/bin/openpkg rc all start ;;"
 57.2060 +                      echo "    stop    ) exec ${prefix}/bin/openpkg rc all stop  ;;"
 57.2061 +                      echo "    restart ) exec ${prefix}/bin/openpkg rc all stop start ;;"
 57.2062                        echo "    status  ) ;;"
 57.2063                        echo "esac"
 57.2064                      ) >/etc/rc.d/${name}
 57.2065 @@ -1965,11 +2524,14 @@
 57.2066                  ;;
 57.2067              Linux/* )
 57.2068                  if [ -f /etc/gentoo-release ]; then
 57.2069 -                    if [ ! -f /etc/init.d/openpkg-${name} ]; then
 57.2070 +                    if [ -f /etc/init.d/${name_old} ]; then
 57.2071 +                        rm -f /etc/init.d/${name_old}
 57.2072 +                    fi
 57.2073 +                    if [ ! -f /etc/init.d/${name} ]; then
 57.2074                          #   install transfer script
 57.2075                          ( echo "#!/sbin/runscript"
 57.2076                            echo "##"
 57.2077 -                          echo "##  openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 57.2078 +                          echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 57.2079                            echo "##"
 57.2080                            echo ""
 57.2081                            echo "depend() {"
 57.2082 @@ -1977,48 +2539,71 @@
 57.2083                            echo "}"
 57.2084                            echo ""
 57.2085                            echo "checkconfig() {"
 57.2086 -                          echo "    [ -f ${prefix}/etc/rc ] || return 1"
 57.2087 +                          echo "    [ -f ${prefix}/bin/openpkg ] || return 1"
 57.2088                            echo "    case $1 in"
 57.2089 -                          echo "        start ) exec ${prefix}/etc/rc all start ;;"
 57.2090 -                          echo "        stop  ) exec ${prefix}/etc/rc all stop  ;;"
 57.2091 +                          echo "        start ) exec ${prefix}/bin/openpkg rc all start ;;"
 57.2092 +                          echo "        stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
 57.2093                            echo "    esac"
 57.2094                            echo "}"
 57.2095                            echo ""
 57.2096                            echo "start() {"
 57.2097                            echo "    checkconfig || return 1"
 57.2098                            echo "    ebegin "Starting OpenPKG ${prefix} hierarchy""
 57.2099 -                          echo "    exec ${prefix}/etc/rc all start"
 57.2100 +                          echo "    exec ${prefix}/bin/openpkg rc all start"
 57.2101                            echo "    eend 0"
 57.2102                            echo "}"
 57.2103                            echo ""
 57.2104                            echo "stop() {"
 57.2105                            echo "    checkconfig || return 1"
 57.2106                            echo "    ebegin "Stopping OpenPKG ${prefix} hierarchy""
 57.2107 -                          echo "    exec ${prefix}/etc/rc all stop"
 57.2108 +                          echo "    exec ${prefix}/bin/openpkg rc all stop"
 57.2109                            echo "    eend 0"
 57.2110                            echo "}"
 57.2111 -                        ) >/etc/init.d/openpkg-${name}
 57.2112 -                        chmod 755 /etc/init.d/openpkg-${name}
 57.2113 -                        /sbin/rc-update add openpkg-${name} default
 57.2114 +                        ) >/etc/init.d/${name}
 57.2115 +                        chmod 755 /etc/init.d/${name}
 57.2116 +                        /sbin/rc-update add ${name} default
 57.2117 +                    fi
 57.2118 +                elif [ -f /etc/redhat-release ]; then
 57.2119 +                    sroot=/etc/rc.d/init.d
 57.2120 +                    if [ ! -f $sroot/${name} ]; then
 57.2121 +                        #   install transfer script
 57.2122 +                        ( echo "#!/bin/sh"
 57.2123 +                          echo "##"
 57.2124 +                          echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 57.2125 +                          echo "##"
 57.2126 +                          echo ""
 57.2127 +                          echo "# chkconfig: 2345 99 00"
 57.2128 +                          echo "# description: OpenPKG ${prefix}"
 57.2129 +                          echo ""
 57.2130 +                          echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
 57.2131 +                          echo "case \$1 in"
 57.2132 +                          echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
 57.2133 +                          echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
 57.2134 +                          echo "esac"
 57.2135 +                        ) >$sroot/${name}
 57.2136 +                        chmod 755 $sroot/${name}
 57.2137 +                        #   activate script
 57.2138 +                        /sbin/chkconfig --add ${name}
 57.2139 +                        /sbin/chkconfig ${name} on
 57.2140                      fi
 57.2141                  else
 57.2142                      #   sroot: script root directory
 57.2143                      #   lroot: link   root directory
 57.2144                      if [ -f /etc/debian_version ]; then
 57.2145                          sroot=/etc/init.d
 57.2146 -                        lroot=/etc/rc%d.d
 57.2147 -                    elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
 57.2148 +                        lroot=/etc/rc%%d.d
 57.2149 +                    elif [ -f /etc/mandrake-release ]; then
 57.2150                          sroot=/etc/rc.d/init.d
 57.2151 -                        lroot=/etc/rc.d/rc%d.d
 57.2152 +                        lroot=/etc/rc.d/rc%%d.d
 57.2153                      elif [ -f /etc/SuSE-release ]; then
 57.2154                          sroot=/etc/init.d
 57.2155 -                        lroot=/etc/init.d/rc%d.d
 57.2156 +                        lroot=/etc/init.d/rc%%d.d
 57.2157                      elif [ -f /etc/slackware-version ]; then
 57.2158                          sroot=/etc/rc.d
 57.2159 -                        lroot=/etc/rc.d/rc%d.d
 57.2160 +                        lroot=/etc/rc.d/rc%%d.d
 57.2161                          name="rc.${name}"
 57.2162                          for i in 0 1 2 3 4 5 6; do
 57.2163 -                            l=`echo $lroot | sed -e "s;%d;$i;"`
 57.2164 +                            l=`echo $lroot | sed -e "s;%%d;$i;"`
 57.2165                              if [ ! -d $l ]; then
 57.2166                                  mkdir $l 2>&1 || true
 57.2167                              fi
 57.2168 @@ -2037,7 +2622,7 @@
 57.2169                          done
 57.2170                          for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
 57.2171                              if [ -d $lr ]; then
 57.2172 -                                lroot="`echo $lr | sed -e 's;2;%d;'`"
 57.2173 +                                lroot="`echo $lr | sed -e 's;2;%%d;'`"
 57.2174                                  break
 57.2175                              fi
 57.2176                          done
 57.2177 @@ -2046,6 +2631,9 @@
 57.2178                              exit 1
 57.2179                          fi
 57.2180                      fi
 57.2181 +                    if [ -f $sroot/${name_old} ]; then
 57.2182 +                        rm -f $sroot/${name_old}
 57.2183 +                    fi
 57.2184                      if [ ! -f $sroot/${name} ]; then
 57.2185                          #   install transfer script
 57.2186                          ( echo "#!/bin/sh"
 57.2187 @@ -2053,115 +2641,27 @@
 57.2188                            echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 57.2189                            echo "##"
 57.2190                            echo ""
 57.2191 -                          echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 57.2192 +                          echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
 57.2193                            echo "case \$1 in"
 57.2194 -                          echo "    start ) exec ${prefix}/etc/rc all start ;;"
 57.2195 -                          echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
 57.2196 +                          echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
 57.2197 +                          echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
 57.2198                            echo "esac"
 57.2199                          ) >$sroot/${name}
 57.2200                          chmod 755 $sroot/${name}
 57.2201                          #   create corresponding symbolic links
 57.2202                          for i in 2 3 4 5; do
 57.2203 -                            ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/S99${name}
 57.2204 +                            ln -s $sroot/${name} `echo $lroot | sed -e "s;%%d;$i;"`/S99${name}
 57.2205                          done
 57.2206                          for i in 0 1 6; do
 57.2207 -                            ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/K00${name}
 57.2208 +                            ln -s $sroot/${name} `echo $lroot | sed -e "s;%%d;$i;"`/K00${name}
 57.2209                          done
 57.2210                      fi
 57.2211                  fi
 57.2212                  ;;
 57.2213 -            SunOS/5.1* )
 57.2214 -                if [ ! -d /var/svc/manifest/openpkg ]; then
 57.2215 -                    mkdir /var/svc/manifest/openpkg
 57.2216 +            SunOS/5.* )
 57.2217 +                if [ -f /etc/init.d/${name_old} ]; then
 57.2218 +                    rm -f /etc/init.d/${name_old}
 57.2219                  fi
 57.2220 -                if [ ! -f /var/svc/manifest/openpkg/${name}.xml ]; then
 57.2221 -                    #   install SMF manifest
 57.2222 -                    ( echo "<?xml version=\"1.0\"?>"
 57.2223 -                      echo "<!DOCTYPE service_bundle SYSTEM \"/usr/share/lib/xml/dtd/service_bundle.dtd.1\">"
 57.2224 -                      echo "<service_bundle type='manifest' name='OpenPKG:${name}'>"
 57.2225 -                      echo "    <service"
 57.2226 -                      echo "        name='openpkg/${name}'"
 57.2227 -                      echo "        type='service'"
 57.2228 -                      echo "        version='1'>"
 57.2229 -                      echo "        <single_instance />"
 57.2230 -                      echo "        <dependency"
 57.2231 -                      echo "            name='filesystem'"
 57.2232 -                      echo "            type='service'"
 57.2233 -                      echo "            grouping='require_all'"
 57.2234 -                      echo "            restart_on='none'>"
 57.2235 -                      echo "            <service_fmri value='svc:/system/filesystem/local' />"
 57.2236 -                      echo "        </dependency>"
 57.2237 -                      echo "        <dependency"
 57.2238 -                      echo "            name='name-services'"
 57.2239 -                      echo "            type='service'"
 57.2240 -                      echo "            grouping='require_all'"
 57.2241 -                      echo "            restart_on='none'>"
 57.2242 -                      echo "            <service_fmri value='svc:/milestone/name-services' />"
 57.2243 -                      echo "        </dependency>"
 57.2244 -                      echo "        <dependency"
 57.2245 -                      echo "            name='multi-user-server'"
 57.2246 -                      echo "            type='service'"
 57.2247 -                      echo "            grouping='require_all'"
 57.2248 -                      echo "            restart_on='none'>"
 57.2249 -                      echo "            <service_fmri value='svc:/milestone/multi-user-server' />"
 57.2250 -                      echo "        </dependency>"
 57.2251 -                      echo "        <dependency"
 57.2252 -                      echo "            name='network'"
 57.2253 -                      echo "            type='service'"
 57.2254 -                      echo "            grouping='require_all'"
 57.2255 -                      echo "            restart_on='none'>"
 57.2256 -                      echo "            <service_fmri value='svc:/milestone/network' />"
 57.2257 -                      echo "        </dependency>"
 57.2258 -                      echo "        <exec_method"
 57.2259 -                      echo "            type='method'"
 57.2260 -                      echo "            name='start'"
 57.2261 -                      echo "            exec='${prefix}/etc/rc all start'"
 57.2262 -                      echo "            timeout_seconds='180'>"
 57.2263 -                      echo "            <method_context>"
 57.2264 -                      echo "                <method_credential user='root' group='root' />"
 57.2265 -                      echo "            </method_context>"
 57.2266 -                      echo "        </exec_method>"
 57.2267 -                      echo "        <exec_method"
 57.2268 -                      echo "            type='method'"
 57.2269 -                      echo "            name='stop'"
 57.2270 -                      echo "            exec='${prefix}/etc/rc all stop'"
 57.2271 -                      echo "            timeout_seconds='180'>"
 57.2272 -                      echo "        </exec_method>"
 57.2273 -                      echo "        <property_group name='startd' type='framework'>"
 57.2274 -                      echo "            <propval"
 57.2275 -                      echo "                name='ignore_error'"
 57.2276 -                      echo "                type='astring'"
 57.2277 -                      echo "                value='core,signal' />"
 57.2278 -                      echo "        </property_group>"
 57.2279 -                      echo "        <property_group name='startd' type='framework'>"
 57.2280 -                      echo "            <propval"
 57.2281 -                      echo "                name='duration'"
 57.2282 -                      echo "                type='astring'"
 57.2283 -                      echo "                value='transient' />"
 57.2284 -                      echo "        </property_group>"
 57.2285 -                      echo "        <property_group name='general' type='framework'>"
 57.2286 -                      echo "            <propval"
 57.2287 -                      echo "                name='action_authorization'"
 57.2288 -                      echo "                type='astring'"
 57.2289 -                      echo "                value='solaris.smf.manage.openpkg.${name}' />"
 57.2290 -                      echo "        </property_group>"
 57.2291 -                      echo "        <instance name='default' enabled='false' />"
 57.2292 -                      echo "        <stability value='Unstable' />"
 57.2293 -                      echo "        <template>"
 57.2294 -                      echo "            <common_name>"
 57.2295 -                      echo "                <loctext xml:lang='C'>OpenPKG Instance ${prefix}</loctext>"
 57.2296 -                      echo "            </common_name>"
 57.2297 -                      echo "        </template>"
 57.2298 -                      echo "    </service>"
 57.2299 -                      echo "</service_bundle>"
 57.2300 -                    ) >/var/svc/manifest/openpkg/${name}.xml
 57.2301 -                    chmod 644 /var/svc/manifest/openpkg/${name}.xml
 57.2302 -                    /usr/sbin/svccfg import /var/svc/manifest/openpkg/${name}.xml
 57.2303 -                    ( echo "/usr/sbin/svcadm enable \"svc:/openpkg/${name}:default\""
 57.2304 -                    ) >%{l_prefix}.pre-post-process.sh
 57.2305 -                fi
 57.2306 -                ;;
 57.2307 -            SunOS/5.* )
 57.2308                  if [ ! -f /etc/init.d/${name} ]; then
 57.2309                      #   install transfer script
 57.2310                      ( echo "#!/bin/sh"
 57.2311 @@ -2169,10 +2669,10 @@
 57.2312                        echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 57.2313                        echo "##"
 57.2314                        echo ""
 57.2315 -                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 57.2316 +                      echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
 57.2317                        echo "case \$1 in"
 57.2318 -                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
 57.2319 -                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
 57.2320 +                      echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
 57.2321 +                      echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
 57.2322                        echo "esac"
 57.2323                      ) >/etc/init.d/${name}
 57.2324                      chmod 755 /etc/init.d/${name}
 57.2325 @@ -2185,6 +2685,9 @@
 57.2326                  fi
 57.2327                  ;;
 57.2328              UnixWare/* )
 57.2329 +                if [ -f /etc/init.d/${name_old} ]; then
 57.2330 +                    rm -f /etc/init.d/${name_old}
 57.2331 +                fi
 57.2332                  if [ ! -f /etc/init.d/${name} ]; then
 57.2333                      #   install transfer script
 57.2334                      ( echo "#!/bin/sh"
 57.2335 @@ -2192,10 +2695,10 @@
 57.2336                        echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 57.2337                        echo "##"
 57.2338                        echo ""
 57.2339 -                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 57.2340 +                      echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
 57.2341                        echo "case \$1 in"
 57.2342 -                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
 57.2343 -                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
 57.2344 +                      echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
 57.2345 +                      echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
 57.2346                        echo "esac"
 57.2347                      ) >/etc/init.d/${name}
 57.2348                      chmod 755 /etc/init.d/${name}
 57.2349 @@ -2208,6 +2711,9 @@
 57.2350                  fi
 57.2351                  ;;
 57.2352              AIX/* )
 57.2353 +                if [ -f /etc/rc.d/init.d/${name_old} ]; then
 57.2354 +                    rm -f /etc/rc.d/init.d/${name_old}
 57.2355 +                fi
 57.2356                  if [ ! -f /etc/rc.d/init.d/${name} ]; then
 57.2357                      #   install transfer script
 57.2358                      ( echo "#!/bin/sh"
 57.2359 @@ -2215,10 +2721,10 @@
 57.2360                        echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 57.2361                        echo "##"
 57.2362                        echo ""
 57.2363 -                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 57.2364 +                      echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
 57.2365                        echo "case \$1 in"
 57.2366 -                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
 57.2367 -                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
 57.2368 +                      echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
 57.2369 +                      echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
 57.2370                        echo "esac"
 57.2371                      ) >/etc/rc.d/init.d/${name}
 57.2372                      chmod 755 /etc/rc.d/init.d/${name}
 57.2373 @@ -2229,6 +2735,9 @@
 57.2374                  fi
 57.2375                  ;;
 57.2376              OSF1/V5.* )
 57.2377 +                if [ -f /sbin/init.d/${name_old} ]; then
 57.2378 +                    rm -f /sbin/init.d/${name_old}
 57.2379 +                fi
 57.2380                  if [ ! -f /sbin/init.d/${name} ]; then
 57.2381                      #   install transfer script
 57.2382                      ( echo "#!/bin/sh"
 57.2383 @@ -2236,10 +2745,10 @@
 57.2384                        echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 57.2385                        echo "##"
 57.2386                        echo ""
 57.2387 -                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 57.2388 +                      echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
 57.2389                        echo "case \$1 in"
 57.2390 -                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
 57.2391 -                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
 57.2392 +                      echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
 57.2393 +                      echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
 57.2394                        echo "esac"
 57.2395                      ) >/sbin/init.d/${name}
 57.2396                      chmod 755 /sbin/init.d/${name}
 57.2397 @@ -2251,6 +2760,9 @@
 57.2398                  fi
 57.2399                  ;;
 57.2400              HP-UX/* )
 57.2401 +                if [ -f /sbin/init.d/${name_old} ]; then
 57.2402 +                    rm -f /sbin/init.d/${name_old}
 57.2403 +                fi
 57.2404                  if [ ! -f /sbin/init.d/${name} ]; then
 57.2405                      #   install transfer script
 57.2406                      ( echo "#!/bin/sh"
 57.2407 @@ -2258,10 +2770,10 @@
 57.2408                        echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 57.2409                        echo "##"
 57.2410                        echo ""
 57.2411 -                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 57.2412 +                      echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
 57.2413                        echo "case \$1 in"
 57.2414 -                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
 57.2415 -                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
 57.2416 +                      echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
 57.2417 +                      echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
 57.2418                        echo "esac"
 57.2419                      ) >/sbin/init.d/${name}
 57.2420                      chmod 755 /sbin/init.d/${name}
 57.2421 @@ -2273,14 +2785,18 @@
 57.2422                  fi
 57.2423                  ;;
 57.2424              Darwin/* )
 57.2425 -                darwin_rc_dir="/System/Library/StartupItems/${name}"
 57.2426 +                if [ -d /Library/StartupItems/${name_old} ]; then
 57.2427 +                    rm -rf /Library/StartupItems/${name_old}
 57.2428 +                fi
 57.2429 +                darwin_rc_dir="/Library/StartupItems/${name}"
 57.2430                  if [ ! -d ${darwin_rc_dir} ]; then
 57.2431 -                    mkdir ${darwin_rc_dir}
 57.2432 +                    mkdir -p ${darwin_rc_dir}
 57.2433                  fi
 57.2434  
 57.2435                  #   make sure hierarchy is activated in /etc/hostconfig
 57.2436                  #   FIXME: cs: simple and bad code here without any detection of existing entries
 57.2437 -                echo "OPENPKG_${name}=-YES-" >>/etc/hostconfig
 57.2438 +                darwin_rc_var="`echo ${name} | sed -e 's;-;_;g' | tr '[a-z]' '[A-Z]'`"
 57.2439 +                echo "${darwin_rc_var}=-YES-" >>/etc/hostconfig
 57.2440  
 57.2441                  #   install transfer script
 57.2442                  if [ ! -f ${darwin_rc_dir}/${name} ]; then
 57.2443 @@ -2288,20 +2804,21 @@
 57.2444                      ( echo "#!/bin/sh"
 57.2445                        echo "##"
 57.2446                        echo "##  ${darwin_rc_dir}/${name}"
 57.2447 -                      echo "##      -- startup transfer script for OpenPKG ${prefix} hierarchy"
 57.2448 +                      echo "##  -- startup transfer script for OpenPKG ${prefix} hierarchy"
 57.2449                        echo "##"
 57.2450                        echo ""
 57.2451 -                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 57.2452 +                      echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
 57.2453                        echo ""
 57.2454                        echo ". /etc/rc.common"
 57.2455                        echo ""
 57.2456 -                      echo "if [ \"\${OPENPKG_${name}:=-NO-}\" = \"-YES-\" ]; then"
 57.2457 +                      echo "if [ \"\${${darwin_rc_var}:=-NO-}\" = \"-YES-\" ]; then"
 57.2458                        echo "    ConsoleMessage \"OpenPKG ${prefix} hierarchy\""
 57.2459 -                      echo "    ${prefix}/etc/rc all start"
 57.2460 +                      echo "    ${prefix}/bin/openpkg rc all start"
 57.2461                        echo "fi"
 57.2462                      ) >${darwin_rc_dir}/${name}
 57.2463                      chmod 755 ${darwin_rc_dir}/${name}
 57.2464                  fi
 57.2465 +
 57.2466                  #   install startup parameter list
 57.2467                  if [ ! -f ${darwin_rc_dir}/StartupParameters.plist ]; then
 57.2468                      rm -f ${darwin_rc_dir}/StartupParameters.plist >/dev/null 2>&1
 57.2469 @@ -2322,6 +2839,9 @@
 57.2470                  fi
 57.2471                  ;;
 57.2472              IRIX*/6.* )
 57.2473 +                if [ -f /etc/init.d/${name_old} ]; then
 57.2474 +                    rm -f /etc/init.d/${name_old}
 57.2475 +                fi
 57.2476                  if [ ! -f /etc/init.d/${name} ]; then
 57.2477                      #   install transfer script
 57.2478                      ( echo "#!/bin/sh"
 57.2479 @@ -2329,10 +2849,10 @@
 57.2480                        echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 57.2481                        echo "##"
 57.2482                        echo ""
 57.2483 -                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 57.2484 +                      echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
 57.2485                        echo "case \$1 in"
 57.2486 -                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
 57.2487 -                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
 57.2488 +                      echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
 57.2489 +                      echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
 57.2490                        echo "esac"
 57.2491                      ) >/etc/init.d/${name}
 57.2492                      chmod 755 /etc/init.d/${name}
 57.2493 @@ -2343,6 +2863,33 @@
 57.2494                      ) || exit $?
 57.2495                  fi
 57.2496                  ;;
 57.2497 +            CYGWIN*/* )
 57.2498 +                if [ -f /etc/rc.d/init.d/${name_old} ]; then
 57.2499 +                    rm -f /etc/rc.d/init.d/${name_old}
 57.2500 +                fi
 57.2501 +                if [ ! -f /etc/rc.d/init.d/${name} ]; then
 57.2502 +                    #   install transfer script
 57.2503 +                    ( echo "#!/bin/sh"
 57.2504 +                      echo "##"
 57.2505 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 57.2506 +                      echo "##"
 57.2507 +                      echo ""
 57.2508 +                      echo "test -f /etc/rc.d/init.d/functions && . /etc/rc.d/init.d/functions"
 57.2509 +                      echo "test -f /etc/sysconfig/network && . /etc/sysconfig/network"
 57.2510 +                      echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
 57.2511 +                      echo "case \$1 in"
 57.2512 +                      echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
 57.2513 +                      echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
 57.2514 +                      echo "esac"
 57.2515 +                    ) >/etc/rc.d/init.d/${name}
 57.2516 +                    chmod 755 /etc/rc.d/init.d/${name}
 57.2517 +                    #   create corresponding symbolic links
 57.2518 +                    ( cd /etc/rc.d
 57.2519 +                      ln -s ../init.d/${name} rc2.d/S90${name}
 57.2520 +                      ln -s ../init.d/${name} rc1.d/K10${name}
 57.2521 +                    ) || exit $?
 57.2522 +                fi
 57.2523 +                ;;
 57.2524          esac
 57.2525      fi
 57.2526  
 57.2527 @@ -2352,9 +2899,9 @@
 57.2528          echo "openpkg:WARNING: (would require root-privileges)" 1>&2
 57.2529      else
 57.2530          case "$plid" in
 57.2531 -            FreeBSD/* | Linux/* | Darwin/* )
 57.2532 +            FreeBSD/* | Linux/* )
 57.2533                  if [ -f /etc/slackware-version ]; then
 57.2534 -                    exists=`crontab -l | grep "$prefix/etc/rc"`
 57.2535 +                    exists=`crontab -l | egrep "($prefix/bin/openpkg|$prefix/etc/rc)"`
 57.2536                      if [ ".$exists" = . ]; then
 57.2537                          EDITOR=/tmp/vipw.$$
 57.2538                          VISUAL="$EDITOR"
 57.2539 @@ -2363,11 +2910,11 @@
 57.2540                          ( echo "#!/bin/sh"
 57.2541                            echo "(   echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
 57.2542                            echo "    echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
 57.2543 -                          echo "    echo \"0          0  1  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\""
 57.2544 -                          echo "    echo \"0          0  *  *  0  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\""
 57.2545 -                          echo "    echo \"0          0  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\""
 57.2546 -                          echo "    echo \"0          *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\""
 57.2547 -                          echo "    echo \"0,15,30,45 *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\""
 57.2548 +                          echo "    echo \"0          0  1  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron monthly\""
 57.2549 +                          echo "    echo \"0          0  *  *  0  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron weekly\""
 57.2550 +                          echo "    echo \"0          0  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron daily\""
 57.2551 +                          echo "    echo \"0          *  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron hourly\""
 57.2552 +                          echo "    echo \"0,15,30,45 *  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron quarterly\""
 57.2553                            echo "    echo \"# </OpenPKG>\""
 57.2554                            echo ") >>\$1"
 57.2555                          ) >$EDITOR
 57.2556 @@ -2376,22 +2923,22 @@
 57.2557                          rm -f $EDITOR
 57.2558                      fi
 57.2559                  else
 57.2560 -                    exists=`grep "$prefix/etc/rc" /etc/crontab`
 57.2561 +                    exists=`egrep "($prefix/bin/openpkg|$prefix/etc/rc)" /etc/crontab`
 57.2562                      if [ ".$exists" = . ]; then
 57.2563                          ( echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
 57.2564                            echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
 57.2565 -                          echo "0    0  1  *  *  root  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly"
 57.2566 -                          echo "0    0  *  *  0  root  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly"
 57.2567 -                          echo "0    0  *  *  *  root  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily"
 57.2568 -                          echo "0    *  *  *  *  root  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly"
 57.2569 -                          echo "*/15 *  *  *  *  root  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly"
 57.2570 +                          echo "0    0  1  *  *  root  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron monthly"
 57.2571 +                          echo "0    0  *  *  0  root  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron weekly"
 57.2572 +                          echo "0    0  *  *  *  root  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron daily"
 57.2573 +                          echo "0    *  *  *  *  root  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron hourly"
 57.2574 +                          echo "*/15 *  *  *  *  root  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron quarterly"
 57.2575                            echo "# </OpenPKG>"
 57.2576                          ) >>/etc/crontab
 57.2577                      fi
 57.2578                  fi
 57.2579                  ;;
 57.2580 -            SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* )
 57.2581 -                exists=`crontab -l | grep "$prefix/etc/rc"`
 57.2582 +            SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* | CYGWIN*/* | Darwin/* )
 57.2583 +                exists=`crontab -l | egrep "($prefix/bin/openpkg|$prefix/etc/rc)"`
 57.2584                  if [ ".$exists" = . ]; then
 57.2585                      EDITOR=/tmp/vipw.$$
 57.2586                      VISUAL="$EDITOR"
 57.2587 @@ -2400,11 +2947,11 @@
 57.2588                      ( echo "#!/bin/sh"
 57.2589                        echo "(   echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
 57.2590                        echo "    echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
 57.2591 -                      echo "    echo \"0          0  1  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\""
 57.2592 -                      echo "    echo \"0          0  *  *  0  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\""
 57.2593 -                      echo "    echo \"0          0  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\""
 57.2594 -                      echo "    echo \"0          *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\""
 57.2595 -                      echo "    echo \"0,15,30,45 *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\""
 57.2596 +                      echo "    echo \"0          0  1  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron monthly\""
 57.2597 +                      echo "    echo \"0          0  *  *  0  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron weekly\""
 57.2598 +                      echo "    echo \"0          0  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron daily\""
 57.2599 +                      echo "    echo \"0          *  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron hourly\""
 57.2600 +                      echo "    echo \"0,15,30,45 *  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron quarterly\""
 57.2601                        echo "    echo \"# </OpenPKG>\""
 57.2602                        echo ") >>\$1"
 57.2603                      ) >$EDITOR
 57.2604 @@ -2414,16 +2961,16 @@
 57.2605                  fi
 57.2606                  ;;
 57.2607              IRIX*/6.* )
 57.2608 -                exists=`crontab -l | grep "$prefix/etc/rc"`
 57.2609 +                exists=`crontab -l | egrep "($prefix/bin/openpkg|$prefix/etc/rc)"`
 57.2610                  if [ ".$exists" = . ]; then
 57.2611                      ( crontab -l
 57.2612                        echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
 57.2613                        echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
 57.2614 -                      echo "0          0  1  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly"
 57.2615 -                      echo "0          0  *  *  0  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly"
 57.2616 -                      echo "0          0  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily"
 57.2617 -                      echo "0          *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly"
 57.2618 -                      echo "0,15,30,45 *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly"
 57.2619 +                      echo "0          0  1  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron monthly"
 57.2620 +                      echo "0          0  *  *  0  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron weekly"
 57.2621 +                      echo "0          0  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron daily"
 57.2622 +                      echo "0          *  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron hourly"
 57.2623 +                      echo "0,15,30,45 *  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron quarterly"
 57.2624                        echo "# </OpenPKG>"
 57.2625                      ) | /usr/bin/crontab || exit $?
 57.2626                  fi
 57.2627 @@ -2435,18 +2982,18 @@
 57.2628      #   correctly upgrade the RPM database in the %post section (see below).
 57.2629      if [ -d ${prefix}/RPM/DB ]; then
 57.2630          if [ -x "${prefix}/bin/openpkg" -a -x "${prefix}/libexec/openpkg/rpm" ]; then
 57.2631 -            #   OpenPKG 2.0
 57.2632 +            #   OpenPKG >= 2.0
 57.2633              rpm="${prefix}/bin/openpkg rpm"
 57.2634          else
 57.2635              #   OpenPKG 1.x
 57.2636              rpm="${prefix}/bin/rpm"
 57.2637          fi
 57.2638          rm -f ${prefix}/RPM/DB/.version >/dev/null 2>&1 || true
 57.2639 -        $rpm --version |\
 57.2640 +        $rpm --version 2>/dev/null |\
 57.2641              sed -e 's;^;X;' \
 57.2642                  -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
 57.2643                  -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
 57.2644 -                -e 's;^X.*$;4.0;' \
 57.2645 +                -e 's;^X.*$;0.0;' \
 57.2646                  >${prefix}/RPM/DB/.version
 57.2647      fi
 57.2648  
 57.2649 @@ -2460,19 +3007,35 @@
 57.2650      #   update or initially create OpenPKG UUID configuration
 57.2651      %{l_prefix}/bin/openpkg uuid update >/dev/null 2>&1 || true
 57.2652  
 57.2653 +    #   when upgrading from RPM 4 to RPM 5 there will be no
 57.2654 +    #   initial license at all, so create one
 57.2655 +    if [ ! -f %{l_prefix}/etc/openpkg/license ]; then
 57.2656 +        echo "BOOT" >%{l_prefix}/etc/openpkg/license
 57.2657 +        ( chown %{l_musr}:%{l_mgrp} %{l_prefix}/etc/openpkg/license
 57.2658 +          chmod 644 %{l_prefix}/etc/openpkg/license
 57.2659 +        ) >/dev/null 2>&1 || true
 57.2660 +    fi
 57.2661 +
 57.2662 +    #   finally switch from a possibly active BOOT license to EVAL license
 57.2663 +    #   (notice: this is really the earliest time we can switch because the
 57.2664 +    #   previous command had to create the <prefix>/etc/openpkg/uuid first!)
 57.2665 +    if [ ".`cat %{l_prefix}/etc/openpkg/license`" = ".BOOT" ]; then
 57.2666 +        echo "EVAL" >%{l_prefix}/etc/openpkg/license
 57.2667 +    fi
 57.2668 +
 57.2669      #   determine new and old OpenPKG RPM version
 57.2670 -    V_rpm_new="%{V_rpm}"
 57.2671 +    V_rpm_new="%{V_rpm_major}.%{V_rpm_minor}"
 57.2672      if [ -f %{l_prefix}/RPM/DB/.version ]; then
 57.2673          V_rpm_old="`cat %{l_prefix}/RPM/DB/.version`"
 57.2674          rm -f %{l_prefix}/RPM/DB/.version >/dev/null 2>&1 || true
 57.2675      else
 57.2676 -        V_rpm_old="4.0"
 57.2677 +        V_rpm_old="0.0"
 57.2678      fi
 57.2679  
 57.2680      #   make sure all RPM database files are present and that their
 57.2681      #   attributes are correct, etc. This is not a database rebuild
 57.2682      #   operation, so this is fully harmless and can be done always.
 57.2683 -    %{l_prefix}/lib/openpkg/rpmdb --quiet --fixate
 57.2684 +    %{l_prefix}/lib/openpkg/rpmdb --quiet --fixate >/dev/null 2>&1 || true
 57.2685  
 57.2686      #   check RPM database for upgrade requirements
 57.2687      if [ ".$1" = .2 -a ".$V_rpm_old" != ".$V_rpm_new" ]; then
 57.2688 @@ -2481,14 +3044,13 @@
 57.2689          #   we are still running within the execution context of the
 57.2690          #   old RPM which in turn has the database locked) and instead
 57.2691          #   have to just drop a note to the administrator about database
 57.2692 -        #   upgrading. RPM 4.2 in general allows concurrent database
 57.2693 +        #   upgrading. RPM >= 4.2 in general allows concurrent database
 57.2694          #   access, but the whole stuff is too risky here, too.
 57.2695          ( echo "You are upgrading the OpenPKG bootstrap from a previous"
 57.2696            echo "RPM $V_rpm_old based version to this RPM $V_rpm_new based"
 57.2697 -          echo "version. The RPM database in %{l_prefix}/RPM/DB/ can still"
 57.2698 -          echo "be used, but it is strongly recommended to upgrade it as"
 57.2699 -          echo "soon as possible to the latest Berkeley-DB format files by"
 57.2700 -          echo "executing the command:"
 57.2701 +          echo "version. The RPM database in %{l_prefix}/RPM/DB/ can be"
 57.2702 +          echo "reused, but you first have to upgrade it as soon as"
 57.2703 +          echo "possible to the latest format files by executing:"
 57.2704            echo "    \$ %{l_prefix}/bin/openpkg rpm --db-rebuild"
 57.2705            echo "In case of problems with the RPM database you can always"
 57.2706            echo "execute the command:"
 57.2707 @@ -2552,6 +3114,22 @@
 57.2708              ;;
 57.2709      esac
 57.2710  
 57.2711 +    #   special support for fully unprivileged environments
 57.2712 +    #   where we cannot switch the user at all with su(1),
 57.2713 +    #   so we provide a dummy su(1) override command.
 57.2714 +    if [ ".%{l_unprivileged}" = ".yes" ]; then
 57.2715 +        ( echo "#!/bin/sh"
 57.2716 +          echo "while [ \$# -gt 0 ]; do"
 57.2717 +          echo "    case \"\$1\" in"
 57.2718 +          echo "        - | -* ) shift        ;;"
 57.2719 +          echo "        *      ) shift; break ;;"
 57.2720 +          echo "    esac"
 57.2721 +          echo "done"
 57.2722 +          echo "exec /bin/sh \${1+\"\$@\"}"
 57.2723 +        ) >%{l_prefix}/lib/openpkg/override/su
 57.2724 +        chmod 775 %{l_prefix}/lib/openpkg/override/su
 57.2725 +    fi
 57.2726 +
 57.2727      #   FIXME: hack to workaround problems in environments with too few
 57.2728      #   development tools. ATTENTION: see one paragraph above.
 57.2729      if [ ! -d %{l_prefix}/lib/openpkg/fallback ]; then
 57.2730 @@ -2559,21 +3137,47 @@
 57.2731      fi
 57.2732      chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
 57.2733  
 57.2734 -    #   check for "openpkg" executable from the OpenPKG Community series
 57.2735 -    #   print license if not OSS, otherwise register with openpkg.org
 57.2736 -    community_version=`%{l_prefix}/bin/openpkg --license 2>/dev/null | \
 57.2737 -        sed -e 'q' | egrep '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-C'`
 57.2738 -    if [ ".$community_version" = . ]; then
 57.2739 -        ( echo ""
 57.2740 -          echo "NOTICE: This OpenPKG bootstrap package is based on an \"openpkg\""
 57.2741 -          echo "executable which is covered by the following terms of use:"
 57.2742 -          echo "______________________________________________________________________________"
 57.2743 -          echo ""
 57.2744 -          %{l_prefix}/bin/openpkg --license | sed -e '1d'
 57.2745 -        ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t notice
 57.2746 -    else
 57.2747 -        %{l_prefix}/bin/openpkg register </dev/null >/dev/null 2>&1 || true
 57.2748 -    fi
 57.2749 +    #   cruel platform hack
 57.2750 +    case "`cat %{l_prefix}/etc/openpkg/platform`" in
 57.2751 +        *-*-cygwin* )
 57.2752 +            #   Cygwin under Windows Vista dislikes executables with
 57.2753 +            #   "patch" in the same and would require a "*.manifest"
 57.2754 +            #   file applied with the "mt.exe" from the "Windows
 57.2755 +            #   Software Development Kit (SDK)" in order to escape from
 57.2756 +            #   UAC. An easy alternative is to just rename the file to a
 57.2757 +            #   different name.
 57.2758 +            cp  %{l_prefix}/lib/openpkg/patch \
 57.2759 +                %{l_prefix}/lib/openpkg/pitch
 57.2760 +            %{l_prefix}/lib/openpkg/shtool subst \
 57.2761 +                -e 's;openpkg/patch;openpkg/pitch;g' \
 57.2762 +                %{l_prefix}/etc/openpkg/rpmmacros
 57.2763 +            ;;
 57.2764 +    esac
 57.2765 +
 57.2766 +    #   print license
 57.2767 +    ( echo ""
 57.2768 +      echo "NOTICE: Proprietary components of the OpenPKG Framework are covered"
 57.2769 +      echo "by the following terms and conditions and require a valid run-time"
 57.2770 +      echo "license, issued by the OpenPKG GmbH. An initial license, which allows"
 57.2771 +      echo "30 days of free use for evaluation purposes, is already pre-installed."
 57.2772 +      echo "Please go to http://openpkg.com/go/framework-license to obtain"
 57.2773 +      echo "your permanent license."
 57.2774 +      echo ""
 57.2775 +      %{l_prefix}/bin/openpkg --license
 57.2776 +      echo "______________________________________________________________________________"
 57.2777 +      echo ""
 57.2778 +      echo "NOTICE: Open Source components of the OpenPKG Framework are covered"
 57.2779 +      echo "by various standard Open Source distribution licenses, including"
 57.2780 +      echo "the MIT, BSD, LGPL, GPL, Public-Domain and Artistic licenses."
 57.2781 +      echo "They all allow you the use of those components free of charge."
 57.2782 +      echo "See http://www.opensource.org/licenses for more details."
 57.2783 +      echo ""
 57.2784 +    ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t notice
 57.2785 +
 57.2786 +    #   register package with central OpenPKG registry
 57.2787 +    ( nohup %{l_prefix}/bin/openpkg register \
 57.2788 +      </dev/null >/dev/null 2>&1 &
 57.2789 +    ) </dev/null >/dev/null 2>&1 || true
 57.2790  
 57.2791  %preun
 57.2792      [ ".$1" != .0 ] && exit 0
 57.2793 @@ -2592,6 +3196,7 @@
 57.2794      rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true
 57.2795      rm -rf %{l_prefix}/RPM/SRC/* %{l_prefix}/RPM/SRC/.[a-z]* >/dev/null 2>&1 || true
 57.2796      rm -rf %{l_prefix}/RPM/PKG/* %{l_prefix}/RPM/PKG/.[a-z]* >/dev/null 2>&1 || true
 57.2797 +    rm -rf %{l_prefix}/RPM/TR/*  %{l_prefix}/RPM/TR/.[a-z]*  >/dev/null 2>&1 || true
 57.2798      rm -rf %{l_prefix}/RPM/DB/*  %{l_prefix}/RPM/DB/.[a-z]*  >/dev/null 2>&1 || true
 57.2799  
 57.2800      #   The following code usually would be done in a %postun section.
 57.2801 @@ -2668,7 +3273,8 @@
 57.2802                   grep "^$usr:" /etc/passwd; \
 57.2803                   ypmatch "$usr" passwd; \
 57.2804                   nismatch "$usr" passwd; \
 57.2805 -                 nidump passwd . | grep "^$usr:") 2>/dev/null | \
 57.2806 +                 nidump passwd . | grep "^$usr:"; \
 57.2807 +                 dscl . -read "/users/$usr" | grep RecordName) 2>/dev/null | \
 57.2808                   sed -e 'q'`
 57.2809          if [ ".$exists" != . ]; then
 57.2810              if [ ".$cusr" != ".root" ]; then
 57.2811 @@ -2709,6 +3315,9 @@
 57.2812                          grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
 57.2813                          rm -f /etc/passwd.bak >/dev/null 2>&1
 57.2814                          ;;
 57.2815 +                    Darwin/10.[1-9]* | Darwin/1[1-9].* )
 57.2816 +                        dscl . -delete "/users/${usr}"
 57.2817 +                        ;;
 57.2818                      Darwin/* )
 57.2819                          niutil -destroy . "/users/${usr}"
 57.2820                          ;;
 57.2821 @@ -2720,6 +3329,11 @@
 57.2822                          fi
 57.2823                          rm -f /etc/passwd.bak >/dev/null 2>&1
 57.2824                          ;;
 57.2825 +                    CYGWIN*/* )
 57.2826 +                        cp /etc/passwd /etc/passwd.bak && \
 57.2827 +                        grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
 57.2828 +                        rm -f /etc/passwd.bak >/dev/null 2>&1
 57.2829 +                        ;;
 57.2830                  esac
 57.2831              fi
 57.2832          fi
 57.2833 @@ -2729,7 +3343,8 @@
 57.2834                  grep "^$grp:" /etc/group; \
 57.2835                  ypmatch "$grp" group; \
 57.2836                  nismatch "$grp" group; \
 57.2837 -                nidump group . | grep "^$grp:") 2>/dev/null | \
 57.2838 +                nidump group . | grep "^$grp:"; \
 57.2839 +                dscl . -read "/groups/$grp" | grep RecordName) 2>/dev/null | \
 57.2840                  sed -e 'q'`
 57.2841          if [ ".$exists" != . ]; then
 57.2842              if [ ".$cusr" != ".root" ]; then
 57.2843 @@ -2740,6 +3355,9 @@
 57.2844                  echo "openpkg:WARNING: (would remove system standard group)" 1>&2
 57.2845              else
 57.2846                  case "$plid" in
 57.2847 +                    Darwin/10.[1-9]* | Darwin/1[1-9].* )
 57.2848 +                        dscl . -delete "/groups/${grp}"
 57.2849 +                        ;;
 57.2850                      Darwin/* )
 57.2851                          niutil -destroy . "/groups/${grp}"
 57.2852                          ;;
 57.2853 @@ -2771,30 +3389,34 @@
 57.2854      else
 57.2855          case "$plid" in
 57.2856              FreeBSD/* )
 57.2857 -                rm -f /etc/rc.d/openpkg-${name} >/dev/null 2>&1
 57.2858 +                rm -f /etc/rc.d/${name} >/dev/null 2>&1
 57.2859                  ;;
 57.2860              NetBSD/* )
 57.2861                  rm -f /etc/rc.d/${name} >/dev/null 2>&1
 57.2862                  ;;
 57.2863              Linux/* )
 57.2864                  if [ -f /etc/gentoo-release ]; then
 57.2865 -                    /sbin/rc-update del openpkg-${name} >/dev/null 2>&1
 57.2866 -                    rm -f /etc/init.d/openpkg-${name}   >/dev/null 2>&1
 57.2867 +                    /sbin/rc-update del ${name} >/dev/null 2>&1
 57.2868 +                    rm -f /etc/init.d/${name}   >/dev/null 2>&1
 57.2869 +                elif [ -f /etc/redhat-release ]; then
 57.2870 +                    /sbin/chkconfig ${name} off    >/dev/null 2>&1
 57.2871 +                    /sbin/chkconfig --del ${name}  >/dev/null 2>&1
 57.2872 +                    rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
 57.2873                  else
 57.2874                      #   sroot: script root directory
 57.2875                      #   lroot: link   root directory
 57.2876                      if [ -f /etc/debian_version ]; then
 57.2877                          sroot=/etc/init.d
 57.2878 -                        lroot=/etc/rc%d.d
 57.2879 -                    elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
 57.2880 +                        lroot=/etc/rc%%d.d
 57.2881 +                    elif [ -f /etc/mandrake-release ]; then
 57.2882                          sroot=/etc/rc.d/init.d
 57.2883 -                        lroot=/etc/rc.d/rc%d.d
 57.2884 +                        lroot=/etc/rc.d/rc%%d.d
 57.2885                      elif [ -f /etc/SuSE-release ]; then
 57.2886                          sroot=/etc/init.d
 57.2887 -                        lroot=/etc/init.d/rc%d.d
 57.2888 +                        lroot=/etc/init.d/rc%%d.d
 57.2889                      elif [ -f /etc/slackware-version ]; then
 57.2890                          sroot=/etc/rc.d
 57.2891 -                        lroot=/etc/rc.d/rc%d.d
 57.2892 +                        lroot=/etc/rc.d/rc%%d.d
 57.2893                          name="rc.${name}"
 57.2894                      else
 57.2895                          echo "WARNING: you are not running one of the supported standard" 1>&2
 57.2896 @@ -2810,7 +3432,7 @@
 57.2897                          done
 57.2898                          for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
 57.2899                              if [ -d $lr ]; then
 57.2900 -                                lroot="`echo $lr | sed -e 's;2;%d;'`"
 57.2901 +                                lroot="`echo $lr | sed -e 's;2;%%d;'`"
 57.2902                                  break
 57.2903                              fi
 57.2904                          done
 57.2905 @@ -2821,14 +3443,14 @@
 57.2906                      fi
 57.2907                      rm -f ${sroot}/${name} >/dev/null 2>&1
 57.2908                      for i in 2 3 4 5; do
 57.2909 -                        rm -f `echo $lroot | sed -e "s;%d;$i;"`/S99${name} >/dev/null 2>&1
 57.2910 +                        rm -f `echo $lroot | sed -e "s;%%d;$i;"`/S99${name} >/dev/null 2>&1
 57.2911                      done
 57.2912                      for i in 0 1 6; do
 57.2913 -                        rm -f `echo $lroot | sed -e "s;%d;$i;"`/K00${name} >/dev/null 2>&1
 57.2914 +                        rm -f `echo $lroot | sed -e "s;%%d;$i;"`/K00${name} >/dev/null 2>&1
 57.2915                      done
 57.2916                      if [ -f /etc/slackware-version ]; then
 57.2917                          for i in 0 1 2 3 4 5 6; do
 57.2918 -                            l=`echo $lroot | sed -e "s;%d;$i;"`
 57.2919 +                            l=`echo $lroot | sed -e "s;%%d;$i;"`
 57.2920                              if [ -d $l ]; then
 57.2921                                  rmdir $l >/dev/null 2>&1 || true
 57.2922                              fi
 57.2923 @@ -2836,12 +3458,6 @@
 57.2924                      fi
 57.2925                  fi
 57.2926                  ;;
 57.2927 -            SunOS/5.1* )
 57.2928 -                /usr/sbin/svcadm disable "svc:/openpkg/${name}:default"; sleep 2
 57.2929 -                /usr/sbin/svccfg delete -f "svc:/openpkg/${name}:default" >/dev/null 2>&1 || true
 57.2930 -                rm -f /var/svc/manifest/openpkg/${name}.xml >/dev/null 2>&1
 57.2931 -                rmdir /var/svc/manifest/openpkg >/dev/null 2>&1 || true
 57.2932 -                ;;
 57.2933              SunOS/5.* )
 57.2934                  rm -f /etc/init.d/${name} >/dev/null 2>&1
 57.2935                  rm -f /etc/rc3.d/S99${name} >/dev/null 2>&1
 57.2936 @@ -2869,16 +3485,22 @@
 57.2937                  rm -f /etc/rc1.d/K100${name} >/dev/null 2>&1
 57.2938                  ;;
 57.2939              Darwin/* )
 57.2940 +                darwin_rc_var="`echo ${name} | sed -e 's;-;_;g' | tr '[a-z]' '[A-Z]'`"
 57.2941                  cp /etc/hostconfig /etc/hostconfig.bak && \
 57.2942 -                grep -v "^OPENPKG_${name}=" /etc/hostconfig.bak >/etc/hostconfig
 57.2943 +                grep -v "^${darwin_rc_var}=" /etc/hostconfig.bak >/etc/hostconfig
 57.2944                  rm -f /etc/hostconfig.bak >/dev/null 2>&1
 57.2945 -                rm -rf /System/Library/StartupItems/${name} >/dev/null 2>&1
 57.2946 +                rm -rf /Library/StartupItems/${name} >/dev/null 2>&1
 57.2947                  ;;
 57.2948              IRIX*/6.* )
 57.2949                  rm -f /etc/init.d/${name} >/dev/null 2>&1
 57.2950                  rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
 57.2951                  rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
 57.2952                  ;;
 57.2953 +            CYGWIN*/* )
 57.2954 +                rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
 57.2955 +                rm -f /etc/rc.d/rc2.d/S90${name} >/dev/null 2>&1
 57.2956 +                rm -f /etc/rc.d/rc1.d/K10${name} >/dev/null 2>&1
 57.2957 +                ;;
 57.2958          esac
 57.2959      fi
 57.2960  
 57.2961 @@ -2888,7 +3510,7 @@
 57.2962          echo "openpkg:WARNING: (would require root-privileges)" 1>&2
 57.2963      else
 57.2964          case "$plid" in
 57.2965 -            FreeBSD/* | Linux/* | Darwin/* )
 57.2966 +            FreeBSD/* | Linux/* )
 57.2967                  if [ -f /etc/slackware-version ]; then
 57.2968                      EDITOR=/tmp/vipw.$$
 57.2969                      VISUAL="$EDITOR"
 57.2970 @@ -2914,7 +3536,7 @@
 57.2971                      fi
 57.2972                  fi
 57.2973                  ;;
 57.2974 -            SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* )
 57.2975 +            SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* | CYGWIN*/* | Darwin/* )
 57.2976                  EDITOR=/tmp/vipw.$$
 57.2977                  VISUAL="$EDITOR"
 57.2978                  export EDITOR
 57.2979 @@ -2939,6 +3561,10 @@
 57.2980  
 57.2981      #   delayed removal of top-level directory.
 57.2982      ( sleep 2
 57.2983 +      rm -rf %{l_prefix}/RPM/PKG/* >/dev/null 2>&1 || true
 57.2984 +      rm -rf %{l_prefix}/RPM/SRC/* >/dev/null 2>&1 || true
 57.2985 +      rm -rf %{l_prefix}/RPM/CACHE/* >/dev/null 2>&1 || true
 57.2986 +      rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true
 57.2987        rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
 57.2988        rmdir %{l_prefix}/RPM/DB >/dev/null 2>&1 || true
 57.2989        rmdir %{l_prefix}/RPM >/dev/null 2>&1 || true
    58.1 --- a/openpkg/openssl.patch	Tue Jul 31 12:12:54 2012 +0200
    58.2 +++ b/openpkg/openssl.patch	Tue Jul 31 12:23:42 2012 +0200
    58.3 @@ -1,6 +1,6 @@
    58.4  Index: Configure
    58.5 ---- Configure.orig	2007-09-16 14:24:17 +0200
    58.6 -+++ Configure	2007-10-17 12:14:14 +0200
    58.7 +--- Configure.orig	2012-03-14 23:20:40.000000000 +0100
    58.8 ++++ Configure	2012-06-27 10:10:05.000000000 +0200
    58.9  @@ -6,7 +6,6 @@
   58.10   ##
   58.11   
   58.12 @@ -17,28 +17,34 @@
   58.13   #
   58.14   # --test-sanity Make a number of sanity checks on the data in this file.
   58.15   #               This is a debugging tool for OpenSSL developers.
   58.16 -@@ -113,6 +113,7 @@
   58.17 +@@ -123,6 +123,7 @@
   58.18   #$bits2="THIRTY_TWO_BIT ";
   58.19   my $bits1="THIRTY_TWO_BIT ";
   58.20   my $bits2="SIXTY_FOUR_BIT ";
   58.21  +my $ccarg;
   58.22   
   58.23 - my $x86_elf_asm="x86cpuid-elf.o:bn86-elf.o co86-elf.o:dx86-elf.o yx86-elf.o:ax86-elf.o:bx86-elf.o:mx86-elf.o:sx86-elf.o s512sse2-elf.o:cx86-elf.o:rx86-elf.o:rm86-elf.o:r586-elf.o";
   58.24 - my $x86_coff_asm="x86cpuid-cof.o:bn86-cof.o co86-cof.o:dx86-cof.o yx86-cof.o:ax86-cof.o:bx86-cof.o:mx86-cof.o:sx86-cof.o s512sse2-cof.o:cx86-cof.o:rx86-cof.o:rm86-cof.o:r586-cof.o";
   58.25 -@@ -402,8 +403,8 @@
   58.26 + my $x86_asm="x86cpuid.o:bn-586.o co-586.o x86-mont.o x86-gf2m.o:des-586.o crypt586.o:aes-586.o vpaes-x86.o aesni-x86.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o:cmll-x86.o:ghash-x86.o:";
   58.27 + 
   58.28 +@@ -460,12 +461,12 @@
   58.29   
   58.30   #### IBM's AIX.
   58.31   "aix3-cc",  "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
   58.32 --"aix-gcc",  "gcc:-O -DB_ENDIAN::-D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
   58.33 --"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-maix64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64",
   58.34 -+"aix-gcc",  "gcc:-O -DB_ENDIAN::-D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::",
   58.35 -+"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-maix64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::",
   58.36 +-"aix-gcc",  "gcc:-O -DB_ENDIAN::-pthread:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X32",
   58.37 +-"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64",
   58.38 ++"aix-gcc",  "gcc:-O -DB_ENDIAN::-pthread:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::",
   58.39 ++"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::",
   58.40   # Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
   58.41   # at build time. $OBJECT_MODE is respected at ./config stage!
   58.42 - "aix-cc",   "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-q32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
   58.43 -@@ -697,6 +698,10 @@
   58.44 +-"aix-cc",   "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
   58.45 +-"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
   58.46 ++"aix-cc",   "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::",
   58.47 ++"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::",
   58.48 + 
   58.49 + #
   58.50 + # Cray T90 and similar (SDSC)
   58.51 +@@ -828,6 +829,10 @@
   58.52   			{
   58.53 - 			exit(&test_sanity());
   58.54 + 			$strict_warnings = 1;
   58.55   			}
   58.56  +		elsif (/^--with-cc=(.*)$/)
   58.57  +			{
   58.58 @@ -47,42 +53,53 @@
   58.59   		elsif (/^reconfigure/ || /^reconf/)
   58.60   			{
   58.61   			if (open(IN,"<$Makefile"))
   58.62 -@@ -949,7 +954,7 @@
   58.63 +@@ -1143,7 +1148,7 @@
   58.64   print "IsMK1MF=$IsMK1MF\n";
   58.65   
   58.66   my @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
   58.67  -my $cc = $fields[$idx_cc];
   58.68  +my $cc = $ccarg ? $ccarg : $fields[$idx_cc];
   58.69 - my $cflags = $fields[$idx_cflags];
   58.70 - my $unistd = $fields[$idx_unistd];
   58.71 - my $thread_cflag = $fields[$idx_thread_cflag];
   58.72 + # Allow environment CC to override compiler...
   58.73 + if($ENV{CC}) {
   58.74 +     $cc = $ENV{CC};
   58.75  Index: config
   58.76 ---- config.orig	2007-08-01 13:21:35 +0200
   58.77 -+++ config	2007-10-17 12:13:48 +0200
   58.78 -@@ -401,9 +401,9 @@
   58.79 +--- config.orig	2011-11-14 22:12:53.000000000 +0100
   58.80 ++++ config	2012-06-27 10:10:05.000000000 +0200
   58.81 +@@ -277,6 +277,9 @@
   58.82 + 	    Power*)
   58.83 + 		echo "ppc-apple-darwin${VERSION}"
   58.84 + 		;;
   58.85 ++	    x86_64 )
   58.86 ++		echo "x86_64-apple-darwin${VERSION}"
   58.87 ++		;;
   58.88 + 	    *)
   58.89 + 		echo "i686-apple-darwin${VERSION}"
   58.90 + 		;;
   58.91 +@@ -413,7 +416,7 @@
   58.92   
   58.93 - # figure out if gcc is available and if so we use it otherwise
   58.94 - # we fallback to whatever cc does on the system
   58.95 --GCCVER=`(gcc -dumpversion) 2>/dev/null`
   58.96 -+GCCVER=`(gcc -dumpversion 2>/dev/null && exit; cc --version 2>/dev/null | grep GCC >/dev/null && cc -dumpversion )`
   58.97 - if [ "$GCCVER" != "" ]; then
   58.98 --  CC=gcc
   58.99 -+  CC=cc; gcc -dumpversion >/dev/null 2>&1 && CC=gcc
  58.100 -   # then strip off whatever prefix egcs prepends the number with...
  58.101 -   # Hopefully, this will work for any future prefixes as well.
  58.102 -   GCCVER=`echo $GCCVER | LC_ALL=C sed 's/^[a-zA-Z]*\-//'`
  58.103 -@@ -412,8 +412,10 @@
  58.104 -   # major and minor version numbers.
  58.105 -   # peak single digit before and after first dot, e.g. 2.95.1 gives 29
  58.106 -   GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
  58.107 -+  SUFFIX=gcc
  58.108 - else
  58.109 -   CC=cc
  58.110 -+  SUFFIX=cc
  58.111 + # Only set CC if not supplied already
  58.112 + if [ -z "$CROSS_COMPILE$CC" ]; then
  58.113 +-  GCCVER=`sh -c "gcc -dumpversion" 2>/dev/null`
  58.114 ++  GCCVER=`sh -c "${CC-gcc} -dumpversion" 2>/dev/null`
  58.115 +   if [ "$GCCVER" != "" ]; then
  58.116 +     # then strip off whatever prefix egcs prepends the number with...
  58.117 +     # Hopefully, this will work for any future prefixes as well.
  58.118 +@@ -424,8 +427,14 @@
  58.119 +     # peak single digit before and after first dot, e.g. 2.95.1 gives 29
  58.120 +     GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
  58.121 +     CC=gcc
  58.122 ++    SUFFIX=gcc
  58.123 +   else
  58.124 +     CC=cc
  58.125 ++    SUFFIX=cc
  58.126 ++  fi
  58.127 ++else
  58.128 ++  if [ "$GCCVER" != "" ]; then
  58.129 ++    SUFFIX=gcc
  58.130 +   fi
  58.131   fi
  58.132   GCCVER=${GCCVER:-0}
  58.133 - if [ "$SYSTEM" = "HP-UX" ];then
  58.134 -@@ -422,7 +424,7 @@
  58.135 +@@ -435,7 +444,7 @@
  58.136     if [ $GCCVER -ge 30 ]; then
  58.137       # PA64 support only came in with gcc 3.0.x.
  58.138       # We check if the preprocessor symbol __LP64__ is defined...
  58.139 @@ -91,7 +108,7 @@
  58.140         : # __LP64__ has slipped through, it therefore is not defined
  58.141       else
  58.142         GCC_BITS="64"
  58.143 -@@ -433,13 +435,14 @@
  58.144 +@@ -446,13 +455,14 @@
  58.145     if [ $GCCVER -ge 30 ]; then
  58.146       # 64-bit ABI isn't officially supported in gcc 3.0, but it appears
  58.147       # to be working, at the very least 'make test' passes...
  58.148 @@ -107,7 +124,7 @@
  58.149     CCVER=`(cc -V 2>&1) 2>/dev/null | \
  58.150     	egrep -e '^cc: .* C [0-9]\.[0-9]' | \
  58.151   	sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'`
  58.152 -@@ -452,6 +455,7 @@
  58.153 +@@ -465,6 +475,7 @@
  58.154         sleep 5
  58.155       fi
  58.156     fi
  58.157 @@ -115,7 +132,7 @@
  58.158   fi
  58.159   
  58.160   if [ "${SYSTEM}-${MACHINE}" = "Linux-alpha" ]; then
  58.161 -@@ -469,6 +473,7 @@
  58.162 +@@ -482,6 +493,7 @@
  58.163   
  58.164   if [ "${SYSTEM}" = "AIX" ]; then	# favor vendor cc over gcc
  58.165       (cc) 2>&1 | grep -iv "not found" > /dev/null && CC=cc
  58.166 @@ -123,7 +140,7 @@
  58.167   fi
  58.168   
  58.169   CCVER=${CCVER:-0}
  58.170 -@@ -488,7 +493,7 @@
  58.171 +@@ -507,7 +519,7 @@
  58.172   	if [ $CPU -ge 4000 ]; then
  58.173   		options="$options -mips2"
  58.174   	fi
  58.175 @@ -132,7 +149,7 @@
  58.176   	;;
  58.177     mips3-sgi-irix)
  58.178   	#CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
  58.179 -@@ -498,11 +503,11 @@
  58.180 +@@ -517,11 +529,11 @@
  58.181   	#else
  58.182   	#	options="$options -mips3"
  58.183   	#fi
  58.184 @@ -146,7 +163,7 @@
  58.185   	if [ "$TEST" = "false" -a -t 1 ]; then
  58.186   	  echo "         You have about 5 seconds to press Ctrl-C to abort."
  58.187   	  (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
  58.188 -@@ -514,7 +519,7 @@
  58.189 +@@ -533,7 +545,7 @@
  58.190           #else
  58.191           #        options="$options -mips3"
  58.192           #fi
  58.193 @@ -154,8 +171,18 @@
  58.194  +	OUT="irix-mips3-$SUFFIX"
  58.195   	;;
  58.196     ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;;
  58.197 -   ppc-apple-darwin*) OUT="darwin-ppc-cc" ;;
  58.198 -@@ -522,10 +527,10 @@
  58.199 +   ppc-apple-darwin*)
  58.200 +@@ -566,6 +578,9 @@
  58.201 + 	else
  58.202 + 	    OUT="darwin-i386-cc"
  58.203 + 	fi ;;
  58.204 ++  x86_64-apple-darwin*)
  58.205 ++    OUT="darwin64-x86_64-cc"
  58.206 ++    ;;
  58.207 +   armv6+7-*-iphoneos)
  58.208 + 	options="$options -arch%20armv6 -arch%20armv7"
  58.209 + 	OUT="iphoneos-cross" ;;
  58.210 +@@ -575,10 +590,10 @@
  58.211     alpha-*-linux2)
  58.212           ISA=`awk '/cpu model/{print$4;exit(0);}' /proc/cpuinfo`
  58.213   	case ${ISA:-generic} in
  58.214 @@ -169,8 +196,8 @@
  58.215   	    case ${ISA:-generic} in
  58.216   	    EV5|EV45)		options="$options -mcpu=ev5";;
  58.217   	    EV56|PCA56)		options="$options -mcpu=ev56";;
  58.218 -@@ -592,7 +597,7 @@
  58.219 -   s390x-*-linux2) OUT="linux-generic64"; options="$options -DB_ENDIAN" ;;
  58.220 +@@ -662,7 +677,7 @@
  58.221 + 	;;
  58.222     x86_64-*-linux?) OUT="linux-x86_64" ;;
  58.223     *86-*-linux2) OUT="linux-elf"
  58.224  -	if [ "$GCCVER" -gt 28 ]; then
  58.225 @@ -178,14 +205,14 @@
  58.226             if grep '^model.*Pentium' /proc/cpuinfo >/dev/null ; then
  58.227   	    options="$options -march=pentium"
  58.228             fi
  58.229 -@@ -606,17 +611,17 @@
  58.230 +@@ -676,17 +691,17 @@
  58.231     *-*-linux1) OUT="linux-aout" ;;
  58.232     *-*-linux2) OUT="linux-generic32" ;;
  58.233     sun4[uv]*-*-solaris2)
  58.234  -	OUT="solaris-sparcv9-$CC"
  58.235  +	OUT="solaris-sparcv9-$SUFFIX"
  58.236   	ISA64=`(isalist) 2>/dev/null | grep sparcv9`
  58.237 - 	if [ "$ISA64" != "" ]; then
  58.238 + 	if [ "$ISA64" != "" -a "$KERNEL_BITS" = "" ]; then
  58.239  -	    if [ "$CC" = "cc" -a $CCVER -ge 50 ]; then
  58.240  +	    if [ $GCCVER -eq 0 -a $CCVER -ge 50 ]; then
  58.241   		echo "WARNING! If you wish to build 64-bit library, then you have to"
  58.242 @@ -199,8 +226,8 @@
  58.243   		# $GCC_ARCH denotes default ABI chosen by compiler driver
  58.244   		# (first one found on the $PATH). I assume that user
  58.245   		# expects certain consistency with the rest of his builds
  58.246 -@@ -639,21 +644,21 @@
  58.247 - 	    fi
  58.248 +@@ -712,21 +727,21 @@
  58.249 + 	    OUT="solaris64-sparcv9-$CC"
  58.250   	fi
  58.251   	;;
  58.252  -  sun4m-*-solaris2)	OUT="solaris-sparcv8-$CC" ;;
  58.253 @@ -211,9 +238,9 @@
  58.254  +  sun4*-*-solaris2)	OUT="solaris-sparcv7-$SUFFIX" ;;
  58.255     *86*-*-solaris2)
  58.256   	ISA64=`(isalist) 2>/dev/null | grep amd64`
  58.257 --	if [ "$ISA64" != "" ]; then
  58.258 +-	if [ "$ISA64" != "" -a ${KERNEL_BITS:-64} -eq 64 ]; then
  58.259  -	    OUT="solaris64-x86_64-$CC"
  58.260 -+	if [ "$ISA64" != "" -a $GCCVER -gt 0 -a "$GCC_ARCH" = "-m64" ]; then
  58.261 ++	if [ "$ISA64" != "" -a ${KERNEL_BITS:-64} -eq 64 -a $GCCVER -gt 0 -a "$GCC_ARCH" = "-m64" ]; then
  58.262  +	    OUT="solaris64-x86_64-$SUFFIX"
  58.263   	else
  58.264  -	    OUT="solaris-x86-$CC"
  58.265 @@ -228,7 +255,7 @@
  58.266   
  58.267     *86*-*-bsdi4)		OUT="BSD-x86-elf"; options="$options no-sse2 -ldl" ;;
  58.268     alpha*-*-*bsd*)	OUT="BSD-generic64"; options="$options -DL_ENDIAN" ;;
  58.269 -@@ -677,7 +682,7 @@
  58.270 +@@ -750,7 +765,7 @@
  58.271     *-*-osf)		OUT="osf1-alpha-cc" ;;
  58.272     *-*-tru64)		OUT="tru64-alpha-cc" ;;
  58.273     *-*-[Uu]nix[Ww]are7)
  58.274 @@ -237,7 +264,7 @@
  58.275   	  OUT="unixware-7-gcc" ; options="$options no-sse2"
  58.276   	else    
  58.277   	  OUT="unixware-7" ; options="$options no-sse2 -D__i386__"
  58.278 -@@ -688,12 +693,12 @@
  58.279 +@@ -761,12 +776,12 @@
  58.280     *-*-vos)
  58.281   	options="$options no-threads no-shared no-asm no-dso"
  58.282   	EXE=".pm"
  58.283 @@ -251,10 +278,10 @@
  58.284  +	if [ $GCCVER -gt 0 -a $GCC_BITS = "64" ]; then
  58.285   	    OUT="hpux64-parisc2-gcc"
  58.286   	fi
  58.287 - 	KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null`
  58.288 -@@ -711,8 +716,8 @@
  58.289 - 	     fi
  58.290 - 	     OUT="hpux64-ia64-cc"
  58.291 + 	[ "$KERNEL_BITS" ] || KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null`
  58.292 +@@ -781,8 +796,8 @@
  58.293 + 	        OUT="hpux-ia64-cc"
  58.294 +              fi
  58.295   	elif [ $CPU_VERSION -ge 532 ]; then	# PA-RISC 2.x CPU
  58.296  -	     OUT=${OUT:-"hpux-parisc2-${CC}"}
  58.297  -	     if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
  58.298 @@ -263,7 +290,7 @@
  58.299   		echo "WARNING! If you wish to build 64-bit library then you have to"
  58.300   		echo "         invoke './Configure hpux64-parisc2-cc' *manually*."
  58.301   		if [ "$TEST" = "false" -a -t 1 ]; then
  58.302 -@@ -721,19 +726,19 @@
  58.303 +@@ -791,9 +806,9 @@
  58.304   		fi
  58.305   	     fi
  58.306   	elif [ $CPU_VERSION -ge 528 ]; then	# PA-RISC 1.1+ CPU
  58.307 @@ -273,22 +300,18 @@
  58.308  -	     OUT="hpux-parisc-${CC}"
  58.309  +	     OUT="hpux-parisc-${SUFFIX}"
  58.310   	else					# Motorola(?) CPU
  58.311 --	     OUT="hpux-$CC"
  58.312 -+	     OUT="hpux-$SUFFIX"
  58.313 + 	     OUT="hpux-$CC"
  58.314   	fi
  58.315 - 	options="$options -D_REENTRANT" ;;
  58.316 --  *-hpux)	OUT="hpux-parisc-$CC" ;;
  58.317 -+  *-hpux)	OUT="hpux-parisc-$SUFFIX" ;;
  58.318 -   *-aix)
  58.319 - 	KERNEL_BITS=`(getconf KERNEL_BITMODE) 2>/dev/null`
  58.320 +@@ -803,7 +818,7 @@
  58.321 + 	[ "$KERNEL_BITS" ] || KERNEL_BITS=`(getconf KERNEL_BITMODE) 2>/dev/null`
  58.322   	KERNEL_BITS=${KERNEL_BITS:-32}
  58.323   	OBJECT_MODE=${OBJECT_MODE:-32}
  58.324  -	if [ "$CC" = "gcc" ]; then
  58.325  +	if [ $GCCVER -gt 0 ]; then
  58.326   	    OUT="aix-gcc"
  58.327 - 	elif [ $OBJECT_MODE -eq 64 ]; then
  58.328 - 	    echo 'Your $OBJECT_MODE was found to be set to 64' 
  58.329 -@@ -828,7 +833,7 @@
  58.330 +           if [ $OBJECT_MODE -eq 64 ]; then
  58.331 +             echo 'Your $OBJECT_MODE was found to be set to 64'
  58.332 +@@ -913,7 +928,7 @@
  58.333   #fi
  58.334   
  58.335   if [ -z "$OUT" ]; then
  58.336 @@ -297,7 +320,7 @@
  58.337   fi
  58.338   
  58.339   if [ ".$PERL" = . ] ; then
  58.340 -@@ -860,9 +865,9 @@
  58.341 +@@ -945,9 +960,9 @@
  58.342   # compiler for the platform ... in which case we add it on
  58.343   # the end ... otherwise we leave it off
  58.344   
  58.345 @@ -309,7 +332,7 @@
  58.346   fi
  58.347   
  58.348   OUT="$PREFIX$OUT"
  58.349 -@@ -872,9 +877,9 @@
  58.350 +@@ -957,9 +972,9 @@
  58.351     echo Configuring for $OUT
  58.352   
  58.353     if [ "$TEST" = "true" ]; then
  58.354 @@ -321,22 +344,412 @@
  58.355     fi
  58.356   else
  58.357     echo "This system ($OUT) is not supported. See file INSTALL for details."
  58.358 +Index: crypto/aes/asm/aesni-sha1-x86_64.pl
  58.359 +--- crypto/aes/asm/aesni-sha1-x86_64.pl.orig	2011-08-23 22:53:31.000000000 +0200
  58.360 ++++ crypto/aes/asm/aesni-sha1-x86_64.pl	2012-06-27 10:10:05.000000000 +0200
  58.361 +@@ -206,7 +206,7 @@
  58.362 + ___
  58.363 + 
  58.364 + my $aesenc=sub {
  58.365 +-  use integer;
  58.366 ++  
  58.367 +   my ($n,$k)=($r/10,$r%10);
  58.368 +     if ($k==0) {
  58.369 +       $code.=<<___;
  58.370 +@@ -249,7 +249,7 @@
  58.371 + };
  58.372 + 
  58.373 + sub Xupdate_ssse3_16_31()		# recall that $Xi starts wtih 4
  58.374 +-{ use integer;
  58.375 ++{ 
  58.376 +   my $body = shift;
  58.377 +   my @insns = (&$body,&$body,&$body,&$body);	# 40 instructions
  58.378 +   my ($a,$b,$c,$d,$e);
  58.379 +@@ -330,7 +330,7 @@
  58.380 + }
  58.381 + 
  58.382 + sub Xupdate_ssse3_32_79()
  58.383 +-{ use integer;
  58.384 ++{ 
  58.385 +   my $body = shift;
  58.386 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 to 48 instructions
  58.387 +   my ($a,$b,$c,$d,$e);
  58.388 +@@ -397,7 +397,7 @@
  58.389 + }
  58.390 + 
  58.391 + sub Xuplast_ssse3_80()
  58.392 +-{ use integer;
  58.393 ++{ 
  58.394 +   my $body = shift;
  58.395 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.396 +   my ($a,$b,$c,$d,$e);
  58.397 +@@ -431,7 +431,7 @@
  58.398 + }
  58.399 + 
  58.400 + sub Xloop_ssse3()
  58.401 +-{ use integer;
  58.402 ++{ 
  58.403 +   my $body = shift;
  58.404 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.405 +   my ($a,$b,$c,$d,$e);
  58.406 +@@ -456,7 +456,7 @@
  58.407 + }
  58.408 + 
  58.409 + sub Xtail_ssse3()
  58.410 +-{ use integer;
  58.411 ++{ 
  58.412 +   my $body = shift;
  58.413 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.414 +   my ($a,$b,$c,$d,$e);
  58.415 +@@ -465,7 +465,7 @@
  58.416 + }
  58.417 + 
  58.418 + sub body_00_19 () {
  58.419 +-  use integer;
  58.420 ++  
  58.421 +   my ($k,$n);
  58.422 +   my @r=(
  58.423 + 	'($a,$b,$c,$d,$e)=@V;'.
  58.424 +@@ -488,7 +488,7 @@
  58.425 + }
  58.426 + 
  58.427 + sub body_20_39 () {
  58.428 +-  use integer;
  58.429 ++  
  58.430 +   my ($k,$n);
  58.431 +   my @r=(
  58.432 + 	'($a,$b,$c,$d,$e)=@V;'.
  58.433 +@@ -509,7 +509,7 @@
  58.434 + }
  58.435 + 
  58.436 + sub body_40_59 () {
  58.437 +-  use integer;
  58.438 ++  
  58.439 +   my ($k,$n);
  58.440 +   my @r=(
  58.441 + 	'($a,$b,$c,$d,$e)=@V;'.
  58.442 +@@ -723,7 +723,7 @@
  58.443 + ___
  58.444 + 
  58.445 + my $aesenc=sub {
  58.446 +-  use integer;
  58.447 ++  
  58.448 +   my ($n,$k)=($r/10,$r%10);
  58.449 +     if ($k==0) {
  58.450 +       $code.=<<___;
  58.451 +@@ -766,7 +766,7 @@
  58.452 + };
  58.453 + 
  58.454 + sub Xupdate_avx_16_31()		# recall that $Xi starts wtih 4
  58.455 +-{ use integer;
  58.456 ++{ 
  58.457 +   my $body = shift;
  58.458 +   my @insns = (&$body,&$body,&$body,&$body);	# 40 instructions
  58.459 +   my ($a,$b,$c,$d,$e);
  58.460 +@@ -842,7 +842,7 @@
  58.461 + }
  58.462 + 
  58.463 + sub Xupdate_avx_32_79()
  58.464 +-{ use integer;
  58.465 ++{ 
  58.466 +   my $body = shift;
  58.467 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 to 48 instructions
  58.468 +   my ($a,$b,$c,$d,$e);
  58.469 +@@ -907,7 +907,7 @@
  58.470 + }
  58.471 + 
  58.472 + sub Xuplast_avx_80()
  58.473 +-{ use integer;
  58.474 ++{ 
  58.475 +   my $body = shift;
  58.476 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.477 +   my ($a,$b,$c,$d,$e);
  58.478 +@@ -941,7 +941,7 @@
  58.479 + }
  58.480 + 
  58.481 + sub Xloop_avx()
  58.482 +-{ use integer;
  58.483 ++{ 
  58.484 +   my $body = shift;
  58.485 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.486 +   my ($a,$b,$c,$d,$e);
  58.487 +@@ -965,7 +965,7 @@
  58.488 + }
  58.489 + 
  58.490 + sub Xtail_avx()
  58.491 +-{ use integer;
  58.492 ++{ 
  58.493 +   my $body = shift;
  58.494 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.495 +   my ($a,$b,$c,$d,$e);
  58.496 +Index: crypto/asn1/charmap.pl
  58.497 +--- crypto/asn1/charmap.pl.orig	2000-07-28 03:58:11.000000000 +0200
  58.498 ++++ crypto/asn1/charmap.pl	2012-06-27 10:10:05.000000000 +0200
  58.499 +@@ -1,7 +1,5 @@
  58.500 + #!/usr/local/bin/perl -w
  58.501 + 
  58.502 +-use strict;
  58.503 +-
  58.504 + my ($i, @arr);
  58.505 + 
  58.506 + # Set up an array with the type of ASCII characters
  58.507 +Index: crypto/bn/asm/modexp512-x86_64.pl
  58.508 +--- crypto/bn/asm/modexp512-x86_64.pl.orig	2011-12-12 16:12:09.000000000 +0100
  58.509 ++++ crypto/bn/asm/modexp512-x86_64.pl	2012-06-27 10:10:05.000000000 +0200
  58.510 +@@ -70,7 +70,6 @@
  58.511 + 
  58.512 + open STDOUT,"| $^X $xlate $flavour $output";
  58.513 + 
  58.514 +-use strict;
  58.515 + my $code=".text\n\n";
  58.516 + my $m=0;
  58.517 + 
  58.518 +Index: crypto/md5/asm/md5-x86_64.pl
  58.519 +--- crypto/md5/asm/md5-x86_64.pl.orig	2008-12-19 12:17:27.000000000 +0100
  58.520 ++++ crypto/md5/asm/md5-x86_64.pl	2012-06-27 10:10:05.000000000 +0200
  58.521 +@@ -7,8 +7,6 @@
  58.522 + # in the public domain.
  58.523 + #
  58.524 + 
  58.525 +-use strict;
  58.526 +-
  58.527 + my $code;
  58.528 + 
  58.529 + # round1_step() does:
  58.530  Index: crypto/objects/obj_dat.pl
  58.531 ---- crypto/objects/obj_dat.pl.orig	2005-08-29 01:20:47 +0200
  58.532 -+++ crypto/objects/obj_dat.pl	2007-10-17 12:13:48 +0200
  58.533 -@@ -1,9 +1,5 @@
  58.534 +--- crypto/objects/obj_dat.pl.orig	2007-09-18 23:05:21.000000000 +0200
  58.535 ++++ crypto/objects/obj_dat.pl	2012-06-27 10:10:05.000000000 +0200
  58.536 +@@ -2,7 +2,6 @@
  58.537 + 
  58.538 + # fixes bug in floating point emulation on sparc64 when
  58.539 + # this script produces off-by-one output on sparc64
  58.540 +-use integer;
  58.541 + 
  58.542 + sub obj_cmp
  58.543 + 	{
  58.544 +Index: crypto/objects/objxref.pl
  58.545 +--- crypto/objects/objxref.pl.orig	2009-04-06 18:16:23.000000000 +0200
  58.546 ++++ crypto/objects/objxref.pl	2012-06-27 10:10:05.000000000 +0200
  58.547 +@@ -1,7 +1,5 @@
  58.548   #!/usr/local/bin/perl
  58.549   
  58.550 --# fixes bug in floating point emulation on sparc64 when
  58.551 --# this script produces off-by-one output on sparc64
  58.552 --use integer;
  58.553 +-use strict;
  58.554  -
  58.555 - sub obj_cmp
  58.556 - 	{
  58.557 - 	local(@a,@b,$_,$r);
  58.558 + my %xref_tbl;
  58.559 + my %oid_tbl;
  58.560 + 
  58.561 +Index: crypto/perlasm/x86_64-xlate.pl
  58.562 +--- crypto/perlasm/x86_64-xlate.pl.orig	2012-03-13 20:19:31.000000000 +0100
  58.563 ++++ crypto/perlasm/x86_64-xlate.pl	2012-06-27 10:10:05.000000000 +0200
  58.564 +@@ -248,7 +248,6 @@
  58.565 + 
  58.566 + 	# Solaris /usr/ccs/bin/as can't handle multiplications
  58.567 + 	# in $self->{label}, new gas requires sign extension...
  58.568 +-	use integer;
  58.569 + 	$self->{label} =~ s/(?<![\w\$\.])(0x?[0-9a-f]+)/oct($1)/egi;
  58.570 + 	$self->{label} =~ s/([0-9]+\s*[\*\/\%]\s*[0-9]+)/eval($1)/eg;
  58.571 + 	$self->{label} =~ s/([0-9]+)/$1<<32>>32/eg;
  58.572 +Index: crypto/sha/asm/sha1-586.pl
  58.573 +--- crypto/sha/asm/sha1-586.pl.orig	2011-06-28 15:53:49.000000000 +0200
  58.574 ++++ crypto/sha/asm/sha1-586.pl	2012-06-27 10:10:05.000000000 +0200
  58.575 +@@ -523,7 +523,7 @@
  58.576 + # round]...
  58.577 + #
  58.578 + sub Xupdate_ssse3_16_31()		# recall that $Xi starts wtih 4
  58.579 +-{ use integer;
  58.580 ++{ 
  58.581 +   my $body = shift;
  58.582 +   my @insns = (&$body,&$body,&$body,&$body);	# 40 instructions
  58.583 +   my ($a,$b,$c,$d,$e);
  58.584 +@@ -607,7 +607,7 @@
  58.585 + }
  58.586 + 
  58.587 + sub Xupdate_ssse3_32_79()
  58.588 +-{ use integer;
  58.589 ++{ 
  58.590 +   my $body = shift;
  58.591 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 to 48 instructions
  58.592 +   my ($a,$b,$c,$d,$e);
  58.593 +@@ -675,7 +675,7 @@
  58.594 + }
  58.595 + 
  58.596 + sub Xuplast_ssse3_80()
  58.597 +-{ use integer;
  58.598 ++{ 
  58.599 +   my $body = shift;
  58.600 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.601 +   my ($a,$b,$c,$d,$e);
  58.602 +@@ -710,7 +710,7 @@
  58.603 + }
  58.604 + 
  58.605 + sub Xloop_ssse3()
  58.606 +-{ use integer;
  58.607 ++{ 
  58.608 +   my $body = shift;
  58.609 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.610 +   my ($a,$b,$c,$d,$e);
  58.611 +@@ -735,7 +735,7 @@
  58.612 + }
  58.613 + 
  58.614 + sub Xtail_ssse3()
  58.615 +-{ use integer;
  58.616 ++{ 
  58.617 +   my $body = shift;
  58.618 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.619 +   my ($a,$b,$c,$d,$e);
  58.620 +@@ -945,7 +945,7 @@
  58.621 + 	&jmp	(&label("loop"));
  58.622 + 
  58.623 + sub Xupdate_avx_16_31()		# recall that $Xi starts wtih 4
  58.624 +-{ use integer;
  58.625 ++{ 
  58.626 +   my $body = shift;
  58.627 +   my @insns = (&$body,&$body,&$body,&$body);	# 40 instructions
  58.628 +   my ($a,$b,$c,$d,$e);
  58.629 +@@ -1023,7 +1023,7 @@
  58.630 + }
  58.631 + 
  58.632 + sub Xupdate_avx_32_79()
  58.633 +-{ use integer;
  58.634 ++{ 
  58.635 +   my $body = shift;
  58.636 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 to 48 instructions
  58.637 +   my ($a,$b,$c,$d,$e);
  58.638 +@@ -1088,7 +1088,7 @@
  58.639 + }
  58.640 + 
  58.641 + sub Xuplast_avx_80()
  58.642 +-{ use integer;
  58.643 ++{ 
  58.644 +   my $body = shift;
  58.645 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.646 +   my ($a,$b,$c,$d,$e);
  58.647 +@@ -1123,7 +1123,7 @@
  58.648 + }
  58.649 + 
  58.650 + sub Xloop_avx()
  58.651 +-{ use integer;
  58.652 ++{ 
  58.653 +   my $body = shift;
  58.654 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.655 +   my ($a,$b,$c,$d,$e);
  58.656 +@@ -1147,7 +1147,7 @@
  58.657 + }
  58.658 + 
  58.659 + sub Xtail_avx()
  58.660 +-{ use integer;
  58.661 ++{ 
  58.662 +   my $body = shift;
  58.663 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.664 +   my ($a,$b,$c,$d,$e);
  58.665 +Index: crypto/sha/asm/sha1-x86_64.pl
  58.666 +--- crypto/sha/asm/sha1-x86_64.pl.orig	2011-07-04 15:01:42.000000000 +0200
  58.667 ++++ crypto/sha/asm/sha1-x86_64.pl	2012-06-27 10:10:05.000000000 +0200
  58.668 +@@ -367,7 +367,7 @@
  58.669 + }
  58.670 + 
  58.671 + sub Xupdate_ssse3_16_31()		# recall that $Xi starts wtih 4
  58.672 +-{ use integer;
  58.673 ++{ 
  58.674 +   my $body = shift;
  58.675 +   my @insns = (&$body,&$body,&$body,&$body);	# 40 instructions
  58.676 +   my ($a,$b,$c,$d,$e);
  58.677 +@@ -448,7 +448,7 @@
  58.678 + }
  58.679 + 
  58.680 + sub Xupdate_ssse3_32_79()
  58.681 +-{ use integer;
  58.682 ++{ 
  58.683 +   my $body = shift;
  58.684 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 to 48 instructions
  58.685 +   my ($a,$b,$c,$d,$e);
  58.686 +@@ -515,7 +515,7 @@
  58.687 + }
  58.688 + 
  58.689 + sub Xuplast_ssse3_80()
  58.690 +-{ use integer;
  58.691 ++{ 
  58.692 +   my $body = shift;
  58.693 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.694 +   my ($a,$b,$c,$d,$e);
  58.695 +@@ -549,7 +549,7 @@
  58.696 + }
  58.697 + 
  58.698 + sub Xloop_ssse3()
  58.699 +-{ use integer;
  58.700 ++{ 
  58.701 +   my $body = shift;
  58.702 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.703 +   my ($a,$b,$c,$d,$e);
  58.704 +@@ -574,7 +574,7 @@
  58.705 + }
  58.706 + 
  58.707 + sub Xtail_ssse3()
  58.708 +-{ use integer;
  58.709 ++{ 
  58.710 +   my $body = shift;
  58.711 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.712 +   my ($a,$b,$c,$d,$e);
  58.713 +@@ -778,7 +778,7 @@
  58.714 + ___
  58.715 + 
  58.716 + sub Xupdate_avx_16_31()		# recall that $Xi starts wtih 4
  58.717 +-{ use integer;
  58.718 ++{ 
  58.719 +   my $body = shift;
  58.720 +   my @insns = (&$body,&$body,&$body,&$body);	# 40 instructions
  58.721 +   my ($a,$b,$c,$d,$e);
  58.722 +@@ -854,7 +854,7 @@
  58.723 + }
  58.724 + 
  58.725 + sub Xupdate_avx_32_79()
  58.726 +-{ use integer;
  58.727 ++{ 
  58.728 +   my $body = shift;
  58.729 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 to 48 instructions
  58.730 +   my ($a,$b,$c,$d,$e);
  58.731 +@@ -919,7 +919,7 @@
  58.732 + }
  58.733 + 
  58.734 + sub Xuplast_avx_80()
  58.735 +-{ use integer;
  58.736 ++{ 
  58.737 +   my $body = shift;
  58.738 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.739 +   my ($a,$b,$c,$d,$e);
  58.740 +@@ -953,7 +953,7 @@
  58.741 + }
  58.742 + 
  58.743 + sub Xloop_avx()
  58.744 +-{ use integer;
  58.745 ++{ 
  58.746 +   my $body = shift;
  58.747 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.748 +   my ($a,$b,$c,$d,$e);
  58.749 +@@ -977,7 +977,7 @@
  58.750 + }
  58.751 + 
  58.752 + sub Xtail_avx()
  58.753 +-{ use integer;
  58.754 ++{ 
  58.755 +   my $body = shift;
  58.756 +   my @insns = (&$body,&$body,&$body,&$body);	# 32 instructions
  58.757 +   my ($a,$b,$c,$d,$e);
  58.758 +Index: util/clean-depend.pl
  58.759 +--- util/clean-depend.pl.orig	2007-09-19 16:53:18.000000000 +0200
  58.760 ++++ util/clean-depend.pl	2012-06-27 10:10:05.000000000 +0200
  58.761 +@@ -2,8 +2,6 @@
  58.762 + # Clean the dependency list in a makefile of standard includes...
  58.763 + # Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999
  58.764 + 
  58.765 +-use strict;
  58.766 +-
  58.767 + while(<STDIN>) {
  58.768 +     print;
  58.769 +     last if /^# DO NOT DELETE THIS LINE/;
  58.770  Index: util/mklink.pl
  58.771 ---- util/mklink.pl.orig	2006-02-09 13:28:30 +0100
  58.772 -+++ util/mklink.pl	2007-10-17 12:13:48 +0200
  58.773 +--- util/mklink.pl.orig	2008-12-19 14:35:09.000000000 +0100
  58.774 ++++ util/mklink.pl	2012-06-27 10:10:05.000000000 +0200
  58.775  @@ -15,13 +15,12 @@
  58.776   # Apart from this, this script should be able to handle even the most
  58.777   # pathological cases.
  58.778 @@ -349,7 +762,7 @@
  58.779   my @from_path = split(/[\\\/]/, $from);
  58.780  -my $pwd = getcwd();
  58.781  +my $pwd = `pwd`;
  58.782 -+$pwd =~ s/\n$//s;
  58.783 ++$pwd =~ s/\r?\n$//s;
  58.784   chomp($pwd);
  58.785   my @pwd_path = split(/[\\\/]/, $pwd);
  58.786   
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/openpkg/patch.Makefile.in	Tue Jul 31 12:23:42 2012 +0200
    59.3 @@ -0,0 +1,402 @@
    59.4 +# Makefile for GNU patch.
    59.5 +
    59.6 +# Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2009
    59.7 +# Free Software Foundation, Inc.
    59.8 +
    59.9 +# This program is free software; you can redistribute it and/or modify
   59.10 +# it under the terms of the GNU General Public License as published by
   59.11 +# the Free Software Foundation; either version 2, or (at your option)
   59.12 +# any later version.
   59.13 +
   59.14 +# This program is distributed in the hope that it will be useful,
   59.15 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
   59.16 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   59.17 +# GNU General Public License for more details.
   59.18 +
   59.19 +# You should have received a copy of the GNU General Public License
   59.20 +# along with this program; see the file COPYING.
   59.21 +# If not, write to the Free Software Foundation,
   59.22 +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
   59.23 +
   59.24 +#### Start of system configuration section. ####
   59.25 +
   59.26 +srcdir = @srcdir@
   59.27 +VPATH = @srcdir@
   59.28 +
   59.29 +@SET_MAKE@
   59.30 +
   59.31 +CC = @CC@
   59.32 +ed_PROGRAM = @ed_PROGRAM@
   59.33 +INSTALL = @INSTALL@
   59.34 +INSTALL_PROGRAM = @INSTALL_PROGRAM@
   59.35 +INSTALL_DATA = @INSTALL_DATA@
   59.36 +TEST_SHELL = @TEST_SHELL@
   59.37 +transform = @program_transform_name@
   59.38 +
   59.39 +CFLAGS = @CFLAGS@
   59.40 +CPPFLAGS = @CPPFLAGS@
   59.41 +DEFS = @DEFS@
   59.42 +EXEEXT = @EXEEXT@
   59.43 +LDFLAGS = @LDFLAGS@
   59.44 +LIBOBJDIR = gl/lib/
   59.45 +LIBOBJS = @LIBOBJS@ ${LIBOBJDIR}full-write$U.o
   59.46 +LIBS = @LIBS@
   59.47 +OBJEXT = @OBJEXT@
   59.48 +PACKAGE_NAME = @PACKAGE_NAME@
   59.49 +PACKAGE_VERSION = @PACKAGE_VERSION@
   59.50 +STDBOOL_H = @STDBOOL_H@
   59.51 +GETOPT_H = @GETOPT_H@
   59.52 +HAVE__BOOL = @HAVE__BOOL@
   59.53 +ENABLE_MERGE = @ENABLE_MERGE@
   59.54 +
   59.55 +prefix = @prefix@
   59.56 +exec_prefix = @exec_prefix@
   59.57 +bindir = @bindir@
   59.58 +
   59.59 +# Where to put the manual pages.
   59.60 +datarootdir = @datarootdir@
   59.61 +mandir = @mandir@
   59.62 +man1dir = $(mandir)/man1
   59.63 +# Extension (including `.') for the manual page filenames.
   59.64 +man1ext = .1
   59.65 +
   59.66 +# Hook for nonstandard builds.
   59.67 +CONFIG_STATUS = config.status
   59.68 +
   59.69 +#### End of system configuration section. ####
   59.70 +
   59.71 +SHELL = /bin/sh
   59.72 +
   59.73 +LIBSRCS = \
   59.74 +	gl/lib/argmatch.c \
   59.75 +	gl/lib/backupfile.c \
   59.76 +	gl/lib/basename.c \
   59.77 +	gl/lib/dirname.c \
   59.78 +	gl/lib/error.c \
   59.79 +	gl/lib/exitfail.c \
   59.80 +	gl/lib/full-write.c \
   59.81 +	gl/lib/getopt1.c \
   59.82 +	gl/lib/getopt.c \
   59.83 +	gl/lib/hash.c \
   59.84 +	gl/lib/malloc.c \
   59.85 +	gl/lib/mbrtowc.c \
   59.86 +	gl/lib/memchr.c \
   59.87 +	gl/lib/quotearg.c \
   59.88 +	gl/lib/quote.c \
   59.89 +	gl/lib/realloc.c \
   59.90 +	gl/lib/rename.c \
   59.91 +	gl/lib/safe-read.c \
   59.92 +	gl/lib/safe-write.c \
   59.93 +	gl/lib/strcasecmp.c \
   59.94 +	gl/lib/stripslash.c \
   59.95 +	gl/lib/strncasecmp.c \
   59.96 +	gl/lib/strndup.c \
   59.97 +	gl/lib/xmalloc.c \
   59.98 +	gl/lib/xstrndup.c
   59.99 +
  59.100 +SRCS = $(LIBSRCS) \
  59.101 +	src/inp.c \
  59.102 +	src/maketime.c \
  59.103 +	src/merge.c \
  59.104 +	src/partime.c \
  59.105 +	src/patch.c \
  59.106 +	src/pch.c \
  59.107 +	src/quotesys.c \
  59.108 +	src/util.c \
  59.109 +	src/version.c
  59.110 +
  59.111 +MERGEOBJ = src/merge.$(OBJEXT)
  59.112 +
  59.113 +OBJS = $(LIBOBJS) $(MERGEOBJ) \
  59.114 +	src/inp.$(OBJEXT) \
  59.115 +	src/maketime.$(OBJEXT) \
  59.116 +	src/partime.$(OBJEXT) \
  59.117 +	src/patch.$(OBJEXT) \
  59.118 +	src/pch.$(OBJEXT) \
  59.119 +	src/quotesys.$(OBJEXT) \
  59.120 +	src/util.$(OBJEXT) \
  59.121 +	src/version.$(OBJEXT)
  59.122 +
  59.123 +LIBHDRS = \
  59.124 +	gl/lib/argmatch.h \
  59.125 +	gl/lib/backupfile.h \
  59.126 +	gl/lib/dirname.h \
  59.127 +	gl/lib/error.h \
  59.128 +	gl/lib/exitfail.h \
  59.129 +	gl/lib/full-write.h \
  59.130 +	gl/lib/getopt.hin \
  59.131 +	gl/lib/getopt_int.h \
  59.132 +	gl/lib/gettext.h \
  59.133 +	gl/lib/hash.h \
  59.134 +	gl/lib/minmax.h \
  59.135 +	gl/lib/quotearg.h \
  59.136 +	gl/lib/quote.h \
  59.137 +	gl/lib/safe-write.h \
  59.138 +	gl/lib/stdbool.hin \
  59.139 +	gl/lib/unlocked-io.h \
  59.140 +	gl/lib/verify.h \
  59.141 +	gl/lib/xalloc.h \
  59.142 +	gl/lib/xstrndup.h
  59.143 +
  59.144 +HDRS = $(LIBHDRS) \
  59.145 +	src/bestmatch.h \
  59.146 +	src/common.h \
  59.147 +	src/diffseq.h \
  59.148 +	src/inp.h \
  59.149 +	src/maketime.h \
  59.150 +	src/partime.h \
  59.151 +	src/pch.h \
  59.152 +	src/quotesys.h \
  59.153 +	src/util.h \
  59.154 +	src/version.h
  59.155 +
  59.156 +MISC = \
  59.157 +	AUTHORS \
  59.158 +	COPYING \
  59.159 +	ChangeLog \
  59.160 +	INSTALL \
  59.161 +	Makefile.in \
  59.162 +	NEWS \
  59.163 +	README \
  59.164 +	VERSION \
  59.165 +	aclocal.m4 \
  59.166 +	config.guess\
  59.167 +	config.hin \
  59.168 +	config.sub \
  59.169 +	configure \
  59.170 +	configure.ac \
  59.171 +	install-sh \
  59.172 +	mkinstalldirs \
  59.173 +	patch.man \
  59.174 +	tests/test-lib.sh \
  59.175 +	update-version.sh
  59.176 +
  59.177 +DISTFILES = $(MISC) $(SRCS) $(HDRS) $(M4FILES) \
  59.178 +	pc/chdirsaf.c \
  59.179 +	pc/djgpp/config.sed \
  59.180 +	pc/djgpp/configure.bat \
  59.181 +	pc/djgpp/configure.sed \
  59.182 +	pc/djgpp/README
  59.183 +
  59.184 +MORE_DISTFILES = $(TESTS) $(BROKEN_TESTS)
  59.185 +
  59.186 +patch_name = `echo patch | sed '$(transform)'`
  59.187 +
  59.188 +all:: src/patch$(EXEEXT)
  59.189 +
  59.190 +info::
  59.191 +installcheck::
  59.192 +
  59.193 +TESTS = \
  59.194 +	tests/asymmetric-hunks \
  59.195 +	tests/backup-prefix-suffix \
  59.196 +	tests/corrupt-reject-files \
  59.197 +	tests/create-delete \
  59.198 +	tests/crlf-handling \
  59.199 +	tests/filename-choice \
  59.200 +	tests/global-reject-files \
  59.201 +	tests/inname \
  59.202 +	tests/line-numbers \
  59.203 +	tests/merge \
  59.204 +	tests/munged-context-format \
  59.205 +	tests/need-filename \
  59.206 +	tests/no-newline-triggers-assert \
  59.207 +	tests/preserve-c-function-names \
  59.208 +	tests/preserve-mode-and-timestamp \
  59.209 +	tests/reject-format \
  59.210 +	tests/remember-backup-files \
  59.211 +	tests/remember-reject-files \
  59.212 +	tests/unmodified-files
  59.213 +
  59.214 +BROKEN_TESTS = \
  59.215 +	tests/dash-o-append
  59.216 +
  59.217 +check:: $(TESTS)
  59.218 +	@echo All tests succeeded!
  59.219 +
  59.220 +.PHONY: $(TESTS) $(BROKEN_TESTS)
  59.221 +$(TESTS) $(BROKEN_TESTS): all
  59.222 +	@echo "[$@]"
  59.223 +	@srcdir=$(srcdir)/tests $(TEST_SHELL) $(srcdir)/$@
  59.224 +
  59.225 +DEFINE_ENABLE_MERGE = -DENABLE_MERGE
  59.226 +COMPILE = $(CC) -c $(CPPFLAGS) $(DEFS) -Ded_PROGRAM=\"$(ed_PROGRAM)\" \
  59.227 +	$(DEFINE_ENABLE_MERGE) -I. -I$(srcdir)/src -I$(srcdir)/gl/lib $(CFLAGS)
  59.228 +
  59.229 +.c.$(OBJEXT):
  59.230 +	@mkdir -p $(@D)
  59.231 +	$(COMPILE) -o $@ $<
  59.232 +
  59.233 +src/patch$(EXEEXT): $(OBJS)
  59.234 +	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS)
  59.235 +
  59.236 +install:: all
  59.237 +	$(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)
  59.238 +	$(INSTALL_PROGRAM) src/patch$(EXEEXT) $(DESTDIR)$(bindir)/$(patch_name)$(EXEEXT)
  59.239 +	$(INSTALL_DATA) $(srcdir)/patch.man $(DESTDIR)$(man1dir)/$(patch_name)$(man1ext)
  59.240 +
  59.241 +install-strip::
  59.242 +	$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
  59.243 +
  59.244 +uninstall::
  59.245 +	rm -f $(DESTDIR)$(bindir)/$(patch_name)$(EXEEXT) \
  59.246 +		$(DESTDIR)$(man1dir)/$(patch_name)$(man1ext)
  59.247 +
  59.248 +Makefile: Makefile.in $(CONFIG_STATUS)
  59.249 +	$(SHELL) $(CONFIG_STATUS)
  59.250 +FORCE:
  59.251 +VERSION: FORCE
  59.252 +	@cd $(srcdir) && $(SHELL) ./update-version.sh VERSION
  59.253 +config.status: configure
  59.254 +	$(SHELL) $(CONFIG_STATUS) --recheck
  59.255 +configure: configure.ac $(srcdir)/aclocal.m4 $(srcdir)/VERSION
  59.256 +	cd $(srcdir) && autoconf --force
  59.257 +config.hin: configure.ac $(srcdir)/aclocal.m4
  59.258 +	cd $(srcdir) && autoheader --force
  59.259 +
  59.260 +# We need the following in order to create <getopt.h> when the system
  59.261 +# doesn't have one that works with the given compiler.
  59.262 +getopt.h: gl/lib/getopt.hin
  59.263 +	rm -f $@-t $@
  59.264 +	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
  59.265 +	  cat $(srcdir)/gl/lib/getopt.hin; \
  59.266 +	} > $@-t
  59.267 +	mv -f $@-t $@
  59.268 +
  59.269 +# We need the following in order to create <stdbool.h> when the system
  59.270 +# doesn't have one that works.
  59.271 +#gl/lib/stdbool.h: gl/lib/stdbool.hin
  59.272 +stdbool.h: gl/lib/stdbool.hin
  59.273 +	rm -f $@-t $@
  59.274 +	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
  59.275 +	  sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' \
  59.276 +	    < $(srcdir)/gl/lib/stdbool.hin; \
  59.277 +	} > $@-t
  59.278 +	mv $@-t $@
  59.279 +
  59.280 +LIBM4FILES = \
  59.281 +	gl/m4/argmatch.m4 \
  59.282 +	gl/m4/backupfile.m4 \
  59.283 +	gl/m4/d-ino.m4 \
  59.284 +	gl/m4/dirname.m4 \
  59.285 +	gl/m4/dos.m4 \
  59.286 +	gl/m4/double-slash-root.m4 \
  59.287 +	gl/m4/error.m4 \
  59.288 +	gl/m4/exitfail.m4 \
  59.289 +	gl/m4/extensions.m4 \
  59.290 +	gl/m4/getopt.m4 \
  59.291 +	gl/m4/gettext.m4 \
  59.292 +	gl/m4/hash.m4 \
  59.293 +	gl/m4/inline.m4 \
  59.294 +	gl/m4/malloc.m4 \
  59.295 +	gl/m4/mbrtowc.m4 \
  59.296 +	gl/m4/mbstate_t.m4 \
  59.297 +	gl/m4/memchr.m4 \
  59.298 +	gl/m4/minmax.m4 \
  59.299 +	gl/m4/onceonly.m4 \
  59.300 +	gl/m4/quotearg.m4 \
  59.301 +	gl/m4/quote.m4 \
  59.302 +	gl/m4/realloc.m4 \
  59.303 +	gl/m4/rename.m4 \
  59.304 +	gl/m4/safe-write.m4 \
  59.305 +	gl/m4/ssize_t.m4 \
  59.306 +	gl/m4/stdbool.m4 \
  59.307 +	gl/m4/strcase.m4 \
  59.308 +	gl/m4/strndup.m4 \
  59.309 +	gl/m4/unlocked-io.m4 \
  59.310 +	gl/m4/utimbuf.m4 \
  59.311 +	gl/m4/xalloc.m4 \
  59.312 +	gl/m4/xstrndup.m4
  59.313 +
  59.314 +M4FILES = $(LIBM4FILES) \
  59.315 +	m4/mkdir.m4 \
  59.316 +	m4/setmode.m4
  59.317 +
  59.318 +$(srcdir)/aclocal.m4: $(M4FILES)
  59.319 +	aclocal -I m4 -I gl/m4
  59.320 +
  59.321 +TAGS: $(HDRS) $(SRCS)
  59.322 +	etags $(HDRS) $(SRCS)
  59.323 +
  59.324 +mostlyclean::
  59.325 +	rm -f core* *core src/*.$(OBJEXT) gl/lib/*.$(OBJEXT) \
  59.326 +	    stdbool.h getopt.h gl/lib/*.h-t
  59.327 +
  59.328 +clean:: mostlyclean
  59.329 +	rm -f src/patch$(EXEEXT)
  59.330 +
  59.331 +distclean:: clean
  59.332 +	rm -f Makefile config.cache config.hin~ config.log config.status \
  59.333 +	      config.h
  59.334 +	rm -rf autom4te.cache/
  59.335 +
  59.336 +maintainer-clean::
  59.337 +	@echo "This command is intended for maintainers to use;"
  59.338 +	@echo "rebuilding the deleted files requires special tools."
  59.339 +	$(MAKE) distclean
  59.340 +	rm -f TAGS VERSION aclocal.m4 config.hin configure \
  59.341 +	      patch-*.tar.gz patch-*.tar.gz.sig
  59.342 +
  59.343 +PV = $(PACKAGE_NAME)-$(PACKAGE_VERSION)
  59.344 +
  59.345 +dist:: $(DISTFILES)
  59.346 +	@rm -rf $(PV)
  59.347 +	@ln -s . $(PV)
  59.348 +	@tar -cf - `( printf "%s\n" $(DISTFILES) $(MORE_DISTFILES); \
  59.349 +		      grep -q -E -- '-[0-9]+-[0-9a-z]+(-dirty)?$$' VERSION \
  59.350 +		        && echo README-alpha \
  59.351 +		    ) | sed -e 's,^$(srcdir)/,,' -e "s,^,$(PV)/," \
  59.352 +		    | LC_ALL=C sort` \
  59.353 +	  | gzip -9 > $(PV).tar.gz
  59.354 +	@if which bzip2 >/dev/null 2>/dev/null; then \
  59.355 +	    gzip -d < $(PV).tar.gz | bzip2 -9 > $(PV).tar.bz2; fi
  59.356 +	@if which xz >/dev/null 2>/dev/null; then \
  59.357 +	    gzip -d < $(PV).tar.gz | xz -9 > $(PV).tar.xz; fi
  59.358 +	@rm -rf $(PV)
  59.359 +	@whereto=$$(if grep -q -E -- '-[0-9]+-[0-9a-z]+(-dirty)?$$' VERSION; \
  59.360 +		   then echo alpha; else echo ftp; fi); \
  59.361 +	    echo; \
  59.362 +	    echo "# gnupload --to $$whereto.gnu.org:patch $(PV).tar.gz"; \
  59.363 +	    test ! -e $(PV).tar.bz2 || echo "# gnupload" \
  59.364 +	      "--to $$whereto.gnu.org:patch $(PV).tar.bz2"; \
  59.365 +	    test ! -e $(PV).tar.xz || echo "# gnupload" \
  59.366 +	      "--to $$whereto.gnu.org:patch $(PV).tar.xz"; \
  59.367 +	    echo
  59.368 +
  59.369 +$(OBJS): config.h
  59.370 +COMMON = src/common.h $(STDBOOL_H)
  59.371 +
  59.372 +gl/lib/addext.$(OBJEXT): gl/lib/backupfile.h gl/lib/dirname.h
  59.373 +gl/lib/argmatch.$(OBJEXT): $(STDBOOL_H) gl/lib/argmatch.h gl/lib/gettext.h \
  59.374 +	gl/lib/error.h gl/lib/quote.h gl/lib/quotearg.h gl/lib/unlocked-io.h
  59.375 +gl/lib/backupfile.$(OBJEXT): gl/lib/argmatch.h gl/lib/backupfile.h \
  59.376 +	gl/lib/dirname.h
  59.377 +gl/lib/basename.$(OBJEXT): gl/lib/dirname.h
  59.378 +gl/lib/dirname.$(OBJEXT): gl/lib/dirname.h gl/lib/xalloc.h
  59.379 +gl/lib/error.$(OBJEXT): gl/lib/error.h gl/lib/gettext.h gl/lib/unlocked-io.h
  59.380 +gl/lib/exitfail.$(OBJEXT): gl/lib/exitfail.h
  59.381 +gl/lib/full-write.$(OBJEXT): gl/lib/full-write.h gl/lib/safe-write.h
  59.382 +gl/lib/getopt.$(OBJEXT) gl/lib/getopt1.$(OBJEXT): getopt.h
  59.383 +gl/lib/hash.$(OBJEXT): $(STDBOOL_H) gl/lib/hash.h
  59.384 +gl/lib/safe-read.$(OBJEXT): gl/lib/safe-write.h
  59.385 +gl/lib/safe-write.$(OBJEXT): gl/lib/safe-read.c
  59.386 +
  59.387 +src/inp.$(OBJEXT): gl/lib/backupfile.h $(COMMON) src/inp.h src/pch.h \
  59.388 +	gl/lib/quotearg.h src/util.h gl/lib/xalloc.h
  59.389 +src/maketime.$(OBJEXT): src/maketime.h src/partime.h
  59.390 +src/partime.$(OBJEXT): src/partime.h
  59.391 +src/patch.$(OBJEXT): gl/lib/argmatch.h gl/lib/backupfile.h $(COMMON) \
  59.392 +	gl/lib/exitfail.h $(GETOPT_H) src/inp.h src/pch.h \
  59.393 +	gl/lib/quotearg.h src/util.h src/version.h gl/lib/xalloc.h
  59.394 +src/pch.$(OBJEXT): gl/lib/backupfile.h $(COMMON) gl/lib/dirname.h src/inp.h \
  59.395 +	src/pch.h gl/lib/quotearg.h src/util.h
  59.396 +gl/lib/quote.$(OBJECT): gl/lib/quote.h gl/lib/quotearg.h
  59.397 +gl/lib/quotearg.$(OBJEXT): gl/lib/gettext.h gl/lib/quotearg.h gl/lib/xalloc.h
  59.398 +src/quotesys.$(OBJEXT): src/quotesys.h
  59.399 +gl/lib/strncasecmp.$(OBJEXT): gl/lib/strcasecmp.c
  59.400 +src/util.$(OBJEXT): gl/lib/backupfile.h $(COMMON) gl/lib/dirname.h gl/lib/full-write.h \
  59.401 +	gl/lib/hash.h src/maketime.h src/partime.h gl/lib/quotearg.h \
  59.402 +	src/quotesys.h src/util.h src/version.h gl/lib/xalloc.h
  59.403 +src/version.$(OBJEXT): $(COMMON) src/version.h
  59.404 +gl/lib/xmalloc.$(OBJEXT): gl/lib/error.h gl/lib/exitfail.h gl/lib/gettext.h \
  59.405 +	gl/lib/xalloc.h
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/openpkg/patch.strnlen.c	Tue Jul 31 12:23:42 2012 +0200
    60.3 @@ -0,0 +1,31 @@
    60.4 +/* Find the length of STRING, but scan at most MAXLEN characters.
    60.5 +   Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
    60.6 +   Written by Simon Josefsson.
    60.7 +
    60.8 +   This program is free software; you can redistribute it and/or modify
    60.9 +   it under the terms of the GNU General Public License as published by
   60.10 +   the Free Software Foundation; either version 2, or (at your option)
   60.11 +   any later version.
   60.12 +
   60.13 +   This program is distributed in the hope that it will be useful,
   60.14 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
   60.15 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   60.16 +   GNU General Public License for more details.
   60.17 +
   60.18 +   You should have received a copy of the GNU General Public License
   60.19 +   along with this program; if not, write to the Free Software Foundation,
   60.20 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
   60.21 +
   60.22 +#include <config.h>
   60.23 +
   60.24 +#include <string.h>
   60.25 +
   60.26 +/* Find the length of STRING, but scan at most MAXLEN characters.
   60.27 +   If no '\0' terminator is found in that many characters, return MAXLEN.  */
   60.28 +
   60.29 +size_t
   60.30 +strnlen (const char *string, size_t maxlen)
   60.31 +{
   60.32 +  const char *end = memchr (string, '\0', maxlen);
   60.33 +  return end ? (size_t) (end - string) : maxlen;
   60.34 +}
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/openpkg/pcre.patch	Tue Jul 31 12:23:42 2012 +0200
    61.3 @@ -0,0 +1,42 @@
    61.4 +Index: configure
    61.5 +--- configure.orig	2011-12-11 17:22:11.000000000 +0100
    61.6 ++++ configure	2011-12-24 11:54:19.000000000 +0100
    61.7 +@@ -3596,10 +3596,6 @@
    61.8 + $as_echo "$as_me: failed program was:" >&5
    61.9 + sed 's/^/| /' conftest.$ac_ext >&5
   61.10 + 
   61.11 +-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
   61.12 +-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
   61.13 +-as_fn_error 77 "C compiler cannot create executables
   61.14 +-See \`config.log' for more details" "$LINENO" 5; }
   61.15 + else
   61.16 +   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
   61.17 + $as_echo "yes" >&6; }
   61.18 +@@ -4729,10 +4725,7 @@
   61.19 + if $ac_preproc_ok; then :
   61.20 + 
   61.21 + else
   61.22 +-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
   61.23 +-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
   61.24 +-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
   61.25 +-See \`config.log' for more details" "$LINENO" 5; }
   61.26 ++    :
   61.27 + fi
   61.28 + 
   61.29 + ac_ext=c
   61.30 +Index: pcreposix.h
   61.31 +--- pcreposix.h.orig	2010-05-16 18:17:23.000000000 +0200
   61.32 ++++ pcreposix.h	2011-12-24 11:54:19.000000000 +0100
   61.33 +@@ -133,6 +133,12 @@
   61.34 + 
   61.35 + /* The functions */
   61.36 + 
   61.37 ++/* link-time symbol namespace conflict prevention */
   61.38 ++#define regcomp  pcreposix_regcomp
   61.39 ++#define regexec  pcreposix_regexec
   61.40 ++#define regerror pcreposix_regerror
   61.41 ++#define regfree  pcreposix_regfree
   61.42 ++
   61.43 + PCREPOSIX_EXP_DECL int regcomp(regex_t *, const char *, int);
   61.44 + PCREPOSIX_EXP_DECL int regexec(const regex_t *, const char *, size_t,
   61.45 +                      regmatch_t *, int);
    62.1 --- a/openpkg/perl.patch	Tue Jul 31 12:12:54 2012 +0200
    62.2 +++ b/openpkg/perl.patch	Tue Jul 31 12:23:42 2012 +0200
    62.3 @@ -4,123 +4,29 @@
    62.4  area is.
    62.5  
    62.6  Index: installperl
    62.7 ---- installperl.orig	2006-08-15 14:37:41 +0200
    62.8 -+++ installperl	2006-08-18 21:05:05 +0200
    62.9 -@@ -211,6 +211,8 @@
   62.10 - my $installarchlib = "$destdir$Config{installarchlib}";
   62.11 - my $installsitelib = "$destdir$Config{installsitelib}";
   62.12 - my $installsitearch = "$destdir$Config{installsitearch}";
   62.13 -+my $installvendorlib = "$destdir$Config{installvendorlib}";
   62.14 -+my $installvendorarch = "$destdir$Config{installvendorarch}";
   62.15 - my $installman1dir = "$destdir$Config{installman1dir}";
   62.16 +--- installperl.orig	2011-06-09 22:04:29.000000000 +0200
   62.17 ++++ installperl	2011-06-17 15:20:48.000000000 +0200
   62.18 +@@ -200,6 +200,8 @@
   62.19 + my $installarchlib = "$opts{destdir}$Config{installarchlib}";
   62.20 + my $installsitelib = "$opts{destdir}$Config{installsitelib}";
   62.21 + my $installsitearch = "$opts{destdir}$Config{installsitearch}";
   62.22 ++my $installvendorlib = "$opts{destdir}$Config{installvendorlib}";
   62.23 ++my $installvendorarch = "$opts{destdir}$Config{installvendorarch}";
   62.24 + my $installman1dir = "$opts{destdir}$Config{installman1dir}";
   62.25   my $man1ext = $Config{man1ext};
   62.26   my $libperl = $Config{libperl};
   62.27 -@@ -372,6 +374,8 @@
   62.28 - mkpath($installarchlib, $verbose, 0777);
   62.29 - mkpath($installsitelib, $verbose, 0777) if ($installsitelib);
   62.30 - mkpath($installsitearch, $verbose, 0777) if ($installsitearch);
   62.31 -+mkpath($installvendorlib, $verbose, 0777) if ($installvendorlib);
   62.32 -+mkpath($installvendorarch, $verbose, 0777) if ($installvendorarch);
   62.33 +@@ -349,6 +351,8 @@
   62.34 + mkpath($installarchlib, $opts{verbose}, 0777);
   62.35 + mkpath($installsitelib, $opts{verbose}, 0777) if ($installsitelib);
   62.36 + mkpath($installsitearch, $opts{verbose}, 0777) if ($installsitearch);
   62.37 ++mkpath($installvendorlib, $opts{verbose}, 0777) if ($installvendorlib);
   62.38 ++mkpath($installvendorarch, $opts{verbose}, 0777) if ($installvendorarch);
   62.39   
   62.40   if (chdir "lib") {
   62.41       $do_installarchlib = ! samepath($installarchlib, '.');
   62.42  
   62.43  -----------------------------------------------------------------------------
   62.44  
   62.45 -By default, the Perl module search order is "use lib, -I, PERL[5]LIB,
   62.46 -perl, site, vendor, other". This means that in OpenPKG both the modules
   62.47 -installed via CPAN shell (in "site" area) and the "perl-xxx" packages
   62.48 -(in "vendor" area) cannot override the (sometimes obsoleted) module
   62.49 -versions distributed with Perl (in "perl" area). Hence, we change
   62.50 -the search order to a more reasonable one for OpenPKG: "use lib, -I,
   62.51 -PERL[5]LIB, site, vendor, perl, other".
   62.52 -
   62.53 -Index: perl.c
   62.54 ---- perl.c.orig	2006-08-15 14:37:41 +0200
   62.55 -+++ perl.c	2006-08-18 21:08:14 +0200
   62.56 -@@ -4753,39 +4753,6 @@
   62.57 -     incpush(APPLLIB_EXP, TRUE, TRUE, TRUE, TRUE);
   62.58 - #endif
   62.59 - 
   62.60 --#ifdef ARCHLIB_EXP
   62.61 --    incpush(ARCHLIB_EXP, FALSE, FALSE, TRUE, TRUE);
   62.62 --#endif
   62.63 --#ifdef MACOS_TRADITIONAL
   62.64 --    {
   62.65 --	Stat_t tmpstatbuf;
   62.66 --    	SV * privdir = newSV(0);
   62.67 --	char * macperl = PerlEnv_getenv("MACPERL");
   62.68 --	
   62.69 --	if (!macperl)
   62.70 --	    macperl = "";
   62.71 --	
   62.72 --	Perl_sv_setpvf(aTHX_ privdir, "%slib:", macperl);
   62.73 --	if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
   62.74 --	    incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
   62.75 --	Perl_sv_setpvf(aTHX_ privdir, "%ssite_perl:", macperl);
   62.76 --	if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
   62.77 --	    incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
   62.78 --	
   62.79 --   	SvREFCNT_dec(privdir);
   62.80 --    }
   62.81 --    if (!PL_tainting)
   62.82 --	incpush(":", FALSE, FALSE, TRUE, FALSE);
   62.83 --#else
   62.84 --#ifndef PRIVLIB_EXP
   62.85 --#  define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
   62.86 --#endif
   62.87 --#if defined(WIN32)
   62.88 --    incpush(PRIVLIB_EXP, TRUE, FALSE, TRUE, TRUE);
   62.89 --#else
   62.90 --    incpush(PRIVLIB_EXP, FALSE, FALSE, TRUE, TRUE);
   62.91 --#endif
   62.92 --
   62.93 - #ifdef SITEARCH_EXP
   62.94 -     /* sitearch is always relative to sitelib on Windows for
   62.95 -      * DLL-based path intuition to work correctly */
   62.96 -@@ -4828,6 +4795,39 @@
   62.97 -     incpush(PERL_VENDORLIB_STEM, FALSE, TRUE, TRUE, TRUE);
   62.98 - #endif
   62.99 - 
  62.100 -+#ifdef ARCHLIB_EXP
  62.101 -+    incpush(ARCHLIB_EXP, FALSE, FALSE, TRUE, TRUE);
  62.102 -+#endif
  62.103 -+#ifdef MACOS_TRADITIONAL
  62.104 -+    {
  62.105 -+	Stat_t tmpstatbuf;
  62.106 -+    	SV * privdir = newSV(0);
  62.107 -+	char * macperl = PerlEnv_getenv("MACPERL");
  62.108 -+	
  62.109 -+	if (!macperl)
  62.110 -+	    macperl = "";
  62.111 -+	
  62.112 -+	Perl_sv_setpvf(aTHX_ privdir, "%slib:", macperl);
  62.113 -+	if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  62.114 -+	    incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
  62.115 -+	Perl_sv_setpvf(aTHX_ privdir, "%ssite_perl:", macperl);
  62.116 -+	if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  62.117 -+	    incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
  62.118 -+	
  62.119 -+   	SvREFCNT_dec(privdir);
  62.120 -+    }
  62.121 -+    if (!PL_tainting)
  62.122 -+	incpush(":", FALSE, FALSE, TRUE, FALSE);
  62.123 -+#else
  62.124 -+#ifndef PRIVLIB_EXP
  62.125 -+#  define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
  62.126 -+#endif
  62.127 -+#if defined(WIN32)
  62.128 -+    incpush(PRIVLIB_EXP, TRUE, FALSE, TRUE, TRUE);
  62.129 -+#else
  62.130 -+    incpush(PRIVLIB_EXP, FALSE, FALSE, TRUE, TRUE);
  62.131 -+#endif
  62.132 -+
  62.133 - #ifdef PERL_OTHERLIBDIRS
  62.134 -     incpush(PERL_OTHERLIBDIRS, TRUE, TRUE, TRUE, TRUE);
  62.135 - #endif
  62.136 -
  62.137 ------------------------------------------------------------------------------
  62.138 -
  62.139  Port to [Open]Darwin 6.6.2:
  62.140  
  62.141  1. In OpenPKG, Perl does not use the vendor GCC and our GCC does not
  62.142 @@ -135,19 +41,30 @@
  62.143     related to the non-standard "__private_extern__" attribute.
  62.144  
  62.145  Index: hints/darwin.sh
  62.146 ---- hints/darwin.sh.orig	2006-08-15 14:37:41 +0200
  62.147 -+++ hints/darwin.sh	2006-08-18 21:05:05 +0200
  62.148 -@@ -120,9 +120,6 @@
  62.149 -   *-2147483648) ccflags="${ccflags} -DINT32_MIN_BROKEN -DINT64_MIN_BROKEN" ;;
  62.150 - esac
  62.151 - 
  62.152 --# Avoid Apple's cpp precompiler, better for extensions
  62.153 --cppflags="${cppflags} -no-cpp-precomp"
  62.154 --
  62.155 - # This is necessary because perl's build system doesn't
  62.156 - # apply cppflags to cc compile lines as it should.
  62.157 - ccflags="${ccflags} ${cppflags}"
  62.158 -@@ -182,8 +179,7 @@
  62.159 +--- hints/darwin.sh.orig	2011-09-19 15:18:22.000000000 +0200
  62.160 ++++ hints/darwin.sh	2011-12-24 12:00:58.000000000 +0100
  62.161 +@@ -181,6 +181,20 @@
  62.162 +    ldflags="${ldflags} -flat_namespace"
  62.163 +    lddlflags="${ldflags} -bundle -undefined suppress"
  62.164 +    ;;
  62.165 ++9.*)
  62.166 ++   lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
  62.167 ++   case "$ld" in
  62.168 ++       *MACOSX_DEVELOPMENT_TARGET*) ;;
  62.169 ++       *) ld="env MACOSX_DEPLOYMENT_TARGET=10.5 ${ld}" ;;
  62.170 ++   esac
  62.171 ++   ;;
  62.172 ++10.*)
  62.173 ++   lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
  62.174 ++   case "$ld" in
  62.175 ++       *MACOSX_DEVELOPMENT_TARGET*) ;;
  62.176 ++       *) ld="env MACOSX_DEPLOYMENT_TARGET=10.6 ${ld}" ;;
  62.177 ++   esac
  62.178 ++   ;;
  62.179 + *) 
  62.180 +    lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
  62.181 +    case "$ld" in
  62.182 +@@ -191,8 +205,7 @@
  62.183   esac
  62.184   ldlibpthname='DYLD_LIBRARY_PATH';
  62.185   
  62.186 @@ -157,24 +74,13 @@
  62.187   
  62.188   cat > UU/archname.cbu <<'EOCBU'
  62.189   # This script UU/archname.cbu will get 'called-back' by Configure 
  62.190 -Index: perlio.c
  62.191 ---- perlio.c.orig	2006-08-15 14:37:41 +0200
  62.192 -+++ perlio.c	2006-08-18 21:05:05 +0200
  62.193 -@@ -472,7 +472,14 @@
  62.194 - #include <unistd.h>
  62.195 - #endif
  62.196 - #ifdef HAS_MMAP
  62.197 -+#ifdef PERL_DARWIN
  62.198 -+#define environ_safe environ
  62.199 -+#undef environ
  62.200 - #include <sys/mman.h>
  62.201 -+#define environ environ_safe
  62.202 -+#else
  62.203 -+#include <sys/mman.h>
  62.204 -+#endif
  62.205 - #endif
  62.206 - 
  62.207 - void
  62.208 +@@ -326,3 +339,6 @@
  62.209 + # makefile in the same place.  Since Darwin uses GNU make, this dodges
  62.210 + # the problem.
  62.211 + firstmakefile=GNUmakefile;
  62.212 ++
  62.213 ++usenm='false'
  62.214 ++
  62.215  
  62.216  -----------------------------------------------------------------------------
  62.217  
  62.218 @@ -187,8 +93,8 @@
  62.219  it works at all.
  62.220  
  62.221  Index: hints/dec_osf.sh
  62.222 ---- hints/dec_osf.sh.orig	2007-12-18 11:47:07 +0100
  62.223 -+++ hints/dec_osf.sh	2007-12-19 12:31:37 +0100
  62.224 +--- hints/dec_osf.sh.orig	2011-06-17 02:06:09.000000000 +0200
  62.225 ++++ hints/dec_osf.sh	2011-06-17 15:20:48.000000000 +0200
  62.226  @@ -73,15 +73,6 @@
  62.227   *)            if $test "X$optimize" = "X$undef"; then
  62.228                         lddlflags="$lddlflags -msym"
  62.229 @@ -208,27 +114,32 @@
  62.230  
  62.231  -----------------------------------------------------------------------------
  62.232  
  62.233 +Linker flag change for Solaris.
  62.234 +
  62.235  Index: Configure
  62.236 ---- Configure.orig	2006-08-15 14:37:40 +0200
  62.237 -+++ Configure	2006-08-18 21:05:05 +0200
  62.238 -@@ -7871,7 +7871,7 @@
  62.239 +--- Configure.orig	2011-06-09 22:04:29.000000000 +0200
  62.240 ++++ Configure	2011-06-17 15:20:48.000000000 +0200
  62.241 +@@ -8078,9 +8058,9 @@
  62.242   			      ;;
  62.243   			linux|irix*|gnu*)  dflt="-shared $optimize" ;;
  62.244   			next)  dflt='none' ;;
  62.245  -			solaris) dflt='-G' ;;
  62.246  +			solaris) dflt='-shared' ;;
  62.247   			sunos) dflt='-assert nodefinitions' ;;
  62.248 - 			svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
  62.249 +-			svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
  62.250 ++			svr4*|esix*|nonstopux) dflt="-shared $ldflags" ;;
  62.251   	        *)     dflt='none' ;;
  62.252 + 			esac
  62.253 + 			;;
  62.254  
  62.255  -----------------------------------------------------------------------------
  62.256  
  62.257  Security Fix (CVE-2005-3962, OpenPKG-SA-2005.025-perl)
  62.258  
  62.259  Index: sv.c
  62.260 ---- sv.c.orig	2006-08-15 14:37:41 +0200
  62.261 -+++ sv.c	2006-08-18 21:05:05 +0200
  62.262 -@@ -8667,7 +8667,10 @@
  62.263 +--- sv.c.orig	2011-06-17 02:06:09.000000000 +0200
  62.264 ++++ sv.c	2011-06-17 15:20:48.000000000 +0200
  62.265 +@@ -10198,7 +10198,10 @@
  62.266   	if ( (width = expect_number(&q)) ) {
  62.267   	    if (*q == '$') {
  62.268   		++q;
  62.269 @@ -243,17 +154,106 @@
  62.270  
  62.271  -----------------------------------------------------------------------------
  62.272  
  62.273 -Corrections for Solaris 11:
  62.274 +Do not use -fstack-protector as it causes too much portability issues.
  62.275  
  62.276 -Index: perl.h
  62.277 -diff -Nau perl.h.orig perl.h
  62.278 ---- perl.h.orig	2007-12-18 11:47:08.000000000 +0100
  62.279 -+++ perl.h	2009-01-06 15:28:45.843276063 +0100
  62.280 -@@ -1393,6 +1393,7 @@
  62.281 -  */
  62.282 +Index: Configure
  62.283 +--- Configure.orig	2011-06-09 22:04:29.000000000 +0200
  62.284 ++++ Configure	2011-06-17 15:20:48.000000000 +0200
  62.285 +@@ -5158,17 +5158,6 @@
  62.286 + 		;;
  62.287 + 	esac
  62.288   
  62.289 - #if defined(I_SYSMODE) && !defined(PERL_MICRO)
  62.290 -+#include <sys/vnode.h>
  62.291 - #include <sys/mode.h>
  62.292 - #endif
  62.293 +-	# on x86_64 (at least) we require an extra library (libssp) in the
  62.294 +-	# link command line. This library is not named, so I infer that it is
  62.295 +-	# an implementation detail that may change. Hence the safest approach
  62.296 +-	# is to add the flag to the flags passed to the compiler at link time,
  62.297 +-	# as that way the compiler can do the right implementation dependant
  62.298 +-	# thing. (NWC)
  62.299 +-	case "$gccversion" in
  62.300 +-	?*)	set stack-protector -fstack-protector
  62.301 +-		eval $checkccflag
  62.302 +-		;;
  62.303 +-	esac
  62.304 + 	;;
  62.305 + esac
  62.306   
  62.307 +@@ -5307,15 +5296,6 @@
  62.308 + 	;;
  62.309 + *) dflt="$ldflags";;
  62.310 + esac
  62.311 +-# See note above about -fstack-protector
  62.312 +-case "$ccflags" in
  62.313 +-*-fstack-protector*) 
  62.314 +-	case "$dflt" in
  62.315 +-	*-fstack-protector*) ;; # Don't add it again
  62.316 +-	*) dflt="$dflt -fstack-protector" ;; 
  62.317 +-	esac
  62.318 +-	;;
  62.319 +-esac
  62.320 + 
  62.321 + : Try to guess additional flags to pick up local libraries.
  62.322 + for thislibdir in $libpth; do
  62.323 +@@ -8107,14 +8087,6 @@
  62.324 + 	''|' ') dflt='none' ;;
  62.325 + 	esac
  62.326 + 
  62.327 +-	case "$ldflags" in
  62.328 +-	*-fstack-protector*)
  62.329 +-	    case "$dflt" in
  62.330 +-			*-fstack-protector*) ;; # Don't add it again
  62.331 +-			*) dflt="$dflt -fstack-protector" ;; 
  62.332 +-		esac
  62.333 +-		;;
  62.334 +-	esac
  62.335 + 
  62.336 + 
  62.337 +     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
  62.338 +
  62.339 +-----------------------------------------------------------------------------
  62.340 +
  62.341 +Make sure we install into <prefix>/lib/perl/ and not <prefix>/lib/perl5/
  62.342 +
  62.343 +Index: Configure
  62.344 +--- Configure.orig	2009-08-24 18:33:49 +0200
  62.345 ++++ Configure	2009-08-24 18:44:39 +0200
  62.346 +@@ -1769,7 +1769,7 @@
  62.347 + touch posthint.sh
  62.348 + 
  62.349 + : set package name
  62.350 +-package='perl5'
  62.351 ++package='perl'
  62.352 + first=`echo $package | sed -e 's/^\(.\).*/\1/'`
  62.353 + last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
  62.354 + case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
  62.355 +
  62.356 +-----------------------------------------------------------------------------
  62.357 +
  62.358 +Linking against just libgdbm_compat under at least SUSE fails 
  62.359 +because it also needs libgdbm (which Perl doesn't pick up, too)
  62.360 +
  62.361 +Index: hints/linux.sh
  62.362 +--- hints/linux.sh.orig	2011-06-09 22:04:29.000000000 +0200
  62.363 ++++ hints/linux.sh	2011-06-17 15:20:48.000000000 +0200
  62.364 +@@ -55,7 +55,9 @@
  62.365 + libswanted="$*"
  62.366 + 
  62.367 + # Debian 4.0 puts ndbm in the -lgdbm_compat library.
  62.368 +-libswanted="$libswanted gdbm_compat"
  62.369 ++if [ -f /etc/debian_version -o -f /etc/ubuntu_version ]; then
  62.370 ++    libswanted="$libswanted gdbm_compat"
  62.371 ++fi
  62.372 + 
  62.373 + # If you have glibc, then report the version for ./myconfig bug reporting.
  62.374 + # (Configure doesn't need to know the specific version since it just uses
  62.375 +
  62.376 +Index: Configure
  62.377 +--- Configure.orig	2012-05-31 14:59:16.000000000 +0200
  62.378 ++++ Configure	2012-05-31 15:04:27.000000000 +0200
  62.379 +@@ -22206,6 +22206,7 @@
  62.380 +     for xxx in *; do
  62.381 + 	case "$xxx" in
  62.382 + 	    DynaLoader|dynaload) ;;
  62.383 ++        \* ) ;;
  62.384 + 	    *)
  62.385 + 	    this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
  62.386 + 	    leaf=`echo $xxx | $sed -e s/.*-//`;
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/openpkg/popt.patch	Tue Jul 31 12:23:42 2012 +0200
    63.3 @@ -0,0 +1,64 @@
    63.4 +Index: popt.c
    63.5 +--- popt.c.orig	2009-04-12 20:14:38.000000000 +0200
    63.6 ++++ popt.c	2010-04-30 21:31:41.000000000 +0200
    63.7 +@@ -520,6 +520,11 @@
    63.8 +     }
    63.9 + 
   63.10 +     if (con->leftovers != NULL && con->numLeftovers > 0) {
   63.11 ++#if defined(OPENPKG)
   63.12 ++	/* Revert back to the old behaviour of passing to "exec" programs an
   63.13 ++	   extra "--" argument to clearly separate options and arguments. */
   63.14 ++	argv[argc++] = "--";
   63.15 ++#endif
   63.16 + 	memcpy(argv + argc, con->leftovers, sizeof(*argv) * con->numLeftovers);
   63.17 + 	argc += con->numLeftovers;
   63.18 +     }
   63.19 +@@ -697,10 +702,19 @@
   63.20 + 	    /*@switchbreak@*/ break;
   63.21 + #endif
   63.22 + 	case '!':
   63.23 ++#if defined(OPENPKG)
   63.24 ++	    /* allow standard "!#:+" (first argument is expanded multiple times)
   63.25 ++               and non-standard "!#:*" (all arguments are expanded in sequence) */
   63.26 ++	    if (!(s[0] == '#' && s[1] == ':' && (s[2] == '+' || s[2] == '*')))
   63.27 ++#else
   63.28 + 	    if (!(s[0] == '#' && s[1] == ':' && s[2] == '+'))
   63.29 ++#endif
   63.30 + 		/*@switchbreak@*/ break;
   63.31 +-	    /* XXX Make sure that findNextArg deletes only next arg. */
   63.32 ++#if defined(OPENPKG)
   63.33 ++	    if (a == NULL || s[2] == '*') {
   63.34 ++#else
   63.35 + 	    if (a == NULL) {
   63.36 ++#endif
   63.37 + 		if ((a = findNextArg(con, 1U, 1)) == NULL)
   63.38 + 		    /*@switchbreak@*/ break;
   63.39 + 	    }
   63.40 +Index: poptconfig.c
   63.41 +--- poptconfig.c.orig	2009-04-12 20:14:38.000000000 +0200
   63.42 ++++ poptconfig.c	2010-04-30 21:32:23.000000000 +0200
   63.43 +@@ -42,7 +42,10 @@
   63.44 + /*@=declundef =exportheader =incondefs =protoparammatch =redecl =type @*/
   63.45 + #endif	/* __LCLINT__ */
   63.46 + 
   63.47 +-#if !defined(__GLIBC__)
   63.48 ++#if defined(__NetBSD__)
   63.49 ++#include <sys/param.h>
   63.50 ++#endif
   63.51 ++#if !defined(__GLIBC__) && (!defined(__NetBSD__) || __NetBSD_Version__ < 599001100)
   63.52 + /* Return nonzero if PATTERN contains any metacharacters.
   63.53 +    Metacharacters can be quoted with backslashes if QUOTE is nonzero.  */
   63.54 + static int
   63.55 +Index: popthelp.c
   63.56 +--- popthelp.c.orig	2009-04-12 20:14:38.000000000 +0200
   63.57 ++++ popthelp.c	2010-04-30 21:31:41.000000000 +0200
   63.58 +@@ -15,7 +15,9 @@
   63.59 + #include <sys/ioctl.h>
   63.60 + #endif
   63.61 + 
   63.62 ++#if !defined(OPENPKG)
   63.63 + #define	POPT_WCHAR_HACK
   63.64 ++#endif
   63.65 + #ifdef 	POPT_WCHAR_HACK
   63.66 + #include <wchar.h>			/* for mbsrtowcs */
   63.67 + /*@access mbstate_t @*/
    64.1 --- a/openpkg/rc	Tue Jul 31 12:12:54 2012 +0200
    64.2 +++ b/openpkg/rc	Tue Jul 31 12:23:42 2012 +0200
    64.3 @@ -1,15 +1,14 @@
    64.4  #!@l_prefix@/lib/openpkg/bash --noprofile
    64.5  ##
    64.6 -##  rc -- OpenPKG Runcommand Processor
    64.7 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    64.8 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    64.9 +##  rc -- OpenPKG Run-Command Processor
   64.10 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
   64.11  ##
   64.12 -##  Permission to use, copy, modify, and distribute this software for
   64.13 -##  any purpose with or without fee is hereby granted, provided that
   64.14 -##  the above copyright notice and this permission notice appear in all
   64.15 -##  copies.
   64.16 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   64.17 +##  All rights reserved. Licenses which grant limited permission to use,
   64.18 +##  copy, modify and distribute this software are available from the
   64.19 +##  OpenPKG GmbH.
   64.20  ##
   64.21 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   64.22 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   64.23  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   64.24  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   64.25  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   64.26 @@ -29,8 +28,8 @@
   64.27  
   64.28  #   program name, version and date
   64.29  progname="rc"
   64.30 -progvers="1.2.0"
   64.31 -progdate="28-Jul-2003"
   64.32 +progvers="1.2.1"
   64.33 +progdate="2007-12-27"
   64.34  
   64.35  #   path to OpenPKG instance
   64.36  prefix="@l_prefix@"
   64.37 @@ -49,6 +48,42 @@
   64.38  "
   64.39  
   64.40  ##
   64.41 +##  temporary file handling
   64.42 +##
   64.43 +
   64.44 +#   establish secure temporary directory
   64.45 +i=0
   64.46 +while [ $i -lt 10 ]; do
   64.47 +   tmpdir="/tmp/rc-`date '+%Y%m%d%H%M%S'`-$$"
   64.48 +   (umask 022; mkdir $tmpdir >/dev/null 2>&1) && break
   64.49 +   i=$(($i + 1))
   64.50 +   sleep 1
   64.51 +done
   64.52 +if [ $i -eq 10 ]; then
   64.53 +    echo "openpkg:rc:ERROR: unable to establish secure temporary directory" 1>&2
   64.54 +    exit 1
   64.55 +fi
   64.56 +declare -r tmpdir
   64.57 +cleanup () {
   64.58 +    if [ ".$tmpdir" != . ]; then
   64.59 +        if [ -d $tmpdir ]; then
   64.60 +            rm -rf $tmpdir >/dev/null 2>&1 || true
   64.61 +        fi
   64.62 +    fi
   64.63 +}
   64.64 +trap "cleanup; trap - EXIT INT ABRT QUIT TERM" EXIT INT ABRT QUIT TERM
   64.65 +
   64.66 +#   determine reasonable temporary files
   64.67 +tmpfile="$tmpdir/rc.tmp"
   64.68 +outfile="$tmpdir/rc.out"
   64.69 +errfile="$tmpdir/rc.err"
   64.70 +allfile="$tmpdir/rc.all"
   64.71 +deffile="$tmpdir/rc.def"
   64.72 +
   64.73 +#   initialize files
   64.74 +cp /dev/null $deffile
   64.75 +
   64.76 +##
   64.77  ##  command line option parsing
   64.78  ##
   64.79  
   64.80 @@ -65,12 +100,7 @@
   64.81  
   64.82  #   iterate over argument line
   64.83  while [ $# -gt 0 ]; do
   64.84 -    opt=$1
   64.85 -    case $opt in
   64.86 -        -*=*) arg=${opt/-*=/} ;;
   64.87 -           *) arg='' ;;
   64.88 -    esac
   64.89 -    case $opt in
   64.90 +    case "$1" in
   64.91          -s|--silent  ) silent=1      ;;
   64.92          -v|--verbose ) verbose=1     ;;
   64.93          -d|--debug   ) debug=1       ;;
   64.94 @@ -80,8 +110,12 @@
   64.95          -e|--eval    ) eval=1        ;;
   64.96          -c|--config  ) config=1      ;;
   64.97          -q|--query   ) query=1       ;;
   64.98 -        -*           ) help="Invalid option \`$opt'"; break ;;
   64.99 -        *            ) break         ;;
  64.100 +        -D|--define  ) echo "@$2" | \
  64.101 +                       sed -e "s;';\\\\';g" | \
  64.102 +                       sed -e "s;^@\\([a-z][a-zA-Z0-9_]*\\)=\\(.*\\)\$;\1='\2';" \
  64.103 +                           -e "s;^@.*;;" >>$deffile; shift ;;
  64.104 +        -*           ) help="Invalid option \`$1'"; break ;;
  64.105 +        *            ) break ;;
  64.106      esac
  64.107      shift
  64.108  done
  64.109 @@ -92,7 +126,7 @@
  64.110          echo "$progname:ERROR: $help" 1>&2
  64.111      fi
  64.112      echo "Usage: $progname [-s|--silent] [-v|--verbose] [-d|--debug] [-k|--keep] [-h|--help]" 1>&2
  64.113 -    echo "       [-p|--print] [-e|--eval] [-c|--config] [-q|--query]" 1>&2
  64.114 +    echo "       [-p|--print] [-e|--eval] [-c|--config] [-q|--query] [-D|--define <name>=<value>]" 1>&2
  64.115      echo "       <package> <command> [<command> ...]"  1>&2
  64.116      if [ ".$help" != ".Usage" ]; then
  64.117          exit 1
  64.118 @@ -117,30 +151,11 @@
  64.119  
  64.120  #   extend run-time environment with local OpenPKG tools (shtool, rpmtool, etc)
  64.121  PATH_ORIG="$PATH"
  64.122 +PATH="$prefix/lib/openpkg/fallback:$PATH"
  64.123  PATH="$prefix/bin:$PATH"
  64.124  PATH="$prefix/sbin:$PATH"
  64.125  PATH="$prefix/lib/openpkg:$PATH"
  64.126 -
  64.127 -#   establish secure temporary directory
  64.128 -i=0
  64.129 -while [ $i -lt 10 ]; do
  64.130 -   tmpdir="/tmp/rc-`date '+%Y%m%d%H%M%S'`-$$"
  64.131 -   (umask 022; mkdir $tmpdir >/dev/null 2>&1) && break
  64.132 -   i=$(($i + 1))
  64.133 -   sleep 1
  64.134 -done
  64.135 -if [ $i -eq 10 ]; then
  64.136 -    echo "openpkg:rc:ERROR: unable to establish secure temporary directory" 1>&2
  64.137 -    exit 1
  64.138 -fi
  64.139 -declare -r tmpdir
  64.140 -trap "trap - EXIT INT ABRT QUIT TERM; rm -rf $tmpdir >/dev/null 2>&1 || true" EXIT INT ABRT QUIT TERM
  64.141 -
  64.142 -#   determine reasonable temporary files
  64.143 -tmpfile="$tmpdir/rc.tmp"
  64.144 -outfile="$tmpdir/rc.out"
  64.145 -errfile="$tmpdir/rc.err"
  64.146 -allfile="$tmpdir/rc.all"
  64.147 +PATH="$prefix/lib/openpkg/override:$PATH"
  64.148  
  64.149  #   handle --query option
  64.150  if [ ".$query" = .1 ]; then
  64.151 @@ -149,6 +164,7 @@
  64.152      touch $tmpfile
  64.153      sed <$rcdir/rc.openpkg >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  64.154      echo ". $rcconf" >>$tmpfile
  64.155 +    echo ". $deffile" >>$tmpfile
  64.156      scripts=`/bin/ls $rcdir/rc.* | sed -e "s;^$rcdir/rc\.;;" | egrep -v '^openpkg$'`
  64.157      for s_name in $scripts; do
  64.158          sed <$rcdir/rc.$s_name >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  64.159 @@ -157,6 +173,7 @@
  64.160  
  64.161      #   apply override values to get effective values
  64.162      . $rcconf
  64.163 +    . $deffile
  64.164  
  64.165      #   display variable value
  64.166      for var in $*; do
  64.167 @@ -174,6 +191,7 @@
  64.168      touch $tmpfile
  64.169      sed <$rcdir/rc.openpkg >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  64.170      echo ". $rcconf" >>$tmpfile
  64.171 +    echo ". $deffile" >>$tmpfile
  64.172      scripts=`/bin/ls $rcdir/rc.* | sed -e "s;^$rcdir/rc\.;;" | egrep -v '^openpkg$'`
  64.173      for s_name in $scripts; do
  64.174          sed <$rcdir/rc.$s_name >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  64.175 @@ -192,6 +210,7 @@
  64.176  
  64.177      #   apply override values to get effective values
  64.178      . $rcconf
  64.179 +    . $deffile
  64.180  
  64.181      #   determine how to print in bold mode in case output
  64.182      #   is connected to a terminal device
  64.183 @@ -237,20 +256,48 @@
  64.184  scripts="${1/*rc./}"
  64.185  shift
  64.186  isall=0
  64.187 +if [ ".$scripts" = ".cron" ]; then
  64.188 +    #   "cron" is an "all" with a random delay (to ensure that multiple
  64.189 +    #   OpenPKG instances do not all startup at exactly the same time)
  64.190 +    #   plus a mutex lock to ensure that multiple OpenPKG cron tasks of
  64.191 +    #   the same OpenPKG instance do not stumble over each other).
  64.192 +
  64.193 +    #   determine delay range and timeout
  64.194 +    case "${1-quarterly}" in
  64.195 +        monthly     ) delay=1800; timeout=28800 ;; # 30m /  8h
  64.196 +        weekly      ) delay=1800; timeout=14400 ;; # 30m /  4h
  64.197 +        daily       ) delay=900;  timeout=7200  ;; # 15m /  2h
  64.198 +        hourly      ) delay=600;  timeout=3600  ;; #  5m /  1h
  64.199 +        quarterly|* ) delay=30;   timeout=900   ;; # 30s / 15m
  64.200 +    esac
  64.201 +
  64.202 +    #   apply random run-time delay
  64.203 +    #   (hint: $RANDOM is a random value 0..32767)
  64.204 +    sleep $(( ($RANDOM * $delay) / 32767 ))
  64.205 +
  64.206 +    #   wrap ourself for mutual exclusion run-time
  64.207 +    #   and then perform the "all" command
  64.208 +    cleanup
  64.209 +    exec $prefix/lib/openpkg/mutex \
  64.210 +        -t $timeout $prefix/RPM/TMP/openpkg-rc-cron.mutex \
  64.211 +        sh -c "exec $0 all $*" || exit $?
  64.212 +fi
  64.213  if [ ".$scripts" = ".all" ]; then
  64.214      isall=1
  64.215      . $rcconf
  64.216 -    if [ ".$openpkg_runall" != . ]; then
  64.217 -        #   backward compatibility only
  64.218 -        echo "openpkg:rc:WARNING: variable \"openpkg_runall\" was renamed to \"openpkg_rc_all\"." 1>&2
  64.219 -        echo "openpkg:rc:WARNING: value of deprecated variable \"openpkg_runall\" taken over for compatibility." 1>&2
  64.220 -        echo "openpkg:rc:WARNING: please update your local configuration in \"$rcconf\"." 1>&2
  64.221 -        openpkg_rc_all="$openpkg_runall"
  64.222 -    fi
  64.223 +    . $deffile
  64.224      case "$openpkg_rc_all" in
  64.225          [Nn][Oo] | [Ff][Aa][Ll][Ss][Ee] | [Oo][Ff][Ff] | 0 ) exit 0 ;;
  64.226      esac
  64.227      scripts=`/bin/ls $rcdir/rc.* | sed -e "s;^$rcdir/rc\.;;"`
  64.228 +
  64.229 +    #   the "all" target is usually called from system startup scripts,
  64.230 +    #   and we really want to ensure that no potentially corrupt
  64.231 +    #   (because of an unclean shutdown of the system) RPM DB journal
  64.232 +    #   files are staying around and preventing the startup of the
  64.233 +    #   OpenPKG instance. When called manually it also doesn't hurt to
  64.234 +    #   cleanup.
  64.235 +    rm -f $prefix/RPM/DB/__db.* >/dev/null 2>&1 || true
  64.236  else
  64.237      if [ ! -f "$rcdir/rc.$scripts" ]; then
  64.238          echo "openpkg:rc:ERROR: package \"$scripts\" not found" 1>&2
  64.239 @@ -269,6 +316,9 @@
  64.240      exit 1
  64.241  fi
  64.242  
  64.243 +#   just call OpenPKG RPM to let it once perform the run-time integrity checks
  64.244 +$prefix/bin/openpkg rpm -q openpkg >/dev/null || exit $?
  64.245 +
  64.246  #   iterate over the specified commands
  64.247  rv=0
  64.248  cmds="$*"
  64.249 @@ -397,6 +447,7 @@
  64.250          #   rc.conf to override the default of $openpkg_rc_def, too.
  64.251          sed <$rcdir/rc.openpkg >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  64.252          echo ". $rcconf" >>$tmpfile
  64.253 +        echo ". $deffile" >>$tmpfile
  64.254          l_scripts=`/bin/ls $rcdir/rc.* | sed -e "s;^$rcdir/rc\.;;" | egrep -v '^openpkg$'`
  64.255          for l_name in $l_scripts; do
  64.256              sed <$rcdir/rc.$l_name >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  64.257 @@ -404,6 +455,7 @@
  64.258  
  64.259          #   generate: inclusion of the application of override variables
  64.260          echo ". $rcconf" >>$tmpfile
  64.261 +        echo ". $deffile" >>$tmpfile
  64.262  
  64.263          #   for --eval redirect stderr and stdout (but remember stdout)
  64.264          #   (let stderr pass unfiltered in case of debug mode)
  64.265 @@ -492,6 +544,7 @@
  64.266              #   rc.conf to override the default of $openpkg_rc_def, too.
  64.267              sed <$rcdir/rc.openpkg >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  64.268              echo ". $rcconf" >>$tmpfile
  64.269 +            echo ". $deffile" >>$tmpfile
  64.270              l_scripts=`/bin/ls $rcdir/rc.* | sed -e "s;^$rcdir/rc\.;;" | egrep -v '^openpkg$'`
  64.271              for l_name in $l_scripts; do
  64.272                  sed <$rcdir/rc.$l_name >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  64.273 @@ -499,6 +552,7 @@
  64.274  
  64.275              #   generate: inclusion of the application of override variables
  64.276              echo ". $rcconf" >>$tmpfile
  64.277 +            echo ". $deffile" >>$tmpfile
  64.278  
  64.279              #   generate: %common section and particular command section
  64.280              sed <$rcdir/rc.$s_name >>$tmpfile -e "1,/^%common/d" -e '/^%.*/,$d'
    65.1 --- a/openpkg/rc.8	Tue Jul 31 12:12:54 2012 +0200
    65.2 +++ b/openpkg/rc.8	Tue Jul 31 12:23:42 2012 +0200
    65.3 @@ -1,15 +1,7 @@
    65.4 -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
    65.5 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
    65.6  .\"
    65.7  .\" Standard preamble:
    65.8  .\" ========================================================================
    65.9 -.de Sh \" Subsection heading
   65.10 -.br
   65.11 -.if t .Sp
   65.12 -.ne 5
   65.13 -.PP
   65.14 -\fB\\$1\fR
   65.15 -.PP
   65.16 -..
   65.17  .de Sp \" Vertical space (when we can't use .PP)
   65.18  .if t .sp .5v
   65.19  .if n .sp
   65.20 @@ -25,11 +17,11 @@
   65.21  ..
   65.22  .\" Set up some character translations and predefined strings.  \*(-- will
   65.23  .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   65.24 -.\" double quote, and \*(R" will give a right double quote.  | will give a
   65.25 -.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
   65.26 -.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
   65.27 -.\" expand to `' in nroff, nothing in troff, for use with C<>.
   65.28 -.tr \(*W-|\(bv\*(Tr
   65.29 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
   65.30 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
   65.31 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
   65.32 +.\" nothing in troff, for use with C<>.
   65.33 +.tr \(*W-
   65.34  .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   65.35  .ie n \{\
   65.36  .    ds -- \(*W-
   65.37 @@ -48,22 +40,25 @@
   65.38  .    ds R" ''
   65.39  'br\}
   65.40  .\"
   65.41 +.\" Escape single quotes in literal strings from groff's Unicode transform.
   65.42 +.ie \n(.g .ds Aq \(aq
   65.43 +.el       .ds Aq '
   65.44 +.\"
   65.45  .\" If the F register is turned on, we'll generate index entries on stderr for
   65.46 -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
   65.47 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
   65.48  .\" entries marked with X<> in POD.  Of course, you'll have to process the
   65.49  .\" output yourself in some meaningful fashion.
   65.50 -.if \nF \{\
   65.51 +.ie \nF \{\
   65.52  .    de IX
   65.53  .    tm Index:\\$1\t\\n%\t"\\$2"
   65.54  ..
   65.55  .    nr % 0
   65.56  .    rr F
   65.57  .\}
   65.58 -.\"
   65.59 -.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   65.60 -.\" way too many mistakes in technical documents.
   65.61 -.hy 0
   65.62 -.if n .na
   65.63 +.el \{\
   65.64 +.    de IX
   65.65 +..
   65.66 +.\}
   65.67  .\"
   65.68  .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   65.69  .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   65.70 @@ -130,24 +125,28 @@
   65.71  .\"
   65.72  .IX Title "RC 8"
   65.73  .TH RC 8 "OpenPKG" "RC(8)" "OpenPKG"
   65.74 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   65.75 +.\" way too many mistakes in technical documents.
   65.76 +.if n .ad l
   65.77 +.nh
   65.78  .SH "NAME"
   65.79 -\&\fB@l_prefix@/bin/openpkg rc\fR \- OpenPKG Run\-Command Processor
   65.80 +@l_prefix@/bin/openpkg rc \- OpenPKG Run\-Command Processor
   65.81  .SH "SYNOPSIS"
   65.82  .IX Header "SYNOPSIS"
   65.83 -\&\fB@l_prefix@/bin/openpkg rc\fR [\fB\-s\fR|\fB\-\-silent\fR] [\fB\-v\fR|\fB\-\-verbose\fR] [\fB\-d\fR|\fB\-\-debug\fR] [\fB\-k\fR|\fB\-\-keep\fR] \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]
   65.84 +\&\fB\f(CB@l_prefix\fB@/bin/openpkg rc\fR [\fB\-s\fR|\fB\-\-silent\fR] [\fB\-v\fR|\fB\-\-verbose\fR] [\fB\-d\fR|\fB\-\-debug\fR] [\fB\-k\fR|\fB\-\-keep\fR] [\fB\-D\fR|\fB\-\-define\fR \fIname\fR=\fIvalue\fR] \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]
   65.85  .PP
   65.86 -\&\fB@l_prefix@/bin/openpkg rc\fR \fB\-p\fR|\fB\-\-print\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]
   65.87 +\&\fB\f(CB@l_prefix\fB@/bin/openpkg rc\fR \fB\-p\fR|\fB\-\-print\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]
   65.88  .PP
   65.89 -eval `\fB@l_prefix@/bin/openpkg rc\fR \fB\-e\fR|\fB\-\-eval\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]`
   65.90 +eval `\fB\f(CB@l_prefix\fB@/bin/openpkg rc\fR \fB\-e\fR|\fB\-\-eval\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]`
   65.91  .PP
   65.92 -\&\fB@l_prefix@/bin/openpkg rc\fR \fB\-q\fR|\fB\-\-query\fR \fIvariable\fR [\fIvariable\fR ...]
   65.93 +\&\fB\f(CB@l_prefix\fB@/bin/openpkg rc\fR \fB\-q\fR|\fB\-\-query\fR \fIvariable\fR [\fIvariable\fR ...]
   65.94  .PP
   65.95 -\&\fB@l_prefix@/bin/openpkg rc\fR \fB\-c\fR|\fB\-\-config\fR
   65.96 +\&\fB\f(CB@l_prefix\fB@/bin/openpkg rc\fR \fB\-c\fR|\fB\-\-config\fR
   65.97  .PP
   65.98 -\&\fB@l_prefix@/bin/openpkg rc\fR \fB\-h\fR|\fB\-\-help\fR
   65.99 +\&\fB\f(CB@l_prefix\fB@/bin/openpkg rc\fR \fB\-h\fR|\fB\-\-help\fR
  65.100  .SH "DESCRIPTION"
  65.101  .IX Header "DESCRIPTION"
  65.102 -The \fB@l_prefix@/bin/openpkg rc\fR program is the run-command (rc) processor
  65.103 +The \fB\f(CB@l_prefix\fB@/bin/openpkg rc\fR program is the run-command (rc) processor
  65.104  of the \fBOpenPKG\fR instance \f(CW\*(C`@l_prefix@\*(C'\fR. It allows querying the rc
  65.105  configuration variables and the execution of rc command scripts of one
  65.106  or more installed \fBOpenPKG\fR packages. The implemented run-command
  65.107 @@ -157,9 +156,10 @@
  65.108  procedures with periodical procedures into a single approach.
  65.109  .SH "USAGE"
  65.110  .IX Header "USAGE"
  65.111 -.IP "\fB@l_prefix@/bin/openpkg rc\fR [\fB\-s\fR|\fB\-\-silent\fR] [\fB\-v\fR|\fB\-\-verbose\fR] [\fB\-d\fR|\fB\-\-debug\fR] [\fB\-k\fR|\fB\-\-keep\fR] \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]" 4
  65.112 -.IX Item "@l_prefix@/bin/openpkg rc [-s|--silent] [-v|--verbose] [-d|--debug] [-k|--keep] package command [command ...]"
  65.113 -\&\fBRuncommand Execution.\fR This executes one or more specified
  65.114 +.ie n .IP "\fB\fB@l_prefix\fB@/bin/openpkg rc\fR [\fB\-s\fR|\fB\-\-silent\fR] [\fB\-v\fR|\fB\-\-verbose\fR] [\fB\-d\fR|\fB\-\-debug\fR] [\fB\-k\fR|\fB\-\-keep\fR] [\fB\-D\fR|\fB\-\-define\fR \fIname\fR=\fIvalue\fR] \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]" 4
  65.115 +.el .IP "\fB\f(CB@l_prefix\fB@/bin/openpkg rc\fR [\fB\-s\fR|\fB\-\-silent\fR] [\fB\-v\fR|\fB\-\-verbose\fR] [\fB\-d\fR|\fB\-\-debug\fR] [\fB\-k\fR|\fB\-\-keep\fR] [\fB\-D\fR|\fB\-\-define\fR \fIname\fR=\fIvalue\fR] \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]" 4
  65.116 +.IX Item "@l_prefix@/bin/openpkg rc [-s|--silent] [-v|--verbose] [-d|--debug] [-k|--keep] [-D|--define name=value] package command [command ...]"
  65.117 +\&\fBRun-Command Execution.\fR This executes one or more specified
  65.118  \&\fIcommand\fRs in a particular \fIpackage\fR or in all installed packages if
  65.119  \&\fIpackage\fR is "\f(CW\*(C`all\*(C'\fR". Option \fB\-\-silent\fR can be used to explicitly
  65.120  disable progress messages on \f(CW\*(C`stderr\*(C'\fR. Option \fB\-\-verbose\fR can be used
  65.121 @@ -167,19 +167,23 @@
  65.122  automatically determines whether progress messages should be displayed
  65.123  or not depending on whether \f(CW\*(C`stderr\*(C'\fR is connected to a terminal device.
  65.124  Option \fB\-\-keep\fR can be used for debugging purposes to keep the
  65.125 -temporary files were generated during internal processing.
  65.126 -.IP "\fB@l_prefix@/bin/openpkg rc\fR \fB\-p\fR|\fB\-\-print\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]" 4
  65.127 +temporary files were generated during internal processing. Option
  65.128 +\&\fB\-\-define\fR can be used to on-the-fly re-define a configuration variable
  65.129 +\&\fIname\fR with \fIvalue\fR.
  65.130 +.ie n .IP "\fB\fB@l_prefix\fB@/bin/openpkg rc\fR \fB\-p\fR|\fB\-\-print\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]" 4
  65.131 +.el .IP "\fB\f(CB@l_prefix\fB@/bin/openpkg rc\fR \fB\-p\fR|\fB\-\-print\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]" 4
  65.132  .IX Item "@l_prefix@/bin/openpkg rc -p|--print package command [command ...]"
  65.133 -\&\fBRuncommand Printing.\fR This is like the run-command execution (see
  65.134 +\&\fBRun-Command Printing.\fR This is like the run-command execution (see
  65.135  above), but instead of immediately executing all involved individual
  65.136  run-command scripts, they are concatenated (but with all configuration
  65.137  parts reduced to a single configuration part) and printed to \f(CW\*(C`stdout\*(C'\fR.
  65.138  Use this for debugging or post-processing purposes.
  65.139 -.IP "eval `\fB@l_prefix@/bin/openpkg rc\fR \fB\-e\fR|\fB\-\-eval\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]`" 4
  65.140 +.ie n .IP "eval `\fB\fB@l_prefix\fB@/bin/openpkg rc\fR \fB\-e\fR|\fB\-\-eval\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]`" 4
  65.141 +.el .IP "eval `\fB\f(CB@l_prefix\fB@/bin/openpkg rc\fR \fB\-e\fR|\fB\-\-eval\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]`" 4
  65.142  .IX Item "eval `@l_prefix@/bin/openpkg rc -e|--eval package command [command ...]`"
  65.143 -\&\fBRuncommand Evaluation.\fR This is like the run-command execution
  65.144 +\&\fBRun-Command Evaluation.\fR This is like the run-command execution
  65.145  (see above), but the resulting exported shell environment variables
  65.146 -are output to a temporary file as a (Bourne\-Shell or C\-Shell syntax)
  65.147 +are output to a temporary file as a (Bourne-Shell or C\-Shell syntax)
  65.148  shell script, suitable for evaluation within the shell environment
  65.149  of the caller. A one-line script is printed to \f(CW\*(C`stdout\*(C'\fR which then
  65.150  \&\*(L"sources\*(R" (and immediately removes) this temporary file. This is
  65.151 @@ -187,27 +191,30 @@
  65.152  \&\f(CW\*(C`stdout\*(C'\fR, because not all shell implementations like to "\fBeval\fR\*(L"
  65.153  large multi-line scripts. Hence, use this for executing the \*(R"\f(CW\*(C`env\*(C'\fR"
  65.154  run-commands within the current shell.
  65.155 -.IP "\fB@l_prefix@/bin/openpkg rc\fR \fB\-q\fR|\fB\-\-query\fR \fIvariable\fR [\fIvariable\fR ...]" 4
  65.156 +.ie n .IP "\fB\fB@l_prefix\fB@/bin/openpkg rc\fR \fB\-q\fR|\fB\-\-query\fR \fIvariable\fR [\fIvariable\fR ...]" 4
  65.157 +.el .IP "\fB\f(CB@l_prefix\fB@/bin/openpkg rc\fR \fB\-q\fR|\fB\-\-query\fR \fIvariable\fR [\fIvariable\fR ...]" 4
  65.158  .IX Item "@l_prefix@/bin/openpkg rc -q|--query variable [variable ...]"
  65.159  \&\fBConfiguration Variable Querying.\fR This queries the effective values
  65.160  (see \fBRUN-COMMAND \s-1CONFIGURATION\s0\fR section below) of one or more
  65.161  run-command configuration \fIvariable\fRs. Use this within a shell script
  65.162  to selectively query a particular variable.
  65.163 -.IP "\fB@l_prefix@/bin/openpkg rc\fR \fB\-c\fR|\fB\-\-config\fR" 4
  65.164 +.ie n .IP "\fB\fB@l_prefix\fB@/bin/openpkg rc\fR \fB\-c\fR|\fB\-\-config\fR" 4
  65.165 +.el .IP "\fB\f(CB@l_prefix\fB@/bin/openpkg rc\fR \fB\-c\fR|\fB\-\-config\fR" 4
  65.166  .IX Item "@l_prefix@/bin/openpkg rc -c|--config"
  65.167  \&\fBConfiguration Variable Summary.\fR This displays on \f(CW\*(C`stdout\*(C'\fR a
  65.168  three-column table showing the name, default and effective values of
  65.169  all run-command configuration variables. If \f(CW\*(C`stdout\*(C'\fR is connected to
  65.170  terminal device, variables where the default and effective values differ
  65.171  are shown in bold mode.
  65.172 -.IP "\fB@l_prefix@/bin/openpkg rc\fR \fB\-h\fR|\fB\-\-help\fR" 4
  65.173 +.ie n .IP "\fB\fB@l_prefix\fB@/bin/openpkg rc\fR \fB\-h\fR|\fB\-\-help\fR" 4
  65.174 +.el .IP "\fB\f(CB@l_prefix\fB@/bin/openpkg rc\fR \fB\-h\fR|\fB\-\-help\fR" 4
  65.175  .IX Item "@l_prefix@/bin/openpkg rc -h|--help"
  65.176  \&\fBRequesting Help.\fR This just displays a short summary of
  65.177  the usage for this program.
  65.178  .SH "FILES"
  65.179  .IX Header "FILES"
  65.180 -.ie n .Sh "RUN-COMMAND \s-1FILES\s0 (\*(C`@l_prefix@/bin/openpkg rc.d/rc.*\*(C')"
  65.181 -.el .Sh "RUN-COMMAND \s-1FILES\s0 (\f(CW\*(C`@l_prefix@/bin/openpkg rc.d/rc.*\*(C'\fP)"
  65.182 +.ie n .SS "RUN-COMMAND \s-1FILES\s0 (\*(C`@l_prefix@/bin/openpkg rc.d/rc.*\*(C')"
  65.183 +.el .SS "RUN-COMMAND \s-1FILES\s0 (\f(CW\*(C`@l_prefix@/bin/openpkg rc.d/rc.*\*(C'\fP)"
  65.184  .IX Subsection "RUN-COMMAND FILES (@l_prefix@/bin/openpkg rc.d/rc.*)"
  65.185  The foundation of the \fBOpenPKG\fR run-command facility are the individual
  65.186  run-command files \f(CW\*(C`rc.*\*(C'\fR of the installed packages. They are all
  65.187 @@ -267,23 +274,23 @@
  65.188  is tagged with option \fB\-o\fR, \fIstdout\fR messages are passed through
  65.189  verbatim, even if the section script exists with a zero return value.
  65.190  .RS 4
  65.191 -.ie n .IP "%start\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  65.192 +.ie n .IP "%start [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.193  .el .IP "\f(CW%start\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.194  .IX Item "%start [-u user] [-p priority]"
  65.195  This section should start daemons or initialize components.
  65.196  It is especially executed by \fBOpenPKG\fR during system startup.
  65.197 -.ie n .IP "%stop\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  65.198 +.ie n .IP "%stop [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.199  .el .IP "\f(CW%stop\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.200  .IX Item "%stop [-u user] [-p priority]"
  65.201  This section should stop daemons or cleaning up components. It is
  65.202  especially executed by \fBOpenPKG\fR during system shutdown and package
  65.203  deinstallation.
  65.204 -.ie n .IP "%restart\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  65.205 +.ie n .IP "%restart [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.206  .el .IP "\f(CW%restart\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.207  .IX Item "%restart [-u user] [-p priority]"
  65.208  This section should restart daemons.
  65.209  It is especially executed by \fBOpenPKG\fR during package upgrades.
  65.210 -.ie n .IP "\*(C`%status \-o\*(C'\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  65.211 +.ie n .IP "\*(C`%status \-o\*(C' [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.212  .el .IP "\f(CW\*(C`%status \-o\*(C'\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.213  .IX Item "%status -o [-u user] [-p priority]"
  65.214  This section has to provide status information for a package
  65.215 @@ -293,7 +300,7 @@
  65.216  .ie n .IP "\fIpackage\fR\*(C`_enable\*(C'" 4
  65.217  .el .IP "\fIpackage\fR\f(CW\*(C`_enable\*(C'\fR" 4
  65.218  .IX Item "package_enable"
  65.219 -Whether package is enabled, i.e., whether it accepts run\-commands. This
  65.220 +Whether package is enabled, i.e., whether it accepts run-commands. This
  65.221  variable just has to be printed, because is already set in current
  65.222  script environment.
  65.223  .ie n .IP "\fIpackage\fR\*(C`_usable\*(C'" 4
  65.224 @@ -309,17 +316,17 @@
  65.225  .RE
  65.226  .RS 4
  65.227  .RE
  65.228 -.ie n .IP "%monthly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  65.229 +.ie n .IP "%monthly [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.230  .el .IP "\f(CW%monthly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.231  .IX Item "%monthly [-u user] [-p priority]"
  65.232  .PD 0
  65.233 -.ie n .IP "%weekly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  65.234 +.ie n .IP "%weekly [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.235  .el .IP "\f(CW%weekly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.236  .IX Item "%weekly [-u user] [-p priority]"
  65.237 -.ie n .IP "%hourly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  65.238 +.ie n .IP "%hourly [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.239  .el .IP "\f(CW%hourly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.240  .IX Item "%hourly [-u user] [-p priority]"
  65.241 -.ie n .IP "%quarterly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  65.242 +.ie n .IP "%quarterly [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.243  .el .IP "\f(CW%quarterly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  65.244  .IX Item "%quarterly [-u user] [-p priority]"
  65.245  .PD
  65.246 @@ -340,16 +347,16 @@
  65.247  package. Some often seen sections are \f(CW%reload\fR (just reload the
  65.248  configuration without full stop and start procedure), \f(CW%info\fR (output
  65.249  arbitrary information about package), etc.
  65.250 -.ie n .Sh "RUN-COMMAND \s-1CONFIGURATION\s0 (\*(C`@l_prefix@/bin/openpkg rc.conf\*(C')"
  65.251 -.el .Sh "RUN-COMMAND \s-1CONFIGURATION\s0 (\f(CW\*(C`@l_prefix@/bin/openpkg rc.conf\*(C'\fP)"
  65.252 +.ie n .SS "RUN-COMMAND \s-1CONFIGURATION\s0 (\*(C`@l_prefix@/bin/openpkg rc.conf\*(C')"
  65.253 +.el .SS "RUN-COMMAND \s-1CONFIGURATION\s0 (\f(CW\*(C`@l_prefix@/bin/openpkg rc.conf\*(C'\fP)"
  65.254  .IX Subsection "RUN-COMMAND CONFIGURATION (@l_prefix@/bin/openpkg rc.conf)"
  65.255  The run-command configuration variables defined in the "\f(CW%config\fR"
  65.256  sections of all installed packages can be overridden by the
  65.257  administrator in the global file \f(CW\*(C`@l_prefix@/bin/openpkg rc.conf\*(C'\fR. This file is
  65.258  usually empty, but can be filled with Bourne-Shell compatible variable
  65.259  assignment statements like "\fIpackage\fR\f(CW\*(C`_\*(C'\fR\fIvariable\fR=\fIvalue\fR".
  65.260 -.ie n .Sh "RUN-COMMAND \s-1FUNCTIONS\s0 (\*(C`@l_prefix@/bin/openpkg rc.func\*(C')"
  65.261 -.el .Sh "RUN-COMMAND \s-1FUNCTIONS\s0 (\f(CW\*(C`@l_prefix@/bin/openpkg rc.func\*(C'\fP)"
  65.262 +.ie n .SS "RUN-COMMAND \s-1FUNCTIONS\s0 (\*(C`@l_prefix@/bin/openpkg rc.func\*(C')"
  65.263 +.el .SS "RUN-COMMAND \s-1FUNCTIONS\s0 (\f(CW\*(C`@l_prefix@/bin/openpkg rc.func\*(C'\fP)"
  65.264  .IX Subsection "RUN-COMMAND FUNCTIONS (@l_prefix@/bin/openpkg rc.func)"
  65.265  The file \f(CW\*(C`@l_prefix@/bin/openpkg rc.func\*(C'\fR is prepended to the scripts of all
  65.266  executed run-command sections and provides reusable functions.
  65.267 @@ -406,74 +413,60 @@
  65.268  \&    foo_log_numfiles="10"
  65.269  \&    foo_log_minsize="1M"
  65.270  \&    foo_log_complevel="9"
  65.271 -.Ve
  65.272 -.PP
  65.273 -.Vb 13
  65.274 +\&
  65.275  \& %common
  65.276  \&    foo_homedir="@l_prefix@/share/foo"
  65.277  \&    foo_cfgfile="@l_prefix@/etc/foo/foo.cfg"
  65.278  \&    foo_pidfile="@l_prefix@/var/foo/foo.pid"
  65.279  \&    foo_logfile="@l_prefix@/var/foo/foo.log"
  65.280  \&    foo_signal () {
  65.281 -\&        if [ -f ${foo_pidfile} ]; then
  65.282 -\&            kill -$1 `cat ${foo_pidfile}`
  65.283 +\&        if [ \-f ${foo_pidfile} ]; then
  65.284 +\&            kill \-$1 \`cat ${foo_pidfile}\`
  65.285  \&            return $?
  65.286  \&        else
  65.287  \&            return 1
  65.288  \&        fi
  65.289  \&    }
  65.290 -.Ve
  65.291 -.PP
  65.292 -.Vb 15
  65.293 +\&
  65.294  \& %status
  65.295  \&     foo_usable="no"
  65.296 -\&     if [ ".`grep '<<PASSWORD>>' ${foo_cfgfile}`" = . ]; then
  65.297 +\&     if [ ".\`grep \*(Aq<<PASSWORD>>\*(Aq ${foo_cfgfile}\`" = . ]; then
  65.298  \&         foo_usable="yes"
  65.299  \&     fi
  65.300  \&     foo_active="no"
  65.301 -\&     if [ -f ${foo_pidfile} ]; then
  65.302 +\&     if [ \-f ${foo_pidfile} ]; then
  65.303  \&         foo_signal 0
  65.304 -\&         if [ $? -eq 0 ]; then
  65.305 +\&         if [ $? \-eq 0 ]; then
  65.306  \&             foo_active="yes"
  65.307  \&         fi
  65.308  \&     fi
  65.309  \&     echo "foo_enable=${foo_enable}"
  65.310  \&     echo "foo_usable=${foo_usable}"
  65.311  \&     echo "foo_active=${foo_active}"
  65.312 -.Ve
  65.313 -.PP
  65.314 -.Vb 4
  65.315 +\&
  65.316  \& %start
  65.317  \&     rcService foo enable yes || exit 0
  65.318  \&     rcService foo active yes && exit 0
  65.319 -\&     @l_prefix@/sbin/foo --listen ${foo_listen}
  65.320 -.Ve
  65.321 -.PP
  65.322 -.Vb 4
  65.323 +\&     @l_prefix@/sbin/foo \-\-listen ${foo_listen}
  65.324 +\&
  65.325  \& %stop
  65.326  \&     rcService foo enable yes || exit 0
  65.327  \&     rcService foo active yes || exit 0
  65.328  \&     foo_signal TERM
  65.329 -.Ve
  65.330 -.PP
  65.331 -.Vb 4
  65.332 +\&
  65.333  \& %restart
  65.334  \&     rcService foo enable yes || exit 0
  65.335  \&     rcService foo active yes || exit 0
  65.336  \&     rc foo stop start
  65.337 -.Ve
  65.338 -.PP
  65.339 -.Vb 7
  65.340 +\&
  65.341  \& %daily
  65.342  \&     rcService foo enable yes || exit 0
  65.343 -\&     shtool rotate -f \e
  65.344 -\&         -n ${foo_log_numfiles} -s ${foo_log_minsize} -d \e
  65.345 -\&         -z ${foo_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \e
  65.346 -\&         -P "${foo_log_prolog}" -E "${foo_log_epilog}" \e
  65.347 +\&     shtool rotate \-f \e
  65.348 +\&         \-n ${foo_log_numfiles} \-s ${foo_log_minsize} \-d \e
  65.349 +\&         \-z ${foo_log_complevel} \-o @l_rusr@ \-g @l_rgrp@ \-m 644 \e
  65.350 +\&         \-P "${foo_log_prolog}" \-E "${foo_log_epilog}" \e
  65.351  \&         ${foo_logfile}
  65.352 -.Ve
  65.353 -.PP
  65.354 -.Vb 5
  65.355 +\&
  65.356  \& %env
  65.357  \&     if rcService foo enable yes; then
  65.358  \&         FOO_HOME="$foo_homedir"
  65.359 @@ -485,14 +478,14 @@
  65.360  default values and their effective values of package "\f(CW\*(C`foo\*(C'\fR":
  65.361  .PP
  65.362  .Vb 1
  65.363 -\& $ @l_prefix@/bin/openpkg rc --config | grep "^foo_"
  65.364 +\& $ @l_prefix@/bin/openpkg rc \-\-config | grep "^foo_"
  65.365  .Ve
  65.366  .PP
  65.367  Override the default value of a run-command configuration
  65.368  variable \f(CW\*(C`foo_listen\*(C'\fR:
  65.369  .PP
  65.370  .Vb 1
  65.371 -\& $ echo 'foo_listen="192.168.0.1"' >>@l_prefix@/bin/openpkg rc.conf
  65.372 +\& $ echo \*(Aqfoo_listen="192.168.0.1"\*(Aq >>@l_prefix@/bin/openpkg rc.conf
  65.373  .Ve
  65.374  .PP
  65.375  Stop and start from scratch the package "\f(CW\*(C`foo\*(C'\fR":
  65.376 @@ -505,14 +498,14 @@
  65.377  variable \f(CW\*(C`foo_enable\*(C'\fR in a script:
  65.378  .PP
  65.379  .Vb 1
  65.380 -\& if [ ".`@l_prefix@/bin/openpkg rc -q foo_enable`" = .yes ]; then ...
  65.381 +\& if [ ".\`@l_prefix@/bin/openpkg rc \-q foo_enable\`" = .yes ]; then ...
  65.382  .Ve
  65.383  .PP
  65.384  Import all environment settings from all (including "\f(CW\*(C`foo\*(C'\fR") installed
  65.385  packages into the current Bourne-Shell environment:
  65.386  .PP
  65.387  .Vb 2
  65.388 -\& $ eval `@l_prefix@/bin/openpkg rc --eval all env`
  65.389 +\& $ eval \`@l_prefix@/bin/openpkg rc \-\-eval all env\`
  65.390  \& $ echo $FOO_HOME
  65.391  .Ve
  65.392  .SH "SEE ALSO"
    66.1 --- a/openpkg/rc.conf	Tue Jul 31 12:12:54 2012 +0200
    66.2 +++ b/openpkg/rc.conf	Tue Jul 31 12:23:42 2012 +0200
    66.3 @@ -1,12 +1,12 @@
    66.4  ##
    66.5 -##  @l_prefix@/etc/rc.conf -- Runcommand Configuration for OpenPKG Hierarchy
    66.6 +##  @l_prefix@/etc/rc.conf -- Run-Command Configuration for OpenPKG Hierarchy
    66.7  ##
    66.8  ##  This Bourne-Shell script is sourced from @l_prefix@/etc/rc after
    66.9  ##  reading the %config sections from the @l_prefix@/etc/rc.d/rc.<name>
   66.10  ##  script and before executing its %<cmd> section when
   66.11 -##  "@l_prefix@/etc/rc <name> <cmd>" is run. You can use this to
   66.12 +##  "@l_prefix@/bin/openpkg rc <name> <cmd>" is run. You can use this to
   66.13  ##  override all configuration variables which are listed in the output
   66.14 -##  of the "@l_prefix@/etc/rc --config" command. By default this
   66.15 +##  of the "@l_prefix@/bin/openpkg rc --config" command. By default this
   66.16  ##  script obviously is empty.
   66.17  ##
   66.18  
    67.1 --- a/openpkg/rc.func	Tue Jul 31 12:12:54 2012 +0200
    67.2 +++ b/openpkg/rc.func	Tue Jul 31 12:23:42 2012 +0200
    67.3 @@ -1,14 +1,13 @@
    67.4  ##
    67.5 -##  @l_prefix@/etc/rc.func -- Runcommand Helper Functions
    67.6 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    67.7 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    67.8 +##  @l_prefix@/etc/rc.func -- Run-Command Helper Functions
    67.9 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
   67.10  ##
   67.11 -##  Permission to use, copy, modify, and distribute this software for
   67.12 -##  any purpose with or without fee is hereby granted, provided that
   67.13 -##  the above copyright notice and this permission notice appear in all
   67.14 -##  copies.
   67.15 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   67.16 +##  All rights reserved. Licenses which grant limited permission to use,
   67.17 +##  copy, modify and distribute this software are available from the
   67.18 +##  OpenPKG GmbH.
   67.19  ##
   67.20 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   67.21 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   67.22  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   67.23  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   67.24  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    68.1 --- a/openpkg/rc.openpkg	Tue Jul 31 12:12:54 2012 +0200
    68.2 +++ b/openpkg/rc.openpkg	Tue Jul 31 12:23:42 2012 +0200
    68.3 @@ -1,6 +1,25 @@
    68.4  #!@l_prefix@/bin/openpkg rc
    68.5  ##
    68.6 -##  rc.openpkg -- Runcommands
    68.7 +##  rc.openpkg -- Run-Commands
    68.8 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    68.9 +##
   68.10 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   68.11 +##  All rights reserved. Licenses which grant limited permission to use,
   68.12 +##  copy, modify and distribute this software are available from the
   68.13 +##  OpenPKG GmbH.
   68.14 +##
   68.15 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   68.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   68.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   68.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   68.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   68.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   68.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   68.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   68.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   68.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   68.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   68.26 +##  SUCH DAMAGE.
   68.27  ##
   68.28  
   68.29  %config
   68.30 @@ -23,21 +42,23 @@
   68.31  
   68.32  %start -p0
   68.33      rcService openpkg enable yes || exit 0
   68.34 +
   68.35      #   update UUID information (in background to not slow down boot sequences)
   68.36      (nohup @l_prefix@/bin/openpkg uuid update </dev/null >/dev/null 2>&1 &) >/dev/null 2>&1
   68.37  
   68.38  %hourly -u @l_musr@
   68.39      rcService openpkg enable yes || exit 0
   68.40 +
   68.41      #   automatic (re-)registration
   68.42      reregister=0
   68.43 +
   68.44      #   re-register if previously registered
   68.45      @l_prefix@/bin/openpkg register --printstatus >/dev/null 2>&1 && reregister=1
   68.46 -    #   re-register if "openpkg" executable from community series
   68.47 -    [ $reregister -eq 0 ] && @l_prefix@/bin/openpkg --license 2>/dev/null \
   68.48 -    | sed -e 'q' | egrep '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-C' >/dev/null && reregister=1
   68.49 +
   68.50      #   re-register if "openpkg release" configured to pull packages directly from openpkg.(org|com|net)
   68.51      [ $reregister -eq 0 ] && @l_prefix@/bin/openpkg release --fmt='%u' \
   68.52      | egrep '^[^:]*://(([^:]*:)?([^@]*@)?)?([^/]*\.)?openpkg\.(com|org|net)/' >/dev/null && reregister=1
   68.53 +
   68.54      #   perform (re-)registration
   68.55      if [ $reregister -eq 1 ]; then
   68.56          [ $openpkg_reghour -lt 00 -o $openpkg_reghour -gt 23 ] && openpkg_reghour="3"
   68.57 @@ -50,6 +71,7 @@
   68.58  
   68.59  %daily -p0
   68.60      rcService openpkg enable yes || exit 0
   68.61 +
   68.62      #   update UUID information
   68.63      @l_prefix@/bin/openpkg uuid update >/dev/null 2>&1 || true
   68.64  
    69.1 --- a/openpkg/rc.pod	Tue Jul 31 12:12:54 2012 +0200
    69.2 +++ b/openpkg/rc.pod	Tue Jul 31 12:23:42 2012 +0200
    69.3 @@ -1,14 +1,13 @@
    69.4  ##
    69.5  ##  rc.pod -- RPM Auxiliary Tool (Manual Page)
    69.6 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    69.7 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    69.8 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    69.9  ##
   69.10 -##  Permission to use, copy, modify, and distribute this software for
   69.11 -##  any purpose with or without fee is hereby granted, provided that
   69.12 -##  the above copyright notice and this permission notice appear in all
   69.13 -##  copies.
   69.14 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   69.15 +##  All rights reserved. Licenses which grant limited permission to use,
   69.16 +##  copy, modify and distribute this software are available from the
   69.17 +##  OpenPKG GmbH.
   69.18  ##
   69.19 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   69.20 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   69.21  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   69.22  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   69.23  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   69.24 @@ -26,11 +25,11 @@
   69.25  
   69.26  =head1 NAME
   69.27  
   69.28 -B<@l_prefix@/bin/openpkg rc> - OpenPKG Runcommand Processor
   69.29 +B<@l_prefix@/bin/openpkg rc> - OpenPKG Run-Command Processor
   69.30  
   69.31  =head1 SYNOPSIS
   69.32  
   69.33 -B<@l_prefix@/bin/openpkg rc> [B<-s>|B<--silent>] [B<-v>|B<--verbose>] [B<-d>|B<--debug>] [B<-k>|B<--keep>] I<package> I<command> [I<command> ...]
   69.34 +B<@l_prefix@/bin/openpkg rc> [B<-s>|B<--silent>] [B<-v>|B<--verbose>] [B<-d>|B<--debug>] [B<-k>|B<--keep>] [B<-D>|B<--define> I<name>=I<value>] I<package> I<command> [I<command> ...]
   69.35  
   69.36  B<@l_prefix@/bin/openpkg rc> B<-p>|B<--print> I<package> I<command> [I<command> ...]
   69.37  
   69.38 @@ -57,9 +56,9 @@
   69.39  
   69.40  =over 4
   69.41  
   69.42 -=item B<@l_prefix@/bin/openpkg rc> [B<-s>|B<--silent>] [B<-v>|B<--verbose>] [B<-d>|B<--debug>] [B<-k>|B<--keep>] I<package> I<command> [I<command> ...]
   69.43 +=item B<@l_prefix@/bin/openpkg rc> [B<-s>|B<--silent>] [B<-v>|B<--verbose>] [B<-d>|B<--debug>] [B<-k>|B<--keep>] [B<-D>|B<--define> I<name>=I<value>] I<package> I<command> [I<command> ...]
   69.44  
   69.45 -B<Runcommand Execution.> This executes one or more specified
   69.46 +B<Run-Command Execution.> This executes one or more specified
   69.47  I<command>s in a particular I<package> or in all installed packages if
   69.48  I<package> is "C<all>". Option B<--silent> can be used to explicitly
   69.49  disable progress messages on C<stderr>. Option B<--verbose> can be used
   69.50 @@ -67,11 +66,13 @@
   69.51  automatically determines whether progress messages should be displayed
   69.52  or not depending on whether C<stderr> is connected to a terminal device.
   69.53  Option B<--keep> can be used for debugging purposes to keep the
   69.54 -temporary files were generated during internal processing.
   69.55 +temporary files were generated during internal processing. Option
   69.56 +B<--define> can be used to on-the-fly re-define a configuration variable
   69.57 +I<name> with I<value>.
   69.58  
   69.59  =item B<@l_prefix@/bin/openpkg rc> B<-p>|B<--print> I<package> I<command> [I<command> ...]
   69.60  
   69.61 -B<Runcommand Printing.> This is like the run-command execution (see
   69.62 +B<Run-Command Printing.> This is like the run-command execution (see
   69.63  above), but instead of immediately executing all involved individual
   69.64  run-command scripts, they are concatenated (but with all configuration
   69.65  parts reduced to a single configuration part) and printed to C<stdout>.
   69.66 @@ -79,7 +80,7 @@
   69.67  
   69.68  =item eval `B<@l_prefix@/bin/openpkg rc> B<-e>|B<--eval> I<package> I<command> [I<command> ...]`
   69.69  
   69.70 -B<Runcommand Evaluation.> This is like the run-command execution
   69.71 +B<Run-Command Evaluation.> This is like the run-command execution
   69.72  (see above), but the resulting exported shell environment variables
   69.73  are output to a temporary file as a (Bourne-Shell or C-Shell syntax)
   69.74  shell script, suitable for evaluation within the shell environment
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/openpkg/register.8	Tue Jul 31 12:23:42 2012 +0200
    70.3 @@ -0,0 +1,441 @@
    70.4 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
    70.5 +.\"
    70.6 +.\" Standard preamble:
    70.7 +.\" ========================================================================
    70.8 +.de Sp \" Vertical space (when we can't use .PP)
    70.9 +.if t .sp .5v
   70.10 +.if n .sp
   70.11 +..
   70.12 +.de Vb \" Begin verbatim text
   70.13 +.ft CW
   70.14 +.nf
   70.15 +.ne \\$1
   70.16 +..
   70.17 +.de Ve \" End verbatim text
   70.18 +.ft R
   70.19 +.fi
   70.20 +..
   70.21 +.\" Set up some character translations and predefined strings.  \*(-- will
   70.22 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   70.23 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
   70.24 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
   70.25 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
   70.26 +.\" nothing in troff, for use with C<>.
   70.27 +.tr \(*W-
   70.28 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   70.29 +.ie n \{\
   70.30 +.    ds -- \(*W-
   70.31 +.    ds PI pi
   70.32 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   70.33 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   70.34 +.    ds L" ""
   70.35 +.    ds R" ""
   70.36 +.    ds C` 
   70.37 +.    ds C' 
   70.38 +'br\}
   70.39 +.el\{\
   70.40 +.    ds -- \|\(em\|
   70.41 +.    ds PI \(*p
   70.42 +.    ds L" ``
   70.43 +.    ds R" ''
   70.44 +'br\}
   70.45 +.\"
   70.46 +.\" Escape single quotes in literal strings from groff's Unicode transform.
   70.47 +.ie \n(.g .ds Aq \(aq
   70.48 +.el       .ds Aq '
   70.49 +.\"
   70.50 +.\" If the F register is turned on, we'll generate index entries on stderr for
   70.51 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
   70.52 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   70.53 +.\" output yourself in some meaningful fashion.
   70.54 +.ie \nF \{\
   70.55 +.    de IX
   70.56 +.    tm Index:\\$1\t\\n%\t"\\$2"
   70.57 +..
   70.58 +.    nr % 0
   70.59 +.    rr F
   70.60 +.\}
   70.61 +.el \{\
   70.62 +.    de IX
   70.63 +..
   70.64 +.\}
   70.65 +.\"
   70.66 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   70.67 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   70.68 +.    \" fudge factors for nroff and troff
   70.69 +.if n \{\
   70.70 +.    ds #H 0
   70.71 +.    ds #V .8m
   70.72 +.    ds #F .3m
   70.73 +.    ds #[ \f1
   70.74 +.    ds #] \fP
   70.75 +.\}
   70.76 +.if t \{\
   70.77 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   70.78 +.    ds #V .6m
   70.79 +.    ds #F 0
   70.80 +.    ds #[ \&
   70.81 +.    ds #] \&
   70.82 +.\}
   70.83 +.    \" simple accents for nroff and troff
   70.84 +.if n \{\
   70.85 +.    ds ' \&
   70.86 +.    ds ` \&
   70.87 +.    ds ^ \&
   70.88 +.    ds , \&
   70.89 +.    ds ~ ~
   70.90 +.    ds /
   70.91 +.\}
   70.92 +.if t \{\
   70.93 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   70.94 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
   70.95 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
   70.96 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
   70.97 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
   70.98 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
   70.99 +.\}
  70.100 +.    \" troff and (daisy-wheel) nroff accents
  70.101 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  70.102 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  70.103 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  70.104 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  70.105 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  70.106 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  70.107 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  70.108 +.ds ae a\h'-(\w'a'u*4/10)'e
  70.109 +.ds Ae A\h'-(\w'A'u*4/10)'E
  70.110 +.    \" corrections for vroff
  70.111 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  70.112 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  70.113 +.    \" for low resolution devices (crt and lpr)
  70.114 +.if \n(.H>23 .if \n(.V>19 \
  70.115 +\{\
  70.116 +.    ds : e
  70.117 +.    ds 8 ss
  70.118 +.    ds o a
  70.119 +.    ds d- d\h'-1'\(ga
  70.120 +.    ds D- D\h'-1'\(hy
  70.121 +.    ds th \o'bp'
  70.122 +.    ds Th \o'LP'
  70.123 +.    ds ae ae
  70.124 +.    ds Ae AE
  70.125 +.\}
  70.126 +.rm #[ #] #H #V #F C
  70.127 +.\" ========================================================================
  70.128 +.\"
  70.129 +.IX Title "REGISTER 8"
  70.130 +.TH REGISTER 8 "OpenPKG" "REGISTER(8)" "OpenPKG"
  70.131 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
  70.132 +.\" way too many mistakes in technical documents.
  70.133 +.if n .ad l
  70.134 +.nh
  70.135 +.SH "NAME"
  70.136 +openpkg register \- OpenPKG Registry Command\-Line Client
  70.137 +.SH "SYNOPSIS"
  70.138 +.IX Header "SYNOPSIS"
  70.139 +\&\fBregister\fR [\-u|\-\-user=<user|token>] [\-l|\-\-link=<token>] [\fI\-d|\-\-desc=<text\fR>]
  70.140 +          [\-m|\-\-mode=fake|post|wipe] [\fI\-a|\-\-args=<args\fR>]
  70.141 +          [\fI\-\-plat=<text\fR>] [\fI\-\-orel=<text\fR>] [\fI\-\-uuid=<file\fR>]
  70.142 +          [\fI\-\-conf=<file\fR>] [\fI\-\-prep=<file\fR>] [\fI\-\-tran=<file\fR>]
  70.143 +          [\fI\-\-util=<file\fR>] [\-\-data=<tag>[,<tag>...]]
  70.144 +          [\fI\-P|\-\-preparation\fR] [\fI\-T|\-\-transaction\fR]
  70.145 +          [\fI\-U|\-\-utilization\fR] [\fI\-C|\-\-convenience\fR]
  70.146 +          [\fI\-I|\-\-interaction\fR]
  70.147 +          [\fI\-v|\-\-verbose\fR] [\fI\-h|\-\-help\fR]
  70.148 +.PP
  70.149 +\&\fBregister\fR \-S|\-\-printstatus
  70.150 +.PP
  70.151 +\&\fBregister\fR \-R|\-\-rewriteurls [\fIurl\fR ...]
  70.152 +.SH "DESCRIPTION"
  70.153 +.IX Header "DESCRIPTION"
  70.154 +\&\fBopenpkg register\fR is the Command-Line Client the OpenPKG Registry. It is
  70.155 +used by administrators to register an instance with the OpenPKG Registry for
  70.156 +later association.
  70.157 +.PP
  70.158 +After association, \fBopenpkg register\fR can be used for repetitive
  70.159 +reregistrations which update the heartbeat of the instance on the Registry
  70.160 +server, avoiding premature depature from the database. It is assumed that
  70.161 +every instance will be reregistered daily. Dormant
  70.162 +instances might be discarded from the Registry, revoking their access to
  70.163 +additional resources.
  70.164 +.SH "PRIMARY OPERATIONS"
  70.165 +.IX Header "PRIMARY OPERATIONS"
  70.166 +The following primary operations are available:
  70.167 +.IP "\fB\-h\fR, \fB\-\-help\fR" 4
  70.168 +.IX Item "-h, --help"
  70.169 +Display brief usage message.
  70.170 +.IP "\fB\-v\fR, \fB\-\-verbose\fR" 4
  70.171 +.IX Item "-v, --verbose"
  70.172 +Display progress information during data posting.
  70.173 +.IP "\fB\-P\fR, \fB\-\-preparation\fR" 4
  70.174 +.IX Item "-P, --preparation"
  70.175 +Execute the primary operation \*(L"preparation\*(R".
  70.176 +Creates registry data for one request and dumps it stdout
  70.177 +in \s-1XML\s0 format. That request can be filtered and piped into
  70.178 +the transaction phase or it can be copied and pasted into the
  70.179 +XMLdump \s-1CGI\s0 facility manually.
  70.180 +A copy of the output of the last run is also saved to the \f(CW\*(C`${REGISTRY_PREP}\*(C'\fR file.
  70.181 +.IP "\fB\-T\fR, \fB\-\-transaction\fR" 4
  70.182 +.IX Item "-T, --transaction"
  70.183 +Execute the primary operation \*(L"transaction\*(R".
  70.184 +Reads registry data with one request from stdin, executes
  70.185 +the transaction and writes registry data with one or more
  70.186 +responses to stdout in \s-1XML\s0 format.
  70.187 +Depending on the mode of operation, the transaction might be an actual
  70.188 +transport to the XMLdump \s-1CGI\s0 facility or a fake activity which complements the
  70.189 +manual preparation.
  70.190 +A copy of the output of the last run is also saved to the \f(CW\*(C`${REGISTRY_TRAN}\*(C'\fR file.
  70.191 +.IP "\fB\-U\fR, \fB\-\-utilization\fR" 4
  70.192 +.IX Item "-U, --utilization"
  70.193 +Execute the primary operation \*(L"utilization\*(R".
  70.194 +Reads registry data with one response from stdin and updates the local
  70.195 +registry information.
  70.196 +Depending on the mode of operation, the utilization might be an actual
  70.197 +processing of a transaction response or a fake activity which complements the
  70.198 +manual transaction.
  70.199 +Anyway, this step finalizes the registration process and makes the instance
  70.200 +assume it has been properly registered. This status can be printed. \s-1URL\s0
  70.201 +rewriting is activated.
  70.202 +A copy of the output of the last run is also saved to the \f(CW\*(C`${REGISTRY_UTIL}\*(C'\fR file.
  70.203 +.IP "\fB\-C\fR, \fB\-\-convenience\fR" 4
  70.204 +.IX Item "-C, --convenience"
  70.205 +Execute the primary operation \*(L"convenience\*(R".
  70.206 +This executes the three primary operations \*(L"preparation\*(R", \*(L"transaction\*(R" and
  70.207 +\&\*(L"utilization\*(R" in that order and pipes data through this chain.
  70.208 +.IP "\fB\-I\fR, \fB\-\-interaction\fR" 4
  70.209 +.IX Item "-I, --interaction"
  70.210 +Execute the primary operation \*(L"interaction\*(R".
  70.211 +Like \*(L"convenience\*(R" but user is interactively asked for information. This is
  70.212 +the easiest way to do registration but it is not meat to be automated.
  70.213 +.IP "\fB\-S\fR, \fB\-\-printstatus\fR" 4
  70.214 +.IX Item "-S, --printstatus"
  70.215 +If the instance has been registered, information about the registration is printed in a
  70.216 +format suitable for shell evaluation and return code is true.
  70.217 +Otherwise nothing is printed and return code is false.
  70.218 +.IP "\fB\-R\fR, \fB\-\-rewriteurls\fR [\fIurl\fR ...]" 4
  70.219 +.IX Item "-R, --rewriteurls [url ...]"
  70.220 +If the instance has been registered, the given URLs are rewritten to prepend
  70.221 +user:pass information before hostnames below the openpkg.(org|net|com)
  70.222 +domains.  Note the username is is \s-1UUID_REGISTRY\s0 and the password is the
  70.223 +concatenation of \s-1UUID_INSTANCE\s0 and \s-1UUID_PLATFORM\s0 from the
  70.224 +PREFIX/etc/openpkg/uuid file. Both informations are not meant to be used for
  70.225 +traditional authentication, they are merly statistical information.
  70.226 +Otherwise the URLs are returned verbatim.
  70.227 +.SH "STANDARD OPTIONS"
  70.228 +.IX Header "STANDARD OPTIONS"
  70.229 +Standard options are typically used to automate registration (not
  70.230 +association).
  70.231 +.IP "\fB\-m\fR, \fB\-\-mode\fR fake|post|wipe" 4
  70.232 +.IX Item "-m, --mode fake|post|wipe"
  70.233 +Overrides \f(CW\*(C`${REGISTRY_MODE}\*(C'\fR variable in \f(CW\*(C`${REGISTRY_CONF}\*(C'\fR file.
  70.234 +Has no default and is a manadatory setting.
  70.235 +.Sp
  70.236 +In \fBpost\fR mode, transactions are carried out using real network connectivity.
  70.237 +The \*(L"preparation\*(R" step creates a XMLdump and writes it into the
  70.238 +\&\f(CW\*(C`${REGISTRY_PREP}\*(C'\fR file. The \*(L"transaction\*(R" step posts it to the DropXML form
  70.239 +using a \s-1HTTP\s0 request. The response coming back from Registration server is
  70.240 +also in \s-1XML\s0 format and is saved to  \f(CW\*(C`${REGISTRY_TRAN}\*(C'\fR file.  The
  70.241 +\&\*(L"utilization\*(R" step processes this response and writes the final results to the
  70.242 +\&\f(CW\*(C`${REGISTRY_UTIL}\*(C'\fR file.
  70.243 +.Sp
  70.244 +In \fBfake\fR mode, no network connectivity takes place.
  70.245 +The \*(L"prepararation\*(R" step creates a XMLdump and writes it into the
  70.246 +\&\f(CW\*(C`${REGISTRY_PREP}\*(C'\fR file. The \*(L"transaction\*(R" step is a fake only. It assumes a
  70.247 +successful response from the Registration server and saves it to
  70.248 +\&\f(CW\*(C`${REGISTRY_TRAN}\*(C'\fR file.  The \*(L"utilization\*(R" step processes this response and
  70.249 +writes the final results to the \f(CW\*(C`${REGISTRY_UTIL}\*(C'\fR file.
  70.250 +\&\fINote\fR: fake mode is meant as a way to register instances which cannot or must
  70.251 +not post data directly to the Registration server.
  70.252 +.Sp
  70.253 +In \fBwipe\fR mode, the registration is wiped out locally. The status is reset
  70.254 +and \s-1URL\s0 rewriting is disabled.
  70.255 +\&\fINote\fR: the registration server is not contacted, the instace must be removed
  70.256 +manually using the web interface.
  70.257 +\&\fINote\fR: wiping registration is highly recommended as a precursor action of
  70.258 +cloning activities.
  70.259 +.ie n .IP "\fB\-a\fR, \fB\-\-args\fR ""arg [arg ...]""" 4
  70.260 +.el .IP "\fB\-a\fR, \fB\-\-args\fR ``arg [arg ...]''" 4
  70.261 +.IX Item "-a, --args arg [arg ...]"
  70.262 +Overrides \f(CW\*(C`${REGISTRY_ARGS}\*(C'\fR variable in \f(CW\*(C`${REGISTRY_CONF}\*(C'\fR file.
  70.263 +Complements the mode and is specific to it.
  70.264 +Defaults to \*(L"http://registry.openpkg.org/register\*(R" which is the official registry of the OpenPKG Project.
  70.265 +This default is useful for \*(L"post\*(R" mode.
  70.266 +.IP "\fB\-u\fR, \fB\-\-user\fR \fIuser|token\fR" 4
  70.267 +.IX Item "-u, --user user|token"
  70.268 +Overrides \f(CW\*(C`${REGISTRY_USER}\*(C'\fR variable in \f(CW\*(C`${REGISTRY_CONF}\*(C'\fR file.
  70.269 +Indicates the registry user which will find this registration in his arrival queue.
  70.270 +The user can also specified as a token which is enabled for use as \*(L"user\*(R".
  70.271 +If the token is also enabled for \*(L"assoc\*(R" the registered instance is immediately associated
  70.272 +to the user with no need for the user to visit the web interface.
  70.273 +This information in submitted via the \*(L"registry_user\*(R" attribute of the \s-1XML\s0 request.
  70.274 +Retrieves default online from http://openpkg.org/go/autoregister and is a manadatory setting.
  70.275 +.IP "\fB\-l\fR, \fB\-\-link\fR \fItoken\fR" 4
  70.276 +.IX Item "-l, --link token"
  70.277 +Overrides \f(CW\*(C`${REGISTRY_LINK}\*(C'\fR variable in \f(CW\*(C`${REGISTRY_CONF}\*(C'\fR file.
  70.278 +Indicates the registry user which will find this registration linked to his token.
  70.279 +The link must be specified as a token which is enabled for use as \*(L"link\*(R".
  70.280 +If a user token is used and the link token is also enabled for \*(L"assoc\*(R" then the registered instance
  70.281 +is immediately associated to the user with no need for the user to visit the web interface.
  70.282 +This information in submitted via the \*(L"registry_link\*(R" attribute of the \s-1XML\s0 request.
  70.283 +Has no default and is an optional setting.
  70.284 +Be aware that linked users see the same information about an instance as the associated user
  70.285 +can find on his \*(L"association\*(R" page but they cannot alter or delete information.
  70.286 +.IP "\fB\-d\fR, \fB\-\-desc\fR \fIdescription\fR" 4
  70.287 +.IX Item "-d, --desc description"
  70.288 +Overrides \f(CW\*(C`${REGISTRY_DESC}\*(C'\fR variable in \f(CW\*(C`${REGISTRY_CONF}\*(C'\fR file.
  70.289 +Indicates a human readable description of the instance.
  70.290 +This information in submitted via the \*(L"registry_desc\*(R" attribute of the \s-1XML\s0 request.
  70.291 +It appears in the \*(L"description\*(R" column on the \*(L"association\*(R" page of the web form and can be edited on the server side.
  70.292 +Defaults to \*(L"openpkg://${\s-1FQDN\s0}${\s-1PREFIX\s0}\*(R"
  70.293 +.SH "ADVANCED OPTIONS"
  70.294 +.IX Header "ADVANCED OPTIONS"
  70.295 +Advanced options can be enganged to tailor and fully automate a registration
  70.296 +(not association).
  70.297 +.IP "\fB\-\-plat\fR" 4
  70.298 +.IX Item "--plat"
  70.299 +Overrides \f(CW\*(C`${REGISTRY_PLAT}\*(C'\fR variable in \f(CW\*(C`${REGISTRY_CONF}\*(C'\fR file.
  70.300 +Indicates the platform. Concatenated information from \s-1CPU\s0 architecture (arch) and Operating System (os).
  70.301 +This information in submitted via the \*(L"registry_plat\*(R" attribute of the \s-1XML\s0 request.
  70.302 +Defaults to \*(L"%{l_platform \-p}\*(R", e.g. \*(L"ix86\-freebsd6.1\*(R"
  70.303 +.IP "\fB\-\-orel\fR" 4
  70.304 +.IX Item "--orel"
  70.305 +Overrides \f(CW\*(C`${REGISTRY_VERS}\*(C'\fR variable in \f(CW\*(C`${REGISTRY_CONF}\*(C'\fR file.
  70.306 +Indicates the OpenPKG release.
  70.307 +This information in submitted via the \*(L"registry_orel\*(R" attribute of the \s-1XML\s0 request.
  70.308 +Defaults to \*(L"%{l_openpkg_release}\*(R", e.g. \*(L"OpenPKG-CURRENT\*(R", \*(L"OpenPKG\-2\-STABLE\*(R", \*(L"OpenPKG\-2.5\*(R",
  70.309 +.IP "\fB\-\-uuid\fR" 4
  70.310 +.IX Item "--uuid"
  70.311 +Overrides \f(CW\*(C`${REGISTRY_UUID}\*(C'\fR variable in \f(CW\*(C`${REGISTRY_CONF}\*(C'\fR file.
  70.312 +Indicates the \s-1UUID\s0 file of the instance.
  70.313 +This information in submitted via the \*(L"uuid_registry\*(R", \*(L"uuid_instance\*(R" and \*(L"uuid_platform\*(R" attributes of the \s-1XML\s0 request.
  70.314 +Defaults to \fI${\s-1PREFIX\s0}/etc/openpkg/uuid\fR
  70.315 +.IP "\fB\-\-conf\fR" 4
  70.316 +.IX Item "--conf"
  70.317 +Overrides \f(CW\*(C`${REGISTRY_CONF}\*(C'\fR variable from previous \f(CW\*(C`${REGISTRY_CONF}\*(C'\fR file. Processing
  70.318 +of the current configuration file is aborted immediately with all variables
  70.319 +read so far kept. THe new configuration file is read in immediately and
  70.320 +processing continues there. This works similar to an include but is more
  70.321 +primitive as it does not allow nesting, only chaining.
  70.322 +Defaults to \fI${\s-1PREFIX\s0}/etc/openpkg/register.conf\fR
  70.323 +.IP "\fB\-\-prep\fR" 4
  70.324 +.IX Item "--prep"
  70.325 +Overrides \f(CW\*(C`${REGISTRY_PREP}\*(C'\fR variable in \f(CW\*(C`${REGISTRY_CONF}\*(C'\fR file.
  70.326 +File to save a copy of the output from the \*(L"preparation\*(R" step.
  70.327 +Defaults to \fI${\s-1PREFIX\s0}/etc/openpkg/register.prep\fR
  70.328 +.IP "\fB\-\-tran\fR" 4
  70.329 +.IX Item "--tran"
  70.330 +Overrides \f(CW\*(C`${REGISTRY_TRAN}\*(C'\fR variable in \f(CW\*(C`${REGISTRY_CONF}\*(C'\fR file.
  70.331 +File to save a copy of the output from the \*(L"transaction\*(R" step.
  70.332 +Defaults to \fI${\s-1PREFIX\s0}/etc/openpkg/register.tran\fR
  70.333 +.IP "\fB\-\-util\fR" 4
  70.334 +.IX Item "--util"
  70.335 +Overrides \f(CW\*(C`${REGISTRY_UTIL}\*(C'\fR variable in \f(CW\*(C`${REGISTRY_CONF}\*(C'\fR file.
  70.336 +File to save a copy of the output from the \*(L"utilization\*(R" step.
  70.337 +Defaults to \fI${\s-1PREFIX\s0}/etc/openpkg/register.util\fR
  70.338 +.IP "\fB\-\-data\fR" 4
  70.339 +.IX Item "--data"
  70.340 +Overrides \f(CW\*(C`${REGISTRY_DATA}\*(C'\fR variable in \f(CW\*(C`${REGISTRY_CONF}\*(C'\fR file.
  70.341 +Comma separated list of tags to prepare. Available tags are \*(L"request\*(R",
  70.342 +\&\*(L"package\*(R" and \*(L"provides\*(R". The \*(L"request\*(R" refers to the whole thing and
  70.343 +is mandatory. The \*(L"package\*(R" includes name-version-release information
  70.344 +for all installed packages and \*(L"provides\*(R" adds more details required to
  70.345 +capture package options. For details see \s-1OPENPKG_PREP\s0 below.
  70.346 +Defaults to \*(L"request,package,provides\*(R"
  70.347 +.SH "FILES"
  70.348 +.IX Header "FILES"
  70.349 +The following files are used by \fBopenpkg register\fR:
  70.350 +.IP "OPENPKG_UUID=\fI${\s-1PREFIX\s0}/etc/openpkg/uuid\fR" 4
  70.351 +.IX Item "OPENPKG_UUID=${PREFIX}/etc/openpkg/uuid"
  70.352 +.Vb 3
  70.353 +\& UUID_REGISTRY="..."
  70.354 +\& UUID_INSTANCE="..."
  70.355 +\& UUID_PLATFORM="..."
  70.356 +.Ve
  70.357 +.IP "OPENPKG_CONF=\fI${\s-1PREFIX\s0}/etc/openpkg/register.conf\fR" 4
  70.358 +.IX Item "OPENPKG_CONF=${PREFIX}/etc/openpkg/register.conf"
  70.359 +Format suitable for shell evaluation. Interactive mode appends remarked date
  70.360 +and current settings for reuse as new defaults for future runs. Can be preset
  70.361 +to customize or automate registration.
  70.362 +.IP "OPENPKG_PREP=\fI${\s-1PREFIX\s0}/etc/openpkg/register.prep\fR" 4
  70.363 +.IX Item "OPENPKG_PREP=${PREFIX}/etc/openpkg/register.prep"
  70.364 +.Vb 10
  70.365 +\& <?xml version="1.0" encoding="iso\-8859\-1" standalone="no"?>
  70.366 +\& <!DOCTYPE registry
  70.367 +\&   PUBLIC "\-//OpenPKG//DTD OpenPKG Registry 0.0.1//EN"
  70.368 +\&   "http://registry.openpkg.org/registry.dtd" []>
  70.369 +\& <registry>
  70.370 +\&     <request id="..."
  70.371 +\&         registry_user="me@example.com"
  70.372 +\&         registry_desc="openpkg://rm0.openpkg.net/openpkg\-dev"
  70.373 +\&         registry_plat="ix86\-freebsd6.1"
  70.374 +\&         registry_orel="OpenPKG\-CURRENT"
  70.375 +\&         uuid_registry="..."
  70.376 +\&         uuid_instance="..."
  70.377 +\&         uuid_platform="..."
  70.378 +\&     />
  70.379 +\&     <package id="..." name="ssmtp" version="2.61" release="20050608">
  70.380 +\&        <provides name="ssmtp::with_ssl" flag="=" version="no"/>
  70.381 +\&        <provides name="MTA" flag="" version=""/>
  70.382 +\&        <provides name="ssmtp" flag="=" version="2.61\-20050608"/>
  70.383 +\&     </package>
  70.384 +\& </registry>
  70.385 +.Ve
  70.386 +.Sp
  70.387 +The \s-1XML\s0 request starts with <?xml version ...> and <!DOCTYPE registry ...>
  70.388 +headers followed by a <registry> container. The request is inside a <request>
  70.389 +tag. Successful submission into the XMLdump form requires the headers and
  70.390 +exactly one container. It is possible to merge multiple requests into a single
  70.391 +container manually or otherwise and submit them all at once.
  70.392 +.IP "OPENPKG_TRAN=\fI${\s-1PREFIX\s0}/etc/openpkg/register.tran\fR" 4
  70.393 +.IX Item "OPENPKG_TRAN=${PREFIX}/etc/openpkg/register.tran"
  70.394 +.Vb 7
  70.395 +\& <?xml version="1.0" encoding="iso\-8859\-1" standalone="no"?>
  70.396 +\& <!DOCTYPE registry
  70.397 +\&   PUBLIC "\-//OpenPKG//DTD OpenPKG Registry 0.0.1//EN"
  70.398 +\&   "http://registry.openpkg.org/registry.dtd" []>
  70.399 +\& <registry>
  70.400 +\&     <response id="..." done="yes">openpkg://rm0.openpkg.net/openpkg\-dev</response>
  70.401 +\& </registry>
  70.402 +.Ve
  70.403 +.Sp
  70.404 +The \s-1XML\s0 response starts with <?xml version ...> and <!DOCTYPE registry ...>
  70.405 +headers followed by a <registry> container. The response is inside a <request>
  70.406 +tag. The data carried in the tag comes from the \*(L"description\*(R" column on the
  70.407 +\&\*(L"association\*(R" page of the web form and can be edited on the server side.
  70.408 +.IP "OPENPKG_UTIL=\fI${\s-1PREFIX\s0}/etc/openpkg/register.util\fR" 4
  70.409 +.IX Item "OPENPKG_UTIL=${PREFIX}/etc/openpkg/register.util"
  70.410 +.Vb 3
  70.411 +\& REGISTRY_DBID="..."
  70.412 +\& REGISTRY_DONE="yes"
  70.413 +\& REGISTRY_RESP="openpkg://foo.example.com/my/openpkg/prefix"
  70.414 +.Ve
  70.415 +.SH "EXAMPLES"
  70.416 +.IX Header "EXAMPLES"
  70.417 +.Vb 10
  70.418 +\& # su \- openpkg\-mop
  70.419 +\& $ openpkg register \-\-printstatus
  70.420 +\& REGISTRY_DBID="..."
  70.421 +\& REGISTRY_DONE="yes"
  70.422 +\& REGISTRY_RESP="openpkg://foo.example.com/my/openpkg/prefix"
  70.423 +\& $ openpkg register \-\-printstatus >/dev/null && echo "Yup"
  70.424 +\& Yup
  70.425 +\& $ eval \`openpkg register \-\-printstatus\`; echo DONE=$REGISTRY_DONE
  70.426 +\& DONE=yes
  70.427 +\& $ openpkg register \-\-mode=wipe
  70.428 +\& $ openpkg register \-\-printstatus || echo "Nope"
  70.429 +\& Nope
  70.430 +\& $ openpkg register \-\-user=thl@openpkg.net \-\-mode=post
  70.431 +\& REGISTRY_DBID="...."
  70.432 +\& REGISTRY_DONE="yes"
  70.433 +\& REGISTRY_RESP="openpkg://foo.example.com/my/openpkg/prefix"
  70.434 +\& $ openpkg register \-\-printstatus >/dev/null && echo "Yup"
  70.435 +\& Yup
  70.436 +\& $ openpkg register \-\-rewriteurls http://download.openpkg.org/foo/bar
  70.437 +\& ftp://...:...@download.openpkg.org/foo/bar
  70.438 +.Ve
  70.439 +.SH "SEE ALSO"
  70.440 +.IX Header "SEE ALSO"
  70.441 +\&\fIbash\fR\|(1), \f(CW\*(C`openpkg man uuid\*(C'\fR, \f(CW\*(C`http://registry.openpkg.org/\*(C'\fR
  70.442 +.SH "AUTHOR"
  70.443 +.IX Header "AUTHOR"
  70.444 +Thomas Lotterer <thl@openpkg.org>
    71.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.2 +++ b/openpkg/register.pod	Tue Jul 31 12:23:42 2012 +0200
    71.3 @@ -0,0 +1,358 @@
    71.4 +
    71.5 +=pod
    71.6 +
    71.7 +=head1 NAME
    71.8 +
    71.9 +B<openpkg register> - OpenPKG Registry Command-Line Client
   71.10 +
   71.11 +=head1 SYNOPSIS
   71.12 +
   71.13 +B<register> [-u|--user=<user|token>] [-l|--link=<token>] [I<-d|--desc=<text>>]
   71.14 +          [-m|--mode=fake|post|wipe] [I<-a|--args=<args>>]
   71.15 +          [I<--plat=<text>>] [I<--orel=<text>>] [I<--uuid=<file>>]
   71.16 +          [I<--conf=<file>>] [I<--prep=<file>>] [I<--tran=<file>>]
   71.17 +          [I<--util=<file>>] [--data=<tag>[,<tag>...]]
   71.18 +          [I<-P|--preparation>] [I<-T|--transaction>]
   71.19 +          [I<-U|--utilization>] [I<-C|--convenience>]
   71.20 +          [I<-I|--interaction>]
   71.21 +          [I<-v|--verbose>] [I<-h|--help>]
   71.22 +
   71.23 +B<register> -S|--printstatus
   71.24 +
   71.25 +B<register> -R|--rewriteurls [I<url> ...]
   71.26 +
   71.27 +=head1 DESCRIPTION
   71.28 +
   71.29 +B<openpkg register> is the Command-Line Client the OpenPKG Registry. It is
   71.30 +used by administrators to register an instance with the OpenPKG Registry for
   71.31 +later association.
   71.32 +
   71.33 +After association, B<openpkg register> can be used for repetitive
   71.34 +reregistrations which update the heartbeat of the instance on the Registry
   71.35 +server, avoiding premature depature from the database. It is assumed that
   71.36 +every instance will be reregistered daily. Dormant
   71.37 +instances might be discarded from the Registry, revoking their access to
   71.38 +additional resources.
   71.39 +
   71.40 +=head1 PRIMARY OPERATIONS
   71.41 +
   71.42 +The following primary operations are available:
   71.43 +
   71.44 +=over 4
   71.45 +
   71.46 +=item B<-h>, B<--help>
   71.47 +
   71.48 +Display brief usage message.
   71.49 +
   71.50 +=item B<-v>, B<--verbose>
   71.51 +
   71.52 +Display progress information during data posting.
   71.53 +
   71.54 +=item B<-P>, B<--preparation>
   71.55 +
   71.56 +Execute the primary operation "preparation".
   71.57 +Creates registry data for one request and dumps it stdout
   71.58 +in XML format. That request can be filtered and piped into
   71.59 +the transaction phase or it can be copied and pasted into the
   71.60 +XMLdump CGI facility manually.
   71.61 +A copy of the output of the last run is also saved to the C<${REGISTRY_PREP}> file.
   71.62 +
   71.63 +=item B<-T>, B<--transaction>
   71.64 +
   71.65 +Execute the primary operation "transaction".
   71.66 +Reads registry data with one request from stdin, executes
   71.67 +the transaction and writes registry data with one or more
   71.68 +responses to stdout in XML format.
   71.69 +Depending on the mode of operation, the transaction might be an actual
   71.70 +transport to the XMLdump CGI facility or a fake activity which complements the
   71.71 +manual preparation.
   71.72 +A copy of the output of the last run is also saved to the C<${REGISTRY_TRAN}> file.
   71.73 +
   71.74 +=item B<-U>, B<--utilization>
   71.75 +
   71.76 +Execute the primary operation "utilization".
   71.77 +Reads registry data with one response from stdin and updates the local
   71.78 +registry information.
   71.79 +Depending on the mode of operation, the utilization might be an actual
   71.80 +processing of a transaction response or a fake activity which complements the
   71.81 +manual transaction.
   71.82 +Anyway, this step finalizes the registration process and makes the instance
   71.83 +assume it has been properly registered. This status can be printed. URL
   71.84 +rewriting is activated.
   71.85 +A copy of the output of the last run is also saved to the C<${REGISTRY_UTIL}> file.
   71.86 +
   71.87 +=item B<-C>, B<--convenience>
   71.88 +
   71.89 +Execute the primary operation "convenience".
   71.90 +This executes the three primary operations "preparation", "transaction" and
   71.91 +"utilization" in that order and pipes data through this chain.
   71.92 +
   71.93 +=item B<-I>, B<--interaction>
   71.94 +
   71.95 +Execute the primary operation "interaction".
   71.96 +Like "convenience" but user is interactively asked for information. This is
   71.97 +the easiest way to do registration but it is not meat to be automated.
   71.98 +
   71.99 +=item B<-S>, B<--printstatus>
  71.100 +
  71.101 +If the instance has been registered, information about the registration is printed in a
  71.102 +format suitable for shell evaluation and return code is true.
  71.103 +Otherwise nothing is printed and return code is false.
  71.104 +
  71.105 +=item B<-R>, B<--rewriteurls> [I<url> ...]
  71.106 +
  71.107 +If the instance has been registered, the given URLs are rewritten to prepend
  71.108 +user:pass information before hostnames below the openpkg.(org|net|com)
  71.109 +domains.  Note the username is is UUID_REGISTRY and the password is the
  71.110 +concatenation of UUID_INSTANCE and UUID_PLATFORM from the
  71.111 +PREFIX/etc/openpkg/uuid file. Both informations are not meant to be used for
  71.112 +traditional authentication, they are merly statistical information.
  71.113 +Otherwise the URLs are returned verbatim.
  71.114 +
  71.115 +=back
  71.116 +
  71.117 +=head1 STANDARD OPTIONS
  71.118 +
  71.119 +Standard options are typically used to automate registration (not
  71.120 +association).
  71.121 +
  71.122 +=over 4
  71.123 +
  71.124 +=item B<-m>, B<--mode> fake|post|wipe
  71.125 +
  71.126 +Overrides C<${REGISTRY_MODE}> variable in C<${REGISTRY_CONF}> file.
  71.127 +Has no default and is a manadatory setting.
  71.128 +
  71.129 +In B<post> mode, transactions are carried out using real network connectivity.
  71.130 +The "preparation" step creates a XMLdump and writes it into the
  71.131 +C<${REGISTRY_PREP}> file. The "transaction" step posts it to the DropXML form
  71.132 +using a HTTP request. The response coming back from Registration server is
  71.133 +also in XML format and is saved to  C<${REGISTRY_TRAN}> file.  The
  71.134 +"utilization" step processes this response and writes the final results to the
  71.135 +C<${REGISTRY_UTIL}> file.
  71.136 +
  71.137 +In B<fake> mode, no network connectivity takes place.
  71.138 +The "prepararation" step creates a XMLdump and writes it into the
  71.139 +C<${REGISTRY_PREP}> file. The "transaction" step is a fake only. It assumes a
  71.140 +successful response from the Registration server and saves it to
  71.141 +C<${REGISTRY_TRAN}> file.  The "utilization" step processes this response and
  71.142 +writes the final results to the C<${REGISTRY_UTIL}> file.
  71.143 +I<Note>: fake mode is meant as a way to register instances which cannot or must
  71.144 +not post data directly to the Registration server.
  71.145 +
  71.146 +In B<wipe> mode, the registration is wiped out locally. The status is reset
  71.147 +and URL rewriting is disabled.
  71.148 +I<Note>: the registration server is not contacted, the instace must be removed
  71.149 +manually using the web interface.
  71.150 +I<Note>: wiping registration is highly recommended as a precursor action of
  71.151 +cloning activities.
  71.152 +
  71.153 +=item B<-a>, B<--args> "arg [arg ...]"
  71.154 +
  71.155 +Overrides C<${REGISTRY_ARGS}> variable in C<${REGISTRY_CONF}> file.
  71.156 +Complements the mode and is specific to it.
  71.157 +Defaults to "http://registry.openpkg.org/register" which is the official registry of the OpenPKG Project.
  71.158 +This default is useful for "post" mode.
  71.159 +
  71.160 +=item B<-u>, B<--user> I<user|token>
  71.161 +
  71.162 +Overrides C<${REGISTRY_USER}> variable in C<${REGISTRY_CONF}> file.
  71.163 +Indicates the registry user which will find this registration in his arrival queue.
  71.164 +The user can also specified as a token which is enabled for use as "user".
  71.165 +If the token is also enabled for "assoc" the registered instance is immediately associated
  71.166 +to the user with no need for the user to visit the web interface.
  71.167 +This information in submitted via the "registry_user" attribute of the XML request.
  71.168 +Retrieves default online from http://openpkg.org/go/autoregister and is a manadatory setting.
  71.169 +
  71.170 +=item B<-l>, B<--link> I<token>
  71.171 +
  71.172 +Overrides C<${REGISTRY_LINK}> variable in C<${REGISTRY_CONF}> file.
  71.173 +Indicates the registry user which will find this registration linked to his token.
  71.174 +The link must be specified as a token which is enabled for use as "link".
  71.175 +If a user token is used and the link token is also enabled for "assoc" then the registered instance
  71.176 +is immediately associated to the user with no need for the user to visit the web interface.
  71.177 +This information in submitted via the "registry_link" attribute of the XML request.
  71.178 +Has no default and is an optional setting.
  71.179 +Be aware that linked users see the same information about an instance as the associated user
  71.180 +can find on his "association" page but they cannot alter or delete information.
  71.181 +
  71.182 +=item B<-d>, B<--desc> I<description>
  71.183 +
  71.184 +Overrides C<${REGISTRY_DESC}> variable in C<${REGISTRY_CONF}> file.
  71.185 +Indicates a human readable description of the instance.
  71.186 +This information in submitted via the "registry_desc" attribute of the XML request.
  71.187 +It appears in the "description" column on the "association" page of the web form and can be edited on the server side.
  71.188 +Defaults to "openpkg://${FQDN}${PREFIX}"
  71.189 +
  71.190 +=back
  71.191 +
  71.192 +=head1 ADVANCED OPTIONS
  71.193 +
  71.194 +Advanced options can be enganged to tailor and fully automate a registration
  71.195 +(not association).
  71.196 +
  71.197 +=over 4
  71.198 +
  71.199 +=item B<--plat>
  71.200 +
  71.201 +Overrides C<${REGISTRY_PLAT}> variable in C<${REGISTRY_CONF}> file.
  71.202 +Indicates the platform. Concatenated information from CPU architecture (arch) and Operating System (os).
  71.203 +This information in submitted via the "registry_plat" attribute of the XML request.
  71.204 +Defaults to "%{l_platform -p}", e.g. "ix86-freebsd6.1"
  71.205 +
  71.206 +=item B<--orel>
  71.207 +
  71.208 +Overrides C<${REGISTRY_VERS}> variable in C<${REGISTRY_CONF}> file.
  71.209 +Indicates the OpenPKG release.
  71.210 +This information in submitted via the "registry_orel" attribute of the XML request.
  71.211 +Defaults to "%{l_openpkg_release}", e.g. "OpenPKG-CURRENT", "OpenPKG-2-STABLE", "OpenPKG-2.5",
  71.212 +
  71.213 +=item B<--uuid>
  71.214 +
  71.215 +Overrides C<${REGISTRY_UUID}> variable in C<${REGISTRY_CONF}> file.
  71.216 +Indicates the UUID file of the instance.
  71.217 +This information in submitted via the "uuid_registry", "uuid_instance" and "uuid_platform" attributes of the XML request.
  71.218 +Defaults to F<${PREFIX}/etc/openpkg/uuid>
  71.219 +
  71.220 +=item B<--conf>
  71.221 +
  71.222 +Overrides C<${REGISTRY_CONF}> variable from previous C<${REGISTRY_CONF}> file. Processing
  71.223 +of the current configuration file is aborted immediately with all variables
  71.224 +read so far kept. THe new configuration file is read in immediately and
  71.225 +processing continues there. This works similar to an include but is more
  71.226 +primitive as it does not allow nesting, only chaining.
  71.227 +Defaults to F<${PREFIX}/etc/openpkg/register.conf>
  71.228 +
  71.229 +=item B<--prep>
  71.230 +
  71.231 +Overrides C<${REGISTRY_PREP}> variable in C<${REGISTRY_CONF}> file.
  71.232 +File to save a copy of the output from the "preparation" step.
  71.233 +Defaults to F<${PREFIX}/etc/openpkg/register.prep>
  71.234 +
  71.235 +=item B<--tran>
  71.236 +
  71.237 +Overrides C<${REGISTRY_TRAN}> variable in C<${REGISTRY_CONF}> file.
  71.238 +File to save a copy of the output from the "transaction" step.
  71.239 +Defaults to F<${PREFIX}/etc/openpkg/register.tran>
  71.240 +
  71.241 +=item B<--util>
  71.242 +
  71.243 +Overrides C<${REGISTRY_UTIL}> variable in C<${REGISTRY_CONF}> file.
  71.244 +File to save a copy of the output from the "utilization" step.
  71.245 +Defaults to F<${PREFIX}/etc/openpkg/register.util>
  71.246 +
  71.247 +=item B<--data>
  71.248 +
  71.249 +Overrides C<${REGISTRY_DATA}> variable in C<${REGISTRY_CONF}> file.
  71.250 +Comma separated list of tags to prepare. Available tags are "request",
  71.251 +"package" and "provides". The "request" refers to the whole thing and
  71.252 +is mandatory. The "package" includes name-version-release information
  71.253 +for all installed packages and "provides" adds more details required to
  71.254 +capture package options. For details see OPENPKG_PREP below.
  71.255 +Defaults to "request,package,provides"
  71.256 +
  71.257 +=back
  71.258 +
  71.259 +=head1 FILES
  71.260 +
  71.261 +The following files are used by B<openpkg register>:
  71.262 +
  71.263 +=over 4
  71.264 +
  71.265 +=item OPENPKG_UUID=F<${PREFIX}/etc/openpkg/uuid>
  71.266 +
  71.267 + UUID_REGISTRY="..."
  71.268 + UUID_INSTANCE="..."
  71.269 + UUID_PLATFORM="..."
  71.270 +
  71.271 +=item OPENPKG_CONF=F<${PREFIX}/etc/openpkg/register.conf>
  71.272 +
  71.273 +Format suitable for shell evaluation. Interactive mode appends remarked date
  71.274 +and current settings for reuse as new defaults for future runs. Can be preset
  71.275 +to customize or automate registration.
  71.276 +
  71.277 +=item OPENPKG_PREP=F<${PREFIX}/etc/openpkg/register.prep>
  71.278 +
  71.279 + <?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
  71.280 + <!DOCTYPE registry
  71.281 +   PUBLIC "-//OpenPKG//DTD OpenPKG Registry 0.0.1//EN"
  71.282 +   "http://registry.openpkg.org/registry.dtd" []>
  71.283 + <registry>
  71.284 +     <request id="..."
  71.285 +         registry_user="me@example.com"
  71.286 +         registry_desc="openpkg://rm0.openpkg.net/openpkg-dev"
  71.287 +         registry_plat="ix86-freebsd6.1"
  71.288 +         registry_orel="OpenPKG-CURRENT"
  71.289 +         uuid_registry="..."
  71.290 +         uuid_instance="..."
  71.291 +         uuid_platform="..."
  71.292 +     />
  71.293 +     <package id="..." name="ssmtp" version="2.61" release="20050608">
  71.294 +        <provides name="ssmtp::with_ssl" flag="=" version="no"/>
  71.295 +        <provides name="MTA" flag="" version=""/>
  71.296 +        <provides name="ssmtp" flag="=" version="2.61-20050608"/>
  71.297 +     </package>
  71.298 + </registry>
  71.299 +
  71.300 +The XML request starts with <?xml version ...> and <!DOCTYPE registry ...>
  71.301 +headers followed by a <registry> container. The request is inside a <request>
  71.302 +tag. Successful submission into the XMLdump form requires the headers and
  71.303 +exactly one container. It is possible to merge multiple requests into a single
  71.304 +container manually or otherwise and submit them all at once.
  71.305 +
  71.306 +=item OPENPKG_TRAN=F<${PREFIX}/etc/openpkg/register.tran>
  71.307 +
  71.308 + <?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
  71.309 + <!DOCTYPE registry
  71.310 +   PUBLIC "-//OpenPKG//DTD OpenPKG Registry 0.0.1//EN"
  71.311 +   "http://registry.openpkg.org/registry.dtd" []>
  71.312 + <registry>
  71.313 +     <response id="..." done="yes">openpkg://rm0.openpkg.net/openpkg-dev</response>
  71.314 + </registry>
  71.315 +
  71.316 +The XML response starts with <?xml version ...> and <!DOCTYPE registry ...>
  71.317 +headers followed by a <registry> container. The response is inside a <request>
  71.318 +tag. The data carried in the tag comes from the "description" column on the
  71.319 +"association" page of the web form and can be edited on the server side.
  71.320 +
  71.321 +=item OPENPKG_UTIL=F<${PREFIX}/etc/openpkg/register.util>
  71.322 +
  71.323 + REGISTRY_DBID="..."
  71.324 + REGISTRY_DONE="yes"
  71.325 + REGISTRY_RESP="openpkg://foo.example.com/my/openpkg/prefix"
  71.326 +
  71.327 +=back
  71.328 +
  71.329 +=head1 EXAMPLES
  71.330 +
  71.331 + # su - openpkg-mop
  71.332 + $ openpkg register --printstatus
  71.333 + REGISTRY_DBID="..."
  71.334 + REGISTRY_DONE="yes"
  71.335 + REGISTRY_RESP="openpkg://foo.example.com/my/openpkg/prefix"
  71.336 + $ openpkg register --printstatus >/dev/null && echo "Yup"
  71.337 + Yup
  71.338 + $ eval `openpkg register --printstatus`; echo DONE=$REGISTRY_DONE
  71.339 + DONE=yes
  71.340 + $ openpkg register --mode=wipe
  71.341 + $ openpkg register --printstatus || echo "Nope"
  71.342 + Nope
  71.343 + $ openpkg register --user=thl@openpkg.net --mode=post
  71.344 + REGISTRY_DBID="...."
  71.345 + REGISTRY_DONE="yes"
  71.346 + REGISTRY_RESP="openpkg://foo.example.com/my/openpkg/prefix"
  71.347 + $ openpkg register --printstatus >/dev/null && echo "Yup"
  71.348 + Yup
  71.349 + $ openpkg register --rewriteurls http://download.openpkg.org/foo/bar
  71.350 + ftp://...:...@download.openpkg.org/foo/bar
  71.351 +
  71.352 +=head1 SEE ALSO
  71.353 +
  71.354 +bash(1), C<openpkg man uuid>, C<http://registry.openpkg.org/>
  71.355 +
  71.356 +=head1 AUTHOR
  71.357 +
  71.358 +Thomas Lotterer E<lt>thl@openpkg.orgE<gt>
  71.359 +
  71.360 +=cut
  71.361 +
    72.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.2 +++ b/openpkg/register.sh	Tue Jul 31 12:23:42 2012 +0200
    72.3 @@ -0,0 +1,686 @@
    72.4 +#!@l_prefix@/lib/openpkg/bash
    72.5 +##
    72.6 +##  register -- OpenPKG Registry Command-Line Client
    72.7 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    72.8 +##
    72.9 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   72.10 +##  All rights reserved. Licenses which grant limited permission to use,
   72.11 +##  copy, modify and distribute this software are available from the
   72.12 +##  OpenPKG GmbH.
   72.13 +##
   72.14 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   72.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   72.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   72.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   72.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   72.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   72.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   72.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   72.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   72.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   72.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   72.25 +##  SUCH DAMAGE.
   72.26 +##
   72.27 +
   72.28 +##
   72.29 +##  configuration
   72.30 +##
   72.31 +
   72.32 +#   program name, version and date
   72.33 +progname="register"
   72.34 +progvers="1.1.3"
   72.35 +progdate="24-Aug-2007"
   72.36 +
   72.37 +#   determine path to OpenPKG instance
   72.38 +PREFIX="@l_prefix@"
   72.39 +if [ ".${OPENPKG_PREFIX}" != . ]; then
   72.40 +    PREFIX="${OPENPKG_PREFIX}"
   72.41 +fi
   72.42 +
   72.43 +#   determine rpm
   72.44 +rpm="$PREFIX/libexec/openpkg/rpm"
   72.45 +[ -x "$PREFIX/lib/openpkg/rpm" ] && rpm="$PREFIX/lib/openpkg/rpm"
   72.46 +
   72.47 +#   http post
   72.48 +curl="$PREFIX/lib/openpkg/curl"
   72.49 +useragent="openpkg-$progname/$progvers"
   72.50 +
   72.51 +error()
   72.52 +{
   72.53 +    echo "$progname:ERROR: $@" 1>&2
   72.54 +    exit 1
   72.55 +}
   72.56 +
   72.57 +[ ".$PREFIX" = . ] && error "empty PREFIX not allowed"
   72.58 +
   72.59 +##
   72.60 +##  read configuration unless already done during option parsing
   72.61 +##
   72.62 +sanitycheck()
   72.63 +{
   72.64 +    if [ ".$1" != . -a -r "$1" ]; then
   72.65 +        cat <"$1" | awk '
   72.66 +            BEGIN { rc=0 }
   72.67 +            !/^([A-Z][A-Z0-9_]+[A-Z0-9]="[^"]*")? *(#.*)?$/ { rc=1 }
   72.68 +            END { exit rc }' && return 0
   72.69 +    fi
   72.70 +    return 1
   72.71 +}
   72.72 +
   72.73 +readconf()
   72.74 +{
   72.75 +    [ ".$REGISTRY_CONF" = . ] && return
   72.76 +    if [ -r "$REGISTRY_CONF" ]; then
   72.77 +        sanitycheck "$REGISTRY_CONF" && . "$REGISTRY_CONF"
   72.78 +    fi
   72.79 +}
   72.80 +
   72.81 +readuuid()
   72.82 +{
   72.83 +    [ ".$REGISTRY_UUID" = . ] && return
   72.84 +    if [ -r "$REGISTRY_UUID" ]; then
   72.85 +        sanitycheck "$REGISTRY_UUID" && . "$REGISTRY_UUID"
   72.86 +    fi
   72.87 +}
   72.88 +
   72.89 +readutil()
   72.90 +{
   72.91 +    [ ".$REGISTRY_UTIL" = . ] && return
   72.92 +    if [ -r "$REGISTRY_UTIL" ]; then
   72.93 +        sanitycheck "$REGISTRY_UTIL" && . "$REGISTRY_UTIL"
   72.94 +    fi
   72.95 +}
   72.96 +
   72.97 +##
   72.98 +##  command line option parsing
   72.99 +##
  72.100 +
  72.101 +#   default parameters
  72.102 +FQDN=`$PREFIX/lib/openpkg/shtool echo -e '%h%d'`
  72.103 +
  72.104 +#   primary operations
  72.105 +op="automatic"
  72.106 +
  72.107 +#   standard options
  72.108 +REGISTRY_AUTO="http://openpkg.org/go/autoregister"
  72.109 +REGISTRY_MODE="post"
  72.110 +REGISTRY_ARGS="http://registry.openpkg.org/register"
  72.111 +REGISTRY_USER=""
  72.112 +REGISTRY_LINK=""
  72.113 +REGISTRY_DESC="openpkg://${FQDN}${PREFIX}"
  72.114 +
  72.115 +#   advanced options
  72.116 +#   we are called from rpm URL rewrite wrapper,
  72.117 +#   so defer PLAT and OREL lookup to avoid rpm loop
  72.118 +REGISTRY_PLAT=""
  72.119 +REGISTRY_OREL=""
  72.120 +REGISTRY_UUID="$PREFIX/etc/openpkg/uuid"
  72.121 +REGISTRY_CONF="$PREFIX/etc/openpkg/register.conf"
  72.122 +REGISTRY_PREP="$PREFIX/etc/openpkg/register.prep"
  72.123 +REGISTRY_TRAN="$PREFIX/etc/openpkg/register.tran"
  72.124 +REGISTRY_UTIL="$PREFIX/etc/openpkg/register.util"
  72.125 +
  72.126 +#   amount of data being posted
  72.127 +REGISTRY_DATA="request,package,provides"
  72.128 +
  72.129 +#   read baseline config early and allow options to override contents
  72.130 +readconf
  72.131 +
  72.132 +#   debug options
  72.133 +verbose="no"
  72.134 +help="no"
  72.135 +
  72.136 +#   iterate over argument line
  72.137 +declare -a a
  72.138 +declare -i i=0
  72.139 +while [ $# -gt 0 ]; do
  72.140 +    opt=$1
  72.141 +    case $opt in
  72.142 +        -*=*) arg=`echo "${opt}" | sed 's/^[-_a-zA-Z0-9]*=//'`
  72.143 +              opt=`echo "${opt}" | sed 's/=.*//'`
  72.144 +              ;;
  72.145 +           *) arg='' ;;
  72.146 +    esac
  72.147 +    case $opt in
  72.148 +        #   primary operations
  72.149 +        -P|--preparation ) op="preparation" ;;
  72.150 +        -T|--transaction ) op="transaction" ;;
  72.151 +        -U|--utilization ) op="utilization" ;;
  72.152 +        -C|--convenience ) op="convenience" ;;
  72.153 +        -I|--interaction ) op="interaction" ;;
  72.154 +
  72.155 +        #   additional features
  72.156 +        -S|--printstatus ) op="printstatus" ;;
  72.157 +        -R|--rewriteurls ) op="rewriteurls" ;;
  72.158 +
  72.159 +        #   standard options
  72.160 +        -m|--mode )
  72.161 +            if [ ".$arg" = . ]; then shift; arg="$1"; fi
  72.162 +            if [ ".$arg" = . ]; then help="Missing argument to \"$opt\""; break; fi
  72.163 +            REGISTRY_MODE="$arg"
  72.164 +            ;;
  72.165 +        -a|--args )
  72.166 +            if [ ".$arg" = . ]; then shift; arg="$1"; fi
  72.167 +            if [ ".$arg" = . ]; then help="Missing argument to \"$opt\""; break; fi
  72.168 +            REGISTRY_ARGS="$arg"
  72.169 +            ;;
  72.170 +        -u|--user )
  72.171 +            if [ ".$arg" = . ]; then shift; arg="$1"; fi
  72.172 +            if [ ".$arg" = . ]; then help="Missing argument to \"$opt\""; break; fi
  72.173 +            REGISTRY_USER="$arg"
  72.174 +            ;;
  72.175 +        -l|--link )
  72.176 +            if [ ".$arg" = . ]; then shift; arg="$1"; fi
  72.177 +            if [ ".$arg" = . ]; then help="Missing argument to \"$opt\""; break; fi
  72.178 +            REGISTRY_LINK="$arg"
  72.179 +            ;;
  72.180 +        -d|--desc )
  72.181 +            if [ ".$arg" = . ]; then shift; arg="$1"; fi
  72.182 +            if [ ".$arg" = . ]; then help="Missing argument to \"$opt\""; break; fi
  72.183 +            REGISTRY_DESC="$arg"
  72.184 +            ;;
  72.185 +
  72.186 +        #   advanced options
  72.187 +        --plat )
  72.188 +            if [ ".$arg" = . ]; then shift; arg="$1"; fi
  72.189 +            if [ ".$arg" = . ]; then help="Missing argument to \"$opt\""; break; fi
  72.190 +            REGISTRY_PLAT="$arg"
  72.191 +            ;;
  72.192 +        --orel )
  72.193 +            if [ ".$arg" = . ]; then shift; arg="$1"; fi
  72.194 +            if [ ".$arg" = . ]; then help="Missing argument to \"$opt\""; break; fi
  72.195 +            REGISTRY_VERS="$arg"
  72.196 +            ;;
  72.197 +        --uuid )
  72.198 +            if [ ".$arg" = . ]; then shift; arg="$1"; fi
  72.199 +            if [ ".$arg" = . ]; then help="Missing argument to \"$opt\""; break; fi
  72.200 +            REGISTRY_UUID="$arg"
  72.201 +            ;;
  72.202 +        --conf )
  72.203 +            if [ ".$arg" = . ]; then shift; arg="$1"; fi
  72.204 +            if [ ".$arg" = . ]; then help="Missing argument to \"$opt\""; break; fi
  72.205 +            REGISTRY_CONF="$arg"; readconf
  72.206 +            ;;
  72.207 +        --prep )
  72.208 +            if [ ".$arg" = . ]; then shift; arg="$1"; fi
  72.209 +            if [ ".$arg" = . ]; then help="Missing argument to \"$opt\""; break; fi
  72.210 +            REGISTRY_PREP="$arg"
  72.211 +            ;;
  72.212 +        --tran )
  72.213 +            if [ ".$arg" = . ]; then shift; arg="$1"; fi
  72.214 +            if [ ".$arg" = . ]; then help="Missing argument to \"$opt\""; break; fi
  72.215 +            REGISTRY_TRAN="$arg"
  72.216 +            ;;
  72.217 +        --util )
  72.218 +            if [ ".$arg" = . ]; then shift; arg="$1"; fi
  72.219 +            if [ ".$arg" = . ]; then help="Missing argument to \"$opt\""; break; fi
  72.220 +            REGISTRY_UTIL="$arg"
  72.221 +            ;;
  72.222 +        --data )
  72.223 +            if [ ".$arg" = . ]; then shift; arg="$1"; fi
  72.224 +            if [ ".$arg" = . ]; then help="Missing argument to \"$opt\""; break; fi
  72.225 +            REGISTRY_DATA="$arg"
  72.226 +            ;;
  72.227 +
  72.228 +        #   debug options
  72.229 +        -v|--verbose ) verbose="yes" ;;
  72.230 +        -h|--help    ) help="Usage"  ;;
  72.231 +        -*           ) help="Invalid option \`$opt'"; break ;;
  72.232 +
  72.233 +        #   optional arguments
  72.234 +        * ) a[$i]="$opt"
  72.235 +            i=i+1
  72.236 +            ;;
  72.237 +    esac
  72.238 +    shift
  72.239 +done
  72.240 +set -- "${a[@]}"
  72.241 +unset i a
  72.242 +
  72.243 +#   advanced options, lookup PLAT and OREL default for all modes
  72.244 +#   but those called from rpm URL rewrite mapper
  72.245 +if [ $op != "printstatus" -a $op != "rewriteurls" ]; then
  72.246 +    [ ".$REGISTRY_PLAT" = . ] && REGISTRY_PLAT="`$rpm --db-private --eval '%{l_platform -p}'`"
  72.247 +    [ ".$REGISTRY_OREL" = . ] && REGISTRY_OREL="`$rpm --db-private --eval '%{l_openpkg_release}'`"
  72.248 +fi
  72.249 +
  72.250 +#   display error or usage message
  72.251 +if [ ".$help" != .no ]; then
  72.252 +    if [ ".$help" != ".Usage" ]; then
  72.253 +        echo "$progname:ERROR: $help" 1>&2
  72.254 +    fi
  72.255 +    echo "Usage: $progname [-u|--user=<user>] [-l|--link=<token>] [-d|--desc=<text>]"
  72.256 +    echo "       [-m|--mode=fake|post|wipe] [-a|--args=<args>]"
  72.257 +    echo "       [--plat=<text>] [--orel=<text>] [--uuid=<file>]"
  72.258 +    echo "       [--conf=<file>] [--prep=<file>] [--tran=<file>] [--util=<file>] [--data=<tag>[,<tag>...]]"
  72.259 +    echo "       [-P|--preparation] [-T|--transaction] [-U|--utilization]"
  72.260 +    echo "       [-C|--convenience] [-I|--interaction]"
  72.261 +    echo "       [-v|--verbose] [-h|--help]"
  72.262 +    echo "Usage: $progname -S|--printstatus"
  72.263 +    echo "Usage: $progname -R|--rewriteurls [[url]...]]"
  72.264 +    if [ ".$help" != ".Usage" ]; then
  72.265 +        exit 1
  72.266 +    else
  72.267 +        exit 0
  72.268 +    fi
  72.269 +fi
  72.270 +
  72.271 +##
  72.272 +##  Primary operation Preparation
  72.273 +##
  72.274 +preparation()
  72.275 +{
  72.276 +    if [ ".$REGISTRY_MODE" = .wipe ]; then
  72.277 +        if [ ".$REGISTRY_PREP" != . ]; then
  72.278 +            if [ -f $REGISTRY_PREP ]; then
  72.279 +                cat </dev/null >$REGISTRY_PREP
  72.280 +            fi
  72.281 +        fi
  72.282 +        return
  72.283 +    fi
  72.284 +
  72.285 +    [ ".$REGISTRY_USER" = . ] && error "missing information REGISTRY_USER"
  72.286 +    [ ".$REGISTRY_DESC" = . ] && error "missing information REGISTRY_DESC"
  72.287 +    [ ".$REGISTRY_PLAT" = . ] && error "missing information REGISTRY_PLAT"
  72.288 +    [ ".$REGISTRY_OREL" = . ] && error "missing information REGISTRY_OREL"
  72.289 +    [ ".$REGISTRY_UUID" = . ] && error "missing information REGISTRY_UUID"
  72.290 +    [ ".$REGISTRY_PREP" = . ] && error "missing information REGISTRY_PREP"
  72.291 +
  72.292 +    if [ -r "$REGISTRY_UUID" ]; then
  72.293 +        sanitycheck "$REGISTRY_UUID" && . "$REGISTRY_UUID"
  72.294 +    fi
  72.295 +    [ ".$UUID_REGISTRY" = . ] && error "missing information UUID_REGISTRY"
  72.296 +    [ ".$UUID_INSTANCE" = . ] && error "missing information UUID_INSTANCE"
  72.297 +    [ ".$UUID_PLATFORM" = . ] && error "missing information UUID_PLATFORM"
  72.298 +
  72.299 +    #   amount of data being posted
  72.300 +    Q='"'; I="    "; N=$'\n'; D=""
  72.301 +
  72.302 +    echo "$REGISTRY_DATA" | grep request >/dev/null
  72.303 +    if [ $? = 0 ]; then
  72.304 +        D="${D}<?xml version=${Q}1.0${Q} encoding=${Q}iso-8859-1${Q} standalone=${Q}no${Q}?>${N}"
  72.305 +        D="${D}<!DOCTYPE registry${N}"
  72.306 +        D="${D}  PUBLIC ${Q}-//OpenPKG//DTD OpenPKG Registry 0.0.1//EN${Q}${N}"
  72.307 +        D="${D}  ${Q}http://registry.openpkg.org/registry.dtd${Q} []>${N}"
  72.308 +        D="${D}<registry>${N}"
  72.309 +        D="${D}${I}<request id=${Q}$UUID_REGISTRY${Q}${N}"
  72.310 +        D="${D}${I}${I}registry_user=${Q}$REGISTRY_USER${Q}${N}"
  72.311 +        [ ".$REGISTRY_LINK" != . ] && \
  72.312 +        D="${D}${I}${I}registry_link=${Q}$REGISTRY_LINK${Q}${N}" # optional
  72.313 +        D="${D}${I}${I}registry_desc=${Q}$REGISTRY_DESC${Q}${N}"
  72.314 +        D="${D}${I}${I}registry_plat=${Q}$REGISTRY_PLAT${Q}${N}"
  72.315 +        D="${D}${I}${I}registry_orel=${Q}$REGISTRY_OREL${Q}${N}"
  72.316 +        D="${D}${I}${I}uuid_registry=${Q}$UUID_REGISTRY${Q}${N}"
  72.317 +        D="${D}${I}${I}uuid_instance=${Q}$UUID_INSTANCE${Q}${N}"
  72.318 +        D="${D}${I}${I}uuid_platform=${Q}$UUID_PLATFORM${Q}${N}"
  72.319 +
  72.320 +        echo "$REGISTRY_DATA" | grep package >/dev/null
  72.321 +        if [ $? = 0 ]; then
  72.322 +            D="${D}${I}>${N}"
  72.323 +            F=""
  72.324 +            F="${F}${I}${I}<package id=${Q}%{PKGID}${Q} name=${Q}%{NAME}${Q} version=${Q}%{VERSION}${Q} release=${Q}%{RELEASE}${Q}"
  72.325 +            echo "$REGISTRY_DATA" | grep provides >/dev/null
  72.326 +            if [ $? = 0 ]; then
  72.327 +                F="${F}>\n"
  72.328 +                F="${F}[${I}${I}${I}<provides name=${Q}%{PROVIDENAME}${Q} flag=${Q}%{PROVIDEFLAGS:depflags}${Q} version=${Q}%{PROVIDEVERSION}${Q}/>\n]"
  72.329 +                F="${F}${I}${I}</package>\n"
  72.330 +            else
  72.331 +                F="${F}/>\n"
  72.332 +            fi
  72.333 +            D="${D}`$rpm --db-private --qf \"${F}\" -qa | sed '/<package id="(none)"/,/<\/package>/d'`${N}"
  72.334 +            D="${D}    </request>${N}"
  72.335 +        else
  72.336 +            D="${D}${I}/>${N}"
  72.337 +        fi
  72.338 +        D="${D}</registry>${N}"
  72.339 +    fi
  72.340 +    echo "$D" | tee $REGISTRY_PREP
  72.341 +}
  72.342 +
  72.343 +##
  72.344 +##  Primary operation Transaction
  72.345 +##
  72.346 +transaction()
  72.347 +{
  72.348 +    if [ ".$REGISTRY_MODE" = .wipe ]; then
  72.349 +        if [ ".$REGISTRY_TRAN" != . ]; then
  72.350 +            if [ -f $REGISTRY_TRAN ]; then
  72.351 +                cat </dev/null >$REGISTRY_TRAN
  72.352 +            fi
  72.353 +        fi
  72.354 +        return
  72.355 +    fi
  72.356 +
  72.357 +    [ ".$REGISTRY_MODE" = . ] && error "missing information REGISTRY_MODE"
  72.358 +    [ ".$REGISTRY_ARGS" = . ] && error "missing information REGISTRY_ARGS"
  72.359 +    [ ".$REGISTRY_TRAN" = . ] && error "missing information REGISTRY_TRAN"
  72.360 +
  72.361 +    if [ ".$REGISTRY_MODE" = .fake ]; then
  72.362 +        request=`awk '
  72.363 +            BEGIN { registry=0 }
  72.364 +            /<registry>/ { registry=1 }
  72.365 +            /<request / { if (registry) { print $0 } }
  72.366 +            /<\/registry>/ { registry=0 }' | \
  72.367 +            sed -e 's;^.*<request id=";;' -e 's;"$;;'`
  72.368 +        if [ ".$request" = . ]; then error "no request seen on stdin"; fi
  72.369 +        (
  72.370 +            echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"no\"?>"
  72.371 +            echo "<!DOCTYPE registry"
  72.372 +            echo "  PUBLIC \"-//OpenPKG//DTD OpenPKG Registry 0.0.1//EN\""
  72.373 +            echo "  \"http://registry.openpkg.org/registry.dtd\" []>"
  72.374 +            echo "<registry>"
  72.375 +            echo "    <response id=\"$request\" done=\"yes\">fake</response>"
  72.376 +            echo "</registry>"
  72.377 +        ) | tee $REGISTRY_TRAN
  72.378 +    fi
  72.379 +
  72.380 +    if [ ".$REGISTRY_MODE" = .post ]; then
  72.381 +        O=""
  72.382 +        if [ $verbose = no ]; then O="$O --silent"; fi
  72.383 +        $curl \
  72.384 +            $O \
  72.385 +            --user-agent "$useragent" \
  72.386 +            --connect-timeout 15 \
  72.387 +            --max-time 120 \
  72.388 +            --form 'page=dropxml' \
  72.389 +            --form 'data=<-' \
  72.390 +            --form 'submit=DROPXML' \
  72.391 +            $REGISTRY_ARGS \
  72.392 +        | tee $REGISTRY_TRAN
  72.393 +    fi
  72.394 +}
  72.395 +
  72.396 +##
  72.397 +##  Primary operation Utilization
  72.398 +##
  72.399 +utilization()
  72.400 +{
  72.401 +    if [ ".$REGISTRY_MODE" = .wipe ]; then
  72.402 +        if [ ".$REGISTRY_UTIL" != . ]; then
  72.403 +            if [ -f $REGISTRY_UTIL ]; then
  72.404 +                cat </dev/null >$REGISTRY_UTIL
  72.405 +            fi
  72.406 +        fi
  72.407 +        return
  72.408 +    fi
  72.409 +
  72.410 +    [ ".$REGISTRY_UTIL" = . ] && error "missing information REGISTRY_UTIL"
  72.411 +
  72.412 +    response=`awk '
  72.413 +        BEGIN { registry=0 }
  72.414 +        /<registry>/ { registry=1 }
  72.415 +        /<response / { if (registry) { print $0 } }
  72.416 +        /<\/registry>/ { registry=0 }' | \
  72.417 +        sed -e 's;^.*<response id=";;' -e 's;" done="; ;' -e 's;">; ;' -e 's;</response>.*$;;'`
  72.418 +    if [ ".$response" = . ]; then error "no response seen on stdin"; fi
  72.419 +
  72.420 +    REGISTRY_DBID=`echo $response | awk '/./ { print $1 }'`
  72.421 +    REGISTRY_DONE=`echo $response | awk '/./ { print $2 }'`
  72.422 +    REGISTRY_RESP=`echo $response | sed -e 's;^[^ ][^ ]* [^ ][^ ]* ;;'`
  72.423 +
  72.424 +    [ ".$REGISTRY_DBID" = . ] && error "missing information REGISTRY_DBID"
  72.425 +    [ ".$REGISTRY_DONE" = . ] && error "missing information REGISTRY_DONE"
  72.426 +    [ ".$REGISTRY_RESP" = . ] && error "missing information REGISTRY_RESP"
  72.427 +
  72.428 +    (
  72.429 +        echo "REGISTRY_DBID=\"$REGISTRY_DBID\""
  72.430 +        echo "REGISTRY_DONE=\"$REGISTRY_DONE\""
  72.431 +        echo "REGISTRY_RESP=\"$REGISTRY_RESP\""
  72.432 +    ) | tee $REGISTRY_UTIL
  72.433 +}
  72.434 +
  72.435 +##
  72.436 +##  Automatic registration data retrieval
  72.437 +##
  72.438 +autoregdata()
  72.439 +{
  72.440 +    if [ ".$REGISTRY_AUTO" != . ]; then
  72.441 +        O=""
  72.442 +        if [ $verbose = no ]; then O="$O --silent"; fi
  72.443 +        response=`$curl \
  72.444 +            $O -L \
  72.445 +            --user-agent "$useragent" \
  72.446 +            --connect-timeout 8 \
  72.447 +            --max-time 16 \
  72.448 +            $REGISTRY_AUTO \
  72.449 +        | awk '
  72.450 +            BEGIN { registry=0 }
  72.451 +            /<registry>/ { registry=1 }
  72.452 +            /<autoregister / { if (registry) { print $0 } }
  72.453 +            /<\/registry>/ { registry=0 }' \
  72.454 +        | sed -e 's;^.*<autoregister *;;' -e 's;>[^>]*</autoregister>.*$;;' \
  72.455 +          -e 's;\([^=]*\)="\([^"]*\)" *;\1="\2"\\
  72.456 +;g' \
  72.457 +        | awk -F= '/=/ { print "REGISTRY_"toupper($1)"="$2"" }'`
  72.458 +        if [ $verbose = yes ]; then echo "autoregdata from $REGISTRY_AUTO"; echo "$response"; fi
  72.459 +        eval "$response"
  72.460 +    fi
  72.461 +}
  72.462 +
  72.463 +##
  72.464 +##  Primary operation Convenience
  72.465 +##
  72.466 +convenience()
  72.467 +{
  72.468 +    if [ ".$REGISTRY_MODE" = .wipe ]; then
  72.469 +        utilization
  72.470 +        transaction
  72.471 +        preparation
  72.472 +        return
  72.473 +    fi
  72.474 +
  72.475 +    preparation | transaction | utilization
  72.476 +
  72.477 +    readutil || error "problem reading util"
  72.478 +    if [ ".$REGISTRY_DONE" = .yes ]; then
  72.479 +        echo "#`TZ= date '+%Y-%m-%d %H:%M:%S'` UTC" | tee "$REGISTRY_CONF" || return
  72.480 +        (
  72.481 +            echo "REGISTRY_USER=\"$REGISTRY_USER\""
  72.482 +            echo "REGISTRY_LINK=\"$REGISTRY_LINK\""
  72.483 +            echo "REGISTRY_DESC=\"$REGISTRY_DESC\""
  72.484 +            echo "REGISTRY_PLAT=\"$REGISTRY_PLAT\""
  72.485 +            echo "REGISTRY_OREL=\"$REGISTRY_OREL\""
  72.486 +            echo "REGISTRY_UUID=\"$REGISTRY_UUID\""
  72.487 +            echo "REGISTRY_PREP=\"$REGISTRY_PREP\""
  72.488 +            echo "REGISTRY_MODE=\"$REGISTRY_MODE\""
  72.489 +            echo "REGISTRY_ARGS=\"$REGISTRY_ARGS\""
  72.490 +            echo "REGISTRY_TRAN=\"$REGISTRY_TRAN\""
  72.491 +            echo "REGISTRY_UTIL=\"$REGISTRY_UTIL\""
  72.492 +        ) | tee -a "$REGISTRY_CONF"
  72.493 +    fi
  72.494 +}
  72.495 +
  72.496 +##
  72.497 +##  Primary operation Interaction
  72.498 +##
  72.499 +interaction()
  72.500 +{
  72.501 +    if [ ".$REGISTRY_MODE" = .wipe ]; then
  72.502 +        if [ ".$REGISTRY_CONF" != . ]; then
  72.503 +            if [ -f $REGISTRY_CONF ]; then
  72.504 +                cat </dev/null >$REGISTRY_CONF
  72.505 +            fi
  72.506 +        fi
  72.507 +        return
  72.508 +    fi
  72.509 +
  72.510 +    echo "OpenPKG Registry Client ($useragent)"
  72.511 +    echo ""
  72.512 +    echo "Interactive step-by-step registration procedure."
  72.513 +    echo "You can abort at any time by just pressing CTRL-C."
  72.514 +    echo ""
  72.515 +    echo "Registration is a three step process:"
  72.516 +    echo "1. Preparation = create a configuration file and locally prepare a registration request"
  72.517 +    echo "2. Transaction = run a transaction to submit the request to the registry"
  72.518 +    echo "3. Utilization = memorize the response to activate local URL rewriting"
  72.519 +    echo ""
  72.520 +    echo "A (*) marks an optional field where the empty string \"\" is allowed."
  72.521 +    echo "Just press RETURN to continue and/or keep a default setting."
  72.522 +
  72.523 +    echo ""
  72.524 +    echo "==== Step 1/3: Preparation ===="
  72.525 +    echo "Attempting to write to the configuration file \"$REGISTRY_CONF\""
  72.526 +    echo "#`TZ= date '+%Y-%m-%d %H:%M:%S'` UTC" | tee -a "$REGISTRY_CONF" 2>/dev/null \
  72.527 +        || error "Configuration file not writable. Get more permissions and try again"
  72.528 +
  72.529 +    read -p "[REGISTRY_USER=\"$REGISTRY_USER\"] username? ";          [ ".$REPLY" != . ] && REGISTRY_USER="$REPLY"
  72.530 +    read -p "[REGISTRY_DESC=\"$REGISTRY_DESC\"] description (*)? ";   [ ".$REPLY" != . ] && REGISTRY_DESC="$REPLY"
  72.531 +    read -p "[REGISTRY_PLAT=\"$REGISTRY_PLAT\"] platform (*)? ";      [ ".$REPLY" != . ] && REGISTRY_DESC="$REPLY"
  72.532 +    read -p "[REGISTRY_OREL=\"$REGISTRY_OREL\"] release (*)? ";       [ ".$REPLY" != . ] && REGISTRY_DESC="$REPLY"
  72.533 +    read -p "[REGISTRY_UUID=\"$REGISTRY_UUID\"] uuid file to read? "; [ ".$REPLY" != . ] && REGISTRY_UUID="$REPLY"
  72.534 +    read -p "[REGISTRY_DATA=\"$REGISTRY_DATA\"] data to prepare? ";   [ ".$REPLY" != . ] && REGISTRY_DATA="$REPLY"
  72.535 +    read -p "[REGISTRY_PREP=\"$REGISTRY_PREP\"] prep dump file? ";    [ ".$REPLY" != . ] && REGISTRY_PREP="$REPLY"
  72.536 +
  72.537 +    [ ".$REGISTRY_USER" = . ] && error "missing information REGISTRY_USER"
  72.538 +    [ ".$REGISTRY_DESC" = . ] && error "missing information REGISTRY_DESC"
  72.539 +    [ ".$REGISTRY_PLAT" = . ] && error "missing information REGISTRY_PLAT"
  72.540 +    [ ".$REGISTRY_OREL" = . ] && error "missing information REGISTRY_OREL"
  72.541 +    [ ".$REGISTRY_UUID" = . ] && error "missing information REGISTRY_UUID"
  72.542 +    [ ".$REGISTRY_DATA" = . ] && error "missing information REGISTRY_DATA"
  72.543 +    [ ".$REGISTRY_PREP" = . ] && error "missing information REGISTRY_PREP"
  72.544 +
  72.545 +    if [ -r "$REGISTRY_UUID" ]; then
  72.546 +        sanitycheck "$REGISTRY_UUID" && . "$REGISTRY_UUID"
  72.547 +    fi
  72.548 +    [ ".$UUID_REGISTRY" = . ] && error "missing information UUID_REGISTRY"
  72.549 +    [ ".$UUID_INSTANCE" = . ] && error "missing information UUID_INSTANCE"
  72.550 +    [ ".$UUID_PLATFORM" = . ] && error "missing information UUID_PLATFORM"
  72.551 +
  72.552 +    echo "Appending to configuration file \"$REGISTRY_CONF\""
  72.553 +    (
  72.554 +        echo "REGISTRY_USER=\"$REGISTRY_USER\""
  72.555 +        echo "REGISTRY_LINK=\"$REGISTRY_LINK\""
  72.556 +        echo "REGISTRY_DESC=\"$REGISTRY_DESC\""
  72.557 +        echo "REGISTRY_PLAT=\"$REGISTRY_PLAT\""
  72.558 +        echo "REGISTRY_OREL=\"$REGISTRY_OREL\""
  72.559 +        echo "REGISTRY_UUID=\"$REGISTRY_UUID\""
  72.560 +        echo "REGISTRY_PREP=\"$REGISTRY_PREP\""
  72.561 +    ) | tee -a "$REGISTRY_CONF"
  72.562 +
  72.563 +    preparation
  72.564 +
  72.565 +    echo ""
  72.566 +    echo "==== Step 2/3: Transaction ===="
  72.567 +    read -p "[REGISTRY_MODE=\"$REGISTRY_MODE\"] mode (post or fake)? "; [ ".$REPLY" != . ] && REGISTRY_MODE="$REPLY"
  72.568 +    read -p "[REGISTRY_ARGS=\"$REGISTRY_ARGS\"] args? ";                [ ".$REPLY" != . ] && REGISTRY_ARGS="$REPLY"
  72.569 +    read -p "[REGISTRY_TRAN=\"$REGISTRY_TRAN\"] tran dump file? ";      [ ".$REPLY" != . ] && REGISTRY_TRAN="$REPLY"
  72.570 +
  72.571 +    [ ".$REGISTRY_MODE" = . ] && error "missing information REGISTRY_MODE"
  72.572 +    [ ".$REGISTRY_ARGS" = . ] && error "missing information REGISTRY_ARGS"
  72.573 +    [ ".$REGISTRY_TRAN" = . ] && error "missing information REGISTRY_TRAN"
  72.574 +
  72.575 +    echo "Appending to configuration file \"$REGISTRY_CONF\""
  72.576 +    (
  72.577 +        echo "REGISTRY_MODE=\"$REGISTRY_MODE\""
  72.578 +        echo "REGISTRY_ARGS=\"$REGISTRY_ARGS\""
  72.579 +        echo "REGISTRY_TRAN=\"$REGISTRY_TRAN\""
  72.580 +    ) | tee -a "$REGISTRY_CONF"
  72.581 +
  72.582 +    transaction <$REGISTRY_PREP
  72.583 +
  72.584 +    echo ""
  72.585 +    echo "==== Step 3/3: Utilization ===="
  72.586 +    read -p "[REGISTRY_UTIL=\"$REGISTRY_UTIL\"] util dump file? ";      [ ".$REPLY" != . ] && REGISTRY_UTIL="$REPLY"
  72.587 +
  72.588 +    [ ".$REGISTRY_UTIL" = . ] && error "missing information REGISTRY_UTIL"
  72.589 +
  72.590 +    echo "Appending to configuration file \"$REGISTRY_CONF\""
  72.591 +    (
  72.592 +        echo "REGISTRY_UTIL=\"$REGISTRY_UTIL\""
  72.593 +    ) | tee -a "$REGISTRY_CONF"
  72.594 +
  72.595 +    utilization <$REGISTRY_TRAN
  72.596 +}
  72.597 +
  72.598 +##
  72.599 +##  Additional feature printstatus
  72.600 +##
  72.601 +printstatus()
  72.602 +{
  72.603 +    rc=0
  72.604 +    readconf || error "problem reading conf"
  72.605 +    readuuid || error "problem reading uuid"
  72.606 +    readutil || error "problem reading util"
  72.607 +    if [ ".$REGISTRY_DONE" = .yes ]; then
  72.608 +        cat "$REGISTRY_UTIL"
  72.609 +        return 0
  72.610 +    fi
  72.611 +    return 1
  72.612 +}
  72.613 +
  72.614 +##
  72.615 +##  Additional feature rewriteurls
  72.616 +##
  72.617 +rewriteurls()
  72.618 +{
  72.619 +    readconf && readuuid && readutil || return $?
  72.620 +    if [ ".$REGISTRY_DONE" = .yes ]; then
  72.621 +        #   URL rewriting
  72.622 +        while [ ".$1" != . ]; do
  72.623 +            printf '%s\n' "$1" | \
  72.624 +            sed -e "s;^\([^:/]*\)://\([^:/]*\.openpkg\.com\)/;\1://$UUID_REGISTRY:$UUID_INSTANCE.$UUID_PLATFORM@\2/;" \
  72.625 +                -e "s;^\([^:/]*\)://\([^:/]*\.openpkg\.org\)/;\1://$UUID_REGISTRY:$UUID_INSTANCE.$UUID_PLATFORM@\2/;" \
  72.626 +                -e "s;^\([^:/]*\)://\([^:/]*\.openpkg\.net\)/;\1://$UUID_REGISTRY:$UUID_INSTANCE.$UUID_PLATFORM@\2/;"
  72.627 +            shift
  72.628 +        done
  72.629 +        return 0
  72.630 +    else
  72.631 +        #   stealth mode
  72.632 +        return 1
  72.633 +    fi
  72.634 +}
  72.635 +
  72.636 +##
  72.637 +##  check whether important configuration data is missing
  72.638 +##
  72.639 +checkmissing()
  72.640 +{
  72.641 +    missing=""
  72.642 +    [ ".$REGISTRY_USER" = . ] && missing="$missing REGISTRY_USER"
  72.643 +    [ ".$REGISTRY_DESC" = . ] && missing="$missing REGISTRY_DESC"
  72.644 +    [ ".$REGISTRY_PLAT" = . ] && missing="$missing REGISTRY_PLAT"
  72.645 +    [ ".$REGISTRY_OREL" = . ] && missing="$missing REGISTRY_OREL"
  72.646 +    [ ".$REGISTRY_UUID" = . ] && missing="$missing REGISTRY_UUID"
  72.647 +    [ ".$REGISTRY_PREP" = . ] && missing="$missing REGISTRY_PREP"
  72.648 +    [ ".$REGISTRY_MODE" = . ] && missing="$missing REGISTRY_MODE"
  72.649 +    [ ".$REGISTRY_ARGS" = . ] && missing="$missing REGISTRY_ARGS"
  72.650 +    [ ".$REGISTRY_TRAN" = . ] && missing="$missing REGISTRY_TRAN"
  72.651 +    [ ".$REGISTRY_UTIL" = . ] && missing="$missing REGISTRY_UTIL"
  72.652 +}
  72.653 +
  72.654 +##
  72.655 +##  automatically pick interaction or convenience
  72.656 +##
  72.657 +automatic()
  72.658 +{
  72.659 +    if [ ".$REGISTRY_MODE" = .wipe ]; then
  72.660 +        convenience
  72.661 +        interaction
  72.662 +        return
  72.663 +    fi
  72.664 +
  72.665 +    checkmissing
  72.666 +    if [ ".$missing" != . ]; then
  72.667 +        autoregdata
  72.668 +    fi
  72.669 +
  72.670 +    checkmissing
  72.671 +    if [ ".$missing" = . ]; then
  72.672 +        convenience
  72.673 +    else
  72.674 +        tty -s || return
  72.675 +        echo "missing $missing"
  72.676 +        interaction
  72.677 +    fi
  72.678 +}
  72.679 +
  72.680 +##
  72.681 +##  primary operation switch
  72.682 +##
  72.683 +eval $op "\"$@\""
  72.684 +exit $?
  72.685 +
  72.686 +##
  72.687 +##  MANUAL PAGE
  72.688 +##
  72.689 +
    73.1 --- a/openpkg/release.8	Tue Jul 31 12:12:54 2012 +0200
    73.2 +++ b/openpkg/release.8	Tue Jul 31 12:23:42 2012 +0200
    73.3 @@ -1,15 +1,7 @@
    73.4 -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
    73.5 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
    73.6  .\"
    73.7  .\" Standard preamble:
    73.8  .\" ========================================================================
    73.9 -.de Sh \" Subsection heading
   73.10 -.br
   73.11 -.if t .Sp
   73.12 -.ne 5
   73.13 -.PP
   73.14 -\fB\\$1\fR
   73.15 -.PP
   73.16 -..
   73.17  .de Sp \" Vertical space (when we can't use .PP)
   73.18  .if t .sp .5v
   73.19  .if n .sp
   73.20 @@ -25,11 +17,11 @@
   73.21  ..
   73.22  .\" Set up some character translations and predefined strings.  \*(-- will
   73.23  .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   73.24 -.\" double quote, and \*(R" will give a right double quote.  | will give a
   73.25 -.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
   73.26 -.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
   73.27 -.\" expand to `' in nroff, nothing in troff, for use with C<>.
   73.28 -.tr \(*W-|\(bv\*(Tr
   73.29 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
   73.30 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
   73.31 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
   73.32 +.\" nothing in troff, for use with C<>.
   73.33 +.tr \(*W-
   73.34  .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   73.35  .ie n \{\
   73.36  .    ds -- \(*W-
   73.37 @@ -48,22 +40,25 @@
   73.38  .    ds R" ''
   73.39  'br\}
   73.40  .\"
   73.41 +.\" Escape single quotes in literal strings from groff's Unicode transform.
   73.42 +.ie \n(.g .ds Aq \(aq
   73.43 +.el       .ds Aq '
   73.44 +.\"
   73.45  .\" If the F register is turned on, we'll generate index entries on stderr for
   73.46 -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
   73.47 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
   73.48  .\" entries marked with X<> in POD.  Of course, you'll have to process the
   73.49  .\" output yourself in some meaningful fashion.
   73.50 -.if \nF \{\
   73.51 +.ie \nF \{\
   73.52  .    de IX
   73.53  .    tm Index:\\$1\t\\n%\t"\\$2"
   73.54  ..
   73.55  .    nr % 0
   73.56  .    rr F
   73.57  .\}
   73.58 -.\"
   73.59 -.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   73.60 -.\" way too many mistakes in technical documents.
   73.61 -.hy 0
   73.62 -.if n .na
   73.63 +.el \{\
   73.64 +.    de IX
   73.65 +..
   73.66 +.\}
   73.67  .\"
   73.68  .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   73.69  .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   73.70 @@ -130,8 +125,12 @@
   73.71  .\"
   73.72  .IX Title "RELEASE 8"
   73.73  .TH RELEASE 8 "OpenPKG" "RELEASE(8)" "OpenPKG"
   73.74 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   73.75 +.\" way too many mistakes in technical documents.
   73.76 +.if n .ad l
   73.77 +.nh
   73.78  .SH "NAME"
   73.79 -\&\fBopenpkg release\fR \- OpenPKG Release Utility
   73.80 +openpkg release \- OpenPKG Release Utility
   73.81  .SH "SYNOPSIS"
   73.82  .IX Header "SYNOPSIS"
   73.83  \&\fBopenpkg release\fR [\fB\-F\fR|\fB\-\-fmt\fR \fIformat\fR]
   73.84 @@ -148,19 +147,20 @@
   73.85  The output format specification. The argument \fIformat\fR is an arbitrary
   73.86  string which can contain the special expansion constructs "\f(CW%t\fR\*(L" for
   73.87  expanding the release tag, \*(R"\f(CW%u\fR\*(L" for expanding the distribution \s-1URL\s0
   73.88 -and \*(R"\f(CW\*(C`\en\*(C'\fR" for expanding an embedded newline character. 
   73.89 +and \*(R"\f(CW\*(C`\en\*(C'\fR" for expanding an embedded newline character.
   73.90  The instance \s-1UUID\s0 information is also availble by expanding
   73.91  \&\f(CW%r\fR to \s-1UUID_REGISTRY\s0, \f(CW%i\fR to \s-1UUID_INSTANCE\s0, \f(CW%p\fR to \s-1UUID_PLATFORM\s0.
   73.92  The default \fIformat\fR is "\f(CW\*(C`OpenPKG\-%t %u\*(C'\fR".
   73.93  .IP "\fB\-r\fR, \fB\-\-release\fR \fIrelease\fR" 4
   73.94  .IX Item "-r, --release release"
   73.95  The package "\f(CW\*(C`Release\*(C'\fR" header value to use for deriving the release
   73.96 -tag. The values in the \fI@l_prefix@/etc/openpkg/release\fR file and the
   73.97 +tag. The values in the \fI\f(CI@l_prefix\fI@/etc/openpkg/release\fR file and the
   73.98  "\f(CW\*(C`Release\*(C'\fR" header of the bootstrap package \fBopenpkg\fR are ignored if
   73.99  this option is used.
  73.100  .SH "FILES"
  73.101  .IX Header "FILES"
  73.102 -.IP "\fI@l_prefix@/etc/openpkg/release\fR" 4
  73.103 +.ie n .IP "\fI\fI@l_prefix\fI@/etc/openpkg/release\fR" 4
  73.104 +.el .IP "\fI\f(CI@l_prefix\fI@/etc/openpkg/release\fR" 4
  73.105  .IX Item "@l_prefix@/etc/openpkg/release"
  73.106  This optional configuration file can be used to explicitly set values
  73.107  for the OpenPKG release tag and distribution URLs. It consists of lines
  73.108 @@ -178,43 +178,33 @@
  73.109  The fully-qualified distribution \s-1URL\s0 based on either the "\f(CW\*(C`ftp\*(C'\fR\*(L",
  73.110  \&\*(R"\f(CW\*(C`http\*(C'\fR\*(L" or \*(R"\f(CW\*(C`file\*(C'\fR" \s-1URL\s0 schemes. If \fIurl\fR contains a trailing
  73.111  "\f(CW\*(C`/*\*(C'\fR", this is expanded according to the \fItag\fR value of the \fB\s-1TAG\s0\fR
  73.112 -variable and the corresponding filesystem layout on \f(CW\*(C`ftp.openpkg.org\*(C'\fR.
  73.113 -The default \fIurl\fR is "\f(CW\*(C`ftp://ftp.openpkg.org/*\*(C'\fR".
  73.114 +variable and the corresponding filesystem layout on \f(CW\*(C`download.openpkg.org\*(C'\fR.
  73.115 +The default \fIurl\fR is "\f(CW\*(C`http://download.openpkg.org/stacks/*\*(C'\fR".
  73.116 +.RE
  73.117  .RS 4
  73.118  .RE
  73.119 -.RS 4
  73.120  .SH "EXAMPLE"
  73.121  .IX Header "EXAMPLE"
  73.122  .Vb 2
  73.123  \& $ openpkg release
  73.124 -\& OpenPKG-CURRENT ftp://ftp.openpkg.org/current/SRC/
  73.125 -.Ve
  73.126 -.Sp
  73.127 -.Vb 2
  73.128 -\& $ openpkg release --fmt=%t
  73.129 +\& OpenPKG\-CURRENT http://download.openpkg.org/stacks/current/
  73.130 +\&
  73.131 +\& $ openpkg release \-\-fmt=%t
  73.132  \& CURRENT
  73.133 -.Ve
  73.134 -.Sp
  73.135 -.Vb 2
  73.136 -\& $ openpkg release --fmt=%u
  73.137 -\& ftp://ftp.openpkg.org/current/SRC/
  73.138 -.Ve
  73.139 -.Sp
  73.140 -.Vb 3
  73.141 -\& $ openpkg release --fmt="OpenPKG %t is located at:\e\en%u"
  73.142 +\&
  73.143 +\& $ openpkg release \-\-fmt=%u
  73.144 +\& http://download.openpkg.org/stacks/current/
  73.145 +\&
  73.146 +\& $ openpkg release \-\-fmt="OpenPKG %t is located at:\e\en%u"
  73.147  \& OpenPKG CURRENT is located at:
  73.148 -\& ftp://ftp.openpkg.org/current/SRC/
  73.149 -.Ve
  73.150 -.Sp
  73.151 -.Vb 2
  73.152 -\& $ openpkg release --release=2.5.4 --fmt=%t
  73.153 -\& 2.5-RELEASE
  73.154 -.Ve
  73.155 -.Sp
  73.156 -.Vb 3
  73.157 +\& http://download.openpkg.org/stacks/current/
  73.158 +\&
  73.159 +\& $ openpkg release \-\-release=2.5.4 \-\-fmt=%t
  73.160 +\& 2.5\-RELEASE
  73.161 +\&
  73.162  \& $ cat /openpkg/etc/openpkg/release
  73.163 -\& TAG=2-STABLE-20060622
  73.164 -\& URL=ftp://ftp.example.com/mirror/openpkg.org/*
  73.165 +\& TAG=CURRENT
  73.166 +\& URL=http://download.example.com/stack/current/
  73.167  .Ve
  73.168  .SH "SEE ALSO"
  73.169  .IX Header "SEE ALSO"
    74.1 --- a/openpkg/release.pod	Tue Jul 31 12:12:54 2012 +0200
    74.2 +++ b/openpkg/release.pod	Tue Jul 31 12:23:42 2012 +0200
    74.3 @@ -1,14 +1,13 @@
    74.4  ##
    74.5  ##  release -- OpenPKG Release Utility
    74.6 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    74.7 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    74.8 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    74.9  ##
   74.10 -##  Permission to use, copy, modify, and distribute this software for
   74.11 -##  any purpose with or without fee is hereby granted, provided that
   74.12 -##  the above copyright notice and this permission notice appear in all
   74.13 -##  copies.
   74.14 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   74.15 +##  All rights reserved. Licenses which grant limited permission to use,
   74.16 +##  copy, modify and distribute this software are available from the
   74.17 +##  OpenPKG GmbH.
   74.18  ##
   74.19 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   74.20 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   74.21  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   74.22  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   74.23  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   74.24 @@ -48,7 +47,7 @@
   74.25  The output format specification. The argument I<format> is an arbitrary
   74.26  string which can contain the special expansion constructs "C<%t>" for
   74.27  expanding the release tag, "C<%u>" for expanding the distribution URL
   74.28 -and "C<\n>" for expanding an embedded newline character. 
   74.29 +and "C<\n>" for expanding an embedded newline character.
   74.30  The instance UUID information is also availble by expanding
   74.31  C<%r> to UUID_REGISTRY, C<%i> to UUID_INSTANCE, C<%p> to UUID_PLATFORM.
   74.32  The default I<format> is "C<OpenPKG-%t %u>".
   74.33 @@ -87,34 +86,34 @@
   74.34  The fully-qualified distribution URL based on either the "C<ftp>",
   74.35  "C<http>" or "C<file>" URL schemes. If I<url> contains a trailing
   74.36  "C</*>", this is expanded according to the I<tag> value of the B<TAG>
   74.37 -variable and the corresponding filesystem layout on C<ftp.openpkg.org>.
   74.38 -The default I<url> is "C<ftp://ftp.openpkg.org/*>".
   74.39 +variable and the corresponding filesystem layout on C<download.openpkg.org>.
   74.40 +The default I<url> is "C<http://download.openpkg.org/stacks/*>".
   74.41  
   74.42 -=over
   74.43 +=back
   74.44  
   74.45  =back
   74.46  
   74.47  =head1 EXAMPLE
   74.48  
   74.49   $ openpkg release
   74.50 - OpenPKG-CURRENT ftp://ftp.openpkg.org/current/SRC/
   74.51 + OpenPKG-CURRENT http://download.openpkg.org/stacks/current/
   74.52  
   74.53   $ openpkg release --fmt=%t
   74.54   CURRENT
   74.55  
   74.56   $ openpkg release --fmt=%u
   74.57 - ftp://ftp.openpkg.org/current/SRC/
   74.58 + http://download.openpkg.org/stacks/current/
   74.59  
   74.60   $ openpkg release --fmt="OpenPKG %t is located at:\\n%u"
   74.61   OpenPKG CURRENT is located at:
   74.62 - ftp://ftp.openpkg.org/current/SRC/
   74.63 + http://download.openpkg.org/stacks/current/
   74.64  
   74.65   $ openpkg release --release=2.5.4 --fmt=%t
   74.66   2.5-RELEASE
   74.67  
   74.68   $ cat /openpkg/etc/openpkg/release
   74.69 - TAG=2-STABLE-20060622
   74.70 - URL=ftp://ftp.example.com/mirror/openpkg.org/*
   74.71 + TAG=CURRENT
   74.72 + URL=http://download.example.com/stack/current/
   74.73  
   74.74  =head1 SEE ALSO
   74.75  
    75.1 --- a/openpkg/release.sh	Tue Jul 31 12:12:54 2012 +0200
    75.2 +++ b/openpkg/release.sh	Tue Jul 31 12:23:42 2012 +0200
    75.3 @@ -1,15 +1,14 @@
    75.4  #!@l_prefix@/lib/openpkg/bash
    75.5  ##
    75.6  ##  release -- OpenPKG Release Determination Utility
    75.7 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    75.8 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    75.9 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
   75.10  ##
   75.11 -##  Permission to use, copy, modify, and distribute this software for
   75.12 -##  any purpose with or without fee is hereby granted, provided that
   75.13 -##  the above copyright notice and this permission notice appear in all
   75.14 -##  copies.
   75.15 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   75.16 +##  All rights reserved. Licenses which grant limited permission to use,
   75.17 +##  copy, modify and distribute this software are available from the
   75.18 +##  OpenPKG GmbH.
   75.19  ##
   75.20 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   75.21 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   75.22  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   75.23  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   75.24  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   75.25 @@ -76,9 +75,10 @@
   75.26          -e 's;^X *TAG *= *\([^ ][^ ]*\).*;\1;' \
   75.27          -e '/^X/d' | \
   75.28          sed -n -e '$p'`
   75.29 -else
   75.30 +fi
   75.31 +if [ ".$tag" = . ]; then
   75.32      tag=`$prefix/bin/openpkg rpm \
   75.33 -        -q --qf '%{VERSION}\n' openpkg | number_to_tag`
   75.34 +        -q --qf '%{RELEASE}\n' openpkg | number_to_tag`
   75.35  fi
   75.36  if [ .`echo ".$tag" | sed -e 's;^\.;;' | tag_sanity` = .ERROR ]; then
   75.37      echo "openpkg:release: WARNING: unable to determine OpenPKG release tag" 1>&2
   75.38 @@ -95,14 +95,14 @@
   75.39          sed -n -e '$p'`
   75.40  fi
   75.41  if [ ".$url" = . ]; then
   75.42 -    url="ftp://ftp.openpkg.org/*"
   75.43 +    url="http://download.openpkg.org/stacks/*"
   75.44  fi
   75.45  case ".$url" in
   75.46      */\* )
   75.47          url=`echo ".$url" | sed -e 's;^\.;;' -e 's;/\*$;;'`
   75.48          case "$tag" in
   75.49              CURRENT )
   75.50 -                url="$url/current/SRC/"
   75.51 +                url="$url/current/"
   75.52                  ;;
   75.53              CURRENT-* )
   75.54                  version=`echo "$tag" | sed -e 's;^CURRENT-;;'`
   75.55 @@ -128,6 +128,10 @@
   75.56                  version=`echo "$tag" | sed -e 's;^\(.*\)-RELEASE$;\1;'`
   75.57                  url="$url/release/$version/"
   75.58                  ;;
   75.59 +            * )
   75.60 +                subdir=`echo "$tag" | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
   75.61 +                url="$url/$subdir/"
   75.62 +                ;;
   75.63          esac
   75.64          ;;
   75.65  esac
    76.1 --- a/openpkg/root.README	Tue Jul 31 12:12:54 2012 +0200
    76.2 +++ b/openpkg/root.README	Tue Jul 31 12:23:42 2012 +0200
    76.3 @@ -1,9 +1,9 @@
    76.4  
    76.5 -  This is @l_prefix@, an RPM-based OpenPKG software package hierarchy.
    76.6 +  This is @l_prefix@, an RPM-based OpenPKG software stack.
    76.7    This filesystem area contains software which was automatically
    76.8 -  installed through OpenPKG RPM packages from http://www.openpkg.org/.
    76.9 +  installed through OpenPKG RPM packages from http://openpkg.org/.
   76.10  
   76.11 -  Short OpenPKG RPM query command summary:
   76.12 +  OpenPKG RPM query command summary:
   76.13  
   76.14    $ @l_prefix@/bin/openpkg rpm -qa
   76.15      (q)uery list of (a)ll installed packages
   76.16 @@ -11,14 +11,26 @@
   76.17    $ @l_prefix@/bin/openpkg rpm -qi <name>
   76.18      (q)uery (i)nformation about package <name>
   76.19  
   76.20 -  $ @l_prefix@/bin/openpkg rpm -qlv <name>
   76.21 +  $ @l_prefix@/bin/openpkg rpm -qvl <name>
   76.22      (q)uery (v)erbose (l)ist of installed files of package <name>
   76.23  
   76.24 +  $ @l_prefix@/bin/openpkg rpm -qf <file>
   76.25 +    (q)uery package which contains (f)ile <file>
   76.26 +
   76.27 +  $ @l_prefix@/bin/openpkg rpm -qa '<tag>=[!]<pattern>'
   76.28 +    (q)uery list of (a)ll packages with <tag> [not] matching <pattern>
   76.29 +
   76.30 +  $ @l_prefix@/bin/openpkg rpm -q --whatrequires <capability>
   76.31 +    (q)uery list of (a)ll packages which require <capability>
   76.32 +
   76.33 +  $ @l_prefix@/bin/openpkg rpm -q --whatprovides <capability>
   76.34 +    (q)uery list of (a)ll packages which provide <capability>
   76.35 +
   76.36    Use "eval `@l_prefix@/bin/openpkg rc --eval all env`" from within a
   76.37    user's Bourne (Again) Shell startup script (.profile or .bashrc) in
   76.38 -  order to activate this hierarchy and all of its packages.
   76.39 +  order to activate this OpenPKG software stack and all of its packages.
   76.40  
   76.41    In case of any questions or problems post to the OpenPKG project
   76.42    user support mailing list <openpkg-users@openpkg.org>. For more
   76.43 -  details about OpenPKG visit http://www.openpkg.org/.
   76.44 +  details about OpenPKG visit http://openpkg.org/.
   76.45  
    77.1 --- a/openpkg/rpm-config.8	Tue Jul 31 12:12:54 2012 +0200
    77.2 +++ b/openpkg/rpm-config.8	Tue Jul 31 12:23:42 2012 +0200
    77.3 @@ -1,15 +1,7 @@
    77.4 -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
    77.5 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
    77.6  .\"
    77.7  .\" Standard preamble:
    77.8  .\" ========================================================================
    77.9 -.de Sh \" Subsection heading
   77.10 -.br
   77.11 -.if t .Sp
   77.12 -.ne 5
   77.13 -.PP
   77.14 -\fB\\$1\fR
   77.15 -.PP
   77.16 -..
   77.17  .de Sp \" Vertical space (when we can't use .PP)
   77.18  .if t .sp .5v
   77.19  .if n .sp
   77.20 @@ -25,11 +17,11 @@
   77.21  ..
   77.22  .\" Set up some character translations and predefined strings.  \*(-- will
   77.23  .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   77.24 -.\" double quote, and \*(R" will give a right double quote.  | will give a
   77.25 -.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
   77.26 -.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
   77.27 -.\" expand to `' in nroff, nothing in troff, for use with C<>.
   77.28 -.tr \(*W-|\(bv\*(Tr
   77.29 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
   77.30 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
   77.31 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
   77.32 +.\" nothing in troff, for use with C<>.
   77.33 +.tr \(*W-
   77.34  .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   77.35  .ie n \{\
   77.36  .    ds -- \(*W-
   77.37 @@ -48,22 +40,25 @@
   77.38  .    ds R" ''
   77.39  'br\}
   77.40  .\"
   77.41 +.\" Escape single quotes in literal strings from groff's Unicode transform.
   77.42 +.ie \n(.g .ds Aq \(aq
   77.43 +.el       .ds Aq '
   77.44 +.\"
   77.45  .\" If the F register is turned on, we'll generate index entries on stderr for
   77.46 -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
   77.47 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
   77.48  .\" entries marked with X<> in POD.  Of course, you'll have to process the
   77.49  .\" output yourself in some meaningful fashion.
   77.50 -.if \nF \{\
   77.51 +.ie \nF \{\
   77.52  .    de IX
   77.53  .    tm Index:\\$1\t\\n%\t"\\$2"
   77.54  ..
   77.55  .    nr % 0
   77.56  .    rr F
   77.57  .\}
   77.58 -.\"
   77.59 -.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   77.60 -.\" way too many mistakes in technical documents.
   77.61 -.hy 0
   77.62 -.if n .na
   77.63 +.el \{\
   77.64 +.    de IX
   77.65 +..
   77.66 +.\}
   77.67  .\"
   77.68  .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   77.69  .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   77.70 @@ -130,8 +125,12 @@
   77.71  .\"
   77.72  .IX Title "RPM-CONFIG 8"
   77.73  .TH RPM-CONFIG 8 "OpenPKG" "RPM-CONFIG(8)" "OpenPKG"
   77.74 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   77.75 +.\" way too many mistakes in technical documents.
   77.76 +.if n .ad l
   77.77 +.nh
   77.78  .SH "NAME"
   77.79 -\&\fBrpm\-config\fR \- OpenPKG RPM library build utility
   77.80 +rpm\-config \- OpenPKG RPM library build utility
   77.81  .SH "VERSION"
   77.82  .IX Header "VERSION"
   77.83  OpenPKG \s-1RPM\s0 \s-1RPM_VERSION\s0
   77.84 @@ -188,25 +187,19 @@
   77.85  .SH "EXAMPLE"
   77.86  .IX Header "EXAMPLE"
   77.87  .Vb 5
   77.88 -\& CC       = `rpm-config --cc`
   77.89 -\& CPPFLAGS = `rpm-config --cppflags`
   77.90 -\& CFLAGS   = `rpm-config --cflags`
   77.91 -\& LDFLAGS  = `rpm-config --ldflags`
   77.92 -\& LIBS     = `rpm-config --libs`
   77.93 -.Ve
   77.94 -.PP
   77.95 -.Vb 1
   77.96 +\& CC       = \`rpm\-config \-\-cc\`
   77.97 +\& CPPFLAGS = \`rpm\-config \-\-cppflags\`
   77.98 +\& CFLAGS   = \`rpm\-config \-\-cflags\`
   77.99 +\& LDFLAGS  = \`rpm\-config \-\-ldflags\`
  77.100 +\& LIBS     = \`rpm\-config \-\-libs\`
  77.101 +\&
  77.102  \& all: foo
  77.103 -.Ve
  77.104 -.PP
  77.105 -.Vb 2
  77.106 +\&
  77.107  \& foo: foo.o
  77.108 -\&     $(CC) $(LDFLAGS) -o foo foo.o $(LIBS)
  77.109 -.Ve
  77.110 -.PP
  77.111 -.Vb 2
  77.112 +\&     $(CC) $(LDFLAGS) \-o foo foo.o $(LIBS)
  77.113 +\&
  77.114  \& foo.o: foo.c
  77.115 -\&     $(CC) $(CPPFLAGS) $(CFLAGS) -o foo.o -c foo.c
  77.116 +\&     $(CC) $(CPPFLAGS) $(CFLAGS) \-o foo.o \-c foo.c
  77.117  .Ve
  77.118  .SH "SEE ALSO"
  77.119  .IX Header "SEE ALSO"
    78.1 --- a/openpkg/rpm-config.pod	Tue Jul 31 12:12:54 2012 +0200
    78.2 +++ b/openpkg/rpm-config.pod	Tue Jul 31 12:23:42 2012 +0200
    78.3 @@ -1,14 +1,13 @@
    78.4  ##
    78.5  ##  rpm-config -- OpenPKG RPM Library Build Utility
    78.6 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    78.7 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    78.8 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    78.9  ##
   78.10 -##  Permission to use, copy, modify, and distribute this software for
   78.11 -##  any purpose with or without fee is hereby granted, provided that
   78.12 -##  the above copyright notice and this permission notice appear in all
   78.13 -##  copies.
   78.14 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   78.15 +##  All rights reserved. Licenses which grant limited permission to use,
   78.16 +##  copy, modify and distribute this software are available from the
   78.17 +##  OpenPKG GmbH.
   78.18  ##
   78.19 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   78.20 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   78.21  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   78.22  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   78.23  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    79.1 --- a/openpkg/rpm-config.sh	Tue Jul 31 12:12:54 2012 +0200
    79.2 +++ b/openpkg/rpm-config.sh	Tue Jul 31 12:23:42 2012 +0200
    79.3 @@ -1,15 +1,14 @@
    79.4  #!/bin/sh
    79.5  ##
    79.6  ##  rpm-config -- OpenPKG RPM Library Build Utility
    79.7 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    79.8 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    79.9 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
   79.10  ##
   79.11 -##  Permission to use, copy, modify, and distribute this software for
   79.12 -##  any purpose with or without fee is hereby granted, provided that
   79.13 -##  the above copyright notice and this permission notice appear in all
   79.14 -##  copies.
   79.15 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   79.16 +##  All rights reserved. Licenses which grant limited permission to use,
   79.17 +##  copy, modify and distribute this software are available from the
   79.18 +##  OpenPKG GmbH.
   79.19  ##
   79.20 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   79.21 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   79.22  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   79.23  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   79.24  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    80.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    80.2 +++ b/openpkg/rpm.patch	Tue Jul 31 12:23:42 2012 +0200
    80.3 @@ -0,0 +1,338 @@
    80.4 +Index: Makefile.in
    80.5 +--- Makefile.in.orig	2009-04-13 17:50:53 +0200
    80.6 ++++ Makefile.in	2009-04-13 17:55:37 +0200
    80.7 +@@ -502,7 +502,7 @@
    80.8 + 	@WITH_PCRE_SUBDIR@ @WITH_LUA_SUBDIR@ @WITH_FILE_SUBDIR@ \
    80.9 + 	@WITH_SYCK_SUBDIR@ @WITH_XAR_SUBDIR@ @WITH_XZ_SUBDIR@ misc \
   80.10 + 	rpmio rpmdb lib build rpmconstant @WITH_PYTHON_SUBDIR@ \
   80.11 +-	@WITH_PERL_SUBDIR@ tools scripts tests doc .
   80.12 ++	@WITH_PERL_SUBDIR@ tools scripts doc .
   80.13 + AM_CPPFLAGS = \
   80.14 + 	-I$(srcdir) \
   80.15 + 	-I$(top_srcdir) \
   80.16 +Index: configure
   80.17 +--- configure.orig	2009-04-13 17:50:56 +0200
   80.18 ++++ configure	2009-04-13 17:55:37 +0200
   80.19 +@@ -45970,7 +45970,7 @@
   80.20 + fi
   80.21 + 
   80.22 + 	  case "$host" in
   80.23 +-	    *-*-linux* ) USE_LUA_SHADOW=yes; USE_LUA_CHKCONFIG=yes; ;;
   80.24 ++	    *-*-linux* ) USE_LUA_SHADOW=no; USE_LUA_CHKCONFIG=no; ;;
   80.25 + 	  esac
   80.26 + 
   80.27 + cat >>confdefs.h <<\_ACEOF
   80.28 +Index: macros.in
   80.29 +--- macros.in.orig	2009-04-12 21:46:09 +0200
   80.30 ++++ macros.in	2009-04-13 17:55:37 +0200
   80.31 +@@ -692,8 +692,8 @@
   80.32 + 
   80.33 + # database tag configuration
   80.34 + %_dbi_tags                      %{expand:%%{_dbi_tags_%{_dbapi_used}}}
   80.35 +-%_dbi_tags_3                    Packages:Name:Basenames:Group:Providename:Requirename:Conflictname:Obsoletename:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1header:Filedigests:Pubkeys:Packagecolor:Nvra:Sourcepkgid:Filepaths
   80.36 +-%_dbi_tags_4                    Packages:Name:Basenames:Group:Providename:Requirename:Conflictname:Obsoletename:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1header:Filedigests:Pubkeys:Packagecolor:Nvra:Sourcepkgid:Filepaths
   80.37 ++%_dbi_tags_3                    Packages:Name:Basenames:Group:Providename:Requirename:Conflictname:Obsoletename:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1header:Filedigests:Pubkeys:Packagecolor:Nvra:Sourcepkgid:Filepaths:BuildEnvironment
   80.38 ++%_dbi_tags_4                    Packages:Name:Basenames:Group:Providename:Requirename:Conflictname:Obsoletename:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1header:Filedigests:Pubkeys:Packagecolor:Nvra:Sourcepkgid:Filepaths:BuildEnvironment
   80.39 + 
   80.40 + # database configuration: Berkeley-DB [dbapi 3 hooks]
   80.41 + %_dbi_config_3                  %{_dbi_btconfig}
   80.42 +@@ -720,6 +720,7 @@
   80.43 + %_dbi_config_3_Triggername      %{_dbi_btconfig}
   80.44 + %_dbi_config_3_Packages         %{_dbi_btconfig} lockdbfd
   80.45 + %_dbi_config_3_Depends          %{_dbi_btconfig} temporary private
   80.46 ++%_dbi_config_3_BuildEnvironment %{_dbi_btconfig}
   80.47 + 
   80.48 + # database configuration: SQLite [dbapi 4 hooks]
   80.49 + %_dbi_config_4                  %{_dbi_sqlconfig}
   80.50 +@@ -746,6 +747,7 @@
   80.51 + %_dbi_config_4_Triggername      %{_dbi_sqlconfig}
   80.52 + %_dbi_config_4_Packages         %{_dbi_sqlconfig}
   80.53 + %_dbi_config_4_Depends          %{_dbi_sqlconfig} temporary private
   80.54 ++%_dbi_config_4_BuildEnvironment %{_dbi_sqlconfig}
   80.55 + 
   80.56 + # database configuration [code entry hooks]
   80.57 + %_dbi_config                    %{expand:%%{_dbi_config_%{_dbapi_used}}}
   80.58 +@@ -772,6 +774,7 @@
   80.59 + %_dbi_config_Nvra               %{expand:%%{_dbi_config_%{_dbapi_used}_Nvra}}
   80.60 + %_dbi_config_Sourcepkgid        %{expand:%%{_dbi_config_%{_dbapi_used}_Sourcepkgid}}
   80.61 + %_dbi_config_Filepaths		%{expand:%%{_dbi_config_%{_dbapi_used}_Filepaths}}
   80.62 ++%_dbi_config_BuildEnvironment   %{expand:%%{_dbi_config_%{_dbapi_used}_BuildEnvironment}}
   80.63 + 
   80.64 + # Database API configuration:
   80.65 + #
   80.66 +@@ -1404,11 +1407,11 @@
   80.67 + %_build_cpu		%{_host_cpu}
   80.68 + %_build_vendor		%{_host_vendor}
   80.69 + %_build_os		%{_host_os}
   80.70 +-%_host			@host@
   80.71 +-%_host_alias		@host_alias@%{nil}
   80.72 +-%_host_cpu		@host_cpu@
   80.73 +-%_host_vendor		@host_vendor@
   80.74 +-%_host_os		@host_os@
   80.75 ++#%_host			@host@
   80.76 ++#%_host_alias		@host_alias@%{nil}
   80.77 ++#%_host_cpu		@host_cpu@
   80.78 ++#%_host_vendor		@host_vendor@
   80.79 ++#%_host_os		@host_os@
   80.80 + %_target		%{_host}
   80.81 + %_target_alias		%{_host_alias}
   80.82 + %_target_cpu		%{_host_cpu}
   80.83 +Index: rpmqv.c
   80.84 +--- rpmqv.c.orig	2009-04-12 21:46:09 +0200
   80.85 ++++ rpmqv.c	2009-04-13 17:55:37 +0200
   80.86 +@@ -1,6 +1,9 @@
   80.87 + #include "system.h"
   80.88 + extern const char *__progname;
   80.89 + 
   80.90 ++#define RPM_INTEGRITY_FP "0000000000000000000000000000000000000000"
   80.91 ++#define RPM_INTEGRITY_MV "0.0.0"
   80.92 ++
   80.93 + /* Copyright (C) 1998-2002 - Red Hat, Inc. */
   80.94 + 
   80.95 + #define	_AUTOHELP
   80.96 +Index: tools/Makefile.in
   80.97 +--- tools/Makefile.in.orig	2009-04-13 17:50:53 +0200
   80.98 ++++ tools/Makefile.in	2009-04-13 17:55:37 +0200
   80.99 +@@ -35,9 +35,8 @@
  80.100 + host_triplet = @host@
  80.101 + target_triplet = @target@
  80.102 + EXTRA_PROGRAMS = debugedit$(EXEEXT) rpmkey$(EXEEXT) txar$(EXEEXT)
  80.103 +-bin_PROGRAMS = rpm2cpio$(EXEEXT) rpmcache$(EXEEXT) rpmdigest$(EXEEXT) \
  80.104 +-	rpmgrep$(EXEEXT) rpmmtree$(EXEEXT) rpmrepo$(EXEEXT) \
  80.105 +-	rpmspecdump$(EXEEXT) rpmwget$(EXEEXT)
  80.106 ++bin_PROGRAMS = rpm2cpio$(EXEEXT) rpmcache$(EXEEXT) rpmgrep$(EXEEXT)
  80.107 ++	
  80.108 + pkglib_PROGRAMS = rpmcmp$(EXEEXT) rpmdeps$(EXEEXT) \
  80.109 + 	@WITH_LIBELF_DEBUGEDIT@ $(am__EXEEXT_1)
  80.110 + @WITH_DB_INTERNAL_TRUE@@WITH_DB_TOOLS_INTEGRATED_TRUE@am__append_1 = db_tool
  80.111 +Index: rpmio/rpmlua.c
  80.112 +--- rpmio/rpmlua.c	18 Apr 2009 16:45:17 -0000	2.52.2.10
  80.113 ++++ rpmio/rpmlua.c	6 May 2009 19:40:54 -0000
  80.114 +@@ -1147,7 +1147,7 @@
  80.115 +     if ((hbn = gethostbyname(hostname)) != NULL)
  80.116 +         h = hbn->h_name;
  80.117 +     else
  80.118 +-        h = "localhost";
  80.119 ++        h = hostname;
  80.120 + /*@=multithreaded@*/
  80.121 +     lua_pushstring(L, (const char *)h);
  80.122 +     return 1;
  80.123 +Index: lib/rpmfc.c
  80.124 +--- lib/rpmfc.c	6 Apr 2009 00:21:21 -0000	1.64
  80.125 ++++ lib/rpmfc.c	11 Apr 2009 14:17:58 -0000	1.65
  80.126 +@@ -1836,7 +1836,7 @@
  80.127 + /*@=mustmod@*/
  80.128 + 
  80.129 + /*@unchecked@*/ /*@only@*/ /*@null@*/
  80.130 +-rpmioPool _rpmfcPool;
  80.131 ++rpmioPool _rpmfcPool = NULL;
  80.132 + 
  80.133 + static rpmfc rpmfcGetPool(/*@null@*/ rpmioPool pool)
  80.134 + 	/*@globals _rpmfcPool, fileSystem, internalState @*/
  80.135 +Index: rpmio/rpmmg.c
  80.136 +--- rpmio/rpmmg.c	25 Mar 2009 20:26:47 -0000	2.10
  80.137 ++++ rpmio/rpmmg.c	11 Apr 2009 14:17:58 -0000	2.11
  80.138 +@@ -37,7 +37,7 @@
  80.139 + /*@=mustmod@*/
  80.140 + 
  80.141 + /*@unchecked@*/ /*@only@*/ /*@null@*/
  80.142 +-rpmioPool _rpmmgPool;
  80.143 ++rpmioPool _rpmmgPool = NULL;
  80.144 + 
  80.145 + static rpmmg rpmmgGetPool(/*@null@*/ rpmioPool pool)
  80.146 + 	/*@globals _rpmmgPool, fileSystem @*/
  80.147 +Index: rpmio/glob.c
  80.148 +--- rpmio/glob.c.orig	2009-03-06 23:53:52 +0100
  80.149 ++++ rpmio/glob.c	2009-09-19 19:46:41 +0200
  80.150 +@@ -47,6 +47,18 @@
  80.151 + 
  80.152 + # include "system.h"
  80.153 + 
  80.154 ++#ifndef PATH_MAX
  80.155 ++#ifdef _POSIX_VERSION
  80.156 ++#define PATH_MAX _POSIX_PATH_MAX
  80.157 ++#else
  80.158 ++#ifdef MAXPATHLEN
  80.159 ++#define PATH_MAX MAXPATHLEN
  80.160 ++#else
  80.161 ++#define PATH_MAX 1024
  80.162 ++#endif
  80.163 ++#endif
  80.164 ++#endif
  80.165 ++
  80.166 + /* Needed for offsetof() */
  80.167 + # include <stddef.h>
  80.168 + 
  80.169 +@@ -1111,7 +1123,7 @@
  80.170 + 		    {
  80.171 + 	 		struct dirent64 d64;
  80.172 +       			char room [offsetof (struct dirent64, d_name[0])
  80.173 +-   				   + NAME_MAX + 1];
  80.174 ++   				   + PATH_MAX + 1];
  80.175 +     		    }
  80.176 +     		  d64buf;
  80.177 + 
  80.178 +Index: lua/local/lposix.c
  80.179 +--- lua/local/lposix.c.orig	2009-03-06 23:52:45 +0100
  80.180 ++++ lua/local/lposix.c	2009-09-20 19:57:28 +0200
  80.181 +@@ -538,6 +538,7 @@
  80.182 + 	return pushresult(L, mkdir(path, 0777), path);
  80.183 + }
  80.184 + 
  80.185 ++#if 0
  80.186 + static int Pmkdtemp(lua_State *L)		/** mkdtemp(template) */
  80.187 + 	/*@globals fileSystem @*/
  80.188 + 	/*@modifies L, fileSystem @*/
  80.189 +@@ -555,6 +556,7 @@
  80.190 + 		return 1;
  80.191 + 	}
  80.192 + }
  80.193 ++#endif
  80.194 + 
  80.195 + 
  80.196 + static int Pchdir(lua_State *L)			/** chdir(path) */
  80.197 +@@ -1196,7 +1198,9 @@
  80.198 + 	{"kill",		Pkill},
  80.199 + 	{"link",		Plink},
  80.200 + 	{"mkdir",		Pmkdir},
  80.201 ++#if 0
  80.202 + 	{"mkdtemp",		Pmkdtemp},
  80.203 ++#endif
  80.204 + 	{"mkfifo",		Pmkfifo},
  80.205 + 	{"pathconf",		Ppathconf},
  80.206 + 	{"putenv",		Pputenv},
  80.207 +Index: db/os/os_yield.c
  80.208 +--- db/os/os_yield.c.orig	2008-06-15 10:56:46.000000000 +0200
  80.209 ++++ db/os/os_yield.c	2010-04-30 21:30:35.000000000 +0200
  80.210 +@@ -58,7 +58,7 @@
  80.211 + #elif defined(HAVE_YIELD)
  80.212 + 		yield();
  80.213 + #else
  80.214 +-		__os_sleep(dbenv, 0, 0);
  80.215 ++		__os_sleep(env, 0, 0);
  80.216 + #endif
  80.217 + 	}
  80.218 + }
  80.219 +Index: lib/depends.c
  80.220 +--- lib/depends.c.orig	2009-04-12 21:46:17.000000000 +0200
  80.221 ++++ lib/depends.c	2011-03-08 20:33:59.000000000 +0100
  80.222 +@@ -2654,7 +2654,7 @@
  80.223 + #endif
  80.224 + 		const char * dp;
  80.225 + 		int msglvl = (anaconda || (rpmtsDFlags(ts) & RPMDEPS_FLAG_DEPLOOPS))
  80.226 +-			? RPMLOG_WARNING : RPMLOG_ERR;
  80.227 ++			? RPMLOG_WARNING : RPMLOG_DEBUG;
  80.228 + ;
  80.229 + 
  80.230 + 		/* Unchain predecessor loop. */
  80.231 +Index: doc/rpm.8
  80.232 +--- doc/rpm.8.orig	2007-11-10 03:16:22.000000000 +0100
  80.233 ++++ doc/rpm.8	2011-05-11 17:41:36.000000000 +0200
  80.234 +@@ -177,16 +177,7 @@
  80.235 + \fBrpm\fR {\fB-F|--freshen\fR} [\fBinstall-options\fR] \fB\fIPACKAGE_FILE\fB\fR\fI ...\fR
  80.236 + .PP
  80.237 + This will upgrade packages, but only if an earlier version
  80.238 +-currently exists. The \fIPACKAGE_FILE\fR
  80.239 +-may be specified as an
  80.240 +-\fBftp\fR or
  80.241 +-\fBhttp\fR URL,
  80.242 +-in which case the package will be downloaded before being
  80.243 +-installed. See \fBFTP/HTTP OPTIONS\fR
  80.244 +-for information on \fBrpm\fR's internal
  80.245 +-\fBftp\fR and
  80.246 +-\fBhttp\fR
  80.247 +-client support. 
  80.248 ++currently exists.
  80.249 + .PP
  80.250 + .TP
  80.251 + \fB--aid\fR
  80.252 +@@ -496,14 +487,7 @@
  80.253 + .TP
  80.254 + \fB-p, --package \fIPACKAGE_FILE\fB\fR
  80.255 + Query an (uninstalled) package \fIPACKAGE_FILE\fR.
  80.256 +-The \fIPACKAGE_FILE\fR may be specified
  80.257 +-as an \fBftp\fR or \fBhttp\fR style URL, in
  80.258 +-which case the package header will be downloaded and queried.
  80.259 +-See \fBFTP/HTTP OPTIONS\fR for information on
  80.260 +-\fBrpm\fR's internal
  80.261 +-\fBftp\fR and
  80.262 +-\fBhttp\fR
  80.263 +-client support. The \fIPACKAGE_FILE\fR argument(s),
  80.264 ++The \fIPACKAGE_FILE\fR argument(s),
  80.265 + if not a binary package, will be interpreted as an ASCII package
  80.266 + manifest.  Comments are permitted, starting with a '#', and each
  80.267 + line of a package manifest file may include white space separated
  80.268 +@@ -796,53 +780,6 @@
  80.269 + \fIrpmrc\fR and
  80.270 + \fImacros\fR
  80.271 + configuration file(s).
  80.272 +-.SS "FTP/HTTP OPTIONS"
  80.273 +-.PP
  80.274 +-\fBrpm\fR can act as an FTP and/or HTTP client so
  80.275 +-that packages can be queried or installed from the internet.
  80.276 +-Package files for install, upgrade, and query operations may be
  80.277 +-specified as an
  80.278 +-\fBftp\fR or
  80.279 +-\fBhttp\fR
  80.280 +-style URL:  
  80.281 +-.PP
  80.282 +-ftp://USER:PASSWORD@HOST:PORT/path/to/package.rpm
  80.283 +-.PP
  80.284 +-If the \fB:PASSWORD\fR portion is omitted, the password will be
  80.285 +-prompted for (once per user/hostname pair). If both the user and
  80.286 +-password are omitted, anonymous \fBftp\fR is used.
  80.287 +-In all cases, passive (PASV) \fBftp\fR transfers are
  80.288 +-performed.
  80.289 +-.PP
  80.290 +-\fBrpm\fR allows the following options to be used with
  80.291 +-ftp URLs:
  80.292 +-.TP
  80.293 +-\fB--ftpproxy \fIHOST\fB\fR
  80.294 +-The host \fIHOST\fR will be used as a proxy server
  80.295 +-for all ftp transfers, which allows users to ftp through firewall
  80.296 +-machines which use proxy systems. This option may also be specified
  80.297 +-by configuring the macro \fB%_ftpproxy\fR.
  80.298 +-.TP
  80.299 +-\fB--ftpport \fIPORT\fB\fR
  80.300 +-The TCP \fIPORT\fR number to use for
  80.301 +-the ftp connection on the proxy ftp server instead of the default
  80.302 +-port. This option may also be specified by configuring the macro
  80.303 +-\fB%_ftpport\fR.
  80.304 +-.PP
  80.305 +-\fBrpm\fR allows the following options to be used with
  80.306 +-\fBhttp\fR URLs:
  80.307 +-.TP
  80.308 +-\fB--httpproxy \fIHOST\fB\fR
  80.309 +-The host \fIHOST\fR will be used as
  80.310 +-a proxy server for all \fBhttp\fR transfers. This
  80.311 +-option may also be specified by configuring the macro
  80.312 +-\fB%_httpproxy\fR.
  80.313 +-.TP
  80.314 +-\fB--httpport \fIPORT\fB\fR
  80.315 +-The TCP \fIPORT\fR number to use for the
  80.316 +-\fBhttp\fR connection on the proxy http server instead
  80.317 +-of the default port. This option may also be specified by configuring
  80.318 +-the macro \fB%_httpport\fR.
  80.319 + .SH "LEGACY ISSUES"
  80.320 + .SS "Executing rpmbuild"
  80.321 + .PP
  80.322 +Index: lua/local/lrexlib_lposix.c
  80.323 +--- lua/local/lrexlib_lposix.c.orig	2008-06-15 10:56:54.000000000 +0200
  80.324 ++++ lua/local/lrexlib_lposix.c	2012-02-06 20:51:46.000000000 +0100
  80.325 +@@ -242,10 +242,16 @@
  80.326 +   { "ESPACE",   REG_ESPACE },
  80.327 +   { "BADRPT",   REG_BADRPT },
  80.328 + #ifdef REX_POSIX_EXT
  80.329 ++#ifdef REG_EMPTY
  80.330 +   { "EMPTY",    REG_EMPTY },
  80.331 ++#endif
  80.332 ++#ifdef REG_ASSERT
  80.333 +   { "ASSERT",   REG_ASSERT },
  80.334 ++#endif
  80.335 ++#ifdef REG_INVARG
  80.336 +   { "INVARG",   REG_INVARG },
  80.337 + #endif
  80.338 ++#endif
  80.339 + /*---------------------------------------------------------------------------*/
  80.340 +   { NULL, 0 }
  80.341 + };
    81.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.2 +++ b/openpkg/rpm.sh	Tue Jul 31 12:23:42 2012 +0200
    81.3 @@ -0,0 +1,60 @@
    81.4 +#!@l_prefix@/lib/openpkg/bash
    81.5 +##
    81.6 +##  rpm -- OpenPKG Registry "rpm" overload command
    81.7 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    81.8 +##
    81.9 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   81.10 +##  All rights reserved. Licenses which grant limited permission to use,
   81.11 +##  copy, modify and distribute this software are available from the
   81.12 +##  OpenPKG GmbH.
   81.13 +##
   81.14 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   81.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   81.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   81.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   81.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   81.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   81.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   81.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   81.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   81.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   81.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   81.25 +##  SUCH DAMAGE.
   81.26 +##
   81.27 +
   81.28 +#   determine path to OpenPKG instance
   81.29 +PREFIX="@l_prefix@"
   81.30 +if [ ".${OPENPKG_PREFIX}" != . ]; then
   81.31 +    PREFIX="${OPENPKG_PREFIX}"
   81.32 +fi
   81.33 +
   81.34 +#   determine rpm
   81.35 +rpm="$PREFIX/libexec/openpkg/rpm"
   81.36 +[ -x "$PREFIX/lib/openpkg/rpm" ] && rpm="$PREFIX/lib/openpkg/rpm"
   81.37 +
   81.38 +#   determine whether URL rewriting is active
   81.39 +rewrite=0
   81.40 +#$PREFIX/bin/openpkg register --printstatus >/dev/null 2>&1 && rewrite=1
   81.41 +
   81.42 +#   main
   81.43 +if [ $rewrite = 1 ]; then
   81.44 +    #   URL rewriting
   81.45 +    declare -a a
   81.46 +    declare -i i=0
   81.47 +    while [ ".$1" != . ]; do
   81.48 +        arg="$1"
   81.49 +        printf '%s\n' "$arg" | grep :// >/dev/null && arg=`$PREFIX/bin/openpkg register --rewriteurls "$arg"`
   81.50 +        a[$i]="$arg"
   81.51 +        i=i+1
   81.52 +        shift
   81.53 +    done
   81.54 +    set -- "${a[@]}"
   81.55 +    unset arg i a
   81.56 +else
   81.57 +    #   stealth mode
   81.58 +    :
   81.59 +fi
   81.60 +
   81.61 +#   execute underlying application
   81.62 +exec $rpm "$@"
   81.63 +
    82.1 --- a/openpkg/rpmdb	Tue Jul 31 12:12:54 2012 +0200
    82.2 +++ b/openpkg/rpmdb	Tue Jul 31 12:23:42 2012 +0200
    82.3 @@ -1,15 +1,14 @@
    82.4  #!@l_prefix@/lib/openpkg/bash
    82.5  ##
    82.6  ##  rpmdb -- OpenPKG RPM Database Administration Utility
    82.7 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    82.8 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    82.9 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
   82.10  ##
   82.11 -##  Permission to use, copy, modify, and distribute this software for
   82.12 -##  any purpose with or without fee is hereby granted, provided that
   82.13 -##  the above copyright notice and this permission notice appear in all
   82.14 -##  copies.
   82.15 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   82.16 +##  All rights reserved. Licenses which grant limited permission to use,
   82.17 +##  copy, modify and distribute this software are available from the
   82.18 +##  OpenPKG GmbH.
   82.19  ##
   82.20 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   82.21 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   82.22  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   82.23  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   82.24  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   82.25 @@ -30,6 +29,8 @@
   82.26  help=""
   82.27  prefix="@l_prefix@"
   82.28  dbpath=""
   82.29 +dbapi=""
   82.30 +tmpdir=""
   82.31  rpm=""
   82.32  musr="@l_musr@"
   82.33  mgrp="@l_mgrp@"
   82.34 @@ -42,6 +43,7 @@
   82.35  ##
   82.36  
   82.37  #   iterate over argument line
   82.38 +args=""
   82.39  for opt
   82.40  do
   82.41      case $opt in
   82.42 @@ -51,6 +53,7 @@
   82.43      case $opt in
   82.44          -h|--help      ) help="Usage"  ;;
   82.45          -B|--build     ) mode=build    ;;
   82.46 +        -M|--migrate   ) mode=migrate  ;;
   82.47          -R|--rebuild   ) mode=rebuild  ;;
   82.48          -C|--cleanup   ) mode=cleanup  ;;
   82.49          -F|--fixate    ) mode=fixate   ;;
   82.50 @@ -60,14 +63,19 @@
   82.51          -v|--verbose   ) verbose=`expr $verbose + 1` ;;
   82.52          --prefix=*     ) prefix=$arg   ;;
   82.53          --dbpath=*     ) dbpath=$arg   ;;
   82.54 +        --dblib=*      ) dblib=$arg    ;;
   82.55 +        --tmpdir=*     ) tmpdir=$arg   ;;
   82.56          --rpm=*        ) rpm=$arg      ;;
   82.57          --musr=*       ) musr=$arg     ;;
   82.58          --mgrp=*       ) mgrp=$arg     ;;
   82.59 -        *              ) help="Invalid option \`$opt'"; break ;;
   82.60 +        --             ) ;;
   82.61 +        -*             ) help="Invalid option \`$opt'"; break ;;
   82.62 +        *              ) args="$args \"$opt\"" ;;
   82.63      esac
   82.64  done
   82.65 +eval "set -- $args"
   82.66  
   82.67 -#   makre sure exactly one run-time mode is specified
   82.68 +#   make sure exactly one run-time mode is specified
   82.69  if [ ".$mode" = . ]; then
   82.70      help="No or invalid run-time mode specified"
   82.71  fi
   82.72 @@ -82,6 +90,7 @@
   82.73  
   82.74    -h, --help        print usage message (this one)
   82.75    -B, --build       build new RPM database from scratch
   82.76 +  -M, --migrate     migrate RPM database to new format
   82.77    -R, --rebuild     rebuild new from old RPM database
   82.78    -C, --cleanup     cleanup existing RPM database
   82.79    -F, --fixate      fixate existing RPM database
   82.80 @@ -91,12 +100,14 @@
   82.81    -v, --verbose     operate in more verbose mode (increase verbose level)
   82.82    --prefix=PREFIX   use OpenPKG instance under PREFIX
   82.83    --dbpath=PATH     use OpenPKG RPM database under PATH
   82.84 +  --dblib=LIB       use OpenPKG RPM database backend library ("db" or "sqlite")
   82.85 +  --tmpdir=PATH     use OpenPKG temporary directory under PATH
   82.86    --rpm=PROG        use OpenPKG RPM executable PROG
   82.87    --musr=USERNAME   use OpenPKG management user USERNAME
   82.88    --mgrp=GROUPNAME  use OpenPKG management group GROUPNAME
   82.89  
   82.90  This is OpenPKG rpmdb, an RPM database administration utility, providing
   82.91 -lower-level maintainance functions for the Berkeley-DB 4.1 based RPM 4.2
   82.92 +lower-level maintainance functions for the Berkeley-DB based RPM
   82.93  database. It allows building new RPM databases from scratch, rebuilding
   82.94  a new from an old RPM database (content dumping and reloading),
   82.95  cleaning up problems on an existing RPM database (removal of DB region
   82.96 @@ -115,6 +126,12 @@
   82.97  if [ ".$dbpath" = . ]; then
   82.98      dbpath="$prefix/RPM/DB"
   82.99  fi
  82.100 +if [ ".$dblib" = . ]; then
  82.101 +    dblib="${1-db}"
  82.102 +fi
  82.103 +if [ ".$tmpdir" = . ]; then
  82.104 +    tmpdir="$prefix/RPM/TMP"
  82.105 +fi
  82.106  if [ ".$rpm" = . ]; then
  82.107      rpm="$prefix/bin/openpkg rpm"
  82.108  fi
  82.109 @@ -124,32 +141,61 @@
  82.110  ##
  82.111  
  82.112  dbfiles="
  82.113 -    hash:Basenames
  82.114 -    hash:Conflictname
  82.115 -    hash:Depends
  82.116 -    btree:Dirnames
  82.117 -    hash:Filemd5s
  82.118 -    hash:Group
  82.119 -    btree:Installtid
  82.120 -    hash:Name
  82.121 -    hash:Packages
  82.122 -    hash:Providename
  82.123 -    btree:Provideversion
  82.124 -    hash:Pubkeys
  82.125 -    hash:Requirename
  82.126 -    btree:Requireversion
  82.127 -    hash:Sha1header
  82.128 -    hash:Sigmd5
  82.129 -    hash:Triggername
  82.130 -    region:__db.001
  82.131 -    region:__db.002
  82.132 -    region:__db.003
  82.133 -    region:__db.004
  82.134 -    region:__db.005
  82.135 -    region:__db.006
  82.136 -    region:__db.007
  82.137 -    region:__db.008
  82.138 -    region:__db.009
  82.139 +    3:btree:Basenames
  82.140 +    3:btree:Conflictname
  82.141 +    3:temporary:Depends
  82.142 +    3:btree:Dirnames
  82.143 +    3:btree:Filedigests
  82.144 +    3:btree:Filepaths
  82.145 +    3:btree:Group
  82.146 +    3:btree:Installtid
  82.147 +    3:btree:Name
  82.148 +    3:hash:Packagecolor
  82.149 +    3:btree:Packages
  82.150 +    3:btree:Providename
  82.151 +    3:btree:Provideversion
  82.152 +    3:hash:Pubkeys
  82.153 +    3:btree:Requirename
  82.154 +    3:btree:Requireversion
  82.155 +    3:hash:Sha1header
  82.156 +    3:hash:Sigmd5
  82.157 +    3:btree:Triggername
  82.158 +    3:btree:Obsoletename
  82.159 +    3:btree:Nvra
  82.160 +    3:btree:Sourcepkgid
  82.161 +    3:btree:BuildEnvironment
  82.162 +    3:region:__db.001
  82.163 +    3:region:__db.002
  82.164 +    3:region:__db.003
  82.165 +    3:region:__db.004
  82.166 +    3:region:__db.005
  82.167 +    3:region:__db.006
  82.168 +    3:region:__db.007
  82.169 +    3:region:__db.008
  82.170 +    3:region:__db.009
  82.171 +    4:*:Basenames
  82.172 +    4:*:Conflictname
  82.173 +    4:temporary:Depends
  82.174 +    4:*:Dirnames
  82.175 +    4:*:Filedigests
  82.176 +    4:*:Filepaths
  82.177 +    4:*:Group
  82.178 +    4:*:Installtid
  82.179 +    4:*:Name
  82.180 +    4:*:Packagecolor
  82.181 +    4:*:Packages
  82.182 +    4:*:Providename
  82.183 +    4:*:Provideversion
  82.184 +    4:*:Pubkeys
  82.185 +    4:*:Requirename
  82.186 +    4:*:Requireversion
  82.187 +    4:*:Sha1header
  82.188 +    4:*:Sigmd5
  82.189 +    4:*:Triggername
  82.190 +    4:*:Obsoletename
  82.191 +    4:*:Nvra
  82.192 +    4:*:Sourcepkgid
  82.193 +    4:*:BuildEnvironment
  82.194  "
  82.195  
  82.196  ##
  82.197 @@ -180,8 +226,45 @@
  82.198      fi
  82.199  }
  82.200  
  82.201 +rpmdb_version_load () {
  82.202 +    if [ -f $dbpath/VERSION ]; then
  82.203 +        eval `(. $dbpath/VERSION || exit $?; echo "DBAPI=\"$DBAPI\"; DBLIB=\"$DBLIB\"; DBVER=\"$DBVER\"")`
  82.204 +    fi
  82.205 +    if [ ".$DBAPI" = . ]; then DBAPI="3";     fi
  82.206 +    if [ ".$DBLIB" = . ]; then DBLIB="db";    fi
  82.207 +    if [ ".$DBVER" = . ]; then DBVER="4.1.2"; fi
  82.208 +}
  82.209 +
  82.210 +rpmdb_version_save () {
  82.211 +    if [ ".$DBAPI" = .3 ]; then
  82.212 +        DBLIB="db"
  82.213 +        DBVER=`$rpmdb_load -V 2>&1 |\
  82.214 +            grep 'Berkeley DB [0-9][0-9]*\.[0-9][0-9]*' |\
  82.215 +            sed -e 's;^;X;' \
  82.216 +                -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
  82.217 +                -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1.0;' \
  82.218 +                -e 's;^X.*$;0.0.0;'`
  82.219 +    elif [ ".$DBAPI" = .4 ]; then
  82.220 +        DBLIB="sqlite"
  82.221 +        DBVER=`$rpmdb_sqlite --version 2>&1 |\
  82.222 +            grep '^[0-9][0-9]*\.[0-9][0-9]*' |\
  82.223 +            sed -e 's;^;X;' \
  82.224 +                -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
  82.225 +                -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1.0;' \
  82.226 +                -e 's;^X.*$;0.0.0;'`
  82.227 +    fi
  82.228 +    ( echo "DBAPI=$DBAPI"
  82.229 +      echo "DBLIB=$DBLIB"
  82.230 +      echo "DBVER=$DBVER"
  82.231 +    ) >$dbpath/VERSION.new || exit $?
  82.232 +    mv $dbpath/VERSION.new $dbpath/VERSION || exit $?
  82.233 +    chown $musr:$mgrp $dbpath/VERSION 2>/dev/null || true
  82.234 +    chmod 644 $dbpath/VERSION 2>/dev/null || true
  82.235 +}
  82.236 +
  82.237  rpm () {
  82.238 -    local opts="--dbpath `echo $dbpath | sed -e 's;/*$;;' -e 's;$;/;'`"
  82.239 +    local opts="--define '_dbpath `echo $dbpath | sed -e 's;/*$;;' -e 's;$;/;'`'"
  82.240 +    opts="$opts --define '_repackage_all_erasures 0'"
  82.241      if [ ".$force" = .yes ]; then
  82.242          opts="$opts --define '__dbi_private yes'"
  82.243      fi
  82.244 @@ -189,13 +272,9 @@
  82.245      eval "$rpm $opts \"\$@\""
  82.246  }
  82.247  
  82.248 -rpmdb_load () {
  82.249 -    $prefix/lib/openpkg/rpmdb_load ${1+"$@"}
  82.250 -}
  82.251 -
  82.252 -rpmdb_dump () {
  82.253 -    $prefix/lib/openpkg/rpmdb_dump ${1+"$@"}
  82.254 -}
  82.255 +rpmdb_load="$prefix/lib/openpkg/db_tool load"
  82.256 +rpmdb_dump="$prefix/lib/openpkg/db_tool dump"
  82.257 +rpmdb_sqlite="$prefix/lib/openpkg/sqlite3"
  82.258  
  82.259  ##
  82.260  ##  RPM DATABASE OPERATIONS
  82.261 @@ -225,60 +304,61 @@
  82.262      #   remove all known files
  82.263      verbose 2 "removing (possibly existing) old RPM database DB files"
  82.264      for dbfile in $dbfiles; do
  82.265 -        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\)$/dbtype="\1"; dbfile="\2";/'`
  82.266 -        verbose 3 "removing database file: $dbpath/$dbfile ($dbtype)"
  82.267 +        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\):\(.*\)$/dbapi="\1"; dbtype="\2"; dbfile="\3";/'`
  82.268 +        verbose 3 "removing database file: $dbpath/$dbfile ($dbapi:$dbtype)"
  82.269          rm -f $dbpath/$dbfile
  82.270      done
  82.271  }
  82.272  
  82.273  db_init () {
  82.274      #   perform official "initdb" operation
  82.275 -    #   (is mostly a no-operation in RPM 4.2, but anyway)
  82.276      verbose 2 "creating new RPM database (built-in RPM procedure)"
  82.277      rpm --initdb
  82.278 -
  82.279 -    #   perform some real RPM work, so more database files
  82.280 -    #   magically spring into existence
  82.281 -    verbose 2 "operating on new RPM database"
  82.282 -    rpm --import $prefix/etc/openpkg/openpkg.org.pgp || true
  82.283 -    rpm -e gpg-pubkey-63c4cb9f-3c591eda --allmatches || true
  82.284 -
  82.285 -    #   perform official "rebuilddb" operation in the hope it
  82.286 -    #   creates even more database files now that we have some content
  82.287 -    verbose 2 "rebuilding new RPM database (built-in RPM procedure)"
  82.288 -    rpm --rebuilddb
  82.289 +    rpmdb_version_save
  82.290  }
  82.291  
  82.292  db_unbreak () {
  82.293 -    #   cleanup DB region files
  82.294 -    verbose 2 "cleaning up RPM database DB region files"
  82.295 +    #   cleanup DB files
  82.296 +    verbose 2 "cleaning up RPM database DB files"
  82.297      for dbfile in $dbfiles; do
  82.298 -        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\)$/dbtype="\1"; dbfile="\2";/'`
  82.299 -        if [ ".$dbtype" = .region ]; then
  82.300 -            verbose 3 "cleaning up DB file: $dbpath/$dbfile ($dbtype)"
  82.301 -            rm -f $dbpath/$dbfile || true
  82.302 -            touch $dbpath/$dbfile || true
  82.303 +        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\):\(.*\)$/dbapi="\1"; dbtype="\2"; dbfile="\3";/'`
  82.304 +        if [ -f $dbpath/$dbfile ]; then
  82.305 +            if [ ".$dbapi" = .3 -a ".$dbtype" = .region ]; then
  82.306 +                verbose 3 "cleaning up DB file: $dbpath/$dbfile ($dbapi:$dbtype)"
  82.307 +                rm -f $dbpath/$dbfile || true
  82.308 +            elif [ ".$dbtype" = .temporary ]; then
  82.309 +                verbose 3 "cleaning up DB file: $dbpath/$dbfile ($dbapi:$dbtype)"
  82.310 +                rm -f $dbpath/$dbfile || true
  82.311 +            fi
  82.312          fi
  82.313      done
  82.314  }
  82.315  
  82.316 -db_extend () {
  82.317 -    #   make sure all RPM database DB files are present
  82.318 -    verbose 2 "making sure RPM database contains all possible DB files"
  82.319 +db_convert () {
  82.320 +    #   make sure all RPM database DB files have the correct type
  82.321 +    #   (as the type can be different during upgrading from RPM 4 to RPM 5)
  82.322 +    verbose 2 "making sure RPM database are of the correct type"
  82.323      for dbfile in $dbfiles; do
  82.324 -        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\)$/dbtype="\1"; dbfile="\2";/'`
  82.325 -        if [ ! -f $dbpath/$dbfile ]; then
  82.326 -            verbose 3 "creating DB file: $dbpath/$dbfile ($dbtype)"
  82.327 -            if [ ".$dbtype" = .hash -o ".$dbtype" = .btree ]; then
  82.328 -                ( echo "VERSION=3"
  82.329 -                  echo "format=bytevalue"
  82.330 -                  echo "type=$dbtype"
  82.331 -                  echo "db_pagesize=16384"
  82.332 -                  echo "HEADER=END"
  82.333 -                  echo "DATA=END"
  82.334 -                ) | rpmdb_load $dbpath/$dbfile || true
  82.335 -            else
  82.336 -                touch $dbpath/$dbfile || true
  82.337 +        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\):\(.*\)$/dbapi="\1"; dbtype="\2"; dbfile="\3";/'`
  82.338 +        if [ ".$dbapi" != ".$DBAPI" ]; then
  82.339 +            continue
  82.340 +        fi
  82.341 +        if [ -f $dbpath/$dbfile ]; then
  82.342 +            if [ ".$dbapi" = .3 ] && [ ".$dbtype" = .hash -o ".$dbtype" = .btree ]; then
  82.343 +                dbtype_old="`$rpmdb_dump -h $tmpdir -r $dbpath/$dbfile | grep '^type=' | sed -e 'q' | sed -e 's/^type=//'`"
  82.344 +                if [ ".$dbtype_old" != ".$dbtype" ]; then
  82.345 +                    verbose 3 "converting DB file: $dbpath/$dbfile ($dbtype_old -> $dbtype)"
  82.346 +                    rm -f $dbpath/$dbfile.new
  82.347 +                    $rpmdb_dump -h $tmpdir -r $dbpath/$dbfile |\
  82.348 +                    sed -e "s/^type=.*/type=$dbtype/" -e '/^h_nelem=.*/d' |\
  82.349 +                    $rpmdb_load -h $tmpdir $dbpath/$dbfile.new
  82.350 +                    if $rpmdb_dump -h $tmpdir -r $dbpath/$dbfile.new >/dev/null 2>&1; then
  82.351 +                        rm -f $dbpath/$dbfile
  82.352 +                        mv $dbpath/$dbfile.new $dbpath/$dbfile
  82.353 +                    else
  82.354 +                        warning "failed to convert RPM DB file \"$dbfile\""
  82.355 +                    fi
  82.356 +                fi
  82.357              fi
  82.358          fi
  82.359      done
  82.360 @@ -289,26 +369,75 @@
  82.361      #   reloading their entire content
  82.362      verbose 2 "dumping and reloading RPM database DB file contents"
  82.363      for dbfile in $dbfiles; do
  82.364 -        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\)$/dbtype="\1"; dbfile="\2";/'`
  82.365 -        verbose 3 "dumping and reloading DB file: $dbpath/$dbfile ($dbtype)"
  82.366 +        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\):\(.*\)$/dbapi="\1"; dbtype="\2"; dbfile="\3";/'`
  82.367 +        if [ ".$dbapi" != ".$DBAPI" ]; then
  82.368 +            continue
  82.369 +        fi
  82.370          if [ -f $dbpath/$dbfile ]; then
  82.371 -            if [ ".$dbtype" = .hash -o ".$dbtype" = .btree ]; then
  82.372 -                rpmdb_dump $dbpath/$dbfile |\
  82.373 -                rpmdb_load $dbpath/$dbfile.new
  82.374 -                rm -f $dbpath/$dbfile
  82.375 -                mv $dbpath/$dbfile.new $dbpath/$dbfile
  82.376 -            else
  82.377 -                rm -f $dbpath/$dbfile || true
  82.378 -                touch $dbpath/$dbfile || true
  82.379 +            if [ ".$dbapi" = .3 ]; then
  82.380 +                verbose 3 "dumping and reloading DB file: $dbpath/$dbfile ($dbtype)"
  82.381 +                if [ ".$dbtype" = .hash -o ".$dbtype" = .btree ]; then
  82.382 +                    rm -f $dbpath/$dbfile.new
  82.383 +                    $rpmdb_dump -h $tmpdir -r $dbpath/$dbfile |\
  82.384 +                    $rpmdb_load -h $tmpdir $dbpath/$dbfile.new
  82.385 +                    if $rpmdb_dump -h $tmpdir -r $dbpath/$dbfile.new >/dev/null 2>&1; then
  82.386 +                        rm -f $dbpath/$dbfile
  82.387 +                        mv $dbpath/$dbfile.new $dbpath/$dbfile
  82.388 +                    else
  82.389 +                        warning "failed to reload RPM DB file \"$dbfile\""
  82.390 +                    fi
  82.391 +                elif [ ".$dbtype" = .region ]; then
  82.392 +                    rm -f $dbpath/$dbfile || true
  82.393 +                elif [ ".$dbtype" = .temporary ]; then
  82.394 +                    rm -f $dbpath/$dbfile || true
  82.395 +                fi
  82.396 +            elif [ ".$dbapi" = .4 ]; then
  82.397 +                verbose 3 "dumping and reloading DB file: $dbpath/$dbfile ($dbtype)"
  82.398 +                rm -f $dbpath/$dbfile.new
  82.399 +                $rpmdb_sqlite $dbpath/$dbfile .dump |\
  82.400 +                $rpmdb_sqlite $dbpath/$dbfile.new
  82.401 +                if $rpmdb_sqlite $dbpath/$dbfile.new >/dev/null 2>&1; then
  82.402 +                    rm -f $dbpath/$dbfile
  82.403 +                    mv $dbpath/$dbfile.new $dbpath/$dbfile
  82.404 +                else
  82.405 +                    warning "failed to reload RPM DB file \"$dbfile\""
  82.406 +                fi
  82.407              fi
  82.408          fi
  82.409      done
  82.410 +    rpmdb_version_save
  82.411 +}
  82.412 +
  82.413 +db_migrate () {
  82.414 +    #   perform database migration
  82.415 +    if [ ".$1" != . ]; then
  82.416 +        dblib="$1"
  82.417 +    fi
  82.418 +    dbapi_old="$DBAPI"
  82.419 +    if [ ".$dblib" = .db ]; then
  82.420 +        dbapi_new="3"
  82.421 +    elif [ ".$dblib" = .sqlite ]; then
  82.422 +        dbapi_new="4"
  82.423 +    else
  82.424 +        error "unknown RPM database backend library \"$dblib\""
  82.425 +    fi
  82.426 +    if [ ".$dbapi_new" = ".$dbapi_old" ]; then
  82.427 +        error "RPM database already uses requested backend ($DBAPI:$DBLIB:$DBVER)"
  82.428 +    fi
  82.429 +    verbose 2 "migrating RPM database"
  82.430 +    rpm --rebuilddb --dbapi "$dbapi_old" --rebuilddbapi "$dbapi_new"
  82.431 +    verbose 3 "old RPM database format: $DBAPI:$DBLIB:$DBVER"
  82.432 +    DBAPI="$dbapi_new"
  82.433 +    rpmdb_version_save
  82.434 +    rpmdb_version_load
  82.435 +    verbose 3 "new RPM database format: $DBAPI:$DBLIB:$DBVER"
  82.436  }
  82.437  
  82.438  db_rebuild () {
  82.439      #   perform official "rebuilddb" operation
  82.440      verbose 2 "rebuilding RPM database (built-in RPM procedure)"
  82.441      rpm --rebuilddb
  82.442 +    rpmdb_version_save
  82.443  }
  82.444  
  82.445  db_operate () {
  82.446 @@ -333,17 +462,30 @@
  82.447      #   RPM database files to make sure they are consistent
  82.448      verbose 2 "making sure RPM database files have consistent attributes"
  82.449      for dbfile in $dbfiles; do
  82.450 -        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\)$/dbtype="\1"; dbfile="\2";/'`
  82.451 +        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\):\(.*\)$/dbapi="\1"; dbtype="\2"; dbfile="\3";/'`
  82.452 +        if [ ".$dbapi" != ".$DBAPI" ]; then
  82.453 +            continue
  82.454 +        fi
  82.455          verbose 3 "fixating DB file: $dbpath/$dbfile ($dbtype)"
  82.456 -        chown $musr:$mgrp $dbpath/$dbfile 2>/dev/null || true
  82.457 -        chmod 644 $dbpath/$dbfile 2>/dev/null || true
  82.458 +        if [ -f $dbpath/$dbfile ]; then
  82.459 +            chown $musr:$mgrp $dbpath/$dbfile 2>/dev/null || true
  82.460 +            chmod 644 $dbpath/$dbfile 2>/dev/null || true
  82.461 +        fi
  82.462      done
  82.463 +    chown $musr:$mgrp $dbpath/VERSION 2>/dev/null || true
  82.464 +    chmod 644 $dbpath/VERSION 2>/dev/null || true
  82.465  }
  82.466  
  82.467  db_list () {
  82.468      #   list all database files
  82.469      for dbfile in $dbfiles; do
  82.470 -        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\)$/dbtype="\1"; dbfile="\2";/'`
  82.471 +        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\):\(.*\)$/dbapi="\1"; dbtype="\2"; dbfile="\3";/'`
  82.472 +        if [ ".$dbapi" != ".$DBAPI" ]; then
  82.473 +            continue
  82.474 +        fi
  82.475 +        if [ ! -f "$dbpath/$dbfile" ]; then
  82.476 +            continue
  82.477 +        fi
  82.478          if [ $verbose -eq 0 ]; then
  82.479              echo "$dbfile"
  82.480          elif [ $verbose -eq 1 ]; then
  82.481 @@ -380,6 +522,9 @@
  82.482      error "OpenPKG RPM database directory \"$dbpath\" not writable"
  82.483  fi
  82.484  
  82.485 +#   load database information
  82.486 +rpmdb_version_load
  82.487 +
  82.488  ##
  82.489  ##  DISPATCH INTO COMMANDS
  82.490  ##
  82.491 @@ -389,7 +534,15 @@
  82.492          verbose 1 "BUILDING NEW RPM DATABASE FROM SCRATCH ($dbpath)"
  82.493          db_remove
  82.494          db_init
  82.495 -        db_extend
  82.496 +        db_fixate
  82.497 +        db_operate
  82.498 +        ;;
  82.499 +
  82.500 +    migrate )
  82.501 +        verbose 1 "MIGRATING RPM DATABASE FORMAT ($dbpath)"
  82.502 +        db_unbreak
  82.503 +        db_convert
  82.504 +        db_migrate
  82.505          db_rebuild
  82.506          db_fixate
  82.507          db_operate
  82.508 @@ -398,7 +551,7 @@
  82.509      rebuild )
  82.510          verbose 1 "REBUILDING NEW FROM OLD RPM DATABASE ($dbpath)"
  82.511          db_unbreak
  82.512 -        db_extend
  82.513 +        db_convert
  82.514          db_reload
  82.515          db_rebuild
  82.516          db_fixate
  82.517 @@ -408,7 +561,7 @@
  82.518      cleanup )
  82.519          verbose 1 "CLEANING UP EXISTING RPM DATABASE ($dbpath)"
  82.520          db_unbreak
  82.521 -        db_extend
  82.522 +        db_convert
  82.523          db_rebuild
  82.524          db_fixate
  82.525          db_operate
  82.526 @@ -416,9 +569,7 @@
  82.527  
  82.528      fixate )
  82.529          verbose 1 "FIXATING EXISTING RPM DATABASE ($dbpath)"
  82.530 -        db_extend
  82.531          db_fixate
  82.532 -        db_operate
  82.533          ;;
  82.534  
  82.535      list )
    83.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.2 +++ b/openpkg/rpmlua	Tue Jul 31 12:23:42 2012 +0200
    83.3 @@ -0,0 +1,228 @@
    83.4 +--
    83.5 +--  rpmlua -- OpenPKG RPM Lua Script
    83.6 +--  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    83.7 +--
    83.8 +--  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    83.9 +--  All rights reserved. Licenses which grant limited permission to use,
   83.10 +--  copy, modify and distribute this software are available from the
   83.11 +--  OpenPKG GmbH.
   83.12 +--
   83.13 +--  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   83.14 +--  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   83.15 +--  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   83.16 +--  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   83.17 +--  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   83.18 +--  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   83.19 +--  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   83.20 +--  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   83.21 +--  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   83.22 +--  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   83.23 +--  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   83.24 +--  SUCH DAMAGE.
   83.25 +--
   83.26 +
   83.27 +--
   83.28 +--  The purpose of this Lua script is to extend the default Lua functions
   83.29 +--  in the OpenPKG RPM installation for the @l_prefix@ hierarchy.
   83.30 +--
   83.31 +
   83.32 +--  provide namespace
   83.33 +openpkg = {}
   83.34 +
   83.35 +--  small wrapper around the realpath(3) call provided by RPM
   83.36 +function openpkg.realpath(path)
   83.37 +    if posix.stat(path) ~= nil then
   83.38 +        --  path exists, so resolve as a whole
   83.39 +        path = rpm.realpath(path)
   83.40 +    else
   83.41 +        --  path not exists, so recursively resolve only prefix
   83.42 +        local s, _, m = util.rmatch(path, "^(.+?)/([^/]+)/?$")
   83.43 +        if s ~= nil then
   83.44 +            local prefix = openpkg.realpath(m[1])
   83.45 +            if util.rmatch(prefix, "/$") == nil then
   83.46 +                prefix = prefix .. "/"
   83.47 +            end
   83.48 +            path = prefix .. m[2]
   83.49 +        end
   83.50 +    end
   83.51 +    return path
   83.52 +end
   83.53 +
   83.54 +--  try to reduce real path to symbolic one (if posssible)
   83.55 +function openpkg.unrealpath(path, prefix_unreal)
   83.56 +    local prefix_real = openpkg.realpath(prefix_unreal)
   83.57 +    if prefix_real ~= prefix_unreal then
   83.58 +        if string.sub(path, 1, string.len(prefix_real)) == prefix_real then
   83.59 +            path = prefix_unreal .. string.sub(path, string.len(prefix_real)+1)
   83.60 +        end
   83.61 +    end
   83.62 +    return path
   83.63 +end
   83.64 +
   83.65 +--  canonicalize filesystem path as good as possible
   83.66 +function openpkg.canonicalize(path)
   83.67 +    path = openpkg.unrealpath(path, os.getenv("PWD"))
   83.68 +    path = openpkg.unrealpath(path, rpm.expand("%{l_prefix}"))
   83.69 +    return path
   83.70 +end
   83.71 +
   83.72 +--  temporary directory determination
   83.73 +function openpkg.tmpdir()
   83.74 +    local tmpdir = os.getenv("TMPDIR")
   83.75 +    if tmpdir ~= nil then
   83.76 +        tmpdir = openpkg.canonicalize(openpkg.realpath(tmpdir))
   83.77 +    else
   83.78 +        tmpdir = "/tmp"
   83.79 +    end
   83.80 +    tmpdir = tmpdir .. "/openpkg"
   83.81 +    return tmpdir
   83.82 +end
   83.83 +
   83.84 +--  layout determination: RPM Lua based implementation
   83.85 +function openpkg.layout(args)
   83.86 +    local dir = ""
   83.87 +
   83.88 +    --   parse arguments
   83.89 +    local arg = {
   83.90 +        variable   = "",
   83.91 +        layout     = "",
   83.92 +        macrosfile = "",
   83.93 +        basedir    = "",
   83.94 +        shared     = "no",
   83.95 +        debug      = "no",
   83.96 +        specdir    = "",
   83.97 +        sourcedir  = "",
   83.98 +        builddir   = "",
   83.99 +        tmppath    = "",
  83.100 +        rpmdir     = "",
  83.101 +        srcrpmdir  = ""
  83.102 +    }
  83.103 +    local arg_map_fwd = {
  83.104 +        binrpmdir = "rpmdir",
  83.105 +        tmpdir    = "tmppath"
  83.106 +    }
  83.107 +    local arg_map_rev = {
  83.108 +        rpmdir    = "binrpmdir",
  83.109 +        tmppath   = "tmpdir"
  83.110 +    }
  83.111 +    if rpm.debug() then
  83.112 +        arg.debug = "yes"
  83.113 +    end
  83.114 +    util.rsubst(args, "(?s)\\s*([a-z_][a-zA-Z0-9_-]*)=(?:\"((?:\\\\.|[^\"])*)\"|(\\S*))",
  83.115 +        function (key, _, value1, value2)
  83.116 +            if arg_map_fwd[key] ~= nil then
  83.117 +                key = arg_map_fwd[key]
  83.118 +            end
  83.119 +            if arg[key] == nil then
  83.120 +                io.stderr:write("rpm: invalid parameter \"" .. key .. "\" on call to \"openpkg.layout()\"\n")
  83.121 +            else
  83.122 +                if value1 ~= nil then arg[key] = value1 else arg[key] = value2 end
  83.123 +            end
  83.124 +            return false
  83.125 +        end
  83.126 +    )
  83.127 +    if arg.variable == "" then
  83.128 +        io.stderr:write("rpm: missing \"variable\" parameter on call to \"openpkg.layout()\"\n")
  83.129 +        return ""
  83.130 +    end
  83.131 +    if arg.layout == "" then
  83.132 +        io.stderr:write("rpm: missing \"layout\" parameter on call to \"openpkg.layout()\"\n")
  83.133 +        return ""
  83.134 +    end
  83.135 +    if arg.macrosfile == "" and arg.basedir == "" then
  83.136 +        io.stderr:write("rpm: missing \"macrosfile\" or \"basedir\" parameter on call to \"openpkg.layout()\"\n")
  83.137 +        return ""
  83.138 +    end
  83.139 +
  83.140 +    --   determine base directory
  83.141 +    if arg.basedir == "" then
  83.142 +        if util.rmatch(arg.macrosfile, "^.*/\.openpkg/rpmmacros$") ~= nil then
  83.143 +            arg.basedir = openpkg.canonicalize(openpkg.realpath(
  83.144 +                util.rsubst(
  83.145 +                    openpkg.realpath(arg.macrosfile),
  83.146 +                    "/[^/]+$", "/.."
  83.147 +                )
  83.148 +            ))
  83.149 +        else
  83.150 +            arg.basedir = rpm.expand("%{l_prefix}")
  83.151 +        end
  83.152 +    end
  83.153 +
  83.154 +    --  temporarily define "__openpkg_basedir" macro
  83.155 +    rpm.define("__openpkg_basedir " .. arg.basedir)
  83.156 +
  83.157 +    --  temporarily define "__openpkg_shared" macro
  83.158 +    if arg.shared == "yes" then
  83.159 +        rpm.define("__openpkg_shared yes")
  83.160 +    end
  83.161 +
  83.162 +    --  determine layout directory list
  83.163 +    local list = ""
  83.164 +    if arg[arg.variable] ~= nil and arg[arg.variable] ~= "" then
  83.165 +        list = arg[arg.variable]
  83.166 +    else
  83.167 +        list = rpm.expand(
  83.168 +            "%{?__openpkg_layout_" .. arg.layout .. "_" .. arg.variable .. "}" ..
  83.169 +            "%{!?__openpkg_layout_" .. arg.layout .. "_" .. arg.variable .. ":" ..
  83.170 +            "%{__openpkg_layout_global_" .. arg.variable .. "}}"
  83.171 +        )
  83.172 +    end
  83.173 +
  83.174 +    --  remove temporarily defined "__openpkg_basedir" macro
  83.175 +    rpm.undefine("__openpkg_basedir")
  83.176 +
  83.177 +    --  remove temporarily defined "__openpkg_shared" macro
  83.178 +    if arg.shared == "yes" then
  83.179 +        rpm.undefine("__openpkg_shared")
  83.180 +    end
  83.181 +
  83.182 +    --  iterate over all directory specifications
  83.183 +    local dirs = util.rsplit(list, "(?s)\\s+")
  83.184 +    local k = table.maxn(dirs)
  83.185 +    for i, _ in ipairs(dirs) do
  83.186 +        --  parse specification into path to check and optionally path to make
  83.187 +        local path_check  = dirs[i]
  83.188 +        local path_append = false
  83.189 +        local path_make   = path_check
  83.190 +        local s, _, m = util.rmatch(path_check, "^(.+):(\\+?)(.*)$")
  83.191 +        if s ~= nil then
  83.192 +            path_check  = m[1]
  83.193 +            path_append = (m[2] == "+")
  83.194 +            path_make   = m[3]
  83.195 +        end
  83.196 +        --  check whether path should be taken (last path is always taken)
  83.197 +        if posix.stat(path_check) ~= nil or i == k then
  83.198 +            if path_append then
  83.199 +                --  special case: simply append a suffix
  83.200 +                dir = path_check .. path_make
  83.201 +            else
  83.202 +                --  regular case: use full path to make
  83.203 +                dir = path_make
  83.204 +            end
  83.205 +            break
  83.206 +        end
  83.207 +    end
  83.208 +    if dir ~= "" then
  83.209 +        --  make sure path really exists and resolve to absolute path
  83.210 +        if posix.stat(dir) == nil then
  83.211 +            io.stderr:write("rpm: creating \"" .. arg.variable .. "\" directory \"" .. dir .. "\"\n")
  83.212 +            if posix.mkdir(dir) ~= 0 then
  83.213 +                io.stderr:write("rpm: failed to create directory \"" .. dir .. "\"\n")
  83.214 +            end
  83.215 +        end
  83.216 +        dir = openpkg.canonicalize(openpkg.realpath(dir))
  83.217 +    end
  83.218 +
  83.219 +    --  debugging
  83.220 +    if arg.debug == "yes" then
  83.221 +        local variable = arg.variable
  83.222 +        if arg_map_rev[variable] ~= nil then
  83.223 +            variable = arg_map_rev[variable]
  83.224 +        end
  83.225 +        io.stderr:write(string.format("rpm: openpkg: layout: [%s] %s = \"%s\"\n", arg.layout, variable, dir))
  83.226 +    end
  83.227 +
  83.228 +    --  provide result directory
  83.229 +    return dir
  83.230 +end
  83.231 +
    84.1 --- a/openpkg/rpmmacros	Tue Jul 31 12:12:54 2012 +0200
    84.2 +++ b/openpkg/rpmmacros	Tue Jul 31 12:23:42 2012 +0200
    84.3 @@ -1,14 +1,13 @@
    84.4  ##
    84.5  ##  rpmmacros -- OpenPKG RPM Macros
    84.6 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    84.7 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    84.8 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    84.9  ##
   84.10 -##  Permission to use, copy, modify, and distribute this software for
   84.11 -##  any purpose with or without fee is hereby granted, provided that
   84.12 -##  the above copyright notice and this permission notice appear in all
   84.13 -##  copies.
   84.14 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   84.15 +##  All rights reserved. Licenses which grant limited permission to use,
   84.16 +##  copy, modify and distribute this software are available from the
   84.17 +##  OpenPKG GmbH.
   84.18  ##
   84.19 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   84.20 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   84.21  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   84.22  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   84.23  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   84.24 @@ -21,12 +20,20 @@
   84.25  ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   84.26  ##  SUCH DAMAGE.
   84.27  ##
   84.28 +
   84.29 +##
   84.30  ##  The purpose of this macro set is to override the default
   84.31  ##  macros in the OpenPKG RPM installation for the @l_prefix@ hierarchy.
   84.32  ##
   84.33  
   84.34 +#   utility macro for "delayed one-time expansion" of macro bodies
   84.35 +#   (works by redefining a macro in-place to its expanded body on its first usage)
   84.36 +%l_once()                %{expand:%%global %{*}}%{expand:%%{%{1}}}
   84.37 +
   84.38  #   the OpenPKG release identification (for the current package or as a fallback for the bootstrap package)
   84.39 -%l_openpkg_release(F:)   %(%{l_prefix}/libexec/openpkg/release --release="%{?release}%{!?release:%(%{l_rpm} -q --qf '%{release}' openpkg)}" %{?-F:-F "%{-F*}"}%{!?-F:-F "OpenPKG-%%t"})
   84.40 +%l_openpkg_release(F:)   %(%{l_prefix}/libexec/openpkg/release \\\
   84.41 +                         --release="%{?release}%{!?release:%(%{l_rpm} -q --qf '%{release}' openpkg)}" \\\
   84.42 +                         %{?-F:-F "%{-F*}"}%{!?-F:-F "OpenPKG-%%t"})
   84.43  
   84.44  #   the OpenPKG OIDs (root is officially registered at IANA)
   84.45  %l_openpkg_oid           1.3.6.1.4.1.18749
   84.46 @@ -37,15 +44,31 @@
   84.47  
   84.48  #   the OpenPKG package tagging
   84.49  %l_tag_fmt               @TAG@
   84.50 -%l_tag_fmt_compat        %(prefix="%{l_prefix_static}"; if [ ".`expr $prefix : '/[^/][^/]*$'`" != .0 ]; then loc=`echo $prefix | cut -c2-4`; else loc=`echo $prefix | sed -e 's;/\\(.\\)[^/]*;\\1;g' | cut -c1-3`; fi; echo $loc)
   84.51 -%l_tag_fmt_loc           %(echo "%{l_prefix_static}" | sed -e 's;^/\\([^/]\\)[^/]*/\\([^/]\\)[^/]*/\\([^/]\\).*;\\1\\2\\3;' -e 's;^/\\([^/]\\)[^/]*/\\([^/][^/]\\).*;\\1\\2;' -e 's;^/\\([^/][^/]\\)[^/]*/\\([^/]\\).*;\\1\\2;' -e 's;^/\\([^/]\\)[^/]*/\\([^/]\\).*;\\1\\2;' -e 's;^/\\([^/][^/][^/]\\).*;\\1;' -e 's;^/\\([^/][^/]\\).*;\\1;' -e 's;^/\\([^/]\\).*;\\1;')
   84.52 -%l_tag_fmt_opt           %(uuid_ns="`%{l_uuid} -v3 ns:OID %{l_openpkg_oid_tagfmtopt}`"; %{l_uuid} -v3 $uuid_ns '%{?_options}')
   84.53 +%l_tag_fmt_compat        %(prefix="%{l_prefix_static}"; \
   84.54 +                         if [ ".`expr $prefix : '/[^/][^/]*$'`" != .0 ]; then \
   84.55 +                             loc=`echo $prefix | cut -c2-4`; \
   84.56 +                         else \
   84.57 +                             loc=`echo $prefix | sed -e 's;/\\(.\\)[^/]*;\\1;g' | cut -c1-3`; \
   84.58 +                         fi; \
   84.59 +                         echo $loc)
   84.60 +%l_tag_fmt_loc           %(echo "%{l_prefix_static}" | \\\
   84.61 +                         sed -e 's;^/\\([^/]\\)[^/]*/\\([^/]\\)[^/]*/\\([^/]\\).*;\\1\\2\\3;' \\\
   84.62 +                             -e 's;^/\\([^/]\\)[^/]*/\\([^/][^/]\\).*;\\1\\2;' \\\
   84.63 +                             -e 's;^/\\([^/][^/]\\)[^/]*/\\([^/]\\).*;\\1\\2;' \\\
   84.64 +                             -e 's;^/\\([^/]\\)[^/]*/\\([^/]\\).*;\\1\\2;' \\\
   84.65 +                             -e 's;^/\\([^/][^/][^/]\\).*;\\1;' \\\
   84.66 +                             -e 's;^/\\([^/][^/]\\).*;\\1;' \\\
   84.67 +                             -e 's;^/\\([^/]\\).*;\\1;' \\\
   84.68 +                         )
   84.69 +%l_tag_fmt_opt           %(uuid_ns="`%{l_uuid} -v3 ns:OID %{l_openpkg_oid_tagfmtopt}`"; \
   84.70 +                         %{l_uuid} -v3 $uuid_ns '%{?_options}')
   84.71  %l_tag_fmt_uuid          %(%{l_uuid} -v1)
   84.72  %l_tag_fmt_time          %(date '+%%Y%%m%%d%%H%%M%%S')
   84.73  %l_tag_fmt_user          %(%{l_shtool} echo -e '%%u')
   84.74  %l_tag_fmt_host          %(%{l_shtool} echo -e '%%h%%d')
   84.75 -%l_tag_gen               %{expand:%(echo '%{l_tag_fmt}' | sed -e 's/<\\([a-zA-Z][_a-zA-Z0-9]*\\)>/%%{l_tag_fmt_\\1}/g')}
   84.76 -%l_tag                   %(echo "%{l_tag_gen}" | sed -e 's;-;;g')
   84.77 +%l_tag_gen               %{expand:%(echo '%{l_tag_fmt}' | \\\
   84.78 +                         sed -e 's/<\\([a-zA-Z][_a-zA-Z0-9]*\\)>/%%{l_tag_fmt_\\1}/g')}
   84.79 +%l_tag                   %{l_once l_tag %(echo "%{l_tag_gen}" | sed -e 's;-;;g')}
   84.80  
   84.81  #   the OpenPKG instance location (backward compatibility only)
   84.82  %l_location              %{l_tag}
   84.83 @@ -92,35 +115,65 @@
   84.84  %l_host_os               %{_host_os}
   84.85  %l_host                  %{_host_cpu}-%{_host_os}
   84.86  
   84.87 +#   host name or FQDN identification
   84.88 +%l_hostname(f)           %(%{l_shtool} echo -n -e '%%h%{?-f:%%d}')
   84.89 +
   84.90  #   new OpenPKG platform identification
   84.91 -%l_platform(cptF:)       %(if [ ".%{?-F}" != . ]; then fmt="%{-F*}"; else T="%{?-c:c}%{?-p:p}%{?-t:t}"; [ ".$T" = . ] && T="p"; fmt="%%<a$T>-%%<s$T>"; fi; %{l_shtool} platform -n -L -S "" -C "+" -F "$fmt")
   84.92 +%l_platform(cptF:)       %(if [ ".%{?-F}" != . ]; then \
   84.93 +                             fmt="%{-F*}"; \
   84.94 +                         else \
   84.95 +                             T="%{?-c:c}%{?-p:p}%{?-t:t}"; \
   84.96 +                             [ ".$T" = . ] && T="p"; \
   84.97 +                             fmt="%%<a$T>-%%<s$T>"; \
   84.98 +                         fi; \
   84.99 +                         %{l_shtool} platform -n -L -S "" -C "+" -F "$fmt")
  84.100  
  84.101  #   old OpenPKG platform identification
  84.102  %l_target                %{l_platform -t}
  84.103  
  84.104 +#   UID/GID lookup
  84.105 +%l_xuid_lookup()         %(( getent passwd '%1'; \
  84.106 +                             grep '^%1:' /etc/passwd; \
  84.107 +                             ypmatch '%1' passwd; \
  84.108 +                             nismatch '%1' passwd; \
  84.109 +                             nidump passwd . | grep '^%1:' \
  84.110 +                           ) 2>/dev/null | \
  84.111 +                           sed -e 'q' | \\\
  84.112 +                           awk -F: '{ print $3; }' \
  84.113 +                         )
  84.114 +%l_xgid_lookup()         %(( getent group '%2'; \
  84.115 +                             grep '^%2:' /etc/group; \
  84.116 +                             ypmatch '%2' group; \
  84.117 +                             nismatch '%2' group; \
  84.118 +                             nidump group . | grep '^%1:' \
  84.119 +                           ) 2>/dev/null | \
  84.120 +                           sed -e 'q' | \\\
  84.121 +                           awk -F: '{ print $3; }' \
  84.122 +                         )
  84.123 +
  84.124  #   the *S*uper-user user/group name/id pair
  84.125  %l_susr                  @SUSR@
  84.126  %l_sgrp                  @SGRP@
  84.127 -%l_suid                  %((getent passwd "%{l_susr}"; grep "^%{l_susr}:" /etc/passwd; ypmatch "%{l_susr}" passwd; nismatch "%{l_susr}" passwd; nidump passwd . | grep "^%{l_susr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  84.128 -%l_sgid                  %((getent group  "%{l_sgrp}"; grep "^%{l_sgrp}:" /etc/group;  ypmatch "%{l_sgrp}" group;  nismatch "%{l_sgrp}" group;  nidump group  . | grep "^%{l_susr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  84.129 +%l_suid                  %{expand:%%{l_xuid_lookup %{l_susr} %{l_sgrp}}}
  84.130 +%l_sgid                  %{expand:%%{l_xgid_lookup %{l_susr} %{l_sgrp}}}
  84.131  
  84.132  #   the *M*anagement user/group name/id pair
  84.133  %l_musr                  @MUSR@
  84.134  %l_mgrp                  @MGRP@
  84.135 -%l_muid                  %((getent passwd "%{l_musr}"; grep "^%{l_musr}:" /etc/passwd; ypmatch "%{l_musr}" passwd; nismatch "%{l_musr}" passwd; nidump passwd . | grep "^%{l_musr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  84.136 -%l_mgid                  %((getent group  "%{l_mgrp}"; grep "^%{l_mgrp}:" /etc/group;  ypmatch "%{l_mgrp}" group;  nismatch "%{l_mgrp}" group;  nidump group  . | grep "^%{l_musr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  84.137 +%l_muid                  %{expand:%%{l_xuid_lookup %{l_musr} %{l_mgrp}}}
  84.138 +%l_mgid                  %{expand:%%{l_xgid_lookup %{l_musr} %{l_mgrp}}}
  84.139  
  84.140  #   the *R*restricted user/group name/id pair
  84.141  %l_rusr                  @RUSR@
  84.142  %l_rgrp                  @RGRP@
  84.143 -%l_ruid                  %((getent passwd "%{l_rusr}"; grep "^%{l_rusr}:" /etc/passwd; ypmatch "%{l_rusr}" passwd; nismatch "%{l_rusr}" passwd; nidump passwd . | grep "^%{l_rusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  84.144 -%l_rgid                  %((getent group  "%{l_rgrp}"; grep "^%{l_rgrp}:" /etc/group;  ypmatch "%{l_rgrp}" group;  nismatch "%{l_rgrp}" group;  nidump group  . | grep "^%{l_rusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  84.145 +%l_ruid                  %{expand:%%{l_xuid_lookup %{l_rusr} %{l_rgrp}}}
  84.146 +%l_rgid                  %{expand:%%{l_xgid_lookup %{l_rusr} %{l_rgrp}}}
  84.147  
  84.148  #   the *N*on-privileged user/group name/id pair
  84.149  %l_nusr                  @NUSR@
  84.150  %l_ngrp                  @NGRP@
  84.151 -%l_nuid                  %((getent passwd "%{l_nusr}"; grep "^%{l_nusr}:" /etc/passwd; ypmatch "%{l_nusr}" passwd; nismatch "%{l_nusr}" passwd; nidump passwd . | grep "^%{l_nusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  84.152 -%l_ngid                  %((getent group  "%{l_ngrp}"; grep "^%{l_ngrp}:" /etc/group;  ypmatch "%{l_ngrp}" group;  nismatch "%{l_ngrp}" group;  nidump group  . | grep "^%{l_nusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  84.153 +%l_nuid                  %{expand:%%{l_xuid_lookup %{l_nusr} %{l_ngrp}}}
  84.154 +%l_ngid                  %{expand:%%{l_xgid_lookup %{l_nusr} %{l_ngrp}}}
  84.155  
  84.156  #   backward compatibility (openpkg < 20020204)
  84.157  %l_fsusr                 %{l_musr}
  84.158 @@ -128,6 +181,10 @@
  84.159  %l_npuid                 %{l_nuid}
  84.160  %l_npgid                 %{l_ngid}
  84.161  
  84.162 +#   whether we are intended to operate in an environment where
  84.163 +#   only a single unprivileged user account can be used
  84.164 +%l_unprivileged          @l_unprivileged@
  84.165 +
  84.166  #   define the installation hierarchy (used parts)
  84.167  %l_prefix                @l_prefix@
  84.168  %l_prefix_static         @l_prefix_static@
  84.169 @@ -159,11 +216,49 @@
  84.170  #   ";" for "-s" and ";" for "-b" and "-c". You can either specify one
  84.171  #   or more names of variables to expand or use "-a" for mostly all
  84.172  #   variables and "-A" for really all variables.
  84.173 -%l_value(sbcaA)          %{expand:%(l=""; for x in `if [ ".%*" != . ]; then echo "%* "; else p=""; if [ ".%{-a:yes}" = .yes ]; then p="^%%l_(prefix|[smrn](usr|grp|uid|gid))"; elif [ ".%{-A:yes}" = .yes ]; then p="^%%l_"; fi; if [ ".$p" != . ]; then egrep "$p" %{l_prefix}/etc/openpkg/rpmmacros | sed -e '/^%%l_value/,$d' -e 's;^%%\\(l_[a-z1-9_]*\\).*;\\1;'; fi; fi`; do e=""; if [ ".%{-s:yes}" = .yes ]; then e="-e 's;@$x@;%%{$x};g'"; elif [ ".%{-b:yes}" = .yes ]; then e="$x='%%{$x}';"; elif [ ".%{-c:yes}" = .yes ]; then e="set $x = '%%{$x}';"; else e="%%{$x}"; fi; if [ ".$l" = . ]; then l="$e"; else l="$l $e"; fi; done; echo "$l")}
  84.174 +%l_value(sbcaA)          %{expand:%(\
  84.175 +                         l=""; \
  84.176 +                             for x in \\\
  84.177 +                                 `if [ ".%*" != . ]; then \
  84.178 +                                     echo "%* "; \
  84.179 +                                 else \
  84.180 +                                     p=""; \
  84.181 +                                     if [ ".%{-a:yes}" = .yes ]; then \
  84.182 +                                         p="^%%l_(prefix|[smrn](usr|grp|uid|gid))"; \
  84.183 +                                     elif [ ".%{-A:yes}" = .yes ]; then \
  84.184 +                                         p="^%%l_"; \
  84.185 +                                     fi; \
  84.186 +                                     if [ ".$p" != . ]; then \
  84.187 +                                         egrep "$p" %{l_prefix}/etc/openpkg/rpmmacros |\\\
  84.188 +                                         sed -e '/^%%l_value/,$d' \\\
  84.189 +                                             -e 's;^%%\\(l_[a-z1-9_]*\\).*;\\1;'; \
  84.190 +                                     fi; \
  84.191 +                                 fi`; do \
  84.192 +                                 e=""; \
  84.193 +                                 if [ ".%{-s:yes}" = .yes ]; then \
  84.194 +                                     e="-e 's;@$x@;%%{$x};g'"; \
  84.195 +                                 elif [ ".%{-b:yes}" = .yes ]; then \
  84.196 +                                     e="$x='%%{$x}';"; \
  84.197 +                                 elif [ ".%{-c:yes}" = .yes ]; then \
  84.198 +                                     e="set $x = '%%{$x}';"; \
  84.199 +                                 else \
  84.200 +                                     e="%%{$x}"; \
  84.201 +                                 fi; \
  84.202 +                                 if [ ".$l" = . ]; then \
  84.203 +                                     l="$e"; \
  84.204 +                                 else \
  84.205 +                                     l="$l $e"; \
  84.206 +                                 fi; \
  84.207 +                             done; \
  84.208 +                             echo "$l" \
  84.209 +                         )}
  84.210  
  84.211  #   local version of the empty macro
  84.212  %l_nil                   %{nil}
  84.213  
  84.214 +#   local version of the tab character
  84.215 +%l_tab                   %{lua: print "\t" }
  84.216 +
  84.217  #   override the internal RPM hierarchy variables
  84.218  %_usr                    %{nil}
  84.219  %_var                    %{nil}
  84.220 @@ -176,15 +271,23 @@
  84.221  %_specdir                %{l_prefix}/RPM/SRC/%{name}
  84.222  %_rpmdir                 %{l_prefix}/RPM/PKG
  84.223  %_srcrpmdir              %{l_prefix}/RPM/PKG
  84.224 -%_repackage_dir          %{l_prefix}/RPM/PKG
  84.225 -%_cache_dbpath           %{l_prefix}/RPM/PKG
  84.226 -%_solve_dbpath           %{l_prefix}/RPM/PKG
  84.227 -%_solve_pkgsdir          %{l_prefix}/RPM/PKG
  84.228 +%_repackage_dir          %{l_prefix}/RPM/TR
  84.229 +%_cache_dbpath           %{l_prefix}/RPM/CACHE
  84.230 +%_solve_dbpath           %{l_prefix}/RPM/CACHE
  84.231 +%_solve_pkgsdir          %{l_prefix}/RPM/CACHE
  84.232  %_defaultdocdir          %{l_docdir}
  84.233  
  84.234  #   complement the %{SOURCE<n>} and %{PATCH<n>} with %{SOURCE <file>} and %{PATCH <file>}
  84.235 -%SOURCE()                %(f="%1"; if [ -f "%{_specdir}/$f" ]; then echo "%{_specdir}/$f"; else echo "%{_sourcedir}/$f"; fi)
  84.236 -%PATCH()                 %(f="%1"; if [ -f "%{_specdir}/$f" ]; then echo "%{_specdir}/$f"; else echo "%{_sourcedir}/$f"; fi)
  84.237 +%_SOURCE_PATCH()         %{lua: \
  84.238 +                         local source1 = rpm.expand("%{_specdir}/%1") \
  84.239 +                         local source2 = rpm.expand("%{_sourcedir}/%1") \
  84.240 +                         if posix.stat(source1) ~= nil then \
  84.241 +                             print(source1) \
  84.242 +                         else \
  84.243 +                             print(source2) \
  84.244 +                         end }
  84.245 +%SOURCE()                %{expand:%%{_SOURCE_PATCH %1}}
  84.246 +%PATCH()                 %{expand:%%{_SOURCE_PATCH %1}}
  84.247  
  84.248  #   override RPM's absolute tool paths with relative ones
  84.249  #   (because if you upgrade RPM it would hard-code tools in own hierarchy, too)
  84.250 @@ -195,7 +298,6 @@
  84.251  %__chmod                 chmod
  84.252  %__chown                 chown
  84.253  %__cp                    cp
  84.254 -%__cpio                  cpio
  84.255  %__grep                  grep
  84.256  %__gzip                  %{_gzipbin}
  84.257  %__id                    id
  84.258 @@ -213,33 +315,37 @@
  84.259  %__sed                   sed
  84.260  %__ssh                   ssh
  84.261  %__tar                   %{_tarbin}
  84.262 -%__unzip                 %{_unzipbin}
  84.263 +%__xz                    %{_xzbin}
  84.264  
  84.265  #   override some more RPM macros where the default value is not acceptable
  84.266 +%_dbapi                  %{l_once _dbapi %(if [ -f "%{_dbpath}/VERSION" ]; then \
  84.267 +                             . "%{_dbpath}/VERSION"; \
  84.268 +                         fi; \
  84.269 +                         echo "${DBAPI:-3}")}
  84.270 +%__dbi_other             %{?_tmppath:tmpdir=%{_tmppath}} %{?__dbi_cdb} %{?__dbi_private:private}
  84.271 +%__file_context_path     %{nil}
  84.272 +%__check_files           %{nil}
  84.273 +%_patch_suffix           -b --suffix .orig
  84.274 +%_excludedocs            1
  84.275  %_dependency_whiteout    %{nil}
  84.276  %__debug_install_post    %{nil}
  84.277  %_unpackaged_files_terminate_build 0
  84.278  
  84.279 -#   override automatic dependency generation
  84.280 -%_use_internal_dependency_generator 0
  84.281 -%__find_provides         %{nil}
  84.282 -%__find_requires         %{nil}
  84.283 -%__find_prereq           %{nil}
  84.284 -%__perl_provides         %{nil}
  84.285 -%__perl_requires         %{nil}
  84.286 -
  84.287  #   provide fixed paths to tools (standard)
  84.288  %_gzipbin                %{l_prefix}/lib/openpkg/gzip
  84.289  %_bzip2bin               %{l_prefix}/lib/openpkg/bzip2
  84.290 +%_xzbin                  %{l_prefix}/lib/openpkg/xz
  84.291  %_patchbin               %{l_prefix}/lib/openpkg/patch
  84.292  %_tarbin                 %{l_prefix}/lib/openpkg/tar
  84.293 -%_unzipbin               %{l_prefix}/lib/openpkg/unzip
  84.294 +%__bsdtar                %{l_prefix}/lib/openpkg/bsdtar
  84.295 +%__cpio                  %{l_prefix}/lib/openpkg/bsdcpio
  84.296 +%__unzip                 %{__bsdtar}
  84.297  
  84.298  #   provide path to platform identification file
  84.299  %__platform              %{l_prefix}/etc/openpkg/platform
  84.300  
  84.301  #   provide fixed paths to tools (additional)
  84.302 -%l_rc                    %{l_prefix}/etc/rc
  84.303 +%l_rc                    %{l_prefix}/bin/openpkg --keep-privileges rc
  84.304  %l_rpm                   %{l_prefix}/libexec/openpkg/rpm
  84.305  %l_rpm2cpio              %{l_prefix}/libexec/openpkg/rpm2cpio
  84.306  %l_rpm_config            %{l_prefix}/libexec/openpkg/rpm-config
  84.307 @@ -251,31 +357,41 @@
  84.308  %l_uuid                  %{l_prefix}/lib/openpkg/uuid
  84.309  
  84.310  #   provide smart paths to tools
  84.311 -%l_tool_locate()         %(if [ ".%{expand:%%{?use_%1}}" != . ]; then tool="%{expand:%%{use_%1}}"; elif [ -f "%{l_prefix}/bin/%2" ]; then tool="%{l_prefix}/bin/%2"; elif [ -f "%{l_prefix}/lib/openpkg/%2" ]; then tool="%{l_prefix}/lib/openpkg/%2"; else tool="%2"; fi; echo $tool)
  84.312 -%l_gzip                  %{l_tool_locate gzip     gzip}
  84.313 -%l_bzip2                 %{l_tool_locate bzip2    bzip2}
  84.314 -%l_tar                   %{l_tool_locate tar      tar}
  84.315 -%l_make                  %{l_tool_locate make     make}
  84.316 -%l_cc                    %{l_tool_locate cc       cc}
  84.317 -%l_ar                    %{l_tool_locate ar       ar}
  84.318 -%l_ld                    %{l_tool_locate ld       ld}
  84.319 -%l_as                    %{l_tool_locate as       as}
  84.320 -%l_strip                 %{l_tool_locate strip    strip}
  84.321 -%l_cxx                   %{l_tool_locate cxx      c++}
  84.322 -%l_patch                 %{l_tool_locate patch    patch}
  84.323 -%l_sed                   %{l_tool_locate sed      sed}
  84.324 -%l_grep                  %{l_tool_locate grep     grep}
  84.325 -%l_awk                   %{l_tool_locate awk      awk}
  84.326 -%l_autoconf              %{l_tool_locate autoconf autoconf}
  84.327 -%l_automake              %{l_tool_locate automake automake}
  84.328 -%l_libtool               %{l_tool_locate libtool  libtool}
  84.329 -%l_flex                  %{l_tool_locate flex     flex}
  84.330 -%l_bison                 %{l_tool_locate bison    bison}
  84.331 -%l_perl                  %{l_tool_locate perl     perl}
  84.332 -%l_miniperl              %{l_tool_locate miniperl miniperl}
  84.333 -%l_openssl               %{l_tool_locate openssl  openssl}
  84.334 -%l_xmkmf                 %{l_tool_locate xmkmf    xmkmf}
  84.335 -%l_vcheck                %{l_tool_locate vcheck   vcheck}
  84.336 +%l_tool_locate()         %{lua: \
  84.337 +                         if rpm.expand("%{expand:%%{?use_%1}}") ~= "" then \
  84.338 +                             print(rpm.expand("%{expand:%%{use_%1}}")) \
  84.339 +                         elseif posix.stat(rpm.expand("%{l_prefix}/bin/%2")) ~= nil then \
  84.340 +                             print(rpm.expand("%{l_prefix}/bin/%2")) \
  84.341 +                         elseif posix.stat(rpm.expand("%{l_prefix}/lib/openpkg/%2")) ~= nil then \
  84.342 +                             print(rpm.expand("%{l_prefix}/lib/openpkg/%2")) \
  84.343 +                         else \
  84.344 +                             print(rpm.expand("%2")) \
  84.345 +                         end }
  84.346 +%l_gzip                  %{l_once l_gzip     %{l_tool_locate gzip     gzip}}
  84.347 +%l_bzip2                 %{l_once l_bzip2    %{l_tool_locate bzip2    bzip2}}
  84.348 +%l_xz                    %{l_once l_xz       %{l_tool_locate xz       xz}}
  84.349 +%l_tar                   %{l_once l_tar      %{l_tool_locate tar      tar}}
  84.350 +%l_make                  %{l_once l_make     %{l_tool_locate make     make}}
  84.351 +%l_cc                    %{l_once l_cc       %{l_tool_locate cc       cc}}
  84.352 +%l_ar                    %{l_once l_ar       %{l_tool_locate ar       ar}}
  84.353 +%l_ld                    %{l_once l_ld       %{l_tool_locate ld       ld}}
  84.354 +%l_as                    %{l_once l_as       %{l_tool_locate as       as}}
  84.355 +%l_strip                 %{l_once l_strip    %{l_tool_locate strip    strip}}
  84.356 +%l_cxx                   %{l_once l_cxx      %{l_tool_locate cxx      c++}}
  84.357 +%l_patch                 %{l_once l_patch    %{l_tool_locate patch    patch}}
  84.358 +%l_sed                   %{l_once l_sed      %{l_tool_locate sed      sed}}
  84.359 +%l_grep                  %{l_once l_grep     %{l_tool_locate grep     grep}}
  84.360 +%l_awk                   %{l_once l_awk      %{l_tool_locate awk      awk}}
  84.361 +%l_autoconf              %{l_once l_autoconf %{l_tool_locate autoconf autoconf}}
  84.362 +%l_automake              %{l_once l_automake %{l_tool_locate automake automake}}
  84.363 +%l_libtool               %{l_once l_libtool  %{l_tool_locate libtool  libtool}}
  84.364 +%l_flex                  %{l_once l_flex     %{l_tool_locate flex     flex}}
  84.365 +%l_bison                 %{l_once l_bison    %{l_tool_locate bison    bison}}
  84.366 +%l_perl                  %{l_once l_perl     %{l_tool_locate perl     perl}}
  84.367 +%l_miniperl              %{l_once l_miniperl %{l_tool_locate miniperl miniperl}}
  84.368 +%l_openssl               %{l_once l_openssl  %{l_tool_locate openssl  openssl}}
  84.369 +%l_xmkmf                 %{l_once l_xmkmf    %{l_tool_locate xmkmf    xmkmf}}
  84.370 +%l_vcheck                %{l_once l_vcheck   %{l_tool_locate vcheck   vcheck}}
  84.371  
  84.372  #   tool options
  84.373  %l_mflags(O)             %(%{l_sane_env}; %{l_rpmtool} mflags %{-O:-O} "%{l_make}")
  84.374 @@ -285,11 +401,24 @@
  84.375  %l_ldflags()             %(%{l_sane_env}; %{l_rpmtool} ldflags  -p%{l_prefix}          -- %*)
  84.376  
  84.377  #   OSSP fake syslog library
  84.378 -%l_fsl_ldflags()         %(if [ ".%{with_fsl}" = ".yes" ]; then flags=`(%{l_prefix}/bin/fsl-config --all --ldflags) 2>/dev/null`; else flags=''; fi; echo $flags)
  84.379 -%l_fsl_libs()            %(if [ ".%{with_fsl}" = ".yes" ]; then flags=`(%{l_prefix}/bin/fsl-config --all --libs   ) 2>/dev/null`; else flags=''; fi; echo $flags)
  84.380 +%l_fsl_ldflags()         %(if [ ".%{with_fsl}" = ".yes" ]; then \
  84.381 +                             flags=`(%{l_prefix}/bin/fsl-config --all --ldflags) 2>/dev/null`; \
  84.382 +                         else \
  84.383 +                             flags=''; \
  84.384 +                         fi; \
  84.385 +                         echo $flags)
  84.386 +%l_fsl_libs()            %(if [ ".%{with_fsl}" = ".yes" ]; then \
  84.387 +                             flags=`(%{l_prefix}/bin/fsl-config --all --libs) 2>/dev/null`; \
  84.388 +                         else \
  84.389 +                             flags=''; \
  84.390 +                         fi; \
  84.391 +                         echo $flags)
  84.392  
  84.393  #   determine the current username
  84.394 -%l_whoami                %((id -un) 2>/dev/null || (whoami) 2>/dev/null || (who am i | cut "-d " -f1) 2>/dev/null || echo $LOGNAME)
  84.395 +%l_whoami                %{l_once l_whoami %((id -un) 2>/dev/null || \\\
  84.396 +                         (whoami) 2>/dev/null || \\\
  84.397 +                         (who am i | cut "-d " -f1) 2>/dev/null || \\\
  84.398 +                         echo $LOGNAME)}
  84.399  
  84.400  #   macros for dynamically generating a %files list
  84.401  %l_files_defattr         '%%defattr(-,%{l_musr},%{l_mgrp})'
  84.402 @@ -297,8 +426,11 @@
  84.403  %l_files_noshared        '%%not %%dir {%{l_prefix},%{l_prefix}/*,%{l_prefix}/etc/rc.d,%{l_prefix}/man/*}'
  84.404  %l_files_std()           %l_files_defattr %l_files_all %l_files_noshared
  84.405  
  84.406 +#   default %defattr when rolling SRPMS
  84.407 +%_srcdefattr             (-,openpkg,openpkg)
  84.408 +
  84.409  #   path to local build root
  84.410 -%l_buildroot             %{_tmppath}/%{name}-%{version}-root
  84.411 +%l_buildroot             %{_tmppath}/%{name}-%{version}-%{release}-buildroot
  84.412  %buildroot               %{l_buildroot}
  84.413  
  84.414  #   path to local temporary location
  84.415 @@ -316,7 +448,12 @@
  84.416  %_rpmfilename            %{l_binrpmfilename}
  84.417  %_build_name_fmt         %{l_binrpmfilename}
  84.418  %_repackage_name_fmt     %{l_binrpmfilename}
  84.419 -%_solve_name_fmt         %{_solve_pkgsdir}/%{l_binrpmfilename}
  84.420 +%_solve_name_fmt         %{?_solve_pkgsdir}/%{l_binrpmfilename}
  84.421 +%_query_all_fmt          %%{NAME}-%%{VERSION}-%%{RELEASE}
  84.422 +%___NVRA                 %%{NAME}-%%{VERSION}-%%{RELEASE}
  84.423 +
  84.424 +#   do not repackage automatically
  84.425 +%_repackage_all_erasures 0
  84.426  
  84.427  #   override the payload compression for the CPIO parts of an RPM
  84.428  #   (we use the equivalent of "bzip2 -9")
  84.429 @@ -324,98 +461,177 @@
  84.430  %_binary_payload         w9.bzdio
  84.431  
  84.432  #   package signature type is OpenPGP via GnuPG
  84.433 -%__gpg                   %{l_prefix}/bin/gpg
  84.434 +%__gpg                   %{l_tool_locate gpg gpg}
  84.435  %_signature              gpg
  84.436 -%__vsflags               1
  84.437  
  84.438  #   two macro-processor add-ons (should be part of forthcoming RPM releases)
  84.439  %ifdef()                 %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
  84.440  %ifndef()                %if %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
  84.441  
  84.442  #   macro for package option configuration
  84.443 -%option()                %{expand:%%{!?%{1}:%%global %*}} %{expand:%%global _options %{?_options:%{_options}:}%{1}=%%%{1}} \
  84.444 -Provides: %{name}::%{1} = %(echo '%{expand:%%{%{1}}}' | sed -e 's;%%;%%%%;g' -e 's; ;%%20;g' -e 's;	;%%09;g')
  84.445 +%option()                %{lua: \
  84.446 +                             local package_name = rpm.expand("%{name}") \
  84.447 +                             local option_name = rpm.expand("%1") \
  84.448 +                             if rpm.expand("%{?" .. option_name .. ":defined}") ~= "defined" then \
  84.449 +                                 rpm.expand("%global " .. rpm.expand("%*")) \
  84.450 +                             end \
  84.451 +                             local option_value = rpm.expand("%{" .. option_name .. "}") \
  84.452 +                             option_value = util.rsubst(option_value, "(?s)%", "%%%%") \
  84.453 +                             option_value = util.rsubst(option_value, "(?s) ", "%%20") \
  84.454 +                             option_value = util.rsubst(option_value, "(?s)\\t", "%%09") \
  84.455 +                             rpm.expand("%global _options %{?_options:%{_options}:}" .. option_name .. "=" .. option_value) \
  84.456 +                             print(string.format("Provides: %s::%s = %s\\n", package_name, option_name, option_value)) \
  84.457 +                         }
  84.458  
  84.459  #   macros for NoSource/NoPatch (distribution restriction) integrity handling
  84.460 -%NoSource()              %(if [ ".%{?restriction}" != ".no" ]; then echo "NoSource: %1"; fi)%{expand:%%global _restricted %{?_restricted:%{_restricted}} %%{SOURCEURL%1}}
  84.461 -%NoPatch()               %(if [ ".%{?restriction}" != ".no" ]; then echo "NoPatch: %1"; fi)%{expand:%%global _restricted %{?_restricted:%{_restricted}} %%{PATCHURL%1}}
  84.462 +%NoSource()              %(if [ ".%{?restriction}" != ".no" ]; then \
  84.463 +                             echo "NoSource: %1"; \
  84.464 +                         fi) \
  84.465 +                         %{expand:%%global _restricted %{?_restricted:%{_restricted}} %%{SOURCEURL%1}}
  84.466 +%NoPatch()               %(if [ ".%{?restriction}" != ".no" ]; then \
  84.467 +                             echo "NoPatch: %1"; fi) \
  84.468 +                         %{expand:%%global _restricted %{?_restricted:%{_restricted}} %%{PATCHURL%1}}
  84.469  %integrity()             %{l_check_nosource}
  84.470  
  84.471  #   macros for checking build environment
  84.472 -%l_check_nosource()      %(%{l_sane_env}; checkok=1; checkinfo=`echo "Sorry, this OpenPKG package contains a DISTRIBUTION RESTRICTED source file."; echo "Before you can proceed building this package, fetch missing files MANUALLY:"`; for url in . %{?_restricted}; do [ ".$url" = .. ] && continue; eval `echo "$url" | sed -e 's!^\\(.*\\)::/\\([^/][^/]*\\)$!;url=\\"\\1\\"; file=\\"\\2\\"!' -e 's!^\\([^:;][^:]*://.*/\\)\\([^/][^/]*\\)$!;url=\\"\\1\\"; file=\\"\\2\\"!' -e 's:^\\([^;].*\\)$:;url="(unknown location) "; file="\\1":' -e 's:^;::'`; if [ ! -f "%{_specdir}/$file" ] && [ ! -f "%{_sourcedir}/$file" ]; then checkok=0; checkinfo=`echo "${checkinfo}"; echo ""; echo "from ${url}"; echo "file ${file}"; echo "here %{_sourcedir}/$file"`; fi; done; if [ $checkok -ne 1 ]; then echo "set +x"; echo "$checkinfo" | %{l_rpmtool} msg -b -t error | sed -e 's;^;echo ";' -e 's;$;";'; echo "exit 1"; fi)
  84.473 -%l_check_class()         %(%{l_sane_env}; class=`echo "@:%{?class}:%{?distribution}" | sed -e 's;^@:\\([^:][^:]*\\):.*$;\\1;' -e 's;^@:.*\\[\\(.*\\)\\].*$;\\1;' -e 's;^@:.*$;JUNK;'`; %{l_rpmtool} check-class "$class")
  84.474 +%l_check_nosource()      %(%{l_sane_env}; checkok=1; \
  84.475 +                         checkinfo=`echo "Sorry, this OpenPKG package contains a DISTRIBUTION RESTRICTED source file."; \\\
  84.476 +                         echo "Before you can proceed building this package, fetch missing files MANUALLY:"`; \
  84.477 +                         for url in . %{?_restricted}; do \
  84.478 +                             [ ".$url" = .. ] && continue; \
  84.479 +                             eval `echo "$url" | \\\
  84.480 +                             sed -e 's!^\\(.*\\)::/\\([^/][^/]*\\)$!;url=\\"\\1\\"; file=\\"\\2\\"!' \\\
  84.481 +                                 -e 's!^\\([^:;][^:]*://.*/\\)\\([^/][^/]*\\)$!;url=\\"\\1\\"; file=\\"\\2\\"!' \\\
  84.482 +                                 -e 's:^\\([^;].*\\)$:;url="(unknown location) "; file="\\1":' \\\
  84.483 +                                 -e 's:^;::'`; \
  84.484 +                             if [ ! -f "%{_specdir}/$file" ] && [ ! -f "%{_sourcedir}/$file" ]; then \\\
  84.485 +                                 checkok=0; \
  84.486 +                                 checkinfo=`echo "${checkinfo}"; \\\
  84.487 +                                     echo ""; \\\
  84.488 +                                     echo "from ${url}"; \\\
  84.489 +                                     echo "file ${file}"; \\\
  84.490 +                                     echo "here %{_sourcedir}/$file"`; \
  84.491 +                             fi; \
  84.492 +                         done; \
  84.493 +                         if [ $checkok -ne 1 ]; then \
  84.494 +                             echo "set +x"; \
  84.495 +                             echo "$checkinfo" | \\\
  84.496 +                             %{l_rpmtool} msg -b -t error | \\\
  84.497 +                             sed -e 's;^;echo ";' -e 's;$;";'; \
  84.498 +                             echo "exit 1"; \
  84.499 +                         fi)
  84.500 +%l_check_class()         %(%{l_sane_env}; \
  84.501 +                         class=`echo "@:%{?class}:%{?distribution}" | \\\
  84.502 +                         sed -e 's;^@:\\([^:][^:]*\\):.*$;\\1;' \\\
  84.503 +                             -e 's;^@:.*\\[\\(.*\\)\\].*$;\\1;' \\\
  84.504 +                             -e 's;^@:.*$;JUNK;'`; \
  84.505 +                         %{l_rpmtool} check-class "$class")
  84.506  %prep %%prep\
  84.507      %{l_check_nosource} \
  84.508      %{l_check_class} \
  84.509      %{nil}
  84.510  
  84.511  #   macro-processor add-on for testing external conditions
  84.512 -%l_test(pfd)             %(if [ ".%{?-p:yes}" = .yes ]; then %{l_rpm} -q %1 >/dev/null 2>&1; rc=$?; elif [ ".%{?-f:yes}" = .yes ]; then test -f %1; rc=$?; elif [ ".%{?-d:yes}" = .yes ]; then test -d %1; rc=$?; fi; if [ ".$rc" = .0 ]; then echo "yes"; else echo "no"; fi)
  84.513 -
  84.514 -#   default list of vendor source fetching locations
  84.515 -%l_fetch_mirror_0        -
  84.516 -%l_fetch_mirror_1        -
  84.517 -%l_fetch_mirror_2        -
  84.518 -%l_fetch_mirror_3        -
  84.519 -%l_fetch_mirror_4        -
  84.520 -%l_fetch_mirror_5        -
  84.521 -%l_fetch_mirror_6        -
  84.522 -%l_fetch_mirror_7        -
  84.523 -%l_fetch_mirror_8        -
  84.524 -%l_fetch_mirror_9        -
  84.525 -%l_fetch_backup_0        -
  84.526 -%l_fetch_backup_1        -
  84.527 -%l_fetch_backup_2        -
  84.528 -%l_fetch_backup_3        -
  84.529 -%l_fetch_backup_4        -
  84.530 -%l_fetch_backup_5        -
  84.531 -%l_fetch_backup_6        -
  84.532 -%l_fetch_backup_7        -
  84.533 -%l_fetch_backup_8        -
  84.534 -%l_fetch_backup_9        ftp://ftp.openpkg.org/sources/DST/%{name}/
  84.535 +%l_test(pfd)             %(if [ ".%{?-p:yes}" = .yes ]; then \
  84.536 +                             %{l_rpm} -q %1 >/dev/null 2>&1; rc=$?; \
  84.537 +                         elif [ ".%{?-f:yes}" = .yes ]; then \
  84.538 +                             test -f %1; rc=$?; \
  84.539 +                         elif [ ".%{?-d:yes}" = .yes ]; then \
  84.540 +                             test -d %1; rc=$?; \
  84.541 +                         fi; \
  84.542 +                         if [ ".$rc" = .0 ]; then \
  84.543 +                             echo "yes"; \
  84.544 +                         else \
  84.545 +                             echo "no"; \
  84.546 +                         fi)
  84.547  
  84.548  #   sane build environment setup
  84.549 -%l_build_path            %(if [ -d %{l_prefix}/lib/openpkg/override ]; then echo "%{l_prefix}/lib/openpkg/override:"; fi)%{l_prefix}/bin:%{l_prefix}/sbin:@l_build_path@%(if [ -d %{l_prefix}/lib/openpkg/fallback ]; then echo ":%{l_prefix}/lib/openpkg/fallback"; fi)
  84.550 +%l_build_path            %{l_once l_build_path %(if [ -d %{l_prefix}/lib/openpkg/override ]; then \
  84.551 +                             echo "%{l_prefix}/lib/openpkg/override:"; \
  84.552 +                         fi)%{l_prefix}/bin:%{l_prefix}/sbin:@l_build_path@%(\
  84.553 +                         if [ -d %{l_prefix}/lib/openpkg/fallback ]; then \
  84.554 +                             echo ":%{l_prefix}/lib/openpkg/fallback"; \
  84.555 +                         fi)}
  84.556  %l_build_ldlp            %{l_prefix}/lib:@l_build_ldlp@
  84.557  %l_build_ulim            @l_build_ulim@
  84.558  %l_build_shell_cmd       %{l_prefix}/lib/openpkg/bash
  84.559  %l_build_shell_opt       --norc --noprofile --posix
  84.560  
  84.561  #   sane build environment for manual usage in macros (currently just $PATH)
  84.562 -%l_sane_env              PATH="%{l_build_path}"; export PATH; LD_LIBRARY_PATH="%{l_build_ldlp}"; export LD_LIBRARY_PATH
  84.563 +%l_sane_env              PATH="%{l_build_path}"; \
  84.564 +                         export PATH; \
  84.565 +                         LD_LIBRARY_PATH="%{l_build_ldlp}"; \
  84.566 +                         export LD_LIBRARY_PATH
  84.567  
  84.568  #   sane build environment for %prep/%build/%install
  84.569  %_buildshell             env -i %{l_build_shell_cmd} %{l_build_shell_opt}
  84.570 -%___build_pre \
  84.571 -HOME="%{l_prefix}"\
  84.572 -SHELL="%{l_build_shell_cmd}"\
  84.573 -TERM="%(echo $TERM)"\
  84.574 -TMPDIR="%{_tmppath}"\
  84.575 -USER="%(echo $USER)"\
  84.576 -LOGNAME="%(echo $LOGNAME)"\
  84.577 -PATH="%{l_build_path}"\
  84.578 -LD_LIBRARY_PATH="%{l_build_ldlp}"\
  84.579 -export HOME SHELL TMPDIR USER LOGNAME PATH LD_LIBRARY_PATH\
  84.580 -RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
  84.581 -RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
  84.582 -RPM_OPT_FLAGS=\"%{optflags}\"\
  84.583 -RPM_ARCH=\"%{l_host_arch}\"\
  84.584 -RPM_OS=\"%{l_host_os}\"\
  84.585 -RPM_DOC_DIR=\"%{_docdir}\"\
  84.586 -RPM_PACKAGE_NAME=\"%{name}\"\
  84.587 -RPM_PACKAGE_VERSION=\"%{version}\"\
  84.588 -RPM_PACKAGE_RELEASE=\"%{release}\"\
  84.589 -export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS RPM_DOC_DIR\
  84.590 -export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
  84.591 -%{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
  84.592 -export RPM_BUILD_ROOT}\
  84.593 -%{l_build_ulim}\
  84.594 -umask 022\
  84.595 -%{verbose:set -x}%{!verbose:exec >/dev/null}\
  84.596 -cd %{u2p:%{_builddir}}
  84.597 +%___build_pre            HOME="%{l_prefix}"\
  84.598 +                         SHELL="%{l_build_shell_cmd}"\
  84.599 +                         TERM="%{getenv:TERM}"\
  84.600 +                         TMPDIR="%{_tmppath}"\
  84.601 +                         USER="%{getenv:USER}"\
  84.602 +                         LOGNAME="%{getenv:LOGNAME}"\
  84.603 +                         PATH="%{l_build_path}"\
  84.604 +                         LD_LIBRARY_PATH="%{l_build_ldlp}"\
  84.605 +                         export HOME SHELL TMPDIR USER LOGNAME PATH LD_LIBRARY_PATH\
  84.606 +                         RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
  84.607 +                         RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
  84.608 +                         RPM_OPT_FLAGS=\"%{optflags}\"\
  84.609 +                         RPM_ARCH=\"%{l_host_arch}\"\
  84.610 +                         RPM_OS=\"%{l_host_os}\"\
  84.611 +                         RPM_DOC_DIR=\"%{_docdir}\"\
  84.612 +                         RPM_PACKAGE_NAME=\"%{name}\"\
  84.613 +                         RPM_PACKAGE_VERSION=\"%{version}\"\
  84.614 +                         RPM_PACKAGE_RELEASE=\"%{release}\"\
  84.615 +                         export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS RPM_DOC_DIR\
  84.616 +                         export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
  84.617 +                         %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
  84.618 +                         export RPM_BUILD_ROOT}\
  84.619 +                         %{l_build_ulim}\
  84.620 +                         umask 022\
  84.621 +                         %{verbose:set -x}%{!verbose:exec >/dev/null}\
  84.622 +                         cd %{u2p:%{_builddir}}
  84.623 +
  84.624 +#   improved %patch macro
  84.625 +%patch(b:p:P:REz:F:d:e:m:) %{lua: \
  84.626 +    local subst = "" \
  84.627 +    local options = rpm.expand("%**") \
  84.628 +    local regex = "-e\\\\s*('[^']*'|\\"[^\\"]*\\"|\\\\S+)" \
  84.629 +    local pcre = rex_pcre.new(regex) \
  84.630 +    local n = 0 \
  84.631 +    while true do \
  84.632 +        local s, e, t = pcre:tfind(options, n) \
  84.633 +        if s == nil then break end \
  84.634 +        subst = subst .. " -e " .. t[1] \
  84.635 +        n = e + 1 \
  84.636 +    end \
  84.637 +    local regex = "-m\\\\s*('[^']*'|\\"[^\\"]*\\"|\\\\S+)" \
  84.638 +    local pcre = rex_pcre.new(regex) \
  84.639 +    local n = 0 \
  84.640 +    while true do \
  84.641 +        local s, e, t = pcre:tfind(options, n) \
  84.642 +        if s == nil then break end \
  84.643 +        subst = subst .. " -e 's;@" .. t[1] .. "@;%{" .. t[1] .. "};g'" \
  84.644 +        n = e + 1 \
  84.645 +    end \
  84.646 +    if subst ~= "" then \
  84.647 +        subst = "| sed" .. subst \
  84.648 +        rpm.define("__patch_subst " .. subst) \
  84.649 +    else \
  84.650 +        rpm.define("__patch_subst %{nil}") \
  84.651 +    end \
  84.652 +}%{shrink: \
  84.653 +%define __patch_number  %{-P:%{-P*}}%{!-P:0} \
  84.654 +%define __patch_file    %{P:%{__patch_number}} \
  84.655 +%define __patch_suffix  %{-b:-b --suffix %{-b*}}%{!-b:-b --suffix .orig} %{-z:--suffix %{-z*}} \
  84.656 +%define __patch_options -s %{-p:-p%{-p*}} %{-F:-F%{-F*}} %{-d:-d%{-d*}} %{-R} %{-E} %{__patch_suffix} \
  84.657 +echo "Patch #%{__patch_number} (%{basename:%{__patch_file}}):"; \
  84.658 +%{uncompress:%{__patch_file}} %{__patch_subst} | %{__patch} %{__patch_options}}\
  84.659 +%{nil}
  84.660  
  84.661  #   special %track section support
  84.662 -%__spec_track_template VCFILE="%{_tmppath}/%{name}-%{version}-%{release}.vc"\
  84.663 +%__spec_track_pre\
  84.664 +VCFILE="%{_tmppath}/%{name}-%{version}-%{release}.track.vc"\
  84.665  rm -f $VCFILE\
  84.666  set -o noclobber\
  84.667  sed -e 's;^ *#.*$;;' -e 's;^    ;;' >$VCFILE <<'EOF'\
  84.668 @@ -434,12 +650,81 @@
  84.669      ( echo "config = {"\
  84.670        echo "}"\
  84.671      ) >>$VCFILE\
  84.672 -    %{l_vcheck} -v -f $VCFILE || true\
  84.673 +    %{l_vcheck} %{verbose:--verbose}%{!verbose:--noverbose} -f $VCFILE || true\
  84.674  fi\
  84.675  rm -f $VCFILE\
  84.676  %{nil}
  84.677  
  84.678 -#   automatically include never changing RPM header text
  84.679 +#   support additional .spec tags
  84.680 +%_arbitrary_tags                   Class:Track:TrackProg:BuildDependency:BuildEnvironment:My*:Local*
  84.681 +
  84.682 +#   disable /bin/sh dependency (which doesn't fit into OpenPKG's environment)
  84.683 +%_disable_shell_interpreter_deps   1
  84.684 +
  84.685 +#   support downloading files via cURL (instead of internal RPMIO)
  84.686 +#   and optionally also from global and local mirror and backup location(s)
  84.687 +%__urlgetfile_urls_mirror() \
  84.688 +    %{nil}
  84.689 +%__urlgetfile_urls_backup() %{lua: \
  84.690 +    local url = rpm.expand("%1") \
  84.691 +    local name = rpm.expand("%{name}") \
  84.692 +    if name ~= "" and url ~= "" then \
  84.693 +        local cache = "http://download.openpkg.org/components/cache/" .. name .. "/" \
  84.694 +        url = util.rsubst(url, "^.+/([^/]+)$", cache .. "%1") \
  84.695 +        print(url) \
  84.696 +    end \
  84.697 +}
  84.698 +%__urlgetfile_urls() \
  84.699 +    %{?__urlgetfile_urls_mirror %1} %1 %{?__urlgetfile_urls_backup %1}
  84.700 +%__urlgetfile() %{lua: \
  84.701 +    local url_orig = rpm.expand("%1") \
  84.702 +    local file = rpm.expand("%2") \
  84.703 +    local urls = util.rsplit(rpm.expand("%{?__urlgetfile_urls " .. url_orig .. "}"), "\\\\s+") \
  84.704 +    local result = "ERROR" \
  84.705 +    local type = "mirror" \
  84.706 +    for i, url in ipairs(urls) do \
  84.707 +        if url ~= "" then
  84.708 +            if url == url_orig then \
  84.709 +                type = "original" \
  84.710 +            elseif type == "original" then \
  84.711 +                type = "backup" \
  84.712 +            end \
  84.713 +            io.stdout:write(string.format("Fetching(%s): %s\\n", type, url)) \
  84.714 +            local rc = rpm.expand( \
  84.715 +                "%(%{l_prefix}/bin/openpkg curl '-#' -L -R -k " .. \
  84.716 +                "-o '" .. file .. "'" .. " '" .. url .. "' 1>&2; echo $?)" \
  84.717 +            ) \
  84.718 +            if rc == "0" then \
  84.719 +                result = "OK" \
  84.720 +                break \
  84.721 +            end \
  84.722 +        end
  84.723 +    end \
  84.724 +    print(result) \
  84.725 +}
  84.726 +
  84.727 +#   increase size of line buffer for .spec file parsing
  84.728 +#   from 10KB to 4MB to support rather large BuildEnvironment tags
  84.729 +%_spec_line_buffer_size  4000000
  84.730 +
  84.731 +#   configure auto-generation of OpenPKG "BuildDependency" and "BuildEnvironment" tags
  84.732 +%__autogen_builddependency  0
  84.733 +%__autogen_buildenvironment 0
  84.734 +
  84.735 +#   hook into %description
  84.736 +%description\
  84.737 +%{?__hook_description_1}\
  84.738 +%{?__hook_description_2}\
  84.739 +%{?__hook_description_3}\
  84.740 +%{?__hook_description_4}\
  84.741 +%{?__hook_description_5}\
  84.742 +%{?__hook_description_6}\
  84.743 +%{?__hook_description_7}\
  84.744 +%{?__hook_description_8}\
  84.745 +%{?__hook_description_9}\
  84.746 +%%description
  84.747 +
  84.748 +#   magically provide additional tags which are required but are always the same
  84.749  %__hook_description_1 %{lua: \
  84.750      local prefix = rpm.expand("%{l_prefix_static}") \
  84.751      if rpm.expand("%{?prefix}") ~= prefix then \
  84.752 @@ -449,3 +734,254 @@
  84.753      print("AutoReqProv: no\\n") \
  84.754  }
  84.755  
  84.756 +#   auto-generate arbitrary tag "Marker" (via "rpm --marker <marker>")
  84.757 +%__hook_description_2 %{?__marker:Marker: %{__marker}}\
  84.758 +%{nil}
  84.759 +
  84.760 +#   auto-generate arbitrary tag "BuildDependency" from the standard tag(s) "BuildPreReq"
  84.761 +#   in order to forward-carry this build-time information to the binary RPM and to the RPMDB.
  84.762 +%__hook_description_3 %{?__autogen_builddependency:%{?buildprereq:BuildDependency: %{@buildprereq:, }}}\
  84.763 +%{nil}
  84.764 +
  84.765 +#   magically pickup all patched packaging source files (.orig/.rej)
  84.766 +%__hook_description_4 %{lua: \
  84.767 +    --  assemble RPM's information about SourceN and PatchN \
  84.768 +    local sources = {} \
  84.769 +    local macros = rpm.macros() \
  84.770 +    for name, value in pairs(macros) do \
  84.771 +        local s, _, m = util.rmatch(name, "^(?i)(SOURCE|PATCH)((?:URL)?)(\\\\d+)$") \
  84.772 +        if s ~= nil and value["body"] ~= nil then \
  84.773 +            local n = string.upper(string.sub(m[1], 1, 1)) .. string.lower(string.sub(m[1], 2)) .. m[3] \
  84.774 +            if sources[n] == nil then \
  84.775 +                sources[n] = { url = "", file = "" } \
  84.776 +            end \
  84.777 +            if m[2] ~= nil and m[2] ~= "" then \
  84.778 +                sources[n].url = value["body"] \
  84.779 +            else \
  84.780 +                sources[n].file = value["body"] \
  84.781 +            end \
  84.782 +        end \
  84.783 +    end \
  84.784 +    \
  84.785 +    --  add implicit .spec source file \
  84.786 +    sources["Source999"] = { \
  84.787 +        url  = rpm.expand("%{name}.spec"), \
  84.788 +        file = rpm.expand("%{_specdir}/%{name}.spec") \
  84.789 +    } \
  84.790 +    \
  84.791 +    --  auto-generate tags for local SourceN and PatchN files \
  84.792 +    --  where any corresponding .orig/.rej files exists \
  84.793 +    for id, s in pairs(sources) do \
  84.794 +        if util.rmatch(s.url, "^(?:ftp|https?)://.+") == nil then \
  84.795 +            for i, ext in ipairs({ ".orig", ".rej" }) do \
  84.796 +                if posix.access(s.file .. ext, "r") == 0 then \
  84.797 +                    local _, _, m = util.rmatch(id, "^(?i)(Source|Patch)(\\\\d+)$") \
  84.798 +                    local tag = string.format("%s%d: %s\\n", m[1], 10000 * i + m[2], s.url .. ext) \
  84.799 +                    print(tag) \
  84.800 +                end \
  84.801 +            end \
  84.802 +        end \
  84.803 +    end \
  84.804 +}
  84.805 +
  84.806 +#   recursive package environment tracking configuration
  84.807 +%__environment_delete_nve_regex    ^gpg-pubkey-[^-]+-[^-]+$
  84.808 +%__environment_prune_nve_regex     ^%{name}-[^-]+-[^-]+$
  84.809 +%__environment_prune_depth_number  3
  84.810 +%__environment_debug               0
  84.811 +
  84.812 +#   recursive package environment implementation
  84.813 +%__hook_description_5 %{nil}
  84.814 +%__hook_description_5_orig %{?__autogen_buildenvironment:%{lua: \
  84.815 +    --  determine current debug status quo
  84.816 +    local debug = tonumber(rpm.expand("%{?__environment_debug}%{!?__environment_debug:0}")) \
  84.817 +    \
  84.818 +    --  determine current environment in serialized format \
  84.819 +    --  (which actually is the Lua table constructor syntax) \
  84.820 +    local result = {} \
  84.821 +    for _, line in ipairs(rpm.query( \
  84.822 +        "Q:\\\\[\\"%{name}-%{version}-%{release}\\"\\\\]=" .. \
  84.823 +        "%|buildenvironment?{%{buildenvironment}}:{\\\\{\\\\}}|,", \
  84.824 +        true, "*")) do \
  84.825 +        local s, _, m = util.rmatch(line, "(?s)^Q:(.+)$") \
  84.826 +        if s ~= nil then \
  84.827 +            table.insert(result, m[1]) \
  84.828 +        end \
  84.829 +    end \
  84.830 +    local constructor = "{" .. table.concat(result , "") .. "}" \
  84.831 +    \
  84.832 +    --  parse current environment \
  84.833 +    --  (by evaluating the constructor as a Lua script) \
  84.834 +    local environment = {} \
  84.835 +    local f = loadstring("return " .. constructor) \
  84.836 +    if f ~= nil then \
  84.837 +        environment = f() \
  84.838 +    else \
  84.839 +        io.stderr:write("rpm: WARNING: failed to parse Lua table constructor: " .. constructor .. "\\n") \
  84.840 +    end \
  84.841 +    if debug > 0 then \
  84.842 +        io.stdout:write("BuildEnvironment(original): " .. util.dump_object(environment, false) .. "\\n") \
  84.843 +    end
  84.844 +    \
  84.845 +    --  prune environment according to configuration \
  84.846 +    function prune_environment (environment, depth) \
  84.847 +        local delete_nve_regex   = tostring(rpm.expand("%{?__environment_delete_nve_regex}")) \
  84.848 +        local prune_nve_regex    = tostring(rpm.expand("%{?__environment_prune_nve_regex}")) \
  84.849 +        local prune_depth_number = tonumber(rpm.expand("%{?__environment_prune_depth_number}")) \
  84.850 +        if type(environment) == "table" then \
  84.851 +            for nve, _ in pairs(environment) do \
  84.852 +                if (prune_depth_number ~= nil and prune_depth_number > 0 and depth > prune_depth_number) or \
  84.853 +                   (delete_nve_regex ~= "" and util.rmatch(nve, delete_nve_regex) ~= nil) then \
  84.854 +                    environment[nve] = nil \
  84.855 +                elseif prune_nve_regex ~= nil and util.rmatch(nve, prune_nve_regex) ~= nil then \
  84.856 +                    environment[nve] = {} \
  84.857 +                else \
  84.858 +                    prune_environment(environment[nve], depth + 1) \
  84.859 +                end \
  84.860 +            end \
  84.861 +        end \
  84.862 +    end \
  84.863 +    prune_environment(environment, 1) \
  84.864 +    if debug > 0 then \
  84.865 +        io.stdout:write("BuildEnvironment(pruned): " .. util.dump_object(environment, false) .. "\\n") \
  84.866 +    end \
  84.867 +    \
  84.868 +    --  export serialized environment as an RPM tag \
  84.869 +    if type(environment) == "table" then \
  84.870 +        local tag = "BuildEnvironment: " .. util.dump_object(environment, true) .. "\\n" \
  84.871 +        print(tag) \
  84.872 +        if debug > 0 then \
  84.873 +            io.stdout:write(tag) \
  84.874 +        end \
  84.875 +    end \
  84.876 +}}
  84.877 +
  84.878 +#   recursive package environment XML query support
  84.879 +%__environment_to_xml %{lua: \
  84.880 +    local lua = io.stdin:read("*all") \
  84.881 +    local f = loadstring("return " .. lua) \
  84.882 +    local xml = ""
  84.883 +    if f ~= nil then \
  84.884 +        xml = xml .. "<?xml version=\\"1.0\\" encoding=\\"ISO-8859-1\\" standalone=\\"no\\"?>\\n" \
  84.885 +        xml = xml .. "<!DOCTYPE environment\\n" \
  84.886 +        xml = xml .. "  PUBLIC \\"-//rpm5.org//DTD BuildEnvironment 1.0//EN\\"\\n" \
  84.887 +        xml = xml .. "  \\"http://rpm5.org/dtd/environment-1.0.dtd\\">\\n" \
  84.888 +        function genxml (environment, prefix) \
  84.889 +            local xml = prefix .. "<environment>\\n" \
  84.890 +            for id, e in pairs(environment) do \
  84.891 +                xml = xml .. prefix .. "  <package>\\n" \
  84.892 +                xml = xml .. prefix .. "    <id>" .. id .. "</id>\\n" \
  84.893 +                if e ~= nil and next(e) ~= nil then \
  84.894 +                    xml = xml .. genxml(e, prefix .. "    ") \
  84.895 +                end \
  84.896 +                xml = xml .. prefix .. "  </package>\\n" \
  84.897 +            end \
  84.898 +            xml = xml .. prefix .. "</environment>\\n" \
  84.899 +            return xml
  84.900 +        end \
  84.901 +        local environment = f() \
  84.902 +        xml = xml .. genxml(environment, "") \
  84.903 +    end \
  84.904 +    print(xml)
  84.905 +}
  84.906 +
  84.907 +#   PGP public key information
  84.908 +%l_pgpkey(n:F:) %{lua: \
  84.909 +    local name   = rpm.expand("%{?-n:%{-n*}}%{!?-n:openpkg.org}") \
  84.910 +    local format = rpm.expand("%{?-F:%{-F*}}%{!?-F:%%f:%%i}") \
  84.911 +    local fn = "?" \
  84.912 +    local id = "?" \
  84.913 +    if name == "openpkg.com" then \
  84.914 +        fn = rpm.expand("%{l_prefix}/etc/openpkg/openpkg.com.pgp") \
  84.915 +        id = "7D121A8FC05DC18A4329E9EF67042EC961B7AE34" \
  84.916 +    elseif name == "openpkg.net" then \
  84.917 +        fn = rpm.expand("%{l_prefix}/etc/openpkg/openpkg.net.pgp") \
  84.918 +        id = "3BD10E1171B22598D7708C48AEBE764552197903" \
  84.919 +    elseif name == "openpkg.org" then \
  84.920 +        fn = rpm.expand("%{l_prefix}/etc/openpkg/openpkg.org.pgp") \
  84.921 +        id = "6D96EFCFCF75328810DB40C2807593E063C4CB9F" \
  84.922 +    end \
  84.923 +    local result = util.rsubst(format, "%([nfi])", { ["n"] = name, ["f"] = fn, ["i"] = id }) \
  84.924 +    print(result) \
  84.925 +}
  84.926 +
  84.927 +#   integrity checking configuration
  84.928 +%_integrity_spec_cfg_idx %{l_prefix}/etc/openpkg/license
  84.929 +%_integrity_spec_cfg_dir %{l_prefix}/etc/openpkg/license.d
  84.930 +%_integrity_spec_cfg  %{lua: \
  84.931 +    local idx = rpm.slurp(rpm.expand("%{_integrity_spec_cfg_idx}")) \
  84.932 +    idx = util.rsubst(idx, "(?s)\\\\s*(.+?)\\\\s*$", "%1") \
  84.933 +    local cfg = rpm.expand("%{_integrity_spec_cfg_dir}") .. "/" .. idx \
  84.934 +    print(cfg) \
  84.935 +}
  84.936 +%_integrity_proc_lua  %{l_prefix}/lib/openpkg/license.lua
  84.937 +%_integrity_pkey_pgp  %{l_prefix}/etc/openpkg/openpkg.com.pgp
  84.938 +
  84.939 +##
  84.940 +##  Support for OpenPKG Flexible Filesystem Layout
  84.941 +##
  84.942 +
  84.943 +#   layout definition: RPM to OpenPKG variable mapping
  84.944 +%_specdir     %{expand:%%global _specdir   %%{__openpkg_layout variable=specdir   %{?openpkg_layout_specdir}  %{!?openpkg_layout_specdir:  %{openpkg_layout}}}}%{_specdir}
  84.945 +%_sourcedir   %{expand:%%global _sourcedir %%{__openpkg_layout variable=sourcedir %{?openpkg_layout_sourcedir}%{!?openpkg_layout_sourcedir:%{openpkg_layout}}}}%{_sourcedir}
  84.946 +%_builddir    %{expand:%%global _builddir  %%{__openpkg_layout variable=builddir  %{?openpkg_layout_builddir} %{!?openpkg_layout_builddir: %{openpkg_layout}}}}%{_builddir}
  84.947 +%_tmppath     %{expand:%%global _tmppath   %%{__openpkg_layout variable=tmppath   %{?openpkg_layout_tmppath}  %{!?openpkg_layout_tmppath:  %{openpkg_layout}}}}%{_tmppath}
  84.948 +%_rpmdir      %{expand:%%global _rpmdir    %%{__openpkg_layout variable=rpmdir    %{?openpkg_layout_rpmdir}   %{!?openpkg_layout_rpmdir:   %{openpkg_layout}}}}%{_rpmdir}
  84.949 +%_srcrpmdir   %{expand:%%global _srcrpmdir %%{__openpkg_layout variable=srcrpmdir %{?openpkg_layout_srcrpmdir}%{!?openpkg_layout_srcrpmdir:%{openpkg_layout}}}}%{_srcrpmdir}
  84.950 +
  84.951 +#   default OpenPKG filesystem layout
  84.952 +%openpkg_layout       macrosfile=%{macrosfile} layout=global
  84.953 +
  84.954 +#   layout determination: RPM macro to RPM Lua entry point
  84.955 +%__openpkg_layout()   %{lua: print(openpkg.layout(rpm.expand("%*"))) }
  84.956 +
  84.957 +#   calculated base directory (placeholder definition only)
  84.958 +%__openpkg_basedir    %{l_prefix}
  84.959 +
  84.960 +#   temporary path determination
  84.961 +%__openpkg_tmpdir     %{lua: print(openpkg.tmpdir()) }
  84.962 +
  84.963 +#   shared environment (SE) support
  84.964 +%__openpkg_SE_id      %{l_hostname}-%{l_platform}-%{l_tag}
  84.965 +%__openpkg_SE_subdir  %{?__openpkg_shared:/%{__openpkg_SE_id}}
  84.966 +
  84.967 +#   layout definition: GLOBAL filesystem layout
  84.968 +%__openpkg_layout_global_specdir()        %{l_prefix}/RPM/SRC/%{?name}
  84.969 +%__openpkg_layout_global_sourcedir()      %{l_prefix}/RPM/SRC/%{?name}
  84.970 +%__openpkg_layout_global_builddir()       %{l_prefix}/RPM/TMP
  84.971 +%__openpkg_layout_global_tmppath()        %{l_prefix}/RPM/TMP
  84.972 +%__openpkg_layout_global_rpmdir()         %{l_prefix}/RPM/PKG
  84.973 +%__openpkg_layout_global_srcrpmdir()      %{l_prefix}/RPM/PKG
  84.974 +
  84.975 +#   layout definition: LOCAL filesystem layout
  84.976 +%__openpkg_layout_local_specdir()         %{__openpkg_basedir}
  84.977 +%__openpkg_layout_local_sourcedir()       %{__openpkg_basedir}
  84.978 +%__openpkg_layout_local_builddir()        %{__openpkg_basedir}/.openpkg-tmp:+%{__openpkg_SE_subdir}
  84.979 +%__openpkg_layout_local_tmppath()         %{__openpkg_basedir}/.openpkg-tmp:+%{__openpkg_SE_subdir}
  84.980 +%__openpkg_layout_local_rpmdir()          %{__openpkg_basedir}
  84.981 +%__openpkg_layout_local_srcrpmdir()       %{__openpkg_basedir}
  84.982 +
  84.983 +#   layout definition: SIMPLE local filesystem layout
  84.984 +%__openpkg_layout_simple_specdir()        %{__openpkg_basedir}
  84.985 +%__openpkg_layout_simple_sourcedir()      %{__openpkg_basedir}
  84.986 +%__openpkg_layout_simple_builddir()       %{__openpkg_tmpdir}:+%{__openpkg_SE_subdir}
  84.987 +%__openpkg_layout_simple_tmppath()        %{__openpkg_tmpdir}:+%{__openpkg_SE_subdir}
  84.988 +%__openpkg_layout_simple_rpmdir()         %{realpath:%{__openpkg_basedir}/..}
  84.989 +%__openpkg_layout_simple_srcrpmdir()      %{realpath:%{__openpkg_basedir}/..}
  84.990 +
  84.991 +#   layout definition: STRUCTURED local filesystem layout
  84.992 +%__openpkg_layout_structured_specdir()    %{__openpkg_basedir}/src
  84.993 +%__openpkg_layout_structured_sourcedir()  %{__openpkg_basedir}/dst %{__openpkg_basedir}/src
  84.994 +%__openpkg_layout_structured_builddir()   %{__openpkg_basedir}/tmp:+%{__openpkg_SE_subdir} %{__openpkg_tmpdir}:+%{__openpkg_SE_subdir}
  84.995 +%__openpkg_layout_structured_tmppath()    %{__openpkg_basedir}/tmp:+%{__openpkg_SE_subdir} %{__openpkg_tmpdir}:+%{__openpkg_SE_subdir}
  84.996 +%__openpkg_layout_structured_rpmdir()     %{__openpkg_basedir}/pkg/bin %{__openpkg_basedir}/pkg %{__openpkg_basedir}
  84.997 +%__openpkg_layout_structured_srcrpmdir()  %{__openpkg_basedir}/pkg/src %{__openpkg_basedir}/pkg %{__openpkg_basedir}
  84.998 +
  84.999 +#   layout definition: DISTRIBUTED local filesystem layout
 84.1000 +%__openpkg_layout_distributed_specdir()   %{__openpkg_basedir}/src/%{?name}
 84.1001 +%__openpkg_layout_distributed_sourcedir() %{__openpkg_basedir}/dst/%{?name} %{__openpkg_basedir}/src/%{?name}
 84.1002 +%__openpkg_layout_distributed_builddir()  %{__openpkg_basedir}/tmp:+%{__openpkg_SE_subdir} %{__openpkg_tmpdir}:+%{__openpkg_SE_subdir}
 84.1003 +%__openpkg_layout_distributed_tmppath()   %{__openpkg_basedir}/tmp:+%{__openpkg_SE_subdir} %{__openpkg_tmpdir}:+%{__openpkg_SE_subdir}
 84.1004 +%__openpkg_layout_distributed_rpmdir()    %{__openpkg_basedir}/pkg/bin %{__openpkg_basedir}/pkg %{__openpkg_basedir}
 84.1005 +%__openpkg_layout_distributed_srcrpmdir() %{__openpkg_basedir}/pkg/src %{__openpkg_basedir}/pkg %{__openpkg_basedir}
 84.1006 +
    85.1 --- a/openpkg/rpmpopt	Tue Jul 31 12:12:54 2012 +0200
    85.2 +++ b/openpkg/rpmpopt	Tue Jul 31 12:23:42 2012 +0200
    85.3 @@ -1,14 +1,13 @@
    85.4  ##
    85.5  ##  rpmpopt -- OpenPKG RPM POPT Configuration
    85.6 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    85.7 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    85.8 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    85.9  ##
   85.10 -##  Permission to use, copy, modify, and distribute this software for
   85.11 -##  any purpose with or without fee is hereby granted, provided that
   85.12 -##  the above copyright notice and this permission notice appear in all
   85.13 -##  copies.
   85.14 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   85.15 +##  All rights reserved. Licenses which grant limited permission to use,
   85.16 +##  copy, modify and distribute this software are available from the
   85.17 +##  OpenPKG GmbH.
   85.18  ##
   85.19 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   85.20 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   85.21  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   85.22  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   85.23  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   85.24 @@ -21,11 +20,17 @@
   85.25  ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   85.26  ##  SUCH DAMAGE.
   85.27  ##
   85.28 +
   85.29 +##
   85.30  ##  The purpose of this configuration file is to extend and override
   85.31  ##  the "rpmpopt" directives in the default RPM POPT configuration with
   85.32  ##  OpenPKG specific extensions and adjustments.
   85.33  ##
   85.34  
   85.35 +#   extended short-hand option
   85.36 +rpm alias --force --replacepkgs --replacefiles --oldpackage --noparentdirs \
   85.37 +    --POPTdesc=$"force operation (short hand for --replacepkgs --replacefiles --oldpackage --noparentdirs on installation)"
   85.38 +
   85.39  #   backward compatibility for old RPM extensions
   85.40  rpm exec --stowaway  echo "install \"openpkg-tools\" and use \"openpkg stowaway\" now please."
   85.41  rpm exec --makeproxy echo "install \"openpkg-tools\" and use \"openpkg makeproxy\" now please."
   85.42 @@ -58,6 +63,8 @@
   85.43  #   RPM extension: "rpm --db-{build,rebuild,cleanup,fixate}"
   85.44  rpm exec --db-build   rpmdb --build \
   85.45      --POPTdesc=$"RPM database administration: build new database (destructive operation; you have to know what you are doing)"
   85.46 +rpm exec --db-migrate rpmdb --migrate \
   85.47 +    --POPTdesc=$"RPM database administration: change database format (migration operation; you have to know what you are doing)"
   85.48  rpm exec --db-rebuild rpmdb --rebuild \
   85.49      --POPTdesc=$"RPM database administration: rebuild new from old database (upgrading operation; reasonable after upgrades or on DB corruption)"
   85.50  rpm exec --db-cleanup rpmdb --cleanup \
   85.51 @@ -66,7 +73,7 @@
   85.52      --POPTdesc=$"RPM database administration: fixate existing database (harmless operation; for fixating files only)"
   85.53  
   85.54  #   RPM extension: "rpm --db-private ..."
   85.55 -rpm alias --db-private --define "_rpmdb_private yes" \
   85.56 +rpm alias --db-private --define "__dbi_private yes" \
   85.57      --POPTdesc=$"operate RPM database in Berkeley-DB DB_PRIVATE mode"
   85.58  
   85.59  #   RPM extension: "rpm --track"
   85.60 @@ -77,8 +84,8 @@
   85.61  rpm alias --track-dump -bt --define '___track_dump yes' \
   85.62      --POPTdesc=$"dump the vendor source tracking script (%track)"
   85.63  
   85.64 -#   RPM extension: "rpm --test"
   85.65 -rpm alias --test -q --qf '%{TEST}\n' \
   85.66 +#   RPM extension: "rpm --runtime-test"
   85.67 +rpm alias --runtime-test -q --qf '%{TEST}\n' \
   85.68      --pipe "grep -v \(none\) | @l_prefix@/lib/openpkg/bash" \
   85.69      --POPTdesc=$"run package run-time test script (%test)"
   85.70  
   85.71 @@ -91,11 +98,39 @@
   85.72  #   RPM adjustment: "rpm --setugids ..."
   85.73  rpm alias --setugids -q --qf \
   85.74      '[run %{FILEUSERNAME:shescape} %{FILEGROUPNAME:shescape} %{FILENAMES:shescape}\n]' \
   85.75 -    --pipe "(echo 'run () { chown -- \"$1\" \"$3\"; chgrp -- \"$2\" \"$3\"; }'; grep -v '(none)') | @l_prefix@/lib/openpkg/bash" \
   85.76 +    --pipe "(echo 'run () { chown -h -- \"$1\" \"$3\"; chgrp -h -- \"$2\" \"$3\"; }'; grep -v '(none)') | @l_prefix@/lib/openpkg/bash" \
   85.77      --POPTdesc=$"set user/group ownership of files in a package"
   85.78  
   85.79 +#   RPM extension: "rpm -qp --environment"
   85.80 +rpm alias --environment --qf '%{Environment}\n' \
   85.81 +    --pipe "@l_prefix@/lib/openpkg/rpm --eval '%{__environment_to_xml}'" \
   85.82 +    --POPTdesc=$"query the recursively tracked build environment of a package as XML"
   85.83 +
   85.84 +#   RPM extension: "rpm --marker <marker>"
   85.85 +rpm alias --mark --define "__marker !#:+" \
   85.86 +    --POPTdesc=$"mark package with Marker: <marker>" \
   85.87 +    --POPTargs=$"<marker>"
   85.88 +
   85.89 +#   RPM adjustment: "rpm -bs" implies "--nodeps"
   85.90 +rpm alias -bs -bs --nodeps
   85.91 +
   85.92 +#   RPM exentsion: "rpm --no-build{dependency,environment}"
   85.93 +rpm alias --no-builddependency --undefine "__autogen_builddependency" \
   85.94 +    --POPTdesc=$"do not auto-generate BuildDependency tag"
   85.95 +rpm alias --no-buildenvironment --undefine "__autogen_buildenvironment" \
   85.96 +    --POPTdesc=$"do not auto-generate BuildEnvironment tag"
   85.97 +
   85.98 +#   RPM extension: "rpm --layout <layout>"
   85.99 +rpm alias --layout --define "openpkg_layout basedir=%(pwd) layout=!#:+" \
  85.100 +    --POPTdesc=$"choose a particular packaging environment layout (global, local, simple, structured, distributed)" \
  85.101 +    --POPTargs=$"<layout>"
  85.102 +
  85.103 +#   RPM extension: "rpm --local"
  85.104 +rpm alias --local --define "openpkg_layout basedir=%(pwd) layout=local" \
  85.105 +    --POPTdesc=$"choose the 'local' packaging environment layout based on current directory as the base directory"
  85.106 +
  85.107  #   RPM adjustment: improved and cleaned up "rpm -i/--info"
  85.108 -rpmq alias --info --qf '\
  85.109 +rpm alias --info --qf '\
  85.110  Name:     %-25{NAME} Source RPM:   %{SOURCERPM}\n\
  85.111  Version:  %-25{VERSION} Signature:    %|DSAHEADER?{dsa:%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{rsa:%{RSAHEADER:pgpsig}}:{%|SIGGPG?{gpg:%{SIGGPG:pgpsig}}:{%|SIGPGP?{pgp:%{SIGPGP:pgpsig}}:{%|SIGMD5?{md5:%{SIGMD5}}:{(none)}|}|}|}|}|\n\
  85.112  Release:  %-25{RELEASE} Build Host:   %{BUILDHOST}\n\
  85.113 @@ -109,6 +144,12 @@
  85.114  URL:      %{URL}\n\
  85.115  Description:\n%{DESCRIPTION}\n\
  85.116  %|PROVIDENAME?{Provides:\n\
  85.117 -[    %{PROVIDENAME} %|PROVIDEFLAGS?{%{PROVIDEFLAGS:depflags} %{PROVIDEVERSION}}:{}|\n]}:{}|\
  85.118 +[    %{PROVIDENAME}%|PROVIDEFLAGS?{%{PROVIDEFLAGS:depflags}%{PROVIDEVERSION}}:{}|\n]}:{}|\
  85.119 +%|CONFLICTNAME?{Conflicts:\n\
  85.120 +[    %{CONFLICTNAME}%|CONFLICTFLAGS?{%{CONFLICTFLAGS:depflags}%{CONFLICTVERSION}}:{}|\n]}:{}|\
  85.121 +%|OBSOLETENAME?{Obsoletes:\n\
  85.122 +[    %{OBSOLETENAME}%|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags}%{OBSOLETEVERSION}}:{}|\n]}:{}|\
  85.123 +%|REQUIRENAME?{Requires:\n\
  85.124 +[    %{REQUIRENAME}%|REQUIREFLAGS?{%{REQUIREFLAGS:depflags}%{REQUIREVERSION}}:{}|\n]}:{}|\
  85.125  ' --POPTdesc=$"list descriptive information from package(s)"
  85.126  
    86.1 --- a/openpkg/rpmtool	Tue Jul 31 12:12:54 2012 +0200
    86.2 +++ b/openpkg/rpmtool	Tue Jul 31 12:23:42 2012 +0200
    86.3 @@ -1,15 +1,14 @@
    86.4  #!@l_prefix@/lib/openpkg/bash
    86.5  ##
    86.6  ##  rpmtool -- OpenPKG RPM Auxiliary Tool
    86.7 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    86.8 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    86.9 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
   86.10  ##
   86.11 -##  Permission to use, copy, modify, and distribute this software for
   86.12 -##  any purpose with or without fee is hereby granted, provided that
   86.13 -##  the above copyright notice and this permission notice appear in all
   86.14 -##  copies.
   86.15 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   86.16 +##  All rights reserved. Licenses which grant limited permission to use,
   86.17 +##  copy, modify and distribute this software are available from the
   86.18 +##  OpenPKG GmbH.
   86.19  ##
   86.20 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   86.21 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   86.22  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   86.23  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   86.24  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   86.25 @@ -35,7 +34,7 @@
   86.26  fi
   86.27  if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
   86.28      echo "This is $prog_name, version $prog_vers ($prog_date)"
   86.29 -    echo "Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>"
   86.30 +    echo "Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>"
   86.31      echo ''
   86.32      echo "Usage: $prog_name [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]"
   86.33      echo ''
   86.34 @@ -1088,6 +1087,8 @@
   86.35          if [ ".$opt_b" = .yes ]; then
   86.36              echo . | awk '{ printf("%c", 7); }'
   86.37          fi
   86.38 +
   86.39 +        #   determine title of message
   86.40          title=""
   86.41          case $opt_t in
   86.42              info   ) title="-------" ;;
   86.43 @@ -1114,30 +1115,30 @@
   86.44              PLUS )
   86.45                  echo "set +x"
   86.46                  ( echo "This OpenPKG package is of class PLUS."
   86.47 -                  echo "It is still in a QUALITY ASSURANCE state,"
   86.48 -                  echo "therefore it is NOT ready for careless use."
   86.49 +                  echo "This means it is still in extended QUALITY ASSURANCE state."
   86.50 +                  echo "Hence it is still NOT ready for careless use."
   86.51                    echo "Do not use it in critical production environments."
   86.52 -                  echo "This software might still be unstable at runtime."
   86.53 +                  echo "It might be still potentially unstable under run-time."
   86.54                  ) | sh $prog_path msg -r -t notice | sed -e 's;^;echo ";' -e 's;$;";'
   86.55                  echo "set -x"
   86.56                  ;;
   86.57              EVAL )
   86.58                  echo "set +x"
   86.59                  ( echo "This OpenPKG package is of class EVAL."
   86.60 -                  echo "It is still in a EVALUATION and QA state,"
   86.61 -                  echo "therefore it is NOT ready for general use."
   86.62 +                  echo "This means it is still in EVALUATION and QUALITY ASSURANCE state."
   86.63 +                  echo "Hence it is still NOT ready for general use."
   86.64                    echo "Do not use it in production environments."
   86.65 -                  echo "It might be unstable or incompletely packaged."
   86.66 +                  echo "It might be unstable under run-time or still incompletely packaged."
   86.67                  ) | sh $prog_path msg -r -t warn | sed -e 's;^;echo ";' -e 's;$;";'
   86.68                  echo "set -x"
   86.69                  ;;
   86.70              JUNK )
   86.71                  echo "set +x"
   86.72                  ( echo "This OpenPKG package is of class JUNK."
   86.73 -                  echo "It is still in DEVELOPMENT state,"
   86.74 -                  echo "therefore it is NOT ready to be used."
   86.75 +                  echo "This means it is still in DEVELOPMENT state."
   86.76 +                  echo "Hence it is still NOT ready even for general evaluation."
   86.77                    echo "Do not use it at all, except in development environments!"
   86.78 -                  echo "This software is either unstable or incompletely packaged."
   86.79 +                  echo "It is definitely unstable and incompletely packaged."
   86.80                  ) | sh $prog_path msg -r -t warn | sed -e 's;^;echo ";' -e 's;$;";'
   86.81                  echo "set -x"
   86.82                  ;;
    87.1 --- a/openpkg/rpmtool.8	Tue Jul 31 12:12:54 2012 +0200
    87.2 +++ b/openpkg/rpmtool.8	Tue Jul 31 12:23:42 2012 +0200
    87.3 @@ -1,15 +1,7 @@
    87.4 -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
    87.5 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
    87.6  .\"
    87.7  .\" Standard preamble:
    87.8  .\" ========================================================================
    87.9 -.de Sh \" Subsection heading
   87.10 -.br
   87.11 -.if t .Sp
   87.12 -.ne 5
   87.13 -.PP
   87.14 -\fB\\$1\fR
   87.15 -.PP
   87.16 -..
   87.17  .de Sp \" Vertical space (when we can't use .PP)
   87.18  .if t .sp .5v
   87.19  .if n .sp
   87.20 @@ -25,11 +17,11 @@
   87.21  ..
   87.22  .\" Set up some character translations and predefined strings.  \*(-- will
   87.23  .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   87.24 -.\" double quote, and \*(R" will give a right double quote.  | will give a
   87.25 -.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
   87.26 -.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
   87.27 -.\" expand to `' in nroff, nothing in troff, for use with C<>.
   87.28 -.tr \(*W-|\(bv\*(Tr
   87.29 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
   87.30 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
   87.31 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
   87.32 +.\" nothing in troff, for use with C<>.
   87.33 +.tr \(*W-
   87.34  .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   87.35  .ie n \{\
   87.36  .    ds -- \(*W-
   87.37 @@ -48,22 +40,25 @@
   87.38  .    ds R" ''
   87.39  'br\}
   87.40  .\"
   87.41 +.\" Escape single quotes in literal strings from groff's Unicode transform.
   87.42 +.ie \n(.g .ds Aq \(aq
   87.43 +.el       .ds Aq '
   87.44 +.\"
   87.45  .\" If the F register is turned on, we'll generate index entries on stderr for
   87.46 -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
   87.47 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
   87.48  .\" entries marked with X<> in POD.  Of course, you'll have to process the
   87.49  .\" output yourself in some meaningful fashion.
   87.50 -.if \nF \{\
   87.51 +.ie \nF \{\
   87.52  .    de IX
   87.53  .    tm Index:\\$1\t\\n%\t"\\$2"
   87.54  ..
   87.55  .    nr % 0
   87.56  .    rr F
   87.57  .\}
   87.58 -.\"
   87.59 -.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   87.60 -.\" way too many mistakes in technical documents.
   87.61 -.hy 0
   87.62 -.if n .na
   87.63 +.el \{\
   87.64 +.    de IX
   87.65 +..
   87.66 +.\}
   87.67  .\"
   87.68  .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   87.69  .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   87.70 @@ -130,8 +125,12 @@
   87.71  .\"
   87.72  .IX Title "RPMTOOL 8"
   87.73  .TH RPMTOOL 8 "OpenPKG" "RPMTOOL(8)" "OpenPKG"
   87.74 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   87.75 +.\" way too many mistakes in technical documents.
   87.76 +.if n .ad l
   87.77 +.nh
   87.78  .SH "NAME"
   87.79 -\&\fBrpmtool\fR \- RPM Auxiliary Tool
   87.80 +rpmtool \- RPM Auxiliary Tool
   87.81  .SH "SYNOPSIS"
   87.82  .IX Header "SYNOPSIS"
   87.83  \&\fBrpmtool\fR
   87.84 @@ -153,10 +152,10 @@
   87.85  Example:
   87.86  .Sp
   87.87  .Vb 5
   87.88 -\& case `rpmtool platform`; in
   87.89 -\&     *-freebsd[34].* ) ... ;;
   87.90 -\&     *-sunos5.[678]  ) ... ;;
   87.91 -\&     *-linux2.[24].* ) ... ;;
   87.92 +\& case \`rpmtool platform\`; in
   87.93 +\&     *\-freebsd[34].* ) ... ;;
   87.94 +\&     *\-sunos5.[678]  ) ... ;;
   87.95 +\&     *\-linux2.[24].* ) ... ;;
   87.96  \& esac
   87.97  .Ve
   87.98  .IP "\fBmflags\fR [\fB\-O\fR] \fItool\fR" 4
   87.99 @@ -170,7 +169,7 @@
  87.100  Example:
  87.101  .Sp
  87.102  .Vb 1
  87.103 -\& make `rpmtool mflags -O make`
  87.104 +\& make \`rpmtool mflags \-O make\`
  87.105  .Ve
  87.106  .IP "\fBcflags\fR [\fB\-O\fR] \fItool\fR" 4
  87.107  .IX Item "cflags [-O] tool"
  87.108 @@ -182,9 +181,9 @@
  87.109  Example:
  87.110  .Sp
  87.111  .Vb 1
  87.112 -\& CC="$CC" CFLAGS=`rpmtool cflags -O $CC` ./configure ...
  87.113 +\& CC="$CC" CFLAGS=\`rpmtool cflags \-O $CC\` ./configure ...
  87.114  .Ve
  87.115 -.ie n .IP "\fBcppflags\fR [\fB\-p\fR \fIprefix\fR] [[\*(C`+|\-\*(C'\fR\fIsubdir ...]" 4
  87.116 +.ie n .IP "\fBcppflags\fR [\fB\-p\fR \fIprefix\fR] [[\*(C`+|\-\*(C'\fIsubdir\fR ...]" 4
  87.117  .el .IP "\fBcppflags\fR [\fB\-p\fR \fIprefix\fR] [[\f(CW\*(C`+|\-\*(C'\fR\fIsubdir\fR ...]" 4
  87.118  .IX Item "cppflags [-p prefix] [[+|-subdir ...]"
  87.119  This command output \fIcpp\fR\|(1) \f(CW\*(C`\-I\*(C'\fR options for the OpenPKG instance
  87.120 @@ -196,9 +195,9 @@
  87.121  Example:
  87.122  .Sp
  87.123  .Vb 1
  87.124 -\& rpmtool cppflags -p /foo bar -baz +quux
  87.125 +\& rpmtool cppflags \-p /foo bar \-baz +quux
  87.126  .Ve
  87.127 -.ie n .IP "\fBldflags\fR [\fB\-p\fR \fIprefix\fR] [[\*(C`+|\-\*(C'\fR\fIsubdir ...]" 4
  87.128 +.ie n .IP "\fBldflags\fR [\fB\-p\fR \fIprefix\fR] [[\*(C`+|\-\*(C'\fIsubdir\fR ...]" 4
  87.129  .el .IP "\fBldflags\fR [\fB\-p\fR \fIprefix\fR] [[\f(CW\*(C`+|\-\*(C'\fR\fIsubdir\fR ...]" 4
  87.130  .IX Item "ldflags [-p prefix] [[+|-subdir ...]"
  87.131  This command output \fIld\fR\|(1) \f(CW\*(C`\-L\*(C'\fR options for the OpenPKG instance
  87.132 @@ -210,7 +209,7 @@
  87.133  Example:
  87.134  .Sp
  87.135  .Vb 1
  87.136 -\& rpmtool ldflags -p /foo bar -baz +quux
  87.137 +\& rpmtool ldflags \-p /foo bar \-baz +quux
  87.138  .Ve
  87.139  .IP "\fBfiles\fR [\fB\-v\fR] [\fB\-o\fR \fIoutfile\fR] [\fB\-r\fR \fIbuild-root\fR] [\fIentry\fR ...]" 4
  87.140  .IX Item "files [-v] [-o outfile] [-r build-root] [entry ...]"
  87.141 @@ -229,7 +228,7 @@
  87.142  .IX Item "Trailing Tags"
  87.143  \&\s-1RPM\s0 requires that all tags (like \f(CW\*(C`%attr(...)\*(C'\fR or \f(CW%dir\fR) preceed the
  87.144  path in a file list entry. This sometimes leads to ugly and unreadable
  87.145 -file lists, because all paths cannot be left\-aligned. With \fIrpmtool\fR\|(8)
  87.146 +file lists, because all paths cannot be left-aligned. With \fIrpmtool\fR\|(8)
  87.147  tags in the input file list can be at leading and trailing positions.
  87.148  The output file list will nevertheless have all tags in leading
  87.149  positions for \s-1RPM\s0.
  87.150 @@ -262,16 +261,14 @@
  87.151  .Vb 8
  87.152  \& %install
  87.153  \&   :
  87.154 -\& rpmtool files -o files -r$RPM_BUILD_ROOT \e
  87.155 -\&     '%defattr(-,foo,foo)' \e
  87.156 -\&     '%{prefix}' \e
  87.157 -\&     '%attr(1755,root,foo) %{prefix}/bin/bar' \e
  87.158 -\&     '%not %dir {%{prefix},%{prefix}/*,%{prefix}/man/*}' \e
  87.159 -\&     '%not %{prefix}/info/dir'
  87.160 -.Ve
  87.161 -.Sp
  87.162 -.Vb 1
  87.163 -\& %files -f files
  87.164 +\& rpmtool files \-o files \-r$RPM_BUILD_ROOT \e
  87.165 +\&     \*(Aq%defattr(\-,foo,foo)\*(Aq \e
  87.166 +\&     \*(Aq%{prefix}\*(Aq \e
  87.167 +\&     \*(Aq%attr(1755,root,foo) %{prefix}/bin/bar\*(Aq \e
  87.168 +\&     \*(Aq%not %dir {%{prefix},%{prefix}/*,%{prefix}/man/*}\*(Aq \e
  87.169 +\&     \*(Aq%not %{prefix}/info/dir\*(Aq
  87.170 +\&
  87.171 +\& %files \-f files
  87.172  .Ve
  87.173  .RE
  87.174  .IP "\fBmsg\fR [\fB\-b\fR]" 4
    88.1 --- a/openpkg/rpmtool.pod	Tue Jul 31 12:12:54 2012 +0200
    88.2 +++ b/openpkg/rpmtool.pod	Tue Jul 31 12:23:42 2012 +0200
    88.3 @@ -1,14 +1,14 @@
    88.4  ##
    88.5  ##  rpmtool.pod -- OpenPKG RPM Auxiliary Tool (Manual Page)
    88.6 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    88.7 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    88.8  ##
    88.9 -##  Permission to use, copy, modify, and distribute this software for
   88.10 -##  any purpose with or without fee is hereby granted, provided that
   88.11 -##  the above copyright notice and this permission notice appear in all
   88.12 -##  copies.
   88.13 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
   88.14  ##
   88.15 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   88.16 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   88.17 +##  All rights reserved. Licenses which grant limited permission to use,
   88.18 +##  copy, modify and distribute this software are available from the
   88.19 +##  OpenPKG GmbH.
   88.20 +##
   88.21 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   88.22  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   88.23  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   88.24  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    89.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.2 +++ b/openpkg/sea.8	Tue Jul 31 12:23:42 2012 +0200
    89.3 @@ -0,0 +1,177 @@
    89.4 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
    89.5 +.\"
    89.6 +.\" Standard preamble:
    89.7 +.\" ========================================================================
    89.8 +.de Sp \" Vertical space (when we can't use .PP)
    89.9 +.if t .sp .5v
   89.10 +.if n .sp
   89.11 +..
   89.12 +.de Vb \" Begin verbatim text
   89.13 +.ft CW
   89.14 +.nf
   89.15 +.ne \\$1
   89.16 +..
   89.17 +.de Ve \" End verbatim text
   89.18 +.ft R
   89.19 +.fi
   89.20 +..
   89.21 +.\" Set up some character translations and predefined strings.  \*(-- will
   89.22 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   89.23 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
   89.24 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
   89.25 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
   89.26 +.\" nothing in troff, for use with C<>.
   89.27 +.tr \(*W-
   89.28 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   89.29 +.ie n \{\
   89.30 +.    ds -- \(*W-
   89.31 +.    ds PI pi
   89.32 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   89.33 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   89.34 +.    ds L" ""
   89.35 +.    ds R" ""
   89.36 +.    ds C` 
   89.37 +.    ds C' 
   89.38 +'br\}
   89.39 +.el\{\
   89.40 +.    ds -- \|\(em\|
   89.41 +.    ds PI \(*p
   89.42 +.    ds L" ``
   89.43 +.    ds R" ''
   89.44 +'br\}
   89.45 +.\"
   89.46 +.\" Escape single quotes in literal strings from groff's Unicode transform.
   89.47 +.ie \n(.g .ds Aq \(aq
   89.48 +.el       .ds Aq '
   89.49 +.\"
   89.50 +.\" If the F register is turned on, we'll generate index entries on stderr for
   89.51 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
   89.52 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   89.53 +.\" output yourself in some meaningful fashion.
   89.54 +.ie \nF \{\
   89.55 +.    de IX
   89.56 +.    tm Index:\\$1\t\\n%\t"\\$2"
   89.57 +..
   89.58 +.    nr % 0
   89.59 +.    rr F
   89.60 +.\}
   89.61 +.el \{\
   89.62 +.    de IX
   89.63 +..
   89.64 +.\}
   89.65 +.\"
   89.66 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   89.67 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   89.68 +.    \" fudge factors for nroff and troff
   89.69 +.if n \{\
   89.70 +.    ds #H 0
   89.71 +.    ds #V .8m
   89.72 +.    ds #F .3m
   89.73 +.    ds #[ \f1
   89.74 +.    ds #] \fP
   89.75 +.\}
   89.76 +.if t \{\
   89.77 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   89.78 +.    ds #V .6m
   89.79 +.    ds #F 0
   89.80 +.    ds #[ \&
   89.81 +.    ds #] \&
   89.82 +.\}
   89.83 +.    \" simple accents for nroff and troff
   89.84 +.if n \{\
   89.85 +.    ds ' \&
   89.86 +.    ds ` \&
   89.87 +.    ds ^ \&
   89.88 +.    ds , \&
   89.89 +.    ds ~ ~
   89.90 +.    ds /
   89.91 +.\}
   89.92 +.if t \{\
   89.93 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   89.94 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
   89.95 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
   89.96 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
   89.97 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
   89.98 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
   89.99 +.\}
  89.100 +.    \" troff and (daisy-wheel) nroff accents
  89.101 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  89.102 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  89.103 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  89.104 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  89.105 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  89.106 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  89.107 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  89.108 +.ds ae a\h'-(\w'a'u*4/10)'e
  89.109 +.ds Ae A\h'-(\w'A'u*4/10)'E
  89.110 +.    \" corrections for vroff
  89.111 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  89.112 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  89.113 +.    \" for low resolution devices (crt and lpr)
  89.114 +.if \n(.H>23 .if \n(.V>19 \
  89.115 +\{\
  89.116 +.    ds : e
  89.117 +.    ds 8 ss
  89.118 +.    ds o a
  89.119 +.    ds d- d\h'-1'\(ga
  89.120 +.    ds D- D\h'-1'\(hy
  89.121 +.    ds th \o'bp'
  89.122 +.    ds Th \o'LP'
  89.123 +.    ds ae ae
  89.124 +.    ds Ae AE
  89.125 +.\}
  89.126 +.rm #[ #] #H #V #F C
  89.127 +.\" ========================================================================
  89.128 +.\"
  89.129 +.IX Title "SEA 8"
  89.130 +.TH SEA 8 "OpenPKG" "SEA(8)" "OpenPKG"
  89.131 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
  89.132 +.\" way too many mistakes in technical documents.
  89.133 +.if n .ad l
  89.134 +.nh
  89.135 +.SH "NAME"
  89.136 +sea \- Shell Execution Archive
  89.137 +.SH "SYNOPSIS"
  89.138 +.IX Header "SYNOPSIS"
  89.139 +\&\fBsea\fR
  89.140 +[\fB\-h\fR|\fB\-\-help\fR]
  89.141 +[\fB\-o\fR|\fB\-\-output\fR \fIsea\fR]
  89.142 +\&\fIscript\fR
  89.143 +[\fIfile-or-dir\fR ...]
  89.144 +.SH "DESCRIPTION"
  89.145 +.IX Header "DESCRIPTION"
  89.146 +The \fBsea\fR utility allows you to wrap a control shell script (\fIscript\fR)
  89.147 +plus zero or more payload file or directories (\fIfile-or-dir\fR) into a
  89.148 +so-called \fIShell Execution Archive\fR (\fIsea\fR), a \fIsh\fR\|(1) executable script
  89.149 +which temporarily auto-extracts its payload and pass-through execution
  89.150 +to the control script.
  89.151 +.SH "OPTIONS AND ARGUMENTS"
  89.152 +.IX Header "OPTIONS AND ARGUMENTS"
  89.153 +.IP "\fB\-h\fR|\fB\-\-help\fR" 4
  89.154 +.IX Item "-h|--help"
  89.155 +Just shows a short usage information of the \fBsea\fR utility.
  89.156 +.IP "\fB\-o\fR|\fB\-\-output\fR \fIsea\fR" 4
  89.157 +.IX Item "-o|--output sea"
  89.158 +The output \fIShell Execution Archive\fR file. By default the output is
  89.159 +saved to a file with a basename derived from \fIscript\fR and with new
  89.160 +attached extension \fI.sea\fR.
  89.161 +.IP "\fIscript\fR" 4
  89.162 +.IX Item "script"
  89.163 +The mandatory control script which is added to the payload and which
  89.164 +(after auto-extraction) is executed. It receives all command-line
  89.165 +arguments originally passed to the \fIShell Execution Archive\fR.
  89.166 +.IP "\fIfile-or-dir\fR" 4
  89.167 +.IX Item "file-or-dir"
  89.168 +Optional number of files or directories which are added to the payload.
  89.169 +.SH "EXAMPLES"
  89.170 +.IX Header "EXAMPLES"
  89.171 +.Vb 1
  89.172 +\& $ sea \-o foo.src.sh foo.sh foo.src.d
  89.173 +.Ve
  89.174 +.SH "HISTORY"
  89.175 +.IX Header "HISTORY"
  89.176 +The \fBsea\fR command was implemented in April 2012 by \fIRalf S. Engelschall\fR
  89.177 +<rse@engelschall.com>. Its idea is based on the
  89.178 +OpenPKG shell packages (\fIopenpkg.src.sh\fR) and its implemenation was
  89.179 +triggered by the demand for self-contained OpenPKG software stack source
  89.180 +archives.
    90.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.2 +++ b/openpkg/sea.pod	Tue Jul 31 12:23:42 2012 +0200
    90.3 @@ -0,0 +1,89 @@
    90.4 +##
    90.5 +##  sea -- Shell Execution Archive
    90.6 +##  Copyright (c) 2012 Ralf S. Engelschall <rse@engelschall.com>
    90.7 +##
    90.8 +##  This program is free software; you can redistribute it and/or modify
    90.9 +##  it under the terms of the GNU General Public License as published by
   90.10 +##  the Free Software Foundation; either version 2 of the License, or
   90.11 +##  (at your option) any later version.
   90.12 +##
   90.13 +##  This program is distributed in the hope that it will be useful,
   90.14 +##  but WITHOUT ANY WARRANTY; without even the implied warranty of
   90.15 +##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   90.16 +##  General Public License for more details.
   90.17 +##
   90.18 +##  You should have received a copy of the GNU General Public License
   90.19 +##  along with this program; if not, write to the Free Software
   90.20 +##  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
   90.21 +##  USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
   90.22 +##
   90.23 +##  NOTICE: Given that you include this file verbatim into your own
   90.24 +##  source tree, you are justified in saying that it remains separate
   90.25 +##  from your package, and that this way you are simply just using GNU
   90.26 +##  shtool. So, in this situation, there is no requirement that your
   90.27 +##  package itself is licensed under the GNU General Public License in
   90.28 +##  order to take advantage of GNU shtool.
   90.29 +##
   90.30 +
   90.31 +=pod
   90.32 +
   90.33 +=head1 NAME
   90.34 +
   90.35 +B<sea> - B<Shell Execution Archive>
   90.36 +
   90.37 +=head1 SYNOPSIS
   90.38 +
   90.39 +B<sea>
   90.40 +[B<-h>|B<--help>]
   90.41 +[B<-o>|B<--output> I<sea>]
   90.42 +I<script>
   90.43 +[I<file-or-dir> ...]
   90.44 +
   90.45 +=head1 DESCRIPTION
   90.46 +
   90.47 +The B<sea> utility allows you to wrap a control shell script (I<script>)
   90.48 +plus zero or more payload file or directories (I<file-or-dir>) into a
   90.49 +so-called I<Shell Execution Archive> (I<sea>), a sh(1) executable script
   90.50 +which temporarily auto-extracts its payload and pass-through execution
   90.51 +to the control script.
   90.52 +
   90.53 +=head1 OPTIONS AND ARGUMENTS
   90.54 +
   90.55 +=over 4
   90.56 +
   90.57 +=item B<-h>|B<--help>
   90.58 +
   90.59 +Just shows a short usage information of the B<sea> utility.
   90.60 +
   90.61 +=item B<-o>|B<--output> I<sea>
   90.62 +
   90.63 +The output I<Shell Execution Archive> file. By default the output is
   90.64 +saved to a file with a basename derived from I<script> and with new
   90.65 +attached extension F<.sea>.
   90.66 +
   90.67 +=item I<script>
   90.68 +
   90.69 +The mandatory control script which is added to the payload and which
   90.70 +(after auto-extraction) is executed. It receives all command-line
   90.71 +arguments originally passed to the I<Shell Execution Archive>.
   90.72 +
   90.73 +=item I<file-or-dir>
   90.74 +
   90.75 +Optional number of files or directories which are added to the payload.
   90.76 +
   90.77 +=back
   90.78 +
   90.79 +=head1 EXAMPLES
   90.80 +
   90.81 + $ sea -o foo.src.sh foo.sh foo.src.d
   90.82 +
   90.83 +=head1 HISTORY
   90.84 +
   90.85 +The B<sea> command was implemented in April 2012 by I<Ralf S. Engelschall>
   90.86 +E<lt>rse@engelschall.comE<gt>. Its idea is based on the
   90.87 +OpenPKG shell packages (F<openpkg.src.sh>) and its implemenation was
   90.88 +triggered by the demand for self-contained OpenPKG software stack source
   90.89 +archives.
   90.90 +
   90.91 +=cut
   90.92 +
    91.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    91.2 +++ b/openpkg/sea.sh	Tue Jul 31 12:23:42 2012 +0200
    91.3 @@ -0,0 +1,243 @@
    91.4 +##
    91.5 +##  sea -- Shell Execution Archive
    91.6 +##  Copyright (c) 2012 Ralf S. Engelschall <rse@engelschall.com>
    91.7 +##
    91.8 +##  This program is free software; you can redistribute it and/or modify
    91.9 +##  it under the terms of the GNU General Public License as published by
   91.10 +##  the Free Software Foundation; either version 2 of the License, or
   91.11 +##  (at your option) any later version.
   91.12 +##
   91.13 +##  This program is distributed in the hope that it will be useful,
   91.14 +##  but WITHOUT ANY WARRANTY; without even the implied warranty of
   91.15 +##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   91.16 +##  General Public License for more details.
   91.17 +##
   91.18 +##  You should have received a copy of the GNU General Public License
   91.19 +##  along with this program; if not, write to the Free Software
   91.20 +##  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
   91.21 +##  USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
   91.22 +##
   91.23 +##  NOTICE: Given that you include this file verbatim into your own
   91.24 +##  source tree, you are justified in saying that it remains separate
   91.25 +##  from your package, and that this way you are simply just using GNU
   91.26 +##  shtool. So, in this situation, there is no requirement that your
   91.27 +##  package itself is licensed under the GNU General Public License in
   91.28 +##  order to take advantage of GNU shtool.
   91.29 +##
   91.30 +
   91.31 +##
   91.32 +##  COMMAND LINE PARSING
   91.33 +##
   91.34 +
   91.35 +str_usage="[-h|--help] [-o|--output <file>] <script> [<file-or-dir> ...]"
   91.36 +arg_spec="1+"
   91.37 +opt_spec="h.o:"
   91.38 +opt_alias="h:help,o:output"
   91.39 +opt_h=no
   91.40 +opt_o=""
   91.41 +
   91.42 +#   parse argument specification string
   91.43 +eval `echo $arg_spec |\
   91.44 +      sed -e 's/^\([0-9]*\)\([+=]\)/arg_NUMS=\1; arg_MODE=\2/'`
   91.45 +
   91.46 +#   parse option specification string
   91.47 +eval `echo $opt_spec |\
   91.48 +      sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'`
   91.49 +
   91.50 +#   parse option alias string
   91.51 +eval `echo $opt_alias |\
   91.52 +      sed -e 's/-/_/g' -e 's/\([a-zA-Z0-9]\):\([^,]*\),*/opt_ALIAS_\2=\1;/g'`
   91.53 +
   91.54 +#   interate over argument line
   91.55 +opt_PREV=''
   91.56 +while [ $# -gt 0 ]; do
   91.57 +    #   special option stops processing
   91.58 +    if [ ".$1" = ".--" ]; then
   91.59 +        shift
   91.60 +        break
   91.61 +    fi
   91.62 +
   91.63 +    #   determine option and argument
   91.64 +    opt_ARG_OK=no
   91.65 +    if [ ".$opt_PREV" != . ]; then
   91.66 +        #   merge previous seen option with argument
   91.67 +        opt_OPT="$opt_PREV"
   91.68 +        opt_ARG="$1"
   91.69 +        opt_ARG_OK=yes
   91.70 +        opt_PREV=''
   91.71 +    else
   91.72 +        #   split argument into option and argument
   91.73 +        case "$1" in
   91.74 +            --[a-zA-Z0-9]*=*)
   91.75 +                eval `echo "x$1" |\
   91.76 +                      sed -e 's/^x--\([a-zA-Z0-9-]*\)=\(.*\)$/opt_OPT="\1";opt_ARG="\2"/'`
   91.77 +                opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'`
   91.78 +                eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
   91.79 +                ;;
   91.80 +            --[a-zA-Z0-9]*)
   91.81 +                opt_OPT=`echo "x$1" | cut -c4-`
   91.82 +                opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'`
   91.83 +                eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
   91.84 +                opt_ARG=''
   91.85 +                ;;
   91.86 +            -[a-zA-Z0-9]*)
   91.87 +                eval `echo "x$1" |\
   91.88 +                      sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \
   91.89 +                          -e 's/";\(.*\)$/"; opt_ARG="\1"/'`
   91.90 +                ;;
   91.91 +            -[a-zA-Z0-9])
   91.92 +                opt_OPT=`echo "x$1" | cut -c3-`
   91.93 +                opt_ARG=''
   91.94 +                ;;
   91.95 +            *)
   91.96 +                break
   91.97 +                ;;
   91.98 +        esac
   91.99 +    fi
  91.100 +
  91.101 +    #   eat up option
  91.102 +    shift
  91.103 +
  91.104 +    #   determine whether option needs an argument
  91.105 +    eval "opt_MODE=\$opt_MODE_${opt_OPT}"
  91.106 +    if [ ".$opt_ARG" = . ] && [ ".$opt_ARG_OK" != .yes ]; then
  91.107 +        if [ ".$opt_MODE" = ".:" ] || [ ".$opt_MODE" = ".+" ]; then
  91.108 +            opt_PREV="$opt_OPT"
  91.109 +            continue
  91.110 +        fi
  91.111 +    fi
  91.112 +
  91.113 +    #   process option
  91.114 +    case $opt_MODE in
  91.115 +        '.' )
  91.116 +            #   boolean option
  91.117 +            eval "opt_${opt_OPT}=yes"
  91.118 +            ;;
  91.119 +        ':' )
  91.120 +            #   option with argument (multiple occurances override)
  91.121 +            eval "opt_${opt_OPT}=\"\$opt_ARG\""
  91.122 +            ;;
  91.123 +        '+' )
  91.124 +            #   option with argument (multiple occurances append)
  91.125 +            eval "opt_${opt_OPT}=\"\$opt_${opt_OPT} \$opt_ARG\""
  91.126 +            ;;
  91.127 +        * )
  91.128 +            echo "$0: ERROR: unknown option: \`$opt_OPT'" 1>&2
  91.129 +            exit 1
  91.130 +            ;;
  91.131 +    esac
  91.132 +done
  91.133 +if [ ".$opt_PREV" != . ]; then
  91.134 +    echo "$0: ERROR: missing argument to option \`$opt_PREV'" 1>&2
  91.135 +    exit 1
  91.136 +fi
  91.137 +
  91.138 +#   process help option
  91.139 +if [ ".$opt_h" = .yes ]; then
  91.140 +    echo "Usage: $0 $str_usage"
  91.141 +    exit 0
  91.142 +fi
  91.143 +
  91.144 +#   complain about incorrect number of arguments
  91.145 +case $arg_MODE in
  91.146 +    '=' )
  91.147 +        if [ $# -ne $arg_NUMS ]; then
  91.148 +            echo "$0: ERROR: invalid number of arguments (exactly $arg_NUMS expected)" 1>&2
  91.149 +            exit 1
  91.150 +        fi
  91.151 +        ;;
  91.152 +    '+' )
  91.153 +        if [ $# -lt $arg_NUMS ]; then
  91.154 +            echo "$0: ERROR: invalid number of arguments (at least $arg_NUMS expected)" 1>&2
  91.155 +            exit 1
  91.156 +        fi
  91.157 +        ;;
  91.158 +esac
  91.159 +
  91.160 +##
  91.161 +##  MAIN
  91.162 +##
  91.163 +
  91.164 +#   we required at least the control script
  91.165 +script="$1"
  91.166 +shift
  91.167 +
  91.168 +#   determine output file
  91.169 +sea="$opt_o"
  91.170 +if [ ".$sea" = . ]; then
  91.171 +    sea=`echo "$script" | sed -e 's;\.[^.][^.]*$;;' -e 's;$;.sea;'`
  91.172 +fi
  91.173 +
  91.174 +#   wrap into a self-extracting distribution file
  91.175 +tmpdir="${TMPDIR-/tmp}"
  91.176 +tmpfile="$tmpdir/sea.tmp.$$"
  91.177 +rm -f $tmpfile
  91.178 +set -o noclobber
  91.179 +(   sed <$0 \
  91.180 +        -e '1,/^____/d' \
  91.181 +        -e "s;@script@;$script;g"
  91.182 +    echo . | awk '{
  91.183 +        for (i = 0; i < 2048/8; i++) {
  91.184 +            printf("        ");
  91.185 +        }
  91.186 +    }'
  91.187 +) >$tmpfile
  91.188 +dd bs=2048 count=1 if=$tmpfile of=$sea 2>/dev/null
  91.189 +rm -f $tmpfile
  91.190 +tar cf - "$script" "$@" 2>/dev/null >>$sea
  91.191 +
  91.192 +#   graceful termination
  91.193 +#   (before the shell discovers that we carry the wrapper with us below)
  91.194 +exit 0
  91.195 +
  91.196 +##
  91.197 +##  WRAPPER SCRIPT
  91.198 +##
  91.199 +
  91.200 +______________________________________________________________________________
  91.201 +#!/bin/sh
  91.202 +#![OpenPKG]
  91.203 +##
  91.204 +##  THIS IS AN AUTO-GENERATED SHELL-WRAPPER ARCHIVE
  91.205 +##
  91.206 +
  91.207 +#   establish sane environment
  91.208 +PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin"
  91.209 +LC_CTYPE=C
  91.210 +export LC_CTYPE
  91.211 +umask 022
  91.212 +
  91.213 +#   pass-through
  91.214 +if [ $# -eq 1 -a ".$1" = ".--tar" ]; then
  91.215 +    #   pass-through attached payload on stdout
  91.216 +    dd if="$0" bs=2048 skip=1 2>/dev/null
  91.217 +    rc=$?
  91.218 +else
  91.219 +    #   extract attached payload
  91.220 +    rm -rf "$0.d" >/dev/null 2>&1
  91.221 +    mkdir "$0.d" || exit $?
  91.222 +    dd if="$0" bs=2048 skip=1 2>/dev/null | \
  91.223 +    (cd "$0.d" && tar xf - 2>/dev/null)
  91.224 +    if [ ! -f "$0.d/@script@" ]; then
  91.225 +        echo "$0: ERROR: failed to unpack attached payload into directory \"$0.d\"" 1>&2
  91.226 +        rm -rf "$0.d" >/dev/null 2>&1 || true
  91.227 +        exit 1
  91.228 +    fi
  91.229 +
  91.230 +    #   pass-through execution to control script
  91.231 +    (cd "$0.d" && exec sh "./@script@" ${1+"$@"})
  91.232 +    rc=$?
  91.233 +
  91.234 +    #   cleanup
  91.235 +    rm -rf "$0.d" >/dev/null 2>&1 || true
  91.236 +fi
  91.237 +
  91.238 +#   terminate gracefully
  91.239 +#   (before the shell discovers that we carry MBs of raw data with us below)
  91.240 +exit $rc
  91.241 +
  91.242 +#   the payload tarball is appended in raw format directly to the end
  91.243 +#   of this script, just leaded by padding whitespaces which make sure
  91.244 +#   that the tarball data starts at the pre-defined offset of 2KB. This
  91.245 +#   allows us to unpack the tarball by just skipping the leading 2KB.
  91.246 +
    92.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    92.2 +++ b/openpkg/search.8	Tue Jul 31 12:23:42 2012 +0200
    92.3 @@ -0,0 +1,176 @@
    92.4 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
    92.5 +.\"
    92.6 +.\" Standard preamble:
    92.7 +.\" ========================================================================
    92.8 +.de Sp \" Vertical space (when we can't use .PP)
    92.9 +.if t .sp .5v
   92.10 +.if n .sp
   92.11 +..
   92.12 +.de Vb \" Begin verbatim text
   92.13 +.ft CW
   92.14 +.nf
   92.15 +.ne \\$1
   92.16 +..
   92.17 +.de Ve \" End verbatim text
   92.18 +.ft R
   92.19 +.fi
   92.20 +..
   92.21 +.\" Set up some character translations and predefined strings.  \*(-- will
   92.22 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   92.23 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
   92.24 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
   92.25 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
   92.26 +.\" nothing in troff, for use with C<>.
   92.27 +.tr \(*W-
   92.28 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   92.29 +.ie n \{\
   92.30 +.    ds -- \(*W-
   92.31 +.    ds PI pi
   92.32 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   92.33 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   92.34 +.    ds L" ""
   92.35 +.    ds R" ""
   92.36 +.    ds C` 
   92.37 +.    ds C' 
   92.38 +'br\}
   92.39 +.el\{\
   92.40 +.    ds -- \|\(em\|
   92.41 +.    ds PI \(*p
   92.42 +.    ds L" ``
   92.43 +.    ds R" ''
   92.44 +'br\}
   92.45 +.\"
   92.46 +.\" Escape single quotes in literal strings from groff's Unicode transform.
   92.47 +.ie \n(.g .ds Aq \(aq
   92.48 +.el       .ds Aq '
   92.49 +.\"
   92.50 +.\" If the F register is turned on, we'll generate index entries on stderr for
   92.51 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
   92.52 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   92.53 +.\" output yourself in some meaningful fashion.
   92.54 +.ie \nF \{\
   92.55 +.    de IX
   92.56 +.    tm Index:\\$1\t\\n%\t"\\$2"
   92.57 +..
   92.58 +.    nr % 0
   92.59 +.    rr F
   92.60 +.\}
   92.61 +.el \{\
   92.62 +.    de IX
   92.63 +..
   92.64 +.\}
   92.65 +.\"
   92.66 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   92.67 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   92.68 +.    \" fudge factors for nroff and troff
   92.69 +.if n \{\
   92.70 +.    ds #H 0
   92.71 +.    ds #V .8m
   92.72 +.    ds #F .3m
   92.73 +.    ds #[ \f1
   92.74 +.    ds #] \fP
   92.75 +.\}
   92.76 +.if t \{\
   92.77 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   92.78 +.    ds #V .6m
   92.79 +.    ds #F 0
   92.80 +.    ds #[ \&
   92.81 +.    ds #] \&
   92.82 +.\}
   92.83 +.    \" simple accents for nroff and troff
   92.84 +.if n \{\
   92.85 +.    ds ' \&
   92.86 +.    ds ` \&
   92.87 +.    ds ^ \&
   92.88 +.    ds , \&
   92.89 +.    ds ~ ~
   92.90 +.    ds /
   92.91 +.\}
   92.92 +.if t \{\
   92.93 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   92.94 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
   92.95 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
   92.96 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
   92.97 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
   92.98 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
   92.99 +.\}
  92.100 +.    \" troff and (daisy-wheel) nroff accents
  92.101 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  92.102 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  92.103 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  92.104 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  92.105 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  92.106 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  92.107 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  92.108 +.ds ae a\h'-(\w'a'u*4/10)'e
  92.109 +.ds Ae A\h'-(\w'A'u*4/10)'E
  92.110 +.    \" corrections for vroff
  92.111 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  92.112 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  92.113 +.    \" for low resolution devices (crt and lpr)
  92.114 +.if \n(.H>23 .if \n(.V>19 \
  92.115 +\{\
  92.116 +.    ds : e
  92.117 +.    ds 8 ss
  92.118 +.    ds o a
  92.119 +.    ds d- d\h'-1'\(ga
  92.120 +.    ds D- D\h'-1'\(hy
  92.121 +.    ds th \o'bp'
  92.122 +.    ds Th \o'LP'
  92.123 +.    ds ae ae
  92.124 +.    ds Ae AE
  92.125 +.\}
  92.126 +.rm #[ #] #H #V #F C
  92.127 +.\" ========================================================================
  92.128 +.\"
  92.129 +.IX Title "SEARCH 8"
  92.130 +.TH SEARCH 8 "OpenPKG" "SEARCH(8)" "OpenPKG"
  92.131 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
  92.132 +.\" way too many mistakes in technical documents.
  92.133 +.if n .ad l
  92.134 +.nh
  92.135 +.SH "NAME"
  92.136 +openpkg search \- OpenPKG Package Searching
  92.137 +.SH "SYNOPSIS"
  92.138 +.IX Header "SYNOPSIS"
  92.139 +\&\fBopenpkg\fR
  92.140 +\&\fBsearch\fR
  92.141 +[\fB\-r\fR \fIresource\fR]
  92.142 +[\fB\-v\fR]
  92.143 +\&\fIregex\fR ...
  92.144 +.SH "DESCRIPTION"
  92.145 +.IX Header "DESCRIPTION"
  92.146 +The \fBopenpkg search\fR tool is a frontend for searching indexed \s-1RPM\s0
  92.147 +packages. It downloads \s-1XML/RDF\s0 based resource index files from an \s-1RPM\s0
  92.148 +package repository and does a regular expression based search on each
  92.149 +package's name, summary and description texts.
  92.150 +.SH "OPTIONS"
  92.151 +.IX Header "OPTIONS"
  92.152 +The following command line options exist:
  92.153 +.IP "\fB\-r\fR \fIrepository\fR" 4
  92.154 +.IX Item "-r repository"
  92.155 +Specify the path to an OpenPKG \s-1RPM\s0 package repository.
  92.156 +This can be a \s-1URL\s0 (including \*(L"file://\*(R") to download packages from or
  92.157 +an absolute directory path (identified by leading \*(L"/\*(R") or
  92.158 +a relative directory path (identified by leading \*(L"./\*(R") to access packages directly.
  92.159 +The name of the package file is appended to this path.
  92.160 +The default is to use a \s-1URL\s0 pointing to the \fBOpenPKG\fR download service
  92.161 +as determined by the "\fBopenpkg release\fR" command.
  92.162 +.IP "\fB\-v\fR" 4
  92.163 +.IX Item "-v"
  92.164 +Produces itemized verbose output instead of the default brief tabular
  92.165 +output.
  92.166 +.SH "SEE ALSO"
  92.167 +.IX Header "SEE ALSO"
  92.168 +\&\fIindex\fR\|(8), \fIbuild\fR\|(8).
  92.169 +.SH "HISTORY"
  92.170 +.IX Header "HISTORY"
  92.171 +The \fBopenpkg search\fR command was invented in May 2012 by \fIRalf S.
  92.172 +Engelschall\fR <rse@engelschall.com> for use inside the \fBOpenPKG\fR
  92.173 +project <http://www.openpkg.org/>.
  92.174 +.SH "AUTHORS"
  92.175 +.IX Header "AUTHORS"
  92.176 +.Vb 2
  92.177 +\& Ralf S. Engelschall
  92.178 +\& rse@engelschall.com
  92.179 +.Ve
    93.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    93.2 +++ b/openpkg/search.pl	Tue Jul 31 12:23:42 2012 +0200
    93.3 @@ -0,0 +1,246 @@
    93.4 +##
    93.5 +##  search.pl -- OpenPKG Package Searching
    93.6 +##  Copyright (c) 2011-2012 OpenPKG GmbH <http://openpkg.com/>
    93.7 +##
    93.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    93.9 +##  All rights reserved. Licenses which grant limited permission to use,
   93.10 +##  copy, modify and distribute this software are available from the
   93.11 +##  OpenPKG GmbH.
   93.12 +##
   93.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   93.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   93.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   93.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   93.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   93.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   93.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   93.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   93.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   93.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   93.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   93.24 +##  SUCH DAMAGE.
   93.25 +##
   93.26 +
   93.27 +require 5.003;
   93.28 +
   93.29 +#   OpenPKG instance prefix and RPM
   93.30 +my $my_prefix = $ENV{'OPENPKG_PREFIX'};
   93.31 +my $my_rpm = "$my_prefix/bin/openpkg rpm";
   93.32 +delete $ENV{'OPENPKG_PREFIX'};
   93.33 +
   93.34 +#   program identification
   93.35 +my $progname  = "search";
   93.36 +my $progvers  = "0.1.0";
   93.37 +
   93.38 +#   home-brewn getopt(3) style option parser
   93.39 +sub getopts ($$@) {
   93.40 +    my ($opt_spec, $opts, @argv_orig) = @_;
   93.41 +    my (%optf) = map { m/(\w)/; $1 => $_ } $opt_spec =~ m/(\w:|\w)/g;
   93.42 +    my (@argv, $optarg);
   93.43 +
   93.44 +    foreach (@argv_orig) {
   93.45 +        if (@argv) {
   93.46 +            push @argv, $_;
   93.47 +        } elsif (defined $optarg) {
   93.48 +            if (exists $opts->{$optarg}) {
   93.49 +                $opts->{$optarg} .= " $_";
   93.50 +            } else {
   93.51 +                $opts->{$optarg} = $_;
   93.52 +            }
   93.53 +            $optarg = undef;
   93.54 +        } elsif (!/^[-]/) {
   93.55 +            push @argv, $_;
   93.56 +        } else {
   93.57 +            while (/^\-(\w)(.*)/) {
   93.58 +                if (exists $optf{$1}) {
   93.59 +                    if (length($optf{$1}) > 1) {
   93.60 +                        if ($2 ne '') {
   93.61 +                            if (exists $opts->{$1}) {
   93.62 +                                $opts->{$1} .= " $2";
   93.63 +                            } else {
   93.64 +                                $opts->{$1} = $2;
   93.65 +                            }
   93.66 +                        } else {
   93.67 +                            $optarg = $1;
   93.68 +                        }
   93.69 +                        last;
   93.70 +                    } else {
   93.71 +                        $opts->{$1} = 1;
   93.72 +                    }
   93.73 +                } else {
   93.74 +                    warn "openpkg:$prog_name:WARNING: unknown option $_\n";
   93.75 +                }
   93.76 +                $_ = "-$2";
   93.77 +            }
   93.78 +        }
   93.79 +    }
   93.80 +    if (defined $optarg) {
   93.81 +        warn "openpkg:$prog_name:WARNING: option $optarg requires an argument\n";
   93.82 +    }
   93.83 +    foreach my $opt (keys %optf) {
   93.84 +        if (not exists $opts->{$opt}) {
   93.85 +            $opts->{$opt} = (length($optf{$opt}) > 1 ? "" : 0);
   93.86 +        }
   93.87 +    }
   93.88 +    return @argv;
   93.89 +}
   93.90 +
   93.91 +#   execute a command
   93.92 +my $run_cache = {};
   93.93 +sub run ($) {
   93.94 +    my ($cmd) = @_;
   93.95 +    my $out = $run_cache->{$cmd};
   93.96 +    if (not defined($out)) {
   93.97 +        my @out = `$cmd`;
   93.98 +        $out = [ @out ];
   93.99 +        $run_cache->{$cmd} = $out;
  93.100 +    }
  93.101 +    return (wantarray ? @{$out} : join(//, @{$out}));
  93.102 +}
  93.103 +
  93.104 +#   determine reasonable temporary directory
  93.105 +my $tmpdir = ($ENV{"TMPDIR"} || "/tmp");
  93.106 +
  93.107 +#   parse command line options
  93.108 +my $opts = {};
  93.109 +@ARGV = getopts("hvr:", $opts, @ARGV);
  93.110 +
  93.111 +#   usage sanity check and usage help
  93.112 +sub usage {
  93.113 +    my ($rc) = @_;
  93.114 +    my $usage = "openpkg:$prog_name:USAGE: openpkg search <regex>\n";
  93.115 +    if ($rc == 0) {
  93.116 +        print STDOUT $usage;
  93.117 +    }
  93.118 +    else {
  93.119 +        print STDERR $usage;
  93.120 +    }
  93.121 +    exit($rc);
  93.122 +}
  93.123 +if ($opts->{"h"}) {
  93.124 +    usage(0);
  93.125 +}
  93.126 +if (@ARGV == 0) {
  93.127 +    usage(1);
  93.128 +}
  93.129 +
  93.130 +#   take command line arguments
  93.131 +my $keyword = $ARGV[0];
  93.132 +
  93.133 +#   determine start URL
  93.134 +my $url = $opts->{"r"} || "";
  93.135 +if ($url eq "") {
  93.136 +    $url = run("$my_prefix/bin/openpkg release --fmt='%u' 2>/dev/null");
  93.137 +    $url =~ s/^\s+//s;
  93.138 +    $url =~ s/\s+$//s;
  93.139 +}
  93.140 +if ($url eq "") {
  93.141 +    print STDERR "openpkg:$prog_name:ERROR: no repository URL known\n";
  93.142 +    exit(1);
  93.143 +}
  93.144 +
  93.145 +#   recursively download XML/RDF index
  93.146 +sub relurl ($$) {
  93.147 +    my ($url, $suburl) = @_;
  93.148 +    if ($suburl =~ m/^\w+:\/\//) {
  93.149 +        $url = $suburl;
  93.150 +    }
  93.151 +    elsif ($suburl =~ m/^\//) {
  93.152 +        $url = "file://$suburl";
  93.153 +    }
  93.154 +    else {
  93.155 +        $url =~ s/(\/)?\/*[^\/]*$/$1$suburl/;
  93.156 +    }
  93.157 +    1 while ($url =~ s/\/\.\//\//s);
  93.158 +    1 while ($url =~ s/\/[^\/]+\/\.\.\//\//s);
  93.159 +    return $url;
  93.160 +}
  93.161 +sub get_index ($) {
  93.162 +    my ($url) = @_;
  93.163 +    if ($url =~ m/^\//) {
  93.164 +        $url = "file://$url";
  93.165 +    }
  93.166 +    if ($url =~ m/\/$/) {
  93.167 +        $url .= "00INDEX.rdf";
  93.168 +    }
  93.169 +    my $cmd = "$my_prefix/bin/openpkg curl -s -o- \"$url\" 2>/dev/null";
  93.170 +    if ($url =~ m/\.bz2$/) {
  93.171 +        $cmd .= " | $my_prefix/lib/openpkg/bzip2 -d -c";
  93.172 +    }
  93.173 +    my $xml = run($cmd);
  93.174 +    my @includes = ();
  93.175 +    while ($xml =~ m/<Repository\s+[^>]*href="([^"]*)"/gs) {
  93.176 +        push(@includes, $1);
  93.177 +    }
  93.178 +    foreach my $include (@includes) {
  93.179 +        $xml .= get_index(relurl($url, $include));
  93.180 +    }
  93.181 +    return $xml;
  93.182 +}
  93.183 +my $xml = get_index($url);
  93.184 +
  93.185 +#   parse XML/RDF index
  93.186 +my $x = $xml;
  93.187 +$x =~ s/<rdf:Description\s+about="([^"]+)".*?>(.+?)<\/rdf:Description>/do1($1, $2), ''/sge;
  93.188 +sub do1 {
  93.189 +    my ($nvr, $xml) = @_;
  93.190 +    my ($name) = ($xml =~ m|<Name>(.+?)</Name>|s);
  93.191 +    my ($vers) = ($xml =~ m|<Version>(.+?)</Version>|s);
  93.192 +    my ($rele) = ($xml =~ m|<Release>(.+?)</Release>|s);
  93.193 +    my ($summ) = ($xml =~ m|<Summary>(.+?)</Summary>|s);
  93.194 +    my ($desc) = ($xml =~ m|<Description>(.+?)</Description>|s);
  93.195 +    if (   $name =~ m|$keyword|si
  93.196 +        or $summ =~ m|$keyword|si
  93.197 +        or $desc =~ m|$keyword|si) {
  93.198 +        do2($nvr, $name, $vers, $rele, $summ, $desc, $xml);
  93.199 +    }
  93.200 +}
  93.201 +sub do2 {
  93.202 +    my ($nvr, $name, $vers, $rele, $summ, $desc, $xml) = @_;
  93.203 +    return if ($name eq "openpkg");
  93.204 +    if ($opts->{"v"}) {
  93.205 +        #   itemized verbose output
  93.206 +        my ($dist)     = ($xml =~ m|<Distribution>(.+?)</Distribution>|s);
  93.207 +        my ($class)    = ($xml =~ m|<Class>(.+?)</Class>|s);
  93.208 +        my ($group)    = ($xml =~ m|<Group>(.+?)</Group>|s);
  93.209 +        my ($license)  = ($xml =~ m|<License>(.+?)</License>|s);
  93.210 +        my ($packager) = ($xml =~ m|<Packager>(.+?)</Packager>|s);
  93.211 +        my ($url)      = ($xml =~ m|<URL>(.+?)</URL>|s);
  93.212 +        my ($vendor)   = ($xml =~ m|<Vendor>(.+?)</Vendor>|s);
  93.213 +
  93.214 +        print "Name:     $name\n";
  93.215 +        print "Version:  $vers\n";
  93.216 +        print "Release:  $rele\n";
  93.217 +        print "Group:    $group\n";
  93.218 +        print "Class:    $class\n";
  93.219 +        print "Distrib:  $dist\n";
  93.220 +        print "License:  $license\n";
  93.221 +        print "Packager: $packager\n";
  93.222 +        print "Vendor:   $vendor\n";
  93.223 +        print "Summary:  $summ\n";
  93.224 +        print "URL:      $url\n";
  93.225 +
  93.226 +        print "Description:\n";
  93.227 +        $desc =~ s/^\s+//mg;
  93.228 +        $desc =~ s/\s+$//mg;
  93.229 +        $desc =~ s/^/    /mg;
  93.230 +        print "$desc\n";
  93.231 +
  93.232 +        my ($prov) = ($xml =~ m|<Provides>(.+?)</Provides>|s);
  93.233 +        if (($prov || "") ne "") {
  93.234 +            print "Provides:\n";
  93.235 +            $prov =~ s/<resource\s+equ="([^"]*)">(.+?)<\/resource>/do3($1, $2), ''/sge;
  93.236 +            sub do3 {
  93.237 +                my ($val, $name) = @_;
  93.238 +                print "    $name = $val\n";
  93.239 +            }
  93.240 +        }
  93.241 +
  93.242 +        print "\n";
  93.243 +    }
  93.244 +    else {
  93.245 +        #   tabular brief output
  93.246 +        printf("%-20s %-10s %-9s %s\n", $name, $vers, $rele, $summ);
  93.247 +    }
  93.248 +}
  93.249 +
    94.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    94.2 +++ b/openpkg/search.pod	Tue Jul 31 12:23:42 2012 +0200
    94.3 @@ -0,0 +1,84 @@
    94.4 +##
    94.5 +##  search.pod -- OpenPKG Package Searching
    94.6 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
    94.7 +##
    94.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    94.9 +##  All rights reserved. Licenses which grant limited permission to use,
   94.10 +##  copy, modify and distribute this software are available from the
   94.11 +##  OpenPKG GmbH.
   94.12 +##
   94.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   94.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   94.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   94.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   94.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   94.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   94.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   94.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   94.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   94.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   94.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   94.24 +##  SUCH DAMAGE.
   94.25 +##
   94.26 +
   94.27 +=pod
   94.28 +
   94.29 +=head1 NAME
   94.30 +
   94.31 +B<openpkg search> - B<OpenPKG> Package Searching
   94.32 +
   94.33 +=head1 SYNOPSIS
   94.34 +
   94.35 +B<openpkg>
   94.36 +B<search>
   94.37 +[B<-r> I<resource>]
   94.38 +[B<-v>]
   94.39 +I<regex> ...
   94.40 +
   94.41 +=head1 DESCRIPTION
   94.42 +
   94.43 +The B<openpkg search> tool is a frontend for searching indexed RPM
   94.44 +packages. It downloads XML/RDF based resource index files from an RPM
   94.45 +package repository and does a regular expression based search on each
   94.46 +package's name, summary and description texts.
   94.47 +
   94.48 +=head1 OPTIONS
   94.49 +
   94.50 +The following command line options exist:
   94.51 +
   94.52 +=over 4
   94.53 +
   94.54 +=item B<-r> I<repository>
   94.55 +
   94.56 +Specify the path to an OpenPKG RPM package repository.
   94.57 +This can be a URL (including "file://") to download packages from or
   94.58 +an absolute directory path (identified by leading "/") or
   94.59 +a relative directory path (identified by leading "./") to access packages directly.
   94.60 +The name of the package file is appended to this path.
   94.61 +The default is to use a URL pointing to the B<OpenPKG> download service
   94.62 +as determined by the "B<openpkg release>" command.
   94.63 +
   94.64 +=item B<-v>
   94.65 +
   94.66 +Produces itemized verbose output instead of the default brief tabular
   94.67 +output.
   94.68 +
   94.69 +=back
   94.70 +
   94.71 +=head1 SEE ALSO
   94.72 +
   94.73 +index(8), build(8).
   94.74 +
   94.75 +=head1 HISTORY
   94.76 +
   94.77 +The B<openpkg search> command was invented in May 2012 by I<Ralf S.
   94.78 +Engelschall> E<lt>rse@engelschall.comE<gt> for use inside the B<OpenPKG>
   94.79 +project E<lt>http://www.openpkg.org/E<gt>.
   94.80 +
   94.81 +=head1 AUTHORS
   94.82 +
   94.83 + Ralf S. Engelschall
   94.84 + rse@engelschall.com
   94.85 +
   94.86 +=cut
   94.87 +
    95.1 --- a/openpkg/shtool	Tue Jul 31 12:12:54 2012 +0200
    95.2 +++ b/openpkg/shtool	Tue Jul 31 12:23:42 2012 +0200
    95.3 @@ -1,12 +1,12 @@
    95.4  #!/bin/sh
    95.5  ##
    95.6  ##  GNU shtool -- The GNU Portable Shell Tool
    95.7 -##  Copyright (c) 1994-2007 Ralf S. Engelschall <rse@engelschall.com>
    95.8 +##  Copyright (c) 1994-2008 Ralf S. Engelschall <rse@engelschall.com>
    95.9  ##
   95.10  ##  See http://www.gnu.org/software/shtool/ for more information.
   95.11  ##  See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
   95.12  ##
   95.13 -##  Version:  2.0.7 (19-May-2007)
   95.14 +##  Version:  2.0.8 (18-Jul-2008)
   95.15  ##  Contents: all available modules
   95.16  ##
   95.17  
   95.18 @@ -90,8 +90,8 @@
   95.19      exit 1
   95.20  fi
   95.21  if [ ".$1" = ".-h" ] || [ ".$1" = ".--help" ]; then
   95.22 -    echo "This is GNU shtool, version 2.0.7 (19-May-2007)"
   95.23 -    echo 'Copyright (c) 1994-2007 Ralf S. Engelschall <rse@engelschall.com>'
   95.24 +    echo "This is GNU shtool, version 2.0.8 (18-Jul-2008)"
   95.25 +    echo 'Copyright (c) 1994-2008 Ralf S. Engelschall <rse@engelschall.com>'
   95.26      echo 'Report bugs to <bug-shtool@gnu.org>'
   95.27      echo ''
   95.28      echo 'Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]'
   95.29 @@ -157,7 +157,7 @@
   95.30      exit 0
   95.31  fi
   95.32  if [ ".$1" = ".-v" ] || [ ".$1" = ".--version" ]; then
   95.33 -    echo "GNU shtool 2.0.7 (19-May-2007)"
   95.34 +    echo "GNU shtool 2.0.8 (18-Jul-2008)"
   95.35      exit 0
   95.36  fi
   95.37  if [ ".$1" = ".-r" ] || [ ".$1" = ".--recreate" ]; then
   95.38 @@ -647,7 +647,7 @@
   95.39  echo )
   95.40      ##
   95.41      ##  echo -- Print string with optional construct expansion
   95.42 -    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
   95.43 +    ##  Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
   95.44      ##
   95.45  
   95.46      text="$*"
   95.47 @@ -958,7 +958,7 @@
   95.48      ##
   95.49      ##  mdate -- Pretty-print modification time of a file or dir
   95.50      ##  Copyright (c) 1995-1997 Free Software Foundation, Inc.
   95.51 -    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
   95.52 +    ##  Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
   95.53      ##
   95.54  
   95.55      fod="$1"
   95.56 @@ -1086,7 +1086,7 @@
   95.57  table )
   95.58      ##
   95.59      ##  table -- Pretty-print a field-separated list as a table
   95.60 -    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
   95.61 +    ##  Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
   95.62      ##
   95.63  
   95.64      if [ $opt_c -gt 4 ]; then
   95.65 @@ -1151,7 +1151,7 @@
   95.66  prop )
   95.67      ##
   95.68      ##  prop -- Display progress with a running propeller
   95.69 -    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
   95.70 +    ##  Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
   95.71      ##
   95.72  
   95.73      perl=''
   95.74 @@ -1197,7 +1197,7 @@
   95.75  move )
   95.76      ##
   95.77      ##  move -- Move files with simultaneous substitution
   95.78 -    ##  Copyright (c) 1999-2007 Ralf S. Engelschall <rse@engelschall.com>
   95.79 +    ##  Copyright (c) 1999-2008 Ralf S. Engelschall <rse@engelschall.com>
   95.80      ##
   95.81  
   95.82      src="$1"
   95.83 @@ -1289,7 +1289,7 @@
   95.84  install )
   95.85      ##
   95.86      ##  install -- Install a program, script or datafile
   95.87 -    ##  Copyright (c) 1997-2007 Ralf S. Engelschall <rse@engelschall.com>
   95.88 +    ##  Copyright (c) 1997-2008 Ralf S. Engelschall <rse@engelschall.com>
   95.89      ##
   95.90  
   95.91      #   special case: "shtool install -d <dir> [...]" internally
   95.92 @@ -1452,7 +1452,7 @@
   95.93  mkdir )
   95.94      ##
   95.95      ##  mkdir -- Make one or more directories
   95.96 -    ##  Copyright (c) 1996-2007 Ralf S. Engelschall <rse@engelschall.com>
   95.97 +    ##  Copyright (c) 1996-2008 Ralf S. Engelschall <rse@engelschall.com>
   95.98      ##
   95.99  
  95.100      errstatus=0
  95.101 @@ -1540,11 +1540,11 @@
  95.102  mkln )
  95.103      ##
  95.104      ##  mkln -- Make link with calculation of relative paths
  95.105 -    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
  95.106 +    ##  Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
  95.107      ##
  95.108  
  95.109      #   determine source(s) and destination
  95.110 -    args=$?
  95.111 +    args=$#
  95.112      srcs=""
  95.113      while [ $# -gt 1 ]; do
  95.114          srcs="$srcs $1"
  95.115 @@ -1628,14 +1628,14 @@
  95.116              dstdir=""
  95.117          else
  95.118              while [ ".$srcdir" != . ] && [ ".$dstdir" != . ]; do
  95.119 -                presrc=`echo $srcdir | sed -e 's;^\([^/]*\)/.*;\1;'`
  95.120 -                predst=`echo $dstdir | sed -e 's;^\([^/]*\)/.*;\1;'`
  95.121 +                presrc=`echo $srcdir | sed -e 's;^\([^/][^/]*\)/.*;\1;'`
  95.122 +                predst=`echo $dstdir | sed -e 's;^\([^/][^/]*\)/.*;\1;'`
  95.123                  if [ ".$presrc" != ".$predst" ]; then
  95.124                      break
  95.125                  fi
  95.126                  prefix="$prefix$presrc/"
  95.127 -                srcdir=`echo $srcdir | sed -e 's;^[^/]*/*;;'`
  95.128 -                dstdir=`echo $dstdir | sed -e 's;^[^/]*/*;;'`
  95.129 +                srcdir=`echo $srcdir | sed -e 's;^[^/][^/]*/*;;'`
  95.130 +                dstdir=`echo $dstdir | sed -e 's;^[^/][^/]*/*;;'`
  95.131              done
  95.132          fi
  95.133  
  95.134 @@ -1648,13 +1648,13 @@
  95.135          allow_relative_srcpre=no
  95.136          if [ ".$prefix" != . ] && [ ".$prefix" != ./ ]; then
  95.137              allow_relative_srcpre=yes
  95.138 -        fi  
  95.139 +        fi
  95.140          if [ $oneisabs = 0 ]; then
  95.141              allow_relative_srcpre=yes
  95.142 -        fi  
  95.143 +        fi
  95.144          if [ ".$opt_s" != .yes ]; then
  95.145              allow_relative_srcpre=no
  95.146 -        fi  
  95.147 +        fi
  95.148          if [ ".$allow_relative_srcpre" = .yes ]; then
  95.149              pl="$dstdir/"
  95.150              OIFS="$IFS"; IFS='/'
  95.151 @@ -1679,6 +1679,11 @@
  95.152              fi
  95.153          fi
  95.154  
  95.155 +        #   special case (usually on "mkln -s /foo /foo/bar", etc)
  95.156 +        if [ ".$srcpre$srcdir$srcbase" = . ]; then
  95.157 +            srcdir="."
  95.158 +        fi
  95.159 +
  95.160          #   now finalize source and destination directory paths
  95.161          srcdir=`echo $srcdir | sed -e 's;\([^/]\)$;\1/;'`
  95.162          dstdir=`echo $dstdir | sed -e 's;\([^/]\)$;\1/;'`
  95.163 @@ -1696,7 +1701,7 @@
  95.164  mkshadow )
  95.165      ##
  95.166      ##  mkshadow -- Make a shadow tree through symbolic links
  95.167 -    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
  95.168 +    ##  Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
  95.169      ##
  95.170  
  95.171      #   source and destination directory
  95.172 @@ -1814,7 +1819,7 @@
  95.173  fixperm )
  95.174      ##
  95.175      ##  fixperm -- Fix file permissions inside a source tree
  95.176 -    ##  Copyright (c) 1996-2007 Ralf S. Engelschall <rse@engelschall.com>
  95.177 +    ##  Copyright (c) 1996-2008 Ralf S. Engelschall <rse@engelschall.com>
  95.178      ##
  95.179  
  95.180      paths="$*"
  95.181 @@ -1871,7 +1876,7 @@
  95.182  rotate )
  95.183      ##
  95.184      ##  rotate -- Logfile rotation
  95.185 -    ##  Copyright (c) 2001-2007 Ralf S. Engelschall <rse@engelschall.com>
  95.186 +    ##  Copyright (c) 2001-2008 Ralf S. Engelschall <rse@engelschall.com>
  95.187      ##
  95.188  
  95.189      #   make sure we have at least one file to rotate
  95.190 @@ -2032,6 +2037,11 @@
  95.191  
  95.192          #   execute prolog
  95.193          if [ ".$opt_P" != . ]; then
  95.194 +            #   pass current log file name to prolog
  95.195 +            #   prolog cannot be handed an argument as it may be
  95.196 +            #   called as "prolog && something"  
  95.197 +            SHTOOL_ROTATE_LOGFILE="$ldir/$file"
  95.198 +            export SHTOOL_ROTATE_LOGFILE
  95.199              if [ ".$opt_t" = .yes ]; then
  95.200                  echo "$opt_P"
  95.201              fi
  95.202 @@ -2221,6 +2231,11 @@
  95.203  
  95.204          #   execute epilog
  95.205          if [ ".$opt_E" != . ]; then
  95.206 +            #   pass archive file name to epilog command
  95.207 +            #   epilog cannot be handed an argument as it is often
  95.208 +            #   called as "epilog && something"
  95.209 +            SHTOOL_ROTATE_LOGFILE="${adir}/${file}"
  95.210 +            export SHTOOL_ROTATE_LOGFILE
  95.211              if [ ".$opt_t" = .yes ]; then
  95.212                  echo "$opt_E"
  95.213              fi
  95.214 @@ -2235,7 +2250,7 @@
  95.215  tarball )
  95.216      ##
  95.217      ##  tarball -- Roll distribution tarballs
  95.218 -    ##  Copyright (c) 1999-2007 Ralf S. Engelschall <rse@engelschall.com>
  95.219 +    ##  Copyright (c) 1999-2008 Ralf S. Engelschall <rse@engelschall.com>
  95.220      ##
  95.221  
  95.222      srcs="$*"
  95.223 @@ -2399,7 +2414,7 @@
  95.224  subst )
  95.225      ##
  95.226      ##  subst -- Apply sed(1) substitution operations
  95.227 -    ##  Copyright (c) 2001-2007 Ralf S. Engelschall <rse@engelschall.com>
  95.228 +    ##  Copyright (c) 2001-2008 Ralf S. Engelschall <rse@engelschall.com>
  95.229      ##
  95.230  
  95.231      #   remember optional list of file(s)
  95.232 @@ -2511,7 +2526,7 @@
  95.233                  fi
  95.234              fi
  95.235  
  95.236 -            #   optionally check whether any content change actually occurred 
  95.237 +            #   optionally check whether any content change actually occurred
  95.238              if [ ".$opt_q" = .no ]; then
  95.239                  if cmp $file$orig $file >/dev/null 2>&1; then
  95.240                      if [ ".$opt_w" = .yes ]; then
  95.241 @@ -2560,7 +2575,7 @@
  95.242  platform )
  95.243      ##
  95.244      ##  platform -- Platform Identification Utility
  95.245 -    ##  Copyright (c) 2003-2007 Ralf S. Engelschall <rse@engelschall.com>
  95.246 +    ##  Copyright (c) 2003-2008 Ralf S. Engelschall <rse@engelschall.com>
  95.247      ##
  95.248  
  95.249      #   option post-processing
  95.250 @@ -2708,6 +2723,22 @@
  95.251              SC="4.4BSD"
  95.252              ;;
  95.253  
  95.254 +        #   DragonFly BSD
  95.255 +        *:DragonFly:* )
  95.256 +            #   determine architecture
  95.257 +            AT="${UNAME_MACHINE}"
  95.258 +            AP="${AT}"
  95.259 +            case "${AP}" in
  95.260 +                i[3-6]86 ) AP="iX86" ;;
  95.261 +            esac
  95.262 +            AC="${AP}"
  95.263 +            #   determine system
  95.264 +            r=`echo "${UNAME_RELEASE}" | sed -e 's/\([-_].*\)$/[\1]/'`
  95.265 +            ST="DragonFly ${r}"
  95.266 +            SP="${ST}"
  95.267 +            SC="4.4BSD"
  95.268 +            ;;
  95.269 +
  95.270          #   GNU/Linux
  95.271          *:Linux:* )
  95.272              #   determine architecture
  95.273 @@ -2749,7 +2780,7 @@
  95.274                      n=`echo ${tagfile} | sed -e 's/[_-]release$//' -e 's/[_-]version$//'`
  95.275                      v=`(grep VERSION /etc/${tagfile}; cat /etc/${tagfile}) | grep '[0-9]' | sed -e 'q' |\
  95.276                         sed -e 's/^/#/' \
  95.277 -                           -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
  95.278 +                           -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\)\(\.[0-9][0-9]*\).*$/\1[\2]/' \
  95.279                             -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
  95.280                             -e 's/^#[^0-9]*\([0-9][0-9]*\).*$/\1/' \
  95.281                             -e 's/^#.*$//'`
  95.282 @@ -2925,15 +2956,15 @@
  95.283          #   IBM AIX
  95.284          *:AIX:* )
  95.285              #   determine architecture
  95.286 -            cpu_arch=rs6000
  95.287 +            cpu_arch=RS6000
  95.288              if [ -x /usr/sbin/lsdev -a -x /usr/sbin/lsattr ]; then
  95.289                  cpu_id=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
  95.290                  if [ ".`/usr/sbin/lsattr -El ${cpu_id} | grep -i powerpc`" != . ]; then
  95.291 -                    cpu_arch=powerpc
  95.292 +                    cpu_arch=PPC
  95.293                  fi
  95.294              elif [ -d /QOpenSys ]; then
  95.295                  #   IBM i5/OS (aka OS/400) with PASE (Portable Application Solutions Environment)
  95.296 -                cpu_arch=powerpc
  95.297 +                cpu_arch=PPC
  95.298              fi
  95.299              if [ -x /usr/bin/oslevel ]; then
  95.300                  os_level=`/usr/bin/oslevel`
  95.301 @@ -2999,6 +3030,36 @@
  95.302              SC="4.4BSD/Mach3.0"
  95.303              ;;
  95.304  
  95.305 +        #   Windows/Cygwin
  95.306 +        *:CYGWIN*:* )
  95.307 +            #   determine architecture
  95.308 +            AT="`uname -m`"
  95.309 +            AP="${AT}"
  95.310 +            case "${AP}" in
  95.311 +                i?86 ) AP="iX86" ;;
  95.312 +            esac
  95.313 +            AC="${AP}"
  95.314 +            #   determine system
  95.315 +            unset v1; unset v2; unset v3
  95.316 +            eval `echo "${UNAME_RELEASE}" |\
  95.317 +                  sed -e 's/^/#/' \
  95.318 +                      -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \
  95.319 +                      -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \
  95.320 +                      -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \
  95.321 +                      -e 's/^#.*$/v1="0"/'`
  95.322 +            ST="Cygwin ${v1}${v2+.$v2}${v3+[.$v3]}"
  95.323 +            SP="$ST"
  95.324 +            SC="Windows"
  95.325 +            v=`echo "${UNAME_SYSTEM}" | sed -e 's/^CYGWIN_NT-//' |\
  95.326 +               sed -e 's/^/#/' -e 's/^#\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' -e 's/^#.*$//'`
  95.327 +            case "$v" in
  95.328 +                4.0 ) SC="$SC[ NT]"    ;;
  95.329 +                5.0 ) SC="$SC[ 2000]"  ;;
  95.330 +                5.1 ) SC="$SC[ XP]"    ;;
  95.331 +                6.0 ) SC="$SC[ Vista]" ;;
  95.332 +            esac
  95.333 +            ;;
  95.334 +
  95.335          #   TODO ...ADD YOUR NEW PLATFORM CHECK HERE... TODO
  95.336          # *:XXX:* )
  95.337          #   ...
  95.338 @@ -3143,7 +3204,7 @@
  95.339  arx )
  95.340      ##
  95.341      ##  arx -- Extended archive command
  95.342 -    ##  Copyright (c) 1999-2007 Ralf S. Engelschall <rse@engelschall.com>
  95.343 +    ##  Copyright (c) 1999-2008 Ralf S. Engelschall <rse@engelschall.com>
  95.344      ##
  95.345  
  95.346      ar_prg="$opt_C"
  95.347 @@ -3222,7 +3283,7 @@
  95.348  slo )
  95.349      ##
  95.350      ##  slo -- Separate linker options by library class
  95.351 -    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
  95.352 +    ##  Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
  95.353      ##
  95.354  
  95.355      DIFS="$IFS"
  95.356 @@ -3381,7 +3442,7 @@
  95.357  scpp )
  95.358      ##
  95.359      ##  scpp -- Sharing C Pre-Processor
  95.360 -    ##  Copyright (c) 1999-2007 Ralf S. Engelschall <rse@engelschall.com>
  95.361 +    ##  Copyright (c) 1999-2008 Ralf S. Engelschall <rse@engelschall.com>
  95.362      ##
  95.363  
  95.364      srcs="$*"
  95.365 @@ -3601,7 +3662,7 @@
  95.366  version )
  95.367      ##
  95.368      ##  version -- Maintain a version information file
  95.369 -    ##  Copyright (c) 1994-2007 Ralf S. Engelschall <rse@engelschall.com>
  95.370 +    ##  Copyright (c) 1994-2008 Ralf S. Engelschall <rse@engelschall.com>
  95.371      ##
  95.372  
  95.373      file="$1"
  95.374 @@ -3893,7 +3954,7 @@
  95.375  path )
  95.376      ##
  95.377      ##  path -- Deal with program paths
  95.378 -    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
  95.379 +    ##  Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
  95.380      ##
  95.381  
  95.382      namelist="$*"
    96.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    96.2 +++ b/openpkg/shtool.sh	Tue Jul 31 12:23:42 2012 +0200
    96.3 @@ -0,0 +1,2 @@
    96.4 +#!/bin/sh
    96.5 +exec @l_prefix@/lib/openpkg/shtool ${1+"$@"}
    97.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    97.2 +++ b/openpkg/sqlite.patch	Tue Jul 31 12:23:42 2012 +0200
    97.3 @@ -0,0 +1,73 @@
    97.4 +Index: Makefile.in
    97.5 +--- Makefile.in.orig	2009-07-06 16:29:57 +0200
    97.6 ++++ Makefile.in	2009-08-12 20:12:13 +0200
    97.7 +@@ -187,6 +187,17 @@
    97.8 + USE_AMALGAMATION = @USE_AMALGAMATION@
    97.9 + LIBOBJ = $(OBJS$(USE_AMALGAMATION))
   97.10 + 
   97.11 ++# FTS3 support
   97.12 ++ifdef FTS3
   97.13 ++TCC    += -DSQLITE_ENABLE_FTS3 -I$(TOP)/ext/fts3
   97.14 ++LIBOBJ += fts3.lo fts3_hash.lo fts3_expr.lo fts3_porter.lo fts3_icu.lo fts3_tokenizer1.lo fts3_tokenizer.lo
   97.15 ++endif
   97.16 ++
   97.17 ++# RTREE support
   97.18 ++ifdef RTREE
   97.19 ++TCC    += -DSQLITE_ENABLE_RTREE -I$(TOP)/ext/rtree
   97.20 ++LIBOBJ += rtree.lo
   97.21 ++endif
   97.22 + 
   97.23 + # All of the source code files.
   97.24 + #
   97.25 +@@ -477,6 +488,24 @@
   97.26 + 		-o $@ $(TOP)/src/shell.c libsqlite3.la \
   97.27 + 		$(LIBREADLINE) $(TLIBS) -rpath "$(libdir)"
   97.28 + 
   97.29 ++fts3.lo:	$(TOP)/ext/fts3/fts3.c $(HDR)
   97.30 ++	$(LTCOMPILE) -c $(TOP)/ext/fts3/fts3.c
   97.31 ++fts3_hash.lo:	$(TOP)/ext/fts3/fts3_hash.c $(HDR)
   97.32 ++	$(LTCOMPILE) -c $(TOP)/ext/fts3/fts3_hash.c
   97.33 ++fts3_expr.lo:	$(TOP)/ext/fts3/fts3_expr.c $(HDR)
   97.34 ++	$(LTCOMPILE) -c $(TOP)/ext/fts3/fts3_expr.c
   97.35 ++fts3_icu.lo:	$(TOP)/ext/fts3/fts3_icu.c $(HDR)
   97.36 ++	$(LTCOMPILE) -c $(TOP)/ext/fts3/fts3_icu.c
   97.37 ++fts3_porter.lo:	$(TOP)/ext/fts3/fts3_porter.c $(HDR)
   97.38 ++	$(LTCOMPILE) -c $(TOP)/ext/fts3/fts3_porter.c
   97.39 ++fts3_tokenizer.lo:	$(TOP)/ext/fts3/fts3_tokenizer.c $(HDR)
   97.40 ++	$(LTCOMPILE) -c $(TOP)/ext/fts3/fts3_tokenizer.c
   97.41 ++fts3_tokenizer1.lo:	$(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR)
   97.42 ++	$(LTCOMPILE) -c $(TOP)/ext/fts3/fts3_tokenizer1.c
   97.43 ++
   97.44 ++rtree.lo:	$(TOP)/ext/rtree/rtree.c $(HDR)
   97.45 ++	$(LTCOMPILE) -c $(TOP)/ext/rtree/rtree.c
   97.46 ++
   97.47 + # This target creates a directory named "tsrc" and fills it with
   97.48 + # copies of all of the C source code and header files needed to
   97.49 + # build on the target system.  Some of the C source code and header
   97.50 +Index: configure
   97.51 +--- configure.orig	2009-08-01 17:04:20 +0200
   97.52 ++++ configure	2009-08-12 20:12:13 +0200
   97.53 +@@ -6012,11 +6012,7 @@
   97.54 + if $ac_preproc_ok; then
   97.55 +   :
   97.56 + else
   97.57 +-  { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
   97.58 +-See \`config.log' for more details." >&5
   97.59 +-$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
   97.60 +-See \`config.log' for more details." >&2;}
   97.61 +-   { (exit 1); exit 1; }; }
   97.62 ++  :
   97.63 + fi
   97.64 + 
   97.65 + ac_ext=c
   97.66 +Index: sqlite3.pc.in
   97.67 +--- sqlite3.pc.in.orig	2009-05-05 05:39:51 +0200
   97.68 ++++ sqlite3.pc.in	2009-08-12 20:12:13 +0200
   97.69 +@@ -8,6 +8,5 @@
   97.70 + Name: SQLite
   97.71 + Description: SQL database engine
   97.72 + Version: @RELEASE@
   97.73 +-Libs: -L${libdir} -lsqlite3
   97.74 +-Libs.private: @LIBS@
   97.75 ++Libs: -L${libdir} -lsqlite3 @LIBS@
   97.76 + Cflags: -I${includedir}
    98.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    98.2 +++ b/openpkg/stack.8	Tue Jul 31 12:23:42 2012 +0200
    98.3 @@ -0,0 +1,402 @@
    98.4 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
    98.5 +.\"
    98.6 +.\" Standard preamble:
    98.7 +.\" ========================================================================
    98.8 +.de Sp \" Vertical space (when we can't use .PP)
    98.9 +.if t .sp .5v
   98.10 +.if n .sp
   98.11 +..
   98.12 +.de Vb \" Begin verbatim text
   98.13 +.ft CW
   98.14 +.nf
   98.15 +.ne \\$1
   98.16 +..
   98.17 +.de Ve \" End verbatim text
   98.18 +.ft R
   98.19 +.fi
   98.20 +..
   98.21 +.\" Set up some character translations and predefined strings.  \*(-- will
   98.22 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   98.23 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
   98.24 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
   98.25 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
   98.26 +.\" nothing in troff, for use with C<>.
   98.27 +.tr \(*W-
   98.28 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   98.29 +.ie n \{\
   98.30 +.    ds -- \(*W-
   98.31 +.    ds PI pi
   98.32 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   98.33 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   98.34 +.    ds L" ""
   98.35 +.    ds R" ""
   98.36 +.    ds C` 
   98.37 +.    ds C' 
   98.38 +'br\}
   98.39 +.el\{\
   98.40 +.    ds -- \|\(em\|
   98.41 +.    ds PI \(*p
   98.42 +.    ds L" ``
   98.43 +.    ds R" ''
   98.44 +'br\}
   98.45 +.\"
   98.46 +.\" Escape single quotes in literal strings from groff's Unicode transform.
   98.47 +.ie \n(.g .ds Aq \(aq
   98.48 +.el       .ds Aq '
   98.49 +.\"
   98.50 +.\" If the F register is turned on, we'll generate index entries on stderr for
   98.51 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
   98.52 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   98.53 +.\" output yourself in some meaningful fashion.
   98.54 +.ie \nF \{\
   98.55 +.    de IX
   98.56 +.    tm Index:\\$1\t\\n%\t"\\$2"
   98.57 +..
   98.58 +.    nr % 0
   98.59 +.    rr F
   98.60 +.\}
   98.61 +.el \{\
   98.62 +.    de IX
   98.63 +..
   98.64 +.\}
   98.65 +.\"
   98.66 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   98.67 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   98.68 +.    \" fudge factors for nroff and troff
   98.69 +.if n \{\
   98.70 +.    ds #H 0
   98.71 +.    ds #V .8m
   98.72 +.    ds #F .3m
   98.73 +.    ds #[ \f1
   98.74 +.    ds #] \fP
   98.75 +.\}
   98.76 +.if t \{\
   98.77 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   98.78 +.    ds #V .6m
   98.79 +.    ds #F 0
   98.80 +.    ds #[ \&
   98.81 +.    ds #] \&
   98.82 +.\}
   98.83 +.    \" simple accents for nroff and troff
   98.84 +.if n \{\
   98.85 +.    ds ' \&
   98.86 +.    ds ` \&
   98.87 +.    ds ^ \&
   98.88 +.    ds , \&
   98.89 +.    ds ~ ~
   98.90 +.    ds /
   98.91 +.\}
   98.92 +.if t \{\
   98.93 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   98.94 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
   98.95 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
   98.96 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
   98.97 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
   98.98 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
   98.99 +.\}
  98.100 +.    \" troff and (daisy-wheel) nroff accents
  98.101 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  98.102 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  98.103 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  98.104 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  98.105 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  98.106 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  98.107 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  98.108 +.ds ae a\h'-(\w'a'u*4/10)'e
  98.109 +.ds Ae A\h'-(\w'A'u*4/10)'E
  98.110 +.    \" corrections for vroff
  98.111 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  98.112 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  98.113 +.    \" for low resolution devices (crt and lpr)
  98.114 +.if \n(.H>23 .if \n(.V>19 \
  98.115 +\{\
  98.116 +.    ds : e
  98.117 +.    ds 8 ss
  98.118 +.    ds o a
  98.119 +.    ds d- d\h'-1'\(ga
  98.120 +.    ds D- D\h'-1'\(hy
  98.121 +.    ds th \o'bp'
  98.122 +.    ds Th \o'LP'
  98.123 +.    ds ae ae
  98.124 +.    ds Ae AE
  98.125 +.\}
  98.126 +.rm #[ #] #H #V #F C
  98.127 +.\" ========================================================================
  98.128 +.\"
  98.129 +.IX Title "STACK 8"
  98.130 +.TH STACK 8 "OpenPKG" "STACK(8)" "OpenPKG"
  98.131 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
  98.132 +.\" way too many mistakes in technical documents.
  98.133 +.if n .ad l
  98.134 +.nh
  98.135 +.SH "NAME"
  98.136 +openpkg stack \- OpenPKG Software Stack Generation
  98.137 +.SH "SYNOPSIS"
  98.138 +.IX Header "SYNOPSIS"
  98.139 +\&\fBopenpkg stack\fR
  98.140 +[\fB\-h\fR|\fB\-\-help\fR]
  98.141 +[\fB\-v\fR|\fB\-\-verbose\fR \fIlevel\fR]
  98.142 +[\fB\-o\fR|\fB\-\-output\fR \fIdir\fR]
  98.143 +[\fB\-D\fR|\fB\-\-define\fR \fIname\fR=\fIvalue\fR ...]
  98.144 +[\fB\-u\fR|\fB\-\-unversioned\fR]
  98.145 +[\fB\-q\fR|\fB\-\-query\fR]
  98.146 +\&\fI\fIname\fI.stk\fR
  98.147 +.SH "DESCRIPTION"
  98.148 +.IX Header "DESCRIPTION"
  98.149 +The \fBopenpkg stack\fR command reads a OpenPKG software stack definition
  98.150 +\&\fI\fIname\fI.stk\fR, generates a OpenPKG software stack deployment script
  98.151 +\&\fI\fIname\fI[\-\fIversion\fI\-\fIrelease\fI].sh\fR, determines, downloads and
  98.152 +stores all required corresponding OpenPKG source packages under
  98.153 +\&\fI\fIname\fI[\-\fIversion\fI\-\fIrelease\fI].src.d/*.src.{sh,rpm}\fR.
  98.154 +.PP
  98.155 +On executing the generated OpenPKG software stack deployment
  98.156 +script \fI\fIname\fI[\-\fIversion\fI\-\fIrelease\fI].sh\fR, an OpenPKG
  98.157 +instance is created (or reused if existing), all packages
  98.158 +built and installed in topologically correct dependency order
  98.159 +and the resulting OpenPKG binary packages stored as
  98.160 +\&\fI\fIname\fI[\-\fIversion\fI\-\fIrelease\fI].\fIplatform\fI\-\fItag\fI.d/*.{sh,rpm}\fR.
  98.161 +.PP
  98.162 +The main design decisions and intentions of OpenPKG software stacks are:
  98.163 +.IP "1." 4
  98.164 +OpenPKG software stacks can be centrally defined in a single file
  98.165 +\&\fI\fIname\fI.stk\fR, similar to the definition of OpenPKG software packages in
  98.166 +\&\fI\fIname\fI.spec\fR files. This definition includes both OpenPKG framework
  98.167 +bootstrap parameters, OpenPKG package build parameters and OpenPKG
  98.168 +software stack specific deployment-time prolog and epilog scripts.
  98.169 +.IP "2." 4
  98.170 +OpenPKG software stacks depend on particular OpenPKG software packages
  98.171 +(and perhaps even their particular versions) and by downloading and
  98.172 +locally storing all relevant OpenPKG software packages an OpenPKG
  98.173 +software stack remains stable and self-contained \*(-- even if new versions
  98.174 +of OpenPKG software packages are released.
  98.175 +.IP "3." 4
  98.176 +For generating the OpenPKG software stack files, an OpenPKG instance
  98.177 +and its \fBopenpkg stack\fR command is required, but executing the OpenPKG
  98.178 +software stack deployment script does \s-1NOT\s0 require any pre-existing
  98.179 +OpenPKG instances.
  98.180 +.IP "4." 4
  98.181 +By wrapping \fI\fIname\fI[\-\fIversion\fI\-\fIrelease\fI].sh\fR and
  98.182 +\&\fI\fIname\fI[\-\fIversion\fI\-\fIrelease\fI].src.d/\fR into a \fIShell Execution
  98.183 +Archive\fR \fI\fIname\fI[\-\fIversion\fI\-\fIrelease\fI].src.sh\fR with the \fBopenpkg
  98.184 +sea\fR command, you can provide a single self-contained file for building
  98.185 +and installing an OpenPKG software stack from OpenPKG source packages.
  98.186 +.IP "5." 4
  98.187 +By wrapping \fI\fIname\fI[\-\fIversion\fI\-\fIrelease\fI].sh\fR and
  98.188 +\&\fI\fIname\fI[\-\fIversion\fI\-\fIrelease\fI].\fIplatform\fI\-\fItag\fI.d/\fR
  98.189 +into a \fIShell Execution Archive\fR
  98.190 +\&\fI\fIname\fI[\-\fIversion\fI\-\fIrelease\fI].\fIplatform\fI\-\fItag\fI.sh\fR with the
  98.191 +\&\fBopenpkg sea\fR command, you can provide a single self-contained file for
  98.192 +installing an OpenPKG software stack from OpenPKG binary packages.
  98.193 +.SH "COMMAND-LINE OPTIONS AND ARGUMENTS"
  98.194 +.IX Header "COMMAND-LINE OPTIONS AND ARGUMENTS"
  98.195 +.IP "\fB\-h\fR|\fB\-\-help\fR" 4
  98.196 +.IX Item "-h|--help"
  98.197 +Just shows a short usage information for the \fBopenpkg stack\fR command.
  98.198 +.IP "\fB\-v\fR|\fB\-\-verbose\fR \fIlevel\fR" 4
  98.199 +.IX Item "-v|--verbose level"
  98.200 +Sets the verbosity level for outputs, from \f(CW0\fR (no output at all) to 4
  98.201 +(all possible outputs). The default is \f(CW4\fR.
  98.202 +.IP "\fB\-o\fR|\fB\-\-output\fR \fIdir\fR" 4
  98.203 +.IX Item "-o|--output dir"
  98.204 +The output directory for the OpenPKG software stack files.
  98.205 +The default is the current directory (\fI.\fR).
  98.206 +.IP "[\fB\-D\fR|\fB\-\-define\fR \fIname\fR=\fIvalue\fR ...]" 4
  98.207 +.IX Item "[-D|--define name=value ...]"
  98.208 +On-the-fly overrides the value of option macro \f(CW\*(C`%{\f(CIname\f(CW}\*(C'\fR with
  98.209 +\&\fIvalue\fR. Use this to generate a variant of an OpenPKG software stack
  98.210 +without modifying the software stack definition file.
  98.211 +.IP "[\fB\-u\fR|\fB\-\-unversioned\fR]" 4
  98.212 +.IX Item "[-u|--unversioned]"
  98.213 +By default \fBopenpkg stack\fR creates the file
  98.214 +\&\f(CW\*(C`\f(CIname\f(CW\-\f(CIversion\f(CW\-\f(CIrelease\f(CW.sh\*(C'\fR (deployment script) and the
  98.215 +directory \f(CW\*(C`\f(CIname\f(CW\-\f(CIversion\f(CW\-\f(CIrelease\f(CW.src.d/\*(C'\fR (source packages).
  98.216 +With this option the names are \f(CW\*(C`\f(CIname\f(CW.sh\*(C'\fR and \f(CW\*(C`\f(CIname\f(CW.src.d/\*(C'\fR only.
  98.217 +.IP "[\fB\-q\fR|\fB\-\-query\fR]" 4
  98.218 +.IX Item "[-q|--query]"
  98.219 +Forces a different operation mode where a shell script is output
  98.220 +on \fIstdout\fR containing variable definitions in the format
  98.221 +\&\f(CW\*(C`\f(CIname\f(CW="\f(CIvalue\f(CW";\*(C'\fR with information about the software stack
  98.222 +definition. The provided variable names are \f(CW\*(C`name\*(C'\fR, \f(CW\*(C`summary\*(C'\fR,
  98.223 +\&\f(CW\*(C`packager\*(C'\fR, \f(CW\*(C`version\*(C'\fR and \f(CW\*(C`release\*(C'\fR for the corresponding headers,
  98.224 +plus variables for all defined software stack options (see \f(CW%option\fR
  98.225 +section below).
  98.226 +.IP "\fIname\fR\fI.stk\fR" 4
  98.227 +.IX Item "name.stk"
  98.228 +The mandatory OpenPKG software stack definition file.
  98.229 +See below under \fB\s-1SOFTWARE\s0 \s-1STACK\s0 \s-1DEFINITION\s0\fR for details.
  98.230 +.SH "SOFTWARE STACK DEFINITION"
  98.231 +.IX Header "SOFTWARE STACK DEFINITION"
  98.232 +An OpenPKG software stack is defined by a configuration file
  98.233 +containing headers (\f(CW\*(C`Foo:\*(C'\fR) and sections (<%foo>).
  98.234 +.SS "Configuration Headers"
  98.235 +.IX Subsection "Configuration Headers"
  98.236 +.IP "\fBName\fR" 4
  98.237 +.IX Item "Name"
  98.238 +The name of the OpenPKG software stack. Also used as a prefix for many
  98.239 +files. Should match the regular expression \f(CW\*(C`^[a\-z][a\-zA\-Z0\-9]+\*(C'\fR,
  98.240 +although this is not enforced. Example: \f(CW\*(C`Name: example\*(C'\fR.
  98.241 +.IP "\fBSummary\fR" 4
  98.242 +.IX Item "Summary"
  98.243 +A single line, shortly summarizing the purpose of the OpenPKG software
  98.244 +stack. Example: \f(CW\*(C`Summary: Example Stack\*(C'\fR.
  98.245 +.IP "\fBPackager\fR" 4
  98.246 +.IX Item "Packager"
  98.247 +Name of the packager of the OpenPKG software software stack.
  98.248 +Example: \f(CW\*(C`Packager: OpenPKG GmbH\*(C'\fR.
  98.249 +.IP "\fBVersion\fR" 4
  98.250 +.IX Item "Version"
  98.251 +Version identifier of the OpenPKG software stack. Describes the
  98.252 +\&\fIlogical\fR revision of the software stack definition. Should match the
  98.253 +regular expression \f(CW\*(C`^[0\-9]+\e.[0\-9]\e.[0\-9]+$\*(C'\fR, although this is not
  98.254 +enforced. Example: \f(CW\*(C`Version: 1.0.0\*(C'\fR.
  98.255 +.IP "\fBRelease\fR" 4
  98.256 +.IX Item "Release"
  98.257 +Release identifier of the OpenPKG software stack. Describes the
  98.258 +\&\fIphysical\fR revision of the stack definition. Should be in the format
  98.259 +\&\f(CW\*(C`YYYYMMDD\*(C'\fR and hence match the regular expression \f(CW\*(C`^[0\-9]{8}$\*(C'\fR,
  98.260 +although this is not enforced. Example: \f(CW\*(C`Release: 20120101\*(C'\fR.
  98.261 +.SS "Configuration Sections"
  98.262 +.IX Subsection "Configuration Sections"
  98.263 +.ie n .IP "\fB\fB%options\fB\fR" 4
  98.264 +.el .IP "\fB\f(CB%options\fB\fR" 4
  98.265 +.IX Item "%options"
  98.266 +Zero or more options for the OpenPKG software stack, one per line, in
  98.267 +the format "\fIname\fR \fIdefault-value\fR". Options can be overridden on
  98.268 +the command-line with \fB\-D\fR\fIname\fR=\fIvalue\fR. Example: \f(CW\*(C`with_ssl yes\*(C'\fR.
  98.269 +Option values can be expanded in all headers and sections through the
  98.270 +following constructs:
  98.271 +.RS 4
  98.272 +.ie n .IP "\*(C`%{\f(CIname\f(CW}\*(C'" 4
  98.273 +.el .IP "\f(CW\*(C`%{\f(CIname\f(CW}\*(C'\fR" 4
  98.274 +.IX Item "%{name}"
  98.275 +Expand to the value of option \fIname\fR.
  98.276 +.ie n .IP "\*(C`%{?\f(CIname\f(CW:\f(CIvalue\f(CW}\*(C'" 4
  98.277 +.el .IP "\f(CW\*(C`%{?\f(CIname\f(CW:\f(CIvalue\f(CW}\*(C'\fR" 4
  98.278 +.IX Item "%{?name:value}"
  98.279 +Expand to \fIvalue\fR if option \fIname\fR is defined.
  98.280 +.ie n .IP "\*(C`%{!?\f(CIname\f(CW:\f(CIvalue\f(CW}\*(C'" 4
  98.281 +.el .IP "\f(CW\*(C`%{!?\f(CIname\f(CW:\f(CIvalue\f(CW}\*(C'\fR" 4
  98.282 +.IX Item "%{!?name:value}"
  98.283 +Expand to \fIvalue\fR if option \fIname\fR is \s-1NOT\s0 defined.
  98.284 +.RE
  98.285 +.RS 4
  98.286 +.RE
  98.287 +.ie n .IP "\fB\fB%description\fB\fR" 4
  98.288 +.el .IP "\fB\f(CB%description\fB\fR" 4
  98.289 +.IX Item "%description"
  98.290 +A single textual paragraph describing the purpose of the OpenPKG
  98.291 +software stack in more detail than header \f(CW\*(C`Summary\*(C'\fR.
  98.292 +.ie n .IP "\fB\fB%framework\fB\fR" 4
  98.293 +.el .IP "\fB\f(CB%framework\fB\fR" 4
  98.294 +.IX Item "%framework"
  98.295 +The command-line parameters passed to the OpenPKG framework
  98.296 +bootstrap source shell package \fIopenpkg\-*.src.sh\fR. Usually at
  98.297 +least the parameters \fB\-\-prefix=\fR\fIpath\fR, \fB\-\-user=\fR\fIusername\fR,
  98.298 +\&\fB\-\-group=\fR\fIgroupname\fR and \fB\-\-tag=\fR\fItagname\fR are given here. In order
  98.299 +to allow an OpenPKG software stack to be easily reused one creates
  98.300 +the options (see \f(CW%option\fR above) named \f(CW\*(C`prefix\*(C'\fR, \f(CW\*(C`user\*(C'\fR, \f(CW\*(C`group\*(C'\fR
  98.301 +and \f(CW\*(C`tag\*(C'\fR and then use \f(CW\*(C`\-\-prefix=%{prefix}\*(C'\fR, \f(CW\*(C`\-\-user=%{user}\*(C'\fR,
  98.302 +\&\f(CW\*(C`\-\-group=%{group}\*(C'\fR and \f(CW\*(C`\-\-tag=%{tag}\*(C'\fR in this \f(CW%framework\fR section.
  98.303 +.ie n .IP "\fB\fB%packages\fB\fR" 4
  98.304 +.el .IP "\fB\f(CB%packages\fB\fR" 4
  98.305 +.IX Item "%packages"
  98.306 +The packages to build and install for the OpenPKG software stack, in
  98.307 +the format of "\fB\-D\f(BIpackage\fB::\f(BIoption\fB=\f(BIvalue\fB\fR\*(L" and \*(R"\fIpackage\fR"
  98.308 +specifications as understood by the \f(CW\*(C`openpkg build\*(C'\fR tool. Example:
  98.309 +\&\f(CW\*(C`\-Dapache::with_mod_ssl=yes \-Dapache\-php::with_json=yes apache
  98.310 +apache\-php\*(C'\fR.
  98.311 +.ie n .IP "\fB\fB%prolog\fB\fR" 4
  98.312 +.el .IP "\fB\f(CB%prolog\fB\fR" 4
  98.313 +.IX Item "%prolog"
  98.314 +A shell script executed before installation of all packages.
  98.315 +The variable \f(CW$prefix\fR is available to access the
  98.316 +OpenPKG software stack without having to hard-code a path.
  98.317 +.ie n .IP "\fB\fB%epilog\fB\fR" 4
  98.318 +.el .IP "\fB\f(CB%epilog\fB\fR" 4
  98.319 +.IX Item "%epilog"
  98.320 +A shell script executed after installation of all packages. This
  98.321 +is usually used for applying OpenPKG software stack specific
  98.322 +configurations. The variable \f(CW$prefix\fR is available to access the
  98.323 +OpenPKG software stack without having to hard-code a path. Example:
  98.324 +\&\f(CW\*(C`echo "openldap_enable=no" >>$prefix/etc/rc.conf\*(C'\fR.
  98.325 +.SH "EXAMPLES"
  98.326 +.IX Header "EXAMPLES"
  98.327 +.Vb 1
  98.328 +\& $ cat xamp.stk
  98.329 +\& 
  98.330 +\& Name:         xamp
  98.331 +\& Summary:      Apache\-MySQL\-PHP Server
  98.332 +\& Packager:     OpenPKG GmbH
  98.333 +\& Version:      1.0.0
  98.334 +\& Release:      20120407
  98.335 +\&  
  98.336 +\& %description
  98.337 +\&     This software stack contains a so\-called xAMP web stack, consisting
  98.338 +\&     of the major components Apache, MySQL and PHP.
  98.339 +\&  
  98.340 +\& %options
  98.341 +\&     repo      http://download.openpkg.org/stacks/current/source/
  98.342 +\&     prefix    /xamp
  98.343 +\&     user      xamp
  98.344 +\&     group     xamp
  98.345 +\&     tag       xamp
  98.346 +\&     with_ldap no
  98.347 +\&     with_ssl  no
  98.348 +\&     addr      127.0.0.1
  98.349 +\&  
  98.350 +\& %repository
  98.351 +\&     %{repo}
  98.352 +\&  
  98.353 +\& %framework
  98.354 +\&     \-\-prefix=%{prefix}
  98.355 +\&     \-\-user=%{user}
  98.356 +\&     \-\-group=%{group}
  98.357 +\&     \-\-tag=%{tag}
  98.358 +\&  
  98.359 +\& %packages
  98.360 +\&     \-D apache::with_mod_dav=yes
  98.361 +\&     \-D apache::with_mod_deflate=yes
  98.362 +\&     \-D apache::with_mod_ldap=%{with_ldap}
  98.363 +\&     \-D apache::with_mod_proxy=yes
  98.364 +\&     \-D apache::with_mod_ssl=%{with_ssl}
  98.365 +\&     \-D apache\-php::with_curl=yes
  98.366 +\&     \-D apache\-php::with_freetype=yes
  98.367 +\&     \-D apache\-php::with_gd=yes
  98.368 +\&     \-D apache\-php::with_iconv=yes
  98.369 +\&     \-D apache\-php::with_json=yes
  98.370 +\&     \-D apache\-php::with_mbregex=yes
  98.371 +\&     \-D apache\-php::with_mbstring=yes
  98.372 +\&     \-D apache\-php::with_mysql=yes
  98.373 +\&     \-D apache\-php::with_openldap=%{with_ldap}
  98.374 +\&     \-D apache\-php::with_session=yes
  98.375 +\&     \-D apache\-php::with_simplexml=yes
  98.376 +\&     \-D apache\-php::with_sqlite=yes
  98.377 +\&     \-D apache\-php::with_ssl=%{with_ssl}
  98.378 +\&     \-D apache\-php::with_xml=yes
  98.379 +\&     \-D apache\-php::with_zlib=yes
  98.380 +\&     apache
  98.381 +\&     apache\-php
  98.382 +\&     mysql
  98.383 +\&  
  98.384 +\& %epilog
  98.385 +\&     shtool subst \e
  98.386 +\&         \-e \*(Aqs;127\e.0\e.0\e.1:%{addr};g\*(Aq \e
  98.387 +\&         %{prefix}/etc/apache/apache.conf
  98.388 +\&     if [ ".%{with_ldap}" = .yes ]; then
  98.389 +\&         echo "openldap_enable=\e"no\e"" >>%{prefix}/etc/rc.conf
  98.390 +\&     fi
  98.391 +\&  
  98.392 +\& $ openpkg stack \-v4 \e
  98.393 +\&   \-Dprefix=/v/xamp \-Duser=xamp\-sw \-Dgroup=xamp\-sw \e
  98.394 +\&   \-\-unversioned xamp.stk
  98.395 +\&
  98.396 +\& $ openpkg sea \-o xamp.src.sh xamp.sh xamp.src.d/
  98.397 +\&
  98.398 +\& $ sh xamp.src.sh \-v4 \-S sudo
  98.399 +\&
  98.400 +\& $ openpkg sea \-o xamp.bin.sh xamp.sh xamp.*\-*.d/
  98.401 +.Ve
  98.402 +.SH "HISTORY"
  98.403 +.IX Header "HISTORY"
  98.404 +The \fBopenpkg stack\fR command was implemented in April 2012 by \fIRalf S. Engelschall\fR
  98.405 +<rse@engelschall.com> for the OpenPKG Framework of the OpenPKG GmbH.
    99.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    99.2 +++ b/openpkg/stack.pod	Tue Jul 31 12:23:42 2012 +0200
    99.3 @@ -0,0 +1,341 @@
    99.4 +##
    99.5 +##  OpenPKG Software Stack Generation Utility
    99.6 +##  Copyright (c) 2012 OpenPKG GmbH <http://openpkg.com/>
    99.7 +##
    99.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
    99.9 +##  All rights reserved. Licenses which grant limited permission to use,
   99.10 +##  copy, modify and distribute this software are available from the
   99.11 +##  OpenPKG GmbH.
   99.12 +##
   99.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   99.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   99.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   99.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   99.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   99.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   99.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   99.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   99.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   99.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   99.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   99.24 +##  SUCH DAMAGE.
   99.25 +##
   99.26 +
   99.27 +=pod
   99.28 +
   99.29 +=head1 NAME
   99.30 +
   99.31 +B<openpkg stack> - B<OpenPKG Software Stack Generation>
   99.32 +
   99.33 +=head1 SYNOPSIS
   99.34 +
   99.35 +B<openpkg stack>
   99.36 +[B<-h>|B<--help>]
   99.37 +[B<-v>|B<--verbose> I<level>]
   99.38 +[B<-o>|B<--output> I<dir>]
   99.39 +[B<-D>|B<--define> I<name>=I<value> ...]
   99.40 +[B<-u>|B<--unversioned>]
   99.41 +[B<-q>|B<--query>]
   99.42 +F<I<name>.stk>
   99.43 +
   99.44 +=head1 DESCRIPTION
   99.45 +
   99.46 +The B<openpkg stack> command reads a OpenPKG software stack definition
   99.47 +F<I<name>.stk>, generates a OpenPKG software stack deployment script
   99.48 +F<I<name>[-I<version>-I<release>].sh>, determines, downloads and
   99.49 +stores all required corresponding OpenPKG source packages under
   99.50 +F<I<name>[-I<version>-I<release>].src.d/*.src.{sh,rpm}>.
   99.51 +
   99.52 +On executing the generated OpenPKG software stack deployment
   99.53 +script F<I<name>[-I<version>-I<release>].sh>, an OpenPKG
   99.54 +instance is created (or reused if existing), all packages
   99.55 +built and installed in topologically correct dependency order
   99.56 +and the resulting OpenPKG binary packages stored as
   99.57 +F<I<name>[-I<version>-I<release>].I<platform>-I<tag>.d/*.{sh,rpm}>.
   99.58 +
   99.59 +The main design decisions and intentions of OpenPKG software stacks are:
   99.60 +
   99.61 +=over 4
   99.62 +
   99.63 +=item 1.
   99.64 +
   99.65 +OpenPKG software stacks can be centrally defined in a single file
   99.66 +F<I<name>.stk>, similar to the definition of OpenPKG software packages in
   99.67 +F<I<name>.spec> files. This definition includes both OpenPKG framework
   99.68 +bootstrap parameters, OpenPKG package build parameters and OpenPKG
   99.69 +software stack specific deployment-time prolog and epilog scripts.
   99.70 +
   99.71 +=item 2.
   99.72 +
   99.73 +OpenPKG software stacks depend on particular OpenPKG software packages
   99.74 +(and perhaps even their particular versions) and by downloading and
   99.75 +locally storing all relevant OpenPKG software packages an OpenPKG
   99.76 +software stack remains stable and self-contained -- even if new versions
   99.77 +of OpenPKG software packages are released.
   99.78 +
   99.79 +=item 3.
   99.80 +
   99.81 +For generating the OpenPKG software stack files, an OpenPKG instance
   99.82 +and its B<openpkg stack> command is required, but executing the OpenPKG
   99.83 +software stack deployment script does NOT require any pre-existing
   99.84 +OpenPKG instances.
   99.85 +
   99.86 +=item 4.
   99.87 +
   99.88 +By wrapping F<I<name>[-I<version>-I<release>].sh> and
   99.89 +F<I<name>[-I<version>-I<release>].src.d/> into a I<Shell Execution
   99.90 +Archive> F<I<name>[-I<version>-I<release>].src.sh> with the B<openpkg
   99.91 +sea> command, you can provide a single self-contained file for building
   99.92 +and installing an OpenPKG software stack from OpenPKG source packages.
   99.93 +
   99.94 +=item 5.
   99.95 +
   99.96 +By wrapping F<I<name>[-I<version>-I<release>].sh> and
   99.97 +F<I<name>[-I<version>-I<release>].I<platform>-I<tag>.d/>
   99.98 +into a I<Shell Execution Archive>
   99.99 +F<I<name>[-I<version>-I<release>].I<platform>-I<tag>.sh> with the
  99.100 +B<openpkg sea> command, you can provide a single self-contained file for
  99.101 +installing an OpenPKG software stack from OpenPKG binary packages.
  99.102 +
  99.103 +=back
  99.104 +
  99.105 +=head1 COMMAND-LINE OPTIONS AND ARGUMENTS
  99.106 +
  99.107 +=over 4
  99.108 +
  99.109 +=item B<-h>|B<--help>
  99.110 +
  99.111 +Just shows a short usage information for the B<openpkg stack> command.
  99.112 +
  99.113 +=item B<-v>|B<--verbose> I<level>
  99.114 +
  99.115 +Sets the verbosity level for outputs, from C<0> (no output at all) to 4
  99.116 +(all possible outputs). The default is C<4>.
  99.117 +
  99.118 +=item B<-o>|B<--output> I<dir>
  99.119 +
  99.120 +The output directory for the OpenPKG software stack files.
  99.121 +The default is the current directory (F<.>).
  99.122 +
  99.123 +=item [B<-D>|B<--define> I<name>=I<value> ...]
  99.124 +
  99.125 +On-the-fly overrides the value of option macro C<%{I<name>}> with
  99.126 +I<value>. Use this to generate a variant of an OpenPKG software stack
  99.127 +without modifying the software stack definition file.
  99.128 +
  99.129 +=item [B<-u>|B<--unversioned>]
  99.130 +
  99.131 +By default B<openpkg stack> creates the file
  99.132 +C<I<name>-I<version>-I<release>.sh> (deployment script) and the
  99.133 +directory C<I<name>-I<version>-I<release>.src.d/> (source packages).
  99.134 +With this option the names are C<I<name>.sh> and C<I<name>.src.d/> only.
  99.135 +
  99.136 +=item [B<-q>|B<--query>]
  99.137 +
  99.138 +Forces a different operation mode where a shell script is output
  99.139 +on F<stdout> containing variable definitions in the format
  99.140 +C<I<name>="I<value>";> with information about the software stack
  99.141 +definition. The provided variable names are C<name>, C<summary>,
  99.142 +C<packager>, C<version> and C<release> for the corresponding headers,
  99.143 +plus variables for all defined software stack options (see C<%option>
  99.144 +section below).
  99.145 +
  99.146 +=item I<name>F<.stk>
  99.147 +
  99.148 +The mandatory OpenPKG software stack definition file.
  99.149 +See below under B<SOFTWARE STACK DEFINITION> for details.
  99.150 +
  99.151 +=back
  99.152 +
  99.153 +=head1 SOFTWARE STACK DEFINITION
  99.154 +
  99.155 +An OpenPKG software stack is defined by a configuration file
  99.156 +containing headers (C<Foo:>) and sections (<%foo>).
  99.157 +
  99.158 +=head2 Configuration Headers
  99.159 +
  99.160 +=over 4
  99.161 +
  99.162 +=item B<Name>
  99.163 +
  99.164 +The name of the OpenPKG software stack. Also used as a prefix for many
  99.165 +files. Should match the regular expression C<^[a-z][a-zA-Z0-9]+>,
  99.166 +although this is not enforced. Example: C<Name: example>.
  99.167 +
  99.168 +=item B<Summary>
  99.169 +
  99.170 +A single line, shortly summarizing the purpose of the OpenPKG software
  99.171 +stack. Example: C<Summary: Example Stack>.
  99.172 +
  99.173 +=item B<Packager>
  99.174 +
  99.175 +Name of the packager of the OpenPKG software software stack.
  99.176 +Example: C<Packager: OpenPKG GmbH>.
  99.177 +
  99.178 +=item B<Version>
  99.179 +
  99.180 +Version identifier of the OpenPKG software stack. Describes the
  99.181 +I<logical> revision of the software stack definition. Should match the
  99.182 +regular expression C<^[0-9]+\.[0-9]\.[0-9]+$>, although this is not
  99.183 +enforced. Example: C<Version: 1.0.0>.
  99.184 +
  99.185 +=item B<Release>
  99.186 +
  99.187 +Release identifier of the OpenPKG software stack. Describes the
  99.188 +I<physical> revision of the stack definition. Should be in the format
  99.189 +C<YYYYMMDD> and hence match the regular expression C<^[0-9]{8}$>,
  99.190 +although this is not enforced. Example: C<Release: 20120101>.
  99.191 +
  99.192 +=back
  99.193 +
  99.194 +=head2 Configuration Sections
  99.195 +
  99.196 +=over 4
  99.197 +
  99.198 +=item B<%options>
  99.199 +
  99.200 +Zero or more options for the OpenPKG software stack, one per line, in
  99.201 +the format "I<name> I<default-value>". Options can be overridden on
  99.202 +the command-line with B<-D>I<name>=I<value>. Example: C<with_ssl yes>.
  99.203 +Option values can be expanded in all headers and sections through the
  99.204 +following constructs:
  99.205 +
  99.206 +=over 4
  99.207 +
  99.208 +=item C<%{I<name>}>
  99.209 +
  99.210 +Expand to the value of option I<name>.
  99.211 +
  99.212 +=item C<%{?I<name>:I<value>}>
  99.213 +
  99.214 +Expand to I<value> if option I<name> is defined.
  99.215 +
  99.216 +=item C<%{!?I<name>:I<value>}>
  99.217 +
  99.218 +Expand to I<value> if option I<name> is NOT defined.
  99.219 +
  99.220 +=back
  99.221 +
  99.222 +=item B<%description>
  99.223 +
  99.224 +A single textual paragraph describing the purpose of the OpenPKG
  99.225 +software stack in more detail than header C<Summary>.
  99.226 +
  99.227 +=item B<%framework>
  99.228 +
  99.229 +The command-line parameters passed to the OpenPKG framework
  99.230 +bootstrap source shell package F<openpkg-*.src.sh>. Usually at
  99.231 +least the parameters B<--prefix=>I<path>, B<--user=>I<username>,
  99.232 +B<--group=>I<groupname> and B<--tag=>I<tagname> are given here. In order
  99.233 +to allow an OpenPKG software stack to be easily reused one creates
  99.234 +the options (see C<%option> above) named C<prefix>, C<user>, C<group>
  99.235 +and C<tag> and then use C<--prefix=%{prefix}>, C<--user=%{user}>,
  99.236 +C<--group=%{group}> and C<--tag=%{tag}> in this C<%framework> section.
  99.237 +
  99.238 +=item B<%packages>
  99.239 +
  99.240 +The packages to build and install for the OpenPKG software stack, in
  99.241 +the format of "B<-DI<package>::I<option>=I<value>>" and "I<package>"
  99.242 +specifications as understood by the C<openpkg build> tool. Example:
  99.243 +C<-Dapache::with_mod_ssl=yes -Dapache-php::with_json=yes apache
  99.244 +apache-php>.
  99.245 +
  99.246 +=item B<%prolog>
  99.247 +
  99.248 +A shell script executed before installation of all packages.
  99.249 +The variable C<$prefix> is available to access the
  99.250 +OpenPKG software stack without having to hard-code a path.
  99.251 +
  99.252 +=item B<%epilog>
  99.253 +
  99.254 +A shell script executed after installation of all packages. This
  99.255 +is usually used for applying OpenPKG software stack specific
  99.256 +configurations. The variable C<$prefix> is available to access the
  99.257 +OpenPKG software stack without having to hard-code a path. Example:
  99.258 +C<echo "openldap_enable=no" E<gt>E<gt>$prefix/etc/rc.conf>.
  99.259 +
  99.260 +=back
  99.261 +
  99.262 +=head1 EXAMPLES
  99.263 +
  99.264 + $ cat xamp.stk
  99.265 + 
  99.266 + Name:         xamp
  99.267 + Summary:      Apache-MySQL-PHP Server
  99.268 + Packager:     OpenPKG GmbH
  99.269 + Version:      1.0.0
  99.270 + Release:      20120407
  99.271 +  
  99.272 + %description
  99.273 +     This software stack contains a so-called xAMP web stack, consisting
  99.274 +     of the major components Apache, MySQL and PHP.
  99.275 +  
  99.276 + %options
  99.277 +     repo      http://download.openpkg.org/stacks/current/source/
  99.278 +     prefix    /xamp
  99.279 +     user      xamp
  99.280 +     group     xamp
  99.281 +     tag       xamp
  99.282 +     with_ldap no
  99.283 +     with_ssl  no
  99.284 +     addr      127.0.0.1
  99.285 +  
  99.286 + %repository
  99.287 +     %{repo}
  99.288 +  
  99.289 + %framework
  99.290 +     --prefix=%{prefix}
  99.291 +     --user=%{user}
  99.292 +     --group=%{group}
  99.293 +     --tag=%{tag}
  99.294 +  
  99.295 + %packages
  99.296 +     -D apache::with_mod_dav=yes
  99.297 +     -D apache::with_mod_deflate=yes
  99.298 +     -D apache::with_mod_ldap=%{with_ldap}
  99.299 +     -D apache::with_mod_proxy=yes
  99.300 +     -D apache::with_mod_ssl=%{with_ssl}
  99.301 +     -D apache-php::with_curl=yes
  99.302 +     -D apache-php::with_freetype=yes
  99.303 +     -D apache-php::with_gd=yes
  99.304 +     -D apache-php::with_iconv=yes
  99.305 +     -D apache-php::with_json=yes
  99.306 +     -D apache-php::with_mbregex=yes
  99.307 +     -D apache-php::with_mbstring=yes
  99.308 +     -D apache-php::with_mysql=yes
  99.309 +     -D apache-php::with_openldap=%{with_ldap}
  99.310 +     -D apache-php::with_session=yes
  99.311 +     -D apache-php::with_simplexml=yes
  99.312 +     -D apache-php::with_sqlite=yes
  99.313 +     -D apache-php::with_ssl=%{with_ssl}
  99.314 +     -D apache-php::with_xml=yes
  99.315 +     -D apache-php::with_zlib=yes
  99.316 +     apache
  99.317 +     apache-php
  99.318 +     mysql
  99.319 +  
  99.320 + %epilog
  99.321 +     shtool subst \
  99.322 +         -e 's;127\.0\.0\.1:%{addr};g' \
  99.323 +         %{prefix}/etc/apache/apache.conf
  99.324 +     if [ ".%{with_ldap}" = .yes ]; then
  99.325 +         echo "openldap_enable=\"no\"" >>%{prefix}/etc/rc.conf
  99.326 +     fi
  99.327 +  
  99.328 + $ openpkg stack -v4 \
  99.329 +   -Dprefix=/v/xamp -Duser=xamp-sw -Dgroup=xamp-sw \
  99.330 +   --unversioned xamp.stk
  99.331 +
  99.332 + $ openpkg sea -o xamp.src.sh xamp.sh xamp.src.d/
  99.333 +
  99.334 + $ sh xamp.src.sh -v4 -S sudo
  99.335 +
  99.336 + $ openpkg sea -o xamp.bin.sh xamp.sh xamp.*-*.d/
  99.337 +
  99.338 +=head1 HISTORY
  99.339 +
  99.340 +The B<openpkg stack> command was implemented in April 2012 by I<Ralf S. Engelschall>
  99.341 +E<lt>rse@engelschall.comE<gt> for the OpenPKG Framework of the OpenPKG GmbH. 
  99.342 +
  99.343 +=cut
  99.344 +
   100.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   100.2 +++ b/openpkg/stack.sh	Tue Jul 31 12:23:42 2012 +0200
   100.3 @@ -0,0 +1,967 @@
   100.4 +##
   100.5 +##  OpenPKG Software Stack Generation
   100.6 +##  Copyright (c) 2010-2012 OpenPKG GmbH <http://openpkg.com/>
   100.7 +##
   100.8 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
   100.9 +##  All rights reserved. Licenses which grant limited permission to use,
  100.10 +##  copy, modify and distribute this software are available from the
  100.11 +##  OpenPKG GmbH.
  100.12 +##
  100.13 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
  100.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  100.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  100.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  100.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  100.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  100.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  100.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  100.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  100.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  100.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  100.24 +##  SUCH DAMAGE.
  100.25 +##
  100.26 +
  100.27 +#   configuration
  100.28 +openpkg="${OPENPKG_PREFIX}/bin/openpkg"
  100.29 +curl="${OPENPKG_PREFIX}/bin/openpkg curl"
  100.30 +shtool="${OPENPKG_PREFIX}/lib/openpkg/shtool"
  100.31 +
  100.32 +##
  100.33 +##  COMMAND LINE PARSING
  100.34 +##
  100.35 +
  100.36 +str_usage="[-h|--help] [-v|--verbose <level>] [-o|--output <dir>] [-D|--define <name>=<value> ...] [-u|--unversioned] [-q|--query] <name>.stk"
  100.37 +arg_spec="1="
  100.38 +opt_spec="h.v:o:D+u.q."
  100.39 +opt_alias="h:help,v:verbose,o:output,D:define,u:unversioned,q:query"
  100.40 +opt_h=no
  100.41 +opt_v=4
  100.42 +opt_o="."
  100.43 +opt_D=""
  100.44 +opt_u=no
  100.45 +opt_q=no
  100.46 +
  100.47 +#   parse argument specification string
  100.48 +eval `echo $arg_spec |\
  100.49 +      sed -e 's/^\([0-9]*\)\([+=]\)/arg_NUMS=\1; arg_MODE=\2/'`
  100.50 +
  100.51 +#   parse option specification string
  100.52 +eval `echo $opt_spec |\
  100.53 +      sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'`
  100.54 +
  100.55 +#   parse option alias string
  100.56 +eval `echo $opt_alias |\
  100.57 +      sed -e 's/-/_/g' -e 's/\([a-zA-Z0-9]\):\([^,]*\),*/opt_ALIAS_\2=\1;/g'`
  100.58 +
  100.59 +#   interate over argument line
  100.60 +opt_PREV=''
  100.61 +while [ $# -gt 0 ]; do
  100.62 +    #   special option stops processing
  100.63 +    if [ ".$1" = ".--" ]; then
  100.64 +        shift
  100.65 +        break
  100.66 +    fi
  100.67 +
  100.68 +    #   determine option and argument
  100.69 +    opt_ARG_OK=no
  100.70 +    if [ ".$opt_PREV" != . ]; then
  100.71 +        #   merge previous seen option with argument
  100.72 +        opt_OPT="$opt_PREV"
  100.73 +        opt_ARG="$1"
  100.74 +        opt_ARG_OK=yes
  100.75 +        opt_PREV=''
  100.76 +    else
  100.77 +        #   split argument into option and argument
  100.78 +        case "$1" in
  100.79 +            --[a-zA-Z0-9]*=*)
  100.80 +                eval `echo "x$1" |\
  100.81 +                      sed -e 's/^x--\([a-zA-Z0-9-]*\)=\(.*\)$/opt_OPT="\1";opt_ARG="\2"/'`
  100.82 +                opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'`
  100.83 +                eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
  100.84 +                ;;
  100.85 +            --[a-zA-Z0-9]*)
  100.86 +                opt_OPT=`echo "x$1" | cut -c4-`
  100.87 +                opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'`
  100.88 +                eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
  100.89 +                opt_ARG=''
  100.90 +                ;;
  100.91 +            -[a-zA-Z0-9]*)
  100.92 +                eval `echo "x$1" |\
  100.93 +                      sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \
  100.94 +                          -e 's/";\(.*\)$/"; opt_ARG="\1"/'`
  100.95 +                ;;
  100.96 +            -[a-zA-Z0-9])
  100.97 +                opt_OPT=`echo "x$1" | cut -c3-`
  100.98 +                opt_ARG=''
  100.99 +                ;;
 100.100 +            *)
 100.101 +                break
 100.102 +                ;;
 100.103 +        esac
 100.104 +    fi
 100.105 +
 100.106 +    #   eat up option
 100.107 +    shift
 100.108 +
 100.109 +    #   determine whether option needs an argument
 100.110 +    eval "opt_MODE=\$opt_MODE_${opt_OPT}"
 100.111 +    if [ ".$opt_ARG" = . ] && [ ".$opt_ARG_OK" != .yes ]; then
 100.112 +        if [ ".$opt_MODE" = ".:" ] || [ ".$opt_MODE" = ".+" ]; then
 100.113 +            opt_PREV="$opt_OPT"
 100.114 +            continue
 100.115 +        fi
 100.116 +    fi
 100.117 +
 100.118 +    #   process option
 100.119 +    case $opt_MODE in
 100.120 +        '.' )
 100.121 +            #   boolean option
 100.122 +            eval "opt_${opt_OPT}=yes"
 100.123 +            ;;
 100.124 +        ':' )
 100.125 +            #   option with argument (multiple occurances override)
 100.126 +            eval "opt_${opt_OPT}=\"\$opt_ARG\""
 100.127 +            ;;
 100.128 +        '+' )
 100.129 +            #   option with argument (multiple occurances append)
 100.130 +            eval "opt_${opt_OPT}=\"\$opt_${opt_OPT} \$opt_ARG\""
 100.131 +            ;;
 100.132 +        * )
 100.133 +            echo "$0: ERROR: unknown option: \`$opt_OPT'" 1>&2
 100.134 +            exit 1
 100.135 +            ;;
 100.136 +    esac
 100.137 +done
 100.138 +if [ ".$opt_PREV" != . ]; then
 100.139 +    echo "$0: ERROR: missing argument to option \`$opt_PREV'" 1>&2
 100.140 +    exit 1
 100.141 +fi
 100.142 +
 100.143 +#   process help option
 100.144 +if [ ".$opt_h" = .yes ]; then
 100.145 +    echo "Usage: $0 $str_usage"
 100.146 +    exit 0
 100.147 +fi
 100.148 +
 100.149 +#   complain about incorrect number of arguments
 100.150 +case $arg_MODE in
 100.151 +    '=' )
 100.152 +        if [ $# -ne $arg_NUMS ]; then
 100.153 +            echo "$0: ERROR: invalid number of arguments (exactly $arg_NUMS expected)" 1>&2
 100.154 +            exit 1
 100.155 +        fi
 100.156 +        ;;
 100.157 +    '+' )
 100.158 +        if [ $# -lt $arg_NUMS ]; then
 100.159 +            echo "$0: ERROR: invalid number of arguments (at least $arg_NUMS expected)" 1>&2
 100.160 +            exit 1
 100.161 +        fi
 100.162 +        ;;
 100.163 +esac
 100.164 +
 100.165 +##
 100.166 +##  HELPER FUNCTIONS
 100.167 +##
 100.168 +
 100.169 +#   helper function for graceful termination
 100.170 +die () {
 100.171 +    echo "$0: ERROR: $*"
 100.172 +    exit 1
 100.173 +}
 100.174 +
 100.175 +#   helper function for verbose messages
 100.176 +verbose () {
 100.177 +    lvl="$1"
 100.178 +    msg="$2"
 100.179 +    if [ $opt_v -ge $lvl ]; then
 100.180 +        case "$lvl" in
 100.181 +            1 ) str_prefix="**" ;;
 100.182 +            2 ) str_prefix="++" ;;
 100.183 +            3 ) str_prefix="--" ;;
 100.184 +            4 ) str_prefix=".." ;;
 100.185 +        esac
 100.186 +        echo "${str_prefix} ${msg}"
 100.187 +    fi
 100.188 +}
 100.189 +
 100.190 +#   expand macros
 100.191 +macro_expand () {
 100.192 +    stk="$1"
 100.193 +
 100.194 +    #   load all options and their default values
 100.195 +    options=""
 100.196 +    for option in `sed <$stk \
 100.197 +        -e "1,/^%options/d" -e '/^%/,$d' \
 100.198 +        -e 's/#.*$//' -e 's/^ *//' -e 's/ *$//' -e '/^ *$/d' \
 100.199 +        -e 's; *[^ ]*$;;'`; do
 100.200 +        options="$options $option"
 100.201 +    done
 100.202 +    eval `sed <$stk \
 100.203 +        -e "1,/^%options/d" -e '/^%/,$d' \
 100.204 +        -e 's/#.*$//' -e 's/^ *//' -e '/^ *$/d' \
 100.205 +        -e 's:^\([^ ]*\) *\([^ ]*\)$:option_\1="\2";:'`
 100.206 +
 100.207 +    #   override options with defined values
 100.208 +    for define in $opt_D; do
 100.209 +        name=`echo "$define" | sed -e 's;=.*$;;'`
 100.210 +        value=`echo "$define" | sed -e 's;^.*=;;'`
 100.211 +        eval "exists=\"\${option_${name}}\""
 100.212 +        if [ ".$exists" = . ]; then
 100.213 +            die "definition of not-existing option \"$name\""
 100.214 +        fi
 100.215 +        eval "option_${name}=\"${value}\""
 100.216 +    done
 100.217 +
 100.218 +    #   expand macros
 100.219 +    cmd="sed"
 100.220 +    for name in $options; do
 100.221 +        eval "value=\"\${option_${name}}\""
 100.222 +        cmd="$cmd -e 's;%{[?]$name:\\([^}]*\\)};\1;g'"
 100.223 +        cmd="$cmd -e 's;%{![?]$name:\\([^}]*\\)};;g'"
 100.224 +        cmd="$cmd -e 's;%{$name};$value;g'"
 100.225 +    done
 100.226 +    cmd="$cmd -e 's;%{[?][^:}]*:[^}]*};;g'"
 100.227 +    cmd="$cmd -e 's;%{![?][^:}]*:\([^}]*\)};\1;g'"
 100.228 +    eval "$cmd"
 100.229 +}
 100.230 +
 100.231 +#   extract macro-expanded header
 100.232 +header () {
 100.233 +    stk="$1"
 100.234 +    hdr="$2"
 100.235 +    exists=`egrep "^${hdr}" $stk`
 100.236 +    if [ ".$exists" != . ]; then
 100.237 +        egrep "^${hdr}:" $stk | \
 100.238 +        sed -e 's;^[^:]*: *;;' -e 's/#.*$//' -e 's/^ *//' -e 's/ *$//' -e '/^ *$/d' | \
 100.239 +        macro_expand "$stk"
 100.240 +    fi
 100.241 +}
 100.242 +
 100.243 +#   extract macro-expanded section
 100.244 +section () {
 100.245 +    stk="$1"
 100.246 +    sec="$2"
 100.247 +    exists=`egrep "^%${sec}" $stk`
 100.248 +    if [ ".$exists" != . ]; then
 100.249 +        sed <$stk \
 100.250 +            -e "1,/^%${sec}/d" -e '/^%/,$d' \
 100.251 +            -e 's/#.*$//' -e 's/^ *//' -e 's/ *$//' -e '/^ *$/d' | \
 100.252 +        macro_expand "$stk"
 100.253 +    fi
 100.254 +}
 100.255 +
 100.256 +##
 100.257 +##  MAIN
 100.258 +##
 100.259 +
 100.260 +#   determine stack file
 100.261 +stk="$1"
 100.262 +shift
 100.263 +
 100.264 +#   support stand-alone query operation
 100.265 +if [ ".$opt_q" = .yes ]; then
 100.266 +    name=`header "$stk" "Name"`
 100.267 +    summary=`header "$stk" "Summary"`
 100.268 +    packager=`header "$stk" "Packager"`
 100.269 +    version=`header "$stk" "Version"`
 100.270 +    release=`header "$stk" "Release"`
 100.271 +    echo "name=\"$name\";"
 100.272 +    echo "summary=\"$summary\";"
 100.273 +    echo "packager=\"$packager\";"
 100.274 +    echo "version=\"$version\";"
 100.275 +    echo "release=\"$release\";"
 100.276 +    sed <$stk \
 100.277 +        -e "1,/^%options/d" -e '/^%/,$d' \
 100.278 +        -e 's/#.*$//' -e 's/^ *//' -e '/^ *$/d' \
 100.279 +        -e 's:^\([^ ]*\) *\([^ ]*\)$:\1="\2";:'
 100.280 +    exit 0
 100.281 +fi
 100.282 +
 100.283 +#   determine temporary directory
 100.284 +tmpdir="${TMPDIR-/tmp}"
 100.285 +
 100.286 +#   provide verbose header
 100.287 +verbose 1 "OpenPKG Software Stack Generation"
 100.288 +
 100.289 +#   determine information
 100.290 +verbose 2 "determining software stack information"
 100.291 +name=`header "$stk" "Name"`
 100.292 +summary=`header "$stk" "Summary"`
 100.293 +packager=`header "$stk" "Packager"`
 100.294 +version=`header "$stk" "Version"`
 100.295 +release=`header "$stk" "Release"`
 100.296 +verbose 3 "Name:        $name"
 100.297 +verbose 3 "Summary:     $summary"
 100.298 +verbose 3 "Packager:    $packager"
 100.299 +verbose 3 "Version:     $version"
 100.300 +verbose 3 "Release:     $release"
 100.301 +if [ ".$opt_u" = .yes ]; then
 100.302 +    basename="$name"
 100.303 +else
 100.304 +    basename="$name-$version-$release"
 100.305 +fi
 100.306 +
 100.307 +#   determine URLs
 100.308 +verbose 2 "determining software stack packages"
 100.309 +repo=`section "$stk" "repository"`
 100.310 +verbose 3 "repository:  [URL]  $repo"
 100.311 +$openpkg build -r "$repo" -Z -u -K -B \
 100.312 +    `section "$stk" "packages"` | \
 100.313 +    egrep "openpkg curl" | \
 100.314 +    sed -e 's;^.* \([^ ]*\) || exit.*$;\1;' \
 100.315 +        -e '/\/openpkg-[0-9].*\.src\.rpm/{h;s/\.src\.rpm$/.src.sh/;p;x}' \
 100.316 +    >$tmpdir/url.txt
 100.317 +
 100.318 +#   provide header
 100.319 +verbose 2 "assembling software stack sources"
 100.320 +
 100.321 +#   download source packages
 100.322 +if [ ! -d "$opt_o/$basename.src.d" ]; then
 100.323 +    verbose 3 "creating:    [DIR]  $opt_o/$basename.src.d"
 100.324 +    $shtool mkdir -p -m 755 "$opt_o/$basename.src.d"
 100.325 +else
 100.326 +    verbose 3 "reusing:     [DIR]  $opt_o/$basename.src.d"
 100.327 +fi
 100.328 +for url in `cat $tmpdir/url.txt`; do
 100.329 +    url_file=`echo $url | sed -e 's;^.*/\([^/]*\)$;\1;'`
 100.330 +    if [ ! -f "$opt_o/$basename.src.d/$url_file" ]; then
 100.331 +        verbose 3 "downloading: [FILE] $opt_o/$basename.src.d/$url_file"
 100.332 +        if [ $opt_v -ge 4 ]; then
 100.333 +            $curl '-#' -L -k -o $opt_o/$basename.src.d/$url_file $url
 100.334 +        else
 100.335 +            $curl -s -L -k -o $opt_o/$basename.src.d/$url_file $url
 100.336 +        fi
 100.337 +    else
 100.338 +        verbose 3 "reusing:     [FILE] $opt_o/$basename.src.d/$url_file"
 100.339 +    fi
 100.340 +done
 100.341 +for path in $opt_o/$basename.src.d/*.src.sh $opt_o/$basename.src.d/*.src.rpm; do
 100.342 +    if [ ! -f "$path" ]; then
 100.343 +        continue
 100.344 +    fi
 100.345 +    path_file=`echo $path | sed -e 's;^.*/\([^/]*\)$;\1;'`
 100.346 +    found=no
 100.347 +    for url in `cat $tmpdir/url.txt`; do
 100.348 +        url_file=`echo $url | sed -e 's;^.*/\([^/]*\)$;\1;'`
 100.349 +        if [ ".$url_file" = ".$path_file" ]; then
 100.350 +            found=yes
 100.351 +            break
 100.352 +        fi
 100.353 +    done
 100.354 +    if [ ".$found" = .no ]; then
 100.355 +        verbose 3 "removing:    [FILE] $path"
 100.356 +        rm -f "$path"
 100.357 +    fi
 100.358 +done
 100.359 +rm -f $tmpdir/url.txt
 100.360 +
 100.361 +#   generate XML/RDF index for SRPM packages
 100.362 +verbose 3 "generating:  [FILE] $opt_o/$basename.src.d/00INDEX.rdf"
 100.363 +$openpkg index -r "OpenPKG/SRPM" \
 100.364 +    -o $opt_o/$basename.src.d/00INDEX.rdf \
 100.365 +    -i $opt_o/$basename.src.d
 100.366 +
 100.367 +#   generate deployment utility
 100.368 +verbose 3 "generating:  [FILE] $opt_o/$basename.sh"; \
 100.369 +section "$stk" "framework" >$tmpdir/framework.txt
 100.370 +section "$stk" "prolog" >$tmpdir/prolog.txt
 100.371 +section "$stk" "epilog" >$tmpdir/epilog.txt
 100.372 +HAVE_PROLOG=no; if [ ".`cat $tmpdir/prolog.txt`" != . ]; then HAVE_PROLOG=yes; fi
 100.373 +HAVE_EPILOG=no; if [ ".`cat $tmpdir/epilog.txt`" != . ]; then HAVE_EPILOG=yes; fi
 100.374 +$openpkg build -r "$repo" -Z -u -K \
 100.375 +    `section "$stk" "packages"` | \
 100.376 +grep -v "^#" | \
 100.377 +grep -v "^echo" | \
 100.378 +grep -v "^rm" | \
 100.379 +egrep -v "^(if|fi)" | \
 100.380 +grep -v "openpkg curl" | \
 100.381 +grep -v "openpkg rpm -Uvh" | \
 100.382 +sed -e 's;.*openpkg rpm ;;' \
 100.383 +    -e 's; || exit.*;;' \
 100.384 +    -e 's;--rebuild ;;' \
 100.385 +    -e 's;/.*/\([^/]*\.src\.rpm\);\1;' \
 100.386 +    -e 's;^\(.*\) \([^/]*\.src\.rpm\);\2 \1;' \
 100.387 +    -e "s;--define '\\([^ ]*\\) \\([^ ]*\\)';\\1=\\2;g" \
 100.388 +    -e 's;\.src\.rpm;;' \
 100.389 +    >$tmpdir/packages.txt
 100.390 +sed <$0 \
 100.391 +    -e '1,/^____/d' \
 100.392 +    -e "/^CFG_FRAMEWORK=\"/r $tmpdir/framework.txt" \
 100.393 +    -e "/^CFG_PACKAGES=\"/r $tmpdir/packages.txt" \
 100.394 +    -e "s;@HAVE_PROLOG@;$HAVE_PROLOG;" \
 100.395 +    -e "/%prolog/r $tmpdir/prolog.txt" \
 100.396 +    -e "s;@HAVE_EPILOG@;$HAVE_EPILOG;" \
 100.397 +    -e "/%epilog/r $tmpdir/epilog.txt" \
 100.398 +    -e "/^## SHTOOL ##/r $shtool" \
 100.399 +    -e "s;^\\(CFG_NAME=\"\\).*\\(\"\\);\\1$name\\2;" \
 100.400 +    -e "s;^\\(CFG_SUMMARY=\"\\).*\\(\"\\);\\1$summary\\2;" \
 100.401 +    -e "s;^\\(CFG_PACKAGER=\"\\).*\\(\"\\);\\1$packager\\2;" \
 100.402 +    -e "s;^\\(CFG_VERSION=\"\\).*\\(\"\\);\\1$version\\2;" \
 100.403 +    -e "s;^\\(CFG_RELEASE=\"\\).*\\(\"\\);\\1$release\\2;" \
 100.404 +    -e "s;^\\(CFG_UNVERSIONED=\"\\).*\\(\"\\);\\1$opt_u\\2;" \
 100.405 +    >$opt_o/$basename.sh
 100.406 +
 100.407 +#   cleanup
 100.408 +rm -f $tmpdir/framework.txt
 100.409 +rm -f $tmpdir/packages.txt
 100.410 +rm -f $tmpdir/prolog.txt
 100.411 +rm -f $tmpdir/epilog.txt
 100.412 +
 100.413 +#   exit gracefully
 100.414 +exit 0
 100.415 +
 100.416 +##
 100.417 +##  DEPLOYMENT SCRIPT
 100.418 +##
 100.419 +
 100.420 +______________________________________________________________________________
 100.421 +#!/bin/sh
 100.422 +#![OpenPKG]
 100.423 +##
 100.424 +##  OpenPKG Software Stack Deployment
 100.425 +##  Copyright (c) 2010-2012 OpenPKG GmbH <http://openpkg.com/>
 100.426 +##
 100.427 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
 100.428 +##  All rights reserved. Licenses which grant limited permission to use,
 100.429 +##  copy, modify and distribute this software are available from the
 100.430 +##  OpenPKG GmbH.
 100.431 +##
 100.432 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
 100.433 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 100.434 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 100.435 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
 100.436 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 100.437 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 100.438 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 100.439 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 100.440 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 100.441 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 100.442 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 100.443 +##  SUCH DAMAGE.
 100.444 +##
 100.445 +
 100.446 +##
 100.447 +##  COMMAND LINE PARSING
 100.448 +##
 100.449 +
 100.450 +str_usage="[-h|--help] [-v|--verbose <level>] [-c|--cleanup <level>] [-D|--define <name>=<value> ...] [-s|--srcdir <dir>] [-o|--outdir <dir>] [-t|--tmpdir <dir>] [-S <sudo>]"
 100.451 +arg_spec="0="
 100.452 +opt_spec="h.v:c:D+s:o:t:S:"
 100.453 +opt_alias="h:help,v:verbose,c:cleanup,D:define,s:srcdir,o:outdir,t:tmpdir,S:sudo"
 100.454 +opt_h=no
 100.455 +opt_v=3
 100.456 +opt_c=1
 100.457 +opt_D=""
 100.458 +opt_s=""
 100.459 +opt_o=""
 100.460 +opt_t="${TMPDIR-/tmp}"
 100.461 +opt_S=""
 100.462 +
 100.463 +#   parse argument specification string
 100.464 +eval `echo $arg_spec |\
 100.465 +      sed -e 's/^\([0-9]*\)\([+=]\)/arg_NUMS=\1; arg_MODE=\2/'`
 100.466 +
 100.467 +#   parse option specification string
 100.468 +eval `echo $opt_spec |\
 100.469 +      sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'`
 100.470 +
 100.471 +#   parse option alias string
 100.472 +eval `echo $opt_alias |\
 100.473 +      sed -e 's/-/_/g' -e 's/\([a-zA-Z0-9]\):\([^,]*\),*/opt_ALIAS_\2=\1;/g'`
 100.474 +
 100.475 +#   interate over argument line
 100.476 +opt_PREV=''
 100.477 +while [ $# -gt 0 ]; do
 100.478 +    #   special option stops processing
 100.479 +    if [ ".$1" = ".--" ]; then
 100.480 +        shift
 100.481 +        break
 100.482 +    fi
 100.483 +
 100.484 +    #   determine option and argument
 100.485 +    opt_ARG_OK=no
 100.486 +    if [ ".$opt_PREV" != . ]; then
 100.487 +        #   merge previous seen option with argument
 100.488 +        opt_OPT="$opt_PREV"
 100.489 +        opt_ARG="$1"
 100.490 +        opt_ARG_OK=yes
 100.491 +        opt_PREV=''
 100.492 +    else
 100.493 +        #   split argument into option and argument
 100.494 +        case "$1" in
 100.495 +            --[a-zA-Z0-9]*=*)
 100.496 +                eval `echo "x$1" |\
 100.497 +                      sed -e 's/^x--\([a-zA-Z0-9-]*\)=\(.*\)$/opt_OPT="\1";opt_ARG="\2"/'`
 100.498 +                opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'`
 100.499 +                eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
 100.500 +                ;;
 100.501 +            --[a-zA-Z0-9]*)
 100.502 +                opt_OPT=`echo "x$1" | cut -c4-`
 100.503 +                opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'`
 100.504 +                eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
 100.505 +                opt_ARG=''
 100.506 +                ;;
 100.507 +            -[a-zA-Z0-9]*)
 100.508 +                eval `echo "x$1" |\
 100.509 +                      sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \
 100.510 +                          -e 's/";\(.*\)$/"; opt_ARG="\1"/'`
 100.511 +                ;;
 100.512 +            -[a-zA-Z0-9])
 100.513 +                opt_OPT=`echo "x$1" | cut -c3-`
 100.514 +                opt_ARG=''
 100.515 +                ;;
 100.516 +            *)
 100.517 +                break
 100.518 +                ;;
 100.519 +        esac
 100.520 +    fi
 100.521 +
 100.522 +    #   eat up option
 100.523 +    shift
 100.524 +
 100.525 +    #   determine whether option needs an argument
 100.526 +    eval "opt_MODE=\$opt_MODE_${opt_OPT}"
 100.527 +    if [ ".$opt_ARG" = . ] && [ ".$opt_ARG_OK" != .yes ]; then
 100.528 +        if [ ".$opt_MODE" = ".:" ] || [ ".$opt_MODE" = ".+" ]; then
 100.529 +            opt_PREV="$opt_OPT"
 100.530 +            continue
 100.531 +        fi
 100.532 +    fi
 100.533 +
 100.534 +    #   process option
 100.535 +    case $opt_MODE in
 100.536 +        '.' )
 100.537 +            #   boolean option
 100.538 +            eval "opt_${opt_OPT}=yes"
 100.539 +            ;;
 100.540 +        ':' )
 100.541 +            #   option with argument (multiple occurances override)
 100.542 +            eval "opt_${opt_OPT}=\"\$opt_ARG\""
 100.543 +            ;;
 100.544 +        '+' )
 100.545 +            #   option with argument (multiple occurances append)
 100.546 +            eval "opt_${opt_OPT}=\"\$opt_${opt_OPT} \$opt_ARG\""
 100.547 +            ;;
 100.548 +        * )
 100.549 +            echo "$0: ERROR: unknown option: \`$opt_OPT'" 1>&2
 100.550 +            exit 1
 100.551 +            ;;
 100.552 +    esac
 100.553 +done
 100.554 +if [ ".$opt_PREV" != . ]; then
 100.555 +    echo "$0: ERROR: missing argument to option \`$opt_PREV'" 1>&2
 100.556 +    exit 1
 100.557 +fi
 100.558 +
 100.559 +#   process help option
 100.560 +if [ ".$opt_h" = .yes ]; then
 100.561 +    echo "Usage: $0 $str_usage"
 100.562 +    exit 0
 100.563 +fi
 100.564 +
 100.565 +#   complain about incorrect number of arguments
 100.566 +case $arg_MODE in
 100.567 +    '=' )
 100.568 +        if [ $# -ne $arg_NUMS ]; then
 100.569 +            echo "$0: ERROR: invalid number of arguments (exactly $arg_NUMS expected)" 1>&2
 100.570 +            exit 1
 100.571 +        fi
 100.572 +        ;;
 100.573 +    '+' )
 100.574 +        if [ $# -lt $arg_NUMS ]; then
 100.575 +            echo "$0: ERROR: invalid number of arguments (at least $arg_NUMS expected)" 1>&2
 100.576 +            exit 1
 100.577 +        fi
 100.578 +        ;;
 100.579 +esac
 100.580 +
 100.581 +#   helper function for verbose messages
 100.582 +verbose () {
 100.583 +    lvl="$1"
 100.584 +    msg="$2"
 100.585 +    if [ $opt_v -ge $lvl ]; then
 100.586 +        case "$lvl" in
 100.587 +            1 ) str_prefix="**" ;;
 100.588 +            2 ) str_prefix="++" ;;
 100.589 +            3 ) str_prefix="--" ;;
 100.590 +            4 ) str_prefix=".." ;;
 100.591 +        esac
 100.592 +        echo "${str_prefix} ${msg}"
 100.593 +    fi
 100.594 +}
 100.595 +
 100.596 +#   helper function for graceful termination
 100.597 +die () {
 100.598 +    echo "$0: ERROR: $*"
 100.599 +    exit 1
 100.600 +}
 100.601 +
 100.602 +##
 100.603 +##  MAIN
 100.604 +##
 100.605 +
 100.606 +#   the stack information
 100.607 +CFG_NAME=""
 100.608 +CFG_SUMMARY=""
 100.609 +CFG_PACKAGER=""
 100.610 +CFG_VERSION=""
 100.611 +CFG_RELEASE=""
 100.612 +
 100.613 +#   the required OpenPKG framework parameters
 100.614 +CFG_FRAMEWORK="
 100.615 +"
 100.616 +
 100.617 +#   the required OpenPKG packages
 100.618 +#   (in topological order and with build options resolved)
 100.619 +CFG_PACKAGES="
 100.620 +"
 100.621 +
 100.622 +#   whether unversioned output directory should be used
 100.623 +CFG_UNVERSIONED=""
 100.624 +
 100.625 +#   display information
 100.626 +verbose 1 "OpenPKG Software Stack Deployment"
 100.627 +verbose 2 "determining information"
 100.628 +
 100.629 +#   parse OpenPKG framework parameters
 100.630 +params="
 100.631 +    prefix
 100.632 +    user group
 100.633 +    susr musr rusr nusr
 100.634 +    sgrp mgrp rgrp ngrp
 100.635 +    suid muid ruid nuid
 100.636 +    sgid mgid rgid ngid
 100.637 +    tag
 100.638 +"
 100.639 +for param in $params; do
 100.640 +    eval "CF_$param=''"
 100.641 +done
 100.642 +for opt in $CFG_FRAMEWORK; do
 100.643 +    case "$opt" in
 100.644 +        --[a-zA-Z0-9-]*=* )
 100.645 +            name=`echo "$opt" | sed -e 's;^--\([^=]*\)=.*$;\1;'`
 100.646 +            value=`echo "$opt" | sed -e 's;^--[^=]*=\(.*\)$;\1;'`
 100.647 +            eval "CF_$name='$value'"
 100.648 +            ;;
 100.649 +    esac
 100.650 +done
 100.651 +for define in $opt_D; do
 100.652 +    name=`echo "$define" | sed -e 's;=.*$;;'`
 100.653 +    value=`echo "$define" | sed -e 's;^.*=;;'`
 100.654 +    eval "CF_$name='$value'"
 100.655 +done
 100.656 +CFG_FRAMEWORK=''
 100.657 +for name in $params; do
 100.658 +    eval "value=\"\$CF_$name\""
 100.659 +    if [ ".$value" != . ]; then
 100.660 +        if [ ".$CFG_FRAMEWORK" = . ]; then
 100.661 +            CFG_FRAMEWORK="--$name=$value"
 100.662 +        else
 100.663 +            CFG_FRAMEWORK="$CFG_FRAMEWORK --$name=$value"
 100.664 +        fi
 100.665 +    fi
 100.666 +done
 100.667 +if [ ".$CF_musr" = . ]; then CF_musr="$CF_user";    fi
 100.668 +if [ ".$CF_mgrp" = . ]; then CF_mgrp="$CF_group";   fi
 100.669 +if [ ".$CF_rusr" = . ]; then CF_rusr="$CF_user-r";  fi
 100.670 +if [ ".$CF_rgrp" = . ]; then CF_rgrp="$CF_group-r"; fi
 100.671 +if [ ".$CF_nusr" = . ]; then CF_nusr="$CF_user-n";  fi
 100.672 +if [ ".$CF_ngrp" = . ]; then CF_ngrp="$CF_group-n"; fi
 100.673 +verbose 3 "name:     $CFG_NAME"
 100.674 +verbose 3 "summary:  $CFG_SUMMARY"
 100.675 +verbose 3 "packager: $CFG_PACKAGER"
 100.676 +verbose 3 "version:  $CFG_VERSION"
 100.677 +verbose 3 "release:  $CFG_RELEASE"
 100.678 +
 100.679 +#   determine target parameters
 100.680 +if [ ".$CF_prefix" = . ]; then
 100.681 +    die "OpenPKG Framework parameter \"prefix\" required"
 100.682 +fi
 100.683 +prefix="$CF_prefix"
 100.684 +if [ ".$CF_tag" = . ]; then
 100.685 +    die "OpenPKG Framework parameter \"tag\" required"
 100.686 +fi
 100.687 +tag="$CF_tag"
 100.688 +shtool="$opt_t/$CFG_NAME-$CFG_VERSION-$CFG_RELEASE.shtool.sh"
 100.689 +sed <$0 -e '1,/^## SHTOOL ##.*/d' >$shtool
 100.690 +platform=`sh $shtool platform -n -L -S "" -C "+" -F '%<ap>-%<sp>'`
 100.691 +verbose 3 "platform: $platform"
 100.692 +verbose 3 "tag:      $tag"
 100.693 +verbose 3 "prefix:   $prefix"
 100.694 +
 100.695 +#   determine operation directories
 100.696 +srcdir="$opt_s"
 100.697 +if [ ".$srcdir" = . ]; then
 100.698 +    srcdir="$CFG_NAME-$CFG_VERSION-$CFG_RELEASE.src.d"
 100.699 +fi
 100.700 +tmpdir="$opt_t/$CFG_NAME-$CFG_VERSION-$CFG_RELEASE.d"
 100.701 +if [ ! -d "$tmpdir" ]; then
 100.702 +    (   umask 077
 100.703 +        rm -rf "$tmpdir" >/dev/null 2>&1 || true
 100.704 +        sh $shtool mkdir -p -m 700 "$tmpdir" >/dev/null 2>&1
 100.705 +        if [ $? -ne 0 ]; then
 100.706 +            die "failed to create temporary directory: \"$tmpdir\""
 100.707 +        fi
 100.708 +    ) || exit $?
 100.709 +fi
 100.710 +outdir="$opt_o"
 100.711 +if [ ".$outdir" = . ]; then
 100.712 +    if [ ".$CFG_UNVERSIONED" = .yes ]; then
 100.713 +        outdir="$CFG_NAME.$platform-$tag.d"
 100.714 +    else
 100.715 +        outdir="$CFG_NAME-$CFG_VERSION-$CFG_RELEASE.$platform-$tag.d"
 100.716 +    fi
 100.717 +fi
 100.718 +if [ ! -d "$outdir" ]; then
 100.719 +    sh $shtool mkdir -p -m 755 "$outdir" >/dev/null 2>&1
 100.720 +    if [ $? -ne 0 ]; then
 100.721 +        die "failed to create output directory: \"$outdir\""
 100.722 +    fi
 100.723 +fi
 100.724 +verbose 3 "srcdir:   $srcdir"
 100.725 +verbose 3 "outdir:   $outdir"
 100.726 +verbose 3 "tmpdir:   $tmpdir"
 100.727 +
 100.728 +#   execute prolog script
 100.729 +if [ ".@HAVE_PROLOG@" = .yes ]; then
 100.730 +    verbose 2 "execute prolog script"
 100.731 +    cat >$tmpdir/prolog.sh <<EOT
 100.732 +#!/bin/sh
 100.733 +#![OpenPKG]
 100.734 +# %prolog
 100.735 +EOT
 100.736 +    $opt_S sh $tmpdir/prolog.sh
 100.737 +    rm -f $tmpdir/prolog.sh
 100.738 +fi
 100.739 +
 100.740 +if [ $opt_c -le 1 -a -x "$prefix/bin/openpkg" ]; then
 100.741 +    #   optionally fresh-up OpenPKG instance
 100.742 +    pkgs=`$prefix/bin/openpkg rpm -qa | egrep -v '^(openpkg-[0-9]|gpg-pubkey-)'`
 100.743 +    if [ ".$pkgs" != . ]; then
 100.744 +        verbose 2 "uninstall already installed OpenPKG packages"
 100.745 +        for pkg in $pkgs; do
 100.746 +            verbose 3 "REMOVE: $pkg @ $prefix"
 100.747 +        done
 100.748 +        $opt_S $prefix/bin/openpkg rpm -e $pkgs || \
 100.749 +            die "failed to uninstall already installed OpenPKG packages"
 100.750 +    fi
 100.751 +fi
 100.752 +if [ $opt_c -le 0 -a -x "$prefix/bin/openpkg" ]; then
 100.753 +    #   optionally destroy OpenPKG instance
 100.754 +    verbose 2 "destroy existing OpenPKG framework"
 100.755 +    $opt_S $prefix/bin/openpkg rpm -e openpkg || \
 100.756 +        die "failed to destroy existing OpenPKG framework"
 100.757 +fi
 100.758 +
 100.759 +#   check whether an already existing OpenPKG instance can be reused
 100.760 +if [ -x "$prefix/bin/openpkg" ]; then
 100.761 +    verbose 2 "checking compatibility of existing OpenPKG framework"
 100.762 +    for name in $params; do
 100.763 +        case "$name" in
 100.764 +            user|group ) continue ;;
 100.765 +        esac
 100.766 +        eval "value_required=\"\$CF_$name\""
 100.767 +        if [ ".$value_required" != . ]; then
 100.768 +            value_existing=`$prefix/bin/openpkg rpm --eval "%{l_${name}}"`
 100.769 +            if [ ".$value_existing" != ".$value_required" ]; then
 100.770 +                die "conflict on parameter \"$name\": value required: \"$value_required\", value existing: \"$value_existing\""
 100.771 +            fi
 100.772 +        fi
 100.773 +    done
 100.774 +fi
 100.775 +
 100.776 +#   install or upgrade all packages
 100.777 +verbose 2 "install or upgrade all OpenPKG packages"
 100.778 +DIFS="$IFS"
 100.779 +OIFS="$IFS"; IFS="
 100.780 +"
 100.781 +for spec in $CFG_PACKAGES; do
 100.782 +    #   determine information
 100.783 +    pkg=`echo "$spec"    | sed -e 's;^\([^ ]*\).*$;\1;'`
 100.784 +    opts=`echo "$spec"   | sed -e 's;^[^ ]*;;' -e 's;^ *;;'`
 100.785 +    name=`echo "$pkg"    | sed -e 's;^\(.*\)-[^-][^-]*-[^-][^-]*$;\1;'`
 100.786 +    version=`echo "$pkg" | sed -e 's;^.*-\([^-][^-]*\)-[^-][^-]*$;\1;'`
 100.787 +    release=`echo "$pkg" | sed -e 's;^.*-[^-][^-]*-\([^-][^-]*\)$;\1;'`
 100.788 +
 100.789 +    if [ ".$name" = .openpkg ]; then
 100.790 +        #
 100.791 +        #   OpenPKG Framework
 100.792 +        #
 100.793 +        if [   ! -f "$outdir/$pkg.$platform-$tag.sh" \
 100.794 +            -o ! -f "$outdir/$pkg.$platform-$tag.rpm" ]; then
 100.795 +            #   build (bootstrap & regular)
 100.796 +            verbose 3 "BOOTSTRAP-BUILD: $srcdir/$pkg.src.sh"
 100.797 +            verbose 4 "options: $CFG_FRAMEWORK"
 100.798 +            if [ ! -f "$srcdir/$pkg.src.sh" ]; then
 100.799 +                die "source shell package not existing: $srcdir/$pkg.src.sh"
 100.800 +            fi
 100.801 +            (   TMPDIR="$tmpdir"
 100.802 +                srcdir="`cd $srcdir && pwd`"
 100.803 +                cd "$outdir" || exit $?
 100.804 +                cmd="sh \"$srcdir/$pkg.src.sh\" $CFG_FRAMEWORK"
 100.805 +                if [ $opt_v -lt 4 ]; then cmd="$cmd >/dev/null 2>&1"; fi
 100.806 +                eval "$cmd" || \
 100.807 +                    die "failed to build package \"$srcdir/$pkg.src.sh\""
 100.808 +                rm -f $pkg.src.rpm
 100.809 +            ) || exit $?
 100.810 +        fi
 100.811 +        if [ ! -x "$prefix/bin/openpkg" ]; then
 100.812 +            #   install (bootstrap)
 100.813 +            if [ ! -f "$outdir/$pkg.$platform-$tag.sh" ]; then
 100.814 +                die "binary shell package not existing: $outdir/$pkg.$platform-$tag.sh"
 100.815 +            fi
 100.816 +            verbose 3 "BOOTSTRAP-INSTALL: $outdir/$pkg.$platform-$tag.sh"
 100.817 +            cmd="$opt_S sh \"$outdir/$pkg.$platform-$tag.sh\""
 100.818 +            if [ $opt_v -lt 4 ]; then cmd="$cmd >/dev/null 2>&1"; fi
 100.819 +            eval "$cmd" || \
 100.820 +                die "failed to install package \"$outdir/$pkg.$platform-$tag.sh\""
 100.821 +        else
 100.822 +            check=`$prefix/bin/openpkg rpm -q openpkg 2>/dev/null`
 100.823 +            if [ ".$check" != ".$pkg" ]; then
 100.824 +                #   upgrade (regular)
 100.825 +                if [ ! -f "$outdir/$pkg.$platform-$tag.rpm" ]; then
 100.826 +                    die "binary RPM package not existing: $outdir/$pkg.$platform-$tag.rpm"
 100.827 +                fi
 100.828 +                verbose 3 "UPGRADE: $outdir/$pkg.$platform-$tag.rpm"
 100.829 +                rpm_opt="-U"; if [ $opt_v -ge 4 ]; then rpm_opt="${rpm_opt}vh"; fi
 100.830 +                $opt_S $prefix/bin/openpkg rpm $rpm_opt \
 100.831 +                    $outdir/$pkg.$platform-$tag.rpm || \
 100.832 +                    die "failed to upgrade package: $outdir/$pkg.$platform-$tag.rpm"
 100.833 +            else
 100.834 +                #   keep as-is
 100.835 +                verbose 3 "KEEP AS-IS: $pkg @ $prefix"
 100.836 +            fi
 100.837 +        fi
 100.838 +    else
 100.839 +        #
 100.840 +        #   OpenPKG Packages
 100.841 +        #
 100.842 +        if [ ! -x "$prefix/bin/openpkg" ]; then
 100.843 +            #   usually will not happen because of correctly
 100.844 +            #   generated topologically correct package list
 100.845 +            die "command \"$prefix/bin/openpkg\" has to exit for building a regular OpenPKG package" 1>&2
 100.846 +        fi
 100.847 +        if [ ! -f $outdir/$pkg.$platform-$tag.rpm ]; then
 100.848 +            #    build (regular)
 100.849 +            if [ ! -f "$srcdir/$pkg.src.rpm" ]; then
 100.850 +                die "source RPM package not existing: $srcdir/$pkg.src.rpm"
 100.851 +            fi
 100.852 +            verbose 3 "BUILD: $srcdir/$pkg.src.rpm"
 100.853 +            if [ ".$opts" != . ]; then
 100.854 +                verbose 4 "options: $opts"
 100.855 +            fi
 100.856 +            rm -rf "$tmpdir/$pkg" >/dev/null 2>&1 || true
 100.857 +            sh $shtool mkdir -p -m 755 "$tmpdir/$pkg" >/dev/null 2>&1
 100.858 +            cmd="$prefix/bin/openpkg --keep-privileges"
 100.859 +            cmd="$cmd rpm --rebuild"
 100.860 +            cmd="$cmd --define \"_specdir   $tmpdir/$pkg\""
 100.861 +            cmd="$cmd --define \"_sourcedir $tmpdir/$pkg\""
 100.862 +            cmd="$cmd --define \"_builddir  $tmpdir/$pkg\""
 100.863 +            cmd="$cmd --define \"_tmppath   $tmpdir/$pkg\""
 100.864 +            cmd="$cmd --define \"_srcrpmdir $tmpdir/$pkg\""
 100.865 +            cmd="$cmd --define \"_rpmdir    $outdir\""
 100.866 +            OIFS2="$IFS"; IFS="$DIFS"
 100.867 +            for opt in $opts; do
 100.868 +                opt_name=`echo "$opt" | sed -e 's;^\([^=]*\)=.*$;\1;'`
 100.869 +                opt_value=`echo "$opt" | sed -e 's;^[^=]*=\(.*\)$;\1;'`
 100.870 +                cmd="$cmd --define \"$opt_name $opt_value\""
 100.871 +            done
 100.872 +            IFS="$OIFS2"
 100.873 +            cmd="$cmd $srcdir/$pkg.src.rpm"
 100.874 +            if [ $opt_v -lt 4 ]; then cmd="$cmd >/dev/null 2>&1"; fi
 100.875 +            eval "$cmd" || \
 100.876 +                die "failed to build package \"$srcdir/$pkg.src.rpm\""
 100.877 +        fi
 100.878 +        check=`$prefix/bin/openpkg rpm -q "$name" 2>/dev/null`
 100.879 +        if [ ".$check" = ".package $name is not installed" ]; then
 100.880 +            #   install (regular)
 100.881 +            if [ ! -f "$outdir/$pkg.$platform-$tag.rpm" ]; then
 100.882 +                die "binary RPM package not existing: $outdir/$pkg.$platform-$tag.rpm"
 100.883 +            fi
 100.884 +            verbose 3 "INSTALL: $outdir/$pkg.$platform-$tag.rpm"
 100.885 +            rpm_opt="-i"; if [ $opt_v -ge 4 ]; then rpm_opt="${rpm_opt}vh"; fi
 100.886 +            $opt_S $prefix/bin/openpkg rpm $rpm_opt \
 100.887 +                $outdir/$pkg.$platform-$tag.rpm || \
 100.888 +                die "failed to install package: $outdir/$pkg.$platform-$tag.rpm"
 100.889 +        elif [ ".$check" != ".$pkg" ]; then
 100.890 +            #   upgrade (regular)
 100.891 +            if [ ! -f "$outdir/$pkg.$platform-$tag.rpm" ]; then
 100.892 +                die "binary RPM package not existing: $outdir/$pkg.$platform-$tag.rpm"
 100.893 +            fi
 100.894 +            verbose 3 "UPGRADE: $outdir/$pkg.$platform-$tag.rpm"
 100.895 +            rpm_opt="-U"; if [ $opt_v -ge 4 ]; then rpm_opt="${rpm_opt}vh"; fi
 100.896 +            $opt_S $prefix/bin/openpkg rpm $rpm_opt \
 100.897 +                $outdir/$pkg.$platform-$tag.rpm || \
 100.898 +                die "failed to upgrade package: $outdir/$pkg.$platform-$tag.rpm"
 100.899 +        else
 100.900 +            #   keep as-is
 100.901 +            verbose 3 "KEEP AS-IS: $pkg @ $prefix"
 100.902 +        fi
 100.903 +    fi
 100.904 +done
 100.905 +IFS="$OIFS"
 100.906 +
 100.907 +#   optionally remove residue packages from binary RPM package directory
 100.908 +if [ $opt_c -lt 3 ]; then
 100.909 +    verbose 2 "cleanup target directory from residue packages"
 100.910 +    for pkg in $outdir/*.sh $outdir/*.rpm; do
 100.911 +        if [ ! -f "$pkg" ]; then
 100.912 +            continue
 100.913 +        fi
 100.914 +        pkg_base=`echo "$pkg" | sed -e 's;^.*/\([^/][^/]*-[0-9][^/-]*-[0-9][0-9.]*\)\.[^/][^/]*$;\1;'`
 100.915 +        erase=yes
 100.916 +        for spec in $CFG_PACKAGES; do
 100.917 +            spec_base=`echo "$spec" | sed -e 's;^\(.*-[^-][^-]*-[^-][^-]*\).*$;\1;'`
 100.918 +            if [ ".$pkg_base" = ".$spec_base" ]; then
 100.919 +                erase=no
 100.920 +                break
 100.921 +            fi
 100.922 +        done
 100.923 +        if [ ".$erase" = .yes ]; then
 100.924 +            verbose 3 "REMOVE: $pkg"
 100.925 +            rm -f "$pkg"
 100.926 +        fi
 100.927 +    done
 100.928 +fi
 100.929 +
 100.930 +#   optionally remove residue packages from OpenPKG instance
 100.931 +if [ $opt_c -lt 3 ]; then
 100.932 +    verbose 2 "cleanup OpenPKG instance from residue packages"
 100.933 +    for pkg1 in `$prefix/bin/openpkg rpm -qa | egrep -v '^(openpkg-[0-9]|gpg-pubkey-)'`; do
 100.934 +        name1=`echo "$pkg1" | sed -e 's;^\(.*\)-[^-][^-]*-[^-][^-]*$;\1;'`
 100.935 +        erase=yes
 100.936 +        for spec in $CFG_PACKAGES; do
 100.937 +            name2=`echo "$spec" | sed -e 's;^\(.*\)-[^-][^-]*-[^-][^-]*.*$;\1;'`
 100.938 +            if [ ".$name1" = ".$name2" ]; then
 100.939 +                erase=no
 100.940 +                break
 100.941 +            fi
 100.942 +        done
 100.943 +        if [ ".$erase" = .yes ]; then
 100.944 +            verbose 3 "REMOVE: pkg1 @ $prefix"
 100.945 +            $opt_S $prefix/bin/openpkg rpm -e "$pkg1" || \
 100.946 +                die "failed to erase residue package \"$pkg1\""
 100.947 +        fi
 100.948 +    done
 100.949 +fi
 100.950 +
 100.951 +#   execute epilog script
 100.952 +if [ ".@HAVE_EPILOG@" = .yes ]; then
 100.953 +    verbose 2 "execute epilog script"
 100.954 +    cat >$tmpdir/epilog.sh <<EOT
 100.955 +#!/bin/sh
 100.956 +#![OpenPKG]
 100.957 +# %epilog
 100.958 +EOT
 100.959 +    $opt_S sh $tmpdir/epilog.sh
 100.960 +    rm -f $tmpdir/epilog.sh
 100.961 +fi
 100.962 +
 100.963 +#   cleanup
 100.964 +rm -f  $shtool >/dev/null 3>&1 || true
 100.965 +rm -rf $tmpdir >/dev/null 2>&1 || true
 100.966 +
 100.967 +exit 0
 100.968 +
 100.969 +## SHTOOL ###################################################################
 100.970 +
   101.1 --- a/openpkg/tar.patch	Tue Jul 31 12:12:54 2012 +0200
   101.2 +++ b/openpkg/tar.patch	Tue Jul 31 12:23:42 2012 +0200
   101.3 @@ -1,7 +1,7 @@
   101.4  Index: Makefile.in
   101.5 ---- Makefile.in.orig	2010-03-10 11:52:09.000000000 +0100
   101.6 -+++ Makefile.in	2010-03-10 18:28:13.000000000 +0100
   101.7 -@@ -899,7 +899,7 @@
   101.8 +--- Makefile.in.orig	2011-03-12 10:50:13.000000000 +0100
   101.9 ++++ Makefile.in	2011-07-31 17:41:03.000000000 +0200
  101.10 +@@ -1028,7 +1028,7 @@
  101.11   top_srcdir = @top_srcdir@
  101.12   ACLOCAL_AMFLAGS = -I m4
  101.13   EXTRA_DIST = ChangeLog.1 Make.rules
  101.14 @@ -11,21 +11,23 @@
  101.15   prev_change_log = ChangeLog.CVS
  101.16   changelog_dir = .
  101.17  Index: gnu/argp-help.c
  101.18 ---- gnu/argp-help.c.orig	2010-03-10 11:50:33.000000000 +0100
  101.19 -+++ gnu/argp-help.c	2010-03-10 18:26:15.000000000 +0100
  101.20 -@@ -571,8 +571,7 @@
  101.21 +--- gnu/argp-help.c.orig	2011-03-12 10:14:26.000000000 +0100
  101.22 ++++ gnu/argp-help.c	2011-07-31 17:44:24.000000000 +0200
  101.23 +@@ -571,10 +571,7 @@
  101.24     return val;
  101.25   }
  101.26   
  101.27  -static inline int
  101.28 +-#if __GNUC__ >= 3
  101.29  -__attribute__ ((always_inline))
  101.30 +-#endif
  101.31  +static int
  101.32   hol_entry_long_iterate (const struct hol_entry *entry,
  101.33                           int (*func)(const struct argp_option *opt,
  101.34                                       const struct argp_option *real,
  101.35  Index: gnu/strerror.c
  101.36 ---- gnu/strerror.c.orig	2010-03-10 11:50:43.000000000 +0100
  101.37 -+++ gnu/strerror.c	2010-03-10 18:26:15.000000000 +0100
  101.38 +--- gnu/strerror.c.orig	2011-03-12 10:14:33.000000000 +0100
  101.39 ++++ gnu/strerror.c	2011-07-31 17:41:03.000000000 +0200
  101.40  @@ -25,6 +25,7 @@
  101.41   
  101.42   # include <errno.h>
  101.43 @@ -34,33 +36,9 @@
  101.44   
  101.45   # if GNULIB_defined_ESOCK /* native Windows platforms */
  101.46   #  if HAVE_WINSOCK2_H
  101.47 -Index: src/compare.c
  101.48 ---- src/compare.c.orig	2010-01-26 12:28:09.000000000 +0100
  101.49 -+++ src/compare.c	2010-03-10 18:26:15.000000000 +0100
  101.50 -@@ -277,7 +277,7 @@
  101.51 -   size_t len = strlen (current_stat_info.link_name);
  101.52 -   char *linkbuf = alloca (len + 1);
  101.53 - 
  101.54 --  int status = readlink (current_stat_info.file_name, linkbuf, len + 1);
  101.55 -+  int status = readlink (current_stat_info.file_name, linkbuf, len);
  101.56 - 
  101.57 -   if (status < 0)
  101.58 -     {
  101.59 -Index: src/create.c
  101.60 ---- src/create.c.orig	2010-03-09 13:52:41.000000000 +0100
  101.61 -+++ src/create.c	2010-03-10 18:26:15.000000000 +0100
  101.62 -@@ -1690,7 +1690,7 @@
  101.63 -       if (linklen != st->stat.st_size || linklen + 1 == 0)
  101.64 - 	xalloc_die ();
  101.65 -       buffer = (char *) alloca (linklen + 1);
  101.66 --      size = readlink (p, buffer, linklen + 1);
  101.67 -+      size = readlink (p, buffer, linklen);
  101.68 -       if (size < 0)
  101.69 - 	{
  101.70 - 	  file_removed_diag (p, top_level, readlink_diag);
  101.71  Index: src/tar.c
  101.72 ---- src/tar.c.orig	2010-03-09 13:52:41.000000000 +0100
  101.73 -+++ src/tar.c	2010-03-10 18:26:15.000000000 +0100
  101.74 +--- src/tar.c.orig	2010-10-24 20:07:55.000000000 +0200
  101.75 ++++ src/tar.c	2011-07-31 17:41:03.000000000 +0200
  101.76  @@ -20,6 +20,7 @@
  101.77      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  101.78   
  101.79 @@ -70,8 +48,8 @@
  101.80   #include <fnmatch.h>
  101.81   #include <argp.h>
  101.82  Index: src/utf8.c
  101.83 ---- src/utf8.c.orig	2010-01-26 12:30:20.000000000 +0100
  101.84 -+++ src/utf8.c	2010-03-10 18:26:15.000000000 +0100
  101.85 +--- src/utf8.c.orig	2010-01-22 18:18:15.000000000 +0100
  101.86 ++++ src/utf8.c	2011-07-31 17:41:03.000000000 +0200
  101.87  @@ -22,6 +22,9 @@
  101.88   #include "common.h"
  101.89   #ifdef HAVE_ICONV_H
  101.90 @@ -83,8 +61,8 @@
  101.91   
  101.92   #ifndef ICONV_CONST
  101.93  Index: src/xheader.c
  101.94 ---- src/xheader.c.orig	2010-02-12 11:03:09.000000000 +0100
  101.95 -+++ src/xheader.c	2010-03-10 18:26:15.000000000 +0100
  101.96 +--- src/xheader.c.orig	2010-11-27 12:18:49.000000000 +0100
  101.97 ++++ src/xheader.c	2011-07-31 17:41:03.000000000 +0200
  101.98  @@ -26,6 +26,10 @@
  101.99   
 101.100   #include "common.h"
 101.101 @@ -93,6 +71,6 @@
 101.102  +# define SIZE_MAX ((size_t) -1)
 101.103  +#endif
 101.104  +
 101.105 + static void xheader_init (struct xheader *xhdr);
 101.106   static bool xheader_protected_pattern_p (char const *pattern);
 101.107   static bool xheader_protected_keyword_p (char const *keyword);
 101.108 - static void xheader_set_single_keyword (char *) __attribute__ ((noreturn));
   102.1 --- a/openpkg/uuid.8	Tue Jul 31 12:12:54 2012 +0200
   102.2 +++ b/openpkg/uuid.8	Tue Jul 31 12:23:42 2012 +0200
   102.3 @@ -1,15 +1,7 @@
   102.4 -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
   102.5 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
   102.6  .\"
   102.7  .\" Standard preamble:
   102.8  .\" ========================================================================
   102.9 -.de Sh \" Subsection heading
  102.10 -.br
  102.11 -.if t .Sp
  102.12 -.ne 5
  102.13 -.PP
  102.14 -\fB\\$1\fR
  102.15 -.PP
  102.16 -..
  102.17  .de Sp \" Vertical space (when we can't use .PP)
  102.18  .if t .sp .5v
  102.19  .if n .sp
  102.20 @@ -25,11 +17,11 @@
  102.21  ..
  102.22  .\" Set up some character translations and predefined strings.  \*(-- will
  102.23  .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
  102.24 -.\" double quote, and \*(R" will give a right double quote.  | will give a
  102.25 -.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
  102.26 -.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
  102.27 -.\" expand to `' in nroff, nothing in troff, for use with C<>.
  102.28 -.tr \(*W-|\(bv\*(Tr
  102.29 +.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
  102.30 +.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
  102.31 +.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
  102.32 +.\" nothing in troff, for use with C<>.
  102.33 +.tr \(*W-
  102.34  .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
  102.35  .ie n \{\
  102.36  .    ds -- \(*W-
  102.37 @@ -48,22 +40,25 @@
  102.38  .    ds R" ''
  102.39  'br\}
  102.40  .\"
  102.41 +.\" Escape single quotes in literal strings from groff's Unicode transform.
  102.42 +.ie \n(.g .ds Aq \(aq
  102.43 +.el       .ds Aq '
  102.44 +.\"
  102.45  .\" If the F register is turned on, we'll generate index entries on stderr for
  102.46 -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
  102.47 +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  102.48  .\" entries marked with X<> in POD.  Of course, you'll have to process the
  102.49  .\" output yourself in some meaningful fashion.
  102.50 -.if \nF \{\
  102.51 +.ie \nF \{\
  102.52  .    de IX
  102.53  .    tm Index:\\$1\t\\n%\t"\\$2"
  102.54  ..
  102.55  .    nr % 0
  102.56  .    rr F
  102.57  .\}
  102.58 -.\"
  102.59 -.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
  102.60 -.\" way too many mistakes in technical documents.
  102.61 -.hy 0
  102.62 -.if n .na
  102.63 +.el \{\
  102.64 +.    de IX
  102.65 +..
  102.66 +.\}
  102.67  .\"
  102.68  .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
  102.69  .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
  102.70 @@ -130,8 +125,12 @@
  102.71  .\"
  102.72  .IX Title "UUID 8"
  102.73  .TH UUID 8 "OpenPKG" "UUID(8)" "OpenPKG"
  102.74 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
  102.75 +.\" way too many mistakes in technical documents.
  102.76 +.if n .ad l
  102.77 +.nh
  102.78  .SH "NAME"
  102.79 -\&\fBopenpkg uuid\fR \- OpenPKG UUID Update Utility
  102.80 +openpkg uuid \- OpenPKG UUID Update Utility
  102.81  .SH "SYNOPSIS"
  102.82  .IX Header "SYNOPSIS"
  102.83  \&\fBopenpkg uuid\fR [\fB\-\-verbose\fR] [\fB\-\-multicast\fR] \fBreset\fR|\fBupdate\fR|\fBinfo\fR
  102.84 @@ -228,9 +227,9 @@
  102.85  content is:
  102.86  .PP
  102.87  .Vb 3
  102.88 -\& UUID_REGISTRY="81eca44e-4d18-11d8-a837-0090272ff725"
  102.89 -\& UUID_INSTANCE="c55a8d2d-31bb-3ae0-9edb-68337af61acc"
  102.90 -\& UUID_PLATFORM="05ec2532-9e3f-37dc-a7ed-b291c2c463ed"
  102.91 +\& UUID_REGISTRY="81eca44e\-4d18\-11d8\-a837\-0090272ff725"
  102.92 +\& UUID_INSTANCE="c55a8d2d\-31bb\-3ae0\-9edb\-68337af61acc"
  102.93 +\& UUID_PLATFORM="05ec2532\-9e3f\-37dc\-a7ed\-b291c2c463ed"
  102.94  .Ve
  102.95  .SH "CAVEATS"
  102.96  .IX Header "CAVEATS"
  102.97 @@ -242,7 +241,7 @@
  102.98  .PP
  102.99  .Vb 2
 102.100  \& $ openpkg uuid reset
 102.101 -\& $ openpkg uuid --multicast update
 102.102 +\& $ openpkg uuid \-\-multicast update
 102.103  .Ve
 102.104  .SH "SEE ALSO"
 102.105  .IX Header "SEE ALSO"
   103.1 --- a/openpkg/uuid.pod	Tue Jul 31 12:12:54 2012 +0200
   103.2 +++ b/openpkg/uuid.pod	Tue Jul 31 12:23:42 2012 +0200
   103.3 @@ -1,14 +1,13 @@
   103.4  ##
   103.5  ##  uuid -- OpenPKG UUID Update Utility
   103.6 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
   103.7 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
   103.8 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
   103.9  ##
  103.10 -##  Permission to use, copy, modify, and distribute this software for
  103.11 -##  any purpose with or without fee is hereby granted, provided that
  103.12 -##  the above copyright notice and this permission notice appear in all
  103.13 -##  copies.
  103.14 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
  103.15 +##  All rights reserved. Licenses which grant limited permission to use,
  103.16 +##  copy, modify and distribute this software are available from the
  103.17 +##  OpenPKG GmbH.
  103.18  ##
  103.19 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  103.20 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
  103.21  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  103.22  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  103.23  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   104.1 --- a/openpkg/uuid.sh	Tue Jul 31 12:12:54 2012 +0200
   104.2 +++ b/openpkg/uuid.sh	Tue Jul 31 12:23:42 2012 +0200
   104.3 @@ -1,15 +1,14 @@
   104.4  #!@l_prefix@/lib/openpkg/bash
   104.5  ##
   104.6  ##  uuid -- OpenPKG UUID Update Utility
   104.7 -##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
   104.8 -##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
   104.9 +##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
  104.10  ##
  104.11 -##  Permission to use, copy, modify, and distribute this software for
  104.12 -##  any purpose with or without fee is hereby granted, provided that
  104.13 -##  the above copyright notice and this permission notice appear in all
  104.14 -##  copies.
  104.15 +##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
  104.16 +##  All rights reserved. Licenses which grant limited permission to use,
  104.17 +##  copy, modify and distribute this software are available from the
  104.18 +##  OpenPKG GmbH.
  104.19  ##
  104.20 -##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  104.21 +##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
  104.22  ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  104.23  ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  104.24  ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   105.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   105.2 +++ b/openpkg/xz.patch	Tue Jul 31 12:23:42 2012 +0200
   105.3 @@ -0,0 +1,43 @@
   105.4 +Index: Makefile.in
   105.5 +--- Makefile.in.orig	2012-06-22 13:56:07.000000000 +0200
   105.6 ++++ Makefile.in	2012-06-27 10:11:55.000000000 +0200
   105.7 +@@ -333,7 +333,7 @@
   105.8 + # Use -n to prevent gzip from adding a timestamp to the .gz headers.
   105.9 + GZIP_ENV = -9n
  105.10 + DIST_SUBDIRS = lib src po tests debug
  105.11 +-SUBDIRS = $(am__append_1) src po tests
  105.12 ++SUBDIRS = $(am__append_1) src
  105.13 + dist_doc_DATA = \
  105.14 + 	AUTHORS \
  105.15 + 	COPYING \
  105.16 +Index: configure
  105.17 +--- configure.orig	2012-06-22 13:56:05.000000000 +0200
  105.18 ++++ configure	2012-06-27 10:11:55.000000000 +0200
  105.19 +@@ -17680,26 +17680,7 @@
  105.20 + 	#     don't seem so useful here; at least the last one gives some
  105.21 + 	#     warnings which are not bugs.
  105.22 + 	for NEW_FLAG in \
  105.23 +-			-Wall \
  105.24 +-			-Wextra \
  105.25 +-			-Wformat=2 \
  105.26 +-			-Winit-self \
  105.27 +-			-Wmissing-include-dirs \
  105.28 +-			-Wstrict-aliasing \
  105.29 +-			-Wfloat-equal \
  105.30 +-			-Wundef \
  105.31 +-			-Wshadow \
  105.32 +-			-Wpointer-arith \
  105.33 +-			-Wbad-function-cast \
  105.34 +-			-Wwrite-strings \
  105.35 +-			-Wlogical-op \
  105.36 +-			-Waggregate-return \
  105.37 +-			-Wstrict-prototypes \
  105.38 +-			-Wold-style-definition \
  105.39 +-			-Wmissing-prototypes \
  105.40 +-			-Wmissing-declarations \
  105.41 +-			-Wmissing-noreturn \
  105.42 +-			-Wredundant-decls
  105.43 ++        none
  105.44 + 	do
  105.45 + 		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts $NEW_FLAG" >&5
  105.46 + $as_echo_n "checking if $CC accepts $NEW_FLAG... " >&6; }
   106.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   106.2 +++ b/openpkg/zlib.patch	Tue Jul 31 12:23:42 2012 +0200
   106.3 @@ -0,0 +1,20 @@
   106.4 +Index: Makefile.in
   106.5 +--- Makefile.in.orig	2012-04-23 07:58:06.000000000 +0200
   106.6 ++++ Makefile.in	2012-05-03 20:26:07.000000000 +0200
   106.7 +@@ -193,16 +193,6 @@
   106.8 + 	cp $(STATICLIB) $(DESTDIR)$(libdir)
   106.9 + 	chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
  106.10 + 	-@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
  106.11 +-	-@if test -n "$(SHAREDLIBV)"; then \
  106.12 +-	  cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
  106.13 +-	  echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
  106.14 +-	  chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
  106.15 +-	  echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
  106.16 +-	  rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
  106.17 +-	  ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
  106.18 +-	  ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
  106.19 +-	  ($(LDCONFIG) || true)  >/dev/null 2>&1; \
  106.20 +-	fi
  106.21 + 	cp zlib.3 $(DESTDIR)$(man3dir)
  106.22 + 	chmod 644 $(DESTDIR)$(man3dir)/zlib.3
  106.23 + 	cp zlib.pc $(DESTDIR)$(pkgconfigdir)

mercurial