Re: rpmbuild

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

 




On Jul 6, 2006, at 2:44 PM, hmiller@xxxxxxxxxx wrote:

How do you get environment variables into an rpmbuild command?

I have a need to do that, and I have tried using environment variables in the
~/.rpmmacros file with limited success.

I have an environment variable that knows the version of the software I am building. It is named SW_VERSION. In the ~/.rpmmacros, I added this line:

%version $SW_VERSION

In my specfile I have the following:

Version: %{version}

When I do the rpmbuild command, the Version appears to be handled correctly until rpmbuild writes the package file. In the package file, the name of the package includes the name of the environment variable (SW_VERSION) instead of
the value in the environment variable (in this case, 3.2.0).

Since I call rpmbuild from a makefile, I have the makefile generate a new ~/.rpmmacros file every time where I hard-code the version instead of using the environment variable. Is that the best I can do, or is there a way for
~/.rpmmacros to use an environment variable?

Hope I made that clear.


There is no shell environment on the pathway that generates an output file name within rpmbuild.

I.e. theshell  environment is never looked at.

If you absolutely categorically adamantly insist on using environment variables for rpmbuild, try
    %myversion %(echo $SW_VERSION)
...
    Version: %{myversion}
to supply a shell context for examining the environment.

Note the change from %version to %myversion to avoid another surprise.

73 de Jeff

_______________________________________________
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