Re: user defined macros in RPMS ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/11/07, Lis Maria <lismariain@xxxxxxxxx> wrote:
Hi

I am having a doubt about the user defined macros in RPMS.

I believe we can create our own macros in the .rpmmacros file. So i did
create a macro called %_user_switch  xxxx in the .rpmmacros file. Now i am
using this macro in the spec file's
%pre section as

  su %{_user_switch}

Now before firing rpm -Uvh,  i am redefining this macro at the command line
as  rpm --define '_user_switch yyyy'

Now if i try to install my rpm, it is installing the files as xxxx itself
....

Is there any other way i can redefine a macro for rpm install ?
The short answer is no.  Here is the lengthy explanation.

Macros are filled in at build time, such that after you have build
your rpm %{_user_switch} is now "xxxx", and thats what you will have
at install time.

Simple test to see this, do an:

  rpm -qp --scripts $path_to_your_newly_built_package

and note that there are no macros anymore (unless of course a macro
was undefined, and then rpm will leave it, but it still will not get
expanded at install time).

Being to provide install time macros is at least on one of the forks
of rpm's radar, and whether that is good or bad is in the eye of the
beholder.

So what you really want to do instead is use some sort of a config
file of your own, but remember that can be as simple as sourcing in a
shell script that defines variables (this has plusses and
minues...YMMV).

At rate, good luck...james

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux