On 2/15/06, Lakshmi V <lakshmi granger gmail com> wrote:
Hi all
I have got a macro in my spec file
%{!?myloc: %{expand: %%define myloc loc1}}
I am using this in my %install section
mkdir -p $RPM_BUILD_ROOT/scratch/%{myloc}
cp /scratch/tmp/readme.txt $RPM_BUILD_ROOT/scratch/%{myloc}/read_me.txt
chmod 777 $RPM_BUILD_ROOT/scratch/%{myloc}/read_me.txt
Now while buiding if I give
rpmbuild -ba myspec.spec --define 'myloc loc2'
it replaces the myloc correctly and the rpm is built with
/scratch/loc2/read_me.txt entries, but when I want to do the same thing
during install, it doesnt respond to the --define part at all. Will the
--define not work with rpm -ivh ? because the rpm is already built with
the myloc substituted with loc2 ?
Yes, that's exactly why. The %install section is processed during
the build phase and the resulting rpms (except for the .src.rpm) have
no access to it.
Is there any workaround ?
I'm not sure what the recomended procedure is but you could just define an environment variable and access it in a %post script.