Ask Your Question

Is it possible to move the ~/rpmbuild directory?

asked 2017-09-08 06:38:57 -0500

Sven gravatar image

I'm trying to build some rpm packages. I have a spec file, which I'm building with rpmbuild. Unfortuantely I only have limited space in my /home, so I'd like to have the ~/rpmbuild directory in a different place. Is this possible?

The tool accepts a --root and --buildroot parameter, though I don't think it achieves what I want.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-09-08 10:16:46 -0500

villykruse gravatar image

Is is all defined by the rpm macros:

Add the following line to ~/.rpmmacros ( that is the file .rpmmacros in your home directory).

%_topdir /home/data/rpmbuild

Replacing the word /home/data/rpmbuild by the desired location.

If the file ~/.rpmmacros does not exist, just create it.

edit flag offensive delete link more


If you want to make that permanent, simply create a directory on a partition with ample space, make sure the permissions are correct and then make ~/rpmbuild a link to that directory. Yes, it's a bit more work but it doesn't get nuked if something happens to ~/.rpmmacros.

sideburns gravatar imagesideburns ( 2017-09-08 15:10:07 -0500 )edit

answered 2017-09-08 09:42:15 -0500

Sven gravatar image

The question was answered in #fedora-devel on Freenode. For future reference, here's the solution:

Invoke rpmbuild with rpmbuild -D "_topdir $BUILD_DIR" .... This overwrites an internal variable and achieves what I described above.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-09-08 06:38:57 -0500

Seen: 412 times

Last updated: Sep 08 '17