I have the following problem: In the %prep, I run a command that returns a value. I want to be able to use this value in the %build.

I was not able to do it with macros, because %global gets its value on init, and %declare is executed when called. I also wasn't able to use bash parameters because they are not shared between %prep and %build.

I have 2 workarounds: Do all in %prep, or save the value to a file. I'm not comfortable with any of these workarounds.

This seems to be a simple task. Am I missing something?

  • Why can't %prep finish the prep? – Ignacio Vazquez-Abrams Aug 11 '13 at 8:45
  • It does. But I need a value from the %prep in the %build. – Eran Ben-Natan Aug 11 '13 at 8:52
  • Then why isn't the value being generated in %build? – Ignacio Vazquez-Abrams Aug 11 '13 at 8:54
  • Because logically the process that creates this value belongs to the %prep – Eran Ben-Natan Aug 12 '13 at 13:48

I do not believe this is possible. I found this Q&A on Stackoverflow titled: Reassing values to %define variables in spec file - RPM, which stated this fact in several ways.

In searching I found only the method you mentioned of writing data to temporary files, using mktemp for example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.