Browse Source

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).

master
parent
commit
74dfed601f
  1. 1
      openpkg/HISTORY
  2. 40
      openpkg/openpkg.boot
  3. 349
      openpkg/openpkg.spec
  4. 149
      openpkg/platform
  5. 184
      openpkg/rpm.patch.bugfix
  6. 1142
      openpkg/rpm.patch.feature
  7. 808
      openpkg/rpm.patch.porting
  8. 392
      openpkg/rpm.patch.regen
  9. 76
      openpkg/rpmmacros
  10. 68
      openpkg/rpmpopt
  11. 205
      openpkg/rpmrc
  12. 343
      openpkg/rpmx.pl

1
openpkg/HISTORY

@ -2,6 +2,7 @@
2003
====
20030826 **** MAJOR UPGRADE FROM RPM 4.0.2 TO RPM 4.2.1 ****
20030820 name internal bootstrapping tarball just .tar instead of .tar.Z -- it is no longer compressed.
20030806 fix "rcTmp -f" functionality
20030805 trick cURL to skip some useless F77 autoconf checks to get it working under NetBSD again

40
openpkg/openpkg.boot

@ -411,8 +411,12 @@ if [ -f "$tmpdir/rpm" ]; then
echo "$0:ERROR: file $tmpdir/rpm exists, cannot override"
exit 1
fi
echo "#!/bin/sh" >$tmpdir/rpm
echo "exec $RPM_BUILD_ROOT$prefix/lib/openpkg/rpm --rcfile $tmpdir/rpm.1 \"\$@\"" >>$tmpdir/rpm
( 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
@ -448,8 +452,8 @@ sed <`SOURCE rpmmacros` >$tmpdir/rpm.3 \
# 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); }'`
sed <$RPM_BUILD_ROOT$prefix/lib/openpkg/rpmpopt-${V_rpm} >$tmpdir/.popt \
-e "s;^\\(rpm.*exec.*\\)\\(rpm[bdeukv]*\\);\\1$RPM_BUILD_ROOT$prefix/lib/openpkg/\\2;"
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
@ -462,6 +466,14 @@ export HOME
echo "++ initializing RPM database"
$tmpdir/rpm --initdb
##
## save an empty DB file so that we can install below the
## yet untouched databases with correct owner and permissions.
##
cp $RPM_BUILD_ROOT$prefix/RPM/DB/Packages \
$RPM_BUILD_ROOT$prefix/RPM/DB/Empty
##
## now turn over and re-iterate over the RPM spec, but this time
## with the real RPM tool.
@ -485,9 +497,16 @@ $tmpdir/rpm -bb $spec
##
echo "++ overwriting RPM installation by installing via RPM itself"
$tmpdir/rpm -Uvh --force --noscripts --notriggers --justdb --ignoresize \
$tmpdir/rpm --install --justdb --force --noscripts --notriggers --ignoresize \
$RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-*.rpm
##
## install OpenPKG OpenPGP public key into RPM database
##
echo "++ installing OpenPKG OpenPGP public key into RPM database"
$tmpdir/rpm --import $RPM_BUILD_ROOT$prefix/etc/openpkg/openpkg.pgp
## 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
@ -548,10 +567,17 @@ files=`cat $spec |\
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};"`
for dbfile in Basenames Conflictname Group Name Packages Providename \
Requirename Triggername; do
for dbfile in \
Packages Name Basenames Group Requirename Providename Conflictname \
Triggername Dirnames Requireversion Provideversion Installtid \
Sigmd5 Sha1header Filemd5s Depends Pubkeys; do
if [ ! -f $RPM_BUILD_ROOT$prefix/RPM/DB/$dbfile ]; then
cp $RPM_BUILD_ROOT$prefix/RPM/DB/Empty \
$RPM_BUILD_ROOT$prefix/RPM/DB/$dbfile
fi
files="$files RPM/DB/$dbfile"
done
rm -f $RPM_BUILD_ROOT$prefix/RPM/DB/Empty
( cd $RPM_BUILD_ROOT$prefix;
$RPM_BUILD_ROOT$prefix/lib/openpkg/tar --no-recursion -cf - $files) |\
$l_uuencode openpkg-$v.$t.tar >>$dstdir/openpkg-$v.$t.sh

349
openpkg/openpkg.spec

@ -39,19 +39,19 @@
# o any cc(1)
# the package version/release
%define V_openpkg 20030820
%define V_openpkg 20030826
# the used software versions
%define V_rpm 4.0.2
%define V_zlib 1.1.4
%define V_bzip2 1.0.2
%define V_db 3.2.9
%define V_curl 7.10.7
%define V_make 3.80
%define V_gzip 1.3.5
%define V_patch 2.5.4
%define V_tar 1.13.25
%define V_bash 2.05b
%define V_rpm 4.2.1
%define V_zlib 1.1.4
%define V_bzip2 1.0.2
%define V_beecrypt 3.1.0
%define V_curl 7.10.6
%define V_make 3.80
%define V_gzip 1.3.5
%define V_patch 2.5.4
%define V_tar 1.13.25
%define V_bash 2.05b
# package information
Name: openpkg
@ -68,12 +68,12 @@ Release: %{V_openpkg}
# list of sources
Source0: README
Source1: openpkg.boot
Source2: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{V_rpm}.tar.gz
Source2: ftp://ftp.openpkg.org/sources/CPY/openpkg/rpm-%{V_rpm}.tar.gz
Source3: rpm.patch.bugfix
Source4: rpm.patch.feature
Source5: rpm.patch.porting
Source6: rpm.patch.regen
Source7: http://www.sleepycat.com/update/%{V_db}/db-%{V_db}.tar.gz
Source7: http://osdn.dl.sourceforge.net/beecrypt/beecrypt-%{V_beecrypt}.tar.gz
Source8: ftp://sources.redhat.com/pub/bzip2/v102/bzip2-%{V_bzip2}.tar.gz
Source9: ftp://ftp.info-zip.org/pub/infozip/zlib/zlib-%{V_zlib}.tar.gz
Source10: http://curl.haxx.se/download/curl-%{V_curl}.tar.gz
@ -105,18 +105,18 @@ Source35: ftp://ftp.gnu.org/gnu/bash/bash-%{V_bash}.tar.gz
Source36: dot.bashrc
Source37: dot.bash_login
Source38: dot.lsyncrc
Source39: db.patch
Source40: rc.conf
Source41: aux.prereq.sh
Source42: aux.usrgrp.sh
Source43: mkproxyrpm.pl
Source44: ftp://ftp.gnu.org/gnu/config/config.guess
Source45: ftp://ftp.gnu.org/gnu/config/config.sub
Source46: make.patch
Source47: HISTORY
Source48: pod2man.sh
Source49: rc.8
Source50: rc.pod
Source39: rc.conf
Source40: aux.prereq.sh
Source41: aux.usrgrp.sh
Source42: mkproxyrpm.pl
Source43: ftp://ftp.gnu.org/gnu/config/config.guess
Source44: ftp://ftp.gnu.org/gnu/config/config.sub
Source45: make.patch
Source46: HISTORY
Source47: pod2man.sh
Source48: rc.8
Source49: rc.pod
Source50: platform
# build information
Prefix: %{l_prefix}
@ -139,10 +139,10 @@ Provides: OpenPKG
Internally the OpenPKG bootstrap package is based on the
following particular vendor products:
RedHat RPM %{V_rpm}, Berkeley-DB %{V_db}, ZLib %{V_zlib},
GNU Bzip2 %{V_bzip2}, GNU Gzip %{V_gzip}, GNU Tar %{V_tar},
GNU Patch %{V_patch}, GNU Make %{V_make}, GNU Bash %{V_bash},
cURL %{V_curl}
RedHat RPM %{V_rpm}, ZLib %{V_zlib}, GNU Bzip2 %{V_bzip2},
GNU Gzip %{V_gzip}, GNU Tar %{V_tar}, GNU Patch %{V_patch},
GNU Make %{V_make}, GNU Bash %{V_bash}, cURL %{V_curl},
BeeCrypt %{V_beecrypt}
%prep
# skip in bootstrap phase 2 (see openpkg.boot)
@ -165,8 +165,16 @@ Provides: OpenPKG
echo >>.buildenv ' echo "%{_sourcedir}/$1"'
echo >>.buildenv ' fi'
echo >>.buildenv '}'
echo >>.buildenv 'VERBOSE () {'
echo >>.buildenv ' set +x'
echo >>.buildenv ' echo "$*" | sh %{_specdir}/rpmtool msg'
echo >>.buildenv ' set -x'
echo >>.buildenv '}'
. ./.buildenv
# display verbosity header
VERBOSE "PREPARATION: Determine Build Tool Paths"
# determine path to shtool
shtool=`SOURCE shtool`
echo "shtool=$shtool" >>./.buildenv
@ -213,6 +221,9 @@ Provides: OpenPKG
usrgrp=`SOURCE aux.usrgrp.sh`
echo "usrgrp=$usrgrp" >>./.buildenv
# display verbosity header
VERBOSE "PREPERATION: Determine OpenPKG User/Group Name/Id Pairs"
# determine user/group name/id pairs
# - bootstrapping: %{l_[smrn]{usr,grp}} is set via sed(1)
# - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
@ -264,6 +275,9 @@ Provides: OpenPKG
echo "nuid=\"$nuid\"; export nuid" >>.buildenv
echo "ngid=\"$ngid\"; export ngid" >>.buildenv
# display verbosity header
VERBOSE "PREPERATION: Determine OpenPKG Instance Environment"
# determine installation location id
if [ ".%{?l_location:set}" = .set ]; then
loc="%{l_location}"
@ -307,64 +321,86 @@ Provides: OpenPKG
echo "l_build_ldlp=\"$l_build_ldlp\"; export l_build_ldlp" >>.buildenv
echo "l_build_ulim=\"$l_build_ulim\"; export l_build_ulim" >>.buildenv
# display verbosity header
VERBOSE "PREPERATION: Build GNU gzip (Compression Tool)"
# bootstrap GNU zip tool
${l_tar} xf `SOURCE gzip-%{V_gzip}.tar` 2>/dev/null || true
( cd gzip-%{V_gzip}
CC="${l_cc}" ./configure
echo "ac_cv_prog_cc_g=no" >config.cache
CC="${l_cc}" \
./configure \
--cache-file=./config.cache
${l_make}
) || exit $?
l_gzip="`pwd`/gzip-%{V_gzip}/gzip"; export l_gzip
echo "l_gzip=\"$l_gzip\"; export l_gzip" >>.buildenv
# display verbosity header
VERBOSE "PREPERATION: Unpack Distribution Tarballs"
# unpack distribution tarballs
${l_gzip} -dc `SOURCE rpm-%{V_rpm}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE zlib-%{V_zlib}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE bzip2-%{V_bzip2}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE db-%{V_db}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE curl-%{V_curl}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE make-%{V_make}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE patch-%{V_patch}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE tar-%{V_tar}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE bash-%{V_bash}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE rpm-%{V_rpm}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE zlib-%{V_zlib}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE bzip2-%{V_bzip2}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE curl-%{V_curl}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE make-%{V_make}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE patch-%{V_patch}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE tar-%{V_tar}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE bash-%{V_bash}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
${l_gzip} -dc `SOURCE beecrypt-%{V_beecrypt}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
# update config.guess/config.sub
for dir in rpm-%{V_rpm} rpm-%{V_rpm}/popt db-%{V_db}/dist \
curl-%{V_curl} make-%{V_make} patch-%{V_patch} tar-%{V_tar} bash-%{V_bash}/support; do
for dir in rpm-%{V_rpm} rpm-%{V_rpm}/popt beecrypt-%{V_beecrypt} \
curl-%{V_curl} make-%{V_make} patch-%{V_patch} tar-%{V_tar} \
bash-%{V_bash}/support; do
chmod u+w $dir/config.guess $dir/config.sub >/dev/null 2>&1 || true
cp `SOURCE config.guess` $dir/
cp `SOURCE config.sub` $dir/
done
# display verbosity header
VERBOSE "PREPERATION: Build GNU patch (Source Patching Tool)"
# bootstrap GNU patch tool
( cd patch-%{V_patch}
echo 'ac_cv_func_setmode=${ac_cv_func_setmode=no}' >config.cache
echo "ac_cv_prog_cc_g=no" >>config.cache
false=`sh $shtool path false`
echo "ac_cv_path_ed_PROGRAM=\${ac_cv_path_ed_PROGRAM=$false}" >>config.cache
CC="${l_cc}" ./configure --disable-largefile
CC="${l_cc}" \
./configure \
--disable-largefile
${l_make}
( mv patch ..; ${l_make} clean || true; mv ../patch . ) || exit $?
) || exit $?
l_patch="`pwd`/patch-%{V_patch}/patch"; export l_patch
echo "l_patch=\"$l_patch\"; export l_patch" >>.buildenv
# display verbosity header
VERBOSE "PREPERATION: Apply OpenPKG Patches to Distibutions"
# apply OpenPKG patches to distribution trees
( cd rpm-%{V_rpm}
${l_patch} -p0 <`SOURCE rpm.patch.bugfix`
${l_patch} -p0 <`SOURCE rpm.patch.feature`
${l_patch} -p0 <`SOURCE rpm.patch.porting`
${l_patch} -p0 <`SOURCE rpm.patch.regen`
touch aclocal.m4 configure
) || exit $?
( cd db-%{V_db}
${l_patch} -p0 <`SOURCE db.patch`
sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.bugfix` | ${l_patch} -p0
sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.feature` | ${l_patch} -p0
sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.porting` | ${l_patch} -p0
sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.regen` | ${l_patch} -p0
rm -rf db/docs # just reduce disk size of source tree
) || exit $?
( cd make-%{V_make}
${l_patch} -p0 <`SOURCE make.patch`
) || exit $?
# display verbosity header
VERBOSE "PREPERATION: Build GNU make (Build Tool)"
# bootstrap GNU make tool
( cd make-%{V_make}
CC="${l_cc}" ./configure --disable-nls --disable-largefile
CC="${l_cc}" \
./configure \
--disable-nls \
--disable-largefile
${l_make}
( mv make ..; ${l_make} clean || true; mv ../make . ) || exit $?
) || exit $?
@ -379,6 +415,9 @@ Provides: OpenPKG
cd openpkg-%{version}
. ./.buildenv
# display verbosity header
VERBOSE "BUILD: Build GNU bash (Bourne-Again Shell)"
# build GNU bash tool
( cd bash-%{V_bash}
( # force disabled wide-character support
@ -391,6 +430,8 @@ Provides: OpenPKG
echo "ac_cv_func_textdomain=no"
echo "ac_cv_func_bindtextdomain=no"
echo "ac_cv_lib_intl_bindtextdomain=no"
# disable building with debug symbols
echo "ac_cv_prog_cc_g=no"
) >config.cache
CC="${l_cc}"
./configure \
@ -403,11 +444,15 @@ Provides: OpenPKG
( mv bash ..; ${l_make} clean || true; mv ../bash . ) || exit $?
) || exit $?
# display verbosity header
VERBOSE "BUILD: Build GNU tar (Archiving Tool)"
# build GNU tar tool
( cd tar-%{V_tar}
echo 'am_cv_func_iconv=${am_cv_func_iconv=no}' >config.cache
echo 'am_cv_lib_iconv=${am_cv_lib_iconv=no}' >config.cache
echo 'am_cv_func_iconv=${am_cv_func_iconv=no}' >config.cache
echo 'ac_cv_prog_cc_g=no' >config.cache
sh $shtool subst -e 's;^rm conftest.sed;rm -f conftest.sed;' configure
CC="${l_cc}"
../bash-%{V_bash}/bash \
@ -419,17 +464,38 @@ Provides: OpenPKG
( mv src/tar ..; ${l_make} clean || true; mv ../tar src/ ) || exit $?
) || exit $?
# display verbosity header
VERBOSE "BUILD: Build GNU bzip2 (Compression Library)"
# build BZIP2 library
( cd bzip2-%{V_bzip2}
${l_make} CC="${l_cc}" CFLAGS="-O" libbz2.a bzip2 || exit $?
) || exit $?
# display verbosity header
VERBOSE "BUILD: Build Zlib (Compression Library)"
# build ZLIB library
( cd zlib-%{V_zlib}
CC="${l_cc}" CFLAGS="-O" ./configure
${l_make} CC="${l_cc}" CFLAGS="-O" libz.a || exit $?
) || exit $?
# build BeeCrypt library
( cd beecrypt-%{V_beecrypt}
CC="${l_cc}" \
CFLAGS="-O" \
./configure \
--prefix=%{l_prefix} \
--disable-threads \
--disable-shared
${l_make} || exit $?
cp .libs/libbeecrypt.a .
) || exit $?
# display verbosity header
VERBOSE "BUILD: Build cURL (URL Fetching Tool)"
# build cURL tool
( cd curl-%{V_curl}
( echo 'ac_cv_header_openssl_engine_h=no'
@ -451,77 +517,63 @@ Provides: OpenPKG
( mv src/curl ..; ${l_make} clean || true; mv ../curl ./src ) || exit $?
) || exit $?
# build Berkeley-DB library
( cd db-%{V_db}/build_unix
# avoid dependency to pthread
case `sh ../dist/config.guess` in
*-*-osf* ) echo 'db_cv_mutex=${db_cv_mutex=UNIX/msem_init}' >config.cache ;;
esac
CC="${l_cc}" ../dist/configure
${l_make} libdb.a || exit $?
ln libdb.a libdbXXX.a # workaround for Tru64
) || exit $?
# display verbosity header
VERBOSE "BUILD: Build RPM (RedHat Package Manager)"
# build RPM
# - we make sure RPM builds without NLS/gettext problems :-(
# - we make sure RPM finds and uses our own BZIP2/ZLIB/DB libraries
# - we speed up building by skipping the NLS/gettext data
( br=`pwd`
cd rpm-%{V_rpm}
sed -e 's;(aclocal --version);false;' \
-e 's;(automake --version);false;' \
-e 's;(autoconf --version);false;' \
-e 's;(autoheader --version);false;' \
-e 's;(makeinfo --version);false;' \
-e 's;/lib/rpm;/lib/openpkg;' \
-e "s;MKDIR_P=.*;MKDIR_P='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755';" \
-e 's;LDFLAGS_STATIC="[^"]*";LDFLAGS_STATIC="";g' \
-e 's;db-[0-9][0-9.]*;db;g' \
<configure >configure.n && \
mv configure.n configure
sed -e 's;@INTLLIBS@;@INTLLIBS@ @LIBMISC@;' \
<tools/Makefile.in >tools/Makefile.in.n && \
mv tools/Makefile.in.n tools/Makefile.in
sed -e 's;^\(SUBDIRS[ ]*=.*\) po \(.*\)$;\1 \2;' \
-e 's;^\(SUBDIRS[ ]*=.*\) tools \(.*\)$;\1 \2;' \
-e 's;^\(LIBS[ ]*=\).*;\1 @LIBS@ $(EXTRA_LIBS);' \
<Makefile.in >Makefile.in.n && mv Makefile.in.n Makefile.in
sed -e 's;^\(SUBDIRS[ ]*=.*\) po$;\1;' \
<popt/Makefile.in >popt/Makefile.in.n && \
mv popt/Makefile.in.n popt/Makefile.in
sed -e 's;BUFSIZ;8192;g' \
<rpmio/macro.c >rpmio/macro.c.n && \
mv rpmio/macro.c.n rpmio/macro.c
# remove embedded zlib (we are linking with an external one)
rm -rf zlib
# kill Linux-based preconfigured DB header, to allow the Makefiles to
# symlink to it the header that is configured for the current system.
rm -f rpmdb/db.h
# make sure we do not trigger Autoconf/Automake tools
touch configure
touch config.h.in
# disable running of any Autoconf/Automake tools
export ACLOCAL=true
export AUTOCONF=true
export AUTOMAKE=true
export AUTOHEADER=true
export MAKEINFO=true
export AMTAR=true
# cheat GNU Autoconf
( echo 'ac_cv_path_MSGFMT=${ac_cv_path_MSGFMT=no}'
echo 'ac_cv_path_GMSGFMT=${ac_cv_path_GMSGFMT=no}'
echo "ac_cv_path_MKDIR=%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755}"
echo "ac_cv_path___MKDIR=%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755}"
echo "ac_cv_path_MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'"
echo "ac_cv_path___MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'"
echo "ac_cv_path___PYTHON=true"
echo "ac_cv_path___DOXYGEN=true"
echo "acl_cv_rpath=no"
) >config.cache
mkdir perl >/dev/null 2>&1 || true
touch perl/Makefile.in
touch perl/Makefile.PL.in
case `sh ./config.guess` in
*-*-linux* ) nlsopt="--disable-nls" ;;
* ) nlsopt="--enable-nls --with-included-gettext" ;;
esac
nlsopt="--disable-nls"
CC="${l_cc} -DOPENPKG -I$br/db-%{V_db}/build_unix -I$br/zlib-%{V_zlib} -I$br/bzip2-%{V_bzip2}" \
CFLAGS="-DOPENPKG -I$br/db-%{V_db}/build_unix -I$br/zlib-%{V_zlib} -I$br/bzip2-%{V_bzip2}" \
CPPFLAGS="-DOPENPKG -I$br/db-%{V_db}/build_unix -I$br/zlib-%{V_zlib} -I$br/bzip2-%{V_bzip2}" \
LDFLAGS="-L$br/db-%{V_db}/build_unix -L$br/zlib-%{V_zlib} -L$br/bzip2-%{V_bzip2}" \
LIBS="-L$br/db-%{V_db}/build_unix -ldbXXX -L$br/zlib-%{V_zlib} -lz -L$br/bzip2-%{V_bzip2} -lbz2" \
# set build tool flags
export CC="${l_cc}"
export CPPFLAGS="-DOPENPKG -I$br/zlib-%{V_zlib} -I$br/bzip2-%{V_bzip2} -I$br/beecrypt-%{V_beecrypt}"
export CFLAGS="$CPPFLAGS"
export LDFLAGS="-L$br/zlib-%{V_zlib} -L$br/bzip2-%{V_bzip2} -L$br/beecrypt-%{V_beecrypt}"
export LIBS="$LDFLAGS -lz -lbz2 -lbeecrypt"
# configure the package
sh ./configure \
--cache-file=./config.cache \
--prefix=%{l_prefix} \
--disable-shared \
--disable-db1 \
--disable-rpath \
--with-db \
--with-glob \
--without-python \
--without-apidocs \
$nlsopt
${l_make} \
EXTRA_LIBS="-L$br/db-%{V_db}/build_unix -ldbXXX -L$br/zlib-%{V_zlib} -lz -L$br/bzip2-%{V_bzip2} -lbz2"
--disable-nls
# build the package
${l_make}
) || exit $?
%install
@ -532,6 +584,9 @@ Provides: OpenPKG
cd openpkg-%{version}
. ./.buildenv
# display verbosity header
VERBOSE "INSTALL: Create Installation Filesystem Hierarchy"
# create installation hierarchy
rm -rf $RPM_BUILD_ROOT
sh $shtool mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
@ -562,18 +617,24 @@ Provides: OpenPKG
mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir
done
# display verbosity header
VERBOSE "INSTALL: Installation of RPM"
# install RPM into installation hierarchy
( cd rpm-%{V_rpm}
${l_make} DESTDIR="$RPM_BUILD_ROOT" install
) || exit $?
# display verbosity header
VERBOSE "INSTALL: Stripping Down Installation"
# strip RPM installation
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* \
$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/* >/dev/null 2>&1 || true
for dir in man/ja man/pl man/ru man/sk src; do
rm -rf $RPM_BUILD_ROOT%{l_prefix}/$dir >/dev/null 2>&1 || true
done
for file in rpmbuild rpmdb rpme rpmi rpmsign rpmu rpmverify rpmquery gendiff; do
for file in rpme rpmi rpmsign rpmu rpmverify rpmquery gendiff; do
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/$file >/dev/null 2>&1 || true
done
rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/* >/dev/null 2>&1 || true
@ -586,21 +647,26 @@ Provides: OpenPKG
for file in \
u_pkg.sh vpkg-provides.sh vpkg-provides2.sh rpmdiff.cgi rpmdiff \
perl.prov perl.req mkinstalldirs magic.prov magic.req http.req \
getpo.sh get_magic.pl find-requires.perl find-req.pl find-provides.perl \
getpo.sh get_magic.pl find-provides find-requires \
find-requires.perl find-req.pl find-provides.perl \
find-prov.pl find-lang.sh cpanflute convertrpmrc.sh check-prereqs \
rpmputtext rpmgettext brp-compress brp-redhat brp-sparc64-linux \
brp-strip brp-strip-shared brp-strip-comment-note rpmrc \
config.guess config.sub; do
config.guess config.sub check-files; do
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
done
# display verbosity header
VERBOSE "INSTALL: Install Additional Files"
# add additional development files
cp zlib-%{V_zlib}/zlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
cp zlib-%{V_zlib}/libz.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmz.a
cp bzip2-%{V_bzip2}/bzlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
cp bzip2-%{V_bzip2}/libbz2.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbz2.a
cp db-%{V_db}/build_unix/db.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
cp db-%{V_db}/build_unix/libdb.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmdb.a
# display verbosity header
VERBOSE "INSTALL: Post-Adjust Installation"
# post-adjust RPM installation (namespace-clean POPT inclusion)
mv $RPM_BUILD_ROOT%{l_prefix}/lib/libpopt.a \
@ -615,6 +681,12 @@ Provides: OpenPKG
ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$src \
$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
done
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/rpmbuild
ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmb \
$RPM_BUILD_ROOT%{l_prefix}/bin/rpmbuild
# display verbosity header
VERBOSE "INSTALL: Install Additional Tools"
# install lsync tool
sed -e "s:@l_prefix@:%{l_prefix}:g" \
@ -629,6 +701,10 @@ Provides: OpenPKG
>$RPM_BUILD_ROOT%{l_prefix}/man/man8/lsync.8
# install RPM extension
( cd rpm-%{V_rpm}
cp file/file $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
) || exit $?
( cd curl-%{V_curl}
cp src/curl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
@ -676,6 +752,9 @@ Provides: OpenPKG
cp `SOURCE config.sub` $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/config.sub
# display verbosity header
VERBOSE "INSTALL: Install Configuration Files"
# install a few README files
sed -e "s:@l_prefix@:%{l_prefix}:g" \
<`SOURCE root.README` \
@ -718,18 +797,19 @@ Provides: OpenPKG
<`SOURCE rc.8` \
>$RPM_BUILD_ROOT%{l_prefix}/man/man8/rc.8
# hard-code RPM tool for installation hierarchy
# and adjust RPM configuration files
mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm \
$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpm
( echo "#!%{l_prefix}/lib/openpkg/bash";
echo "exec %{l_prefix}/lib/openpkg/rpm --rcfile %{l_prefix}/etc/openpkg/rpmrc \${1+\"\$@\"}"
) >$RPM_BUILD_ROOT%{l_prefix}/bin/rpm
chmod 755 $RPM_BUILD_ROOT%{l_prefix}/bin/rpm
cat `SOURCE rpmpopt` \
>>$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmpopt-%{V_rpm}
# create configuration directory
test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg || \
mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg
mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg
# install platform identification program and output
cp `SOURCE platform` $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/platform
sh `SOURCE platform` >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
chmod 755 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/platform
chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
# install overriding RPM configuration files
cat `SOURCE rpmpopt` \
>>$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmpopt
sed -e "s:@l_prefix@:%{l_prefix}:g" \
<`SOURCE rpmrc` \
>$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmrc
@ -751,6 +831,9 @@ Provides: OpenPKG
cp `SOURCE openpkg.pgp` \
$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.pgp
# display verbosity header
VERBOSE "INSTALL: Done. Thank you for flying OpenPKG..."
%files
%defattr(-,%{?l_musr}%{!?l_musr:%{l_fsusr}},%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}})
%{l_prefix}/README
@ -765,6 +848,7 @@ Provides: OpenPKG
%dir %{l_prefix}/bin
%{l_prefix}/bin/rpm2cpio
%{l_prefix}/bin/rpm
%{l_prefix}/bin/rpmbuild
%dir %{l_prefix}/etc
%{l_prefix}/etc/rc
%config(noreplace) %{l_prefix}/etc/rc.conf
@ -772,6 +856,7 @@ Provides: OpenPKG
%dir %{l_prefix}/etc/rc.d
%{l_prefix}/etc/rc.d/rc.openpkg
%dir %{l_prefix}/etc/openpkg
%config %{l_prefix}/etc/openpkg/platform
%config %{l_prefix}/etc/openpkg/rpmmacros
%config %{l_prefix}/etc/openpkg/rpmrc
%{l_prefix}/etc/openpkg/openpkg.pgp
@ -801,19 +886,17 @@ Provides: OpenPKG
%{l_prefix}/lib/openpkg/bash
%{l_prefix}/lib/openpkg/bzip2
%{l_prefix}/lib/openpkg/curl
%{l_prefix}/lib/openpkg/find-provides
%{l_prefix}/lib/openpkg/find-requires
%{l_prefix}/lib/openpkg/file
%{l_prefix}/lib/openpkg/gzip
%{l_prefix}/lib/openpkg/macros
%{l_prefix}/lib/openpkg/mkproxyrpm.pl
%{l_prefix}/lib/openpkg/patch
%{l_prefix}/lib/openpkg/rpm
%{l_prefix}/lib/openpkg/rpmb
%{l_prefix}/lib/openpkg/rpmdb
%{l_prefix}/lib/openpkg/rpmd
%{l_prefix}/lib/openpkg/rpme
%{l_prefix}/lib/openpkg/rpmi
%{l_prefix}/lib/openpkg/rpmk
%{l_prefix}/lib/openpkg/rpmpopt-%{V_rpm}
%{l_prefix}/lib/openpkg/rpmpopt
%{l_prefix}/lib/openpkg/rpmq
%{l_prefix}/lib/openpkg/rpmt
%{l_prefix}/lib/openpkg/rpmtool
@ -825,6 +908,7 @@ Provides: OpenPKG
%{l_prefix}/lib/openpkg/tar
%{l_prefix}/lib/openpkg/config.guess
%{l_prefix}/lib/openpkg/config.sub
%{l_prefix}/lib/openpkg/platform
%{l_prefix}/lib/librpmpopt.a
%{l_prefix}/lib/librpm.a
%{l_prefix}/lib/librpmbuild.a
@ -853,6 +937,7 @@ Provides: OpenPKG
%dir %{l_prefix}/man/cat8
%dir %{l_prefix}/man/cat9
%{l_prefix}/man/man8/rpm.8
%{l_prefix}/man/man8/rpmbuild.8
%{l_prefix}/man/man8/rpm2cpio.8
%{l_prefix}/man/man8/rc.8
%{l_prefix}/man/man8/lsync.8
@ -1433,6 +1518,14 @@ Provides: OpenPKG
fi
%post
# On upgrades (especially from OpenPKG 1.2 or earlier), make
# sure the OpenPKG OpenPGP public key is available to RPM for
# out-of-the-box package signature verification.
if [ ".$1" = .2 ]; then
%{l_prefix}/bin/rpm -q gpg-pubkey-63c4cb9f-3c591eda >/dev/null 2>&1 || \
%{l_prefix}/bin/rpm --import %{l_prefix}/etc/openpkg/openpkg.pgp
fi
# Finally, rebuild the RPM database with the newly installed RPM
# program on upgrades. Because of RPM internal database locking we
# have to play a little trick here and delay the operation until RPM

149
openpkg/platform

@ -0,0 +1,149 @@
#!/bin/sh
##
## platform -- Provide Platform Identification
## Copyright (c) 2003 The OpenPKG Project <http://www.openpkg.org/>
## Copyright (c) 2003 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 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.
##
# try to retrieve uname(3) information
UNAME_MACHINE=`(uname -m) 2>/dev/null` ||\
UNAME_MACHINE=`(uname -p) 2>/dev/null` ||\
UNAME_MACHINE='unknown'
UNAME_SYSTEM=`(uname -s) 2>/dev/null` ||\
UNAME_SYSTEM='unknown'
UNAME_RELEASE=`(uname -r) 2>/dev/null` ||\
UNAME_RELEASE=`(uname -v) 2>/dev/null` ||\
UNAME_RELEASE='unknown'
# initialize variables
A='unknown'
V='unknown'
S='unknown'
R=''
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}" in
# FreeBSD/NetBSD/OpenBSD
*:FreeBSD:* | *:NetBSD:* | *:OpenBSD:* )
A="${UNAME_MACHINE}"
case ${A} in
*[3456]86* ) A='ix86'; V='pc' ;;
alpha* ) V='compaq' ;;
sparc* ) V='sun' ;;
esac
S='freebsd'
R=`echo "${UNAME_RELEASE}" | sed -e 's/[-(].*$//'`
;;
# GNU/Linux
*:Linux:* )
A="${UNAME_MACHINE}"
case ${A} in
i[3456]86 ) A='ix86'; V='pc' ;;
esac
S='gnulinux'
R=`echo "${UNAME_RELEASE}" | sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`
for tagfile in dummy `cd /etc && echo *[_-]release *[_-]version 2>/dev/null`; do
test ! -f /etc/$tagfile && continue
S=`echo $tagfile | sed -e 's/[_-]release$//' -e 's/[_-]version$//' | tr '[A-Z]' '[a-z]'`
R=`cat /etc/$tagfile | grep '[0-9]' | head -1 |\
sed -e 's/^/#/' \
-e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
-e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
-e 's/^#[^0-9]*\([0-9][0-9]*\).*$/\1/' \
-e 's/^#.*$//'`
done
;;
# Sun Solaris
*:SunOS:* )
A="${UNAME_MACHINE}"
case ${A} in
i86pc ) A='ix86'; V='pc' ;;
sun4[cdm] ) A='sparc32'; V='sun' ;;
sun4u ) A='sparc64'; V='sun' ;;
sun* ) A='sparc64'; V='sun' ;;
esac
S='solaris'
R=`echo "${UNAME_RELEASE}" |\
sed -e 's;^4\.;1.;' \
-e 's;^5\.\([0-6]\).*;2.\1;' \
-e 's;^5\.\([0-9][0-9]*\).*;\1;'`
;;
# HP Tru64
*:OSF1:* )
A="${UNAME_MACHINE}"
S='tru64'
R=`echo "${UNAME_RELEASE}" | sed -e 's;^V;;'`
R="$R.`uname -v`"
;;
# HP-UX
*:HP-UX:* )
A="${UNAME_MACHINE}"
case "$A" in
9000/31? | 9000/[34]?? )
A=m68k
;;
9000/[678][0-9][0-9])
A=hppa
if [ -f /usr/bin/getconf ]; then
sc_cpu_version=`(/usr/bin/getconf SC_CPU_VERSION) 2>/dev/null`
sc_kernel_bits=`(/usr/bin/getconf SC_KERNEL_BITS) 2>/dev/null`
case "$sc_cpu_version" in
523 ) A=hppa1.0 ;;
528 ) A=hppa1.1 ;;
532 ) A=hppa2.0
case "$sc_kernel_bits" in
32) A=${A}n ;;
64) A=${A}w ;;
esac
;;
esac
fi
;;
esac
S='hpux'
R=`echo "${UNAME_RELEASE}" | sed -e 's/[^.]*.[0B]*//'`
;;
# ...SOMETHING ELSE...
* )
A=`echo "${UNAME_MACHINE}" |\
sed -e 's/[ \\\/-]//g' |\
tr '[A-Z]' '[a-z]'`
S=`echo "${UNAME_SYSTEM}" |\
tr '[A-Z]' '[a-z]' |\
sed -e 's/[^a-z0-9]//g'`
R=`echo "${UNAME_RELEASE}" |\
sed -e 's/^/#/' \
-e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
-e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
-e 's/^#[^0-9]*\([0-9][0-9]*\).*$/\1/' \
-e 's/^#.*$//'`
;;
esac
# provide result platform identifier
echo "${A}-${V}-${S}${R}"

