diff --git a/openpkg/HISTORY b/openpkg/HISTORY index b7e9d856b0..7641f51fb6 100644 --- a/openpkg/HISTORY +++ b/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 diff --git a/openpkg/openpkg.boot b/openpkg/openpkg.boot index 3dd2584800..54309e5eab 100755 --- a/openpkg/openpkg.boot +++ b/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". 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 diff --git a/openpkg/openpkg.spec b/openpkg/openpkg.spec index e470fbd29e..5414eaf8a7 100644 --- a/openpkg/openpkg.spec +++ b/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.n && \ - mv configure.n configure - sed -e 's;@INTLLIBS@;@INTLLIBS@ @LIBMISC@;' \ - 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.n && mv Makefile.in.n Makefile.in - sed -e 's;^\(SUBDIRS[ ]*=.*\) po$;\1;' \ - popt/Makefile.in.n && \ - mv popt/Makefile.in.n popt/Makefile.in - sed -e 's;BUFSIZ;8192;g' \ - 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 diff --git a/openpkg/platform b/openpkg/platform new file mode 100644 index 0000000000..502294fb20 --- /dev/null +++ b/openpkg/platform @@ -0,0 +1,149 @@ +#!/bin/sh +## +## platform -- Provide Platform Identification +## Copyright (c) 2003 The OpenPKG Project +## Copyright (c) 2003 Ralf S. Engelschall +## Copyright (c) 2003 Cable & Wireless +## +## 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}" + diff --git a/openpkg/rpm.patch.bugfix b/openpkg/rpm.patch.bugfix index f2da668ca4..6d964c17b3 100644 --- a/openpkg/rpm.patch.bugfix +++ b/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 ## Copyright (c) 2000-2003 Ralf S. Engelschall ## Copyright (c) 2000-2003 Cable & Wireless @@ -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); diff --git a/openpkg/rpm.patch.feature b/openpkg/rpm.patch.feature index 26518b9a6c..80420bde4b 100644 --- a/openpkg/rpm.patch.feature +++ b/openpkg/rpm.patch.feature @@ -1,5 +1,5 @@ ## -## rpm-4.0.2.patch.feature -- Annotated patch file +## rpm.patch.feature -- Annotated patch file ## Copyright (c) 2000-2003 The OpenPKG Project ## Copyright (c) 2000-2003 Ralf S. Engelschall ## Copyright (c) 2000-2003 Cable & Wireless @@ -10,24 +10,381 @@ ## '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 ## ++--------------------------------------------------------------------------- +| Remove "tools" directory from sub-directory list because it contains +| things we are not interested in and which cause some build trouble +| anyway. +| Use a plain "rpmpopt" file without any trailing version. +| Adjust paths to conform to OpenPKG filesystem layout. ++--------------------------------------------------------------------------- +Index: Makefile.am +--- Makefile.am 29 May 2003 18:20:28 -0000 1.1.1.17 ++++ Makefile.am 26 Aug 2003 08:14:57 -0000 +@@ -12,9 +12,9 @@ + xmlspec/examples/*.sh xmlspec/examples/*.lst \ + xmlspec/examples/*.xmlspec \ + po/*.in po/*.po po/rpm.pot \ +- rpm.magic rpmpopt-$(VERSION) rpmqv.c rpm.c ++ rpm.magic rpmpopt rpmqv.c rpm.c + +-SUBDIRS = intl po @WITH_ZLIB_SUBDIR@ @WITH_ELFUTILS_SUBDIR@ file @WITH_DB_SUBDIR@ popt @WITH_BEECRYPT_SUBDIR@ rpmio rpmdb lib build misc @WITH_PYTHON_SUBDIR@ tools scripts tests doc . ++SUBDIRS = intl @WITH_ZLIB_SUBDIR@ @WITH_ELFUTILS_SUBDIR@ file @WITH_DB_SUBDIR@ popt @WITH_BEECRYPT_SUBDIR@ rpmio rpmdb lib build misc @WITH_PYTHON_SUBDIR@ scripts tests doc . + + INCLUDES = \ + -I$(top_srcdir)/build \ +@@ -47,13 +47,10 @@ + + pkglibdir = @RPMCONFIGDIR@ + pkglib_PROGRAMS = rpmb rpmd rpmi rpmk rpmq +-pkglib_DATA = rpmrc rpmpopt-$(VERSION) macros ++pkglib_DATA = rpmrc rpmpopt macros + pkglib_SCRIPTS = find-provides find-requires mkinstalldirs \ + config.guess config.sub config.site + +-rpmpopt-$(VERSION): rpmpopt +- cp rpmpopt $@ +- + noinst_HEADERS = build.h debug.h system.h + + rpm_SOURCES = +@@ -124,32 +121,32 @@ + pkgsrcdir = $(prefix)/src/$(RPMCANONVENDOR) + + install-data-local: +- @$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/rpm ++ @$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/openpkg + @rm -f $(DESTDIR)$(libdir)/rpmrc + @@LN_S@ rpm/rpmrc $(DESTDIR)$(libdir)/rpmrc + @rm -f $(DESTDIR)$(libdir)/rpmpopt + @@LN_S@ rpm/rpmpopt $(DESTDIR)$(libdir)/rpmpopt + @rm -f $(DESTDIR)$(libdir)/rpm/rpmt +- @@LN_S@ rpmb $(DESTDIR)$(libdir)/rpm/rpmt +- @rm -f $(DESTDIR)$(libdir)/rpm/rpme +- @@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpme +- @rm -f $(DESTDIR)$(libdir)/rpm/rpmu +- @@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpmu +- @rm -f $(DESTDIR)$(libdir)/rpm/rpmv +- @@LN_S@ rpmq $(DESTDIR)$(libdir)/rpm/rpmv ++ @@LN_S@ rpmb $(DESTDIR)$(libdir)/openpkg/rpmt ++ @rm -f $(DESTDIR)$(libdir)/openpkg/rpme ++ @@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpme ++ @rm -f $(DESTDIR)$(libdir)/openpkg/rpmu ++ @@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpmu ++ @rm -f $(DESTDIR)$(libdir)/openpkg/rpmv ++ @@LN_S@ rpmq $(DESTDIR)$(libdir)/openpkg/rpmv + rm -f $(DESTDIR)$(bindir)/rpmbuild +- @LN_S@ ../lib/rpm/rpmb $(DESTDIR)$(bindir)/rpmbuild ++ @LN_S@ ../lib/openpkg/rpmb $(DESTDIR)$(bindir)/rpmbuild + rm -f $(DESTDIR)$(bindir)/rpmquery +- @LN_S@ ../lib/rpm/rpmq $(DESTDIR)$(bindir)/rpmquery ++ @LN_S@ ../lib/openpkg/rpmq $(DESTDIR)$(bindir)/rpmquery + rm -f $(DESTDIR)$(bindir)/rpmverify +- @LN_S@ ../lib/rpm/rpmv $(DESTDIR)$(bindir)/rpmverify ++ @LN_S@ ../lib/openpkg/rpmv $(DESTDIR)$(bindir)/rpmverify + rm -f $(DESTDIR)$(bindir)/rpmsign +- @LN_S@ ../lib/rpm/rpmk $(DESTDIR)$(bindir)/rpmsign ++ @LN_S@ ../lib/openpkg/rpmk $(DESTDIR)$(bindir)/rpmsign + rm -f $(DESTDIR)$(bindir)/rpmdb ; \ +- @LN_S@ ../lib/rpm/rpmd $(DESTDIR)$(bindir)/rpmdb ; \ ++ @LN_S@ ../lib/openpkg/rpmd $(DESTDIR)$(bindir)/rpmdb ; \ + for bf in e i u ; do \ + rm -f $(DESTDIR)$(bindir)/rpm$$bf ; \ +- @LN_S@ ../lib/rpm/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \ ++ @LN_S@ ../lib/openpkg/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \ + done + @for dir in BUILD RPMS SOURCES SPECS SRPMS ; do\ + $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/$$dir;\ +@@ -198,10 +195,10 @@ + $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)/$$f ;\ + done + @$(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir) +- @$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/rpm +- -@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/[A-Z]* +- -@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/rpm +- -@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/__db.* ++ @$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/openpkg ++ -@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/[A-Z]* ++ -@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/openpkg ++ -@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/__db.* + + .PHONY: unsetgid + unsetgid: +@@ -244,7 +241,7 @@ + @sudo ./rpm -ta rpm-$(VERSION).tar.gz + + .PHONY: doxygen +-doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt-@VERSION@ ++doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt + rm -rf $@ + mkdir -p $@ + - [ X"@__DOXYGEN@" != Xno ] && @__DOXYGEN@ + ++--------------------------------------------------------------------------- +| Remove "tools" directory from sub-directory list because it contains +| things we are not interested in and which cause some build trouble +| anyway. +| Use a plain "rpmpopt" file without any trailing version. +| Adjust paths to conform to OpenPKG filesystem layout. ++--------------------------------------------------------------------------- +Index: Makefile.in +--- Makefile.in 16 Jul 2003 17:05:42 -0000 1.1.1.23 ++++ Makefile.in 26 Aug 2003 08:15:04 -0000 +@@ -265,10 +265,10 @@ + xmlspec/examples/*.sh xmlspec/examples/*.lst \ + xmlspec/examples/*.xmlspec \ + po/*.in po/*.po po/rpm.pot \ +- rpm.magic rpmpopt-$(VERSION) rpmqv.c rpm.c ++ rpm.magic rpmpopt rpmqv.c rpm.c + + +-SUBDIRS = intl po @WITH_ZLIB_SUBDIR@ @WITH_ELFUTILS_SUBDIR@ file @WITH_DB_SUBDIR@ popt @WITH_BEECRYPT_SUBDIR@ rpmio rpmdb lib build misc @WITH_PYTHON_SUBDIR@ tools scripts tests doc . ++SUBDIRS = intl @WITH_ZLIB_SUBDIR@ @WITH_ELFUTILS_SUBDIR@ file @WITH_DB_SUBDIR@ popt @WITH_BEECRYPT_SUBDIR@ rpmio rpmdb lib build misc @WITH_PYTHON_SUBDIR@ scripts tests doc . + + INCLUDES = \ + -I$(top_srcdir)/build \ +@@ -301,7 +301,7 @@ + bin_PROGRAMS = rpm2cpio + bin_SCRIPTS = gendiff + pkglib_PROGRAMS = rpmb rpmd rpmi rpmk rpmq +-pkglib_DATA = rpmrc rpmpopt-$(VERSION) macros ++pkglib_DATA = rpmrc rpmpopt macros + pkglib_SCRIPTS = find-provides find-requires mkinstalldirs \ + config.guess config.sub config.site + +@@ -1058,8 +1058,6 @@ + uninstall-rpmbinPROGRAMS + + +-rpmpopt-$(VERSION): rpmpopt +- cp rpmpopt $@ + rpm.o: rpmqv.c + $(COMPILE) -DIAM_RPMDB -DIAM_RPMEIU -DIAM_RPMK -DIAM_RPMQV -o $@ -c rpmqv.c + rpmb.o: rpmqv.c +@@ -1097,32 +1095,32 @@ + `make -s sources -C popt` + + install-data-local: +- @$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/rpm ++ @$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/openpkg + @rm -f $(DESTDIR)$(libdir)/rpmrc + @@LN_S@ rpm/rpmrc $(DESTDIR)$(libdir)/rpmrc + @rm -f $(DESTDIR)$(libdir)/rpmpopt + @@LN_S@ rpm/rpmpopt $(DESTDIR)$(libdir)/rpmpopt +- @rm -f $(DESTDIR)$(libdir)/rpm/rpmt +- @@LN_S@ rpmb $(DESTDIR)$(libdir)/rpm/rpmt +- @rm -f $(DESTDIR)$(libdir)/rpm/rpme +- @@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpme +- @rm -f $(DESTDIR)$(libdir)/rpm/rpmu +- @@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpmu +- @rm -f $(DESTDIR)$(libdir)/rpm/rpmv +- @@LN_S@ rpmq $(DESTDIR)$(libdir)/rpm/rpmv ++ @rm -f $(DESTDIR)$(libdir)/openpkg/rpmt ++ @@LN_S@ rpmb $(DESTDIR)$(libdir)/openpkg/rpmt ++ @rm -f $(DESTDIR)$(libdir)/openpkg/rpme ++ @@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpme ++ @rm -f $(DESTDIR)$(libdir)/openpkg/rpmu ++ @@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpmu ++ @rm -f $(DESTDIR)$(libdir)/openpkg/rpmv ++ @@LN_S@ rpmq $(DESTDIR)$(libdir)/openpkg/rpmv + rm -f $(DESTDIR)$(bindir)/rpmbuild +- @LN_S@ ../lib/rpm/rpmb $(DESTDIR)$(bindir)/rpmbuild ++ @LN_S@ ../lib/openpkg/rpmb $(DESTDIR)$(bindir)/rpmbuild + rm -f $(DESTDIR)$(bindir)/rpmquery +- @LN_S@ ../lib/rpm/rpmq $(DESTDIR)$(bindir)/rpmquery ++ @LN_S@ ../lib/openpkg/rpmq $(DESTDIR)$(bindir)/rpmquery + rm -f $(DESTDIR)$(bindir)/rpmverify +- @LN_S@ ../lib/rpm/rpmv $(DESTDIR)$(bindir)/rpmverify ++ @LN_S@ ../lib/openpkg/rpmv $(DESTDIR)$(bindir)/rpmverify + rm -f $(DESTDIR)$(bindir)/rpmsign +- @LN_S@ ../lib/rpm/rpmk $(DESTDIR)$(bindir)/rpmsign ++ @LN_S@ ../lib/openpkg/rpmk $(DESTDIR)$(bindir)/rpmsign + rm -f $(DESTDIR)$(bindir)/rpmdb ; \ +- @LN_S@ ../lib/rpm/rpmd $(DESTDIR)$(bindir)/rpmdb ; \ ++ @LN_S@ ../lib/openpkg/rpmd $(DESTDIR)$(bindir)/rpmdb ; \ + for bf in e i u ; do \ + rm -f $(DESTDIR)$(bindir)/rpm$$bf ; \ +- @LN_S@ ../lib/rpm/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \ ++ @LN_S@ ../lib/openpkg/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \ + done + @for dir in BUILD RPMS SOURCES SPECS SRPMS ; do\ + $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/$$dir;\ +@@ -1171,10 +1169,10 @@ + $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)/$$f ;\ + done + @$(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir) +- @$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/rpm +- -@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/[A-Z]* +- -@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/rpm +- -@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/__db.* ++ @$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/openpkg ++ -@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/[A-Z]* ++ -@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/openpkg ++ -@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/__db.* + + .PHONY: unsetgid + unsetgid: +@@ -1217,7 +1215,7 @@ + @sudo ./rpm -ta rpm-$(VERSION).tar.gz + + .PHONY: doxygen +-doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt-@VERSION@ ++doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt + rm -rf $@ + mkdir -p $@ + - [ X"@__DOXYGEN@" != Xno ] && @__DOXYGEN@ + ++--------------------------------------------------------------------------- +| Add support for splitted source directories, i.e., source files +| alternatively can be placed into the .spec directory and are picked +| up there, too. ++--------------------------------------------------------------------------- +Index: build/build.c +--- build/build.c 4 Mar 2003 15:27:33 -0000 1.1.1.20 ++++ build/build.c 24 Aug 2003 13:10:15 -0000 +@@ -33,7 +33,15 @@ + + for (p = spec->sources; p != NULL; p = p->next) { + if (! (p->flags & RPMBUILD_ISNO)) { ++#ifndef OPENPKG + const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL); ++#else ++ const char *fn = rpmGetPath("%{_specdir}/", p->source, NULL); ++ if (access(fn, F_OK) == -1) { ++ fn = _free(fn); ++ fn = rpmGetPath("%{_sourcedir}/", p->source, NULL); ++ } ++#endif + rc = Unlink(fn); + fn = _free(fn); + } +@@ -42,7 +50,15 @@ + for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) { + for (p = pkg->icon; p != NULL; p = p->next) { + if (! (p->flags & RPMBUILD_ISNO)) { ++#ifndef OPENPKG + const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL); ++#else ++ const char *fn = rpmGetPath("%{_specdir}/", p->source, NULL); ++ if (access(fn, F_OK) == -1) { ++ fn = _free(fn); ++ fn = rpmGetPath("%{_sourcedir}/", p->source, NULL); ++ } ++#endif + rc = Unlink(fn); + fn = _free(fn); + } + ++--------------------------------------------------------------------------- +| Make sure the "Provides" headers are available for querying from the +| .src.rpm files. ++--------------------------------------------------------------------------- +Index: build/files.c +--- build/files.c 4 Mar 2003 17:04:13 -0000 1.1.1.20 ++++ build/files.c 25 Aug 2003 09:42:08 -0000 +@@ -2183,6 +2183,11 @@ + case RPMTAG_CHANGELOGTEXT: + case RPMTAG_URL: + case HEADER_I18NTABLE: ++#ifdef OPENPKG ++ case RPMTAG_PROVIDENAME: ++ case RPMTAG_PROVIDEVERSION: ++ case RPMTAG_PROVIDEFLAGS: ++#endif + if (ptr) + (void)headerAddEntry(spec->sourceHeader, tag, type, ptr, count); + /*@switchbreak@*/ break; + ++--------------------------------------------------------------------------- +| Add support for splitted source directories, i.e., source files +| alternatively can be placed into the .spec directory and are picked +| up there, too. ++--------------------------------------------------------------------------- +Index: build/files.c +--- build/files.c 4 Mar 2003 17:04:13 -0000 1.1.1.20 ++++ build/files.c 25 Aug 2003 09:42:08 -0000 +@@ -2253,8 +2258,20 @@ + } + + { const char * sfn; ++#ifndef OPENPKG + sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""), + "%{_sourcedir}/", srcPtr->source, NULL); ++#else ++ const char *sfn2; ++ sfn2 = rpmGetPath("%{_specdir}/", srcPtr->source, NULL); ++ if (access(sfn2, F_OK) == 0) ++ sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""), ++ "%{_specdir}/", srcPtr->source, NULL); ++ else ++ sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""), ++ "%{_sourcedir}/", srcPtr->source, NULL); ++ sfn2 = _free(sfn2); ++#endif + appendLineStringBuf(sourceFiles, sfn); + sfn = _free(sfn); + } +@@ -2263,8 +2280,20 @@ + for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) { + for (srcPtr = pkg->icon; srcPtr != NULL; srcPtr = srcPtr->next) { + const char * sfn; ++#ifndef OPENPKG + sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""), + "%{_sourcedir}/", srcPtr->source, NULL); ++#else ++ const char *sfn2; ++ sfn2 = rpmGetPath("%{_specdir}/", srcPtr->source, NULL); ++ if (access(sfn2, F_OK) == 0) ++ sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""), ++ "%{_specdir}/", srcPtr->source, NULL); ++ else ++ sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""), ++ "%{_sourcedir}/", srcPtr->source, NULL); ++ sfn2 = _free(sfn2); ++#endif + appendLineStringBuf(sourceFiles, sfn); + sfn = _free(sfn); + } + ++--------------------------------------------------------------------------- +| Add support for splitted source directories, i.e., source files +| alternatively can be placed into the .spec directory and are picked +| up there, too. ++--------------------------------------------------------------------------- +Index: build/parsePreamble.c +--- build/parsePreamble.c 3 Mar 2003 20:46:34 -0000 1.1.1.13 ++++ build/parsePreamble.c 24 Aug 2003 13:10:15 -0000 +@@ -366,7 +366,15 @@ + size_t nb, iconsize; + + /* XXX use rpmGenPath(rootdir, "%{_sourcedir}/", file) for icon path. */ ++#ifndef OPENPKG + fn = rpmGetPath("%{_sourcedir}/", file, NULL); ++#else ++ fn = rpmGetPath("%{_specdir}/", file, NULL); ++ if (access(fn, F_OK) == -1) { ++ fn = _free(fn); ++ fn = rpmGetPath("%{_sourcedir}/", file, NULL); ++ } ++#endif + + fd = Fopen(fn, "r.ufdio"); + if (fd == NULL || Ferror(fd)) { + +--------------------------------------------------------------------------- | In OpenPKG, the RPM package contains own local versions of the | "patch" and "tar" tools, so we cannot accept hard-coded names here. | Instead we expand a variable to allow us to direct RPM to our tools. -| Also we allow %setup and %patch macros whitespace-indented in %prep, -| because both in OpenPKG we both have all scripts indented and this -| way it is more flexible and clean. -| Additionally add support for splitted source directories, i.e., -| source files alternatively can be placed into the spec directory and -| are picked up there, too. +| Also, we allow %setup and %patch macros whitespace-indented in +| %prep, because both in OpenPKG we both have all scripts indented and +| this way it is more flexible and clean. +--------------------------------------------------------------------------- Index: build/parsePrep.c ---- build/parsePrep.c 2001/01/15 23:10:04 1.1.1.7 -+++ build/parsePrep.c 2001/09/21 12:24:12 1.4 -@@ -65,6 +65,7 @@ +--- build/parsePrep.c 7 Aug 2002 14:20:45 -0000 1.1.1.10 ++++ build/parsePrep.c 24 Aug 2003 13:10:15 -0000 +@@ -76,6 +76,7 @@ struct Source *sp; rpmCompressedMagic compressed = COMPRESSED_NOT; int urltype; @@ -35,58 +392,46 @@ Index: build/parsePrep.c for (sp = spec->sources; sp != NULL; sp = sp->next) { if ((sp->flags & RPMBUILD_ISPATCH) && (sp->num == c)) { -@@ -76,7 +77,15 @@ - return NULL; - } - -+#ifndef OPENPKG - fn = urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL); -+#else -+ fn = urlfn = rpmGetPath("%{_specdir}/", sp->source, NULL); -+ if (access(fn, F_OK) == -1) { -+ free(fn); -+ fn = urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL); -+ } -+#endif - - args[0] = '\0'; - if (db) { -@@ -112,6 +121,9 @@ +@@ -124,6 +133,10 @@ /*@notreached@*/ break; } + patcher = rpmGetPath("%{_patchbin}", NULL); + if (strcmp(patcher, "%{_patchbin}") == 0) + patcher = "patch"; ++ if (compressed) { const char *zipper = rpmGetPath( (compressed == COMPRESSED_BZIP2 ? "%{_bzip2bin}" : "%{_gzipbin}"), -@@ -119,20 +131,20 @@ +@@ -131,22 +144,23 @@ sprintf(buf, "echo \"Patch #%d (%s):\"\n" - "%s -d < %s | patch -p%d %s -s\n" -+ "%s -d < %s | %s -p%d %s -s\n" ++ "%s -d < %s | %s -p%d %s -s\n" "STATUS=$?\n" "if [ $STATUS -ne 0 ]; then\n" " exit $STATUS\n" "fi", - c, (const char *) basename(fn), + c, /*@-unrecog@*/ (const char *) basename(fn), /*@=unrecog@*/ zipper, - fn, strip, args); -+ fn, patcher, strip, args); - free((void *)zipper); ++ fn, patcher, strip, args); + zipper = _free(zipper); } else { sprintf(buf, "echo \"Patch #%d (%s):\"\n" - "patch -p%d %s -s < %s", c, (const char *) basename(fn), - strip, args, fn); -+ "%s -p%d %s -s < %s", c, (const char *) basename(fn), -+ patcher, strip, args, fn); ++ "%s -p%d %s -s < %s", c, (const char *) basename(fn), ++ patcher, strip, args, fn); } - free((void *)urlfn); -@@ -155,6 +167,7 @@ ++ patcher = _free(patcher); + urlfn = _free(urlfn); + return buf; + } +@@ -171,6 +185,7 @@ struct Source *sp; rpmCompressedMagic compressed = COMPRESSED_NOT; int urltype; @@ -94,59 +439,58 @@ Index: build/parsePrep.c for (sp = spec->sources; sp != NULL; sp = sp->next) { if ((sp->flags & RPMBUILD_ISSOURCE) && (sp->num == c)) { -@@ -166,7 +179,19 @@ +@@ -182,7 +197,15 @@ return NULL; } +#ifndef OPENPKG - fn = urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL); + urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL); +#else -+ fn = urlfn = rpmGetPath("%{_specdir}/", sp->source, NULL); -+ if (access(fn, F_OK) == -1) { -+ free(fn); -+ fn = urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL); ++ urlfn = rpmGetPath("%{_specdir}/", sp->source, NULL); ++ if (access(urlfn, F_OK) == -1) { ++ urlfn = _free(urlfn); ++ urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL); + } +#endif -+ -+ tar = rpmGetPath("%{_tarbin}", NULL); -+ if (strcmp(tar, "%{_tarbin}") == 0) -+ tar = "tar"; + /*@-internalglobs@*/ /* FIX: shrug */ taropts = ((rpmIsVerbose() && !quietly) ? "-xvvf" : "-xf"); +@@ -228,6 +251,10 @@ + /*@notreached@*/ break; + } -@@ -232,8 +257,13 @@ - free((void *)zipper); ++ tar = rpmGetPath("%{_tarbin}", NULL); ++ if (strcmp(tar, "%{_tarbin}") == 0) ++ tar = "tar"; ++ + if (compressed != COMPRESSED_NOT) { + const char *zipper; + int needtar = 1; +@@ -254,8 +281,13 @@ + zipper = _free(zipper); *t++ = ' '; t = stpcpy(t, fn); - if (needtar) - t = stpcpy( stpcpy( stpcpy(t, " | tar "), taropts), " -"); + if (needtar) { + t = stpcpy(t, " | "); -+ t = stpcpy(t, tar); -+ t = stpcpy(t, " "); -+ t = stpcpy(t, taropts); -+ t = stpcpy(t, " -"); ++ t = stpcpy(t, tar); ++ t = stpcpy(t, " "); ++ t = stpcpy(t, taropts); ++ t = stpcpy(t, " -"); + } t = stpcpy(t, "\n" "STATUS=$?\n" -@@ -242,7 +272,7 @@ - "fi"); - } else { - buf[0] = '\0'; -- t = stpcpy( stpcpy(buf, "tar "), taropts); -+ t = stpcpy( stpcpy(stpcpy(buf, tar), " "), taropts); - *t++ = ' '; - t = stpcpy(t, fn); - } -@@ -549,11 +579,14 @@ - - saveLines = splitString(getStringBuf(buf), strlen(getStringBuf(buf)), '\n'); +@@ -584,12 +617,15 @@ + saveLines = splitString(getStringBuf(sb), strlen(getStringBuf(sb)), '\n'); + /*@-usereleased@*/ for (lines = saveLines; *lines; lines++) { -+ char *cp; -+ for (cp = *lines; *cp == ' ' || *cp == '\t'; cp++) -+ ; ++ char *cp; ++ for (cp = *lines; *cp == ' ' || *cp == '\t'; cp++) ++ ; res = 0; + /*@-boundsread@*/ - if (! strncmp(*lines, "%setup", sizeof("%setup")-1)) { - res = doSetupMacro(spec, *lines); - } else if (! strncmp(*lines, "%patch", sizeof("%patch")-1)) { @@ -159,64 +503,243 @@ Index: build/parsePrep.c appendLineStringBuf(spec->prep, *lines); } ++--------------------------------------------------------------------------- +| Add support for splitted source directories, i.e., source files +| alternatively can be placed into the .spec directory and are picked +| up there, too. ++--------------------------------------------------------------------------- +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 +@@ -87,7 +88,15 @@ + return NULL; + } + ++#ifndef OPENPKG + urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL); ++#else ++ urlfn = rpmGetPath("%{_specdir}/", sp->source, NULL); ++ if (access(urlfn, F_OK) == -1) { ++ urlfn = _free(urlfn); ++ urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL); ++ } ++#endif + + args[0] = '\0'; + if (db) { + +--------------------------------------------------------------------------- | Not everything on a system is RPM based (for instance OpenPKG is | just an add-on to the system), so do not assume we can just require | a package to provide "/bin/sh". +--------------------------------------------------------------------------- Index: build/parseScript.c ---- build/parseScript.c 2001/01/15 23:10:04 1.1.1.9 -+++ build/parseScript.c 2001/06/25 19:31:13 1.2 -@@ -246,6 +246,7 @@ +--- build/parseScript.c 23 Jun 2002 19:47:12 -0000 1.1.1.12 ++++ build/parseScript.c 24 Aug 2003 13:10:15 -0000 +@@ -261,6 +261,7 @@ stripTrailingBlanksStringBuf(sb); p = getStringBuf(sb); + if (progArgv[0] != NULL && strcmp(progArgv[0], "/bin/sh") != 0) - addReqProv(spec, pkg->header, (tagflags | RPMSENSE_INTERP), progArgv[0], NULL, 0); + (void) addReqProv(spec, pkg->header, (tagflags | RPMSENSE_INTERP), progArgv[0], NULL, 0); /* Trigger script insertion is always delayed in order to */ +--------------------------------------------------------------------------- -| RPM has two platform id canonicalizations: hard-coded ones in the -| "rpm" program and defined ones in the rpmrc files. The hard-coded -| ones make the defined ones inconsistent. Additionally in OpenPKG we -| know exactly what we do. So disable the hard-coded canonicalizations -| and use only the defined ones. The only thing we do inside "rpm" is -| to reduce the platform version to major and minor version numbers in -| order to simplify the "rpmrc" files. +| Add support for splitted source directories, i.e., source files +| alternatively can be placed into the spec directory and are picked +| up there, too. ++--------------------------------------------------------------------------- +Index: build/spec.c +--- build/spec.c 4 Mar 2003 15:25:51 -0000 1.1.1.21 ++++ build/spec.c 24 Aug 2003 13:10:15 -0000 +@@ -334,7 +334,15 @@ + + if (tag != RPMTAG_ICON) { + /*@-nullpass@*/ /* LCL: varargs needs null annotate. */ ++#ifndef OPENPKG + const char *body = rpmGetPath("%{_sourcedir}/", p->source, NULL); ++#else ++ const char *body = rpmGetPath("%{_specdir}/", p->source, NULL); ++ if (access(body, F_OK) == -1) { ++ body = _free(body); ++ body = rpmGetPath("%{_sourcedir}/", p->source, NULL); ++ } ++#endif + /*@=nullpass@*/ + + sprintf(buf, "%s%d", + ++--------------------------------------------------------------------------- +| Do not build with warnings on, because we do no RPM development +| (so warnings are useless here), they cause some confusion inside +| Berkeley-DB and also slow down building. Instead, increase the +| optimization level. Additionally, disable static linking of RPM +| tools. Finally, use "shtool mkdir" as the "mkdir -p" fallback. ++--------------------------------------------------------------------------- +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 +@@ -53,7 +53,7 @@ + AS=${AS-as} + AC_SUBST(AS) + if test "$ac_cv_prog_gcc" = 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 + +@@ -142,6 +142,7 @@ + # just link it dynamically + LDFLAGS_STATIC="" + fi ++LDFLAGS_STATIC="" # OpenPKG wants dynamically linked RPM tools + LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}" # libtool format + AC_MSG_RESULT($LDFLAGS_STATIC) + AC_SUBST(LDFLAGS_STATIC) +@@ -201,7 +202,7 @@ + + if test X"$MKDIR_P" = X0 ; then + AC_MSG_RESULT(no) +- MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`" ++ MKDIR_P="@l_prefix@/lib/openpkg/shtool mkdir -f -p -m 755" + else + AC_MSG_RESULT(yes) + fi + ++--------------------------------------------------------------------------- +| Adjust paths for OpenPKG filesystem layout. ++--------------------------------------------------------------------------- +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 +@@ -1200,12 +1202,12 @@ + AC_SUBST(LOCALEDIR) + LIBDIR="`echo $libdir | sed 's-/lib$-/%{_lib}-'`" + AC_SUBST(LIBDIR) +-RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`" ++RPMCONFIGDIR="@l_prefix@/lib/openpkg" + AC_DEFINE_UNQUOTED(RPMCONFIGDIR, "$RPMCONFIGDIR", + [Full path to rpm global configuration directory (usually /usr/lib/rpm)]) + AC_SUBST(RPMCONFIGDIR) + +-SYSCONFIGDIR="`echo /etc/rpm`" ++SYSCONFIGDIR="@l_prefix@/etc/openpkg" + AC_DEFINE_UNQUOTED(SYSCONFIGDIR, "$SYSCONFIGDIR", + [Full path to rpm system configuration directory (usually /etc/rpm)]) + AC_SUBST(SYSCONFIGDIR) +@@ -1215,17 +1217,17 @@ + [Colon separated paths of macro files to read.]) + AC_SUBST(MACROFILES) + +-LIBRPMRC_FILENAME="${RPMCONFIGDIR}/rpmrc" ++LIBRPMRC_FILENAME="${SYSCONFIGDIR}/rpmrc" + AC_DEFINE_UNQUOTED(LIBRPMRC_FILENAME, "$LIBRPMRC_FILENAME", + [Full path to rpmrc configuration file (usually /usr/lib/rpm/rpmrc)]) + AC_SUBST(LIBRPMRC_FILENAME) + +-VENDORRPMRC_FILENAME="${RPMCONFIGDIR}/${RPMCANONVENDOR}/rpmrc" ++VENDORRPMRC_FILENAME="${SYSCONFIGDIR}/${RPMCANONVENDOR}/rpmrc" + AC_DEFINE_UNQUOTED(VENDORRPMRC_FILENAME, "$VENDORRPMRC_FILENAME", + [Full path to vendor rpmrc configuration file (usually /usr/lib/rpm/vendor/rpmrc)]) + AC_SUBST(VENDORRPMRC_FILENAME) + +-LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt-${VERSION}" ++LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt" + AC_DEFINE_UNQUOTED(LIBRPMALIAS_FILENAME, "$LIBRPMALIAS_FILENAME", + [Full path to rpmpopt configuration file (usually /usr/lib/rpm/rpmpopt)]) + AC_SUBST(LIBRPMALIAS_FILENAME) + ++--------------------------------------------------------------------------- +| RPM has two platform id canonicalizations: hard-coded ones in +| the "rpm" program and defined ones in the rpmrc files. The +| hard-coded ones make the defined ones inconsistent. Additionally, +| in OpenPKG we know exactly what we do. So, disable the hard-coded +| canonicalizations and use only the defined ones. The only thing we +| do inside RPM is to reduce the platform version to major and minor +| version numbers in order to simplify the "rpmrc" files. Then, RPM +| allows to read the platform from an external program. Adjust the +| hard-coded path to this program and allow it to be overridden with +| the macro %{__platform}. Finally, change the default definition of +| %{_host} to not contain the vendor stuff to more conform to what +| %{_target} usually is defined to and what we are using throughout +| OpenPKG, too. +--------------------------------------------------------------------------- Index: lib/rpmrc.c ---- lib/rpmrc.c 2001/03/13 12:55:25 1.1.1.20 -+++ lib/rpmrc.c 2001/09/23 08:15:32 1.3 -@@ -931,6 +931,26 @@ - if (!gotDefaults) { - uname(&un); +--- lib/rpmrc.c 4 Jun 2003 18:18:45 -0000 1.1.1.25 ++++ lib/rpmrc.c 26 Aug 2003 07:25:49 -0000 +@@ -27,7 +27,7 @@ + const char * macrofiles = MACROFILES; + + /*@observer@*/ /*@unchecked@*/ +-static const char * platform = "/etc/rpm/platform"; ++static const char * platform = "@l_prefix@/etc/openpkg/platform"; + /*@only@*/ /*@relnull@*/ /*@unchecked@*/ + static const char ** platpat = NULL; + /*@unchecked@*/ +@@ -861,7 +861,11 @@ + + platpat = xrealloc(platpat, (nplatpat + 2) * sizeof(*platpat)); + /*@-onlyunqglobaltrans@*/ ++#ifdef OPENPKG ++ platpat[nplatpat] = rpmExpand("%{_host_cpu}-%{_host_os}", NULL); ++#else + platpat[nplatpat] = rpmExpand("%{_host_cpu}-%{_host_vendor}-%{_host_os}", (gnu && *gnu ? "-" : NULL), gnu, NULL); ++#endif + nplatpat++; + platpat[nplatpat] = NULL; + /*@=onlyunqglobaltrans@*/ +@@ -1062,7 +1066,15 @@ + int rc; + while (!gotDefaults) { +#ifdef OPENPKG -+ { -+ char *cp; -+ char *cpR; -+ int n; -+ cpR = un.release; -+ if ((n = strcspn(cpR, "0123456789")) > 0) -+ cpR += n; -+ if ((n = strspn(cpR, "0123456789.")) > 0) { -+ /* terminate after "N.N.N...." prefix */ -+ cpR[n] = '\0'; -+ /* shorten to "N.N" if longer */ -+ if ((cp = strchr(cpR, '.')) != NULL) { -+ if ((cp = strchr(cp+1, '.')) != NULL) -+ *cp = '\0'; -+ } -+ strcat(un.sysname, cpR); ++ const char *cp; ++ cp = rpmExpand("%{?__platform}", NULL); ++ if (cp == NULL || cp[0] == '\0') ++ cp = platform; ++ if (!rpmPlatform(cp)) { ++#else + if (!rpmPlatform(platform)) { ++#endif + const char * s; + s = rpmExpand("%{_host_cpu}", NULL); + if (s) { +@@ -1082,6 +1094,32 @@ + rc = uname(&un); + if (rc < 0) return; + ++#ifdef OPENPKG ++ { ++ char *cp; ++ char *cpR; ++ int n; ++ cpR = un.release; ++ if ((n = strcspn(cpR, "0123456789")) > 0) ++ cpR += n; ++ if ((n = strspn(cpR,"0123456789.")) > 0) { ++ /* terminate after "N.N.N...." prefix */ ++ cpR[n] = '\0'; ++ /* shorten to "N.N" if longer */ ++ if ((cp = strchr(cpR, '.')) != NULL) { ++ if ((cp = strchr(cp+1, '.')) != NULL) ++ *cp = '\0'; + } ++ 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__) #ifdef SNI /* USUALLY un.sysname on sinix does start with the word "SINIX" -@@ -1114,6 +1134,7 @@ - un.machine[1] = class; +@@ -1298,6 +1336,7 @@ + } } # endif +#endif /* OPENPKG */ @@ -225,153 +748,300 @@ Index: lib/rpmrc.c canon = lookupInCanonTable(un.machine, +--------------------------------------------------------------------------- -| Add support for splitted source directories, i.e., source files -| alternatively can be placed into the spec directory and are picked -| up there, too. +| Disable "check-files" feature, because it is useless in OpenPKG +| (we consistently use BuildRoot and our %files lists are fully +| autogenerated) and just makes problems on bootstrapping. +| Additionally, do not override the "_host_xx" macros because their +| value (derived from /etc/openpkg/platform) is already +| correctly set internally. +--------------------------------------------------------------------------- -Index: build/build.c ---- build/build.c 2001/01/15 23:10:04 1.1.1.16 -+++ build/build.c 2001/09/17 11:09:23 1.2 -@@ -25,7 +25,15 @@ +Index: macros.in +--- macros.in 2 Jul 2003 19:20:52 -0000 1.1.1.14 ++++ macros.in 25 Aug 2003 18:23:11 -0000 +@@ -305,7 +305,7 @@ + # Returns list of unpackaged files, i.e. files in $RPM_BUILD_ROOT not packaged. + # + # Note: Disable (by commenting out) for legacy compatibility. +-%__check_files @RPMCONFIGDIR@/check-files %{buildroot} ++#%__check_files @RPMCONFIGDIR@/check-files %{buildroot} - for (p = spec->sources; p != NULL; p = p->next) { - if (! (p->flags & RPMBUILD_ISNO)) { -+#ifndef OPENPKG - const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL); -+#else -+ const char *fn = rpmGetPath("%{_specdir}/", p->source, NULL); -+ if (access(fn, F_OK) == -1) { -+ free(fn); -+ fn = rpmGetPath("%{_sourcedir}/", p->source, NULL); -+ } -+#endif - unlink(fn); - free((void *)fn); - } -@@ -34,7 +42,15 @@ - for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) { - for (p = pkg->icon; p != NULL; p = p->next) { - if (! (p->flags & RPMBUILD_ISNO)) { -+#ifndef OPENPKG - const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL); -+#else -+ const char *fn = rpmGetPath("%{_specdir}/", p->source, NULL); -+ if (access(fn, F_OK) == -1) { -+ free(fn); -+ fn = rpmGetPath("%{_sourcedir}/", p->source, NULL); -+ } -+#endif - unlink(fn); - free((void *)fn); - } + # + # Should unpackaged files in a build root terminate a build? +@@ -929,11 +929,11 @@ + %_build_cpu %{_host_cpu} + %_build_vendor %{_host_vendor} + %_build_os %{_host_os} +-%_host @host@ +-%_host_alias @host_alias@%{nil} +-%_host_cpu @host_cpu@ +-%_host_vendor @host_vendor@ +-%_host_os @host_os@ ++#%_host @host@ ++#%_host_alias @host_alias@%{nil} ++#%_host_cpu @host_cpu@ ++#%_host_vendor @host_vendor@ ++#%_host_os @host_os@ + %_target %{_host} + %_target_alias %{_host_alias} + %_target_cpu %{_host_cpu} +--------------------------------------------------------------------------- -| Add support for splitted source directories, i.e., source files -| alternatively can be placed into the spec directory and are picked -| up there, too. Also add support for Provides headers in source RPMs. +| Adjust path for OpenPKG filesystem layout. +--------------------------------------------------------------------------- -Index: build/files.c ---- build/files.c 2001/01/19 01:47:25 1.1.1.15 -+++ build/files.c 2001/09/17 11:09:23 1.2 -@@ -1591,6 +1591,9 @@ - case RPMTAG_CHANGELOGTEXT: - case RPMTAG_URL: - case HEADER_I18NTABLE: -+ case RPMTAG_PROVIDENAME: -+ case RPMTAG_PROVIDEVERSION: -+ case RPMTAG_PROVIDEFLAGS: - headerAddEntry(spec->sourceHeader, tag, type, ptr, count); - break; - default: -@@ -1655,8 +1658,20 @@ - } +Index: scripts/Makefile.am +--- scripts/Makefile.am 20 Jun 2003 19:04:49 -0000 1.1.1.11 ++++ scripts/Makefile.am 26 Aug 2003 07:45:36 -0000 +@@ -22,7 +22,7 @@ - { const char *s; -+#ifndef OPENPKG - s = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""), - "%{_sourcedir}/", srcPtr->source, NULL); -+#else -+ const char *s2; -+ s2 = rpmGetPath("%{_specdir}/", srcPtr->source, NULL); -+ if (access(s2, F_OK) == 0) -+ s = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""), -+ "%{_specdir}/", srcPtr->source, NULL); -+ else -+ s = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""), -+ "%{_sourcedir}/", srcPtr->source, NULL); -+ free(s2); -+#endif - appendLineStringBuf(sourceFiles, s); - free((void *)s); - } -@@ -1665,8 +1680,20 @@ - for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) { - for (srcPtr = pkg->icon; srcPtr != NULL; srcPtr = srcPtr->next) { - const char *s; -+#ifndef OPENPKG - s = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""), - "%{_sourcedir}/", srcPtr->source, NULL); -+#else -+ const char *s2; -+ s2 = rpmGetPath("%{_specdir}/", srcPtr->source, NULL); -+ if (access(s2, F_OK) == 0) -+ s = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""), -+ "%{_specdir}/", srcPtr->source, NULL); -+ else -+ s = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""), -+ "%{_sourcedir}/", srcPtr->source, NULL); -+ free(s2); -+#endif - appendLineStringBuf(sourceFiles, s); - free((void *)s); - } + all: + +-configdir = ${prefix}/lib/rpm ++configdir = ${prefix}/lib/openpkg + config_SCRIPTS = \ + brp-compress brp-python-bytecompile brp-redhat \ + brp-strip brp-strip-comment-note \ +--------------------------------------------------------------------------- -| Add support for splitted source directories, i.e., source files -| alternatively can be placed into the spec directory and are picked -| up there, too. +| Adjust path for OpenPKG filesystem layout. +--------------------------------------------------------------------------- -Index: build/parsePreamble.c ---- build/parsePreamble.c 2001/01/15 23:10:04 1.1.1.9 -+++ build/parsePreamble.c 2001/09/17 11:09:23 1.2 -@@ -317,7 +317,15 @@ - size_t nb, iconsize; +Index: scripts/Makefile.in +--- scripts/Makefile.in 16 Jul 2003 17:05:49 -0000 1.1.1.14 ++++ scripts/Makefile.in 26 Aug 2003 07:45:45 -0000 +@@ -273,7 +273,7 @@ - /* XXX use rpmGenPath(rootdir, "%{_sourcedir}/", file) for icon path. */ -+#ifndef OPENPKG - fn = rpmGetPath("%{_sourcedir}/", file, NULL); -+#else -+ fn = rpmGetPath("%{_specdir}/", file, NULL); -+ if (access(fn, F_OK) == -1) { -+ free(fn); -+ fn = rpmGetPath("%{_sourcedir}/", file, NULL); -+ } -+#endif + installprefix = $(DESTDIR) - fd = Fopen(fn, "r.ufdio"); - if (fd == NULL || Ferror(fd)) { +-configdir = ${prefix}/lib/rpm ++configdir = ${prefix}/lib/openpkg + config_SCRIPTS = \ + brp-compress brp-python-bytecompile brp-redhat \ + brp-strip brp-strip-comment-note \ +--------------------------------------------------------------------------- -| Add support for splitted source directories, i.e., source files -| alternatively can be placed into the spec directory and are picked -| up there, too. +| 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, adjust the path to file(1)'s "magic" file. +--------------------------------------------------------------------------- -Index: build/spec.c ---- build/spec.c 2001/01/15 23:10:04 1.1.1.16 -+++ build/spec.c 2001/09/17 11:09:23 1.2 -@@ -319,7 +319,15 @@ - spec->numSources++; +Index: file/Makefile.am +--- file/Makefile.am 24 Jan 2003 19:41:56 -0000 1.1.1.1 ++++ file/Makefile.am 26 Aug 2003 07:44:31 -0000 +@@ -36,7 +36,7 @@ + #MAGIC = @datadir@/magic + #data_DATA = magic magic.mime magic.mgc magic.mime.mgc - if (tag != RPMTAG_ICON) { -+#ifndef OPENPKG - const char *body = rpmGetPath("%{_sourcedir}/", p->source, NULL); -+#else -+ const char *body = rpmGetPath("%{_specdir}/", p->source, NULL); -+ if (access(body, F_OK) == -1) { -+ free(body); -+ body = rpmGetPath("%{_sourcedir}/", p->source, NULL); -+ } -+#endif +-pkglibdir = @prefix@/lib/rpm ++pkglibdir = @prefix@/lib/openpkg + pkglib_DATA = magic magic.mime magic.mgc magic.mime.mgc + MAGIC = $(pkglibdir)/magic + CPPFLAGS = -DMAGIC='"$(MAGIC)"' + ++--------------------------------------------------------------------------- +| 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, adjust the path to file(1)'s "magic" file. ++--------------------------------------------------------------------------- +Index: file/Makefile.in +--- file/Makefile.in 16 Jul 2003 17:05:23 -0000 1.1.1.2 ++++ file/Makefile.in 26 Aug 2003 07:44:20 -0000 +@@ -39,7 +39,7 @@ - sprintf(buf, "%s%d", - (flag & RPMBUILD_ISPATCH) ? "PATCH" : "SOURCE", num); + #MAGIC = @datadir@/magic + #data_DATA = magic magic.mime magic.mgc magic.mime.mgc +-pkglibdir = @prefix@/lib/rpm ++pkglibdir = @prefix@/lib/openpkg + ACLOCAL = @ACLOCAL@ + AMDEP_FALSE = @AMDEP_FALSE@ + AMDEP_TRUE = @AMDEP_TRUE@ +@@ -159,7 +159,7 @@ + noinst_PROGRAMS = file + + file_SOURCES = file.c +-file_LDFLAGS = -all-static ++file_LDFLAGS = -static + file_LDADD = libfmagic.la + + man_MAGIC = magic.@fsect@ + ++--------------------------------------------------------------------------- +| 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, disable the building of gettext stuff we don't need. ++--------------------------------------------------------------------------- +Index: popt/Makefile.am +--- popt/Makefile.am 6 Mar 2003 23:16:43 -0000 1.1.1.9 ++++ popt/Makefile.am 26 Aug 2003 07:42:34 -0000 +@@ -9,7 +9,7 @@ + po/*.in po/*.po po/popt.pot \ + popt.ps + +-SUBDIRS = intl po ++SUBDIRS = intl + + INCLUDES = -I. -I$(top_srcdir) + +@@ -17,13 +17,13 @@ + + noinst_PROGRAMS = test1 test2 test3 + test1_SOURCES = test1.c +-test1_LDFLAGS = -all-static ++test1_LDFLAGS = -static + test1_LDADD = $(usrlib_LTLIBRARIES) + test2_SOURCES = test2.c +-test2_LDFLAGS = -all-static ++test2_LDFLAGS = -static + test2_LDADD = $(usrlib_LTLIBRARIES) + test3_SOURCES = test3.c +-test3_LDFLAGS = -all-static ++test3_LDFLAGS = -static + test3_LDADD = $(usrlib_LTLIBRARIES) + + noinst_SCRIPTS = testit.sh + ++--------------------------------------------------------------------------- +| 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, disable the building of gettext stuff we don't need. ++--------------------------------------------------------------------------- +Index: popt/Makefile.in +--- popt/Makefile.in 16 Jul 2003 17:04:49 -0000 1.1.1.14 ++++ popt/Makefile.in 26 Aug 2003 07:42:51 -0000 +@@ -163,7 +163,7 @@ + popt.ps + + +-SUBDIRS = intl po ++SUBDIRS = intl + + INCLUDES = -I. -I$(top_srcdir) + +@@ -171,13 +171,13 @@ + + noinst_PROGRAMS = test1 test2 test3 + test1_SOURCES = test1.c +-test1_LDFLAGS = -all-static ++test1_LDFLAGS = -static + test1_LDADD = $(usrlib_LTLIBRARIES) + test2_SOURCES = test2.c +-test2_LDFLAGS = -all-static ++test2_LDFLAGS = -static + test2_LDADD = $(usrlib_LTLIBRARIES) + test3_SOURCES = test3.c +-test3_LDFLAGS = -all-static ++test3_LDFLAGS = -static + test3_LDADD = $(usrlib_LTLIBRARIES) + + noinst_SCRIPTS = testit.sh + ++--------------------------------------------------------------------------- +| Revert back to the old behaviour of passing to "exec" programs an +| extra "--" argument to separate options and arguments. Additionally, +| allow the "!#:+" constructs to be used multiple times and then each +| time eat another argument (instead of just eating an argument once +| and expanding this multiple times). ++--------------------------------------------------------------------------- +Index: popt/popt.c +--- popt/popt.c 22 Aug 2002 14:17:44 -0000 1.1.1.12 ++++ popt/popt.c 24 Aug 2003 13:10:16 -0000 +@@ -400,9 +400,7 @@ + } + + if (con->leftovers != NULL && con->numLeftovers > 0) { +-#if 0 + argv[argc++] = "--"; +-#endif + memcpy(argv + argc, con->leftovers, sizeof(*argv) * con->numLeftovers); + argc += con->numLeftovers; + } +@@ -580,10 +578,8 @@ + if (!(s[0] == '#' && s[1] == ':' && s[2] == '+')) + /*@switchbreak@*/ break; + /* XXX Make sure that findNextArg deletes only next arg. */ +- if (a == NULL) { + if ((a = findNextArg(con, 1, 1)) == NULL) + /*@switchbreak@*/ break; +- } + s += 3; + + alen = strlen(a); + ++--------------------------------------------------------------------------- +| Dedefine the stdio variable BUFSIZ because it is usually just 1024 +| on some platforms (on Linux it is 8192) and unfortunately RPM uses +| it here for the macro expansion buffer. For OpenPKG the size 1024 is +| definetely too small. So increase this to a 16KB buffer. ++--------------------------------------------------------------------------- +Index: rpmio/macro.c +--- rpmio/macro.c 15 May 2003 13:42:01 -0000 1.1.1.7 ++++ rpmio/macro.c 26 Aug 2003 07:31:04 -0000 +@@ -50,6 +50,9 @@ + + #include "debug.h" + ++#undef BUFSIZ ++#define BUFSIZ 16384 ++ + #if defined(__LCLINT__) + /*@-exportheader@*/ + extern const unsigned short int **__ctype_b_loc (void) /*@*/; + ++--------------------------------------------------------------------------- +| Reactivate build mode aliases which were removed in rpm-4.1 +| (and now should be available through "rpmbuild" only). ++--------------------------------------------------------------------------- +Index: rpmpopt.in +--- rpmpopt.in 24 Jan 2003 14:56:30 -0000 1.1.1.7 ++++ rpmpopt.in 25 Aug 2003 09:32:31 -0000 +@@ -147,28 +147,27 @@ + # Popt glue to preserve legacy CLI behavior. + # + # XXX popt exec parsing doesn't honor POPT_ARGFLAG_ONEDASH +-# XXX Build mode aliases, removed in rpm-4.1. +-#rpm exec --bp rpmb -bp +-#rpm exec --bc rpmb -bc +-#rpm exec --bi rpmb -bi +-#rpm exec --bl rpmb -bl +-#rpm exec --ba rpmb -ba +-#rpm exec --bb rpmb -bb +-#rpm exec --bs rpmb -bs +-#rpm exec --tp rpmb -tp +-#rpm exec --tc rpmb -tc +-#rpm exec --ti rpmb -ti +-#rpm exec --tl rpmb -tl +-#rpm exec --ta rpmb -ta +-#rpm exec --tb rpmb -tb +-#rpm exec --ts rpmb -ts +-#rpm exec --rebuild rpmb --rebuild +-#rpm exec --recompile rpmb --recompile +-#rpm exec --clean rpmb --clean +-#rpm exec --rmsource rpmb --rmsource +-#rpm exec --rmspec rpmb --rmspec +-#rpm exec --target rpmb --target +-#rpm exec --short-circuit rpmb --short-circuit ++rpm exec --bp rpmb -bp ++rpm exec --bc rpmb -bc ++rpm exec --bi rpmb -bi ++rpm exec --bl rpmb -bl ++rpm exec --ba rpmb -ba ++rpm exec --bb rpmb -bb ++rpm exec --bs rpmb -bs ++rpm exec --tp rpmb -tp ++rpm exec --tc rpmb -tc ++rpm exec --ti rpmb -ti ++rpm exec --tl rpmb -tl ++rpm exec --ta rpmb -ta ++rpm exec --tb rpmb -tb ++rpm exec --ts rpmb -ts ++rpm exec --rebuild rpmb --rebuild ++rpm exec --recompile rpmb --recompile ++rpm exec --clean rpmb --clean ++rpm exec --rmsource rpmb --rmsource ++rpm exec --rmspec rpmb --rmspec ++rpm exec --target rpmb --target ++rpm exec --short-circuit rpmb --short-circuit + + rpm exec --initdb rpmd --initdb + rpm exec --rebuilddb rpmd --rebuilddb diff --git a/openpkg/rpm.patch.porting b/openpkg/rpm.patch.porting index 26f26bbfe2..c3fddc072b 100644 --- a/openpkg/rpm.patch.porting +++ b/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 ## Copyright (c) 2000-2003 Ralf S. Engelschall ## Copyright (c) 2000-2003 Cable & Wireless @@ -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 -+#include - - #include - #include -@@ -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 -+#include + 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 - #include + 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 ++ + #if defined(_LIBC) + #include + #include +@@ -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 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 + #include + #include +-/*@-noparams@*/ +-#include +-/*@=noparams@*/ + #include + #include + #include + ++--------------------------------------------------------------------------- +| 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 - #include + 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) +| 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 + #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 +-#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 diff --git a/openpkg/rpm.patch.regen b/openpkg/rpm.patch.regen index b89e58c7d9..10ccb068f2 100644 --- a/openpkg/rpm.patch.regen +++ b/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 ## Copyright (c) 2000-2003 Ralf S. Engelschall ## Copyright (c) 2000-2003 Cable & Wireless @@ -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 < conftest.$ac_ext <&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 <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 ++ which can conflict with char getmntinfo (); below. ++ Prefer to if __STDC__ is defined, since ++ exists even on freestanding compilers. */ ++#ifdef __STDC__ ++# include ++#else ++# include ++#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 <&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 <&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 <&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 <&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 < - #include -@@ -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 + + ;; diff --git a/openpkg/rpmmacros b/openpkg/rpmmacros index 9f4f753461..4e647ac96d 100644 --- a/openpkg/rpmmacros +++ b/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} and %{PATCH} with %{SOURCE } and %{PATCH } @@ -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}\"\ diff --git a/openpkg/rpmpopt b/openpkg/rpmpopt index 49bceddf98..af3fcfcb78 100644 --- a/openpkg/rpmpopt +++ b/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] " +rpm alias --with --define "with_!#:+ yes" \ + --POPTdesc=$"set '%option yes'" \ + --POPTargs=$"" +rpm alias --without --define "with_!#:+ no" \ + --POPTdesc=$"set '%option with_ no'" \ + --POPTargs=$"" + +# RPM extension: "rpm --option " +rpm alias --option --define "!#:+ !#:+" \ + --POPTdesc=$"set '%option '" \ + --POPTargs=$" " + +# 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)" diff --git a/openpkg/rpmrc b/openpkg/rpmrc index 920079724c..2fbebd61c3 100644 --- a/openpkg/rpmrc +++ b/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 diff --git a/openpkg/rpmx.pl b/openpkg/rpmx.pl index 835b33caa3..3852dfe3f0 100644 --- a/openpkg/rpmx.pl +++ b/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 -## -## update local database with latest repository information -## $ rpm --update -## ## update the package sources by downloading missing files ## $ rpm --fetch ## ## make a proxy package ## $ rpm --makeproxy ## -## 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|\n(.+?)|&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 "\n" . - "\n" . - $DB->{$rpm}->{REPOS} . - "\n" . - "\n" . - $DB->{$rpm}->{REQUIRES} . - "\n" . - "\n" . - $DB->{$rpm}->{INFO} . - "\n" . - "\n" . - $DB->{$rpm}->{FILES} . - "\n" . - "\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 .= "\n"; - $index .= "\n"; - $index .= `$rpm -qp --qf '[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]' $dir/$file`; - $index .= "\n"; - $index .= "\n"; - $index .= `$rpm -qpi $dir/$file`; - $index .= "\n"; - $index .= "\n"; - $index .= `$rpm -qplv $dir/$file`; - $index .= "\n"; - $index .= "\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|\n(.+?)|&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"; - } -} -