You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

660 lines
21 KiB

#!/bin/sh
##
## openpkg.boot -- OpenPKG bootstrap procedure (look Ma, without hands ;)
## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 2000-2003 Cable & Wireless <http://www.cw.com/>
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# This is a very tricky procedure for building the OpenPKG bootstrap
# package via the RPM specification openpkg.spec, but without
# requiring that OpenPKG's RPM already exists. For this the
# openpkg.spec file is manually executed here in order to build
# OpenPKG RPM the first time (that is, we emulate a sufficient
# subset of the RPM functionality), followed by a second round over
# openpkg.spec with the real (and then existing) OpenPKG RPM tool.
# Also keep in mind that lots of tricks are played here in order to
# perform all the steps without having to touch the real installation
# location. That is the whole procedure can (and should) be performed
# by a non-privileged user and no access to the real installation
# location filesystem location.
me="openpkg.boot"
##
## command line handling
##
# command line parameters (defaults)
help=0
verbose=''
prefix=''
usr=''; grp=''
susr=''; sgrp=''
musr=''; mgrp=''
rusr=''; rgrp=''
nusr=''; ngrp=''
suid=''; sgid=''
muid=''; mgid=''
ruid=''; rgid=''
nuid=''; ngid=''
bs=0
# parse command line options
for opt
do
case $opt in
-*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;;
*) arg='' ;;
esac
case $opt in
-h | --help ) help=1 ;;
-v | --verbose ) verbose=v ;;
--prefix=* ) prefix=$arg ;;
--usr=* | --user=* ) usr=$arg ;;
--grp=* | --group=* ) grp=$arg ;;
--susr=* ) susr=$arg ;;
--sgrp=* ) sgrp=$arg ;;
--musr=* ) musr=$arg ;;
--mgrp=* ) mgrp=$arg ;;
--rusr=* ) rusr=$arg ;;
--rgrp=* ) rgrp=$arg ;;
--nusr=* ) nusr=$arg ;;
--ngrp=* ) ngrp=$arg ;;
--suid=* ) suid=$arg ;;
--sgid=* ) sgid=$arg ;;
--muid=* ) muid=$arg ;;
--mgid=* ) mgid=$arg ;;
--ruid=* ) ruid=$arg ;;
--rgid=* ) rgid=$arg ;;
--nuid=* ) nuid=$arg ;;
--ngid=* ) ngid=$arg ;;
-bs | -s ) bs=1 ;;
* ) help=1 ;;
esac
done
if [ ".$bs" = .0 -a ".$prefix" = . ]; then
help=1
fi
if [ ".$help" = .1 ]; then
echo "Usage: sh $me [-h|--help] [-v|--verbose]" 2>&1
echo " --prefix=<prefix> [--user=<usr>] [--group=<grp>]" 2>&1
echo " [--{s,m,r,n}usr=<usr>] [--{s,m,r,n}grp=<grp>]" 2>&1
exit 1
fi
# determine missing parameters
eval `sh aux.usrgrp.sh \
--usr="$usr" --grp="$grp" \
--susr="$susr" --sgrp="$sgrp" \
--musr="$musr" --mgrp="$mgrp" \
--rusr="$rusr" --rgrp="$rgrp" \
--nusr="$nusr" --ngrp="$ngrp" \
--suid="$suid" --sgid="$sgid" \
--muid="$muid" --mgid="$mgid" \
--ruid="$ruid" --rgid="$rgid" \
--nuid="$nuid" --ngid="$ngid"`
##
## determine package information
##
name="openpkg"
spec="$name.spec"
version=`grep V_openpkg $spec | head -1 | awk '{ printf("%s", $3); }'`
23 years ago
release="$version"
##
## display headline
##
sh ./shtool echo -e "%BOpenPKG Bootstrap Procedure%b"
echo "++ bootstrap version: $version-$release"
echo "++ user/group pairs: $susr/$sgrp $musr/$mgrp $rusr/$rgrp $nusr/$ngrp"
##
## optionally roll just a bootstrap source package
##
if [ ".$bs" = .1 ]; then
srcdir=.
if [ -d ../../DST ]; then
dstdir=../../DST/openpkg
elif [ -d ../../dst ]; then
dstdir=../../dst/openpkg
else
dstdir=.
fi
tmpdir="/tmp/$me.$$.d"
if [ -d ../PKG/SRC ]; then
pkgdir=../PKG/SRC
elif [ -d ../PKG ]; then
pkgdir=../PKG
elif [ -d ../../PKG/SRC ]; then
pkgdir=../../PKG/SRC
elif [ -d ../../PKG ]; then
pkgdir=../../PKG
elif [ -d ../../pkg/src ]; then
pkgdir=../../pkg/src
elif [ -d ../../pkg ]; then
pkgdir=../../pkg
else
pkgdir=..
fi
echo "** rolling source bootstrap package:"
echo " $pkgdir/$name-$version-$release.src.sh"
rm -rf $tmpdir
mkdir $tmpdir
( echo "dstdir=$dstdir"
echo "srcdir=$srcdir"
echo "tmpdir=$tmpdir"
grep '^%define' $spec | sed -e 's:^%define *\([^ ]*\) *\(.*\):\1="\2":'
grep '^Source' $spec | sed -e 's;^Source[0-9]*: *;;' -e 's;^.*/;$dstdir/;' \
-e 's;^\([^/]*\)$;$srcdir/\1;' -e 's;%;$;g' \
-e 's;^\(.*\)$;cp \1 $tmpdir/;'
echo "cp -p $spec $tmpdir/"
) >$tmpdir/.sh
sh $tmpdir/.sh
rm -f $tmpdir/.sh
l_version="$release"
case "${l_version}" in
[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] )
l_release="CURRENT"
;;
* )
l_release=`echo "${l_version}" |\
sed -e 's;^;#;' \
-e 's;^#\([0-9][0-9]*\.[0-9][0-9]*\)\.0$;\1-RELEASE;' \
-e 's;^#\([0-9][0-9]*\.[0-9][0-9]*\)\.[0-9][0-9]*$;\1-SOLID;' \
-e 's;^#.*;UNKNOWN;'`
;;
esac
sed <$srcdir/aux.wrapsrc.sh >$tmpdir/openpkg.boot.tmp \
-e "s;@l_dir@;$name-$version-$release.src;" \
-e "s;@l_release@;$l_release;" \
-e "s;@l_version@;$l_version;"
echo . | awk '{
for (i = 0; i < 8192; i++) {
printf(" ");
}
}' >>$tmpdir/openpkg.boot.tmp
dd if=$tmpdir/openpkg.boot.tmp bs=8192 count=8 \
of=$pkgdir/$name-$version-$release.src.sh 2>/dev/null
rm -f $tmpdir/openpkg.boot.tmp
(cd $tmpdir && tar cf - *) >>$pkgdir/$name-$version-$release.src.sh
rm -rf $tmpdir
exit 0
fi
##
## calculate location id
##
prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
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 "++ location id: $loc"
##
## determine distribution directory
##
V_rpm=`grep V_rpm $spec | head -1 | awk '{ printf("%s", $3); }'`
if [ -f "../../DST/openpkg/rpm-${V_rpm}.tar.gz" ]; then
distdir="`cd ../../DST/openpkg; pwd`" # developer only
else
distdir="`pwd`"
fi
echo "++ distribution directory: $distdir"
##
## perform prerequisite checks
##
sh ./aux.prereq.sh source || exit $?
##
## find reasonable run-time paths and tools
##
# find reasonable temporary directory
tmpdir="${TMPDIR-/tmp}"
# find reasonable safe program path
test ".$PATH" = . && PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin"
for dir in /usr/ccs/bin /usr/xpg4/bin; do
test -d $dir && PATH="$PATH:$dir"
done
export PATH
# make environment at least partly sane
umask 022
unset ls rm mv cp sed grep awk >/dev/null 2>&1 || true
# find reasonable TAR
l_tar=''
for t in gtar tar; do
for p in `IFS=":"; echo . $PATH`; do
if [ -f "$p/$t" ]; then
l_tar="$p/$t"
break
fi
done
[ ".$l_tar" != . ] && break
done
if [ ".$l_tar" = . ]; then
echo "$0:FAILED: required TAR not found"
exit 1
fi
# find required Make tool
l_make=''
for t in gmake make; do
for p in `IFS=":"; echo . $PATH`; do
if [ -f "$p/$t" ]; then
l_make="$p/$t"
break
fi
done
[ ".$l_make" != . ] && break
done
if [ ".$l_make" = . ]; then
echo "$0:FAILED: required Make tool not found"
exit 1
fi
# find required [GNU] C Compiler
l_cc=''
for t in egcc ggcc gcc cc; do
for p in `IFS=":"; echo . $PATH`; do
if [ -f "$p/$t" ]; then
# if [ ".`$p/$t --version 2>/dev/null | grep '[23]\.[789]'`" != . ]; then
l_cc="$p/$t"
break
# fi
fi
done
[ ".$l_cc" != . ] && break
done
if [ ".$l_cc" = . ]; then
echo "$0:FAILED: required [GNU] C/C++ compiler not found"
exit 1
fi
##
## execute the spec file manually by emulating
## the behaviour of the OpenPKG RPM tool.
##
# create script prolog
prolog="$tmpdir/openpkg.boot.prolog.sh"
cp /dev/null $prolog
(
echo "_specdir=`pwd`"
echo "_sourcedir=$distdir"
echo "_tmppath=$tmpdir"
echo "_builddir=$tmpdir"
echo "l_prefix=$prefix"
echo "l_location=$loc"
echo "l_buildroot=$tmpdir/$name-$version-root"
echo "l_susr=$susr"
echo "l_sgrp=$sgrp"
echo "l_musr=$musr"
echo "l_mgrp=$mgrp"
echo "l_rusr=$rusr"
echo "l_rgrp=$rgrp"
echo "l_nusr=$nusr"
echo "l_ngrp=$ngrp"
echo "l_suid=$suid"
echo "l_sgid=$sgid"
echo "l_muid=$muid"
echo "l_mgid=$mgid"
echo "l_ruid=$ruid"
echo "l_rgid=$rgid"
echo "l_nuid=$nuid"
echo "l_ngid=$ngid"
echo "l_tar=$l_tar"
echo "l_make=$l_make"
echo "l_cc=$l_cc"
grep '%define' $spec | \
sed \
-e 's:^%define *\([^ ]*\) *\(.*\):\1="\2":'
grep "^[A-Za-z0-9]*: *" $spec | \
sed \
-e 's;^\([A-Za-z0-9]*\): *\(.*\)$;\1="\2";' \
-e 's;^A;a;' -e 's;^B;b;' -e 's;^C;c;' -e 's;^D;d;' -e 's;^E;e;' \
-e 's;^F;f;' -e 's;^G;g;' -e 's;^H;h;' -e 's;^I;i;' -e 's;^J;j;' \
-e 's;^K;k;' -e 's;^L;l;' -e 's;^M;m;' -e 's;^N;n;' -e 's;^O;o;' \
-e 's;^P;p;' -e 's;^Q;q;' -e 's;^R;r;' -e 's;^S;s;' -e 's;^T;t;' \
-e 's;^U;u;' -e 's;^V;v;' -e 's;^W;w;' -e 's;^X;x;' -e 's;^Y;y;' \
-e 's;^Z;z;' -e 's;^buildRoot;buildroot;'
echo "RPM_BUILD_ROOT=\"%{buildroot}\""
echo "RPM_BUILD_DIR=\"%{_builddir}\""
echo "RPM_SOURCE_DIR=\"$distdir\""
echo "export RPM_BUILD_ROOT"
echo "export RPM_BUILD_DIR"
echo "export RPM_SOURCE_DIR"
echo "set -x"
echo "umask 022"
echo "cd \$RPM_BUILD_DIR"
) | sed -e 's;%{\([^}]*\)};${\1};g' >$prolog
# install package via RPM spec file by faking a
# sufficiently enough RPM run-time environment
runscript () {
step=$1
script="$tmpdir/openpkg.boot.$step.sh"
echo ". $prolog" >$script
sed -e "/^%$step/,/^%/ p" -e 'd' <$spec | \
sed -e '/^%/d' | \
sed -e 's;%{SOURCE \([^ ]*\.tar[^ ]*\)};${RPM_DIST_DIR}/\1;g' \
-e 's;%{SOURCE \([^ ]*\)};${RPM_SOURCE_DIR}/\1;g' | \
sed -e 's;%{[?]\([^:}]*\):\([^}]*\)};${\1+\2};g' \
-e 's;%{![?]\([^:}]*\):\([^}]*\)};${\1-\2};g' \
-e 's;%{[?]\([^:}]*\)};${\1+""};g' \
-e 's;%{![?]\([^:}]*\)};${\1-""};g' \
-e 's;%{\([^}]*\)};${\1};g' >>$script
echo "++ executing(%$step): sh $script"
sh $script
if [ $? -ne 0 ]; then
rm -f $script
echo "$0:ERROR: script returned non-null value"
exit 1
fi
rm -f $script
}
runscript prep
runscript build
runscript install
##
## adjust build environment so that the installed
## "rpm" is actually useable, although it still resides in
## the temporary location instead of the real location.
##
# suck in prolog in order to get variables from the spec file
cwd=`pwd`
. $prolog
cd $cwd
# suck in buildenv script in order to get musr/mgrp
. $tmpdir/openpkg-*/.buildenv
# create a custom "rpm" command
echo "++ creating custom RPM command"
rm -f $tmpdir/rpm >/dev/null 2>&1
rmdir $tmpdir/rpm >/dev/null 2>&1
if [ -d "$tmpdir/rpm" ]; then
echo "$0:ERROR: directory $tmpdir/rpm exists, cannot create file with same name"
exit 1
fi
if [ -f "$tmpdir/rpm" ]; then
echo "$0:ERROR: file $tmpdir/rpm exists, cannot override"
exit 1
fi
Major OpenPKG Bootstrap Upgrade: from RPM 4.0.2 (status quo as of March 2001) to RPM 4.2.1 (status quo as of June 2003) This was a long awaited major upgrade, especially necessary on our road to OpenPKG 2.0. So we had to wait until OpenPKG 1.3 was released. Now that this happended recently, we can fully break ;-) OpenPKG-CURRENT with this upgrade. All these changes were previously developed on the OPENPKG_UPGRADE_RPM42 branch and tested in-depth as much as possible. Although all of our tests showed no significant differences while building OpenPKG packages with this, be aware that this potentially can break mostly everything in OpenPKG-CURRENT. If this is the case, we'll fix this soon, of course. This upgrade was made possible through the efforts of the following people: o Conrad Steenberg <conrad@hep.caltech.edu> (intial RPM 4.2.1 patch set) o Michael van Elst <mlelstv@dev.de.cw.net> (patch consolidation, .src.sh bootstrap integration, fixing of --justdb operation, porting remote glob(3) operations, etc) o Ralf S. Engelschall <rse@engelschall.com> (configuration adjustments, patch cleanups and regeneration, code cleanups and bugfixing, new platform id support, etc) ---------------------------------------------------------------------------- This is a list of major changes between RPM 4.0.2 and RPM 4.2.1. See the detailed CHANGES entries below for more details. o Query Pattern Matching RPM 4.2 now alows a glob(3) pattern matching on queries. ("rpm -qa kde-*") o Platform Identification: We finally cleaned up the whole platform identification in RPM. The new approach now is: <prefix>/lib/openpkg/platform is a program which dynamically determines the "<arch>-<vendor>-<os>" id string for the underlying platform. Wxample outputs are: ix86-pc-freebsd4.8, ix86-pc-redhat9, sparc64-sun-solaris9, etc. Then there is <prefix>/etc/openpkg/platform which is the once determined platform id, loaded by RPM to internally provide the macros %_host_{cpu,vendor,os} and %_host. Additionally, we adjusted all other platform id related macros (%_target, %_arch, %_os, etc) to directly depend on these macros. This way we have a new single point of source for the official platform id. o Bugfixes: The upgrade from RPM 4.0.2 (status quo as of March 2001) to RPM 4.2.1 (status quo as of June 2003) is a major code change covering a two year vendor development cycle. This means hundrets of bugs in RPM were fixed and the code was partly refactored and cleaned up. o Package Signatures: RPM 4.2 now uses the BeeCrypt cryptography library for verification of signatures. Previously one needed an externally available GnuPG. GnuPG now is only needed for creating signatures. Additionally, RPM 4.2 manages OpenPGP publuc keys in its RPM database similar to real packages (they even can be seen as pseudo-packages "gpg-pubkey-XXXXX" under query operations). The OpenPKG bootstrap (and also the regular upgrade procedure) now especially imports the OpenPKG OpenPGP public key into this database to make sure that one out-of-the-box can verify signed packages. Finally, "rpm -qi" now especially displays signature information, too. o RPM Database, Berkeley-DB 4.1.24 RPM 4.2 now internally uses Berkeley-DB 4.1.24 instead of version 3.2.4 which RPM 4.0 used. The old DB version 7 database files can still be read without problems and on "openpkg" package upgrade, the database is rebuilded and upgraded to DB version 8 files automatically. Additionally, RPM 4.2 now managed more information than RPM 4.0 and hence uses a few additional database files. o Re-Packaging RPM 4.2 now provides a nifty --repackage feature which can be applied especially to the --erase operation. Before erasing the installed package, RPM then first creates a corresponding binary RPM from scratch. This later can be used to rollback the erase operation. It just has to be remembered that the binary RPM resulting from a "repackage" operation is both not identical to the original binary RPM (because not all information was installed) and that the resulting binary RPM usually has a wrong MD5 digest (so you have to use --nodigest). o POPT Upgrade RPM 4.2 now uses an enhanced version of the POPT library, which especially allows special "argument eating" markers "!#:+" to be used in the rpmpopt file. This allowed us now to provide convinience macros for %option handling on the command line: --with foo => --define 'with_foo yes' => %option with_foo yes --without foo => --define 'with_foo no' => %option with_foo no --option with_foo bar => --define 'with_foo bar' => %option with_foo bar o %files Improvements: If the payload contains an OpenPGP public key, it can be added to the RPM header with a new %files attribute "%pubkey". Additionally, %exclude will now allow fully exclusion ("everything but"). Then there is a new %dev(type,major,minor) directive to permit non-root device files. o rpmbuild(8): A new command line tool rpmbuild(8) was introduced, providing the official RedHat way of building packages by accepting all the -bX options. Those options were removed from the rpm(8) command, too. OpenPKG provides rpmbuild(8) also, but officially sticks with the single command approach using just rpm(8) for all operations by reenabling the legacy option mappings. o Verification: The "rpm --verify" operation was greatly improved and now checks more details and is more accurate. o Performance: Noticable speed improvements were achieved for both query and install operations. o Transactions: RPM internally now uses transactions for its operations (implemented through data structure coloring) and supports full-state rollbacks in case of problems. o Querying: New --queryformat header format modifiers were introduced: ":xml" for dumping the content in XML (e.g. use --qf '[%{*:xml}\n]' to dump header content in XML), ":base64" to dump in Base64 format and ":armor" to dump in hex format. o File Classification: RPM 4.2 internally now uses the file(3) library for classifying files and can use this on auto-dependency generation. OpenPKG does not use this until now. o Dependency Solving and Caching: Although (still) not used by OpenPKG, RPM 4.2 has some limited functionality (used by RedHat up2date) to cache binary RPM headers locally and even store a full separate RPM database with package information ("rpm --dbpath /path/to/somewhere --justdb -U *.rpm") and then resolve dependencies through this information. This is done with the --aid option which implements at least one of the 2 essential elements of a dependency solver. The 2 essential elements are (a) locate a previously uninstalled package that satisfies a new dependency. (b) upgrade an already installed package in order to solve a problem. RPM currently does (a) only. ---------------------------------------------------------------------------- The following is a stripped down version of the CHANGES entries between RPM 4.0.2 and 4.2.1. Only non-bugfixing entries are shown. See RPM 4.2.1's CHANGES file for complete details. o 4.2 -> 4.2.1: - add version check for package with provides and obsoletes. - build with external beecrypt-3.0.0. - add ":xml" header format modifier. - --queryformat '[%%{*:xml}\n]' to dump header content in XML. o 4.1 -> 4.2: - include file-3.39 (with homebrewed) libfmagic, for now. - add /usr/lib/rpm/rpmdeps. - add /usr/lib/rpm/magic. - use rpmdeps rather than find-{requires,provides}. - move libfmagic to librpmio. - internal automagic dependency generation (disabled for now). - don't generate dependencies unless execute bit is set. - enable internal automagic dependency generation as default. - add --file{class,provide,require} popt aliases and header extensions. - add matching "config(N) = EVR" dependencies iff %%config is found. - add %%pubkey attribute to read armored pubkey files into header. - permit both relative/absolute paths, display 'P' when verifying. - resurrect automagic perl(foo) dependency generation. - add BETA-GPG-KEY (but not in headers using %%pubkey yet). - configurable default query output format. - add file(1) as /usr/lib/rpm/rpmfile. o 4.0.4 -> 4.1: - loosely wire beecrypt library into rpm. - proof-of-concept GPG/DSA verification for legacy signatures. - proof-of-concept PGP/RSA verification for legacy signatures. - add :base64 and :armor format extensions, dump binary tags in hex. - proof-of-concept pubkey retrieval from RPM-{PGP,GPG}-KEY. - stupid macros to configure public key file paths. - 1st crack at making zlib rsync friendly. - add payload uncompressed size to signature to avoid rewriting header. - drill header sha1 into signature parallel to header+payload md5. - mandatory "most effective" signature check on query/verify/install. - add header DSA signature. - add header RSA signature (untested, disabled for now). - wire --nodigest/--nosignature options to checksig/query/verify modes. - add --nosuggests to disable suggested resolutions. - enable CDB by default. - use /etc/rpm/platform (if it exists), rather than uname(2), for arch. - remove build mode compatibility aliases, documented and gone. - add --build/--program-prefix, delete libtoolize, from %configure. - open rpmdb early RDONLY, reopen later RDWR, avoid signed srpm noise. - add preliminary rpmgraph(8) and rpmcache(8) executables to rpm-devel. - display signature details using rpm -qi. - configurable (default off) build failure if missing %%doc files (PLD). - configurable (default off) build failure iff unpackaged files (PLD). - resurrect --rollback. - add --predefine to define macros before reading macro configuration. - add a macro to create a sub-package with debugging symbols. - use %%{_lib} for libraries. o 4.0.3 -> 4.0.4: - permit gpg/pgp/pgp5 execs to be reconfigured. - permit subset installs for %lang colored hardlink file sets. - add :armor and :base64 query format qualifiers for binary signatures. - legacy: configurable whiteout for known Red Hat dependency loops. - macro for %files, always include %defattr(), redhat config only. - transaction rollbacks are functional. - make --addsign and --resign behave exactly the same. - speedup large queries by ~50%. o 4.0.2 -> 4.0.3: - add %exclude support (i.e. "everything but") to %files. - add --with/--without popt glue for conditional builds(Tomasz Kloczko). - add --repackage option to put erased bits back into a package. - regenerate rpm.8 man page from docbook glop (in max-rpm). - add cron/logrotate scripts to save installed package filenames. - fix: popt exec doesn't add '--', --target et al no longer need '='. - document build modes in rpmbuild.8, rpmbuild is born. - permit rpm -qa to take RE args applied to name tag. - rpmdb iterator selectors permit default/strcmp/regex/glob matching. - add --noghost to filter non-payload files from rpm -qlv output. - permit alias/exec description/arg text to be set from popt config. - (--POPTdesc/--POPTargs deletion?) - package version now configureable, default v3. - add linux per-platform macro %_smp_mflags <sopwith@redhat.com>. - add %dev(type,major,minor) directive to permit non-root dev build. - resurrect --specedit for i18n. - verify perms (but not mode) on %ghost files. - fix: ftp remote globs broken (#46892).
23 years ago
( echo "#!/bin/sh"
echo "exec $RPM_BUILD_ROOT$prefix/bin/rpm \\"
echo " --rcfile \"$tmpdir/rpm.1\" \\"
echo " --define \"__platform $RPM_BUILD_ROOT$prefix/etc/openpkg/platform\" \\"
echo " \"\$@\""
) >$tmpdir/rpm
chmod a+x $tmpdir/rpm
# direct our own "rpm" tool to adjusted macro sets
sed <`SOURCE rpmrc` >$tmpdir/rpm.1 \
-e "s;^\\(macrofiles:\\) .*;\\1 $tmpdir/rpm.2:$tmpdir/rpm.3;"
# use an adjusted vendor macro set
sed <$RPM_BUILD_ROOT$prefix/lib/openpkg/macros >$tmpdir/rpm.2 \
-e "s;$prefix;$RPM_BUILD_ROOT$prefix;g"
# override the vendor macro set
sed <`SOURCE rpmmacros` >$tmpdir/rpm.3 \
-e "s;@SUSR@;$susr;" \
-e "s;@SGRP@;$sgrp;" \
-e "s;@MUSR@;$musr;" \
-e "s;@MGRP@;$mgrp;" \
-e "s;@RUSR@;$rusr;" \
-e "s;@RGRP@;$rgrp;" \
-e "s;@NUSR@;$nusr;" \
-e "s;@NGRP@;$ngrp;" \
-e "s;@LOC@;$loc;" \
-e "s;^\\(%l_root_install *\\)@l_prefix@;\\1 $prefix;" \
-e "s;^\\(%l_root_rpm *\\)@l_prefix@;\\1 $RPM_BUILD_ROOT$prefix;" \
-e "s;@l_prefix@;$RPM_BUILD_ROOT$prefix;" \
-e "s;^\\(%_specdir *\\).*;\\1 `pwd`;" \
-e "s;^\\(%_sourcedir *\\).*;\\1 $distdir;" \
-e "s;^\\(%_builddir *\\).*;\\1 $tmpdir;" \
-e "s;^\\(%_tmppath *\\).*;\\1 $tmpdir;" \
-e "s;^\\(%_buildshell *\\).*;\\1 /bin/sh;" \
-e "s;@l_build_path@;/bin:/sbin:/usr/bin:/usr/sbin;g" \
-e "s;@l_build_ldlp@;/usr/lib;g" \
-e "s;@l_build_ulim@;:;g"
# use an own $HOME/.popt in order to make sure the "rpm"
# tool is able to execute its sub-tools "rpm<x>".
V_rpm=`grep V_rpm $spec | head -1 | awk '{ printf("%s", $3); }'`
Major OpenPKG Bootstrap Upgrade: from RPM 4.0.2 (status quo as of March 2001) to RPM 4.2.1 (status quo as of June 2003) This was a long awaited major upgrade, especially necessary on our road to OpenPKG 2.0. So we had to wait until OpenPKG 1.3 was released. Now that this happended recently, we can fully break ;-) OpenPKG-CURRENT with this upgrade. All these changes were previously developed on the OPENPKG_UPGRADE_RPM42 branch and tested in-depth as much as possible. Although all of our tests showed no significant differences while building OpenPKG packages with this, be aware that this potentially can break mostly everything in OpenPKG-CURRENT. If this is the case, we'll fix this soon, of course. This upgrade was made possible through the efforts of the following people: o Conrad Steenberg <conrad@hep.caltech.edu> (intial RPM 4.2.1 patch set) o Michael van Elst <mlelstv@dev.de.cw.net> (patch consolidation, .src.sh bootstrap integration, fixing of --justdb operation, porting remote glob(3) operations, etc) o Ralf S. Engelschall <rse@engelschall.com> (configuration adjustments, patch cleanups and regeneration, code cleanups and bugfixing, new platform id support, etc) ---------------------------------------------------------------------------- This is a list of major changes between RPM 4.0.2 and RPM 4.2.1. See the detailed CHANGES entries below for more details. o Query Pattern Matching RPM 4.2 now alows a glob(3) pattern matching on queries. ("rpm -qa kde-*") o Platform Identification: We finally cleaned up the whole platform identification in RPM. The new approach now is: <prefix>/lib/openpkg/platform is a program which dynamically determines the "<arch>-<vendor>-<os>" id string for the underlying platform. Wxample outputs are: ix86-pc-freebsd4.8, ix86-pc-redhat9, sparc64-sun-solaris9, etc. Then there is <prefix>/etc/openpkg/platform which is the once determined platform id, loaded by RPM to internally provide the macros %_host_{cpu,vendor,os} and %_host. Additionally, we adjusted all other platform id related macros (%_target, %_arch, %_os, etc) to directly depend on these macros. This way we have a new single point of source for the official platform id. o Bugfixes: The upgrade from RPM 4.0.2 (status quo as of March 2001) to RPM 4.2.1 (status quo as of June 2003) is a major code change covering a two year vendor development cycle. This means hundrets of bugs in RPM were fixed and the code was partly refactored and cleaned up. o Package Signatures: RPM 4.2 now uses the BeeCrypt cryptography library for verification of signatures. Previously one needed an externally available GnuPG. GnuPG now is only needed for creating signatures. Additionally, RPM 4.2 manages OpenPGP publuc keys in its RPM database similar to real packages (they even can be seen as pseudo-packages "gpg-pubkey-XXXXX" under query operations). The OpenPKG bootstrap (and also the regular upgrade procedure) now especially imports the OpenPKG OpenPGP public key into this database to make sure that one out-of-the-box can verify signed packages. Finally, "rpm -qi" now especially displays signature information, too. o RPM Database, Berkeley-DB 4.1.24 RPM 4.2 now internally uses Berkeley-DB 4.1.24 instead of version 3.2.4 which RPM 4.0 used. The old DB version 7 database files can still be read without problems and on "openpkg" package upgrade, the database is rebuilded and upgraded to DB version 8 files automatically. Additionally, RPM 4.2 now managed more information than RPM 4.0 and hence uses a few additional database files. o Re-Packaging RPM 4.2 now provides a nifty --repackage feature which can be applied especially to the --erase operation. Before erasing the installed package, RPM then first creates a corresponding binary RPM from scratch. This later can be used to rollback the erase operation. It just has to be remembered that the binary RPM resulting from a "repackage" operation is both not identical to the original binary RPM (because not all information was installed) and that the resulting binary RPM usually has a wrong MD5 digest (so you have to use --nodigest). o POPT Upgrade RPM 4.2 now uses an enhanced version of the POPT library, which especially allows special "argument eating" markers "!#:+" to be used in the rpmpopt file. This allowed us now to provide convinience macros for %option handling on the command line: --with foo => --define 'with_foo yes' => %option with_foo yes --without foo => --define 'with_foo no' => %option with_foo no --option with_foo bar => --define 'with_foo bar' => %option with_foo bar o %files Improvements: If the payload contains an OpenPGP public key, it can be added to the RPM header with a new %files attribute "%pubkey". Additionally, %exclude will now allow fully exclusion ("everything but"). Then there is a new %dev(type,major,minor) directive to permit non-root device files. o rpmbuild(8): A new command line tool rpmbuild(8) was introduced, providing the official RedHat way of building packages by accepting all the -bX options. Those options were removed from the rpm(8) command, too. OpenPKG provides rpmbuild(8) also, but officially sticks with the single command approach using just rpm(8) for all operations by reenabling the legacy option mappings. o Verification: The "rpm --verify" operation was greatly improved and now checks more details and is more accurate. o Performance: Noticable speed improvements were achieved for both query and install operations. o Transactions: RPM internally now uses transactions for its operations (implemented through data structure coloring) and supports full-state rollbacks in case of problems. o Querying: New --queryformat header format modifiers were introduced: ":xml" for dumping the content in XML (e.g. use --qf '[%{*:xml}\n]' to dump header content in XML), ":base64" to dump in Base64 format and ":armor" to dump in hex format. o File Classification: RPM 4.2 internally now uses the file(3) library for classifying files and can use this on auto-dependency generation. OpenPKG does not use this until now. o Dependency Solving and Caching: Although (still) not used by OpenPKG, RPM 4.2 has some limited functionality (used by RedHat up2date) to cache binary RPM headers locally and even store a full separate RPM database with package information ("rpm --dbpath /path/to/somewhere --justdb -U *.rpm") and then resolve dependencies through this information. This is done with the --aid option which implements at least one of the 2 essential elements of a dependency solver. The 2 essential elements are (a) locate a previously uninstalled package that satisfies a new dependency. (b) upgrade an already installed package in order to solve a problem. RPM currently does (a) only. ---------------------------------------------------------------------------- The following is a stripped down version of the CHANGES entries between RPM 4.0.2 and 4.2.1. Only non-bugfixing entries are shown. See RPM 4.2.1's CHANGES file for complete details. o 4.2 -> 4.2.1: - add version check for package with provides and obsoletes. - build with external beecrypt-3.0.0. - add ":xml" header format modifier. - --queryformat '[%%{*:xml}\n]' to dump header content in XML. o 4.1 -> 4.2: - include file-3.39 (with homebrewed) libfmagic, for now. - add /usr/lib/rpm/rpmdeps. - add /usr/lib/rpm/magic. - use rpmdeps rather than find-{requires,provides}. - move libfmagic to librpmio. - internal automagic dependency generation (disabled for now). - don't generate dependencies unless execute bit is set. - enable internal automagic dependency generation as default. - add --file{class,provide,require} popt aliases and header extensions. - add matching "config(N) = EVR" dependencies iff %%config is found. - add %%pubkey attribute to read armored pubkey files into header. - permit both relative/absolute paths, display 'P' when verifying. - resurrect automagic perl(foo) dependency generation. - add BETA-GPG-KEY (but not in headers using %%pubkey yet). - configurable default query output format. - add file(1) as /usr/lib/rpm/rpmfile. o 4.0.4 -> 4.1: - loosely wire beecrypt library into rpm. - proof-of-concept GPG/DSA verification for legacy signatures. - proof-of-concept PGP/RSA verification for legacy signatures. - add :base64 and :armor format extensions, dump binary tags in hex. - proof-of-concept pubkey retrieval from RPM-{PGP,GPG}-KEY. - stupid macros to configure public key file paths. - 1st crack at making zlib rsync friendly. - add payload uncompressed size to signature to avoid rewriting header. - drill header sha1 into signature parallel to header+payload md5. - mandatory "most effective" signature check on query/verify/install. - add header DSA signature. - add header RSA signature (untested, disabled for now). - wire --nodigest/--nosignature options to checksig/query/verify modes. - add --nosuggests to disable suggested resolutions. - enable CDB by default. - use /etc/rpm/platform (if it exists), rather than uname(2), for arch. - remove build mode compatibility aliases, documented and gone. - add --build/--program-prefix, delete libtoolize, from %configure. - open rpmdb early RDONLY, reopen later RDWR, avoid signed srpm noise. - add preliminary rpmgraph(8) and rpmcache(8) executables to rpm-devel. - display signature details using rpm -qi. - configurable (default off) build failure if missing %%doc files (PLD). - configurable (default off) build failure iff unpackaged files (PLD). - resurrect --rollback. - add --predefine to define macros before reading macro configuration. - add a macro to create a sub-package with debugging symbols. - use %%{_lib} for libraries. o 4.0.3 -> 4.0.4: - permit gpg/pgp/pgp5 execs to be reconfigured. - permit subset installs for %lang colored hardlink file sets. - add :armor and :base64 query format qualifiers for binary signatures. - legacy: configurable whiteout for known Red Hat dependency loops. - macro for %files, always include %defattr(), redhat config only. - transaction rollbacks are functional. - make --addsign and --resign behave exactly the same. - speedup large queries by ~50%. o 4.0.2 -> 4.0.3: - add %exclude support (i.e. "everything but") to %files. - add --with/--without popt glue for conditional builds(Tomasz Kloczko). - add --repackage option to put erased bits back into a package. - regenerate rpm.8 man page from docbook glop (in max-rpm). - add cron/logrotate scripts to save installed package filenames. - fix: popt exec doesn't add '--', --target et al no longer need '='. - document build modes in rpmbuild.8, rpmbuild is born. - permit rpm -qa to take RE args applied to name tag. - rpmdb iterator selectors permit default/strcmp/regex/glob matching. - add --noghost to filter non-payload files from rpm -qlv output. - permit alias/exec description/arg text to be set from popt config. - (--POPTdesc/--POPTargs deletion?) - package version now configureable, default v3. - add linux per-platform macro %_smp_mflags <sopwith@redhat.com>. - add %dev(type,major,minor) directive to permit non-root dev build. - resurrect --specedit for i18n. - verify perms (but not mode) on %ghost files. - fix: ftp remote globs broken (#46892).
23 years ago
sed <$RPM_BUILD_ROOT$prefix/lib/openpkg/rpmpopt >$tmpdir/.popt \
-e "s;^\\(rpm.*exec.*\\)\\(rpm[bdieukvq]*\\);\\1$RPM_BUILD_ROOT$prefix/lib/openpkg/\\2;"
# activate the .popt file
HOME=$tmpdir
export HOME
##
## now initialize the RPM database under the temporary install location
##
echo "++ initializing RPM database"
Completely revamp the RPM database fiddling: 1. Introduce new <prefix>/lib/openpkg/rpmdb utility for administrating the RPM database on the lower level and hook it into the <prefix>/bin/rpm command line with four options: --db-build RPM database administration: build new database (destructive operation; you have to know what you are doing) --db-rebuild RPM database administration: rebuild new from old database (upgrading operation; reasonable after upgrades or on DB corruption) --db-cleanup RPM database administration: cleanup existing database (cleaning operation; reasonable after DB out-of-sync situations) --db-fixate RPM database administration: fixate existing database (harmless operation; for fixating files only) 2. Use rpmdb from within openpkg.boot to create initial database the correct way and to query the list of filenames of all database files. 3. Use rpmdb from within openpkg.spec:%post to fixate the database on upgrades only (no more rebuilding) but drop note to RPM 4.0 to 4.2 upgraders about "rpm --db-rebuild" and "rpm --db-cleanup". 4. Patch RPM's embedded Berkeley-DB to accept zero-size DB region files. Because permissions and ownership on Berkeley-DB region files __db.XXX have to be already fixed in advance and those files cannot be created in advance on the command line with some reasonable default (as it is the case for the other files which are created with [rpm]db_load), we have to force Berkeley-DB to accept those zero-sized files and (on DB_CREATE) create/overwrite them (instead of thinking another process is currently creating them). This especially workarounds the "Resource temporarily unavailable" problems we've seen on some platforms, which were mainly caused by the pre-existing DB region files. 5. Patch RPM so it passes flag DB_CREATE to Berkeley-DB also if DB region file __db.001 exists, but is (still) zero-size. With those changes all together we are now able to perform lower-level administration of the RPM database, have moved all RPM database fiddling into a single script (rpmdb), this way removed all redundancy related to this database fiddling, and should workround the "Resource temporarily unavailable" problems we experienced. OpenPKG-CURRENT drivers are strongly advised to immediately upgrade to this "openpkg-20030918-20030918" release of the bootstrap package and especially perform an "rpm --db-rebuild" once after the installation. If you have already trouble ("Resource temporarily unavailable" or other hangs) in upgrading the previous "openpkg" package to this latest version, you can workaround it with the following more upgrade procedure (note the "private" on the __dbi_cdb macro definition): $ <prefix>/bin/rpm --rebuild openpkg-20030918-20030918.src.rpm $ rm <prefix>/RPM/DB/__db.* $ <prefix>/bin/rpm -Uvh \ --define '__dbi_cdb create cdb mpool mp_mmapsize=16Mb mp_size=1Mb private' \ <prefix>/RPM/PKG/openpkg-20030918-20030918.*.rpm $ <prefix>/bin/rpm --db-rebuild
23 years ago
$RPM_BUILD_ROOT$prefix/lib/openpkg/bash \
$RPM_BUILD_ROOT$prefix/lib/openpkg/rpmdb \
--prefix=$RPM_BUILD_ROOT$prefix \
--dbpath=$RPM_BUILD_ROOT$prefix/RPM/DB \
--rpm=$tmpdir/rpm \
--build --quiet
##
## now turn over and re-iterate over the RPM spec, but this time
## with the real RPM tool.
##
echo "++ re-iterating over RPM specification procedures"
OPENPKG_BOOT=1
export OPENPKG_BOOT
$tmpdir/rpm -bb $spec
##
## and finally overwrite the installation again, but this time by
## installing officially through the "rpm" tool. This way we achieve
## that RPM is remembered as an RPM package in its own database. We
## just have to make sure the package is relocated while installing.
## For this we could use --prefix=$RPM_BUILD_ROOT$prefix, but this
## would create an incorrect filelist for "rpm" in the database.
## Instead we use the --justdb option which means "rpm" behaves as it
## would install into the real location, but does not actually install
## anything. But as a side-effect, the database is now correct.
##
echo "++ overwriting RPM installation by installing via RPM itself"
Major OpenPKG Bootstrap Upgrade: from RPM 4.0.2 (status quo as of March 2001) to RPM 4.2.1 (status quo as of June 2003) This was a long awaited major upgrade, especially necessary on our road to OpenPKG 2.0. So we had to wait until OpenPKG 1.3 was released. Now that this happended recently, we can fully break ;-) OpenPKG-CURRENT with this upgrade. All these changes were previously developed on the OPENPKG_UPGRADE_RPM42 branch and tested in-depth as much as possible. Although all of our tests showed no significant differences while building OpenPKG packages with this, be aware that this potentially can break mostly everything in OpenPKG-CURRENT. If this is the case, we'll fix this soon, of course. This upgrade was made possible through the efforts of the following people: o Conrad Steenberg <conrad@hep.caltech.edu> (intial RPM 4.2.1 patch set) o Michael van Elst <mlelstv@dev.de.cw.net> (patch consolidation, .src.sh bootstrap integration, fixing of --justdb operation, porting remote glob(3) operations, etc) o Ralf S. Engelschall <rse@engelschall.com> (configuration adjustments, patch cleanups and regeneration, code cleanups and bugfixing, new platform id support, etc) ---------------------------------------------------------------------------- This is a list of major changes between RPM 4.0.2 and RPM 4.2.1. See the detailed CHANGES entries below for more details. o Query Pattern Matching RPM 4.2 now alows a glob(3) pattern matching on queries. ("rpm -qa kde-*") o Platform Identification: We finally cleaned up the whole platform identification in RPM. The new approach now is: <prefix>/lib/openpkg/platform is a program which dynamically determines the "<arch>-<vendor>-<os>" id string for the underlying platform. Wxample outputs are: ix86-pc-freebsd4.8, ix86-pc-redhat9, sparc64-sun-solaris9, etc. Then there is <prefix>/etc/openpkg/platform which is the once determined platform id, loaded by RPM to internally provide the macros %_host_{cpu,vendor,os} and %_host. Additionally, we adjusted all other platform id related macros (%_target, %_arch, %_os, etc) to directly depend on these macros. This way we have a new single point of source for the official platform id. o Bugfixes: The upgrade from RPM 4.0.2 (status quo as of March 2001) to RPM 4.2.1 (status quo as of June 2003) is a major code change covering a two year vendor development cycle. This means hundrets of bugs in RPM were fixed and the code was partly refactored and cleaned up. o Package Signatures: RPM 4.2 now uses the BeeCrypt cryptography library for verification of signatures. Previously one needed an externally available GnuPG. GnuPG now is only needed for creating signatures. Additionally, RPM 4.2 manages OpenPGP publuc keys in its RPM database similar to real packages (they even can be seen as pseudo-packages "gpg-pubkey-XXXXX" under query operations). The OpenPKG bootstrap (and also the regular upgrade procedure) now especially imports the OpenPKG OpenPGP public key into this database to make sure that one out-of-the-box can verify signed packages. Finally, "rpm -qi" now especially displays signature information, too. o RPM Database, Berkeley-DB 4.1.24 RPM 4.2 now internally uses Berkeley-DB 4.1.24 instead of version 3.2.4 which RPM 4.0 used. The old DB version 7 database files can still be read without problems and on "openpkg" package upgrade, the database is rebuilded and upgraded to DB version 8 files automatically. Additionally, RPM 4.2 now managed more information than RPM 4.0 and hence uses a few additional database files. o Re-Packaging RPM 4.2 now provides a nifty --repackage feature which can be applied especially to the --erase operation. Before erasing the installed package, RPM then first creates a corresponding binary RPM from scratch. This later can be used to rollback the erase operation. It just has to be remembered that the binary RPM resulting from a "repackage" operation is both not identical to the original binary RPM (because not all information was installed) and that the resulting binary RPM usually has a wrong MD5 digest (so you have to use --nodigest). o POPT Upgrade RPM 4.2 now uses an enhanced version of the POPT library, which especially allows special "argument eating" markers "!#:+" to be used in the rpmpopt file. This allowed us now to provide convinience macros for %option handling on the command line: --with foo => --define 'with_foo yes' => %option with_foo yes --without foo => --define 'with_foo no' => %option with_foo no --option with_foo bar => --define 'with_foo bar' => %option with_foo bar o %files Improvements: If the payload contains an OpenPGP public key, it can be added to the RPM header with a new %files attribute "%pubkey". Additionally, %exclude will now allow fully exclusion ("everything but"). Then there is a new %dev(type,major,minor) directive to permit non-root device files. o rpmbuild(8): A new command line tool rpmbuild(8) was introduced, providing the official RedHat way of building packages by accepting all the -bX options. Those options were removed from the rpm(8) command, too. OpenPKG provides rpmbuild(8) also, but officially sticks with the single command approach using just rpm(8) for all operations by reenabling the legacy option mappings. o Verification: The "rpm --verify" operation was greatly improved and now checks more details and is more accurate. o Performance: Noticable speed improvements were achieved for both query and install operations. o Transactions: RPM internally now uses transactions for its operations (implemented through data structure coloring) and supports full-state rollbacks in case of problems. o Querying: New --queryformat header format modifiers were introduced: ":xml" for dumping the content in XML (e.g. use --qf '[%{*:xml}\n]' to dump header content in XML), ":base64" to dump in Base64 format and ":armor" to dump in hex format. o File Classification: RPM 4.2 internally now uses the file(3) library for classifying files and can use this on auto-dependency generation. OpenPKG does not use this until now. o Dependency Solving and Caching: Although (still) not used by OpenPKG, RPM 4.2 has some limited functionality (used by RedHat up2date) to cache binary RPM headers locally and even store a full separate RPM database with package information ("rpm --dbpath /path/to/somewhere --justdb -U *.rpm") and then resolve dependencies through this information. This is done with the --aid option which implements at least one of the 2 essential elements of a dependency solver. The 2 essential elements are (a) locate a previously uninstalled package that satisfies a new dependency. (b) upgrade an already installed package in order to solve a problem. RPM currently does (a) only. ---------------------------------------------------------------------------- The following is a stripped down version of the CHANGES entries between RPM 4.0.2 and 4.2.1. Only non-bugfixing entries are shown. See RPM 4.2.1's CHANGES file for complete details. o 4.2 -> 4.2.1: - add version check for package with provides and obsoletes. - build with external beecrypt-3.0.0. - add ":xml" header format modifier. - --queryformat '[%%{*:xml}\n]' to dump header content in XML. o 4.1 -> 4.2: - include file-3.39 (with homebrewed) libfmagic, for now. - add /usr/lib/rpm/rpmdeps. - add /usr/lib/rpm/magic. - use rpmdeps rather than find-{requires,provides}. - move libfmagic to librpmio. - internal automagic dependency generation (disabled for now). - don't generate dependencies unless execute bit is set. - enable internal automagic dependency generation as default. - add --file{class,provide,require} popt aliases and header extensions. - add matching "config(N) = EVR" dependencies iff %%config is found. - add %%pubkey attribute to read armored pubkey files into header. - permit both relative/absolute paths, display 'P' when verifying. - resurrect automagic perl(foo) dependency generation. - add BETA-GPG-KEY (but not in headers using %%pubkey yet). - configurable default query output format. - add file(1) as /usr/lib/rpm/rpmfile. o 4.0.4 -> 4.1: - loosely wire beecrypt library into rpm. - proof-of-concept GPG/DSA verification for legacy signatures. - proof-of-concept PGP/RSA verification for legacy signatures. - add :base64 and :armor format extensions, dump binary tags in hex. - proof-of-concept pubkey retrieval from RPM-{PGP,GPG}-KEY. - stupid macros to configure public key file paths. - 1st crack at making zlib rsync friendly. - add payload uncompressed size to signature to avoid rewriting header. - drill header sha1 into signature parallel to header+payload md5. - mandatory "most effective" signature check on query/verify/install. - add header DSA signature. - add header RSA signature (untested, disabled for now). - wire --nodigest/--nosignature options to checksig/query/verify modes. - add --nosuggests to disable suggested resolutions. - enable CDB by default. - use /etc/rpm/platform (if it exists), rather than uname(2), for arch. - remove build mode compatibility aliases, documented and gone. - add --build/--program-prefix, delete libtoolize, from %configure. - open rpmdb early RDONLY, reopen later RDWR, avoid signed srpm noise. - add preliminary rpmgraph(8) and rpmcache(8) executables to rpm-devel. - display signature details using rpm -qi. - configurable (default off) build failure if missing %%doc files (PLD). - configurable (default off) build failure iff unpackaged files (PLD). - resurrect --rollback. - add --predefine to define macros before reading macro configuration. - add a macro to create a sub-package with debugging symbols. - use %%{_lib} for libraries. o 4.0.3 -> 4.0.4: - permit gpg/pgp/pgp5 execs to be reconfigured. - permit subset installs for %lang colored hardlink file sets. - add :armor and :base64 query format qualifiers for binary signatures. - legacy: configurable whiteout for known Red Hat dependency loops. - macro for %files, always include %defattr(), redhat config only. - transaction rollbacks are functional. - make --addsign and --resign behave exactly the same. - speedup large queries by ~50%. o 4.0.2 -> 4.0.3: - add %exclude support (i.e. "everything but") to %files. - add --with/--without popt glue for conditional builds(Tomasz Kloczko). - add --repackage option to put erased bits back into a package. - regenerate rpm.8 man page from docbook glop (in max-rpm). - add cron/logrotate scripts to save installed package filenames. - fix: popt exec doesn't add '--', --target et al no longer need '='. - document build modes in rpmbuild.8, rpmbuild is born. - permit rpm -qa to take RE args applied to name tag. - rpmdb iterator selectors permit default/strcmp/regex/glob matching. - add --noghost to filter non-payload files from rpm -qlv output. - permit alias/exec description/arg text to be set from popt config. - (--POPTdesc/--POPTargs deletion?) - package version now configureable, default v3. - add linux per-platform macro %_smp_mflags <sopwith@redhat.com>. - add %dev(type,major,minor) directive to permit non-root dev build. - resurrect --specedit for i18n. - verify perms (but not mode) on %ghost files. - fix: ftp remote globs broken (#46892).
23 years ago
$tmpdir/rpm --install --justdb --force --noscripts --notriggers --ignoresize \
$RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-*.rpm
## Puhhhh!!! what a tricky bootstrapping procedure. But now we are
## mostly finished. All we finally have to do is to roll a bootstrap
## tarball in addition to the binary RPM and save the stuff in a
## permanent location.
v="$version-$release"
t="`$tmpdir/rpm --eval '%{l_platform -p}'`-$loc"
# find a reasonable destination directory for packages
if [ -d ../PKG/BIN ]; then
dstdir=../PKG/BIN
elif [ -d ../PKG ]; then
dstdir=../PKG
elif [ -d ../../PKG/BIN ]; then
dstdir=../../PKG/BIN
elif [ -d ../../PKG ]; then
dstdir=../../PKG
else
dstdir=..
fi
# create Source-RPM file
echo "++ creating bootstrap source RPM file"
$tmpdir/rpm -bs --nodeps $spec
cp $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.src.rpm $dstdir/
rm -f $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.src.rpm
# create Binary-RPM file
echo "++ creating bootstrap binary RPM file"
cp $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.$t.rpm $dstdir/
rm -f $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.$t.rpm
# create Binary-Bootstrap file
echo "++ creating bootstrap binary shell script"
files=`cat $spec |\
sed -e '1,/%files/d' -e '/%clean/,$d' |\
grep -v '^ *$' | grep -v '%defattr' |\
sed -e 's;%config(noreplace) *;;' -e 's;%config *;;' \
-e 's;%dir *;;' -e 's;%{l_prefix}/;;' -e 's;^ *;;' -e "s;%{V_rpm};${V_rpm};"`
db_files=""
for db_file in \
`$RPM_BUILD_ROOT$prefix/lib/openpkg/bash \
$RPM_BUILD_ROOT$prefix/lib/openpkg/rpmdb \
--prefix=$RPM_BUILD_ROOT$prefix \
--dbpath=$RPM_BUILD_ROOT$prefix/RPM/DB \
--list --quiet`; do
db_files="$db_files RPM/DB/$db_file"
done
chmod 644 $RPM_BUILD_ROOT$prefix/RPM/DB/*
files="$files $db_files"
( cd $RPM_BUILD_ROOT$prefix
$RPM_BUILD_ROOT$prefix/lib/openpkg/tar --no-recursion -cf - $files
) | $RPM_BUILD_ROOT$prefix/lib/openpkg/bzip2 -9 \
>$RPM_BUILD_ROOT$prefix/openpkg.tar.bz2
cp -p $RPM_BUILD_ROOT$prefix/lib/openpkg/tar \
$RPM_BUILD_ROOT$prefix/openpkg.tar
cp -p $RPM_BUILD_ROOT$prefix/lib/openpkg/bzip2 \
$RPM_BUILD_ROOT$prefix/openpkg.bzip2
l_platform=`$tmpdir/rpm --eval '%{l_platform -p}'`
l_version=`$tmpdir/rpm -q --qf '%{version}' openpkg`
case "${l_version}" in
[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] )
l_release="CURRENT"
;;
* )
l_release=`echo "${l_version}" |\
sed -e 's;^;#;' \
-e 's;^#\([0-9][0-9]*\.[0-9][0-9]*\)\.0$;\1-RELEASE;' \
-e 's;^#\([0-9][0-9]*\.[0-9][0-9]*\)\.[0-9][0-9]*$;\1-SOLID;' \
-e 's;^#.*;UNKNOWN;'`
;;
esac
cat $spec |\
sed -e "/^%pre$/,/^%/ p" -e 'd' |\
sed -e '/^%/d' -e 's/^ //' |\
sed -e 's;%{[?]l_\([^:}]*\):\([^}]*\)};${\1+\2};g' \
-e 's;%{![?]l_\([^:}]*\):\([^}]*\)};${\1-\2};g' \
-e 's;%{[?]l_\([^:}]*\)};${\1+""};g' \
-e 's;%{![?]l_\([^:}]*\)};${\1-""};g' \
-e 's;%{l_\([^}]*\)};${\1};g' >>$script \
>$tmpdir/rpm.pre
sed <`SOURCE aux.wrapbin.sh` \
-e "s;@SUSR@;$susr;" -e "s;@SGRP@;$sgrp;" \
-e "s;@MUSR@;$musr;" -e "s;@MGRP@;$mgrp;" \
-e "s;@RUSR@;$rusr;" -e "s;@RGRP@;$rgrp;" \
-e "s;@NUSR@;$nusr;" -e "s;@NGRP@;$ngrp;" \
-e "s;@SUID@;$suid;" -e "s;@SGID@;$sgid;" \
-e "s;@MUID@;$muid;" -e "s;@MGID@;$mgid;" \
-e "s;@RUID@;$ruid;" -e "s;@RGID@;$rgid;" \
-e "s;@NUID@;$nuid;" -e "s;@NGID@;$ngid;" \
-e "s;@l_prefix@;$prefix;" \
-e "s;@l_platform@;$l_platform;" \
-e "s;@l_release@;$l_release;" \
-e "s;@l_version@;$l_version;" \
-e "/^@PRE@/r $tmpdir/rpm.pre" |\
sed -e '/^@PRE@/d' >$tmpdir/openpkg.boot.tmp
echo . | awk '{
for (i = 0; i < 8192; i++) {
printf(" ");
}
}' >>$tmpdir/openpkg.boot.tmp
rm -f $dstdir/openpkg-$v.$t.sh
dd if=$tmpdir/openpkg.boot.tmp bs=8192 count=8 \
of=$dstdir/openpkg-$v.$t.sh 2>/dev/null
rm -f $tmpdir/openpkg.boot.tmp
( cd $RPM_BUILD_ROOT$prefix
$RPM_BUILD_ROOT$prefix/lib/openpkg/tar --no-recursion -cf - \
openpkg.tar openpkg.bzip2 openpkg.tar.bz2
) >>$dstdir/openpkg-$v.$t.sh
# cleanup
echo "++ cleaning up"
cp `SOURCE rpmtool` $tmpdir/rpmtool
rm -rf $RPM_BUILD_ROOT
rm -rf $tmpdir/$name-$version
rm -f $tmpdir/rpm $tmpdir/rpm.[123] $tmpdir/.popt $tmpdir/rpm.pre
rm -f $prolog
# final hint about results
echo "++ resulting OpenPKG bootstrap package files:"
(cd $dstdir; ls -l openpkg-$v.$t.sh openpkg-$v.$t.rpm openpkg-$v.src.rpm)
set +x
( echo "You have successfully built the OpenPKG bootstrap packages from scratch"
echo "for prefix $prefix on target platform $l_platform. The input"
echo "was the OpenPKG Source Bootstrap Package in file:"
echo ""
echo " openpkg-$v.src.sh"
echo ""
echo "The results are the following three files:"
echo ""
echo " openpkg-$v.src.rpm"
echo " openpkg-$v.$t.rpm"
echo " openpkg-$v.$t.sh"
echo ""
echo "The first result file is the OpenPKG Source Package, containing just"
echo "the same contents than the OpenPKG Source Bootstrap Package, but now in"
echo "RPM format. Optionally use this after the installation of the OpenPKG"
echo "Binary Bootstrap Package if you want to rebuild from source again (but"
echo "then with RPM available)."
echo ""
echo "The second result file is the OpenPKG Binary Package, containing the"
echo "installation files in RPM format for the OpenPKG instance $prefix."
echo "Optionally use this after the installation of the OpenPKG Binary"
echo "Bootstrap Package if you want (usually for fixing something) to"
echo "reinstall (but then with RPM available)."
echo ""
echo "The third result file is the OpenPKG Binary Bootstrap Package,"
echo "containing the installation files as a self-extracting shell script for"
echo "the OpenPKG instance $prefix. Use this in YOUR NEXT STEP to initially"
echo "create the OpenPKG instance from scratch. Hence, proceed now by running"
echo "the following command:"
echo ""
echo " \$ sh openpkg-$v.$t.sh"
) | sh $tmpdir/rpmtool msg -b -t info
rm -f $tmpdir/rpmtool