1

The spec file is present inside the source directory. The specfile build section looks like

%build cd ~/path/sources make 

If the spec file path can be detected then the hardcoding of the ~/path/sources can be avoided. How to get the spec file path.

2 Answers 2

1
%{_specdir} /${name}.spec 

will do the job. See this Fedora Wiki Page for more information.

2
  • Please consider expanding more on your answers which paraphrase links rather than just putting a link. Commented Aug 31, 2016 at 16:07
  • 1
    Note that the %{_specdir} macro will redirect to %{_topdir}/SPECS/, which by default is ~/rpmbuild/SPECS/. Not sure if that is what the OP was looking for. Commented Feb 2, 2019 at 14:02
0

The path is often derived from the process itself. If you look at the output of the build process, you'll see it CDing into various directories as it prepares for another phase of the process.

Simply, if you change the absolute paths to a relative path (and your source files should all be in the payload of your SRPM or moved into a source tree before building if this is a new build) then much of these problems will happily go away.

Also, using an echo in the %prep section, look at stupid pet tricks like

%prep echo %(dirname %{Source0}) echo %(basename %{S:1})

When you are absolutely sure you definitely need to do such horror, that kind of mess will come in handy. Keep it as a rarity if you can.

Someone better than me: If you see this post, remind me how to make it ONLY resolve that %() once, and not every time it needs it?

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.