OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /e/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-src Date: 25-Aug-2003 20:55:23 Branch: OPENPKG_UPGRADE_RPM42 Handle: 2003082519552200 Added files: (Branch: OPENPKG_UPGRADE_RPM42) openpkg-src/openpkg platform Modified files: (Branch: OPENPKG_UPGRADE_RPM42) openpkg-src/openpkg openpkg.boot openpkg.spec rpm.patch.feature rpmmacros Log: - provide program <prefix>/lib/openpkg/platform which provides "<arch>-<os>" id strings for the underlying platform. Additionally, provide file <prefix>/etc/openpkg/platform which provides the (pregenerated) output of <prefix>/lib/openpkg/platform. Finally, teach RPM to use the platform id in <prefix>/etc/openpkg/platform instead of uname(3) to set %{_host*} macros. And make sure that all remaining platform macros are set correctly relative to this stuff. - install the file(1) command line utility for convinience reasons - remove find-{requires,provides}, it is not used at all by OpenPKG Summary: Revision Changes Path 1.28.2.4 +5 -1 openpkg-src/openpkg/openpkg.boot 1.192.2.17 +24 -6 openpkg-src/openpkg/openpkg.spec 1.1.2.1 +149 -0 openpkg-src/openpkg/platform 1.4.2.6 +64 -11 openpkg-src/openpkg/rpm.patch.feature 1.40.2.2 +54 -4 openpkg-src/openpkg/rpmmacros ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-src/openpkg/openpkg.boot ============================================================================ $ cvs diff -u -r1.28.2.3 -r1.28.2.4 openpkg.boot --- openpkg-src/openpkg/openpkg.boot 25 Aug 2003 10:01:59 -0000 1.28.2.3 +++ openpkg-src/openpkg/openpkg.boot 25 Aug 2003 18:55:22 -0000 1.28.2.4 @@ -412,7 +412,11 @@ exit 1 fi echo "#!/bin/sh" >$tmpdir/rpm -echo "exec $RPM_BUILD_ROOT$prefix/bin/rpm --rcfile $tmpdir/rpm.1 \"[EMAIL PROTECTED]"" >>$tmpdir/rpm +( echo "exec $RPM_BUILD_ROOT$prefix/bin/rpm \\" + echo " --define \"__platform $RPM_BUILD_ROOT$prefix/etc/openpkg/platform\" \\" + echo " --rcfile $tmpdir/rpm.1 \\" + echo "\"[EMAIL PROTECTED]"" +) >>$tmpdir/rpm chmod a+x $tmpdir/rpm # direct our own "rpm" tool to adjusted macro sets @@ . patch -p0 <<'@@ .' Index: openpkg-src/openpkg/openpkg.spec ============================================================================ $ cvs diff -u -r1.192.2.16 -r1.192.2.17 openpkg.spec --- openpkg-src/openpkg/openpkg.spec 25 Aug 2003 10:46:14 -0000 1.192.2.16 +++ openpkg-src/openpkg/openpkg.spec 25 Aug 2003 18:55:22 -0000 1.192.2.17 @@ -116,6 +116,7 @@ Source47: pod2man.sh Source48: rc.8 Source49: rc.pod +Source50: platform # build information Prefix: %{l_prefix} @@ -524,6 +525,9 @@ sed -e 's;BUFSIZ;8192;g' \ <rpmio/macro.c >rpmio/macro.c.n && \ mv rpmio/macro.c.n rpmio/macro.c + sed -e 's;/etc/rpm/platform;%{l_prefix}/etc/openpkg/platform;g' \ + <lib/rpmrc.c >lib/rpmrc.c.n && \ + mv lib/rpmrc.c.n lib/rpmrc.c ( 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'" @@ -620,7 +624,8 @@ 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 \ @@ -664,6 +669,10 @@ >$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 @@ -753,11 +762,19 @@ <`SOURCE rc.8` \ >$RPM_BUILD_ROOT%{l_prefix}/man/man8/rc.8 - # adjust RPM configuration files + # create configuration directory + test -d $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 - test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg || \ - mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg sed -e "s:@l_prefix@:%{l_prefix}:g" \ <`SOURCE rpmrc` \ >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmrc @@ -801,6 +818,7 @@ %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 @@ -830,8 +848,7 @@ %{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 @@ -853,6 +870,7 @@ %{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 @@ . patch -p0 <<'@@ .' Index: openpkg-src/openpkg/platform ============================================================================ $ cvs diff -u -r0 -r1.1.2.1 platform --- /dev/null 2003-08-25 20:55:23.000000000 +0200 +++ platform 2003-08-25 20:55:23.000000000 +0200 @@ -0,0 +1,149 @@ +#!/bin/sh +## +## platform -- Provide Platform Identification +## Copyright (c) 2003 The OpenPKG Project <http://www.openpkg.org/> +## Copyright (c) 2003 Ralf S. Engelschall <[EMAIL PROTECTED]> +## Copyright (c) 2003 Cable & Wireless <http://www.cw.com/> +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + +# try to retrieve uname(3) information +UNAME_MACHINE=`(uname -m) 2>/dev/null` ||\ +UNAME_MACHINE=`(uname -p) 2>/dev/null` ||\ +UNAME_MACHINE='unknown' +UNAME_SYSTEM=`(uname -s) 2>/dev/null` ||\ +UNAME_SYSTEM='unknown' +UNAME_RELEASE=`(uname -r) 2>/dev/null` ||\ +UNAME_RELEASE=`(uname -v) 2>/dev/null` ||\ +UNAME_RELEASE='unknown' + +# initialize variables +A='unknown' +V='unknown' +S='unknown' +R='' + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}" in + + # FreeBSD/NetBSD/OpenBSD + *:FreeBSD:* | *:NetBSD:* | *:OpenBSD:* ) + A="${UNAME_MACHINE}" + case ${A} in + *[3456]86* ) A='ix86'; V='pc' ;; + alpha* ) V='compaq' ;; + sparc* ) V='sun' ;; + esac + S='freebsd' + R=`echo "${UNAME_RELEASE}" | sed -e 's/[-(].*$//'` + ;; + + # GNU/Linux + *:Linux:* ) + A="${UNAME_MACHINE}" + case ${A} in + i[3456]86 ) A='ix86'; V='pc' ;; + esac + S='gnulinux' + R=`echo "${UNAME_RELEASE}" | sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'` + for tagfile in dummy `cd /etc && echo *[_-]release *[_-]version 2>/dev/null`; do + test ! -f /etc/$tagfile && continue + S=`echo $tagfile | sed -e 's/[_-]release$//' -e 's/[_-]version$//' | tr '[A-Z]' '[a-z]'` + R=`cat /etc/$tagfile | grep '[0-9]' | head -1 |\ + sed -e 's/^/#/' \ + -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \ + -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \ + -e 's/^#[^0-9]*\([0-9][0-9]*\).*$/\1/' \ + -e 's/^#.*$//'` + done + ;; + + # Sun Solaris + *:SunOS:* ) + A="${UNAME_MACHINE}" + case ${A} in + i86pc ) A='ix86'; V='pc' ;; + sun4[cdm] ) A='sparc32'; V='sun' ;; + sun4u ) A='sparc64'; V='sun' ;; + sun* ) A='sparc64'; V='sun' ;; + esac + S='solaris' + R=`echo "${UNAME_RELEASE}" |\ + sed -e 's;^4\.;1.;' \ + -e 's;^5\.\([0-6]\).*;2.\1;' \ + -e 's;^5\.\([0-9][0-9]*\).*;\1;'` + ;; + + # HP Tru64 + *:OSF1:* ) + A="${UNAME_MACHINE}" + S='tru64' + R=`echo "${UNAME_RELEASE}" | sed -e 's;^V;;'` + R="$R.`uname -v`" + ;; + + # HP-UX + *:HP-UX:* ) + A="${UNAME_MACHINE}" + case "$A" in + 9000/31? | 9000/[34]?? ) + A=m68k + ;; + 9000/[678][0-9][0-9]) + A=hppa + if [ -f /usr/bin/getconf ]; then + sc_cpu_version=`(/usr/bin/getconf SC_CPU_VERSION) 2>/dev/null` + sc_kernel_bits=`(/usr/bin/getconf SC_KERNEL_BITS) 2>/dev/null` + case "$sc_cpu_version" in + 523 ) A=hppa1.0 ;; + 528 ) A=hppa1.1 ;; + 532 ) A=hppa2.0 + case "$sc_kernel_bits" in + 32) A=${A}n ;; + 64) A=${A}w ;; + esac + ;; + esac + fi + ;; + esac + S='hpux' + R=`echo "${UNAME_RELEASE}" | sed -e 's/[^.]*.[0B]*//'` + ;; + + # ...SOMETHING ELSE... + * ) + A=`echo "${UNAME_MACHINE}" |\ + sed -e 's/[ \\\/-]//g' |\ + tr '[A-Z]' '[a-z]'` + S=`echo "${UNAME_SYSTEM}" |\ + tr '[A-Z]' '[a-z]' |\ + sed -e 's/[^a-z0-9]//g'` + R=`echo "${UNAME_RELEASE}" |\ + sed -e 's/^/#/' \ + -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \ + -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \ + -e 's/^#[^0-9]*\([0-9][0-9]*\).*$/\1/' \ + -e 's/^#.*$//'` + ;; +esac + +# provide result platform identifier +echo "${A}-${V}-${S}${R}" + @@ . patch -p0 <<'@@ .' Index: openpkg-src/openpkg/rpm.patch.feature ============================================================================ $ cvs diff -u -r1.4.2.5 -r1.4.2.6 rpm.patch.feature --- openpkg-src/openpkg/rpm.patch.feature 25 Aug 2003 10:48:07 -0000 1.4.2.5 +++ openpkg-src/openpkg/rpm.patch.feature 25 Aug 2003 18:55:22 -0000 1.4.2.6 @@ -388,18 +388,51 @@ AC_SUBST(VENDORRPMRC_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. +| 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. Allow the +| hard-coded path to this program 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 4 Jun 2003 18:18:45 -0000 1.1.1.25 -+++ lib/rpmrc.c 24 Aug 2003 13:10:21 -0000 -@@ -1082,6 +1082,32 @@ ++++ lib/rpmrc.c 25 Aug 2003 18:38:25 -0000 +@@ -861,7 +861,11 @@ + + platpat = xrealloc(platpat, (nplatpat + 2) * sizeof(*platpat)); + /[EMAIL PROTECTED]@*/ ++#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; + /[EMAIL PROTECTED]@*/ +@@ -1062,7 +1066,15 @@ + int rc; + + while (!gotDefaults) { ++#ifdef OPENPKG ++ 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; @@ -432,7 +465,7 @@ #if !defined(__linux__) #ifdef SNI /* USUALLY un.sysname on sinix does start with the word "SINIX" -@@ -1298,6 +1324,7 @@ +@@ -1298,6 +1336,7 @@ } } # endif @@ -445,10 +478,13 @@ | 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 <prefix>/etc/openpkg/platform) is already +| correctly set internally. +--------------------------------------------------------------------------- Index: macros.in --- macros.in 2 Jul 2003 19:20:52 -0000 1.1.1.14 -+++ macros.in 25 Aug 2003 09:04:54 -0000 ++++ 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. # @@ -458,6 +494,23 @@ # # 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 @[EMAIL PROTECTED] +-%_host_cpu @host_cpu@ +-%_host_vendor @host_vendor@ +-%_host_os @host_os@ ++#%_host @host@ ++#%_host_alias @[EMAIL PROTECTED] ++#%_host_cpu @host_cpu@ ++#%_host_vendor @host_vendor@ ++#%_host_os @host_os@ + %_target %{_host} + %_target_alias %{_host_alias} + %_target_cpu %{_host_cpu} +--------------------------------------------------------------------------- | Revert back to the old behaviour of passing to "exec" programs an @@ . patch -p0 <<'@@ .' Index: openpkg-src/openpkg/rpmmacros ============================================================================ $ cvs diff -u -r1.40.2.1 -r1.40.2.2 rpmmacros --- openpkg-src/openpkg/rpmmacros 23 Aug 2003 12:14:36 -0000 1.40.2.1 +++ openpkg-src/openpkg/rpmmacros 25 Aug 2003 18:55:22 -0000 1.40.2.2 @@ -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@ @@ -155,6 +202,9 @@ %_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 %l_rpm %{l_prefix}/bin/rpm @@ -295,8 +345,8 @@ 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}\"\ @@ . ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List [EMAIL PROTECTED]