184
openpkg/rpm.patch.bugfix

@ -1,5 +1,5 @@
##
## rpm-4.0.2.patch.bugfix -- Annotated patch file
## rpm.patch.bugfix -- Annotated patch file
## 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/>
@ -10,16 +10,89 @@
## 'patch' tool to upgrade those files. Each patch snippet is annotated
## with a short description.
##
## Created on: 23-Sep-2001
## Created on: 26-Aug-2003
##
+---------------------------------------------------------------------------
| %setup and %patch macros are treated very special internally, but
| make sure they at least optically can be used like any other macro
| and especially can have leading whitespaces.
+---------------------------------------------------------------------------
Index: build/parsePrep.c
--- build/parsePrep.c 7 Aug 2002 14:20:45 -0000 1.1.1.10
+++ build/parsePrep.c 24 Aug 2003 13:10:15 -0000
@@ -264,11 +296,12 @@
"fi");
} else {
buf[0] = '\0';
- t = stpcpy( stpcpy(buf, "tar "), taropts);
+ t = stpcpy( stpcpy(buf, tar), taropts);
*t++ = ' ';
t = stpcpy(t, fn);
}
+ tar = _free(tar);
urlfn = _free(urlfn);
return buf;
}
+---------------------------------------------------------------------------
| Remove access to not-existing beecrypt/ subdirectory
| to avoid the configure script to break building.
+---------------------------------------------------------------------------
Index: configure.ac
--- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
+++ configure.ac 26 Aug 2003 08:06:43 -0000
@@ -1274,7 +1276,6 @@
python/rpmdb/Makefile
python/test/Makefile
], [ echo timestamp > popt/stamp-h.in
- echo timestamp > beecrypt/stamp-h.in
echo timestamp > stamp-h.in
]
)
+---------------------------------------------------------------------------
| Fix filedescriptor leakage.
+---------------------------------------------------------------------------
Index: lib/psm.c
--- lib/psm.c 5 Jun 2003 12:43:18 -0000 1.1.1.6
+++ lib/psm.c 24 Aug 2003 13:10:11 -0000
@@ -940,6 +940,8 @@
if (sfdno > STDERR_FILENO) {
xx = Fclose (scriptFd);
}
+ } else {
+ xx = Fclose(out);
}
{ const char *ipath = rpmExpand("PATH=%{_install_script_path}", NULL);
+---------------------------------------------------------------------------
| Fix --justdb operation by consistently use the same rootDir checks
| RPM uses everywhere else, too.
+---------------------------------------------------------------------------
Index: lib/psm.c
--- lib/psm.c 5 Jun 2003 12:43:18 -0000 1.1.1.6
+++ lib/psm.c 24 Aug 2003 13:10:11 -0000
@@ -2027,7 +2029,8 @@
case PSM_CHROOT_IN:
{ const char * rootDir = rpmtsRootDir(ts);
/* Change root directory if requested and not already done. */
- if (rootDir != NULL && !rpmtsChrootDone(ts) && !psm->chrootDone) {
+ if (rootDir != NULL && !(rootDir[0] == '/' && rootDir[1] == '\0')
+ && !rpmtsChrootDone(ts) && !psm->chrootDone) {
static int _loaded = 0;
/*
+---------------------------------------------------------------------------
| First, remove incorrectly introduced buffer assignment. Second, fix
| second and subsequent "%{foo -x}" constructs. Without resetting
| the option index only the first construct works. Third, bugfix
| the handling of macros inside macro arguments as in "%{foo
| bar%{quux}baz}". RPM correctly determined the pointer to the
| terminating second(1) closing brace, but instead of passing
| second and subsequent "%{foo -x}" constructs for non-Linux systems
| (without resetting the option index only the first construct would
| work). Third, bugfix the handling of macros inside macro arguments
| as in "%{foo bar%{quux}baz}": RPM correctly determined the pointer
| to the terminating second closing brace, but instead of passing
| this pointer to the subroutine which handles the macro argument
| construction, it passed the underlying character. This in turn
| obviously leaded to an incorrect determination of the argument end
@ -27,52 +100,36 @@
| passing the pointer and not the underlying character.
+---------------------------------------------------------------------------
Index: rpmio/macro.c
--- rpmio/macro.c 2001/01/19 01:47:25 1.1.1.2
+++ rpmio/macro.c 2001/09/20 09:58:20 1.6
@@ -746,7 +746,7 @@
* @return address to continue parsing
--- rpmio/macro.c 15 May 2003 13:42:01 -0000 1.1.1.7
+++ rpmio/macro.c 26 Aug 2003 07:31:04 -0000
@@ -879,7 +882,7 @@
*/
/*@-bounds@*/
/*@dependent@*/ static const char *
-grabArgs(MacroBuf *mb, const MacroEntry *me, const char *se, char lastc)
+grabArgs(MacroBuf *mb, const MacroEntry *me, const char *se, char *lastc)
-grabArgs(MacroBuf mb, const MacroEntry me, /*@returned@*/ const char * se, char lastc)
+grabArgs(MacroBuf mb, const MacroEntry me, /*@returned@*/ const char * se, char *lastc)
/*@globals rpmGlobalMacroContext @*/
/*@modifies mb, rpmGlobalMacroContext @*/
{
char buf[BUFSIZ], *b, *be;
char aname[16];
@@ -764,7 +764,7 @@
@@ -900,7 +903,7 @@
/* Copy args into buf until lastc */
*be++ = ' ';
- while ((c = *se++) != '\0' && c != lastc) {
+ while ((c = *se++) != '\0' && (se-1) != lastc) {
/*@-globs@*/
if (!isblank(c)) {
*be++ = c;
continue;
@@ -801,7 +801,7 @@
/* Build argv array */
argv = (const char **) alloca((argc + 1) * sizeof(char *));
be[-1] = ' '; /* be - 1 == b + strlen(b) == buf + strlen(buf) */
- buf[0] = '\0';
+ be[0] = '\0';
b = buf;
for (c = 0; c < argc; c++) {
argv[c] = b;
@@ -814,6 +814,15 @@
opts = me->opts;
/* Define option macros. */
+#ifdef __GLIBC__
+ /* set to value of 0 instead of 1, because internally GNU libc
+ increases it to 1 implicitly, but additionally performs the
+ necessary full initialization. Without this the option parsing
+ will horribly break under Linux and various circumstances. */
+ optind = 0;
@@ -968,6 +971,8 @@
/*@-mods@*/
optind = 0; /* XXX but posix != glibc */
/*@=mods@*/
+#else
+ optind = 1;
+#endif
while((c = getopt(argc, (char **)argv, opts)) != -1) {
if (c == '?' || (o = strchr(opts, c)) == NULL) {
rpmError(RPMERR_BADSPEC, _("Unknown option %c in %s(%s)\n"),
@@ -991,7 +1000,7 @@
#endif
opts = me->opts;
@@ -1168,7 +1173,7 @@
int c;
int rc = 0;
int negate;
@ -81,7 +138,7 @@ Index: rpmio/macro.c
int chkexist;
if (++mb->depth > max_macro_depth) {
@@ -1024,7 +1033,7 @@
@@ -1202,7 +1207,7 @@
if (mb->depth > 1) /* XXX full expansion for outermost level */
t = mb->t; /* save expansion pointer for printExpand */
negate = 0;
@ -90,38 +147,31 @@ Index: rpmio/macro.c
chkexist = 0;
switch ((c = *s)) {
default: /* %name substitution */
@@ -1058,7 +1067,8 @@
fe = se;
@@ -1237,7 +1242,8 @@
/* For "%name " macros ... */
/*@-globs@*/
if ((c = *fe) && isblank(c))
- grab = '\n';
+ if ((grab = strchr(fe, '\n')) == NULL)
+ grab = strchr(fe, '\0');
break;
+ if ((grab = strchr(fe,'\n')) == NULL)
+ grab = strchr(fe, '\0');
/*@=globs@*/
/*@switchbreak@*/ break;
case '(': /* %(...) shell escape */
if ((se = matchchar(s, c, ')')) == NULL) {
@@ -1104,7 +1114,7 @@
@@ -1284,7 +1290,7 @@
ge = se - 1;
break;
/*@innerbreak@*/ break;
case ' ':
- grab = se[-1];
+ grab = se-1;
break;
/*@innerbreak@*/ break;
default:
break;
+---------------------------------------------------------------------------
| Make sure that spawned childs (%xxxx scripts) do not have
| a *copy* of the STDOUT filedescriptor of the RPM caller open.
+---------------------------------------------------------------------------
--- lib/uninstall.c.orig Mon Jan 22 16:59:13 2001
+++ lib/uninstall.c Tue Jul 29 10:16:33 2003
@@ -389,6 +389,9 @@
Fclose (ts->scriptFd);
}
}
+ else {
+ Fclose(out);
+ }
/*@innerbreak@*/ break;
@@ -1438,7 +1444,7 @@
{ const char *ipath = rpmExpand("PATH=%{_install_script_path}", NULL);
const char *path = SCRIPT_PATH;
/* Setup args for "%name " macros with opts */
if (me && me->opts != NULL) {
- if (grab != '\0') {
+ if (grab != NULL) {
se = grabArgs(mb, me, fe, grab);
} else {
addMacro(mb->mc, "**", NULL, "", mb->depth);

1142
openpkg/rpm.patch.feature

File diff suppressed because it is too large Load Diff

808
openpkg/rpm.patch.porting

@ -1,5 +1,5 @@
##
## rpm-4.0.2.patch.porting -- Annotated patch file
## rpm.patch.porting -- Annotated patch file
## 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/>
@ -10,103 +10,99 @@
## 'patch' tool to upgrade those files. Each patch snippet is annotated
## with a short description.
##
## Created on: 23-Sep-2001
## Created on: 26-Aug-2003
##
+---------------------------------------------------------------------------
| Replace RedHat-specific #include with general one.
| Add support for Berkeley-DB 3.2.x.
| Add support for BSD getmntinfo(3).
+---------------------------------------------------------------------------
Index: lib/db3.c
--- lib/db3.c 2001/02/15 00:16:09 1.1.1.3
+++ lib/db3.c 2001/06/25 14:49:03 1.2
@@ -13,7 +13,7 @@
Index: configure.ac
--- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
+++ configure.ac 26 Aug 2003 08:06:43 -0000
@@ -963,12 +964,13 @@
AC_CHECK_FUNCS(getpassphrase)
#include "system.h"
AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
+ AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have the getmntinfo() function]), [
AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
- AC_LIBOBJ(getmntent)])])])])
+ AC_LIBOBJ(getmntent)])])])])])
-#include <db3/db.h>
+#include <db.h>
#include <rpmlib.h>
#include <rpmmacro.h>
@@ -135,7 +135,7 @@
xx = db_env_create(&dbenv, 0);
xx = cvtdberr(dbi, "db_env_create", rc, _debug);
-#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR == 1
+#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR >= 1
xx = dbenv->remove(dbenv, dbhome, 0);
#else
xx = dbenv->remove(dbenv, dbhome, NULL, 0);
@@ -213,7 +213,7 @@
/* dbenv->set_tx_max(???) */
/* dbenv->set_tx_recover(???) */
if (dbi->dbi_no_fsync) {
-#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR == 1
+#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR >= 1
xx = db_env_set_func_fsync(db3_fsync_disable);
#else
xx = dbenv->set_func_fsync(dbenv, db3_fsync_disable);
@@ -231,7 +231,7 @@
#endif /* __USE_DB3 */
#if defined(__USE_DB3)
-#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR == 1
+#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR >= 1
rc = dbenv->open(dbenv, dbhome, eflags, dbi->dbi_perms);
#else
rc = dbenv->open(dbenv, dbhome, NULL, eflags, dbi->dbi_perms);
AC_CHECK_FUNC(lchown,
[__CHOWN_RHF="%{__chown} -Rhf"
+---------------------------------------------------------------------------
| Replace RedHat-specific #include with general one.
| Not all Bourne-Shells support embedded TAB characters in
| here-document style constructs. Insert the TAB character indirectly
| to workaround problems. Additionally, there is no need to build a
| shared library version of Berkeley-DB.
+---------------------------------------------------------------------------
Index: lib/dbconfig.c
--- lib/dbconfig.c 2001/02/14 19:49:14 1.1.1.1
+++ lib/dbconfig.c 2001/06/25 14:49:03 1.2
@@ -4,7 +4,7 @@
Index: db3/configure
--- db3/configure 18 Jan 2003 14:04:22 -0000 1.1.1.4
+++ db3/configure 25 Aug 2003 10:35:39 -0000
@@ -8,18 +8,18 @@
ARGS="`echo $* | sed -e 's% [^ ]*CFLAGS=[^ ]*%%' -e 's% -[^-][^ ]*%%g' -e 's%--cache-file=.*$%%'`"
#include "system.h"
CC="$CC" CFLAGS="$CFLAGS" $db_dist/configure $ARGS \
- --enable-shared --enable-static --enable-rpc \
+ --disable-shared --enable-static --enable-rpc \
--with-uniquename=_rpmdb --srcdir=$db_dist
-#include <db3/db.h>
+#include <db.h>
mv Makefile Makefile.orig
cat Makefile.orig | sed -e '/^install[:-]/c\
.PHONY: listobjs\
listobjs:\
- @echo $(OBJS) $(C_OBJS) \
+~@echo $(OBJS) $(C_OBJS) \
\
distdir install check:\
\
-db4_install: all install_setip' > Makefile
+db4_install: all install_setip' | tr '~' ' ' > Makefile
#include <rpmlib.h>
#include <rpmmacro.h>
mv db.h db.h.orig
cat db.h.orig | sed \
+---------------------------------------------------------------------------
| Avoid non-portable construct: a self-referencing structure
| declaration cannot be combined with the corresponding typedef.
| Although GCC supports this (and does the correct thing), most
| other stricter compilers complain and fail.
| Add support for BSD getmntinfo(3).
+---------------------------------------------------------------------------
Index: rpmio/rpmmacro.h
--- rpmio/rpmmacro.h 2000/12/11 18:41:27 1.1.1.2
+++ rpmio/rpmmacro.h 2001/06/25 19:26:59 1.2
@@ -6,14 +6,15 @@
*/
Index: lib/fs.c
--- lib/fs.c 4 Jun 2003 18:09:43 -0000 1.1.1.13
+++ lib/fs.c 24 Aug 2003 13:10:21 -0000
@@ -164,6 +164,12 @@
int nextMount = 0;
/*! The structure used to store a macro. */
-typedef /*@abstract@*/ struct MacroEntry {
+struct MacroEntry {
struct MacroEntry *prev;/*!< Macro entry stack. */
const char *name; /*!< Macro name. */
const char *opts; /*!< Macro parameters (a la getopt) */
const char *body; /*!< Macro body. */
int used; /*!< No. of expansions. */
int level; /*!< Scoping level. */
-} MacroEntry;
+};
+typedef /*@abstract@*/ struct MacroEntry MacroEntry;
getmntinfo_r(&mounts, flags, &mntCount, &bufSize);
+# elif HAVE_GETMNTINFO
+ struct statfs * mounts = NULL;
+ int mntCount, flags = MNT_NOWAIT;
+ int nextMount = 0;
+
+ mntCount = getmntinfo(&mounts, flags);
# endif
/*! The structure used to store the set of macros in a context. */
typedef /*@abstract@*/ struct MacroContext {
filesystems = xcalloc((numAlloced + 1), sizeof(*filesystems)); /* XXX memory leak */
@@ -191,6 +197,9 @@
if (getmntent(mtab, &item)) break;
mntdir = item.our_mntdir;
# elif HAVE_GETMNTINFO_R
+ if (nextMount == mntCount) break;
+ mntdir = mounts[nextMount++].f_mntonname;
+# elif HAVE_GETMNTINFO
if (nextMount == mntCount) break;
mntdir = mounts[nextMount++].f_mntonname;
# endif
+---------------------------------------------------------------------------
| Add support for OSF1/Tru64.
| Add support for Compaq/HP OSF1/Tru64.
+---------------------------------------------------------------------------
Index: misc/fnmatch.h
--- misc/fnmatch.h 2000/03/10 22:02:29 1.1.1.2
+++ misc/fnmatch.h 2001/06/25 19:43:38 1.2
--- misc/fnmatch.h 22 Feb 2002 17:12:15 -0000 1.1.1.3
+++ misc/fnmatch.h 24 Aug 2003 13:10:21 -0000
@@ -55,7 +55,7 @@
#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
@ -118,11 +114,21 @@ Index: misc/fnmatch.h
# define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
+---------------------------------------------------------------------------
| Add support for OSF1/Tru64.
| Use more correct Autoconf based size_t check.
| Add support for Compaq/HP OSF1/Tru64.
+---------------------------------------------------------------------------
Index: misc/glob.h
--- misc/glob.h 2000/03/11 20:59:30 1.1.1.3
+++ misc/glob.h 2001/06/25 19:43:38 1.2
--- misc/glob.h 11 Mar 2000 20:59:30 -0000 1.1.1.3
+++ misc/glob.h 24 Aug 2003 13:10:21 -0000
@@ -46,7 +46,7 @@
#endif /* C++ or ANSI C. */
/* We need `size_t' for the following definitions. */
-#ifndef __size_t
+#if !defined(__size_t) && !defined(_SIZE_T_DECLARED)
# if defined __GNUC__ && __GNUC__ >= 2
typedef __SIZE_TYPE__ __size_t;
# ifdef _XOPEN_SOURCE
@@ -74,7 +74,7 @@
#define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */
@ -134,196 +140,516 @@ Index: misc/glob.h
# define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */
+---------------------------------------------------------------------------
| Make sure db1xxx() function references are only used if Berkeley-DB
| 1.x was really found.
+---------------------------------------------------------------------------
Index: lib/rpmdb.c
--- lib/rpmdb.c 2001/02/23 21:43:20 1.1.1.17
+++ lib/rpmdb.c 2001/06/25 19:45:29 1.2
@@ -2124,6 +2124,7 @@
case 2:
case 1:
case 0:
+#if USE_DB1
for (i = 0; i < dbiTagsMax; i++) {
const char * base = db1basename(dbiTags[i]);
sprintf(filename, "%s/%s/%s", rootdir, dbpath, base);
@@ -2131,6 +2132,7 @@
xx = unlink(filename);
free((void *)base);
}
+#endif
break;
}
| Add libmisc.a for platform portability.
+---------------------------------------------------------------------------
Index: tools/Makefile.am
--- tools/Makefile.am 29 May 2003 17:40:17 -0000 1.1.1.14
+++ tools/Makefile.am 26 Aug 2003 07:57:50 -0000
@@ -22,7 +22,7 @@
LDADD = \
$(top_builddir)/lib/librpm.la \
- @INTLLIBS@
+ @INTLLIBS@ @LIBMISC@
staticLDFLAGS = @LDFLAGS_STATIC@ @LDFLAGS_NPTL@
@@ -2213,6 +2215,7 @@
case 2:
case 1:
case 0:
+#if USE_DB1
for (i = 0; i < dbiTagsMax; i++) {
const char * base;
int rpmtag;
@@ -2240,6 +2243,7 @@
rc = 1;
free((void *)base);
}
+#endif
break;
}
if (rc || _olddbapi == _newdbapi)
+---------------------------------------------------------------------------
| Add support for BSD getmntinfo(3).
| Add libmisc.a for platform portability.
+---------------------------------------------------------------------------
Index: acconfig.h
--- acconfig.h 2000/12/11 18:40:56 1.1.1.7
+++ acconfig.h 2001/07/05 11:44:10 1.2
@@ -65,6 +65,9 @@
/* Define as 1 if you have getmntinfo_r() (only osf?) */
#undef HAVE_GETMNTINFO_R
Index: tools/Makefile.in
--- tools/Makefile.in 16 Jul 2003 17:05:51 -0000 1.1.1.20
+++ tools/Makefile.in 26 Aug 2003 07:57:42 -0000
@@ -275,7 +275,7 @@
LDADD = \
$(top_builddir)/lib/librpm.la \
- @INTLLIBS@
+ @INTLLIBS@ @LIBMISC@
+/* Define as 1 if you have getmntinfo() */
+#undef HAVE_GETMNTINFO
+
/* Define as 1 if you have "struct mnttab" (only sco?) */
#undef HAVE_STRUCT_MNTTAB
staticLDFLAGS = @LDFLAGS_STATIC@ @LDFLAGS_NPTL@
+---------------------------------------------------------------------------
| Add support for BSD getmntinfo(3).
| Use GNU libtool's weaker -static (link with own static libraries)
| instead of the strong -all-static (link even with static libc, etc),
| because OpenPKG does not need to be fully static.
+---------------------------------------------------------------------------
Index: config.h.in
--- config.h.in 2001/02/21 20:47:08 1.1.1.12
+++ config.h.in 2001/07/05 11:44:10 1.11
@@ -123,6 +123,9 @@
/* Define as 1 if you have getmntinfo_r() (only osf?) */
#undef HAVE_GETMNTINFO_R
Index: rpmdb/Makefile.am
--- rpmdb/Makefile.am 2 Jul 2003 20:14:07 -0000 1.1.1.7
+++ rpmdb/Makefile.am 26 Aug 2003 10:10:23 -0000
@@ -18,7 +18,7 @@
EXTRA_PROGRAMS = tjfn
+/* Define as 1 if you have getmntinfo() */
+#undef HAVE_GETMNTINFO
+
/* Define as 1 if you have "struct mnttab" (only sco?) */
#undef HAVE_STRUCT_MNTTAB
tjfn_SOURCES = tjfn.c
-tjfn_LDFLAGS = -all-static
+tjfn_LDFLAGS = -static
tjfn_LDADD = librpmdb.la
pkgincdir = $(pkgincludedir)
@@ -180,4 +180,4 @@
$(LINT) $(DEFS) $(INCLUDES) $(librpmdb_la_SOURCES)
tdbi: librpmdb.la tdbi.o
- $(LINK) -all-static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
+ $(LINK) -static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
+---------------------------------------------------------------------------
| Add support for BSD getmntinfo(3).
| Use GNU libtool's weaker -static (link with own static libraries)
| instead of the strong -all-static (link even with static libc, etc),
| because OpenPKG does not need to be fully static.
+---------------------------------------------------------------------------
Index: configure.in
--- configure.in 2001/02/25 17:13:26 1.1.1.17
+++ configure.in 2001/07/05 11:44:11 1.2
@@ -815,12 +815,13 @@
AC_CHECK_FUNCS(getpassphrase)
Index: rpmdb/Makefile.in
--- rpmdb/Makefile.in 16 Jul 2003 17:05:48 -0000 1.1.1.7
+++ rpmdb/Makefile.in 26 Aug 2003 10:10:46 -0000
@@ -273,7 +273,7 @@
EXTRA_PROGRAMS = tjfn
AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT), [
+ AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO), [
AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL),[
AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R), [
AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
AC_DEFINE(HAVE_GETMNTINFO_R)], [
AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
- LIBOBJS="$LIBOBJS getmntent.o"])])])])
+ LIBOBJS="$LIBOBJS getmntent.o"])])])])])
tjfn_SOURCES = tjfn.c
-tjfn_LDFLAGS = -all-static
+tjfn_LDFLAGS = -static
tjfn_LDADD = librpmdb.la
AC_CHECK_FUNC(lchown,
[__CHOWN_RHF="%{__chown} -Rhf"
pkgincdir = $(pkgincludedir)
@@ -952,7 +952,7 @@
$(LINT) $(DEFS) $(INCLUDES) $(librpmdb_la_SOURCES)
tdbi: librpmdb.la tdbi.o
- $(LINK) -all-static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
+ $(LINK) -static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
+---------------------------------------------------------------------------
| Add support for BSD getmntinfo(3).
| Use GNU libtool's weaker -static (link with own static libraries)
| instead of the strong -all-static (link even with static libc, etc),
| because OpenPKG does not need to be fully static.
+---------------------------------------------------------------------------
Index: system.h
--- system.h 2000/12/11 18:40:56 1.1.1.5
+++ system.h 2001/07/05 11:44:11 1.2
@@ -325,7 +325,7 @@
#define lchown chown
#endif
Index: rpmio/Makefile.am
--- rpmio/Makefile.am 5 Jun 2003 12:05:23 -0000 1.1.1.9
+++ rpmio/Makefile.am 26 Aug 2003 07:34:21 -0000
@@ -68,27 +68,27 @@
tdigest_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
-#if HAVE_GETMNTINFO_R || HAVE_MNTCTL
+#if HAVE_GETMNTINFO_R || HAVE_GETMNTINFO || HAVE_MNTCTL
# define GETMNTENT_ONE 0
# define GETMNTENT_TWO 0
# if HAVE_SYS_MNTCTL_H
tdir_SOURCES = tdir.c
-tdir_LDFLAGS = -all-static
+tdir_LDFLAGS = -static
tdir_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
tfts_SOURCES = tfts.c
-tfts_LDFLAGS = -all-static
+tfts_LDFLAGS = -static
tfts_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
tglob_SOURCES = tglob.c
-tglob_LDFLAGS = -all-static
+tglob_LDFLAGS = -static
tglob_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
tinv_SOURCES = tinv.c
-tinv_LDFLAGS = -all-static
+tinv_LDFLAGS = -static
tinv_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
tkey_SOURCES = tkey.c
-tkey_LDFLAGS = -all-static
+tkey_LDFLAGS = -static
tkey_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
tring_SOURCES = tring.c
-tring_LDFLAGS = -all-static
+tring_LDFLAGS = -static
tring_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
trpmio_SOURCES = trpmio.c
+---------------------------------------------------------------------------
| Add support for BSD getmntinfo(3).
| Use GNU libtool's weaker -static (link with own static libraries)
| instead of the strong -all-static (link even with static libc, etc),
| because OpenPKG does not need to be fully static.
| Additionally, remove hard-coded Linux'ism of linking against POSIX
| rt/pthread libraries (is not needed even under Linux itself) and
| make sure the build does not break by an empty argument list when
| iterating over (the not existing) BeeCrypt objects.
+---------------------------------------------------------------------------
Index: lib/fs.c
--- lib/fs.c 2001/01/15 23:10:04 1.1.1.8
+++ lib/fs.c 2001/07/05 11:44:14 1.2
@@ -138,7 +138,7 @@
# if GETMNTENT_ONE || GETMNTENT_TWO
our_mntent item;
FILE * mtab;
-# elif HAVE_GETMNTINFO_R
+# elif HAVE_GETMNTINFO_R || HAVE_GETMNTINFO
struct statfs * mounts = NULL;
int mntCount = 0, bufSize = 0, flags = MNT_NOWAIT;
int nextMount = 0;
@@ -155,6 +155,8 @@
}
# elif HAVE_GETMNTINFO_R
getmntinfo_r(&mounts, flags, &mntCount, &bufSize);
+# elif HAVE_GETMNTINFO
+ mntCount = getmntinfo(&mounts, flags);
# endif
Index: rpmio/Makefile.in
--- rpmio/Makefile.in 16 Jul 2003 17:05:49 -0000 1.1.1.9
+++ rpmio/Makefile.in 26 Aug 2003 07:34:30 -0000
@@ -288,8 +288,7 @@
librpmio_la_LDFLAGS = -release 4.2 \
@WITH_BEECRYPT_LIB@ \
$(top_builddir)/file/libfmagic.la \
- @WITH_ZLIB_LIB@ \
- -lrt -lpthread
+ @WITH_ZLIB_LIB@
filesystems = xcalloc((numAlloced + 1), sizeof(*filesystems)); /* XXX memory leak */
@@ -175,7 +177,7 @@
/* Solaris, maybe others */
if (getmntent(mtab, &item)) break;
mntdir = item.our_mntdir;
-# elif HAVE_GETMNTINFO_R
+# elif HAVE_GETMNTINFO_R || HAVE_GETMNTINFO
if (nextMount == mntCount) break;
mntdir = mounts[nextMount++].f_mntonname;
# endif
librpmio_la_LIBADD = $(BEECRYPTLOBJS)
librpmio_la_DEPENDENCIES = .created
@@ -298,27 +297,27 @@
tdigest_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
tdir_SOURCES = tdir.c
-tdir_LDFLAGS = -all-static
+tdir_LDFLAGS = -static
tdir_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
tfts_SOURCES = tfts.c
-tfts_LDFLAGS = -all-static
+tfts_LDFLAGS = -static
tfts_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
tglob_SOURCES = tglob.c
-tglob_LDFLAGS = -all-static
+tglob_LDFLAGS = -static
tglob_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
tinv_SOURCES = tinv.c
-tinv_LDFLAGS = -all-static
+tinv_LDFLAGS = -static
tinv_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
tkey_SOURCES = tkey.c
-tkey_LDFLAGS = -all-static
+tkey_LDFLAGS = -static
tkey_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
tring_SOURCES = tring.c
-tring_LDFLAGS = -all-static
+tring_LDFLAGS = -static
tring_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
trpmio_SOURCES = trpmio.c
@@ -743,8 +742,8 @@
.created:
if test X"@WITH_BEECRYPT_SUBDIR@" != X; then \
${MAKE} -C $(top_builddir)/@WITH_BEECRYPT_SUBDIR@ listobjs ; \
- for lo in $(BEECRYPTLOBJS); do \
- [ -f $$lo ] || $(LN_S) $(top_builddir)/@WITH_BEECRYPT_SUBDIR@/$$lo $$lo ; \
+ for lo in $(BEECRYPTLOBJS) ''; do \
+ [ ".$$lo" = . ] || [ -f $$lo ] || $(LN_S) $(top_builddir)/@WITH_BEECRYPT_SUBDIR@/$$lo $$lo ; \
done \
fi
touch $@
+---------------------------------------------------------------------------
| Fix inconsistency in declaration.
| Add FreeBSD support.
+---------------------------------------------------------------------------
Index: rpmio/rpmio_internal.h
--- rpmio/rpmio_internal.h.orig Fri Aug 9 22:21:42 2002
+++ rpmio/rpmio_internal.h Fri Aug 9 22:21:42 2002
@@ -5,7 +5,7 @@
* \file rpmio/rpmio_internal.h
*/
Index: rpmio/fts.c
--- rpmio/fts.c 18 Jan 2003 16:13:17 -0000 1.1.1.3
+++ rpmio/fts.c 25 Aug 2003 09:19:37 -0000
@@ -34,6 +34,8 @@
static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
#endif /* LIBC_SCCS and not lint */
+#include <limits.h>
+
#if defined(_LIBC)
#include <sys/param.h>
#include <include/sys/stat.h>
@@ -58,6 +60,13 @@
# define dirfd(dirp) -1
# define _STAT_VER 0
# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
+#endif
+#if defined(__FreeBSD__)
+# define __errno_location() (&errno)
+# define stat64 stat
+# define _STAT_VER 0
+# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
+# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
#endif
#include "system.h"
#include "fts.h"
+---------------------------------------------------------------------------
| Remove inclusion of system <glob.h> because RPM uses its own glob(3)
| implementation and this can conflict with the system one.
+---------------------------------------------------------------------------
Index: rpmio/rpmio.h
--- rpmio/rpmio.h 12 Jun 2003 18:22:18 -0000 1.1.1.7
+++ rpmio/rpmio.h 24 Aug 2003 13:10:21 -0000
@@ -9,9 +9,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
-/*@-noparams@*/
-#include <glob.h>
-/*@=noparams@*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+---------------------------------------------------------------------------
| Make this whole "dirent" fiddling at least working on FreeBSD,
| Solaris and HPUX. This certainly is a bad corner of RPM which
| inherently leads to portability problems.
+---------------------------------------------------------------------------
Index: rpmio/rpmrpc.c
--- rpmio/rpmrpc.c 29 May 2003 22:14:04 -0000 1.1.1.8
+++ rpmio/rpmrpc.c 24 Aug 2003 13:10:21 -0000
@@ -1079,6 +1079,8 @@
return rc;
}
+#if !defined(__FreeBSD__) && !defined(sun)
+
struct __dirstream {
int fd; /* File descriptor. */
char * data; /* Directory block. */
@@ -1091,6 +1093,8 @@
#endif
};
+#endif
+
#if !defined(DT_DIR)
# define DT_UNKNOWN 0
# define DT_FIFO 1
@@ -1101,14 +1105,30 @@
# define DT_LNK 10
# define DT_SOCK 12
# define DT_WHT 14
-typedef struct __dirstream * FTPDIR;
-#else
-typedef DIR * FTPDIR;
#endif
+struct mydirstreament {
+ unsigned char type;
+ char *name;
+};
+struct mydirstream {
+ DIR dir;
+ struct dirent ent;
+ unsigned int offset;
+ unsigned int size;
+ struct mydirstreament av[1];
+};
+typedef struct mydirstream *FTPDIR;
+
/*@unchecked@*/
static int ftpmagicdir = 0x8440291;
-#define ISFTPMAGIC(_dir) (!memcmp((_dir), &ftpmagicdir, sizeof(ftpmagicdir)))
+#if !defined(__FreeBSD__) && !defined(sun)
+#define SETFTPMAGIC(_dir) ((_dir)->fd) = ftpmagicdir
+#define ISFTPMAGIC(_dir) ((_dir)->fd == ftpmagicdir)
+#else
+#define SETFTPMAGIC(_dir) ((_dir)->dd_fd) = ftpmagicdir
+#define ISFTPMAGIC(_dir) ((_dir)->dd_fd == ftpmagicdir)
+#endif
/*@-boundswrite@*/
/*@-type@*/ /* FIX: abstract DIR */
@@ -1121,8 +1141,7 @@
struct dirent * dp;
size_t nb;
const char * s, * sb, * se;
- const char ** av;
- unsigned char * dt;
+ struct mydirstreament * av;
char * t;
int ac;
int c;
@@ -1165,28 +1184,22 @@
}
}
- nb += sizeof(*mydir) + sizeof(*dp) + ((ac + 1) * sizeof(*av)) + (ac + 1);
+ nb = sizeof(*mydir) + (ac * sizeof(*av)) + nb;
mydir = xcalloc(1, nb);
/*@-abstract@*/
- dp = (struct dirent *) (mydir + 1);
- av = (const char **) (dp + 1);
- dt = (char *) (av + (ac + 1));
- t = (char *) (dt + ac + 1);
+ dp = &mydir->ent;
+ av = &mydir->av[0];
+ t = (char *)&mydir->av[ac+1];
/*@=abstract@*/
- mydir->fd = ftpmagicdir;
-/*@-usereleased@*/
- mydir->data = (char *) dp;
-/*@=usereleased@*/
- mydir->allocation = nb;
- mydir->size = ac;
- mydir->offset = -1;
- mydir->filepos = 0;
+ SETFTPMAGIC((DIR *)mydir);
+ mydir->size = ac;
+ mydir->offset = 0;
ac = 0;
/*@-dependenttrans -unrecog@*/
- dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, "."); t++;
- dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, ".."); t++;
+ av[ac].type = DT_DIR; av[ac].name = t; t = stpcpy(t, "."); ++ac;
+ av[ac].type = DT_DIR; av[ac].name = t; t = stpcpy(t, ".."); ++ac;
/*@=dependenttrans =unrecog@*/
sb = NULL;
s = se = ftpBuf;
@@ -1198,34 +1211,34 @@
/*@switchbreak@*/ break;
case '\r':
/*@-dependenttrans@*/
- av[ac] = t;
+ av[ac].name = t;
/*@=dependenttrans@*/
if (sb == NULL) {
/*@-unrecog@*/
switch(*s) {
case 'p':
- dt[ac] = DT_FIFO;
+ av[ac].type = DT_FIFO;
/*@innerbreak@*/ break;
case 'c':
- dt[ac] = DT_CHR;
+ av[ac].type = DT_CHR;
/*@innerbreak@*/ break;
case 'd':
- dt[ac] = DT_DIR;
+ av[ac].type = DT_DIR;
/*@innerbreak@*/ break;
case 'b':
- dt[ac] = DT_BLK;
+ av[ac].type = DT_BLK;
/*@innerbreak@*/ break;
case '-':
- dt[ac] = DT_REG;
+ av[ac].type = DT_REG;
/*@innerbreak@*/ break;
case 'l':
- dt[ac] = DT_LNK;
+ av[ac].type = DT_LNK;
/*@innerbreak@*/ break;
case 's':
- dt[ac] = DT_SOCK;
+ av[ac].type = DT_SOCK;
/*@innerbreak@*/ break;
default:
- dt[ac] = DT_UNKNOWN;
+ av[ac].type = DT_UNKNOWN;
/*@innerbreak@*/ break;
}
/*@=unrecog@*/
@@ -1243,7 +1256,7 @@
/*@switchbreak@*/ break;
}
}
- av[ac] = NULL;
+ av[ac].name = NULL;
/*@-kepttrans@*/
return (DIR *) mydir;
@@ -1258,43 +1271,50 @@
{
FTPDIR mydir = (FTPDIR)dir;
struct dirent * dp;
- const char ** av;
- unsigned char * dt;
+ struct mydirstreament * av;
int ac;
int i;
/*@+voidabstract@*/
- if (mydir == NULL || !ISFTPMAGIC(mydir) || mydir->data == NULL) {
+ if (dir == NULL || !ISFTPMAGIC(dir)) {
/* XXX TODO: EBADF errno. */
return NULL;
}
/*@=voidabstract@*/
- dp = (struct dirent *) mydir->data;
- av = (const char **) (dp + 1);
+ dp = &mydir->ent;
+ av = &mydir->av[0];
ac = mydir->size;
- dt = (char *) (av + (ac + 1));
- i = mydir->offset + 1;
+ i = mydir->offset + 1;
-static inline int fdFileno(void * cookie);
+inline int fdFileno(void * cookie);
/*@-boundsread@*/
- if (i < 0 || i >= ac || av[i] == NULL)
+ if (i < 0 || i >= ac || av[i].name == NULL)
return NULL;
/*@=boundsread@*/
#include <rpmio.h>
#include <rpmurl.h>
mydir->offset = i;
+#if defined(__FreeBSD__)
+ dp->d_ino = i + 1;
+ dp->d_reclen = 0;
+ dp->d_type = av[i].type;
+ strncpy(dp->d_name, av[i].name, sizeof(dp->d_name) - 1);
+ dp->d_name[sizeof(dp->d_name)-1] = '\0';
+ dp->d_namlen = strlen(dp->d_name);
+#elif defined(hpux) || defined(sun)
+ /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
+ dp->d_ino = i + 1; /* W2DO? */
+ dp->d_reclen = 0; /* W2DO? */
+ strncpy(dp->d_name, av[i].name, sizeof(dp->d_name));
+#else
/* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
dp->d_ino = i + 1; /* W2DO? */
dp->d_reclen = 0; /* W2DO? */
-
-#if !defined(hpux) && !defined(sun)
dp->d_off = 0; /* W2DO? */
-/*@-boundsread@*/
- dp->d_type = dt[i];
-/*@=boundsread@*/
+ dp->d_type = av[i].type;
+ strncpy(dp->d_name, av[i].name, sizeof(dp->d_name));
#endif
- strncpy(dp->d_name, av[i], sizeof(dp->d_name));
/*@+voidabstract@*/
if (_ftp_debug)
fprintf(stderr, "*** ftpReaddir(%p) %p \"%s\"\n", (void *)mydir, dp, dp->d_name);
@@ -1313,7 +1333,7 @@
/*@+voidabstract@*/
if (_ftp_debug)
fprintf(stderr, "*** ftpClosedir(%p)\n", (void *)mydir);
- if (mydir == NULL || !ISFTPMAGIC(mydir)) {
+ if (dir == NULL || !ISFTPMAGIC(dir)) {
/* XXX TODO: EBADF errno. */
return -1;
}
+---------------------------------------------------------------------------
| Fix for FreeBSD 5.0
| Remove inclusion of ancient (and since years deprecated) <malloc.h>
| header. This especially makes sure RPM build does not break on
| strict platforms like FreeBSD 5.
+---------------------------------------------------------------------------
Index: misc/glob.h
--- misc/glob.h 2002/09/23 16:45:45 1.1
+++ misc/glob.h 2002/09/23 16:46:23
@@ -46,7 +46,7 @@
#endif /* C++ or ANSI C. */
Index: system.h
--- system.h 1 Mar 2003 19:53:08 -0000 1.1.1.10
+++ system.h 24 Aug 2003 13:10:21 -0000
@@ -256,10 +256,6 @@
#include <err.h>
#endif
/* We need `size_t' for the following definitions. */
-#ifndef __size_t
+#if !defined(__size_t) && !defined(_SIZE_T_DECLARED)
# if defined __GNUC__ && __GNUC__ >= 2
typedef __SIZE_TYPE__ __size_t;
# ifdef _XOPEN_SOURCE
-#if HAVE_MALLOC_H && !defined(__LCLINT__)
-#include <malloc.h>
-#endif
-
/*@-declundef -incondefs @*/ /* FIX: these are macros */
/**
*/
+---------------------------------------------------------------------------
| Add support for BSD getmntinfo(3).
+---------------------------------------------------------------------------
| Fix for Power Macs running MacOS X
+---------------------------------------------------------------------------
Index: lib/rpmrc.c
--- lib/rpmrc.c Sat Mar 15 17:32:40 2003
+++ lib/rpmrc.c Sat Mar 15 17:35:44 2003
@@ -949,6 +949,12 @@
}
strcat(un.sysname, cpR);
}
+ /* fix up machine hardware name containing white-space as it
+ * happens to be on Power Macs running MacOS X
+ */
+ if (!strncmp(un.machine, "Power Macintosh", 15)) {
+ sprintf(un.machine, "powerpc");
+ }
}
#else /* OPENPKG */
#if !defined(__linux__)
Index: system.h
--- system.h 1 Mar 2003 19:53:08 -0000 1.1.1.10
+++ system.h 24 Aug 2003 13:10:21 -0000
@@ -550,7 +546,7 @@
#define lchown chown
#endif
-#if HAVE_GETMNTINFO_R || HAVE_MNTCTL
+#if HAVE_GETMNTINFO_R || HAVE_GETMNTINFO || HAVE_MNTCTL
# define GETMNTENT_ONE 0
# define GETMNTENT_TWO 0
# if HAVE_SYS_MNTCTL_H

