I was once work on packaging things into rpm and sometimes I want to evaluate a rpm spec expression just as python has a shell …
Name: dummy
Version: 0.0.0
Release: 1
License: GPLv2
Group: Dummy
Summary: Dummy
%description
Dummy
%prep
%if "1" == "1" && "0" != "0" || "0" == "0"
%define xxxx %(echo whatx)
%endif
%define yyyy %(echo whaty)
%if "$(uname -r)" == "2.6.9-89.EL"
echo %{xxxx}
%endif
prep
section. Evaluate it withrpmbuild -bp x.spec
another very useful tool is rpmrebuild, which can be used to edit package spec file on the fly.