From 2a8d03669732f68f02fa7b21ec87ee3f65d11e5b Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 25 Mar 2011 14:39:36 +0200 Subject: [PATCH] Push platform config out of main rpm macros file - canon arch & color stuff is now calculated per each known arch in installplatform, and just a single place where arch name mangling is done --- Makefile.am | 5 ++++- configure.ac | 28 --------------------------- installplatform | 60 +++++++++++++++++++++++++++++++++++++++------------------ macros.in | 23 ---------------------- platform.in | 8 ++++++++ 5 files changed, 53 insertions(+), 71 deletions(-) diff --git a/Makefile.am b/Makefile.am index 053236d..a93d66b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -228,7 +228,10 @@ install-exec-hook: @LN_S@ ../../bin/rpm $(DESTDIR)$(bindir)/rpmverify install-data-local: - DESTDIR="$(DESTDIR)" pkglibdir="$(rpmconfigdir)" $(SHELL) $(top_srcdir)/installplatform rpmrc macros platform + DESTDIR="$(DESTDIR)" pkglibdir="$(rpmconfigdir)" \ + $(SHELL) $(top_srcdir)/installplatform \ + rpmrc platform \ + $(RPMCANONVENDOR) $(RPMCANONOS) $(RPMCANONGNU) @$(MKDIR_P) $(DESTDIR)$(localstatedir)/tmp # XXX to appease distcheck we need to remove "stuff" here... diff --git a/configure.ac b/configure.ac index 4d2147a..ee891af 100644 --- a/configure.ac +++ b/configure.ac @@ -777,32 +777,6 @@ for reqscript in ${host_cpu}-${host_os_exact}.req ${host_os_exact}.req ${host_os fi } done -dnl Determine the canonical arch-vendor-os for the host machine -case "${host_cpu}" in -*86) RPMCANONCOLOR=0; RPMCANONARCH=i386 ;; -ia32e*) RPMCANONCOLOR=3; RPMCANONARCH=ia32e ;; -amd64*) RPMCANONCOLOR=3; RPMCANONARCH=amd64 ;; -x86_64*) RPMCANONCOLOR=3; RPMCANONARCH=x86_64 ;; -alpha*) RPMCANONCOLOR=0; RPMCANONARCH=alpha ;; -sparc64*) RPMCANONCOLOR=3; RPMCANONARCH=sparc64 ;; -sparc*) RPMCANONCOLOR=3; RPMCANONARCH=sparc ;; -ia64*) RPMCANONCOLOR=2; RPMCANONARCH=ia64 ;; -s390x*) RPMCANONCOLOR=3; RPMCANONARCH=s390x ;; -s390*) RPMCANONCOLOR=0; RPMCANONARCH=s390 ;; -powerpc64*|ppc64*) RPMCANONCOLOR=3; RPMCANONARCH=ppc64 ;; -powerpc*|ppc*) RPMCANONCOLOR=0; RPMCANONARCH=ppc ;; -arm*) RPMCANONCOLOR=0; RPMCANONARCH=arm ;; -mipsel*) RPMCANONCOLOR=0; RPMCANONARCH=mipsel ;; -mips*) RPMCANONCOLOR=0; RPMCANONARCH=mips ;; -m68k*) RPMCANONCOLOR=0; RPMCANONARCH=m68k ;; -sh3*) RPMCANONCOLOR=0; RPMCANONARCH=sh3 ;; -sh4*) RPMCANONCOLOR=0; RPMCANONARCH=sh4 ;; -*) RPMCANONCOLOR=0; RPMCANONARCH=unknown ;; -esac -case "${host_os_noversion}" in -mint) RPMCANONARCH=m68kmint ;; -esac - dnl permit overriding build_vendor for "canonical rpm vendor" RPMCANONVENDOR="$build_vendor" AC_ARG_WITH([vendor], @@ -812,8 +786,6 @@ AC_DEFINE_UNQUOTED([RPMCANONVENDOR],["${RPMCANONVENDOR}"],[canonical vendor]) RPMCANONOS="$host_os_noversion" RPMCANONGNU="$host_os_gnu" -AC_SUBST(RPMCANONCOLOR) -AC_SUBST(RPMCANONARCH) AC_SUBST(RPMCANONVENDOR) AC_SUBST(RPMCANONOS) AC_SUBST(RPMCANONGNU) diff --git a/installplatform b/installplatform index d16e535..c89c5f0 100755 --- a/installplatform +++ b/installplatform @@ -5,18 +5,12 @@ pkglibdir="${pkglibdir:-/usr/lib/rpm}" platformdir="${pkglibdir}/platform" RPMRC="${1:-rpmrc}" -MACROS="${2:-macros}" -PLATFORM="${3:-platform}" +PLATFORM="${2:-platform}" +VENDOR="${3}" +OS="${4}" +RPMRC_GNU="${5}" -RPM="./rpm --rcfile=$RPMRC --macros=$MACROS" - -canonarch_sed='s_i.86_i386_;s_pentium[34]_i386_;s_athlon_i386_;s_sparc[^-]*_sparc_;s_alpha[^-]*_alpha_;s_arm[^-]*_arm_;s_\(powerpc\|ppc\)[^-]*_ppc_;s,\(ia32e\|amd64\),x86_64,;s_sh4a_sh4_' -arch="`$RPM --eval '%{_arch}'|sed -e "$canonarch_sed"`" -VENDOR="`$RPM --eval '%{_vendor}'`" -OS="`$RPM --eval '%{_os}'`" -RPMRC_GNU="`$RPM --eval '%{_gnu}'`" - -for ARCH in `grep ^arch_canon $RPMRC | cut -d: -f2`; do +for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do RPMRC_OPTFLAGS="`sed -n 's/^optflags: '$ARCH' //p' $RPMRC`" RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`" case $RPMRC_OPTFLAGS in @@ -37,59 +31,91 @@ for ARCH in `grep ^arch_canon $RPMRC | cut -d: -f2`; do # consult various arch folks for correct names etc. ISANAME= ISABITS= + CANONARCH= + CANONCOLOR= + FILTER=cat case "${ARCH}" in sparc64*) ISANAME=sparc ISABITS=64 + CANONARCH=sparc64 + CANONCOLOR=3 ;; sparc*) ISANAME=sparc ISABITS=32 + CANONARCH=sparc + CANONCOLOR=0 ;; s390) ISANAME=s390 ISABITS=32 + CANONARCH=s390 + CANONCOLOR=0 ;; s390x) ISANAME=s390 ISABITS=64 + CANONARCH=s390x + CANONCOLOR=3 ;; ppc64*) ISANAME=ppc ISABITS=64 + CANONARCH=ppc64 + CANONCOLOR=3 ;; ppc*) ISANAME=ppc ISABITS=32 + CANONARCH=ppc + CANONCOLOR=0 ;; i?86|pentium?|athlon|geode) ISANAME=x86 ISABITS=32 + CANONARCH=i386 + CANONCOLOR=0 ;; x86_64|amd64|ia32e) ISANAME=x86 ISABITS=64 + CANONARCH=x86_64 + CANONCOLOR=3 ;; ia64) ISANAME=ia ISABITS=64 + CANONARCH=ia64 + CANONCOLOR=2 ;; sh*) ISANAME=sh ISABITS=32 + CANONARCH=${ARCH} + CANONCOLOR=0 ;; arm*) ISANAME=`echo ${ARCH} | sed "s/^\([^-]*\)-.*/\1/"` ISABITS=32 + CANONARCH=arm + CANONCOLOR=0 ;; alpha*) ISANAME=alpha ISABITS=64 + CANONARCH=alpha + CANONCOLOR=0 + ;; + noarch) + CANONARCH=noarch + CANONCOLOR=0 + FILTER="grep -v -E '^(%optflag|%__isa)'" ;; esac # skip architectures for which we dont have full config parameters - [ -z "$ISANAME" ] && continue + [ -z "$CANONARCH" ] && continue CANONARCH="`echo $ARCH|sed -e "$canonarch_sed"`" @@ -98,7 +124,8 @@ for ARCH in `grep ^arch_canon $RPMRC | cut -d: -f2`; do cat $PLATFORM \ | sed -e "s,@RPMRC_OPTFLAGS@,$RPMRC_OPTFLAGS," \ - -e "s,$arch,$CANONARCH," \ + -e "s,@RPMCANONARCH@,$CANONARCH,g" \ + -e "s,@RPMCANONCOLOR@,$CANONCOLOR," \ -e "s,@RPMRC_GNU@,$RPMRC_GNU," \ -e "s,@LIB@,$LIB," \ -e "s,@ARCH_INSTALL_POST@,$ARCH_INSTALL_POST," \ @@ -107,12 +134,7 @@ for ARCH in `grep ^arch_canon $RPMRC | cut -d: -f2`; do -e "s,@ISABITS@,$ISABITS," \ -e "s,^@${VENDOR}@,," \ | grep -v '^@' \ + | ${FILTER} \ > ${PPD}/macros done - -{ cd ${DESTDIR}/${platformdir} - [ -L noarch-${OS} ] && rm -f noarch-${OS} 2>/dev/null - mkdir -p noarch-${OS} - sed -e "/^%_arch/s,${arch},noarch," ${arch}-${OS}/macros | grep -v '^%optflags' | grep -v "^%__isa" > noarch-${OS}/macros -} diff --git a/macros.in b/macros.in index 702421e..ca38db1 100644 --- a/macros.in +++ b/macros.in @@ -585,13 +585,6 @@ print (t)\ # XXX Note: escaped %% for use in headerSprintf() %_build_name_fmt %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm -# The default transaction color. This value is a set of bits to -# determine file and dependency affinity for this arch. -# 0 uncolored (i.e. use only arch as install hint) -# 1 Elf32 permitted -# 2 Elf64 permitted -%_transaction_color @RPMCANONCOLOR@ - # Verify digest/signature flags for various rpm modes: # 0x30300 (_RPMVSF_NODIGESTS) --nohdrchk if set, don't check digest(s) # 0xc0c00 (_RPMVSF_NOSIGNATURES) --nosignature if set, don't check signature(s) @@ -635,22 +628,6 @@ print (t)\ # Default path to the file used for transaction fcntl lock. %_rpmlock_path %{_dbpath}/.rpm.lock -#============================================================================== -# ---- per-platform macros. -# Macros that are specific to an individual platform. The values here -# will be used if the per-platform macro file does not exist.. -# -%_arch @RPMCANONARCH@ -%_build_arch @RPMCANONARCH@ -%_vendor @RPMCANONVENDOR@ -%_os @RPMCANONOS@ -%_gnu @RPMCANONGNU@ -%_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}%{?_gnu} - -# -# Define a generic value for optflags. Normally overridden by per-target macros. -%optflags -O2 - # # ISA dependency marker, none for noarch and name-bitness for others %_isa %{?__isa:(%{__isa})}%{!?__isa:%{nil}} diff --git a/platform.in b/platform.in index 384f415..45c65a5 100644 --- a/platform.in +++ b/platform.in @@ -4,6 +4,7 @@ # ---- per-platform macros. # %_arch @RPMCANONARCH@ +%_build_arch @RPMCANONARCH@ %_vendor @RPMCANONVENDOR@ %_os @RPMCANONOS@ %_gnu @RPMRC_GNU@ @@ -14,6 +15,13 @@ %__isa_bits @ISABITS@ %__isa %{__isa_name}-%{__isa_bits} +# The default transaction color. This value is a set of bits to +# determine file and dependency affinity for this arch. +# 0 uncolored (i.e. use only arch as install hint) +# 1 Elf32 permitted +# 2 Elf64 permitted +%_transaction_color @RPMCANONCOLOR@ + #============================================================================== # ---- configure macros. # -- 2.7.4