RPM build spec help

Sam Varshavchik mrsam at courier-mta.com
Mon Mar 5 23:44:51 UTC 2007


Dan Track writes:

> Hi
> 
> I hope someone can help. Basically I want to access an environment
> variable and place it in my  macro in my spec file.
> 
> If I try to define a macro like the following:
> 
> %define oracle_home $ORACLE_HOME
> 
> and then try to build it "rpmbuild -ba perl-DBD-Oracle"
> 
> I get the following error:
> error: line 18: Dependency tokens must begin with alpha-numeric, '_'
> or '/': BuildRequires: $ORACLE_HOME/lib/libclntsh.so
> 
> On line 18 I have the following:
> BuildRequires: %{oracle_home}/lib/libclntsh.so
> 
> Any ideas how I can resolve this?

%{expand:%%define oracle_home %(echo $ORACLE_HOME)}

However, this is considered to be bad practice.  RPM build specs should not 
depend on the parent environment, because they won't be reproducible.  The 
correct way to do this is:

1) You should install Oracle via rpm.  Create an rpm package for Oracle, if 
necessary

2) Then, your BuildRequires becomes simply "BuildRequires: oracle"

3) Then, your %prep, %build, and %install sections would initialize 
ORACLE_HOME accordingly (use the same snippet in all three cases).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20070305/06bc2d9b/attachment-0001.sig>


More information about the fedora-list mailing list