Bug 7584 - %defines enclosed by %ifarch executed unconditionally
Summary: %defines enclosed by %ifarch executed unconditionally
Keywords:
Status: CLOSED DUPLICATE of bug 5364
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm
Version: 6.1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-12-04 19:30 UTC by Dale Elisabeth Atems
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 1999-12-16 20:24:59 UTC


Attachments (Terms of Use)

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 ***


Note You need to log in before you can comment on or make changes to this bug.