Ask Your Question

How to remove references to %{buildroot} from binary files in a build root?

asked 2017-01-11 08:46:26 +0000

BH2017 gravatar image

updated 2017-01-14 17:41:22 +0000

mattdm gravatar image

I know how to remove references of %{buildroot} in my package's text files, namely using a find command like:

find %{buildroot}%{_libexecdir} \
  -name "*.pc" -exec sed -i -e 's|%{buildroot}||g' '{}' \; \
  -or -name "*.py" -exec sed -i -e 's|%{buildroot}||g' '{}' \; \
  -or -name "*.py.orig" -exec sed -i -e 's|%{buildroot}||g' '{}' \; \
  -or -name "python-config" -exec sed -i -e 's|%{buildroot}||g' '{}' \; \
  -or -name "Makefile" -exec sed -i -e 's|%{buildroot}||g' '{}' \;

but the problem is that what one does when binary files contain references to %{buildroot}? I suspect if an answer (besides it's impossible) exists it will involve binutils. If it is impossible please give me a method of turning off the %{buildroot} reference check, preferably in a way I can use in the Open Build Service (OBS).

edit retag flag offensive close merge delete


Can you share the spec file? I can help you...

davidva ( 2017-01-13 06:46:42 +0000 )edit

Its source files (including the spec file and patch) can be found here.

BH2017 ( 2017-01-13 09:07:47 +0000 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-01-14 01:16:00 +0000

updated 2017-01-14 07:50:20 +0000

But It includes a bundle python 2.7! why? and symlink with the official python maybe works. Here some changes in the spec file

edit flag offensive delete link more


Thanks, but how do I get it to build for both x86 and x86_64?

BH2017 ( 2017-01-14 15:23:54 +0000 )edit

A conditional task ;)

%ifarch x86_64
davidva ( 2017-01-14 16:42:51 +0000 )edit

I had tried something similar to that and it failed. Then I tried that (with another similar conditional in the %prep section as the source directory is dependent on architecture too) exactly and it failed. As you can see here it only seems to download the x86 tarball for some reason...

BH2017 ( 2017-01-14 17:26:02 +0000 )edit

Nvm I corrected it by editing my _service file.

BH2017 ( 2017-01-14 17:57:35 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Use your votes!

  • Use the 30 daily voting points that you get!
  • Up-vote well framed questions that provide enough information to enable people provide answers.
  • Thank your helpers by up-voting their comments and answers. If a question you asked has been answered, accept the best answer by clicking on the checkbox on the left side of the answer.
  • Down-voting might cost you karma, but you should consider doing so for incorrect or clearly detrimental questions and answers.

Question Tools

1 follower


Asked: 2017-01-11 08:46:26 +0000

Seen: 73 times

Last updated: Jan 14