5

I have a spec file which unpacks a library which is deployed at location which is exported in the shell.

ie

%file
${AXIS2_C}/bin/services/services.xml

This fails with :

error: File not found: root/rpmbuild/BUILDROOT/i386/${AXIS2_C}/bin/services/services.xml

I.e the shell variable does not get expanded. Is there any way around this ?

Thanks!

2 Answers 2

7

Unfortunately, anything defined in the shell started by the %prep, %build or %install sections isn't preserved in the build environment. You'd need to define %{AXIS2_C}, a MACRO variable (not a shell variable):

%define AXIS2_C /usr/local/something

and then refer to it in both your shells as

make whatever FOO=%{AXIS2_C} # or however you used the env variable

and then in the %files section, use

%file
%{AXIS2_C}/bin/services/services.xml

Usually, the initial %define is at the top of the spec file, with some documentation about what it is for. If you need to dynamically set the macro, you'll have to use more complex RPM spec macro commands like %() to do shell expansions.

2
  • 1
    Cheers! This got it done. %define AXISHOME %(echo ${AXIS2C_HOME})
    – Ricko M
    Commented Jan 31, 2011 at 15:10
  • %file %AXISHOME/blah.xml
    – Ricko M
    Commented Jan 31, 2011 at 15:18
0

What happens if you do not enclosure it in { }, and only use " "

%file
"$AXIS2_C"/bin/services/services.xml

(or even without " " at all)

1
  • 1
    Tried and failed :(
    – Ricko M
    Commented Jan 28, 2011 at 17:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .