Bug 7584

Summary: %defines enclosed by %ifarch executed unconditionally
Product: [Retired] Red Hat Linux Reporter: Dale Elisabeth Atems <atems>
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED DUPLICATE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-12-16 20:24:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dale Elisabeth Atems 1999-12-04 19:30:31 UTC
In rpm-3.0.3-2, %defines inside successive %ifarch blocks are executed
regardless of whether the conditional is satisfied. The following excerpt
results in HOSTTYPE=alpha-pc-linux and SOUND=none on an i386:

%build

%ifarch i386
%define HOSTTYPE i386-pc-linux
%define SOUND native
%endif

%ifarch sparc
%define HOSTTYPE sparc-unknown-linux
%define SOUND none
%endif

%ifarch alpha
%define HOSTTYPE alpha-pc-linux
%define SOUND none
%endif

# Delete the originals for the patched files
find . -name "*.orig" -exec rm {} \;

./configure %{HOSTTYPE} --with-dialogs=athena  --with-sound=%{SOUND} \
            --cflags="$RPM_OPT_FLAGS" --error-checking=none          \
            --debug=no --prefix=/usr --lockdir=/var/lock/xemacs      \
            --with-session=yes


If executed on an i386, configuration proceeds for an alpha-pc-linux.
Echo statements placed inside the %ifarch sparc and %ifarch alpha blocks do
not execute, however.

Comment 1 Jeff Johnson 1999-12-16 20:23:59 UTC
I'm resisting adding support for %define within %ifarch because I believe
that %ifarch is the wrong way to package. Meanwhile, here's a nearly
equivalent snippet of code that will probably work for you:

%build

%ifarch i386
SOUND=native
%else
SOUND=none
%endif

# Delete the originals for the patched files
find . -name "*.orig" -exec rm {} \;

./configure %{_target_platform} --with-dialogs=athena  --with-sound=${SOUND} \
             --cflags="$RPM_OPT_FLAGS" --error-checking=none          \
             --debug=no --prefix=/usr --lockdir=/var/lock/xemacs      \
             --with-session=yes

Comment 2 Jeff Johnson 1999-12-16 20:24:59 UTC
*** This bug has been marked as a duplicate of 5364 ***