392
openpkg/rpm.patch.regen

@ -1,5 +1,5 @@
##
## rpm-4.0.2.patch.regen -- Annotated patch file
## rpm.patch.regen -- Annotated patch file
## 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/>
@ -10,219 +10,251 @@
## 'patch' tool to upgrade those files. Each patch snippet is annotated
## with a short description.
##
## Created on: 23-Sep-2001
## Created on: 26-Aug-2003
##
+---------------------------------------------------------------------------
| Regenerated configure script from GNU autoconf run after
| the patches for configure.in were applied.
| Corresponding patches in "config.h.in" script after regeneration from
| patched "configure.ac" with "autoheader".
+---------------------------------------------------------------------------
Index: config.h.in
--- config.h.in 16 Jul 2003 17:17:13 -0000 1.1.1.18
+++ config.h.in 24 Aug 2003 18:58:58 -0000
@@ -108,6 +108,9 @@
/* Define if you have the getmntent() function */
#undef HAVE_GETMNTENT
+/* Define as 1 if you have the getmntinfo() function */
+#undef HAVE_GETMNTINFO
+
/* Define as 1 if you have getmntinfo_r() (only osf?) */
#undef HAVE_GETMNTINFO_R
+---------------------------------------------------------------------------
| Corresponding patches in "configure" script after regeneration from
| patched "configure.ac" with "autoconf".
+---------------------------------------------------------------------------
Index: configure
--- configure 2001/02/26 21:52:29 1.1.1.16
+++ configure 2001/07/05 11:44:33 1.13
@@ -1879,7 +1879,7 @@
--- configure 16 Jul 2003 17:05:55 -0000 1.1.1.23
+++ configure 26 Aug 2003 08:22:10 -0000
@@ -4040,7 +4040,7 @@
AS=${AS-as}
if test "$ac_cv_c_compiler_gnu" = yes; then
- CFLAGS="$CFLAGS -D_GNU_SOURCE -D_REENTRANT -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts"
+ CFLAGS="$CFLAGS -pipe -O2 -D_GNU_SOURCE -D_REENTRANT"
fi
export CFLAGS
@@ -4837,6 +4837,7 @@
# just link it dynamically
LDFLAGS_STATIC=""
fi
+LDFLAGS_STATIC="" # OpenPKG wants dynamically linked RPM tools
LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}" # libtool format
echo "$as_me:$LINENO: result: $LDFLAGS_STATIC" >&5
echo "${ECHO_T}$LDFLAGS_STATIC" >&6
@@ -4937,7 +4938,7 @@
if test X"$MKDIR_P" = X0 ; then
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
- MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
+ MKDIR_P="@l_prefix@/lib/openpkg/shtool mkdir -f -p -m 755"
else
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
@@ -6682,7 +6683,7 @@
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 6685 "configure"' > conftest.$ac_ext
+ echo '#line 6686 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7211,7 +7212,7 @@
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
compiler_c_o=no
-if { (eval echo configure:7214: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+if { (eval echo configure:7215: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s out/conftest.err; then
@@ -8395,7 +8396,7 @@
libsuff=
case "$host_cpu" in
x86_64*|s390x*)
- echo '#line 8398 "configure"' > conftest.$ac_ext
+ echo '#line 8399 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -9067,7 +9068,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9070 "configure"
+#line 9071 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -9165,7 +9166,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9168 "configure"
+#line 9169 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -22911,6 +22912,86 @@
-for ac_prog in gawk mawk nawk awk
+for ac_prog in mawk gawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
@@ -9055,13 +9055,63 @@
else
echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for getmntinfo""... $ac_c" 1>&6
+echo "configure:9060: checking for getmntinfo" >&5
+if eval "test \"`echo '$''{'ac_cv_func_getmntinfo'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for getmntinfo" >&5
+echo $ECHO_N "checking for getmntinfo... $ECHO_C" >&6
+if test "${ac_cv_func_getmntinfo+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 9065 "configure"
+#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char getmntinfo(); below. */
+#include <assert.h>
+ which can conflict with char getmntinfo (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char getmntinfo();
+
+int main() {
+
+ builtin and then its argument prototype would still apply. */
+char getmntinfo ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_getmntinfo) || defined (__stub___getmntinfo)
+choke me
+#else
+getmntinfo();
+char (*f) () = getmntinfo;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:9088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_getmntinfo=yes"
+int
+main ()
+{
+return f != getmntinfo;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_getmntinfo=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_getmntinfo=no"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_getmntinfo=no
+fi
+rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_getmntinfo" >&5
+echo "${ECHO_T}$ac_cv_func_getmntinfo" >&6
+if test $ac_cv_func_getmntinfo = yes; then
+
+if eval "test \"`echo '$ac_cv_func_'getmntinfo`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETMNTINFO 1
+EOF
+_ACEOF
+
+else
+ echo "$ac_t""no" 1>&6
+
echo $ac_n "checking for mntctl""... $ac_c" 1>&6
-echo "configure:9060: checking for mntctl" >&5
+echo "configure:9110: checking for mntctl" >&5
if eval "test \"`echo '$''{'ac_cv_func_mntctl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9065 "configure"
+#line 9115 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char mntctl(); below. */
@@ -9084,7 +9134,7 @@
; return 0; }
EOF
-if { (eval echo configure:9088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_mntctl=yes"
else
@@ -9106,12 +9156,12 @@
echo "$ac_t""no" 1>&6
echo $ac_n "checking for getmntinfo_r""... $ac_c" 1>&6
-echo "configure:9110: checking for getmntinfo_r" >&5
+echo "configure:9160: checking for getmntinfo_r" >&5
if eval "test \"`echo '$''{'ac_cv_func_getmntinfo_r'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9115 "configure"
+#line 9165 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char getmntinfo_r(); below. */
@@ -9134,7 +9184,7 @@
; return 0; }
EOF
-if { (eval echo configure:9138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9188: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_getmntinfo_r=yes"
else
@@ -9156,7 +9206,7 @@
echo "$ac_t""no" 1>&6
echo $ac_n "checking for getmntinfo_r in -lc_r""... $ac_c" 1>&6
-echo "configure:9160: checking for getmntinfo_r in -lc_r" >&5
+echo "configure:9210: checking for getmntinfo_r in -lc_r" >&5
ac_lib_var=`echo c_r'_'getmntinfo_r | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -9164,7 +9214,7 @@
ac_save_LIBS="$LIBS"
LIBS="-lc_r $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 9168 "configure"
+#line 9218 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -9175,7 +9225,7 @@
getmntinfo_r()
; return 0; }
EOF
-if { (eval echo configure:9179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -9211,14 +9261,16 @@
echo "$as_me:$LINENO: checking for mntctl" >&5
echo $ECHO_N "checking for mntctl... $ECHO_C" >&6
if test "${ac_cv_func_mntctl+set}" = set; then
@@ -23148,6 +23229,8 @@
fi
+fi
+
echo $ac_n "checking for lchown""... $ac_c" 1>&6
-echo "configure:9217: checking for lchown" >&5
+echo "configure:9269: checking for lchown" >&5
if eval "test \"`echo '$''{'ac_cv_func_lchown'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9222 "configure"
+#line 9274 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char lchown(); below. */
@@ -9241,7 +9293,7 @@
; return 0; }
EOF
-if { (eval echo configure:9245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_lchown=yes"
else
@@ -9266,7 +9318,7 @@
__CHOWN_RHF="%{__chown} -Rf"
__CHGRP_RHF="%{__chgrp} -Rf"
echo $ac_n "checking whether chown() follows symlinks""... $ac_c" 1>&6
-echo "configure:9270: checking whether chown() follows symlinks" >&5
+echo "configure:9322: checking whether chown() follows symlinks" >&5
# Check whether --enable-broken-chown or --disable-broken-chown was given.
if test "${enable_broken_chown+set}" = set; then
enableval="$enable_broken_chown"
@@ -9294,7 +9346,7 @@
${__RM} -f foo bar
else
echo $ac_n "checking (cannot check by non-root user)""... $ac_c" 1>&6
-echo "configure:9298: checking (cannot check by non-root user)" >&5
+echo "configure:9350: checking (cannot check by non-root user)" >&5
result=no
fi
fi
@@ -9312,13 +9364,13 @@
echo $ac_n "checking root's primary group""... $ac_c" 1>&6
-echo "configure:9316: checking root's primary group" >&5
+echo "configure:9368: checking root's primary group" >&5
if test "$cross_compiling" = yes; then
ROOT_GROUP="root"
echo "$as_me:$LINENO: checking for lchown" >&5
echo $ECHO_N "checking for lchown... $ECHO_C" >&6
@@ -23515,7 +23598,7 @@
else
cat > conftest.$ac_ext <<EOF
-#line 9322 "configure"
+#line 9374 "configure"
#include "confdefs.h"
#include <stdio.h>
#include <sys/types.h>
@@ -9347,7 +9399,7 @@
exit(1);
}
EOF
-if { (eval echo configure:9351: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ROOT_GROUP=`cat conftest_rootg`
else
LIBDIR="`echo $libdir | sed 's-/lib$-/%{_lib}-'`"
-RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
+RPMCONFIGDIR="@l_prefix@/lib/openpkg"
cat >>confdefs.h <<_ACEOF
#define RPMCONFIGDIR "$RPMCONFIGDIR"
@@ -23523,7 +23606,7 @@
-SYSCONFIGDIR="`echo /etc/rpm`"
+SYSCONFIGDIR="@l_prefix@/etc/openpkg"
cat >>confdefs.h <<_ACEOF
#define SYSCONFIGDIR "$SYSCONFIGDIR"
@@ -23539,7 +23622,7 @@
-LIBRPMRC_FILENAME="${RPMCONFIGDIR}/rpmrc"
+LIBRPMRC_FILENAME="${SYSCONFIGDIR}/rpmrc"
cat >>confdefs.h <<_ACEOF
#define LIBRPMRC_FILENAME "$LIBRPMRC_FILENAME"
@@ -23547,7 +23630,7 @@
-VENDORRPMRC_FILENAME="${RPMCONFIGDIR}/${RPMCANONVENDOR}/rpmrc"
+VENDORRPMRC_FILENAME="${SYSCONFIGDIR}/${RPMCANONVENDOR}/rpmrc"
cat >>confdefs.h <<_ACEOF
#define VENDORRPMRC_FILENAME "$VENDORRPMRC_FILENAME"
@@ -23555,7 +23638,7 @@
-LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt-${VERSION}"
+LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt"
cat >>confdefs.h <<_ACEOF
#define LIBRPMALIAS_FILENAME "$LIBRPMALIAS_FILENAME"
@@ -25157,7 +25240,6 @@
esac
done ;;
default ) echo timestamp > popt/stamp-h.in
- echo timestamp > beecrypt/stamp-h.in
echo timestamp > stamp-h.in
;;

76
openpkg/rpmmacros

@ -26,10 +26,57 @@
## macros in the OpenPKG RPM installation for the @l_prefix@ hierarchy.
##
# the platform identification
%l_target %{_target}
# the OpenPKG instance location
%l_location @LOC@
# standard RPM host platform identification
# (defaults via "platform" and uname(3); used internally)
#%_host_cpu ...USE INTERNAL DEFAULT...
#%_host_vendor ...USE INTERNAL DEFAULT...
#%_host_os ...USE INTERNAL DEFAULT...
%_host_alias %{nil}
%_host %{_host_cpu}-%{_host_os}
# standard RPM build platform identification
# (defaults via %{_host*} macros; not used internally AFAIK)
%_build_cpu %{_host_cpu}
%_build_vendor %{_host_vendor}
%_build_os %{_host_os}
%_build_alias %{_host_alias}
%_build %{_host}
# standard RPM target platform identification
# (defaults via %{_host*} macros; used internally for %ifarch/%ifnarch)
%_target_cpu %{_host_cpu}
%_target_vendor %{_host_vendor}
%_target_os %{_host_os}
%_target_alias %{_host_alias}
%_target %{_host}
# legacy RPM platform macros
# (defaults via config.guess/config.sub under RPM build-time)
%_arch %{_host_cpu}
%_vendor %{_host_vendor}
%_os %{_host_os}
# legacy RPM platform macros
# (defaults via various other macros; partly used internally)
%_build_arch %{_arch}
%_target_platform %{_target_cpu}-%{_target_vendor}-%{_target_os}
%_gnu %{nil}
# official OpenPKG host platform identification
%l_host_arch %{_host_cpu}
%l_host_vendor %{_host_vendor}
%l_host_os %{_host_os}
%l_host %{_host_cpu}-%{_host_os}
# standard OpenPKG platform identification
%l_target_arch %{_host_cpu}
%l_target_vendor %{_host_vendor}
%l_target_os %{_host_os}
%l_target %{_host_cpu}-%{_host_os}
# the *S*uper-user user/group name/id pair
%l_susr @SUSR@
%l_sgrp @SGRP@
@ -106,6 +153,10 @@
%_specdir %{l_root_rpm}/SRC/%{name}
%_rpmdir %{l_root_rpm}/PKG
%_srcrpmdir %{l_root_rpm}/PKG
%_repackage_dir %{l_root_rpm}/PKG
%_cache_dbpath %{l_root_rpm}/PKG
%_solve_dbpath %{l_root_rpm}/PKG
%_solve_pkgsdir %{l_root_rpm}/PKG
%_defaultdocdir %{l_docdir}
# complement the %{SOURCE<n>} and %{PATCH<n>} with %{SOURCE <file>} and %{PATCH <file>}
@ -139,12 +190,22 @@
%__sed sed
%__ssh ssh
%__tar %{_tarbin}
%__unzip %{_unzipbin}
# override some more RPM macros where the default value is not acceptable
%_dependency_whiteout %{nil}
%__debug_install_post %{nil}
%_unpackaged_files_terminate_build 0
# provide fixed paths to tools (standard)
%_gzipbin %{l_prefix}/lib/openpkg/gzip
%_bzip2bin %{l_prefix}/lib/openpkg/bzip2
%_patchbin %{l_prefix}/lib/openpkg/patch
%_tarbin %{l_prefix}/lib/openpkg/tar
%_unzipbin %{l_prefix}/lib/openpkg/unzip
# provide path to platform identification file
%__platform %{l_prefix}/etc/openpkg/platform
# provide fixed paths to tools (additional)
%l_rc %{l_prefix}/etc/rc
@ -192,7 +253,7 @@
%l_files_defattr '%defattr(-,%{l_musr},%{l_mgrp})'
%l_files_all '%{l_prefix}'
%l_files_noshared '%not %dir {%{l_prefix},%{l_prefix}/*,%{l_prefix}/etc/rc.d,%{l_prefix}/man/*}'
%l_files_std(o:g:) %l_files_defattr %l_files_all %l_files_noshared
%l_files_std() %l_files_defattr %l_files_all %l_files_noshared
# path to local build root
%l_buildroot %{_tmppath}/%{name}-%{version}-root
@ -206,6 +267,9 @@
# override the name scheme for RPM files
%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}-%%{OS}-@LOC@.rpm
%_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}-%%{OS}-@LOC@.rpm
%_repackage_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}-%%{OS}-@LOC@.rpm
%_solve_name_fmt %{_solve_pkgsdir}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}-%%{OS}-@LOC@.rpm
# override the payload compression for the CPIO parts of an RPM
# (we use the equivalent of "bzip2 -9")
@ -213,7 +277,9 @@
%_binary_payload w9.bzdio
# package signature type is OpenPGP via GnuPG
%__gpg gpg
%_signature gpg
%__vsflags 1
# two macro-processor add-ons (should be part of forthcoming RPM releases)
%ifdef() %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
@ -282,8 +348,8 @@ export HOME SHELL TMPDIR TEMPDIR USER LOGNAME PATH LD_LIBRARY_PATH\
RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
RPM_OPT_FLAGS=\"%{optflags}\"\
RPM_ARCH=\"%{_arch}\"\
RPM_OS=\"%{_os}\"\
RPM_ARCH=\"%{l_host_arch}\"\
RPM_OS=\"%{l_host_os}\"\
RPM_DOC_DIR=\"%{_docdir}\"\
RPM_PACKAGE_NAME=\"%{name}\"\
RPM_PACKAGE_VERSION=\"%{version}\"\

68
openpkg/rpmpopt

@ -1,30 +1,50 @@
# link extension into "rpm" command line
rpm alias -r --repo
rpm alias -s --smart
rpm exec --stowaway rpmx.sh --stowaway
rpm exec --makeindex rpmx.sh --makeindex
rpm exec --makeproxy rpmx.sh --makeproxy
rpm exec --update rpmx.sh --update
rpm exec --fetch rpmx.sh --fetch
rpm exec --repo rpmx.sh --repo
rpm exec --smart rpmx.sh --smart
rpm alias --restriction --define "restriction yes"
rpm alias --norestriction --define "restriction no"
# override -i/--info display
# RPM extensions: "rpm --stowaway"
rpm exec --stowaway rpmx.sh --stowaway \
--POPTdesc=$"show files not covered by RPM database"
# RPM extensions: "rpm --makeproxy"
rpm exec --makeproxy rpmx.sh --makeproxy \
--POPTdesc=$"build proxy binary RPM from foreign binary RPM"
# RPM extensions: "rpm --stowaway"
rpm exec --fetch rpmx.sh --fetch \
--POPTdesc=$"fetch all Source/Patch files of a package"
# RPM exentsion: "rpm -bs --[no]restriction"
rpm alias --restriction --define "restriction yes" \
--POPTdesc=$"exclude %NoSource files in .src.rpm"
rpm alias --norestriction --define "restriction no" \
--POPTdesc=$"include %NoSource files in .src.rpm"
# RPM extension: "rpm --with[out] <name>"
rpm alias --with --define "with_!#:+ yes" \
--POPTdesc=$"set '%option <name> yes'" \
--POPTargs=$"<name>"
rpm alias --without --define "with_!#:+ no" \
--POPTdesc=$"set '%option with_<name> no'" \
--POPTargs=$"<name>"
# RPM extension: "rpm --option <name> <value>"
rpm alias --option --define "!#:+ !#:+" \
--POPTdesc=$"set '%option <name> <value>'" \
--POPTargs=$"<name> <value>"
# RPM adjustment: improved and cleaned up "rpm -i/--info"
rpmq alias --info --qf '\
Name: %-27{NAME} Source RPM: %{SOURCERPM}\n\
Version: %-27{VERSION} Packager: %{PACKAGER}\n\
Release: %-27{RELEASE} Build Host: %{BUILDHOST}\n\
Group: %-27{GROUP} Build System: %{ARCH}-%{OS}\n\
Distrib: %-27{DISTRIBUTION} Build Time: %{BUILDTIME:date}\n\
License: %-27{LICENSE} Relocations: %|PREFIXES?{[%{PREFIXES}]}:{(not relocateable)}|\n\
Vendor: %-27{VENDOR} Install Size: %{SIZE} bytes\n\
URL: %-27{URL} Install Time: %|INSTALLTIME?{%{INSTALLTIME:date}}:{(not installed)}|\n\
Summary: %{SUMMARY}\n\
Name: %-25{NAME} Source RPM: %{SOURCERPM}\n\
Version: %-25{VERSION} Build Host: %{BUILDHOST}\n\
Release: %-25{RELEASE} Build System: %{ARCH}-%{OS}\n\
Group: %-25{GROUP} Build Time: %{BUILDTIME:date}\n\
Distrib: %-25{DISTRIBUTION} Install Time: %|INSTALLTIME?{%{INSTALLTIME:date}}:{(not installed)}|\n\
Packager: %-25{PACKAGER} Install Size: %{SIZE} bytes\n\
Vendor: %-25{VENDOR} Relocations: %|PREFIXES?{[%{PREFIXES}]}:{(not relocateable)}|\n\
License: %-25{LICENSE} Signature: %|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{%|SIGGPG?{%{SIGGPG:pgpsig}}:{%|SIGPGP?{%{SIGPGP:pgpsig}}:{(none)}|}|}|}|\n\
Summary:\n\
%{SUMMARY}\n\
%{URL}\n\
Description:\n%{DESCRIPTION}\n\
%|PROVIDENAME?{Provides:\n\
[ %{PROVIDENAME} %|PROVIDEFLAGS?{%{PROVIDEFLAGS:depflags} %{PROVIDEVERSION}}:{}|\n]}:{}|\
'
' --POPTdesc=$"list descriptive information from package(s)"

205
openpkg/rpmrc

@ -35,176 +35,73 @@
macrofiles: @l_prefix@/lib/openpkg/macros:@l_prefix@/etc/openpkg/rpmmacros:~/.rpmmacros
#
# CPU Architectures
# CPU Architecture Mappings
#
# Intel
buildarchtranslate: i386: ix86
buildarchtranslate: i486: ix86
buildarchtranslate: i586: ix86
buildarchtranslate: i686: ix86
buildarchtranslate: athlon: ix86
buildarchtranslate: i86pc: ix86
buildarchtranslate: ia64: ia64
buildarch_compat: i386: ix86 noarch
buildarch_compat: i486: ix86 noarch
buildarch_compat: i586: ix86 noarch
buildarch_compat: i686: ix86 noarch
buildarch_compat: athlon: ix86 noarch
buildarch_compat: i86pc: ix86 noarch
buildarch_compat: ia64: ia64 ix86 noarch
# Intel IA32/IA64
arch_canon: ix86: ix86 1
arch_canon: ia64: ia64 9
arch_compat: i386: ix86 noarch
arch_compat: i486: ix86 noarch
arch_compat: i586: ix86 noarch
arch_compat: i686: ix86 noarch
arch_compat: athlon: ix86 noarch
arch_compat: i86pc: ix86 noarch
arch_compat: ix86: ix86 noarch
buildarch_compat: ix86: ix86 noarch
arch_compat: ia64: ia64 ix86 noarch
buildarch_compat: ia64: ia64 ix86 noarch
# Alpha
buildarchtranslate: alphaev5: alpha
buildarchtranslate: alphaev56: alpha
buildarchtranslate: alphapca56: alpha
buildarchtranslate: alphaev6: alpha
buildarchtranslate: alphaev67: alpha
buildarch_compat: alphaev5: alpha noarch
buildarch_compat: alphaev56: alpha noarch
buildarch_compat: alphapca56: alpha noarch
buildarch_compat: alphaev6: alpha noarch
buildarch_compat: alphaev67: alpha noarch
# Compaq Alpha
arch_canon: alpha: alpha 2
arch_compat: alphaev5: alpha noarch
arch_compat: alphaev56: alpha noarch
arch_compat: alphapca56: alpha noarch
arch_compat: alphaev6: alpha noarch
arch_compat: alphaev67: alpha noarch
arch_compat: alpha: alpha noarch
buildarch_compat: alpha: alpha noarch
# SPARC
buildarchtranslate: sun4c: sparc
buildarchtranslate: sun4d: sparc
buildarchtranslate: sun4m: sparc
buildarchtranslate: sun4u: sparc64
buildarch_compat: sun4c: sparc noarch
buildarch_compat: sun4d: sparc noarch
buildarch_compat: sun4m: sparc noarch
buildarch_compat: sun4u: sparc64 sparc noarch
# Sun SPARC
arch_canon: sparc: sparc 3
arch_canon: sparc64: sparc64 3
arch_compat: sun4c: sparc noarch
arch_compat: sun4d: sparc noarch
arch_compat: sun4m: sparc noarch
arch_compat: sun4u: sparc64 sparc noarch
arch_compat: sparc: sparc noarch
buildarch_compat: sparc: sparc noarch
arch_compat: sparc64: sparc64 sparc noarch
buildarch_compat: sparc64: sparc64 sparc noarch
# PA-RISC
buildarchtranslate: 9000/778: hppa
buildarch_compat: 9000/778: hppa noarch
arch_canon: hppa: hppa 4
arch_compat: 9000/778: hppa noarch
# HP PA-RISC
arch_canon: hppa: hppa 4
arch_compat: hppa: hppa noarch
buildarch_compat: hppa: hppa noarch
#
# Operating Systems
# Operating System Mappings
#
# Linux
buildostranslate: Linux2.0: linux2.0
buildostranslate: Linux2.1: linux2.1
buildostranslate: Linux2.2: linux2.2
buildostranslate: Linux2.3: linux2.3
buildostranslate: Linux2.4: linux2.4
buildostranslate: Linux2.5: linux2.5
buildostranslate: Linux2.6: linux2.6
os_canon: linux2.0: linux2.0 1
os_canon: linux2.1: linux2.1 1
os_canon: linux2.2: linux2.2 1
os_canon: linux2.3: linux2.3 1
os_canon: linux2.4: linux2.4 1
os_canon: linux2.5: linux2.5 1
os_canon: linux2.6: linux2.6 1
os_compat: Linux2.0: linux2.0
os_compat: Linux2.1: linux2.1 linux2.0
os_compat: Linux2.2: linux2.2 linux2.1 linux2.0
os_compat: Linux2.3: linux2.3 linux2.2 linux2.1 linux2.0
os_compat: Linux2.4: linux2.4 linux2.3 linux2.2 linux2.1 linux2.0
os_compat: Linux2.5: linux2.5 linux2.4 linux2.3 linux2.2 linux2.1 linux2.0
os_compat: Linux2.6: linux2.6 linux2.5 linux2.4 linux2.3 linux2.2 linux2.1 linux2.0
# Solaris
buildostranslate: SunOS5.0: solaris2.0
buildostranslate: SunOS5.1: solaris2.1
buildostranslate: SunOS5.2: solaris2.2
buildostranslate: SunOS5.3: solaris2.3
buildostranslate: SunOS5.4: solaris2.4
buildostranslate: SunOS5.5: solaris2.5
buildostranslate: SunOS5.6: solaris2.6
buildostranslate: SunOS5.7: solaris2.7
buildostranslate: SunOS5.8: solaris2.8
buildostranslate: SunOS5.9: solaris2.9
os_canon: solaris2.0: solaris2.0 3
os_canon: solaris2.1: solaris2.1 3
os_canon: solaris2.2: solaris2.2 3
os_canon: solaris2.3: solaris2.3 3
os_canon: solaris2.4: solaris2.4 3
os_canon: solaris2.5: solaris2.5 3
os_canon: solaris2.6: solaris2.6 3
os_canon: solaris2.7: solaris2.7 3
os_canon: solaris2.8: solaris2.8 3
os_canon: solaris2.9: solaris2.9 3
os_compat: SunOS5.0: solaris2.0
os_compat: SunOS5.1: solaris2.1 solaris2.0
os_compat: SunOS5.2: solaris2.2 solaris2.1 solaris2.0
os_compat: SunOS5.3: solaris2.3 solaris2.2 solaris2.1 solaris2.0
os_compat: SunOS5.4: solaris2.4 solaris2.3 solaris2.2 solaris2.1 solaris2.0
os_compat: SunOS5.5: solaris2.5 solaris2.4 solaris2.3 solaris2.2 solaris2.1 solaris2.0
os_compat: SunOS5.6: solaris2.6 solaris2.5 solaris2.4 solaris2.3 solaris2.2 solaris2.1 solaris2.0
os_compat: SunOS5.7: solaris2.7 solaris2.6 solaris2.5 solaris2.4 solaris2.3 solaris2.2 solaris2.1 solaris2.0
os_compat: SunOS5.8: solaris2.8 solaris2.7 solaris2.6 solaris2.5 solaris2.4 solaris2.3 solaris2.2 solaris2.1 solaris2.0
os_compat: SunOS5.9: solaris2.9 solaris2.8 solaris2.7 solaris2.6 solaris2.5 solaris2.4 solaris2.3 solaris2.2 solaris2.1 solaris2.0
# FreeBSD
buildostranslate: FreeBSD4.0: freebsd4.0
buildostranslate: FreeBSD4.1: freebsd4.1
buildostranslate: FreeBSD4.2: freebsd4.2
buildostranslate: FreeBSD4.3: freebsd4.3
buildostranslate: FreeBSD4.4: freebsd4.4
buildostranslate: FreeBSD4.5: freebsd4.5
buildostranslate: FreeBSD4.6: freebsd4.6
buildostranslate: FreeBSD4.7: freebsd4.7
buildostranslate: FreeBSD4.8: freebsd4.8
buildostranslate: FreeBSD5.0: freebsd5.0
os_canon: freebsd4.0: freebsd4.0 8
os_canon: freebsd4.1: freebsd4.1 8
os_canon: freebsd4.2: freebsd4.2 8
os_canon: freebsd4.3: freebsd4.3 8
os_canon: freebsd4.4: freebsd4.4 8
os_canon: freebsd4.5: freebsd4.5 8
os_canon: freebsd4.6: freebsd4.6 8
os_canon: freebsd4.7: freebsd4.7 8
os_canon: freebsd4.8: freebsd4.8 8
os_compat: FreeBSD4.0: freebsd4.0 linux2.0 linux2.2
os_compat: FreeBSD4.1: freebsd4.1 freebsd4.0 linux2.0 linux2.2
os_compat: FreeBSD4.2: freebsd4.2 freebsd4.1 freebsd4.0 linux2.0 linux2.2
os_compat: FreeBSD4.3: freebsd4.3 freebsd4.2 freebsd4.1 freebsd4.0 linux2.0 linux2.2
os_compat: FreeBSD4.4: freebsd4.4 freebsd4.3 freebsd4.2 freebsd4.1 freebsd4.0 linux2.0 linux2.2
os_compat: FreeBSD4.5: freebsd4.5 freebsd4.4 freebsd4.3 freebsd4.2 freebsd4.1 freebsd4.0 linux2.0 linux2.2
os_compat: FreeBSD4.6: freebsd4.6 freebsd4.5 freebsd4.4 freebsd4.3 freebsd4.2 freebsd4.1 freebsd4.0 linux2.0 linux2.2
os_compat: FreeBSD4.7: freebsd4.7 freebsd4.6 freebsd4.5 freebsd4.4 freebsd4.3 freebsd4.2 freebsd4.1 freebsd4.0 linux2.0 linux2.2
os_compat: FreeBSD4.8: freebsd4.8 freebsd4.7 freebsd4.6 freebsd4.5 freebsd4.4 freebsd4.3 freebsd4.2 freebsd4.1 freebsd4.0 linux2.0 linux2.2
os_compat: FreeBSD5.0: freebsd5.0 freebsd4.6 freebsd4.5 freebsd4.4 freebsd4.3 freebsd4.2 freebsd4.1 freebsd4.0 linux2.0 linux2.2
os_compat: freebsd4.0: freebsd4.0
os_compat: freebsd4.1: freebsd4.1 freebsd4.0
os_compat: freebsd4.2: freebsd4.2 freebsd4.1 freebsd4.0
os_compat: freebsd4.3: freebsd4.3 freebsd4.2 freebsd4.1 freebsd4.0
os_compat: freebsd4.4: freebsd4.4 freebsd4.3 freebsd4.2 freebsd4.1 freebsd4.0
os_compat: freebsd4.5: freebsd4.5 freebsd4.4 freebsd4.3 freebsd4.2 freebsd4.1 freebsd4.0
os_compat: freebsd4.6: freebsd4.6 freebsd4.5 freebsd4.4 freebsd4.3 freebsd4.2 freebsd4.1 freebsd4.0
os_compat: freebsd4.7: freebsd4.7 freebsd4.6 freebsd4.5 freebsd4.4 freebsd4.3 freebsd4.2 freebsd4.1 freebsd4.0
os_compat: freebsd4.8: freebsd4.8 freebsd4.7 freebsd4.6 freebsd4.5 freebsd4.4 freebsd4.3 freebsd4.2 freebsd4.1 freebsd4.0
os_compat: freebsd4.9: freebsd4.9 freebsd4.8 freebsd4.7 freebsd4.6 freebsd4.5 freebsd4.4 freebsd4.3 freebsd4.2 freebsd4.1 freebsd4.0
os_compat: freebsd5.0: freebsd5.0
os_compat: freebsd5.1: freebsd5.1 freebsd5.0
os_compat: freebsd5.2: freebsd5.2 freebsd5.1 freebsd5.0
os_compat: freebsd5.3: freebsd5.3 freebsd5.2 freebsd5.1 freebsd5.0
# Tru64
buildostranslate: osf15.0: osf5.0
buildostranslate: OSF1V5.0: osf5.0
buildostranslate: OSF1V5.1: osf5.1
os_canon: osf5.0: osf5.0 9
os_canon: osf5.1: osf5.1 9
os_compat: osf15.0: osf5.0
os_compat: OSF1V5.0: osf5.0
os_compat: OSF1V5.1: osf5.0 osf5.1
# GNU/Linux
os_compat: redhat8.0: redhat8.0
os_compat: redhat8.1: redhat8.1 redhat8.0
os_compat: redhat8.2: redhat8.2 redhat8.1 redhat8.0
os_compat: redhat9: redhat9 redhat8.2 redhat8.1 redhat8.0
os_compat: suse8.0: suse8.0
os_compat: suse8.1: suse8.1 suse8.0
os_compat: suse8.2: suse8.2 suse8.1 suse8.0
# HP-UX
buildostranslate: hp-ux10.20: hpux10.20
os_canon: hpux10.20: hpux10.20 10
os_compat: hp-ux10.20: hpux10.20
# Sun Solaris
os_compat: solaris2.0: solaris2.0
os_compat: solaris2.1: solaris2.1 solaris2.0
os_compat: solaris2.2: solaris2.2 solaris2.1 solaris2.0
os_compat: solaris2.3: solaris2.3 solaris2.2 solaris2.1 solaris2.0
os_compat: solaris2.4: solaris2.4 solaris2.3 solaris2.2 solaris2.1 solaris2.0
os_compat: solaris2.5: solaris2.5 solaris2.4 solaris2.3 solaris2.2 solaris2.1 solaris2.0
os_compat: solaris2.6: solaris2.6 solaris2.5 solaris2.4 solaris2.3 solaris2.2 solaris2.1 solaris2.0
os_compat: solaris7: solaris7 solaris2.6 solaris2.5 solaris2.4 solaris2.3 solaris2.2 solaris2.1 solaris2.0
os_compat: solaris8: solaris8 solaris7 solaris2.6 solaris2.5 solaris2.4 solaris2.3 solaris2.2 solaris2.1 solaris2.0
os_compat: solaris9: solaris9 solaris8 solaris7 solaris2.6 solaris2.5 solaris2.4 solaris2.3 solaris2.2 solaris2.1 solaris2.0

343
openpkg/rpmx.pl

@ -7,36 +7,12 @@
## list all files in the hierarchy which are not listed in RPM database
## $ rpm --stowaway
##
## generate repository information (on server only)
## $ rpm --makeindex <pkgdir>
##
## update local database with latest repository information
## $ rpm --update
##
## update the package sources by downloading missing files
## $ rpm --fetch <spec-file>
##
## make a proxy package
## $ rpm --makeproxy <binary-rpm>
##
## query repository information
## $ rpm -rqa
## $ rpm -rqai
## $ rpm -rqal
## $ rpm -rqalv
## $ rpm -rqi package
## $ rpm -rql package
## $ rpm -rqlv package
##
## update already installed packages
## $ rpm -Uvhs '*'
##
## install/update a particular package and its dependencies
## $ rpm -Uvhs file-pattern
##
## erase a particular package and its dependencies
## $ rpm -es file-pattern
##
require 5.000;
@ -113,7 +89,7 @@ foreach $arg (@ARGV) {
$isdef = 0;
next;
}
if ($arg =~ m/^--(stowaway|makeindex|update|fetch|makeproxy|repo|smart)$/) {
if ($arg =~ m/^--(stowaway|fetch|makeproxy)$/) {
$op = $1;
next;
}
@ -150,83 +126,15 @@ else {
if ($op eq 'stowaway') {
$rc = &op_stowaway($CFG);
}
elsif ($op eq 'makeindex') {
$rc = &op_makeindex($CFG);
}
elsif ($op eq 'update') {
$rc = &op_update($CFG);
}
elsif ($op eq 'fetch') {
$rc = &op_fetch($CFG);
}
elsif ($op eq 'makeproxy') {
$rc = &op_makeproxy($CFG);
}
elsif ($op eq 'repo') {
$rc = &op_repo($CFG);
}
elsif ($op eq 'smart') {
$rc = &op_smart($CFG);
}
exit($rc);
}
## ______________________________________________________________________
##
## Database Handling
## ______________________________________________________________________
##
# read database file from disk
sub db_load {
my ($dbfile) = @_;
if (not -f $dbfile) {
my $DB = {};
return $DB;
}
my $fp = new IO::File ("<$dbfile") || die "cannot read from Database file `$dbfile'";
my $db = '';
my $buf;
$db .= $buf while ($fp->read($buf, 128*1024));
$fp->close;
my $DB = {};
$db =~ s|<rpm\s+(\S+)>\n(.+?)</rpm>|&load_rpm($DB, $2, $1), ''|isge;
sub load_rpm {
my ($DB, $db, $rpm) = @_;
$DB->{$rpm} = {};
$db =~ s/<(repos|info|files|requires)>\n(.+?)<\/\1>/$DB->{$rpm}->{uc($1)} = $2, ''/isge;
}
return $DB;
}
# write database file to disk
sub db_store {
my ($dbfile, $DB) = @_;
my $fp = new IO::File (">$dbfile") || die "cannot store to Database file `$dbfile'";
my $rpm;
foreach $rpm (sort(keys(%{$DB}))) {
print $fp "<rpm $rpm>\n" .
"<repos>\n" .
$DB->{$rpm}->{REPOS} .
"</repos>\n" .
"<requires>\n" .
$DB->{$rpm}->{REQUIRES} .
"</requires>\n" .
"<info>\n" .
$DB->{$rpm}->{INFO} .
"</info>\n" .
"<files>\n" .
$DB->{$rpm}->{FILES} .
"</files>\n" .
"</rpm>\n";
}
$fp->close;
return;
}
## ______________________________________________________________________
##
## Fetch an URL
@ -333,181 +241,6 @@ sub op_stowaway {
return 0;
}
## ______________________________________________________________________
##
## Generate Repository Index
## ______________________________________________________________________
##
sub op_makeindex {
my ($CFG) = @_;
if ($#{$CFG->{ARG}} ne 0) {
print STDERR "rpm: option --makeindex requires an argument\n";
return 1;
}
my $dir = $CFG->{ARG}->[0];
if (not -d $dir) {
print STDERR "rpm: --makeindex argument `$dir' is not a directory\n";
return 1;
}
my $index = '';
my $file;
my $rpm = $CFG->{PRG}->{"rpm"};
foreach $file (sort(glob("$dir/*.rpm"))) {
$file =~ s|^$dir/*||;
$index .= "<rpm $file>\n";
$index .= "<requires>\n";
$index .= `$rpm -qp --qf '[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]' $dir/$file`;
$index .= "</requires>\n";
$index .= "<info>\n";
$index .= `$rpm -qpi $dir/$file`;
$index .= "</info>\n";
$index .= "<files>\n";
$index .= `$rpm -qplv $dir/$file`;
$index .= "</files>\n";
$index .= "</rpm>\n";
}
open(FP, "|".$CFG->{PRG}->{"bzip2"}.">$dir/INDEX.bz2");
print FP $index;
close(FP);
return 0;
}
## ______________________________________________________________________
##
## Fetch Repository Indices
## ______________________________________________________________________
##
sub op_update {
my ($CFG) = @_;
my $DB = {};
my $tmpfile = $CFG->{RC}->{_tmppath}."/rpm.update.tmp.".$$;
for ($i = 9; $i >= 0; $i--) {
my $repo = $CFG->{RC}->{"l_repo_$i"};
next if (not defined($repo) or $repo eq '' or $repo eq '-');
$repo =~ s|([^/])$|$1/|;
my $src = $repo."INDEX.bz2";
my $prefix = $src;
$prefix = substr($prefix, 0, 37)."..." if (length($prefix) > 40);
printf(STDOUT "%-40s ", $prefix);
if (($err = &fetch_url($CFG, $src, $tmpfile))) {
$err = substr($err, 0, 37)."..." if (length($err) > 40);
print STDOUT "FAILED: $err\n";
next;
}
my $size = (stat($tmpfile))[7];
print STDOUT "OK: $size bytes\n";
my $fh = new IO::Handle;
open($fh, $CFG->{PRG}->{"bzip2"}." -d -c $tmpfile|");
my $db = '';
my $buf;
$db .= $buf while ($fh->read($buf, 128*1024));
$fh->close;
unlink($tmpfile);
$db =~ s|<rpm\s+(\S+)>\n(.+?)</rpm>|&load_rpm2($DB, $repo, $2, $1), ''|isge;
sub load_rpm2 {
my ($DB, $repo, $db, $rpm) = @_;
my $target = $CFG->{RC}->{_target};
return if ($rpm !~ m|\.src\.rpm$| and $rpm !~ m|\.$target\.rpm$|);
my $repos = '';
if (defined($DB->{$rpm})) {
$repos = $DB->{$rpm}->{REPOS};
}
$repos = $repo."\n".$repos;
$DB->{$rpm} = {};
$DB->{$rpm}->{REPOS} = $repos;
$db =~ s/<(info|files|requires)>\n(.+?)<\/\1>/$DB->{$rpm}->{uc($1)} = $2, ''/isge;
}
}
my $dbfile = $CFG->{RC}->{_dbpath}."/Repository";
&db_store($dbfile, $DB);
return 0;
}
## ______________________________________________________________________
##
## Repository Queries
## ______________________________________________________________________
##
sub op_repo {
my ($CFG) = @_;
# argument line consistency check
if (not defined($CFG->{OPT_OPT}->{"-q"})) {
print STDERR "rpm: option --repo always requires option -q\n";
return 1;
}
my @optok = (qw(--rcfile -q --all -i --list --verbose));
my $opt;
my $check;
foreach $opt (keys(%{$CFG->{OPT_OPT}})) {
my $ok = 0;
foreach $check (@optok) {
if ($check eq $opt) {
$ok = 1;
last;
}
}
if (not $ok) {
print STDERR "rpm: option $opt not supported in conjunction with option --repo\n";
return 1;
}
}
# load database
my $dbfile = $CFG->{RC}->{_dbpath}."/Repository";
if (not -f $dbfile) {
print STDERR "rpm: option --repo requires local repository index.\n";
print STDERR "rpm: run \"rpm --update\", first.\n";
return 1;
}
my $DB = &db_load($dbfile);
# perform query operation
my $target = $CFG->{RC}->{_target};
my $rpm;
my $rpms = {};
foreach $rpm (sort(keys(%{$DB}))) {
my $name = $rpm;
$name =~ s|\.src\.rpm$||;
$name =~ s|\.${target}\.rpm$||;
next if (defined($rpms->{$name}));
$rpms->{$name} = 1;
if ((defined($CFG->{ARG}->[0]) and $rpm =~ m|^$CFG->{ARG}->[0]|)
or defined($CFG->{OPT_OPT}->{"--all"})) {
if (not defined($CFG->{OPT_OPT}->{"--list"}) and not defined($CFG->{OPT_OPT}->{"-i"})) {
print "$name\n";
}
if (defined($CFG->{OPT_OPT}->{"-i"})) {
print $DB->{$rpm}->{INFO};
}
if (defined($CFG->{OPT_OPT}->{"--list"})) {
my $files = $DB->{$rpm}->{FILES};
if (not defined($CFG->{OPT_OPT}->{"--verbose"})) {
if (not ($files =~ s|^.*\s+(\S+\s+->\s+\S+)\s*$|$1|mg)) {
$files =~ s|^.*\s+(\S+)\s*$|$1|mg;
}
}
print "$files";
}
}
}
}
## ______________________________________________________________________
##
## Fetch Operation
@ -662,77 +395,3 @@ sub op_makeproxy {
exec $perl, "$prefix/lib/openpkg/mkproxyrpm.pl", "--rpm=$rpm", "--tmpdir=$tmpdir", @args;
}
## ______________________________________________________________________
##
## Smart Operations
## ______________________________________________________________________
##
sub op_smart {
my ($CFG) = @_;
if ($#{$CFG->{ARG}} ne 0) {
print STDERR "rpm: option --smart requires one argument\n";
return 1;
}
my $package = $CFG->{ARG}->[0];
# load database
my $dbfile = $CFG->{RC}->{_dbpath}."/Repository";
if (not -f $dbfile) {
print STDERR "rpm: option --smart requires local repository index.\n";
print STDERR "rpm: run \"rpm --update\", first.\n";
return 1;
}
my $DB = &db_load($dbfile);
my $deps = [];
&find_deps($CFG, $DB, $deps, $package, '=', 'ANY');
sub find_deps {
my ($CFG, $DB, $deps, $pkg, $op, $ver) = @_;
push(@{$deps}, "$pkg $op $ver");
my $rpm;
foreach $rpm (keys(%{$DB})) {
if (&match_rpm($CFG, $rpm, $pkg, $op, $ver)) {
my $req;
foreach $req (split(/\n/, $DB->{$rpm}->{REQUIRES})) {
$req =~ s|^\s+||sg;
$req =~ s|\s+$||sg;
if ($req =~ m|^OpenPKG$| or
$req =~ m|^rpmlib\(.+\)|) {
next;
}
if ($req =~ m|^(\S+)$|) {
$req .= " = ANY";
}
if ($req =~ m|^(\S+)\s+([=><]+)\s+(\S+)$|) {
&find_deps($CFG, $DB, $deps, $1, $2, $3);
}
}
}
}
}
sub match_rpm {
my ($CFG, $rpm, $name, $op, $ver) = @_;
my $rc = 0;
my $target = $CFG->{RC}->{_target};
$rpm =~ s|\.src\.rpm$||;
$rpm =~ s|\.${target}\.rpm$||;
if ($rpm =~ m|^(\S+)-([^-]+-[^-]+)$|) {
my ($tname, $tver) = ($1, $2);
if ($name eq $tname and &match_version($ver, $op, $tver)) {
$rc = 1;
}
}
return $rc;
}
sub match_version {
my ($ver, $op, $tver) = @_;
return 1;
}
my $dep;
foreach $dep (@{$deps}) {
print "$dep\n";
}
}

Loading…
Cancel
Save